@rightkit/document-workspace 0.0.0-stage → 0.1.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.
- package/CHANGELOG.md +11 -0
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +74 -2
- package/dist/app/App.d.ts +1 -0
- package/dist/app/App.js +6 -0
- package/dist/app/AppDialogs.d.ts +52 -0
- package/dist/app/AppDialogs.js +23 -0
- package/dist/app/AppDialogsHost.d.ts +31 -0
- package/dist/app/AppDialogsHost.js +30 -0
- package/dist/app/AppLifecycle.d.ts +19 -0
- package/dist/app/AppLifecycle.js +87 -0
- package/dist/app/AppProvider.d.ts +317 -0
- package/dist/app/AppProvider.js +217 -0
- package/dist/app/AppRoot.d.ts +8 -0
- package/dist/app/AppRoot.js +159 -0
- package/dist/app/AppShell.d.ts +2 -0
- package/dist/app/AppShell.js +81 -0
- package/dist/app/CommandPalette.d.ts +13 -0
- package/dist/app/CommandPalette.js +47 -0
- package/dist/app/DocActionBar.d.ts +36 -0
- package/dist/app/DocActionBar.js +300 -0
- package/dist/app/DocumentContextMenu.d.ts +29 -0
- package/dist/app/DocumentContextMenu.js +122 -0
- package/dist/app/DocumentPane.d.ts +52 -0
- package/dist/app/DocumentPane.js +30 -0
- package/dist/app/DocumentRouterTable.d.ts +58 -0
- package/dist/app/DocumentRouterTable.js +143 -0
- package/dist/app/ErrorBoundary.d.ts +12 -0
- package/dist/app/ErrorBoundary.js +16 -0
- package/dist/app/FindBar.d.ts +12 -0
- package/dist/app/FindBar.js +199 -0
- package/dist/app/LiveTitle.d.ts +14 -0
- package/dist/app/LiveTitle.js +14 -0
- package/dist/app/OpeningProgress.d.ts +13 -0
- package/dist/app/OpeningProgress.js +21 -0
- package/dist/app/PrintPreviewWindow.d.ts +2 -0
- package/dist/app/PrintPreviewWindow.js +57 -0
- package/dist/app/ShortcutHelp.d.ts +3 -0
- package/dist/app/ShortcutHelp.js +99 -0
- package/dist/app/Sidebar.d.ts +36 -0
- package/dist/app/Sidebar.js +121 -0
- package/dist/app/ToastViewport.d.ts +1 -0
- package/dist/app/ToastViewport.js +31 -0
- package/dist/app/Toolbar.d.ts +26 -0
- package/dist/app/Toolbar.js +63 -0
- package/dist/app/activeFormatSavers.d.ts +7 -0
- package/dist/app/activeFormatSavers.js +4 -0
- package/dist/app/clipboardPaths.d.ts +1 -0
- package/dist/app/clipboardPaths.js +31 -0
- package/dist/app/documentDrafts.d.ts +17 -0
- package/dist/app/documentDrafts.js +104 -0
- package/dist/app/draftResolution.d.ts +5 -0
- package/dist/app/draftResolution.js +25 -0
- package/dist/app/markdownPaletteActions.d.ts +8 -0
- package/dist/app/markdownPaletteActions.js +107 -0
- package/dist/app/resourceCensusDev.d.ts +41 -0
- package/dist/app/resourceCensusDev.js +518 -0
- package/dist/app/setupRecovery.d.ts +34 -0
- package/dist/app/setupRecovery.js +70 -0
- package/dist/app/shell/DocStatsPill.d.ts +18 -0
- package/dist/app/shell/DocStatsPill.js +32 -0
- package/dist/app/shell/DocumentTools.d.ts +9 -0
- package/dist/app/shell/DocumentTools.js +73 -0
- package/dist/app/shell/InfoInspector.d.ts +9 -0
- package/dist/app/shell/InfoInspector.js +67 -0
- package/dist/app/shell/StartPage.d.ts +9 -0
- package/dist/app/shell/StartPage.js +49 -0
- package/dist/app/shell/readEdit.d.ts +6 -0
- package/dist/app/shell/readEdit.js +6 -0
- package/dist/app/sidebar/SidebarDocumentMenu.d.ts +20 -0
- package/dist/app/sidebar/SidebarDocumentMenu.js +56 -0
- package/dist/app/sidebar/SidebarExpandedPanel.d.ts +9 -0
- package/dist/app/sidebar/SidebarExpandedPanel.js +78 -0
- package/dist/app/sidebar/SidebarIcons.d.ts +3 -0
- package/dist/app/sidebar/SidebarIcons.js +18 -0
- package/dist/app/sidebar/SidebarMenus.d.ts +19 -0
- package/dist/app/sidebar/SidebarMenus.js +64 -0
- package/dist/app/sidebar/SidebarPathUtils.d.ts +10 -0
- package/dist/app/sidebar/SidebarPathUtils.js +55 -0
- package/dist/app/sidebar/SidebarPrimitives.d.ts +12 -0
- package/dist/app/sidebar/SidebarPrimitives.js +45 -0
- package/dist/app/sidebar/SidebarRail.d.ts +5 -0
- package/dist/app/sidebar/SidebarRail.js +37 -0
- package/dist/app/sidebar/explorer/ExplorerRowMenu.d.ts +21 -0
- package/dist/app/sidebar/explorer/ExplorerRowMenu.js +37 -0
- package/dist/app/sidebar/explorer/ExplorerSections.d.ts +16 -0
- package/dist/app/sidebar/explorer/ExplorerSections.js +259 -0
- package/dist/app/sidebar/explorer/ExplorerTree.d.ts +46 -0
- package/dist/app/sidebar/explorer/ExplorerTree.js +387 -0
- package/dist/app/sidebar/explorer/explorerState.d.ts +37 -0
- package/dist/app/sidebar/explorer/explorerState.js +135 -0
- package/dist/app/tabMountPolicy.d.ts +45 -0
- package/dist/app/tabMountPolicy.js +104 -0
- package/dist/app/tabWarmOrder.d.ts +7 -0
- package/dist/app/tabWarmOrder.js +48 -0
- package/dist/app/tabs/TabFuseCurves.d.ts +3 -0
- package/dist/app/tabs/TabFuseCurves.js +15 -0
- package/dist/app/tabs/TabOverview.d.ts +24 -0
- package/dist/app/tabs/TabOverview.js +121 -0
- package/dist/app/tabs/TabStrip.d.ts +42 -0
- package/dist/app/tabs/TabStrip.js +380 -0
- package/dist/app/tabs/tabIds.d.ts +5 -0
- package/dist/app/tabs/tabIds.js +7 -0
- package/dist/app/tabs/useTabDirty.d.ts +3 -0
- package/dist/app/tabs/useTabDirty.js +11 -0
- package/dist/app/useAppChromeState.d.ts +21 -0
- package/dist/app/useAppChromeState.js +48 -0
- package/dist/app/useAppCommands.d.ts +66 -0
- package/dist/app/useAppCommands.js +71 -0
- package/dist/app/useAppDocumentCore.d.ts +210 -0
- package/dist/app/useAppDocumentCore.js +40 -0
- package/dist/app/useAppEffects.d.ts +18 -0
- package/dist/app/useAppEffects.js +52 -0
- package/dist/app/useAppPaneSearch.d.ts +37 -0
- package/dist/app/useAppPaneSearch.js +74 -0
- package/dist/app/useAppShellSetup.d.ts +40 -0
- package/dist/app/useAppShellSetup.js +52 -0
- package/dist/app/useAppSlots.d.ts +28 -0
- package/dist/app/useAppSlots.js +40 -0
- package/dist/app/useAppTabChrome.d.ts +51 -0
- package/dist/app/useAppTabChrome.js +66 -0
- package/dist/app/useAutoSave.d.ts +34 -0
- package/dist/app/useAutoSave.js +116 -0
- package/dist/app/useCloseAll.d.ts +52 -0
- package/dist/app/useCloseAll.js +295 -0
- package/dist/app/useClosedTabEviction.d.ts +10 -0
- package/dist/app/useClosedTabEviction.js +38 -0
- package/dist/app/useCommandPalette.d.ts +44 -0
- package/dist/app/useCommandPalette.js +254 -0
- package/dist/app/useCrossDocSearch.d.ts +7 -0
- package/dist/app/useCrossDocSearch.js +94 -0
- package/dist/app/useDistractionFree.d.ts +21 -0
- package/dist/app/useDistractionFree.js +73 -0
- package/dist/app/useDocumentCreation.d.ts +18 -0
- package/dist/app/useDocumentCreation.js +63 -0
- package/dist/app/useDocumentDirty.d.ts +31 -0
- package/dist/app/useDocumentDirty.js +46 -0
- package/dist/app/useDocumentLoader.d.ts +55 -0
- package/dist/app/useDocumentLoader.js +267 -0
- package/dist/app/useDocumentOutputActions.d.ts +6 -0
- package/dist/app/useDocumentOutputActions.js +45 -0
- package/dist/app/useDocumentRuntimeEffects.d.ts +36 -0
- package/dist/app/useDocumentRuntimeEffects.js +458 -0
- package/dist/app/useDocumentSaver.d.ts +58 -0
- package/dist/app/useDocumentSaver.js +511 -0
- package/dist/app/useDocumentTabs.d.ts +41 -0
- package/dist/app/useDocumentTabs.js +207 -0
- package/dist/app/useDocumentWatcher.d.ts +83 -0
- package/dist/app/useDocumentWatcher.js +393 -0
- package/dist/app/useDocumentZoom.d.ts +24 -0
- package/dist/app/useDocumentZoom.js +104 -0
- package/dist/app/useDocuments.d.ts +169 -0
- package/dist/app/useDocuments.js +455 -0
- package/dist/app/useDraftConfirmGate.d.ts +27 -0
- package/dist/app/useDraftConfirmGate.js +47 -0
- package/dist/app/useFileDragOverlay.d.ts +12 -0
- package/dist/app/useFileDragOverlay.js +49 -0
- package/dist/app/useFormatApis.d.ts +13 -0
- package/dist/app/useFormatApis.js +62 -0
- package/dist/app/useFormatDirtyState.d.ts +29 -0
- package/dist/app/useFormatDirtyState.js +81 -0
- package/dist/app/useGlobalShortcuts.d.ts +47 -0
- package/dist/app/useGlobalShortcuts.js +359 -0
- package/dist/app/useHtmlSession.d.ts +68 -0
- package/dist/app/useHtmlSession.js +463 -0
- package/dist/app/useHtmlSessionProps.d.ts +33 -0
- package/dist/app/useHtmlSessionProps.js +57 -0
- package/dist/app/useLibrary.d.ts +21 -0
- package/dist/app/useLibrary.js +81 -0
- package/dist/app/useOpenFromClipboard.d.ts +7 -0
- package/dist/app/useOpenFromClipboard.js +44 -0
- package/dist/app/usePaneLiveness.d.ts +29 -0
- package/dist/app/usePaneLiveness.js +199 -0
- package/dist/app/usePendingSavePaths.d.ts +19 -0
- package/dist/app/usePendingSavePaths.js +67 -0
- package/dist/app/useReadyShow.d.ts +12 -0
- package/dist/app/useReadyShow.js +142 -0
- package/dist/app/useSearchController.d.ts +22 -0
- package/dist/app/useSearchController.js +114 -0
- package/dist/app/useSetupRecovery.d.ts +41 -0
- package/dist/app/useSetupRecovery.js +153 -0
- package/dist/app/useTabChrome.d.ts +40 -0
- package/dist/app/useTabChrome.js +115 -0
- package/dist/app/useViewState.d.ts +27 -0
- package/dist/app/useViewState.js +160 -0
- package/dist/appName.d.ts +2 -0
- package/dist/appName.js +8 -0
- package/dist/documents/DocumentRouter.d.ts +102 -0
- package/dist/documents/DocumentRouter.js +153 -0
- package/dist/documents/FileTypeIcon.d.ts +6 -0
- package/dist/documents/FileTypeIcon.js +93 -0
- package/dist/documents/ImageDocument.d.ts +14 -0
- package/dist/documents/ImageDocument.js +61 -0
- package/dist/documents/capabilities.d.ts +17 -0
- package/dist/documents/capabilities.js +18 -0
- package/dist/documents/html/HtmlDocument.d.ts +15 -0
- package/dist/documents/html/HtmlDocument.js +584 -0
- package/dist/documents/html/HtmlDocumentLayout.d.ts +87 -0
- package/dist/documents/html/HtmlDocumentLayout.js +25 -0
- package/dist/documents/html/HtmlDocumentProps.d.ts +60 -0
- package/dist/documents/html/HtmlDocumentProps.js +1 -0
- package/dist/documents/html/HtmlDocumentSource.d.ts +34 -0
- package/dist/documents/html/HtmlDocumentSource.js +28 -0
- package/dist/documents/markdown/MarkdownSplitPane.d.ts +115 -0
- package/dist/documents/markdown/MarkdownSplitPane.js +352 -0
- package/dist/documents/mdx/MdxSplitPane.d.ts +32 -0
- package/dist/documents/mdx/MdxSplitPane.js +60 -0
- package/dist/documents/txt/LinkDialog.d.ts +8 -0
- package/dist/documents/txt/LinkDialog.js +34 -0
- package/dist/documents/txt/MarkdownSourceToolbar.d.ts +8 -0
- package/dist/documents/txt/MarkdownSourceToolbar.js +25 -0
- package/dist/documents/txt/SourceEditorToolbar.d.ts +12 -0
- package/dist/documents/txt/SourceEditorToolbar.js +4 -0
- package/dist/documents/txt/TxtEditor.d.ts +39 -0
- package/dist/documents/txt/TxtEditor.js +186 -0
- package/dist/documents/txt/sourceEditorTypes.d.ts +49 -0
- package/dist/documents/txt/sourceEditorTypes.js +1 -0
- package/dist/documents/txt/sourceExtensions.d.ts +38 -0
- package/dist/documents/txt/sourceExtensions.js +444 -0
- package/dist/documents/txt/sourceFormatting.d.ts +18 -0
- package/dist/documents/txt/sourceFormatting.js +183 -0
- package/dist/documents/txt/sourceTheme.d.ts +5 -0
- package/dist/documents/txt/sourceTheme.js +220 -0
- package/dist/documents/txt/useCodeMirrorSourceEditor.d.ts +69 -0
- package/dist/documents/txt/useCodeMirrorSourceEditor.js +546 -0
- package/dist/documents/txt/useSourceSearch.d.ts +39 -0
- package/dist/documents/txt/useSourceSearch.js +122 -0
- package/dist/documents/txt/useTextEditorCommands.d.ts +26 -0
- package/dist/documents/txt/useTextEditorCommands.js +151 -0
- package/dist/documents/web/LivePreviewPane.d.ts +11 -0
- package/dist/documents/web/LivePreviewPane.js +58 -0
- package/dist/env.d.ts +66 -0
- package/dist/index.d.ts +121 -0
- package/dist/index.js +123 -0
- package/dist/settings/AppearanceMenu.d.ts +9 -0
- package/dist/settings/AppearanceMenu.js +54 -0
- package/dist/settings/SettingsPanel.d.ts +7 -0
- package/dist/settings/SettingsPanel.js +104 -0
- package/dist/settings/publishedSections.d.ts +22 -0
- package/dist/settings/publishedSections.js +79 -0
- package/dist/settings/sections/AboutSection.d.ts +1 -0
- package/dist/settings/sections/AboutSection.js +13 -0
- package/dist/settings/sections/DiagnosticsSection.d.ts +1 -0
- package/dist/settings/sections/DiagnosticsSection.js +42 -0
- package/dist/settings/sections/PrivacySection.d.ts +3 -0
- package/dist/settings/sections/PrivacySection.js +51 -0
- package/dist/settings/sections/UpdateLicenseBlock.d.ts +10 -0
- package/dist/settings/sections/UpdateLicenseBlock.js +158 -0
- package/dist/state/explorer.d.ts +32 -0
- package/dist/state/explorer.js +111 -0
- package/dist/state/legal.d.ts +51 -0
- package/dist/state/legal.js +130 -0
- package/dist/state/library.d.ts +33 -0
- package/dist/state/library.js +110 -0
- package/dist/state/updateLicense.d.ts +31 -0
- package/dist/state/updateLicense.js +340 -0
- package/dist/styles/explorer.css +219 -0
- package/dist/styles/index.css +1477 -0
- package/dist/styles/tabs.css +467 -0
- package/dist/styles.css +6 -0
- package/package.json +88 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
- Ask 5: host contract documented in `README.md`: legal data is passed in with `configureLegal({ manifest, contract })`, product name with `setHostAppName()`, the DOCX host-toolbar patch requirement, and `VITE_RIGHTKIT_BROWSER_QA`. The `@rightkit-host` alias is documented as the test-fixture alias only; the README previously described it as the host's data path, which the code does not use.
|
|
6
|
+
- Ask 4: pins `prosemirror-view` 1.42.8 (was 1.42.6).
|
|
7
|
+
- Wording fix in the published section comments; no behaviour change.
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
- First release. Multi-format document workspace shell: tabs, sidebar, document router, loaders, savers and actions.
|
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Adrian D'souza
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @rightkit/document-workspace
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Multi-format document workspace shell: tabs, sidebar, document router, loaders, savers and actions.
|
|
4
|
+
|
|
5
|
+
| Item | Value |
|
|
6
|
+
|---|---|
|
|
7
|
+
| Where it runs | App webview UI (React) |
|
|
8
|
+
| Version | 0.1.0 |
|
|
9
|
+
| License | MIT OR Apache-2.0 |
|
|
10
|
+
|
|
11
|
+
## Entry points
|
|
12
|
+
|
|
13
|
+
| Import | Contents |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `@rightkit/document-workspace` | Every module whose exported names do not collide (generated barrel). |
|
|
16
|
+
| `@rightkit/document-workspace/<path>` | Any module under `src/` by path without extension, e.g. `@rightkit/document-workspace/app/App`. |
|
|
17
|
+
| `@rightkit/document-workspace/<path>.css` | Stylesheets shipped next to their components. |
|
|
18
|
+
|
|
19
|
+
## Depends on
|
|
20
|
+
|
|
21
|
+
`@rightkit/document-core`, `@rightkit/docx-editor`, `@rightkit/html-editor`, `@rightkit/markdown-editor`
|
|
22
|
+
|
|
23
|
+
## Peer dependencies
|
|
24
|
+
|
|
25
|
+
`react`, `react-dom`
|
|
26
|
+
|
|
27
|
+
## Host data (legal)
|
|
28
|
+
|
|
29
|
+
The package does not import the host's legal files. The host passes them in once at startup with
|
|
30
|
+
`configureLegal({ manifest, contract })` (exported from the root and from `state/legal`):
|
|
31
|
+
|
|
32
|
+
- `manifest`: the host's `legal/legal-manifest.json`, parsed. It must have a `documents` array.
|
|
33
|
+
- `contract`: the host's generated `legal-contract.json`, with `acceptanceVersion` and `materialSha256` strings.
|
|
34
|
+
|
|
35
|
+
Until `configureLegal` runs, the legal exports (`REQUIRED_LEGAL_ACCEPTANCE_VERSION`,
|
|
36
|
+
`LEGAL_MATERIAL_SHA256`, `LEGAL_GATE_DOCUMENTS`, `LEGAL_ABOUT_LINKS`) are empty or unset, so call it
|
|
37
|
+
before the first render. The exports are live bindings, so every importer sees the configured values.
|
|
38
|
+
|
|
39
|
+
The `@rightkit-host` alias is only used by this package's own test fixture (`test/host-fixture`,
|
|
40
|
+
set in `vitest.config.ts`). The `@rightkit-host/*` module declarations in `src/env.d.ts` describe the
|
|
41
|
+
same files for type-checking; a host does not need to alias them to run the package.
|
|
42
|
+
|
|
43
|
+
## Product name
|
|
44
|
+
|
|
45
|
+
User-facing copy reads the product name from `hostAppName()` (default `"App"`). Call
|
|
46
|
+
`setHostAppName("Your App")` (exported from the root and from `appName`) once at startup, before
|
|
47
|
+
rendering. Accent preset names and copy are read at display time, so the order matters only for
|
|
48
|
+
values the host reads at import.
|
|
49
|
+
|
|
50
|
+
## Host toolbar (DOCX)
|
|
51
|
+
|
|
52
|
+
The DOCX pane uses `@rightkit/docx-editor`, which needs the host-toolbar patch on
|
|
53
|
+
`@eigenpal/docx-editor-react@1.9.0` (see that package's README). Until the workspace root registers
|
|
54
|
+
the patch, a host must apply it or the DOCX pane shows the editor's built-in toolbar.
|
|
55
|
+
|
|
56
|
+
## Host configuration (environment and state)
|
|
57
|
+
|
|
58
|
+
- `VITE_RIGHTKIT_BROWSER_QA=1` at build time enables browser-QA fixtures. A host's QA build sets
|
|
59
|
+
it; release builds leave it unset.
|
|
60
|
+
- The ProseMirror packages used here (`prosemirror-view` and `prosemirror-transform`) are pinned exactly in the
|
|
61
|
+
dependent packages. A host must not install a second copy of either, or plugin keys break.
|
|
62
|
+
|
|
63
|
+
## Host contract
|
|
64
|
+
|
|
65
|
+
Hosts bundle this package with Vite (the build keeps extensionless relative imports and asset imports
|
|
66
|
+
such as `?raw`). Tailwind hosts add `node_modules/@rightkit/document-workspace/dist/**/*.js` to their content globs.
|
|
67
|
+
|
|
68
|
+
## Testing
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
pnpm --dir packages/document-workspace test
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Modules left out of the root barrel because an export name collides with an earlier module
|
|
75
|
+
(import them by subpath): `app/useDocuments.ts`, `documents/html/HtmlDocumentProps.ts`, `documents/txt/sourceEditorTypes.ts`, `documents/txt/sourceFormatting.ts`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function App(): import("react").JSX.Element;
|
package/dist/app/App.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type PaletteItem } from "./CommandPalette.js";
|
|
2
|
+
import type { LoadedDocument } from "@rightkit/document-core/documents/types";
|
|
3
|
+
import type { HtmlConfirmState, HtmlConflictState } from "./useHtmlSession.js";
|
|
4
|
+
export declare function AppDialogs({ settingsOpen, onCloseSettings, onHistoryPurged, paletteOpen, paletteItems, onClosePalette, helpOpen, onCloseHelp, openUrlDialog, onOpenUrlSubmit, onCloseOpenUrlDialog, error, onCloseError, confirmClose, openDocs, titleFor, confirmSave, confirmDontSave, onCancelConfirmClose, confirmCloseAll, onCloseAllSaveAll, onCloseAllDontSave, onCloseAllCancel, confirmQuit, quitDirtyNames, onQuitNow, onQuitWithoutSaving, onQuitSaveAll, onCancelConfirmQuit, conflict, onReloadConflict, onKeepConflict, htmlConfirm, htmlDirtyPages, onHtmlSaveCurrent, onHtmlSaveAll, onHtmlDiscardAll, onHtmlConfirmCancel, htmlConflict, onHtmlConflictReload, onHtmlConflictKeep, }: {
|
|
5
|
+
settingsOpen: boolean;
|
|
6
|
+
onCloseSettings: () => void;
|
|
7
|
+
onHistoryPurged: () => void;
|
|
8
|
+
paletteOpen: boolean;
|
|
9
|
+
paletteItems: PaletteItem[];
|
|
10
|
+
onClosePalette: () => void;
|
|
11
|
+
helpOpen: boolean;
|
|
12
|
+
onCloseHelp: () => void;
|
|
13
|
+
openUrlDialog: boolean;
|
|
14
|
+
onOpenUrlSubmit: (input: string) => void;
|
|
15
|
+
onCloseOpenUrlDialog: () => void;
|
|
16
|
+
error: string | null;
|
|
17
|
+
onCloseError: () => void;
|
|
18
|
+
confirmClose: string | null;
|
|
19
|
+
openDocs: LoadedDocument[];
|
|
20
|
+
titleFor: (doc: LoadedDocument) => string;
|
|
21
|
+
confirmSave: () => void;
|
|
22
|
+
confirmDontSave: () => void;
|
|
23
|
+
onCancelConfirmClose: () => void;
|
|
24
|
+
confirmCloseAll: {
|
|
25
|
+
orderedPaths: string[];
|
|
26
|
+
affectedPaths: string[];
|
|
27
|
+
} | null;
|
|
28
|
+
onCloseAllSaveAll: () => void;
|
|
29
|
+
onCloseAllDontSave: () => void;
|
|
30
|
+
onCloseAllCancel: () => void;
|
|
31
|
+
confirmQuit: boolean;
|
|
32
|
+
quitDirtyNames: string[];
|
|
33
|
+
onQuitNow: () => void;
|
|
34
|
+
onQuitWithoutSaving: () => void;
|
|
35
|
+
onQuitSaveAll: () => void;
|
|
36
|
+
onCancelConfirmQuit: () => void;
|
|
37
|
+
conflict: string | null;
|
|
38
|
+
onReloadConflict: (path: string) => void;
|
|
39
|
+
onKeepConflict: () => void;
|
|
40
|
+
htmlConfirm: HtmlConfirmState;
|
|
41
|
+
htmlDirtyPages: (entryPath: string) => Array<{
|
|
42
|
+
path: string;
|
|
43
|
+
name: string;
|
|
44
|
+
}>;
|
|
45
|
+
onHtmlSaveCurrent: () => void;
|
|
46
|
+
onHtmlSaveAll: () => void;
|
|
47
|
+
onHtmlDiscardAll: () => void;
|
|
48
|
+
onHtmlConfirmCancel: () => void;
|
|
49
|
+
htmlConflict: HtmlConflictState;
|
|
50
|
+
onHtmlConflictReload: () => void;
|
|
51
|
+
onHtmlConflictKeep: () => void;
|
|
52
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { QuitConfirm, CloseConfirm, CloseAllConfirm, HtmlCloseConfirm, ConflictReload, OpenUrlDialog, AppErrorNotice, } from "@rightkit/document-core/app/chrome";
|
|
3
|
+
import { CommandPalette } from "./CommandPalette.js";
|
|
4
|
+
import { ShortcutHelp } from "./ShortcutHelp.js";
|
|
5
|
+
import { SettingsPanel } from "../settings/SettingsPanel.js";
|
|
6
|
+
import { baseName } from "@rightkit/document-core/documents/types";
|
|
7
|
+
// The modal/overlay cluster that used to live inline at the bottom of App.tsx: settings, command
|
|
8
|
+
// palette, shortcut help, the open-url dialog, the error notice, and every confirm/reload dialog.
|
|
9
|
+
// Each dialog owns its own visibility gate via the prop it's passed (mirrors the original inline
|
|
10
|
+
// `{cond && <Dialog .../>}` pattern) so behavior is identical to before the extraction.
|
|
11
|
+
export function AppDialogs({ settingsOpen, onCloseSettings, onHistoryPurged, paletteOpen, paletteItems, onClosePalette, helpOpen, onCloseHelp, openUrlDialog, onOpenUrlSubmit, onCloseOpenUrlDialog, error, onCloseError, confirmClose, openDocs, titleFor, confirmSave, confirmDontSave, onCancelConfirmClose, confirmCloseAll, onCloseAllSaveAll, onCloseAllDontSave, onCloseAllCancel, confirmQuit, quitDirtyNames, onQuitNow, onQuitWithoutSaving, onQuitSaveAll, onCancelConfirmQuit, conflict, onReloadConflict, onKeepConflict, htmlConfirm, htmlDirtyPages, onHtmlSaveCurrent, onHtmlSaveAll, onHtmlDiscardAll, onHtmlConfirmCancel, htmlConflict, onHtmlConflictReload, onHtmlConflictKeep, }) {
|
|
12
|
+
return (_jsxs(_Fragment, { children: [settingsOpen && _jsx(SettingsPanel, { onClose: onCloseSettings, onHistoryPurged: onHistoryPurged }), paletteOpen && _jsx(CommandPalette, { items: paletteItems, onClose: onClosePalette }), helpOpen && _jsx(ShortcutHelp, { onClose: onCloseHelp }), openUrlDialog && _jsx(OpenUrlDialog, { onOpen: onOpenUrlSubmit, onCancel: onCloseOpenUrlDialog }), error && _jsx(AppErrorNotice, { message: error, onClose: onCloseError }), confirmClose && (_jsx(CloseConfirm, { title: titleFor(openDocs.find((d) => d.path === confirmClose) ?? {
|
|
13
|
+
path: confirmClose,
|
|
14
|
+
displayName: "",
|
|
15
|
+
format: "txt",
|
|
16
|
+
content: "",
|
|
17
|
+
}), onSave: confirmSave, onDontSave: confirmDontSave, onCancel: onCancelConfirmClose })), confirmCloseAll && (_jsx(CloseAllConfirm, { dirtyNames: confirmCloseAll.affectedPaths.map((p) => titleFor(openDocs.find((d) => d.path === p) ?? {
|
|
18
|
+
path: p,
|
|
19
|
+
displayName: baseName(p),
|
|
20
|
+
format: "txt",
|
|
21
|
+
content: "",
|
|
22
|
+
}) || baseName(p)), onSaveAll: onCloseAllSaveAll, onDontSave: onCloseAllDontSave, onCancel: onCloseAllCancel })), confirmQuit && (_jsx(QuitConfirm, { dirtyNames: quitDirtyNames, onQuit: onQuitNow, onQuitWithoutSaving: onQuitWithoutSaving, onSaveAll: onQuitSaveAll, onCancel: onCancelConfirmQuit })), conflict && (_jsx(ConflictReload, { name: baseName(conflict), onReload: () => onReloadConflict(conflict), onKeep: onKeepConflict })), htmlConfirm && (_jsx(HtmlCloseConfirm, { title: baseName(htmlConfirm.entryPath), mode: htmlConfirm.mode, dirtyNames: htmlDirtyPages(htmlConfirm.entryPath).map((d) => d.name), onSaveCurrent: onHtmlSaveCurrent, onSaveAll: onHtmlSaveAll, onDiscardAll: onHtmlDiscardAll, onCancel: onHtmlConfirmCancel })), htmlConflict && (_jsx(ConflictReload, { name: baseName(htmlConflict.pagePath), onReload: onHtmlConflictReload, onKeep: onHtmlConflictKeep }))] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { AppDialogs } from "./AppDialogs.js";
|
|
3
|
+
import { BlockDraftViewConfirm } from "@rightkit/document-core/app/chrome";
|
|
4
|
+
import type { LoadedDocument } from "@rightkit/document-core/documents/types";
|
|
5
|
+
import type { useDocuments } from "./useDocuments.js";
|
|
6
|
+
type DialogProps = ComponentProps<typeof AppDialogs>;
|
|
7
|
+
type ConfirmProps = ComponentProps<typeof BlockDraftViewConfirm>;
|
|
8
|
+
/** Wires useDocuments' confirm/conflict state + App's overlay flags into AppDialogs, and mounts the
|
|
9
|
+
* block-draft view/fullscreen confirms. Extracted verbatim from App.tsx's JSX tail. */
|
|
10
|
+
export declare function AppDialogsHost({ docs, openDocs, quitDirtyDocs, paletteItems, overlays, onHistoryPurged, open, openLiveUrl, viewConfirm, fullscreenConfirm, }: {
|
|
11
|
+
docs: ReturnType<typeof useDocuments>;
|
|
12
|
+
openDocs: LoadedDocument[];
|
|
13
|
+
quitDirtyDocs: LoadedDocument[];
|
|
14
|
+
paletteItems: DialogProps["paletteItems"];
|
|
15
|
+
overlays: {
|
|
16
|
+
settingsOpen: boolean;
|
|
17
|
+
setSettingsOpen: (v: boolean) => void;
|
|
18
|
+
paletteOpen: boolean;
|
|
19
|
+
setPaletteOpen: (v: boolean) => void;
|
|
20
|
+
helpOpen: boolean;
|
|
21
|
+
setHelpOpen: (v: boolean) => void;
|
|
22
|
+
openUrlDialog: boolean;
|
|
23
|
+
setOpenUrlDialog: (v: boolean) => void;
|
|
24
|
+
};
|
|
25
|
+
onHistoryPurged: DialogProps["onHistoryPurged"];
|
|
26
|
+
open: (path: string) => unknown;
|
|
27
|
+
openLiveUrl: (url: string) => unknown;
|
|
28
|
+
viewConfirm: ConfirmProps | null;
|
|
29
|
+
fullscreenConfirm: ConfirmProps | null;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AppDialogs } from "./AppDialogs.js";
|
|
3
|
+
import { BlockDraftViewConfirm } from "@rightkit/document-core/app/chrome";
|
|
4
|
+
import { baseName, isUntitled } from "@rightkit/document-core/documents/types";
|
|
5
|
+
import { addRecentUrl } from "@rightkit/document-core/state/recentUrls";
|
|
6
|
+
import { openLinkedDocument } from "@rightkit/document-core/state/tauriBridge";
|
|
7
|
+
import { localPathFromClipboardText } from "./clipboardPaths.js";
|
|
8
|
+
/** Wires useDocuments' confirm/conflict state + App's overlay flags into AppDialogs, and mounts the
|
|
9
|
+
* block-draft view/fullscreen confirms. Extracted verbatim from App.tsx's JSX tail. */
|
|
10
|
+
export function AppDialogsHost({ docs, openDocs, quitDirtyDocs, paletteItems, overlays, onHistoryPurged, open, openLiveUrl, viewConfirm, fullscreenConfirm, }) {
|
|
11
|
+
const { error, setError, confirmClose, setConfirmClose, titleFor, confirmSave, confirmDontSave, confirmCloseAll, confirmCloseAllSaveAll, confirmCloseAllDontSave, confirmCloseAllCancel, confirmQuit, setConfirmQuit, quitNow, conflict, setConflict, keepConflict, applyReload, } = docs;
|
|
12
|
+
return (_jsxs(_Fragment, { children: [_jsx(AppDialogs, { settingsOpen: overlays.settingsOpen, onCloseSettings: () => overlays.setSettingsOpen(false), onHistoryPurged: onHistoryPurged, paletteOpen: overlays.paletteOpen, paletteItems: paletteItems, onClosePalette: () => overlays.setPaletteOpen(false), helpOpen: overlays.helpOpen, onCloseHelp: () => overlays.setHelpOpen(false), openUrlDialog: overlays.openUrlDialog, onOpenUrlSubmit: (input) => {
|
|
13
|
+
overlays.setOpenUrlDialog(false);
|
|
14
|
+
const localPath = localPathFromClipboardText(input);
|
|
15
|
+
if (localPath) {
|
|
16
|
+
void openLinkedDocument(localPath).then((readablePath) => open(readablePath ?? localPath));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
addRecentUrl(input);
|
|
20
|
+
void openLiveUrl(input);
|
|
21
|
+
}, onCloseOpenUrlDialog: () => overlays.setOpenUrlDialog(false), error: error, onCloseError: () => setError(null), confirmClose: confirmClose, openDocs: openDocs, titleFor: titleFor, confirmSave: confirmSave, confirmDontSave: confirmDontSave, onCancelConfirmClose: () => setConfirmClose(null), confirmCloseAll: confirmCloseAll, onCloseAllSaveAll: () => void confirmCloseAllSaveAll(), onCloseAllDontSave: () => void confirmCloseAllDontSave(), onCloseAllCancel: confirmCloseAllCancel, confirmQuit: confirmQuit, quitDirtyNames: quitDirtyDocs.map((doc) => isUntitled(doc.path) ? titleFor(doc) : baseName(doc.path)), onQuitNow: quitNow, onQuitWithoutSaving: () => void docs.quitDiscardAll(), onQuitSaveAll: () => void docs.quitSaveAll(), onCancelConfirmQuit: () => {
|
|
22
|
+
setConfirmQuit(false);
|
|
23
|
+
}, conflict: conflict, onReloadConflict: (path) => {
|
|
24
|
+
applyReload(path);
|
|
25
|
+
setConflict(null);
|
|
26
|
+
}, onKeepConflict: () => {
|
|
27
|
+
if (conflict)
|
|
28
|
+
void keepConflict(conflict);
|
|
29
|
+
}, htmlConfirm: docs.htmlConfirm, htmlDirtyPages: docs.htmlDirtyPages, onHtmlSaveCurrent: docs.htmlSaveCurrent, onHtmlSaveAll: docs.htmlSaveAll, onHtmlDiscardAll: docs.htmlDiscardAll, onHtmlConfirmCancel: docs.htmlConfirmCancel, htmlConflict: docs.htmlConflict, onHtmlConflictReload: docs.htmlConflictReload, onHtmlConflictKeep: docs.htmlConflictKeep }), viewConfirm && _jsx(BlockDraftViewConfirm, { ...viewConfirm }), fullscreenConfirm && _jsx(BlockDraftViewConfirm, { ...fullscreenConfirm })] }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Unlisten } from "@rightkit/document-core/state/bridgeEvents";
|
|
2
|
+
/** Tauri's unlisten callback is asynchronous. During window teardown its backend listener may
|
|
3
|
+
* already be gone, so contain either sync or async cleanup failures instead of leaking an
|
|
4
|
+
* unhandled rejection from React effect cleanup. */
|
|
5
|
+
export declare function releaseAppEventListener(unlisten?: Unlisten): void;
|
|
6
|
+
/**
|
|
7
|
+
* Self-contained app-lifecycle effects, extracted from App.tsx: the file watcher re-arm on the open-tab/sub-page set, the one-shot
|
|
8
|
+
* background update check gated on settings, and the "open URL as a tab" event wiring (custom
|
|
9
|
+
* window event + the Rust "viewright:open-url" bridge event). None of these read per-keystroke
|
|
10
|
+
* state, so moving them here does not change render/perf characteristics.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useAppLifecycle({ watchKey, autoCheckUpdates, autoUpdateCheckRan, openLiveUrl, }: {
|
|
13
|
+
watchKey: string;
|
|
14
|
+
autoCheckUpdates: boolean;
|
|
15
|
+
autoUpdateCheckRan: React.MutableRefObject<boolean>;
|
|
16
|
+
openLiveUrl: (url: string, opts?: {
|
|
17
|
+
background?: boolean;
|
|
18
|
+
}) => Promise<unknown>;
|
|
19
|
+
}): void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { toast } from "@rightkit/platform-ui/headless";
|
|
3
|
+
import { addRecentUrl } from "@rightkit/document-core/state/recentUrls";
|
|
4
|
+
import { watchFiles, onAppEvent } from "@rightkit/document-core/state/tauriBridge";
|
|
5
|
+
import { checkForBackgroundUpdate } from "../state/updateLicense.js";
|
|
6
|
+
import { hostAppName } from "../appName.js";
|
|
7
|
+
/** Tauri's unlisten callback is asynchronous. During window teardown its backend listener may
|
|
8
|
+
* already be gone, so contain either sync or async cleanup failures instead of leaking an
|
|
9
|
+
* unhandled rejection from React effect cleanup. */
|
|
10
|
+
export function releaseAppEventListener(unlisten) {
|
|
11
|
+
if (!unlisten)
|
|
12
|
+
return;
|
|
13
|
+
try {
|
|
14
|
+
void Promise.resolve(unlisten()).catch(() => { });
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Backend already disappeared during native window teardown.
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Self-contained app-lifecycle effects, extracted from App.tsx: the file watcher re-arm on the open-tab/sub-page set, the one-shot
|
|
22
|
+
* background update check gated on settings, and the "open URL as a tab" event wiring (custom
|
|
23
|
+
* window event + the Rust "viewright:open-url" bridge event). None of these read per-keystroke
|
|
24
|
+
* state, so moving them here does not change render/perf characteristics.
|
|
25
|
+
*/
|
|
26
|
+
export function useAppLifecycle({ watchKey, autoCheckUpdates, autoUpdateCheckRan, openLiveUrl, }) {
|
|
27
|
+
// Watch EVERY open file-backed tab plus each HTML session's visited sub-pages, in the one watcher.
|
|
28
|
+
// An external edit to ANY of them (active or background) arrives via the `file-changed` event and
|
|
29
|
+
// reloads that tab when it happens — so tab activation is a pure state change (no re-stat /
|
|
30
|
+
// reload-on-switch) and a background tab is already fresh by the time you click it. Keyed on the
|
|
31
|
+
// sorted path set so it re-arms only when a tab opens/closes/navigates, not on every keystroke.
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
void watchFiles(watchKey ? watchKey.split("|") : []);
|
|
34
|
+
}, [watchKey]);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!autoCheckUpdates || autoUpdateCheckRan.current)
|
|
37
|
+
return;
|
|
38
|
+
autoUpdateCheckRan.current = true;
|
|
39
|
+
let cancelled = false;
|
|
40
|
+
void checkForBackgroundUpdate()
|
|
41
|
+
.then((update) => {
|
|
42
|
+
if (!update || cancelled)
|
|
43
|
+
return;
|
|
44
|
+
// The shared updater adapter returns only eligible signed manifests here: public patches
|
|
45
|
+
// for everyone and feature updates for Pro. Ineligible Pro nudges stay in Settings.
|
|
46
|
+
const tier = update.tier === "patch" ? "patch" : "update";
|
|
47
|
+
toast(`${hostAppName()} ${update.version} ${tier} is ready. Open Settings > Updates to install.`, "info");
|
|
48
|
+
})
|
|
49
|
+
.catch(() => {
|
|
50
|
+
// Background update checks are advisory; Settings still permits a manual retry.
|
|
51
|
+
});
|
|
52
|
+
return () => {
|
|
53
|
+
cancelled = true;
|
|
54
|
+
};
|
|
55
|
+
}, [autoCheckUpdates, autoUpdateCheckRan]);
|
|
56
|
+
// Open an explicit URL preview as a VR web tab. Sources: the Open URL dialog/clipboard, a
|
|
57
|
+
// new-window link in a URL preview (Rust → "viewright:open-url" Tauri event), and web links
|
|
58
|
+
// followed from document previews (bridge → "viewright:open-url-tab").
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
const openUrlInTab = (url, background = false) => {
|
|
61
|
+
addRecentUrl(url);
|
|
62
|
+
void openLiveUrl(url, { background });
|
|
63
|
+
};
|
|
64
|
+
const onWindowOpen = (e) => {
|
|
65
|
+
const detail = e.detail;
|
|
66
|
+
// Detail is a bare url (normal click → foreground) or { url, background } (new-tab gesture).
|
|
67
|
+
if (typeof detail === "string" && detail)
|
|
68
|
+
openUrlInTab(detail);
|
|
69
|
+
else if (detail && typeof detail === "object" && detail.url)
|
|
70
|
+
openUrlInTab(detail.url, !!detail.background);
|
|
71
|
+
};
|
|
72
|
+
window.addEventListener("viewright:open-url-tab", onWindowOpen);
|
|
73
|
+
let un;
|
|
74
|
+
let cancelled = false;
|
|
75
|
+
void onAppEvent("viewright:open-url", openUrlInTab).then((u) => {
|
|
76
|
+
if (cancelled)
|
|
77
|
+
releaseAppEventListener(u);
|
|
78
|
+
else
|
|
79
|
+
un = u;
|
|
80
|
+
});
|
|
81
|
+
return () => {
|
|
82
|
+
cancelled = true;
|
|
83
|
+
releaseAppEventListener(un);
|
|
84
|
+
window.removeEventListener("viewright:open-url-tab", onWindowOpen);
|
|
85
|
+
};
|
|
86
|
+
}, [openLiveUrl]);
|
|
87
|
+
}
|