@bendyline/docblocks-react 2.7.4 → 2.7.5
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/THIRD_PARTY_NOTICES.txt +56 -25
- package/dist/{AiDiagrams-QZMJNGDT.js → AiDiagrams-5P657GFC.js} +2 -2
- package/dist/{AiEditorAssistant-4HFFGVU4.js → AiEditorAssistant-V4MZRC6Q.js} +3 -3
- package/dist/{AiStudyDialog-P3E7PJV5.js → AiStudyDialog-GSCFTG3G.js} +1 -1
- package/dist/{PresentationMaker-MUMFAXEI.js → PresentationMaker-H5B44Q7P.js} +2 -2
- package/dist/{chunk-7V34VUK6.js → chunk-CUCWCZRO.js} +7 -13
- package/dist/{chunk-D4HIOS7E.js → chunk-I4JURPYS.js} +1 -1
- package/dist/{chunk-PNZFIIWW.js → chunk-USKX66SA.js} +23 -5
- package/dist/editor.js +2 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +803 -697
- package/package.json +8 -8
- package/src/styles/docblocks.css +41 -5
package/dist/index.js
CHANGED
|
@@ -100,13 +100,13 @@ import {
|
|
|
100
100
|
matchShortcut,
|
|
101
101
|
shortcutLabel
|
|
102
102
|
} from "./chunk-ACQF63SB.js";
|
|
103
|
-
import "./chunk-
|
|
103
|
+
import "./chunk-USKX66SA.js";
|
|
104
104
|
import {
|
|
105
105
|
buildIssueReportUrl,
|
|
106
106
|
displayBuildDate,
|
|
107
107
|
localDateStamp,
|
|
108
108
|
openExternalUrl
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-CUCWCZRO.js";
|
|
110
110
|
import "./chunk-K4I3NJFL.js";
|
|
111
111
|
import {
|
|
112
112
|
ExportDialog
|
|
@@ -3758,11 +3758,11 @@ async function prepareHostLifecycle(session, request) {
|
|
|
3758
3758
|
|
|
3759
3759
|
// src/DocBlocksShell/DocBlocksShell.tsx
|
|
3760
3760
|
import {
|
|
3761
|
-
useState as
|
|
3762
|
-
useCallback as
|
|
3763
|
-
useEffect as
|
|
3761
|
+
useState as useState24,
|
|
3762
|
+
useCallback as useCallback19,
|
|
3763
|
+
useEffect as useEffect30,
|
|
3764
3764
|
useLayoutEffect as useLayoutEffect4,
|
|
3765
|
-
useRef as
|
|
3765
|
+
useRef as useRef20,
|
|
3766
3766
|
useMemo as useMemo6,
|
|
3767
3767
|
lazy as lazy2,
|
|
3768
3768
|
Suspense as Suspense2
|
|
@@ -3816,7 +3816,7 @@ import {
|
|
|
3816
3816
|
} from "@bendyline/docblocks/workspace";
|
|
3817
3817
|
|
|
3818
3818
|
// src/AppMenu/AppMenu.tsx
|
|
3819
|
-
import { useState as
|
|
3819
|
+
import { useState as useState8, useCallback as useCallback9, useRef as useRef9, useEffect as useEffect9 } from "react";
|
|
3820
3820
|
import {
|
|
3821
3821
|
getHostEnvironment
|
|
3822
3822
|
} from "@bendyline/docblocks/host";
|
|
@@ -4133,8 +4133,87 @@ function SpeechSettingsControls({ speech }) {
|
|
|
4133
4133
|
] });
|
|
4134
4134
|
}
|
|
4135
4135
|
|
|
4136
|
+
// src/Settings/TraySettings.tsx
|
|
4137
|
+
import { useCallback as useCallback8, useEffect as useEffect8, useRef as useRef8, useState as useState7 } from "react";
|
|
4138
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4139
|
+
function trayPlace(platform) {
|
|
4140
|
+
switch (platform) {
|
|
4141
|
+
case "darwin":
|
|
4142
|
+
return { legend: "Menu bar", label: "Show DocBlocks in the menu bar" };
|
|
4143
|
+
case "win32":
|
|
4144
|
+
return {
|
|
4145
|
+
legend: "Notification area",
|
|
4146
|
+
label: "Show DocBlocks in the notification area"
|
|
4147
|
+
};
|
|
4148
|
+
default:
|
|
4149
|
+
return { legend: "System tray", label: "Show DocBlocks in the system tray" };
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
function TraySettingsControls({ menu, platform }) {
|
|
4153
|
+
const [enabled, setEnabled] = useState7(null);
|
|
4154
|
+
const [saving, setSaving] = useState7(false);
|
|
4155
|
+
const [failure, setFailure] = useState7(null);
|
|
4156
|
+
const mounted = useRef8(true);
|
|
4157
|
+
useEffect8(() => {
|
|
4158
|
+
mounted.current = true;
|
|
4159
|
+
const read2 = menu.getTrayEnabled;
|
|
4160
|
+
if (read2) {
|
|
4161
|
+
read2.call(menu).then(
|
|
4162
|
+
(value) => {
|
|
4163
|
+
if (mounted.current) setEnabled(value);
|
|
4164
|
+
},
|
|
4165
|
+
() => {
|
|
4166
|
+
if (mounted.current) setFailure("DocBlocks could not read this setting.");
|
|
4167
|
+
}
|
|
4168
|
+
);
|
|
4169
|
+
}
|
|
4170
|
+
return () => {
|
|
4171
|
+
mounted.current = false;
|
|
4172
|
+
};
|
|
4173
|
+
}, [menu]);
|
|
4174
|
+
const change = useCallback8(
|
|
4175
|
+
async (next) => {
|
|
4176
|
+
const write2 = menu.setTrayEnabled;
|
|
4177
|
+
if (!write2) return;
|
|
4178
|
+
setSaving(true);
|
|
4179
|
+
setFailure(null);
|
|
4180
|
+
setEnabled(next);
|
|
4181
|
+
try {
|
|
4182
|
+
const saved = await write2.call(menu, next);
|
|
4183
|
+
if (mounted.current) setEnabled(saved);
|
|
4184
|
+
} catch {
|
|
4185
|
+
if (mounted.current) {
|
|
4186
|
+
setEnabled(!next);
|
|
4187
|
+
setFailure("DocBlocks could not change this setting. Try again.");
|
|
4188
|
+
}
|
|
4189
|
+
} finally {
|
|
4190
|
+
if (mounted.current) setSaving(false);
|
|
4191
|
+
}
|
|
4192
|
+
},
|
|
4193
|
+
[menu]
|
|
4194
|
+
);
|
|
4195
|
+
const place = trayPlace(platform);
|
|
4196
|
+
return /* @__PURE__ */ jsxs7("fieldset", { className: "db-settings-fieldset", children: [
|
|
4197
|
+
/* @__PURE__ */ jsx8("legend", { className: "db-settings-legend", children: place.legend }),
|
|
4198
|
+
/* @__PURE__ */ jsxs7("label", { className: "db-settings-checkbox", children: [
|
|
4199
|
+
/* @__PURE__ */ jsx8(
|
|
4200
|
+
"input",
|
|
4201
|
+
{
|
|
4202
|
+
type: "checkbox",
|
|
4203
|
+
checked: enabled === true,
|
|
4204
|
+
disabled: enabled === null || saving,
|
|
4205
|
+
onChange: (event) => void change(event.currentTarget.checked)
|
|
4206
|
+
}
|
|
4207
|
+
),
|
|
4208
|
+
place.label
|
|
4209
|
+
] }),
|
|
4210
|
+
/* @__PURE__ */ jsx8("p", { className: "db-settings-hint", children: "One click to a new document, a folder, or any document you have pinned." }),
|
|
4211
|
+
failure && /* @__PURE__ */ jsx8("p", { className: "db-settings-hint db-settings-ai-error", role: "alert", children: failure })
|
|
4212
|
+
] });
|
|
4213
|
+
}
|
|
4214
|
+
|
|
4136
4215
|
// src/AppMenu/AppMenu.tsx
|
|
4137
|
-
import { Fragment as Fragment5, jsx as
|
|
4216
|
+
import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4138
4217
|
function formatBytes(bytes) {
|
|
4139
4218
|
if (!Number.isFinite(bytes) || bytes < 0) return "\u2014";
|
|
4140
4219
|
let value = bytes;
|
|
@@ -4179,21 +4258,22 @@ function AppMenu({
|
|
|
4179
4258
|
appBuildDate,
|
|
4180
4259
|
ai,
|
|
4181
4260
|
speech,
|
|
4261
|
+
tray,
|
|
4182
4262
|
settingsRequest = 0
|
|
4183
4263
|
}) {
|
|
4184
|
-
const [isOpen, setIsOpen] =
|
|
4185
|
-
const [showAbout, setShowAbout] =
|
|
4186
|
-
const [showSettings, setShowSettings] =
|
|
4187
|
-
|
|
4264
|
+
const [isOpen, setIsOpen] = useState8(false);
|
|
4265
|
+
const [showAbout, setShowAbout] = useState8(false);
|
|
4266
|
+
const [showSettings, setShowSettings] = useState8(false);
|
|
4267
|
+
useEffect9(() => {
|
|
4188
4268
|
if (settingsRequest > 0) setShowSettings(true);
|
|
4189
4269
|
}, [settingsRequest]);
|
|
4190
|
-
const [requestingPersistentStorage, setRequestingPersistentStorage] =
|
|
4270
|
+
const [requestingPersistentStorage, setRequestingPersistentStorage] = useState8(false);
|
|
4191
4271
|
const surface = getHostEnvironment()?.surface ?? "web";
|
|
4192
4272
|
const moreInformationUrl = MORE_INFORMATION_URLS[surface] ?? MORE_INFORMATION_URLS.web;
|
|
4193
|
-
const containerRef =
|
|
4273
|
+
const containerRef = useRef9(null);
|
|
4194
4274
|
const { menuRef, triggerRef, handleMenuKeyDown, handleTriggerKeyDown, closeMenu } = useMenuKeyboard(isOpen, setIsOpen);
|
|
4195
|
-
const [storageEstimate, setStorageEstimate] =
|
|
4196
|
-
|
|
4275
|
+
const [storageEstimate, setStorageEstimate] = useState8(null);
|
|
4276
|
+
useEffect9(() => {
|
|
4197
4277
|
if (!showSettings || !getStorageEstimate) return;
|
|
4198
4278
|
let cancelled = false;
|
|
4199
4279
|
getStorageEstimate().then((estimate) => {
|
|
@@ -4205,7 +4285,7 @@ function AppMenu({
|
|
|
4205
4285
|
cancelled = true;
|
|
4206
4286
|
};
|
|
4207
4287
|
}, [showSettings, getStorageEstimate]);
|
|
4208
|
-
|
|
4288
|
+
useEffect9(() => {
|
|
4209
4289
|
if (!isOpen) return;
|
|
4210
4290
|
function handleOutsideClick(e) {
|
|
4211
4291
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -4215,14 +4295,14 @@ function AppMenu({
|
|
|
4215
4295
|
document.addEventListener("mousedown", handleOutsideClick);
|
|
4216
4296
|
return () => document.removeEventListener("mousedown", handleOutsideClick);
|
|
4217
4297
|
}, [closeMenu, isOpen]);
|
|
4218
|
-
const handleAction =
|
|
4298
|
+
const handleAction = useCallback9(
|
|
4219
4299
|
(action) => {
|
|
4220
4300
|
closeMenu(true);
|
|
4221
4301
|
action();
|
|
4222
4302
|
},
|
|
4223
4303
|
[closeMenu]
|
|
4224
4304
|
);
|
|
4225
|
-
const handleKeepBrowserDataFromSettings =
|
|
4305
|
+
const handleKeepBrowserDataFromSettings = useCallback9(async () => {
|
|
4226
4306
|
if (!onKeepBrowserData || requestingPersistentStorage) return;
|
|
4227
4307
|
setShowSettings(false);
|
|
4228
4308
|
setRequestingPersistentStorage(true);
|
|
@@ -4232,9 +4312,9 @@ function AppMenu({
|
|
|
4232
4312
|
setRequestingPersistentStorage(false);
|
|
4233
4313
|
}
|
|
4234
4314
|
}, [onKeepBrowserData, requestingPersistentStorage]);
|
|
4235
|
-
return /* @__PURE__ */
|
|
4236
|
-
/* @__PURE__ */
|
|
4237
|
-
/* @__PURE__ */
|
|
4315
|
+
return /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
4316
|
+
/* @__PURE__ */ jsxs8("div", { ref: containerRef, className: "db-app-menu", children: [
|
|
4317
|
+
/* @__PURE__ */ jsxs8(
|
|
4238
4318
|
"button",
|
|
4239
4319
|
{
|
|
4240
4320
|
ref: triggerRef,
|
|
@@ -4244,8 +4324,8 @@ function AppMenu({
|
|
|
4244
4324
|
"aria-expanded": isOpen,
|
|
4245
4325
|
"aria-haspopup": "menu",
|
|
4246
4326
|
children: [
|
|
4247
|
-
logoUrl ? /* @__PURE__ */
|
|
4248
|
-
/* @__PURE__ */
|
|
4327
|
+
logoUrl ? /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
4328
|
+
/* @__PURE__ */ jsx9(
|
|
4249
4329
|
"img",
|
|
4250
4330
|
{
|
|
4251
4331
|
src: logoUrl,
|
|
@@ -4255,7 +4335,7 @@ function AppMenu({
|
|
|
4255
4335
|
height: 242
|
|
4256
4336
|
}
|
|
4257
4337
|
),
|
|
4258
|
-
logoDarkUrl && /* @__PURE__ */
|
|
4338
|
+
logoDarkUrl && /* @__PURE__ */ jsx9(
|
|
4259
4339
|
"img",
|
|
4260
4340
|
{
|
|
4261
4341
|
src: logoDarkUrl,
|
|
@@ -4265,8 +4345,8 @@ function AppMenu({
|
|
|
4265
4345
|
height: 242
|
|
4266
4346
|
}
|
|
4267
4347
|
)
|
|
4268
|
-
] }) : /* @__PURE__ */
|
|
4269
|
-
/* @__PURE__ */
|
|
4348
|
+
] }) : /* @__PURE__ */ jsx9("span", { className: "db-app-menu-label", children: "docblocks" }),
|
|
4349
|
+
/* @__PURE__ */ jsx9(
|
|
4270
4350
|
"span",
|
|
4271
4351
|
{
|
|
4272
4352
|
className: `db-app-menu-caret${isOpen ? " db-app-menu-caret--open" : ""}`,
|
|
@@ -4276,7 +4356,7 @@ function AppMenu({
|
|
|
4276
4356
|
]
|
|
4277
4357
|
}
|
|
4278
4358
|
),
|
|
4279
|
-
isOpen && /* @__PURE__ */
|
|
4359
|
+
isOpen && /* @__PURE__ */ jsxs8(
|
|
4280
4360
|
"div",
|
|
4281
4361
|
{
|
|
4282
4362
|
ref: menuRef,
|
|
@@ -4284,7 +4364,7 @@ function AppMenu({
|
|
|
4284
4364
|
role: "menu",
|
|
4285
4365
|
onKeyDown: handleMenuKeyDown,
|
|
4286
4366
|
children: [
|
|
4287
|
-
/* @__PURE__ */
|
|
4367
|
+
/* @__PURE__ */ jsx9(
|
|
4288
4368
|
"button",
|
|
4289
4369
|
{
|
|
4290
4370
|
className: "db-app-menu-item",
|
|
@@ -4294,7 +4374,7 @@ function AppMenu({
|
|
|
4294
4374
|
children: "Settings"
|
|
4295
4375
|
}
|
|
4296
4376
|
),
|
|
4297
|
-
onInstallApp && /* @__PURE__ */
|
|
4377
|
+
onInstallApp && /* @__PURE__ */ jsx9(
|
|
4298
4378
|
"button",
|
|
4299
4379
|
{
|
|
4300
4380
|
className: "db-app-menu-item",
|
|
@@ -4304,8 +4384,8 @@ function AppMenu({
|
|
|
4304
4384
|
children: "Install DocBlocks\u2026"
|
|
4305
4385
|
}
|
|
4306
4386
|
),
|
|
4307
|
-
(onDownloadAllWorkspaces || onRestoreBackup || onKeepBrowserData) && /* @__PURE__ */
|
|
4308
|
-
onDownloadAllWorkspaces && /* @__PURE__ */
|
|
4387
|
+
(onDownloadAllWorkspaces || onRestoreBackup || onKeepBrowserData) && /* @__PURE__ */ jsx9("div", { className: "db-app-menu-divider" }),
|
|
4388
|
+
onDownloadAllWorkspaces && /* @__PURE__ */ jsx9(
|
|
4309
4389
|
"button",
|
|
4310
4390
|
{
|
|
4311
4391
|
className: "db-app-menu-item",
|
|
@@ -4315,7 +4395,7 @@ function AppMenu({
|
|
|
4315
4395
|
children: "Back up all workspaces"
|
|
4316
4396
|
}
|
|
4317
4397
|
),
|
|
4318
|
-
onRestoreBackup && /* @__PURE__ */
|
|
4398
|
+
onRestoreBackup && /* @__PURE__ */ jsx9(
|
|
4319
4399
|
"button",
|
|
4320
4400
|
{
|
|
4321
4401
|
className: "db-app-menu-item",
|
|
@@ -4325,7 +4405,7 @@ function AppMenu({
|
|
|
4325
4405
|
children: "Restore backup\u2026"
|
|
4326
4406
|
}
|
|
4327
4407
|
),
|
|
4328
|
-
onKeepBrowserData && /* @__PURE__ */
|
|
4408
|
+
onKeepBrowserData && /* @__PURE__ */ jsx9(
|
|
4329
4409
|
"button",
|
|
4330
4410
|
{
|
|
4331
4411
|
className: "db-app-menu-item",
|
|
@@ -4335,8 +4415,8 @@ function AppMenu({
|
|
|
4335
4415
|
children: "Protect data from browser cleanup"
|
|
4336
4416
|
}
|
|
4337
4417
|
),
|
|
4338
|
-
/* @__PURE__ */
|
|
4339
|
-
onShowKeyboardShortcuts && /* @__PURE__ */
|
|
4418
|
+
/* @__PURE__ */ jsx9("div", { className: "db-app-menu-divider" }),
|
|
4419
|
+
onShowKeyboardShortcuts && /* @__PURE__ */ jsxs8(
|
|
4340
4420
|
"button",
|
|
4341
4421
|
{
|
|
4342
4422
|
className: "db-app-menu-item db-app-menu-item--with-shortcut",
|
|
@@ -4346,11 +4426,11 @@ function AppMenu({
|
|
|
4346
4426
|
onClick: () => handleAction(onShowKeyboardShortcuts),
|
|
4347
4427
|
children: [
|
|
4348
4428
|
"Keyboard shortcuts",
|
|
4349
|
-
/* @__PURE__ */
|
|
4429
|
+
/* @__PURE__ */ jsx9("span", { className: "db-app-menu-shortcut", "aria-hidden": "true", children: "F1" })
|
|
4350
4430
|
]
|
|
4351
4431
|
}
|
|
4352
4432
|
),
|
|
4353
|
-
/* @__PURE__ */
|
|
4433
|
+
/* @__PURE__ */ jsx9(
|
|
4354
4434
|
"a",
|
|
4355
4435
|
{
|
|
4356
4436
|
className: "db-app-menu-item",
|
|
@@ -4363,7 +4443,7 @@ function AppMenu({
|
|
|
4363
4443
|
children: "Documentation"
|
|
4364
4444
|
}
|
|
4365
4445
|
),
|
|
4366
|
-
/* @__PURE__ */
|
|
4446
|
+
/* @__PURE__ */ jsx9(
|
|
4367
4447
|
"button",
|
|
4368
4448
|
{
|
|
4369
4449
|
className: "db-app-menu-item",
|
|
@@ -4377,53 +4457,54 @@ function AppMenu({
|
|
|
4377
4457
|
}
|
|
4378
4458
|
)
|
|
4379
4459
|
] }),
|
|
4380
|
-
showSettings && /* @__PURE__ */
|
|
4381
|
-
/* @__PURE__ */
|
|
4460
|
+
showSettings && /* @__PURE__ */ jsxs8(SettingsDialog, { onClose: () => setShowSettings(false), children: [
|
|
4461
|
+
/* @__PURE__ */ jsx9(
|
|
4382
4462
|
ThemeSettings,
|
|
4383
4463
|
{
|
|
4384
4464
|
value: themePreference,
|
|
4385
4465
|
onChange: (preference) => onThemeChange?.(preference)
|
|
4386
4466
|
}
|
|
4387
4467
|
),
|
|
4388
|
-
/* @__PURE__ */
|
|
4468
|
+
/* @__PURE__ */ jsx9(
|
|
4389
4469
|
AccentColorSettings,
|
|
4390
4470
|
{
|
|
4391
4471
|
value: accentColor,
|
|
4392
4472
|
onChange: (color) => onAccentColorChange?.(color)
|
|
4393
4473
|
}
|
|
4394
4474
|
),
|
|
4395
|
-
/* @__PURE__ */
|
|
4475
|
+
/* @__PURE__ */ jsx9(
|
|
4396
4476
|
InterfaceFontSettings,
|
|
4397
4477
|
{
|
|
4398
4478
|
value: interfaceFont,
|
|
4399
4479
|
onChange: (font) => onInterfaceFontChange?.(font)
|
|
4400
4480
|
}
|
|
4401
4481
|
),
|
|
4402
|
-
/* @__PURE__ */
|
|
4482
|
+
/* @__PURE__ */ jsx9(
|
|
4403
4483
|
WriteCanvasSettingsControls,
|
|
4404
4484
|
{
|
|
4405
4485
|
value: writeCanvasSettings,
|
|
4406
4486
|
onChange: (settings) => onWriteCanvasSettingsChange?.(settings)
|
|
4407
4487
|
}
|
|
4408
4488
|
),
|
|
4409
|
-
/* @__PURE__ */
|
|
4489
|
+
/* @__PURE__ */ jsx9(
|
|
4410
4490
|
ProofingSettingsControls,
|
|
4411
4491
|
{
|
|
4412
4492
|
value: proofingPreferences,
|
|
4413
4493
|
onChange: (settings) => onProofingPreferencesChange?.(settings)
|
|
4414
4494
|
}
|
|
4415
4495
|
),
|
|
4416
|
-
ai && /* @__PURE__ */
|
|
4417
|
-
speech && /* @__PURE__ */
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
/* @__PURE__ */
|
|
4496
|
+
ai && /* @__PURE__ */ jsx9(AiSettingsControls, { ai }),
|
|
4497
|
+
speech && /* @__PURE__ */ jsx9(SpeechSettingsControls, { speech }),
|
|
4498
|
+
tray && /* @__PURE__ */ jsx9(TraySettingsControls, { menu: tray, platform: getHostEnvironment()?.platform }),
|
|
4499
|
+
getStorageEstimate && /* @__PURE__ */ jsxs8("fieldset", { className: "db-settings-fieldset", children: [
|
|
4500
|
+
/* @__PURE__ */ jsx9("legend", { className: "db-settings-legend", children: "Storage" }),
|
|
4501
|
+
/* @__PURE__ */ jsx9("p", { className: "db-settings-hint", children: storageEstimate ? `DocBlocks documents and app data are using ${formatBytes(
|
|
4421
4502
|
storageEstimate.usage
|
|
4422
4503
|
)} of the ${formatBytes(
|
|
4423
4504
|
storageEstimate.quota
|
|
4424
4505
|
)} this browser allows for the site.` : "Storage usage is not available in this browser." }),
|
|
4425
|
-
storagePersistent !== void 0 && /* @__PURE__ */
|
|
4426
|
-
onKeepBrowserData && /* @__PURE__ */
|
|
4506
|
+
storagePersistent !== void 0 && /* @__PURE__ */ jsx9("p", { className: "db-settings-hint", children: storagePersistent ? "Protected from routine browser cleanup on this device." : "Browsers may clear site data under storage pressure unless protection is granted." }),
|
|
4507
|
+
onKeepBrowserData && /* @__PURE__ */ jsx9(
|
|
4427
4508
|
"button",
|
|
4428
4509
|
{
|
|
4429
4510
|
type: "button",
|
|
@@ -4434,16 +4515,16 @@ function AppMenu({
|
|
|
4434
4515
|
}
|
|
4435
4516
|
)
|
|
4436
4517
|
] }),
|
|
4437
|
-
onVersioningPreferenceChange && /* @__PURE__ */
|
|
4438
|
-
/* @__PURE__ */
|
|
4439
|
-
/* @__PURE__ */
|
|
4518
|
+
onVersioningPreferenceChange && /* @__PURE__ */ jsxs8("fieldset", { className: "db-settings-fieldset", children: [
|
|
4519
|
+
/* @__PURE__ */ jsx9("legend", { className: "db-settings-legend", children: "Version history" }),
|
|
4520
|
+
/* @__PURE__ */ jsxs8("p", { className: "db-settings-hint", children: [
|
|
4440
4521
|
"When on, DocBlocks keeps prior revisions of each document inside a sibling",
|
|
4441
4522
|
" ",
|
|
4442
|
-
/* @__PURE__ */
|
|
4523
|
+
/* @__PURE__ */ jsx9("code", { children: "<name>_files/.versions/" }),
|
|
4443
4524
|
" folder. Individual workspaces can override this default in their own settings."
|
|
4444
4525
|
] }),
|
|
4445
|
-
/* @__PURE__ */
|
|
4446
|
-
/* @__PURE__ */
|
|
4526
|
+
/* @__PURE__ */ jsxs8("label", { className: "db-settings-radio", children: [
|
|
4527
|
+
/* @__PURE__ */ jsx9(
|
|
4447
4528
|
"input",
|
|
4448
4529
|
{
|
|
4449
4530
|
type: "radio",
|
|
@@ -4455,8 +4536,8 @@ function AppMenu({
|
|
|
4455
4536
|
),
|
|
4456
4537
|
"On for all workspaces"
|
|
4457
4538
|
] }),
|
|
4458
|
-
/* @__PURE__ */
|
|
4459
|
-
/* @__PURE__ */
|
|
4539
|
+
/* @__PURE__ */ jsxs8("label", { className: "db-settings-radio", children: [
|
|
4540
|
+
/* @__PURE__ */ jsx9(
|
|
4460
4541
|
"input",
|
|
4461
4542
|
{
|
|
4462
4543
|
type: "radio",
|
|
@@ -4468,8 +4549,8 @@ function AppMenu({
|
|
|
4468
4549
|
),
|
|
4469
4550
|
"On in browser workspaces, off for local folders"
|
|
4470
4551
|
] }),
|
|
4471
|
-
/* @__PURE__ */
|
|
4472
|
-
/* @__PURE__ */
|
|
4552
|
+
/* @__PURE__ */ jsxs8("label", { className: "db-settings-radio", children: [
|
|
4553
|
+
/* @__PURE__ */ jsx9(
|
|
4473
4554
|
"input",
|
|
4474
4555
|
{
|
|
4475
4556
|
type: "radio",
|
|
@@ -4481,7 +4562,7 @@ function AppMenu({
|
|
|
4481
4562
|
),
|
|
4482
4563
|
"Off for all workspaces"
|
|
4483
4564
|
] }),
|
|
4484
|
-
onOpenWorkspaceSettings && /* @__PURE__ */
|
|
4565
|
+
onOpenWorkspaceSettings && /* @__PURE__ */ jsx9(
|
|
4485
4566
|
"button",
|
|
4486
4567
|
{
|
|
4487
4568
|
type: "button",
|
|
@@ -4495,38 +4576,38 @@ function AppMenu({
|
|
|
4495
4576
|
)
|
|
4496
4577
|
] })
|
|
4497
4578
|
] }),
|
|
4498
|
-
showAbout && /* @__PURE__ */
|
|
4499
|
-
/* @__PURE__ */
|
|
4500
|
-
/* @__PURE__ */
|
|
4579
|
+
showAbout && /* @__PURE__ */ jsxs8(Dialog, { title: "About DocBlocks", onClose: () => setShowAbout(false), children: [
|
|
4580
|
+
/* @__PURE__ */ jsxs8("p", { children: [
|
|
4581
|
+
/* @__PURE__ */ jsx9("strong", { children: "DocBlocks" }),
|
|
4501
4582
|
" is a local-first Markdown document editor. Your files stay under your control."
|
|
4502
4583
|
] }),
|
|
4503
|
-
appVersion && /* @__PURE__ */
|
|
4504
|
-
/* @__PURE__ */
|
|
4505
|
-
/* @__PURE__ */
|
|
4584
|
+
appVersion && /* @__PURE__ */ jsxs8("p", { className: "db-about-version", children: [
|
|
4585
|
+
/* @__PURE__ */ jsx9("span", { children: "Version" }),
|
|
4586
|
+
/* @__PURE__ */ jsx9("code", { "aria-label": `DocBlocks version ${appVersion}`, children: appVersion })
|
|
4506
4587
|
] }),
|
|
4507
|
-
appBuildDate && /* @__PURE__ */
|
|
4508
|
-
/* @__PURE__ */
|
|
4509
|
-
/* @__PURE__ */
|
|
4588
|
+
appBuildDate && /* @__PURE__ */ jsxs8("p", { className: "db-about-version", children: [
|
|
4589
|
+
/* @__PURE__ */ jsx9("span", { children: "Build" }),
|
|
4590
|
+
/* @__PURE__ */ jsx9("time", { dateTime: appBuildDate, children: displayBuildDate(appBuildDate) })
|
|
4510
4591
|
] }),
|
|
4511
|
-
/* @__PURE__ */
|
|
4592
|
+
/* @__PURE__ */ jsxs8("p", { children: [
|
|
4512
4593
|
"Built with",
|
|
4513
4594
|
" ",
|
|
4514
|
-
/* @__PURE__ */
|
|
4595
|
+
/* @__PURE__ */ jsx9("a", { href: "https://github.com/bendyline/squisq", target: "_blank", rel: "noopener noreferrer", children: "squisq" }),
|
|
4515
4596
|
" ",
|
|
4516
4597
|
"by",
|
|
4517
4598
|
" ",
|
|
4518
|
-
/* @__PURE__ */
|
|
4599
|
+
/* @__PURE__ */ jsx9("a", { href: "https://bendyline.com", target: "_blank", rel: "noopener noreferrer", children: "Bendyline" }),
|
|
4519
4600
|
"."
|
|
4520
4601
|
] }),
|
|
4521
|
-
surface === "web" && /* @__PURE__ */
|
|
4602
|
+
surface === "web" && /* @__PURE__ */ jsxs8("p", { children: [
|
|
4522
4603
|
"See our free desktop apps at",
|
|
4523
4604
|
" ",
|
|
4524
|
-
/* @__PURE__ */
|
|
4605
|
+
/* @__PURE__ */ jsx9("a", { href: MORE_INFORMATION_URLS.electron, target: "_blank", rel: "noopener noreferrer", children: "docblocks.com/desktop" }),
|
|
4525
4606
|
"."
|
|
4526
4607
|
] }),
|
|
4527
|
-
/* @__PURE__ */
|
|
4528
|
-
/* @__PURE__ */
|
|
4529
|
-
/* @__PURE__ */
|
|
4608
|
+
/* @__PURE__ */ jsxs8("p", { className: "db-dialog-links", children: [
|
|
4609
|
+
/* @__PURE__ */ jsx9("a", { href: moreInformationUrl, target: "_blank", rel: "noopener noreferrer", children: "More information..." }),
|
|
4610
|
+
/* @__PURE__ */ jsx9(
|
|
4530
4611
|
"a",
|
|
4531
4612
|
{
|
|
4532
4613
|
href: "https://github.com/bendyline/docblocks",
|
|
@@ -4535,7 +4616,7 @@ function AppMenu({
|
|
|
4535
4616
|
children: "GitHub"
|
|
4536
4617
|
}
|
|
4537
4618
|
),
|
|
4538
|
-
/* @__PURE__ */
|
|
4619
|
+
/* @__PURE__ */ jsx9(
|
|
4539
4620
|
"a",
|
|
4540
4621
|
{
|
|
4541
4622
|
href: "https://github.com/bendyline/docblocks/releases",
|
|
@@ -4544,7 +4625,7 @@ function AppMenu({
|
|
|
4544
4625
|
children: "Release notes"
|
|
4545
4626
|
}
|
|
4546
4627
|
),
|
|
4547
|
-
/* @__PURE__ */
|
|
4628
|
+
/* @__PURE__ */ jsx9(
|
|
4548
4629
|
"a",
|
|
4549
4630
|
{
|
|
4550
4631
|
href: "https://github.com/bendyline/docblocks/issues",
|
|
@@ -4553,7 +4634,7 @@ function AppMenu({
|
|
|
4553
4634
|
children: "Support"
|
|
4554
4635
|
}
|
|
4555
4636
|
),
|
|
4556
|
-
/* @__PURE__ */
|
|
4637
|
+
/* @__PURE__ */ jsx9(
|
|
4557
4638
|
"a",
|
|
4558
4639
|
{
|
|
4559
4640
|
href: "https://github.com/bendyline/docblocks/blob/main/LICENSE",
|
|
@@ -4562,7 +4643,7 @@ function AppMenu({
|
|
|
4562
4643
|
children: "License (MIT)"
|
|
4563
4644
|
}
|
|
4564
4645
|
),
|
|
4565
|
-
/* @__PURE__ */
|
|
4646
|
+
/* @__PURE__ */ jsx9(
|
|
4566
4647
|
"a",
|
|
4567
4648
|
{
|
|
4568
4649
|
href: "https://github.com/bendyline/docblocks/blob/main/NOTICE.md",
|
|
@@ -4630,18 +4711,18 @@ async function restoreBrowserBackup(file) {
|
|
|
4630
4711
|
}
|
|
4631
4712
|
|
|
4632
4713
|
// src/WorkspacePicker/WorkspaceSettingsButton.tsx
|
|
4633
|
-
import { useState as
|
|
4634
|
-
import { jsx as
|
|
4714
|
+
import { useState as useState9, useCallback as useCallback10, useRef as useRef10, useEffect as useEffect10 } from "react";
|
|
4715
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4635
4716
|
function WorkspaceSettingsButton({
|
|
4636
4717
|
onSettings,
|
|
4637
4718
|
onRename,
|
|
4638
4719
|
onDownload,
|
|
4639
4720
|
onRemove
|
|
4640
4721
|
}) {
|
|
4641
|
-
const [isOpen, setIsOpen] =
|
|
4642
|
-
const containerRef =
|
|
4722
|
+
const [isOpen, setIsOpen] = useState9(false);
|
|
4723
|
+
const containerRef = useRef10(null);
|
|
4643
4724
|
const { menuRef, triggerRef, handleMenuKeyDown, handleTriggerKeyDown, closeMenu } = useMenuKeyboard(isOpen, setIsOpen);
|
|
4644
|
-
|
|
4725
|
+
useEffect10(() => {
|
|
4645
4726
|
if (!isOpen) return;
|
|
4646
4727
|
function handleOutsideClick(e) {
|
|
4647
4728
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -4651,15 +4732,15 @@ function WorkspaceSettingsButton({
|
|
|
4651
4732
|
document.addEventListener("mousedown", handleOutsideClick);
|
|
4652
4733
|
return () => document.removeEventListener("mousedown", handleOutsideClick);
|
|
4653
4734
|
}, [closeMenu, isOpen]);
|
|
4654
|
-
const handleAction =
|
|
4735
|
+
const handleAction = useCallback10(
|
|
4655
4736
|
(action) => {
|
|
4656
4737
|
closeMenu(true);
|
|
4657
4738
|
action();
|
|
4658
4739
|
},
|
|
4659
4740
|
[closeMenu]
|
|
4660
4741
|
);
|
|
4661
|
-
return /* @__PURE__ */
|
|
4662
|
-
/* @__PURE__ */
|
|
4742
|
+
return /* @__PURE__ */ jsxs9("div", { ref: containerRef, className: "db-ws-settings", children: [
|
|
4743
|
+
/* @__PURE__ */ jsx10(
|
|
4663
4744
|
"button",
|
|
4664
4745
|
{
|
|
4665
4746
|
ref: triggerRef,
|
|
@@ -4670,10 +4751,10 @@ function WorkspaceSettingsButton({
|
|
|
4670
4751
|
"aria-haspopup": "menu",
|
|
4671
4752
|
"aria-label": "Workspace settings",
|
|
4672
4753
|
title: "Workspace settings",
|
|
4673
|
-
children: /* @__PURE__ */
|
|
4754
|
+
children: /* @__PURE__ */ jsx10(WorkspaceIcon, {})
|
|
4674
4755
|
}
|
|
4675
4756
|
),
|
|
4676
|
-
isOpen && /* @__PURE__ */
|
|
4757
|
+
isOpen && /* @__PURE__ */ jsxs9(
|
|
4677
4758
|
"div",
|
|
4678
4759
|
{
|
|
4679
4760
|
ref: menuRef,
|
|
@@ -4681,7 +4762,7 @@ function WorkspaceSettingsButton({
|
|
|
4681
4762
|
role: "menu",
|
|
4682
4763
|
onKeyDown: handleMenuKeyDown,
|
|
4683
4764
|
children: [
|
|
4684
|
-
/* @__PURE__ */
|
|
4765
|
+
/* @__PURE__ */ jsx10(
|
|
4685
4766
|
"button",
|
|
4686
4767
|
{
|
|
4687
4768
|
className: "db-ws-settings-item",
|
|
@@ -4691,7 +4772,7 @@ function WorkspaceSettingsButton({
|
|
|
4691
4772
|
children: "Workspace settings\u2026"
|
|
4692
4773
|
}
|
|
4693
4774
|
),
|
|
4694
|
-
/* @__PURE__ */
|
|
4775
|
+
/* @__PURE__ */ jsx10(
|
|
4695
4776
|
"button",
|
|
4696
4777
|
{
|
|
4697
4778
|
className: "db-ws-settings-item",
|
|
@@ -4701,7 +4782,7 @@ function WorkspaceSettingsButton({
|
|
|
4701
4782
|
children: "Rename workspace"
|
|
4702
4783
|
}
|
|
4703
4784
|
),
|
|
4704
|
-
/* @__PURE__ */
|
|
4785
|
+
/* @__PURE__ */ jsx10(
|
|
4705
4786
|
"button",
|
|
4706
4787
|
{
|
|
4707
4788
|
className: "db-ws-settings-item",
|
|
@@ -4711,8 +4792,8 @@ function WorkspaceSettingsButton({
|
|
|
4711
4792
|
children: "Back up this workspace"
|
|
4712
4793
|
}
|
|
4713
4794
|
),
|
|
4714
|
-
/* @__PURE__ */
|
|
4715
|
-
/* @__PURE__ */
|
|
4795
|
+
/* @__PURE__ */ jsx10("div", { className: "db-ws-settings-divider" }),
|
|
4796
|
+
/* @__PURE__ */ jsx10(
|
|
4716
4797
|
"button",
|
|
4717
4798
|
{
|
|
4718
4799
|
className: "db-ws-settings-item db-ws-settings-item--danger",
|
|
@@ -4729,7 +4810,7 @@ function WorkspaceSettingsButton({
|
|
|
4729
4810
|
}
|
|
4730
4811
|
|
|
4731
4812
|
// src/WorkspacePicker/WorkspaceSettingsDialog.tsx
|
|
4732
|
-
import { useEffect as
|
|
4813
|
+
import { useEffect as useEffect11, useMemo as useMemo2, useState as useState10 } from "react";
|
|
4733
4814
|
import { getThemeSummaries } from "@bendyline/squisq/schemas";
|
|
4734
4815
|
import {
|
|
4735
4816
|
diffWorkspaceSettings,
|
|
@@ -4783,7 +4864,7 @@ function resolveVersioningEnabled(workspace, globalPref, workspaceSettings) {
|
|
|
4783
4864
|
}
|
|
4784
4865
|
|
|
4785
4866
|
// src/WorkspacePicker/WorkspaceSettingsDialog.tsx
|
|
4786
|
-
import { Fragment as Fragment6, jsx as
|
|
4867
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4787
4868
|
var VERSIONING_LABELS = {
|
|
4788
4869
|
on: "on",
|
|
4789
4870
|
"browser-only": "on for browser workspaces, off for local folders",
|
|
@@ -4832,15 +4913,15 @@ function WorkspaceSettingsDialog({
|
|
|
4832
4913
|
}) {
|
|
4833
4914
|
const writable = isWorkspaceSettingsWritable(settings);
|
|
4834
4915
|
const base = settings.settings;
|
|
4835
|
-
const [draft, setDraft] =
|
|
4916
|
+
const [draft, setDraft] = useState10(
|
|
4836
4917
|
() => initialDraft(workspace, settings.settings)
|
|
4837
4918
|
);
|
|
4838
|
-
const [touched, setTouched] =
|
|
4839
|
-
|
|
4919
|
+
const [touched, setTouched] = useState10(false);
|
|
4920
|
+
useEffect11(() => {
|
|
4840
4921
|
if (!touched) setDraft(initialDraft(workspace, settings.settings));
|
|
4841
4922
|
}, [settings.settings, touched, workspace]);
|
|
4842
|
-
const [saving, setSaving] =
|
|
4843
|
-
const [saveError, setSaveError] =
|
|
4923
|
+
const [saving, setSaving] = useState10(false);
|
|
4924
|
+
const [saveError, setSaveError] = useState10(null);
|
|
4844
4925
|
const themes = useMemo2(() => getThemeSummaries(), []);
|
|
4845
4926
|
const patch = useMemo2(() => diffWorkspaceSettings(base, draft), [base, draft]);
|
|
4846
4927
|
const validation = useMemo2(() => tryApplyWorkspaceSettingsPatch(base, patch), [base, patch]);
|
|
@@ -4865,16 +4946,16 @@ function WorkspaceSettingsDialog({
|
|
|
4865
4946
|
}
|
|
4866
4947
|
};
|
|
4867
4948
|
const notice = settings.status === "loading" ? "Loading workspace settings\u2026" : writable ? null : settings.message ?? "These workspace settings cannot be changed here.";
|
|
4868
|
-
return /* @__PURE__ */
|
|
4949
|
+
return /* @__PURE__ */ jsxs10(
|
|
4869
4950
|
Dialog,
|
|
4870
4951
|
{
|
|
4871
4952
|
title: "Workspace settings",
|
|
4872
4953
|
size: "wide",
|
|
4873
4954
|
onClose,
|
|
4874
4955
|
closeOnBackdrop: !changed,
|
|
4875
|
-
footer: writable ? /* @__PURE__ */
|
|
4876
|
-
/* @__PURE__ */
|
|
4877
|
-
/* @__PURE__ */
|
|
4956
|
+
footer: writable ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
4957
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: "db-git-secondary-btn", onClick: onClose, children: "Cancel" }),
|
|
4958
|
+
/* @__PURE__ */ jsx11(
|
|
4878
4959
|
"button",
|
|
4879
4960
|
{
|
|
4880
4961
|
type: "button",
|
|
@@ -4884,19 +4965,19 @@ function WorkspaceSettingsDialog({
|
|
|
4884
4965
|
children: saving ? "Saving\u2026" : "Save"
|
|
4885
4966
|
}
|
|
4886
4967
|
)
|
|
4887
|
-
] }) : /* @__PURE__ */
|
|
4968
|
+
] }) : /* @__PURE__ */ jsx11("button", { type: "button", className: "db-git-secondary-btn", onClick: onClose, children: "Close" }),
|
|
4888
4969
|
children: [
|
|
4889
|
-
/* @__PURE__ */
|
|
4890
|
-
/* @__PURE__ */
|
|
4970
|
+
/* @__PURE__ */ jsxs10("p", { className: "db-settings-hint", children: [
|
|
4971
|
+
/* @__PURE__ */ jsx11("strong", { children: workspace.name }),
|
|
4891
4972
|
" \xB7",
|
|
4892
4973
|
" ",
|
|
4893
4974
|
isLocal ? "Local folder workspace" : "Browser workspace",
|
|
4894
4975
|
" \xB7 saved in",
|
|
4895
4976
|
" ",
|
|
4896
|
-
/* @__PURE__ */
|
|
4977
|
+
/* @__PURE__ */ jsx11("code", { children: ".docblocks/workspace.json" })
|
|
4897
4978
|
] }),
|
|
4898
|
-
notice && /* @__PURE__ */
|
|
4899
|
-
/* @__PURE__ */
|
|
4979
|
+
notice && /* @__PURE__ */ jsx11("p", { className: "db-settings-status db-settings-status--warning", role: "status", children: notice }),
|
|
4980
|
+
/* @__PURE__ */ jsx11(
|
|
4900
4981
|
WorkspaceSettingsControls,
|
|
4901
4982
|
{
|
|
4902
4983
|
value: draft,
|
|
@@ -4913,14 +4994,14 @@ function WorkspaceSettingsDialog({
|
|
|
4913
4994
|
regenerating: outputsStatus.state === "running"
|
|
4914
4995
|
}
|
|
4915
4996
|
),
|
|
4916
|
-
(saveError || !validation.ok && changed) && /* @__PURE__ */
|
|
4997
|
+
(saveError || !validation.ok && changed) && /* @__PURE__ */ jsx11("p", { className: "db-settings-status db-settings-status--warning", role: "alert", children: saveError ?? (!validation.ok ? validation.message : null) })
|
|
4917
4998
|
]
|
|
4918
4999
|
}
|
|
4919
5000
|
);
|
|
4920
5001
|
}
|
|
4921
5002
|
|
|
4922
5003
|
// src/WorkspaceSettings/useWorkspaceSettings.ts
|
|
4923
|
-
import { useCallback as
|
|
5004
|
+
import { useCallback as useCallback11, useEffect as useEffect12, useRef as useRef11, useState as useState11 } from "react";
|
|
4924
5005
|
import { maybeGetDocBlocksHost } from "@bendyline/docblocks/host";
|
|
4925
5006
|
import { getFileSystemProviderV2 as getFileSystemProviderV24 } from "@bendyline/docblocks/filesystem";
|
|
4926
5007
|
import {
|
|
@@ -4935,15 +5016,15 @@ function sameState(left, right) {
|
|
|
4935
5016
|
}
|
|
4936
5017
|
function useWorkspaceSettings(provider, enabled) {
|
|
4937
5018
|
const providerV2 = provider && enabled ? getFileSystemProviderV24(provider) : null;
|
|
4938
|
-
const [state, setState] =
|
|
5019
|
+
const [state, setState] = useState11(
|
|
4939
5020
|
providerV2 ? LOADING_WORKSPACE_SETTINGS : UNAVAILABLE_WORKSPACE_SETTINGS
|
|
4940
5021
|
);
|
|
4941
|
-
const stateRef =
|
|
5022
|
+
const stateRef = useRef11(state);
|
|
4942
5023
|
stateRef.current = state;
|
|
4943
|
-
const generationRef =
|
|
4944
|
-
const [refreshKey, setRefreshKey] =
|
|
4945
|
-
const refresh =
|
|
4946
|
-
const providerRef =
|
|
5024
|
+
const generationRef = useRef11(0);
|
|
5025
|
+
const [refreshKey, setRefreshKey] = useState11(0);
|
|
5026
|
+
const refresh = useCallback11(() => setRefreshKey((key) => key + 1), []);
|
|
5027
|
+
const providerRef = useRef11(providerV2);
|
|
4947
5028
|
if (providerRef.current !== providerV2) {
|
|
4948
5029
|
providerRef.current = providerV2;
|
|
4949
5030
|
generationRef.current += 1;
|
|
@@ -4951,7 +5032,7 @@ function useWorkspaceSettings(provider, enabled) {
|
|
|
4951
5032
|
stateRef.current = reset;
|
|
4952
5033
|
setState(reset);
|
|
4953
5034
|
}
|
|
4954
|
-
|
|
5035
|
+
useEffect12(() => {
|
|
4955
5036
|
if (!providerV2) return;
|
|
4956
5037
|
const generation = generationRef.current;
|
|
4957
5038
|
let cancelled = false;
|
|
@@ -4966,7 +5047,7 @@ function useWorkspaceSettings(provider, enabled) {
|
|
|
4966
5047
|
cancelled = true;
|
|
4967
5048
|
};
|
|
4968
5049
|
}, [providerV2, refreshKey]);
|
|
4969
|
-
|
|
5050
|
+
useEffect12(() => {
|
|
4970
5051
|
if (!providerV2) return;
|
|
4971
5052
|
window.addEventListener("focus", refresh);
|
|
4972
5053
|
const stopResume = maybeGetDocBlocksHost()?.lifecycle?.onResume?.(refresh);
|
|
@@ -4985,7 +5066,7 @@ function useWorkspaceSettings(provider, enabled) {
|
|
|
4985
5066
|
void subscription?.dispose();
|
|
4986
5067
|
};
|
|
4987
5068
|
}, [providerV2, refresh]);
|
|
4988
|
-
const save =
|
|
5069
|
+
const save = useCallback11(
|
|
4989
5070
|
async (patch) => {
|
|
4990
5071
|
if (!providerV2) throw new Error(UNAVAILABLE_WORKSPACE_SETTINGS.message ?? void 0);
|
|
4991
5072
|
const generation = generationRef.current;
|
|
@@ -5002,7 +5083,7 @@ function useWorkspaceSettings(provider, enabled) {
|
|
|
5002
5083
|
}
|
|
5003
5084
|
|
|
5004
5085
|
// src/WorkspaceSettings/useWorkspaceOutputs.ts
|
|
5005
|
-
import { useEffect as
|
|
5086
|
+
import { useEffect as useEffect13, useState as useState12, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
5006
5087
|
import { getFileSystemProviderV2 as getFileSystemProviderV25 } from "@bendyline/docblocks/filesystem";
|
|
5007
5088
|
import {
|
|
5008
5089
|
createWorkspaceOutputsScheduler,
|
|
@@ -5026,8 +5107,8 @@ var noSubscription = () => () => void 0;
|
|
|
5026
5107
|
var idleStatus = () => IDLE_WORKSPACE_OUTPUTS_STATUS;
|
|
5027
5108
|
function useWorkspaceOutputs(provider, workspaceId, settings, enabled) {
|
|
5028
5109
|
const providerV2 = provider && enabled ? getFileSystemProviderV25(provider) : null;
|
|
5029
|
-
const [scheduler, setScheduler] =
|
|
5030
|
-
|
|
5110
|
+
const [scheduler, setScheduler] = useState12(null);
|
|
5111
|
+
useEffect13(() => {
|
|
5031
5112
|
if (!providerV2 || !workspaceId) {
|
|
5032
5113
|
setScheduler(null);
|
|
5033
5114
|
return;
|
|
@@ -5048,7 +5129,7 @@ function useWorkspaceOutputs(provider, workspaceId, settings, enabled) {
|
|
|
5048
5129
|
next.dispose();
|
|
5049
5130
|
};
|
|
5050
5131
|
}, [providerV2, workspaceId]);
|
|
5051
|
-
|
|
5132
|
+
useEffect13(() => {
|
|
5052
5133
|
scheduler?.updateSettings(settings);
|
|
5053
5134
|
}, [scheduler, settings]);
|
|
5054
5135
|
const status = useSyncExternalStore2(
|
|
@@ -5083,22 +5164,22 @@ async function assertNotGeneratedCatalog(provider, path) {
|
|
|
5083
5164
|
}
|
|
5084
5165
|
|
|
5085
5166
|
// src/WorkspaceSettings/GeneratedFileView.tsx
|
|
5086
|
-
import { Fragment as Fragment7, jsx as
|
|
5167
|
+
import { Fragment as Fragment7, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5087
5168
|
function GeneratedFileNotice({ kind, onOpenSettings, onBack }) {
|
|
5088
|
-
return /* @__PURE__ */
|
|
5089
|
-
onBack && /* @__PURE__ */
|
|
5090
|
-
/* @__PURE__ */
|
|
5091
|
-
/* @__PURE__ */
|
|
5169
|
+
return /* @__PURE__ */ jsxs11("div", { className: "db-generated-file-notice", role: "note", children: [
|
|
5170
|
+
onBack && /* @__PURE__ */ jsx12("button", { type: "button", className: "db-generated-file-back", onClick: onBack, children: "Back to files" }),
|
|
5171
|
+
/* @__PURE__ */ jsxs11("span", { className: "db-generated-file-notice-text", children: [
|
|
5172
|
+
/* @__PURE__ */ jsx12("strong", { children: "Generated by DocBlocks \xB7 read-only." }),
|
|
5092
5173
|
" ",
|
|
5093
5174
|
kind === "catalog-html" ? "This catalog page is rebuilt from the documents in this folder as you save." : "This catalog data is rebuilt from the documents in this folder as you save."
|
|
5094
5175
|
] }),
|
|
5095
|
-
onOpenSettings && /* @__PURE__ */
|
|
5176
|
+
onOpenSettings && /* @__PURE__ */ jsx12("button", { type: "button", className: "db-git-secondary-btn", onClick: onOpenSettings, children: "Catalog settings\u2026" })
|
|
5096
5177
|
] });
|
|
5097
5178
|
}
|
|
5098
5179
|
function GeneratedCatalogPage({ html, fileName, ...notice }) {
|
|
5099
|
-
return /* @__PURE__ */
|
|
5100
|
-
/* @__PURE__ */
|
|
5101
|
-
/* @__PURE__ */
|
|
5180
|
+
return /* @__PURE__ */ jsxs11("div", { className: "db-generated-file", children: [
|
|
5181
|
+
/* @__PURE__ */ jsx12(GeneratedFileNotice, { kind: "catalog-html", ...notice }),
|
|
5182
|
+
/* @__PURE__ */ jsx12(
|
|
5102
5183
|
"iframe",
|
|
5103
5184
|
{
|
|
5104
5185
|
className: "db-generated-file-preview",
|
|
@@ -5111,10 +5192,10 @@ function GeneratedCatalogPage({ html, fileName, ...notice }) {
|
|
|
5111
5192
|
] });
|
|
5112
5193
|
}
|
|
5113
5194
|
function GeneratedFileFrame({ kind, children, ...notice }) {
|
|
5114
|
-
if (!kind) return /* @__PURE__ */
|
|
5115
|
-
return /* @__PURE__ */
|
|
5116
|
-
/* @__PURE__ */
|
|
5117
|
-
/* @__PURE__ */
|
|
5195
|
+
if (!kind) return /* @__PURE__ */ jsx12(Fragment7, { children });
|
|
5196
|
+
return /* @__PURE__ */ jsxs11("div", { className: "db-generated-file", children: [
|
|
5197
|
+
/* @__PURE__ */ jsx12(GeneratedFileNotice, { kind, ...notice }),
|
|
5198
|
+
/* @__PURE__ */ jsx12("div", { className: "db-generated-file-body", children })
|
|
5118
5199
|
] });
|
|
5119
5200
|
}
|
|
5120
5201
|
|
|
@@ -5126,14 +5207,14 @@ import {
|
|
|
5126
5207
|
} from "@bendyline/docblocks/workspace-settings";
|
|
5127
5208
|
|
|
5128
5209
|
// src/hooks/useDocumentSession.ts
|
|
5129
|
-
import { useState as
|
|
5210
|
+
import { useState as useState13, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
5130
5211
|
import {
|
|
5131
5212
|
DocumentRecoveryJournal,
|
|
5132
5213
|
DocumentSession,
|
|
5133
5214
|
getDefaultDocumentRecoveryStorage
|
|
5134
5215
|
} from "@bendyline/docblocks/document";
|
|
5135
5216
|
function useDocumentSession(autoSaveDelayMs = 500) {
|
|
5136
|
-
const [session] =
|
|
5217
|
+
const [session] = useState13(
|
|
5137
5218
|
() => new DocumentSession({
|
|
5138
5219
|
autoSaveDelayMs,
|
|
5139
5220
|
recoveryJournal: new DocumentRecoveryJournal(getDefaultDocumentRecoveryStorage())
|
|
@@ -5149,14 +5230,14 @@ function useDocumentSession(autoSaveDelayMs = 500) {
|
|
|
5149
5230
|
|
|
5150
5231
|
// src/Export/DeferredExportToolbarControls.tsx
|
|
5151
5232
|
import { lazy, Suspense } from "react";
|
|
5152
|
-
import { jsx as
|
|
5233
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
5153
5234
|
var ExportToolbarControlsImplementation = lazy(
|
|
5154
5235
|
() => import("./ExportToolbarControls-HOV424TO.js").then((module) => ({
|
|
5155
5236
|
default: module.ExportToolbarControls
|
|
5156
5237
|
}))
|
|
5157
5238
|
);
|
|
5158
5239
|
function ExportToolbarControls(props) {
|
|
5159
|
-
return /* @__PURE__ */
|
|
5240
|
+
return /* @__PURE__ */ jsx13(Suspense, { fallback: null, children: /* @__PURE__ */ jsx13(ExportToolbarControlsImplementation, { ...props }) });
|
|
5160
5241
|
}
|
|
5161
5242
|
|
|
5162
5243
|
// src/Export/host-export-save.ts
|
|
@@ -5196,27 +5277,27 @@ async function saveBlobToHost(exports, documentId, blob, filename, grantId) {
|
|
|
5196
5277
|
}
|
|
5197
5278
|
|
|
5198
5279
|
// src/Git/useGit.ts
|
|
5199
|
-
import { useCallback as
|
|
5280
|
+
import { useCallback as useCallback13, useEffect as useEffect15, useMemo as useMemo3, useRef as useRef13, useState as useState15 } from "react";
|
|
5200
5281
|
import { maybeGetDocBlocksHost as maybeGetDocBlocksHost2 } from "@bendyline/docblocks/host";
|
|
5201
5282
|
|
|
5202
5283
|
// src/Git/useGitStatus.ts
|
|
5203
|
-
import { useCallback as
|
|
5284
|
+
import { useCallback as useCallback12, useEffect as useEffect14, useRef as useRef12, useState as useState14 } from "react";
|
|
5204
5285
|
var SCHEDULE_REFRESH_MS = 1500;
|
|
5205
5286
|
function statusKey(status) {
|
|
5206
5287
|
return JSON.stringify(status);
|
|
5207
5288
|
}
|
|
5208
5289
|
function useGitStatus(gitApi, repositoryId, enabled) {
|
|
5209
|
-
const [status, setStatus] =
|
|
5210
|
-
const lastKeyRef =
|
|
5211
|
-
const timerRef =
|
|
5212
|
-
const generationRef =
|
|
5213
|
-
const apply =
|
|
5290
|
+
const [status, setStatus] = useState14(null);
|
|
5291
|
+
const lastKeyRef = useRef12(null);
|
|
5292
|
+
const timerRef = useRef12(null);
|
|
5293
|
+
const generationRef = useRef12(0);
|
|
5294
|
+
const apply = useCallback12((next) => {
|
|
5214
5295
|
const key = statusKey(next);
|
|
5215
5296
|
if (key === lastKeyRef.current) return;
|
|
5216
5297
|
lastKeyRef.current = key;
|
|
5217
5298
|
setStatus(next);
|
|
5218
5299
|
}, []);
|
|
5219
|
-
|
|
5300
|
+
useEffect14(() => {
|
|
5220
5301
|
generationRef.current += 1;
|
|
5221
5302
|
if (timerRef.current) {
|
|
5222
5303
|
clearTimeout(timerRef.current);
|
|
@@ -5234,7 +5315,7 @@ function useGitStatus(gitApi, repositoryId, enabled) {
|
|
|
5234
5315
|
unsubscribe();
|
|
5235
5316
|
};
|
|
5236
5317
|
}, [gitApi, repositoryId, enabled, apply]);
|
|
5237
|
-
const refresh =
|
|
5318
|
+
const refresh = useCallback12(() => {
|
|
5238
5319
|
if (!gitApi || !repositoryId || !enabled) return;
|
|
5239
5320
|
const generation = generationRef.current;
|
|
5240
5321
|
void gitApi.status(repositoryId).then(
|
|
@@ -5248,14 +5329,14 @@ function useGitStatus(gitApi, repositoryId, enabled) {
|
|
|
5248
5329
|
() => void 0
|
|
5249
5330
|
);
|
|
5250
5331
|
}, [gitApi, repositoryId, enabled, apply]);
|
|
5251
|
-
const scheduleRefresh =
|
|
5332
|
+
const scheduleRefresh = useCallback12(() => {
|
|
5252
5333
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
5253
5334
|
timerRef.current = setTimeout(() => {
|
|
5254
5335
|
timerRef.current = null;
|
|
5255
5336
|
refresh();
|
|
5256
5337
|
}, SCHEDULE_REFRESH_MS);
|
|
5257
5338
|
}, [refresh]);
|
|
5258
|
-
|
|
5339
|
+
useEffect14(() => {
|
|
5259
5340
|
return () => {
|
|
5260
5341
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
5261
5342
|
};
|
|
@@ -5281,8 +5362,8 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5281
5362
|
const host = maybeGetDocBlocksHost2();
|
|
5282
5363
|
const gitApi = host?.git ?? null;
|
|
5283
5364
|
const workspaceId = gitApi ? requestedWorkspaceId : null;
|
|
5284
|
-
const [capabilities, setCapabilities] =
|
|
5285
|
-
|
|
5365
|
+
const [capabilities, setCapabilities] = useState15(null);
|
|
5366
|
+
useEffect15(() => {
|
|
5286
5367
|
if (!gitApi) return;
|
|
5287
5368
|
let cancelled = false;
|
|
5288
5369
|
let timer = null;
|
|
@@ -5308,10 +5389,10 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5308
5389
|
};
|
|
5309
5390
|
}, [gitApi]);
|
|
5310
5391
|
const available = gitApi !== null && capabilities?.gitAvailable === true;
|
|
5311
|
-
const [repo, setRepo] =
|
|
5312
|
-
const [remoteWeb, setRemoteWeb] =
|
|
5313
|
-
const [pendingGrant, setPendingGrant] =
|
|
5314
|
-
const loadRemote =
|
|
5392
|
+
const [repo, setRepo] = useState15(null);
|
|
5393
|
+
const [remoteWeb, setRemoteWeb] = useState15(null);
|
|
5394
|
+
const [pendingGrant, setPendingGrant] = useState15(null);
|
|
5395
|
+
const loadRemote = useCallback13(
|
|
5315
5396
|
(repositoryId2, isCancelled) => {
|
|
5316
5397
|
if (!gitApi) return;
|
|
5317
5398
|
void gitApi.listRemotes(repositoryId2).then(
|
|
@@ -5325,7 +5406,7 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5325
5406
|
},
|
|
5326
5407
|
[gitApi]
|
|
5327
5408
|
);
|
|
5328
|
-
|
|
5409
|
+
useEffect15(() => {
|
|
5329
5410
|
setRepo(null);
|
|
5330
5411
|
setRemoteWeb(null);
|
|
5331
5412
|
setPendingGrant(null);
|
|
@@ -5351,8 +5432,8 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5351
5432
|
cancelled = true;
|
|
5352
5433
|
};
|
|
5353
5434
|
}, [gitApi, workspaceId, available, loadRemote]);
|
|
5354
|
-
const [grantBusy, setGrantBusy] =
|
|
5355
|
-
const enableExpandedRepo =
|
|
5435
|
+
const [grantBusy, setGrantBusy] = useState15(false);
|
|
5436
|
+
const enableExpandedRepo = useCallback13(
|
|
5356
5437
|
async (opts) => {
|
|
5357
5438
|
if (!gitApi || !workspaceId) return false;
|
|
5358
5439
|
setGrantBusy(true);
|
|
@@ -5373,15 +5454,15 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5373
5454
|
const isRepo = repositoryId !== null;
|
|
5374
5455
|
const { status, refresh, scheduleRefresh } = useGitStatus(gitApi, repositoryId, isRepo);
|
|
5375
5456
|
const badges = useMemo3(() => buildBadgeMap(status?.changes ?? []), [status]);
|
|
5376
|
-
const [busy, setBusy] =
|
|
5377
|
-
const [lastResult, setLastResult] =
|
|
5378
|
-
const [dialog, setDialog] =
|
|
5379
|
-
const openDialog =
|
|
5457
|
+
const [busy, setBusy] = useState15(null);
|
|
5458
|
+
const [lastResult, setLastResult] = useState15(null);
|
|
5459
|
+
const [dialog, setDialog] = useState15({ kind: "none" });
|
|
5460
|
+
const openDialog = useCallback13((next) => {
|
|
5380
5461
|
setLastResult(null);
|
|
5381
5462
|
setDialog(next);
|
|
5382
5463
|
}, []);
|
|
5383
|
-
const closeDialog =
|
|
5384
|
-
const routeError =
|
|
5464
|
+
const closeDialog = useCallback13(() => setDialog({ kind: "none" }), []);
|
|
5465
|
+
const routeError = useCallback13(
|
|
5385
5466
|
(operation, error) => {
|
|
5386
5467
|
if (error.code === "auth-failed") {
|
|
5387
5468
|
setDialog({
|
|
@@ -5395,15 +5476,15 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5395
5476
|
},
|
|
5396
5477
|
[]
|
|
5397
5478
|
);
|
|
5398
|
-
const statusRef =
|
|
5399
|
-
|
|
5479
|
+
const statusRef = useRef13(status);
|
|
5480
|
+
useEffect15(() => {
|
|
5400
5481
|
statusRef.current = status;
|
|
5401
5482
|
}, [status]);
|
|
5402
|
-
const workingTreeChangedRef =
|
|
5403
|
-
|
|
5483
|
+
const workingTreeChangedRef = useRef13(onWorkingTreeChanged);
|
|
5484
|
+
useEffect15(() => {
|
|
5404
5485
|
workingTreeChangedRef.current = onWorkingTreeChanged;
|
|
5405
5486
|
}, [onWorkingTreeChanged]);
|
|
5406
|
-
const runAction =
|
|
5487
|
+
const runAction = useCallback13(
|
|
5407
5488
|
async (kind, operation, action, successMessage) => {
|
|
5408
5489
|
if (!gitApi || !repositoryId) return false;
|
|
5409
5490
|
setBusy(kind);
|
|
@@ -5433,7 +5514,7 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5433
5514
|
},
|
|
5434
5515
|
[gitApi, repositoryId, refresh, routeError]
|
|
5435
5516
|
);
|
|
5436
|
-
const commit =
|
|
5517
|
+
const commit = useCallback13(
|
|
5437
5518
|
(message, paths) => runAction(
|
|
5438
5519
|
"commit",
|
|
5439
5520
|
"commit",
|
|
@@ -5442,7 +5523,7 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5442
5523
|
),
|
|
5443
5524
|
[runAction]
|
|
5444
5525
|
);
|
|
5445
|
-
const push =
|
|
5526
|
+
const push = useCallback13(async () => {
|
|
5446
5527
|
const setUpstream = statusRef.current?.upstream === null;
|
|
5447
5528
|
await runAction(
|
|
5448
5529
|
"push",
|
|
@@ -5451,13 +5532,13 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5451
5532
|
setUpstream ? "Branch published" : "Pushed"
|
|
5452
5533
|
);
|
|
5453
5534
|
}, [runAction]);
|
|
5454
|
-
const pull =
|
|
5535
|
+
const pull = useCallback13(async () => {
|
|
5455
5536
|
await runAction("pull", "pull", (api, repository) => api.pull(repository), "Pulled");
|
|
5456
5537
|
}, [runAction]);
|
|
5457
|
-
const fetchRemote =
|
|
5538
|
+
const fetchRemote = useCallback13(async () => {
|
|
5458
5539
|
await runAction("fetch", "fetch", (api, repository) => api.fetch(repository), "Fetched");
|
|
5459
5540
|
}, [runAction]);
|
|
5460
|
-
const createBranch =
|
|
5541
|
+
const createBranch = useCallback13(
|
|
5461
5542
|
(name) => runAction(
|
|
5462
5543
|
"branch",
|
|
5463
5544
|
"branch",
|
|
@@ -5466,7 +5547,7 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5466
5547
|
),
|
|
5467
5548
|
[runAction]
|
|
5468
5549
|
);
|
|
5469
|
-
const switchBranch =
|
|
5550
|
+
const switchBranch = useCallback13(
|
|
5470
5551
|
(name) => runAction(
|
|
5471
5552
|
"branch",
|
|
5472
5553
|
"branch",
|
|
@@ -5475,7 +5556,7 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5475
5556
|
),
|
|
5476
5557
|
[runAction]
|
|
5477
5558
|
);
|
|
5478
|
-
const openOnRemote =
|
|
5559
|
+
const openOnRemote = useCallback13(
|
|
5479
5560
|
(filePath) => {
|
|
5480
5561
|
if (!remoteWeb || !host) return;
|
|
5481
5562
|
let url = remoteWeb.webUrl;
|
|
@@ -5487,7 +5568,7 @@ function useGit(provider, requestedWorkspaceId, theme, onWorkingTreeChanged) {
|
|
|
5487
5568
|
},
|
|
5488
5569
|
[remoteWeb, host]
|
|
5489
5570
|
);
|
|
5490
|
-
const createPullRequest =
|
|
5571
|
+
const createPullRequest = useCallback13(async () => {
|
|
5491
5572
|
if (!gitApi || !repositoryId) return;
|
|
5492
5573
|
setBusy("pr");
|
|
5493
5574
|
setLastResult(null);
|
|
@@ -5611,7 +5692,7 @@ function retainFileSystemProvider(provider) {
|
|
|
5611
5692
|
}
|
|
5612
5693
|
|
|
5613
5694
|
// src/DocBlocksShell/document-title.ts
|
|
5614
|
-
import { useEffect as
|
|
5695
|
+
import { useEffect as useEffect16 } from "react";
|
|
5615
5696
|
var APP_TITLE = "DocBlocks";
|
|
5616
5697
|
var INSTALLED_DISPLAY_QUERIES = [
|
|
5617
5698
|
"(display-mode: window-controls-overlay)",
|
|
@@ -5635,7 +5716,7 @@ function titleForSelectedFile(selectedFile, homeDocumentTitle = APP_TITLE, homeD
|
|
|
5635
5716
|
return includeAppName ? `${name} - ${APP_TITLE}` : name;
|
|
5636
5717
|
}
|
|
5637
5718
|
function useDocumentTitle(selectedFile, homeDocumentTitle, homeDocumentPath) {
|
|
5638
|
-
|
|
5719
|
+
useEffect16(() => {
|
|
5639
5720
|
if (typeof document === "undefined") return;
|
|
5640
5721
|
const displayQueries = typeof globalThis.matchMedia === "function" ? INSTALLED_DISPLAY_QUERIES.map((query) => globalThis.matchMedia(query)) : [];
|
|
5641
5722
|
const updateTitle = () => {
|
|
@@ -5959,37 +6040,37 @@ function summariseImport(result) {
|
|
|
5959
6040
|
}
|
|
5960
6041
|
|
|
5961
6042
|
// src/components/usePromptDialog.ts
|
|
5962
|
-
import React2, { useCallback as
|
|
6043
|
+
import React2, { useCallback as useCallback15, useEffect as useEffect18, useRef as useRef15, useState as useState17 } from "react";
|
|
5963
6044
|
|
|
5964
6045
|
// src/components/PromptDialog.tsx
|
|
5965
|
-
import { useCallback as
|
|
5966
|
-
import { Fragment as Fragment8, jsx as
|
|
6046
|
+
import { useCallback as useCallback14, useEffect as useEffect17, useId as useId3, useRef as useRef14, useState as useState16 } from "react";
|
|
6047
|
+
import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5967
6048
|
function PromptDialog({ request, onSettle }) {
|
|
5968
|
-
const [value, setValue] =
|
|
5969
|
-
const inputRef =
|
|
6049
|
+
const [value, setValue] = useState16(request.initialValue ?? "");
|
|
6050
|
+
const inputRef = useRef14(null);
|
|
5970
6051
|
const inputId = useId3();
|
|
5971
|
-
const cancel =
|
|
5972
|
-
const submit =
|
|
6052
|
+
const cancel = useCallback14(() => onSettle(null), [onSettle]);
|
|
6053
|
+
const submit = useCallback14(() => {
|
|
5973
6054
|
if (value.trim() === "") return;
|
|
5974
6055
|
onSettle(value);
|
|
5975
6056
|
}, [onSettle, value]);
|
|
5976
6057
|
const initialSelection = request.initialSelection;
|
|
5977
|
-
|
|
6058
|
+
useEffect17(() => {
|
|
5978
6059
|
const input = inputRef.current;
|
|
5979
6060
|
if (!input) return;
|
|
5980
6061
|
if (initialSelection) input.setSelectionRange(initialSelection[0], initialSelection[1]);
|
|
5981
6062
|
else input.select();
|
|
5982
6063
|
}, []);
|
|
5983
|
-
return /* @__PURE__ */
|
|
6064
|
+
return /* @__PURE__ */ jsx14(
|
|
5984
6065
|
Dialog,
|
|
5985
6066
|
{
|
|
5986
6067
|
title: request.title,
|
|
5987
6068
|
onClose: cancel,
|
|
5988
6069
|
initialFocusRef: inputRef,
|
|
5989
6070
|
closeOnBackdrop: false,
|
|
5990
|
-
footer: /* @__PURE__ */
|
|
5991
|
-
/* @__PURE__ */
|
|
5992
|
-
/* @__PURE__ */
|
|
6071
|
+
footer: /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
6072
|
+
/* @__PURE__ */ jsx14("button", { type: "button", className: "db-git-secondary-btn", onClick: cancel, children: "Cancel" }),
|
|
6073
|
+
/* @__PURE__ */ jsx14(
|
|
5993
6074
|
"button",
|
|
5994
6075
|
{
|
|
5995
6076
|
type: "button",
|
|
@@ -6000,9 +6081,9 @@ function PromptDialog({ request, onSettle }) {
|
|
|
6000
6081
|
}
|
|
6001
6082
|
)
|
|
6002
6083
|
] }),
|
|
6003
|
-
children: /* @__PURE__ */
|
|
6004
|
-
/* @__PURE__ */
|
|
6005
|
-
/* @__PURE__ */
|
|
6084
|
+
children: /* @__PURE__ */ jsxs12("div", { className: "db-git-form-row", children: [
|
|
6085
|
+
/* @__PURE__ */ jsx14("label", { className: "db-git-form-label", htmlFor: inputId, children: request.label }),
|
|
6086
|
+
/* @__PURE__ */ jsx14(
|
|
6006
6087
|
"input",
|
|
6007
6088
|
{
|
|
6008
6089
|
id: inputId,
|
|
@@ -6025,17 +6106,17 @@ function PromptDialog({ request, onSettle }) {
|
|
|
6025
6106
|
|
|
6026
6107
|
// src/components/usePromptDialog.ts
|
|
6027
6108
|
function usePromptDialog() {
|
|
6028
|
-
const [pending, setPending] =
|
|
6029
|
-
const pendingRef =
|
|
6030
|
-
const nextIdRef =
|
|
6031
|
-
const settlePending =
|
|
6109
|
+
const [pending, setPending] = useState17(null);
|
|
6110
|
+
const pendingRef = useRef15(null);
|
|
6111
|
+
const nextIdRef = useRef15(0);
|
|
6112
|
+
const settlePending = useCallback15((value) => {
|
|
6032
6113
|
const current = pendingRef.current;
|
|
6033
6114
|
if (!current) return;
|
|
6034
6115
|
pendingRef.current = null;
|
|
6035
6116
|
setPending((open) => open?.id === current.id ? null : open);
|
|
6036
6117
|
current.settle(value);
|
|
6037
6118
|
}, []);
|
|
6038
|
-
const prompt =
|
|
6119
|
+
const prompt = useCallback15(
|
|
6039
6120
|
(request) => new Promise((resolve) => {
|
|
6040
6121
|
settlePending(null);
|
|
6041
6122
|
const next = { id: ++nextIdRef.current, request, settle: resolve };
|
|
@@ -6044,7 +6125,7 @@ function usePromptDialog() {
|
|
|
6044
6125
|
}),
|
|
6045
6126
|
[settlePending]
|
|
6046
6127
|
);
|
|
6047
|
-
|
|
6128
|
+
useEffect18(() => {
|
|
6048
6129
|
return () => settlePending(null);
|
|
6049
6130
|
}, [settlePending]);
|
|
6050
6131
|
const promptDialog = pending ? React2.createElement(PromptDialog, {
|
|
@@ -6057,37 +6138,37 @@ function usePromptDialog() {
|
|
|
6057
6138
|
}
|
|
6058
6139
|
|
|
6059
6140
|
// src/components/NewDocumentDialog.tsx
|
|
6060
|
-
import { useCallback as
|
|
6061
|
-
import { Fragment as Fragment9, jsx as
|
|
6141
|
+
import { useCallback as useCallback16, useEffect as useEffect19, useId as useId4, useRef as useRef16, useState as useState18 } from "react";
|
|
6142
|
+
import { Fragment as Fragment9, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6062
6143
|
function NewDocumentDialog({
|
|
6063
6144
|
onSettle,
|
|
6064
6145
|
initialFormat = "markdown"
|
|
6065
6146
|
}) {
|
|
6066
|
-
const [name, setName] =
|
|
6067
|
-
const [format, setFormat] =
|
|
6068
|
-
const inputRef =
|
|
6147
|
+
const [name, setName] = useState18("Untitled");
|
|
6148
|
+
const [format, setFormat] = useState18(initialFormat);
|
|
6149
|
+
const inputRef = useRef16(null);
|
|
6069
6150
|
const nameId = useId4();
|
|
6070
6151
|
const formatId = useId4();
|
|
6071
6152
|
const hintId = useId4();
|
|
6072
6153
|
const hint = newFileFormatHint(format);
|
|
6073
6154
|
const filename = newFileName(name, format);
|
|
6074
|
-
const cancel =
|
|
6075
|
-
const submit =
|
|
6155
|
+
const cancel = useCallback16(() => onSettle(null), [onSettle]);
|
|
6156
|
+
const submit = useCallback16(() => {
|
|
6076
6157
|
if (filename) onSettle({ filename, format });
|
|
6077
6158
|
}, [filename, format, onSettle]);
|
|
6078
|
-
|
|
6159
|
+
useEffect19(() => {
|
|
6079
6160
|
inputRef.current?.select();
|
|
6080
6161
|
}, []);
|
|
6081
|
-
return /* @__PURE__ */
|
|
6162
|
+
return /* @__PURE__ */ jsx15(
|
|
6082
6163
|
Dialog,
|
|
6083
6164
|
{
|
|
6084
6165
|
title: "New document",
|
|
6085
6166
|
onClose: cancel,
|
|
6086
6167
|
initialFocusRef: inputRef,
|
|
6087
6168
|
closeOnBackdrop: false,
|
|
6088
|
-
footer: /* @__PURE__ */
|
|
6089
|
-
/* @__PURE__ */
|
|
6090
|
-
/* @__PURE__ */
|
|
6169
|
+
footer: /* @__PURE__ */ jsxs13(Fragment9, { children: [
|
|
6170
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: "db-git-secondary-btn", onClick: cancel, children: "Cancel" }),
|
|
6171
|
+
/* @__PURE__ */ jsx15(
|
|
6091
6172
|
"button",
|
|
6092
6173
|
{
|
|
6093
6174
|
type: "button",
|
|
@@ -6098,9 +6179,9 @@ function NewDocumentDialog({
|
|
|
6098
6179
|
}
|
|
6099
6180
|
)
|
|
6100
6181
|
] }),
|
|
6101
|
-
children: /* @__PURE__ */
|
|
6102
|
-
/* @__PURE__ */
|
|
6103
|
-
/* @__PURE__ */
|
|
6182
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "db-new-document-fields", children: [
|
|
6183
|
+
/* @__PURE__ */ jsx15("label", { className: "db-git-form-label", htmlFor: nameId, children: "Document name" }),
|
|
6184
|
+
/* @__PURE__ */ jsx15(
|
|
6104
6185
|
"input",
|
|
6105
6186
|
{
|
|
6106
6187
|
id: nameId,
|
|
@@ -6116,8 +6197,8 @@ function NewDocumentDialog({
|
|
|
6116
6197
|
}
|
|
6117
6198
|
}
|
|
6118
6199
|
),
|
|
6119
|
-
/* @__PURE__ */
|
|
6120
|
-
/* @__PURE__ */
|
|
6200
|
+
/* @__PURE__ */ jsx15("label", { className: "db-git-form-label", htmlFor: formatId, children: "Type" }),
|
|
6201
|
+
/* @__PURE__ */ jsx15(
|
|
6121
6202
|
"select",
|
|
6122
6203
|
{
|
|
6123
6204
|
id: formatId,
|
|
@@ -6125,10 +6206,10 @@ function NewDocumentDialog({
|
|
|
6125
6206
|
"aria-describedby": hint ? hintId : void 0,
|
|
6126
6207
|
value: format,
|
|
6127
6208
|
onChange: (e) => setFormat(e.target.value),
|
|
6128
|
-
children: /* @__PURE__ */
|
|
6209
|
+
children: /* @__PURE__ */ jsx15(NewFileFormatOptions, {})
|
|
6129
6210
|
}
|
|
6130
6211
|
),
|
|
6131
|
-
hint && /* @__PURE__ */
|
|
6212
|
+
hint && /* @__PURE__ */ jsx15("p", { id: hintId, className: "db-new-document-hint", children: hint })
|
|
6132
6213
|
] })
|
|
6133
6214
|
}
|
|
6134
6215
|
);
|
|
@@ -6136,7 +6217,7 @@ function NewDocumentDialog({
|
|
|
6136
6217
|
|
|
6137
6218
|
// src/DocBlocksShell/EditorErrorBoundary.tsx
|
|
6138
6219
|
import { Component } from "react";
|
|
6139
|
-
import { jsx as
|
|
6220
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6140
6221
|
var EditorErrorBoundary = class extends Component {
|
|
6141
6222
|
constructor() {
|
|
6142
6223
|
super(...arguments);
|
|
@@ -6151,11 +6232,11 @@ var EditorErrorBoundary = class extends Component {
|
|
|
6151
6232
|
render() {
|
|
6152
6233
|
const { error } = this.state;
|
|
6153
6234
|
if (!error) return this.props.children;
|
|
6154
|
-
return /* @__PURE__ */
|
|
6155
|
-
/* @__PURE__ */
|
|
6156
|
-
/* @__PURE__ */
|
|
6157
|
-
/* @__PURE__ */
|
|
6158
|
-
/* @__PURE__ */
|
|
6235
|
+
return /* @__PURE__ */ jsx16("div", { className: "db-shell-empty db-shell-empty--workspace", role: "alert", children: /* @__PURE__ */ jsxs14("div", { className: "db-workspace-empty-content", children: [
|
|
6236
|
+
/* @__PURE__ */ jsx16("h1", { children: "This document couldn\u2019t be displayed" }),
|
|
6237
|
+
/* @__PURE__ */ jsx16("p", { children: "The editor ran into a problem drawing it. The document itself is unaffected." }),
|
|
6238
|
+
/* @__PURE__ */ jsx16("div", { className: "db-workspace-empty-actions", children: /* @__PURE__ */ jsx16("button", { type: "button", onClick: () => this.setState({ error: null }), children: "Try again" }) }),
|
|
6239
|
+
/* @__PURE__ */ jsx16("p", { className: "db-workspace-empty-hint", children: error.message })
|
|
6159
6240
|
] }) });
|
|
6160
6241
|
}
|
|
6161
6242
|
};
|
|
@@ -6444,10 +6525,10 @@ function saveViewPreferences(preferences) {
|
|
|
6444
6525
|
}
|
|
6445
6526
|
|
|
6446
6527
|
// src/layout/useFormFactor.ts
|
|
6447
|
-
import { useEffect as
|
|
6528
|
+
import { useEffect as useEffect21, useMemo as useMemo4, useState as useState20 } from "react";
|
|
6448
6529
|
|
|
6449
6530
|
// src/layout/useMediaQuery.ts
|
|
6450
|
-
import { useEffect as
|
|
6531
|
+
import { useEffect as useEffect20, useState as useState19 } from "react";
|
|
6451
6532
|
var INSTALLED_DISPLAY_QUERIES2 = [
|
|
6452
6533
|
"(display-mode: window-controls-overlay)",
|
|
6453
6534
|
"(display-mode: standalone)"
|
|
@@ -6460,8 +6541,8 @@ function isInstalledDisplayMode() {
|
|
|
6460
6541
|
return INSTALLED_DISPLAY_QUERIES2.some(matchesMediaQuery);
|
|
6461
6542
|
}
|
|
6462
6543
|
function useMediaQuery(query) {
|
|
6463
|
-
const [matches, setMatches] =
|
|
6464
|
-
|
|
6544
|
+
const [matches, setMatches] = useState19(() => matchesMediaQuery(query));
|
|
6545
|
+
useEffect20(() => {
|
|
6465
6546
|
if (typeof globalThis.matchMedia !== "function") return;
|
|
6466
6547
|
const list = globalThis.matchMedia(query);
|
|
6467
6548
|
const update = () => setMatches(list.matches);
|
|
@@ -6480,11 +6561,11 @@ function initialSize() {
|
|
|
6480
6561
|
return { width: window.innerWidth, height: window.innerHeight };
|
|
6481
6562
|
}
|
|
6482
6563
|
function useFormFactor(rootRef, override) {
|
|
6483
|
-
const [size, setSize] =
|
|
6564
|
+
const [size, setSize] = useState20(initialSize);
|
|
6484
6565
|
const coarse = useMediaQuery(COARSE_POINTER_QUERY);
|
|
6485
6566
|
const anyHover = useMediaQuery(ANY_HOVER_QUERY);
|
|
6486
|
-
const [installed, setInstalled] =
|
|
6487
|
-
|
|
6567
|
+
const [installed, setInstalled] = useState20(isInstalledDisplayMode);
|
|
6568
|
+
useEffect21(() => {
|
|
6488
6569
|
const element = rootRef.current;
|
|
6489
6570
|
const readWindow = () => setSize(initialSize());
|
|
6490
6571
|
if (!element || typeof ResizeObserver === "undefined") {
|
|
@@ -6508,7 +6589,7 @@ function useFormFactor(rootRef, override) {
|
|
|
6508
6589
|
observer.observe(element);
|
|
6509
6590
|
return () => observer.disconnect();
|
|
6510
6591
|
}, [rootRef]);
|
|
6511
|
-
|
|
6592
|
+
useEffect21(() => {
|
|
6512
6593
|
if (typeof globalThis.matchMedia !== "function") return;
|
|
6513
6594
|
const update = () => setInstalled(isInstalledDisplayMode());
|
|
6514
6595
|
const lists = ["(display-mode: window-controls-overlay)", "(display-mode: standalone)"].map(
|
|
@@ -6535,9 +6616,9 @@ function useFormFactor(rootRef, override) {
|
|
|
6535
6616
|
}
|
|
6536
6617
|
|
|
6537
6618
|
// src/layout/useInert.ts
|
|
6538
|
-
import { useEffect as
|
|
6619
|
+
import { useEffect as useEffect22 } from "react";
|
|
6539
6620
|
function useInert(ref, inert) {
|
|
6540
|
-
|
|
6621
|
+
useEffect22(() => {
|
|
6541
6622
|
const element = ref.current;
|
|
6542
6623
|
if (!element) return;
|
|
6543
6624
|
element.toggleAttribute("inert", inert);
|
|
@@ -6546,9 +6627,9 @@ function useInert(ref, inert) {
|
|
|
6546
6627
|
}
|
|
6547
6628
|
|
|
6548
6629
|
// src/layout/useKeyboardInset.ts
|
|
6549
|
-
import { useEffect as
|
|
6630
|
+
import { useEffect as useEffect23 } from "react";
|
|
6550
6631
|
function useKeyboardInset(enabled) {
|
|
6551
|
-
|
|
6632
|
+
useEffect23(() => {
|
|
6552
6633
|
if (!enabled || typeof window === "undefined") return;
|
|
6553
6634
|
const viewport = window.visualViewport;
|
|
6554
6635
|
if (!viewport) return;
|
|
@@ -6580,10 +6661,10 @@ function useKeyboardInset(enabled) {
|
|
|
6580
6661
|
}
|
|
6581
6662
|
|
|
6582
6663
|
// src/layout/useFormFactorAttributes.ts
|
|
6583
|
-
import { useEffect as
|
|
6664
|
+
import { useEffect as useEffect24, useRef as useRef17 } from "react";
|
|
6584
6665
|
function useFormFactorAttributes(rootRef, formFactor, layoutMode, drawerOpen) {
|
|
6585
|
-
const published =
|
|
6586
|
-
|
|
6666
|
+
const published = useRef17(/* @__PURE__ */ new Map());
|
|
6667
|
+
useEffect24(() => {
|
|
6587
6668
|
const owned = published.current;
|
|
6588
6669
|
return () => {
|
|
6589
6670
|
for (const [target, names] of owned) {
|
|
@@ -6592,7 +6673,7 @@ function useFormFactorAttributes(rootRef, formFactor, layoutMode, drawerOpen) {
|
|
|
6592
6673
|
owned.clear();
|
|
6593
6674
|
};
|
|
6594
6675
|
}, []);
|
|
6595
|
-
|
|
6676
|
+
useEffect24(() => {
|
|
6596
6677
|
if (typeof document === "undefined") return;
|
|
6597
6678
|
const attributes = {
|
|
6598
6679
|
...formFactorDataAttributes(formFactor, layoutMode)
|
|
@@ -6618,10 +6699,10 @@ function useFormFactorAttributes(rootRef, formFactor, layoutMode, drawerOpen) {
|
|
|
6618
6699
|
}
|
|
6619
6700
|
|
|
6620
6701
|
// src/layout/useInterfaceFontAttribute.ts
|
|
6621
|
-
import { useEffect as
|
|
6702
|
+
import { useEffect as useEffect25 } from "react";
|
|
6622
6703
|
var INTERFACE_FONT_ATTRIBUTE = "data-db-interface-font";
|
|
6623
6704
|
function useInterfaceFontAttribute(preference) {
|
|
6624
|
-
|
|
6705
|
+
useEffect25(() => {
|
|
6625
6706
|
if (typeof document === "undefined") return;
|
|
6626
6707
|
const root = document.documentElement;
|
|
6627
6708
|
if (preference !== "system") {
|
|
@@ -6634,7 +6715,7 @@ function useInterfaceFontAttribute(preference) {
|
|
|
6634
6715
|
}
|
|
6635
6716
|
|
|
6636
6717
|
// src/DocBlocksShell/useEdgeSwipe.ts
|
|
6637
|
-
import { useEffect as
|
|
6718
|
+
import { useEffect as useEffect26 } from "react";
|
|
6638
6719
|
var EDGE_ZONE_PX = 24;
|
|
6639
6720
|
var AXIS_LOCK_PX = 10;
|
|
6640
6721
|
var COMMIT_FRACTION = 0.4;
|
|
@@ -6647,7 +6728,7 @@ function useEdgeSwipe({
|
|
|
6647
6728
|
onOpen,
|
|
6648
6729
|
onClose
|
|
6649
6730
|
}) {
|
|
6650
|
-
|
|
6731
|
+
useEffect26(() => {
|
|
6651
6732
|
const surface = surfaceRef.current;
|
|
6652
6733
|
if (!enabled || !surface) return;
|
|
6653
6734
|
let pointerId = null;
|
|
@@ -6729,11 +6810,11 @@ function useEdgeSwipe({
|
|
|
6729
6810
|
}
|
|
6730
6811
|
|
|
6731
6812
|
// src/DocBlocksShell/useEditorFileDrop.ts
|
|
6732
|
-
import { useEffect as
|
|
6813
|
+
import { useEffect as useEffect27, useState as useState21 } from "react";
|
|
6733
6814
|
var INTERNAL_DRAG_TYPE2 = "application/x-docblocks-entry";
|
|
6734
6815
|
function useEditorFileDrop(targetRef, enabled, onFiles) {
|
|
6735
|
-
const [dropActive, setDropActive] =
|
|
6736
|
-
|
|
6816
|
+
const [dropActive, setDropActive] = useState21(false);
|
|
6817
|
+
useEffect27(() => {
|
|
6737
6818
|
const element = targetRef.current;
|
|
6738
6819
|
if (!enabled || !element) {
|
|
6739
6820
|
setDropActive(false);
|
|
@@ -6795,11 +6876,11 @@ function useEditorFileDrop(targetRef, enabled, onFiles) {
|
|
|
6795
6876
|
}
|
|
6796
6877
|
|
|
6797
6878
|
// src/DocBlocksShell/useShellShortcuts.ts
|
|
6798
|
-
import { useEffect as
|
|
6879
|
+
import { useEffect as useEffect28, useRef as useRef18 } from "react";
|
|
6799
6880
|
function useShellShortcuts(handlers, layoutMode) {
|
|
6800
|
-
const handlersRef =
|
|
6881
|
+
const handlersRef = useRef18(handlers);
|
|
6801
6882
|
handlersRef.current = handlers;
|
|
6802
|
-
|
|
6883
|
+
useEffect28(() => {
|
|
6803
6884
|
if (typeof window === "undefined") return;
|
|
6804
6885
|
const onKeyDown = (event) => {
|
|
6805
6886
|
const id = matchShortcut(event, layoutMode);
|
|
@@ -6816,8 +6897,8 @@ function useShellShortcuts(handlers, layoutMode) {
|
|
|
6816
6897
|
}
|
|
6817
6898
|
|
|
6818
6899
|
// src/DocBlocksShell/UpdateAvailableNotice.tsx
|
|
6819
|
-
import { useState as
|
|
6820
|
-
import { Fragment as Fragment10, jsx as
|
|
6900
|
+
import { useState as useState22 } from "react";
|
|
6901
|
+
import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6821
6902
|
var UPDATE_PROMPT_ID = "db-update-available-prompt";
|
|
6822
6903
|
function UpdateAvailableNotice({
|
|
6823
6904
|
available,
|
|
@@ -6825,12 +6906,12 @@ function UpdateAvailableNotice({
|
|
|
6825
6906
|
blocked = false,
|
|
6826
6907
|
statusBarVisible
|
|
6827
6908
|
}) {
|
|
6828
|
-
const [promptOpen, setPromptOpen] =
|
|
6829
|
-
const [applying, setApplying] =
|
|
6909
|
+
const [promptOpen, setPromptOpen] = useState22(false);
|
|
6910
|
+
const [applying, setApplying] = useState22(false);
|
|
6830
6911
|
if (!available || !onApplyUpdate) return null;
|
|
6831
6912
|
const promptVisible = promptOpen && !blocked;
|
|
6832
|
-
return /* @__PURE__ */
|
|
6833
|
-
/* @__PURE__ */
|
|
6913
|
+
return /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
6914
|
+
/* @__PURE__ */ jsx17(
|
|
6834
6915
|
"button",
|
|
6835
6916
|
{
|
|
6836
6917
|
type: "button",
|
|
@@ -6844,16 +6925,16 @@ function UpdateAvailableNotice({
|
|
|
6844
6925
|
children: "Update available"
|
|
6845
6926
|
}
|
|
6846
6927
|
),
|
|
6847
|
-
promptVisible && /* @__PURE__ */
|
|
6928
|
+
promptVisible && /* @__PURE__ */ jsxs15(
|
|
6848
6929
|
"div",
|
|
6849
6930
|
{
|
|
6850
6931
|
id: UPDATE_PROMPT_ID,
|
|
6851
6932
|
className: `db-update-banner${statusBarVisible ? "" : " db-update-banner--floating"}`,
|
|
6852
6933
|
role: "alert",
|
|
6853
6934
|
children: [
|
|
6854
|
-
/* @__PURE__ */
|
|
6855
|
-
/* @__PURE__ */
|
|
6856
|
-
/* @__PURE__ */
|
|
6935
|
+
/* @__PURE__ */ jsx17("span", { children: "A new version of DocBlocks is available. Reload to update the editor and site pages." }),
|
|
6936
|
+
/* @__PURE__ */ jsxs15("div", { className: "db-update-banner-actions", children: [
|
|
6937
|
+
/* @__PURE__ */ jsx17(
|
|
6857
6938
|
"button",
|
|
6858
6939
|
{
|
|
6859
6940
|
type: "button",
|
|
@@ -6865,7 +6946,7 @@ function UpdateAvailableNotice({
|
|
|
6865
6946
|
children: applying ? "Updating\u2026" : "Reload"
|
|
6866
6947
|
}
|
|
6867
6948
|
),
|
|
6868
|
-
/* @__PURE__ */
|
|
6949
|
+
/* @__PURE__ */ jsx17("button", { type: "button", onClick: () => setPromptOpen(false), disabled: applying, children: "Later" })
|
|
6869
6950
|
] })
|
|
6870
6951
|
]
|
|
6871
6952
|
}
|
|
@@ -6874,19 +6955,19 @@ function UpdateAvailableNotice({
|
|
|
6874
6955
|
}
|
|
6875
6956
|
|
|
6876
6957
|
// src/DocBlocksShell/WelcomeScreen.tsx
|
|
6877
|
-
import { jsx as
|
|
6958
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6878
6959
|
var WELCOME_HEADLINE = "The Markdown editor that turns one file into anything.";
|
|
6879
6960
|
var WELCOME_SUMMARY = "Write the way you normally would, then share the same file as a PDF, a Word document, a slide deck, or a video.";
|
|
6880
6961
|
var WELCOME_PRIVACY_NOTE = "No account, and your documents stay on this device.";
|
|
6881
|
-
var DOCBLOCKS_APPS_URL = "https://docblocks.com/
|
|
6962
|
+
var DOCBLOCKS_APPS_URL = "https://docblocks.com/docs/#apps";
|
|
6882
6963
|
function WelcomeScreen({
|
|
6883
6964
|
onCreateDocument,
|
|
6884
6965
|
onTour,
|
|
6885
6966
|
onDismiss,
|
|
6886
6967
|
offerApps = false
|
|
6887
6968
|
}) {
|
|
6888
|
-
return /* @__PURE__ */
|
|
6889
|
-
/* @__PURE__ */
|
|
6969
|
+
return /* @__PURE__ */ jsxs16("section", { className: "db-welcome-gateway", "aria-labelledby": "db-welcome-gateway-title", children: [
|
|
6970
|
+
/* @__PURE__ */ jsx18(
|
|
6890
6971
|
"button",
|
|
6891
6972
|
{
|
|
6892
6973
|
type: "button",
|
|
@@ -6897,16 +6978,16 @@ function WelcomeScreen({
|
|
|
6897
6978
|
children: "\xD7"
|
|
6898
6979
|
}
|
|
6899
6980
|
),
|
|
6900
|
-
/* @__PURE__ */
|
|
6901
|
-
/* @__PURE__ */
|
|
6902
|
-
/* @__PURE__ */
|
|
6903
|
-
/* @__PURE__ */
|
|
6904
|
-
/* @__PURE__ */
|
|
6905
|
-
/* @__PURE__ */
|
|
6906
|
-
/* @__PURE__ */
|
|
6907
|
-
/* @__PURE__ */
|
|
6908
|
-
/* @__PURE__ */
|
|
6909
|
-
offerApps && /* @__PURE__ */
|
|
6981
|
+
/* @__PURE__ */ jsxs16("div", { className: "db-welcome-gateway-body", children: [
|
|
6982
|
+
/* @__PURE__ */ jsxs16("div", { className: "db-welcome-gateway-copy", children: [
|
|
6983
|
+
/* @__PURE__ */ jsx18("p", { className: "db-welcome-gateway-eyebrow", children: "Welcome to DocBlocks" }),
|
|
6984
|
+
/* @__PURE__ */ jsx18("h1", { id: "db-welcome-gateway-title", children: WELCOME_HEADLINE }),
|
|
6985
|
+
/* @__PURE__ */ jsx18("p", { children: WELCOME_SUMMARY }),
|
|
6986
|
+
/* @__PURE__ */ jsx18("p", { className: "db-welcome-gateway-note", children: WELCOME_PRIVACY_NOTE }),
|
|
6987
|
+
/* @__PURE__ */ jsxs16("div", { className: "db-welcome-gateway-actions", children: [
|
|
6988
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: "db-welcome-gateway-primary", onClick: onCreateDocument, children: "Create a document" }),
|
|
6989
|
+
/* @__PURE__ */ jsx18("button", { type: "button", className: "db-welcome-gateway-cta", onClick: onTour, children: "Tour the welcome document" }),
|
|
6990
|
+
offerApps && /* @__PURE__ */ jsx18(
|
|
6910
6991
|
"a",
|
|
6911
6992
|
{
|
|
6912
6993
|
className: "db-welcome-gateway-apps",
|
|
@@ -6918,61 +6999,61 @@ function WelcomeScreen({
|
|
|
6918
6999
|
)
|
|
6919
7000
|
] })
|
|
6920
7001
|
] }),
|
|
6921
|
-
/* @__PURE__ */
|
|
7002
|
+
/* @__PURE__ */ jsx18(WelcomeLoop, {})
|
|
6922
7003
|
] })
|
|
6923
7004
|
] });
|
|
6924
7005
|
}
|
|
6925
7006
|
function WelcomeLoop() {
|
|
6926
|
-
return /* @__PURE__ */
|
|
6927
|
-
/* @__PURE__ */
|
|
6928
|
-
/* @__PURE__ */
|
|
6929
|
-
/* @__PURE__ */
|
|
6930
|
-
/* @__PURE__ */
|
|
7007
|
+
return /* @__PURE__ */ jsxs16("div", { className: "db-welcome-loop", "aria-hidden": "true", children: [
|
|
7008
|
+
/* @__PURE__ */ jsxs16("div", { className: "db-welcome-loop-source", children: [
|
|
7009
|
+
/* @__PURE__ */ jsx18("span", { className: "db-welcome-loop-file", children: "Lisbon.md" }),
|
|
7010
|
+
/* @__PURE__ */ jsxs16("code", { children: [
|
|
7011
|
+
/* @__PURE__ */ jsx18("span", { className: "db-welcome-loop-mark", children: "# " }),
|
|
6931
7012
|
"Lisbon in three days",
|
|
6932
7013
|
"\n",
|
|
6933
7014
|
"Trams, tiles, and pastries.",
|
|
6934
7015
|
"\n\n",
|
|
6935
|
-
/* @__PURE__ */
|
|
7016
|
+
/* @__PURE__ */ jsx18("span", { className: "db-welcome-loop-mark", children: "## " }),
|
|
6936
7017
|
"Day one",
|
|
6937
7018
|
"\n",
|
|
6938
|
-
/* @__PURE__ */
|
|
7019
|
+
/* @__PURE__ */ jsx18("span", { className: "db-welcome-loop-mark", children: "- " }),
|
|
6939
7020
|
"Ride Tram 28",
|
|
6940
7021
|
"\n",
|
|
6941
|
-
/* @__PURE__ */
|
|
7022
|
+
/* @__PURE__ */ jsx18("span", { className: "db-welcome-loop-mark", children: "- " }),
|
|
6942
7023
|
"Sunset at Gra\xE7a"
|
|
6943
7024
|
] })
|
|
6944
7025
|
] }),
|
|
6945
|
-
/* @__PURE__ */
|
|
6946
|
-
/* @__PURE__ */
|
|
6947
|
-
/* @__PURE__ */
|
|
6948
|
-
/* @__PURE__ */
|
|
6949
|
-
/* @__PURE__ */
|
|
6950
|
-
/* @__PURE__ */
|
|
6951
|
-
/* @__PURE__ */
|
|
6952
|
-
/* @__PURE__ */
|
|
7026
|
+
/* @__PURE__ */ jsx18("div", { className: "db-welcome-loop-arrow", children: "\u2192" }),
|
|
7027
|
+
/* @__PURE__ */ jsxs16("div", { className: "db-welcome-loop-stage", children: [
|
|
7028
|
+
/* @__PURE__ */ jsxs16("div", { className: "db-welcome-loop-frame db-welcome-loop-frame--page", children: [
|
|
7029
|
+
/* @__PURE__ */ jsx18("strong", { children: "Lisbon in three days" }),
|
|
7030
|
+
/* @__PURE__ */ jsx18("span", { children: "Trams, tiles, and pastries." }),
|
|
7031
|
+
/* @__PURE__ */ jsx18("em", { children: "Day one" }),
|
|
7032
|
+
/* @__PURE__ */ jsx18("span", { children: "\u2022 Ride Tram 28" }),
|
|
7033
|
+
/* @__PURE__ */ jsx18("span", { children: "\u2022 Sunset at Gra\xE7a" })
|
|
6953
7034
|
] }),
|
|
6954
|
-
/* @__PURE__ */
|
|
6955
|
-
/* @__PURE__ */
|
|
6956
|
-
/* @__PURE__ */
|
|
7035
|
+
/* @__PURE__ */ jsxs16("div", { className: "db-welcome-loop-frame db-welcome-loop-frame--slide", children: [
|
|
7036
|
+
/* @__PURE__ */ jsx18("strong", { children: "Lisbon in three days" }),
|
|
7037
|
+
/* @__PURE__ */ jsx18("span", { children: "Trams, tiles, and pastries." })
|
|
6957
7038
|
] }),
|
|
6958
|
-
/* @__PURE__ */
|
|
6959
|
-
/* @__PURE__ */
|
|
6960
|
-
/* @__PURE__ */
|
|
6961
|
-
/* @__PURE__ */
|
|
6962
|
-
/* @__PURE__ */
|
|
6963
|
-
/* @__PURE__ */
|
|
7039
|
+
/* @__PURE__ */ jsxs16("div", { className: "db-welcome-loop-frame db-welcome-loop-frame--video", children: [
|
|
7040
|
+
/* @__PURE__ */ jsx18("em", { children: "Day one" }),
|
|
7041
|
+
/* @__PURE__ */ jsx18("span", { children: "\u2022 Ride Tram 28" }),
|
|
7042
|
+
/* @__PURE__ */ jsx18("span", { children: "\u2022 Sunset at Gra\xE7a" }),
|
|
7043
|
+
/* @__PURE__ */ jsx18("i", { className: "db-welcome-loop-play", children: "\u25B6" }),
|
|
7044
|
+
/* @__PURE__ */ jsx18("i", { className: "db-welcome-loop-progress" })
|
|
6964
7045
|
] })
|
|
6965
7046
|
] }),
|
|
6966
|
-
/* @__PURE__ */
|
|
6967
|
-
/* @__PURE__ */
|
|
6968
|
-
/* @__PURE__ */
|
|
6969
|
-
/* @__PURE__ */
|
|
7047
|
+
/* @__PURE__ */ jsxs16("ol", { className: "db-welcome-loop-labels", children: [
|
|
7048
|
+
/* @__PURE__ */ jsx18("li", { children: "PDF" }),
|
|
7049
|
+
/* @__PURE__ */ jsx18("li", { children: "Slides" }),
|
|
7050
|
+
/* @__PURE__ */ jsx18("li", { children: "Video" })
|
|
6970
7051
|
] })
|
|
6971
7052
|
] });
|
|
6972
7053
|
}
|
|
6973
7054
|
|
|
6974
7055
|
// src/DocBlocksShell/useDocumentLinkProvider.ts
|
|
6975
|
-
import { useCallback as
|
|
7056
|
+
import { useCallback as useCallback17 } from "react";
|
|
6976
7057
|
|
|
6977
7058
|
// src/DocBlocksShell/document-links.ts
|
|
6978
7059
|
import { parseWorkspacePath as parseWorkspacePath7 } from "@bendyline/docblocks/filesystem";
|
|
@@ -7021,7 +7102,7 @@ function createDocumentLinkCandidates(entries, selectedFile, query) {
|
|
|
7021
7102
|
// src/DocBlocksShell/useDocumentLinkProvider.ts
|
|
7022
7103
|
var LISTING_WAIT_MS = 5e3;
|
|
7023
7104
|
function useDocumentLinkProvider(index, selectedFile, ensureIndex) {
|
|
7024
|
-
return
|
|
7105
|
+
return useCallback17(
|
|
7025
7106
|
async (query) => {
|
|
7026
7107
|
if (!index || !selectedFile) return [];
|
|
7027
7108
|
ensureIndex();
|
|
@@ -7034,7 +7115,7 @@ function useDocumentLinkProvider(index, selectedFile, ensureIndex) {
|
|
|
7034
7115
|
}
|
|
7035
7116
|
|
|
7036
7117
|
// src/WorkspaceIndex/useWorkspaceIndex.ts
|
|
7037
|
-
import { useCallback as
|
|
7118
|
+
import { useCallback as useCallback18, useEffect as useEffect29, useMemo as useMemo5, useRef as useRef19, useState as useState23, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
7038
7119
|
import { getFileSystemProviderV2 as getFileSystemProviderV29 } from "@bendyline/docblocks/filesystem";
|
|
7039
7120
|
import { maybeGetDocBlocksHost as maybeGetDocBlocksHost3 } from "@bendyline/docblocks/host";
|
|
7040
7121
|
var IDLE_WORKSPACE_INDEX_STATUS = Object.freeze({
|
|
@@ -7066,9 +7147,9 @@ function whenIdle(callback) {
|
|
|
7066
7147
|
}
|
|
7067
7148
|
function useWorkspaceIndex(provider, workspaceId, mode = "eager") {
|
|
7068
7149
|
const providerV2 = provider && mode !== "off" ? getFileSystemProviderV29(provider) : null;
|
|
7069
|
-
const [index, setIndex] =
|
|
7070
|
-
const startRequestedRef =
|
|
7071
|
-
|
|
7150
|
+
const [index, setIndex] = useState23(null);
|
|
7151
|
+
const startRequestedRef = useRef19(false);
|
|
7152
|
+
useEffect29(() => {
|
|
7072
7153
|
setIndex(null);
|
|
7073
7154
|
startRequestedRef.current = false;
|
|
7074
7155
|
if (!providerV2 || !workspaceId) return;
|
|
@@ -7090,7 +7171,7 @@ function useWorkspaceIndex(provider, workspaceId, mode = "eager") {
|
|
|
7090
7171
|
created?.dispose();
|
|
7091
7172
|
};
|
|
7092
7173
|
}, [providerV2, workspaceId, mode]);
|
|
7093
|
-
|
|
7174
|
+
useEffect29(() => {
|
|
7094
7175
|
if (!index) return;
|
|
7095
7176
|
const refresh = () => index.refresh();
|
|
7096
7177
|
const onVisibilityChange = () => {
|
|
@@ -7107,16 +7188,16 @@ function useWorkspaceIndex(provider, workspaceId, mode = "eager") {
|
|
|
7107
7188
|
stopResume?.();
|
|
7108
7189
|
};
|
|
7109
7190
|
}, [index]);
|
|
7110
|
-
const subscribe =
|
|
7191
|
+
const subscribe = useCallback18(
|
|
7111
7192
|
(listener) => index ? index.subscribe(listener) : () => void 0,
|
|
7112
7193
|
[index]
|
|
7113
7194
|
);
|
|
7114
|
-
const getStatus =
|
|
7195
|
+
const getStatus = useCallback18(
|
|
7115
7196
|
() => index ? index.getStatus() : IDLE_WORKSPACE_INDEX_STATUS,
|
|
7116
7197
|
[index]
|
|
7117
7198
|
);
|
|
7118
7199
|
const status = useSyncExternalStore4(subscribe, getStatus, getStatus);
|
|
7119
|
-
const ensure =
|
|
7200
|
+
const ensure = useCallback18(() => {
|
|
7120
7201
|
if (!index) {
|
|
7121
7202
|
startRequestedRef.current = true;
|
|
7122
7203
|
return;
|
|
@@ -7357,63 +7438,75 @@ function isWelcomeDocumentPath(path) {
|
|
|
7357
7438
|
function isAppDefaultWorkspace(workspaceId, hostDefaultWorkspaceIds) {
|
|
7358
7439
|
return hostDefaultWorkspaceIds ? hostDefaultWorkspaceIds.has(workspaceId) : workspaceId === DEFAULT_WORKSPACE_ID;
|
|
7359
7440
|
}
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
"
|
|
7391
|
-
"
|
|
7392
|
-
"
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7441
|
+
function welcomeDocumentContent({
|
|
7442
|
+
browserStorage,
|
|
7443
|
+
desktopApp
|
|
7444
|
+
}) {
|
|
7445
|
+
return [
|
|
7446
|
+
"---",
|
|
7447
|
+
"squisq-theme: warm-earth",
|
|
7448
|
+
"squisq-cover-slide: false",
|
|
7449
|
+
"---",
|
|
7450
|
+
"",
|
|
7451
|
+
'# Welcome to DocBlocks {[title subtitle="Write once. Share it as a document, a deck, or a video."]}',
|
|
7452
|
+
"",
|
|
7453
|
+
"This is an ordinary document, so go ahead and change it. Click anywhere and type; DocBlocks saves as you go.",
|
|
7454
|
+
"",
|
|
7455
|
+
"## Write the way you already do {[list]}",
|
|
7456
|
+
"",
|
|
7457
|
+
"- Type to add text, and use the toolbar for headings, lists, and bold or italic text.",
|
|
7458
|
+
"- Choose **Insert** in the toolbar to add a table, a checklist, a chart, a diagram, or a picture.",
|
|
7459
|
+
"- Choose **Source** to see the Markdown text behind this page. Both views edit the same document.",
|
|
7460
|
+
"",
|
|
7461
|
+
"## One document, many ways to share it {[diagram]}",
|
|
7462
|
+
"",
|
|
7463
|
+
"```diagram",
|
|
7464
|
+
" +-----------------+",
|
|
7465
|
+
" | Your document |",
|
|
7466
|
+
" +--------+--------+",
|
|
7467
|
+
" |",
|
|
7468
|
+
" +-----------+------+-----+------------+",
|
|
7469
|
+
" | | | |",
|
|
7470
|
+
" v v v v",
|
|
7471
|
+
"+-------+ +--------+ +----------+ +---------+",
|
|
7472
|
+
"| PDF | | Word | | Slides | | Video |",
|
|
7473
|
+
"+-------+ +--------+ +----------+ +---------+",
|
|
7474
|
+
"```",
|
|
7475
|
+
"",
|
|
7476
|
+
"## Present it or send it {[content]}",
|
|
7477
|
+
"",
|
|
7478
|
+
"Each heading starts a new slide, so this document is already a slideshow. Choose **Slideshow** at the top to see it, or **Export** to save it as a PDF, a Word document, a PowerPoint deck, an e-book, a web page, or a video.",
|
|
7479
|
+
"",
|
|
7480
|
+
"## Your documents stay yours {[factCard]}",
|
|
7481
|
+
"",
|
|
7482
|
+
// Not "files other apps can open": in the browser they live in browser storage.
|
|
7483
|
+
"There is no account to create. Your documents stay on this device, written in plain Markdown that any text editor can read." + // Only browser storage shows Back up in the file list. Elsewhere the
|
|
7484
|
+
// documents are files the device itself keeps.
|
|
7485
|
+
(browserStorage ? " Choose **Back up** at the bottom of the file list to keep a copy somewhere safe." : ""),
|
|
7486
|
+
"",
|
|
7487
|
+
"## Make your own {[list]}",
|
|
7488
|
+
"",
|
|
7489
|
+
"1. Choose **New File** above the file list and give it a name.",
|
|
7490
|
+
"2. Write a heading and a few sentences.",
|
|
7491
|
+
"3. Choose **Slideshow** to present it, or **Export** to share it.",
|
|
7492
|
+
"",
|
|
7493
|
+
"## Go further {[list]}",
|
|
7494
|
+
"",
|
|
7495
|
+
desktopApp ? "- Choose **Open Folder** in the workspace menu above the file list to work on Markdown files you already have." : "- [Get the desktop app](https://docblocks.com/desktop/) to work in folders on your computer.",
|
|
7496
|
+
"- [Add DocBlocks to VS Code](https://docblocks.com/vscode/) to edit documents beside your code.",
|
|
7497
|
+
"- [Read the guides](https://docblocks.com/docs/) for everything else.",
|
|
7498
|
+
// End with a newline, as the Write view saves every document. Without it,
|
|
7499
|
+
// merely opening the welcome document in Write rewrote the file.
|
|
7500
|
+
""
|
|
7501
|
+
].join("\n");
|
|
7502
|
+
}
|
|
7503
|
+
var WELCOME_DOCUMENT_CONTENT = welcomeDocumentContent({
|
|
7504
|
+
browserStorage: true,
|
|
7505
|
+
desktopApp: false
|
|
7506
|
+
});
|
|
7414
7507
|
|
|
7415
7508
|
// src/DocBlocksShell/DocBlocksShell.tsx
|
|
7416
|
-
import { Fragment as Fragment11, jsx as
|
|
7509
|
+
import { Fragment as Fragment11, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7417
7510
|
var editorShellModulePromise = null;
|
|
7418
7511
|
function loadEditorShell() {
|
|
7419
7512
|
editorShellModulePromise ?? (editorShellModulePromise = (async () => {
|
|
@@ -7445,22 +7538,22 @@ var GitToolbarControl = lazy2(
|
|
|
7445
7538
|
() => import("./GitToolbarControl-B7KG4MFP.js").then((m) => ({ default: m.GitToolbarControl }))
|
|
7446
7539
|
);
|
|
7447
7540
|
var AiToolbarControl = lazy2(
|
|
7448
|
-
() => import("./AiEditorAssistant-
|
|
7541
|
+
() => import("./AiEditorAssistant-V4MZRC6Q.js").then((module) => ({
|
|
7449
7542
|
default: module.AiToolbarControl
|
|
7450
7543
|
}))
|
|
7451
7544
|
);
|
|
7452
7545
|
var PresentationMaker = lazy2(
|
|
7453
|
-
() => import("./PresentationMaker-
|
|
7546
|
+
() => import("./PresentationMaker-H5B44Q7P.js").then((module) => ({
|
|
7454
7547
|
default: module.PresentationMaker
|
|
7455
7548
|
}))
|
|
7456
7549
|
);
|
|
7457
7550
|
var AiReviewPanel = lazy2(
|
|
7458
|
-
() => import("./AiEditorAssistant-
|
|
7551
|
+
() => import("./AiEditorAssistant-V4MZRC6Q.js").then((module) => ({
|
|
7459
7552
|
default: module.AiReviewPanel
|
|
7460
7553
|
}))
|
|
7461
7554
|
);
|
|
7462
7555
|
var AiIllustratePanel = lazy2(
|
|
7463
|
-
() => import("./AiDiagrams-
|
|
7556
|
+
() => import("./AiDiagrams-5P657GFC.js").then((module) => ({
|
|
7464
7557
|
default: module.AiIllustratePanel
|
|
7465
7558
|
}))
|
|
7466
7559
|
);
|
|
@@ -7553,10 +7646,10 @@ function isMemoryWorkspaceProvider(provider) {
|
|
|
7553
7646
|
return typeof candidate.captureContents === "function" && typeof candidate.replaceContents === "function" && typeof candidate.treeVersion === "number";
|
|
7554
7647
|
}
|
|
7555
7648
|
function useOsTheme() {
|
|
7556
|
-
const [dark, setDark] =
|
|
7649
|
+
const [dark, setDark] = useState24(
|
|
7557
7650
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
7558
7651
|
);
|
|
7559
|
-
|
|
7652
|
+
useEffect30(() => {
|
|
7560
7653
|
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
7561
7654
|
const handler = (e) => setDark(e.matches);
|
|
7562
7655
|
mq.addEventListener("change", handler);
|
|
@@ -7742,7 +7835,7 @@ async function createHostProviderFromWorkspace(ws) {
|
|
|
7742
7835
|
var DESKTOP_TOOLBAR_WRAP_WIDTH = 900;
|
|
7743
7836
|
var WEB_TOOLBAR_WRAP_WIDTH = 700;
|
|
7744
7837
|
function FolderGlyph() {
|
|
7745
|
-
return /* @__PURE__ */
|
|
7838
|
+
return /* @__PURE__ */ jsx19(
|
|
7746
7839
|
"svg",
|
|
7747
7840
|
{
|
|
7748
7841
|
viewBox: "0 0 24 24",
|
|
@@ -7751,12 +7844,12 @@ function FolderGlyph() {
|
|
|
7751
7844
|
strokeWidth: "1.5",
|
|
7752
7845
|
strokeLinejoin: "round",
|
|
7753
7846
|
"aria-hidden": "true",
|
|
7754
|
-
children: /* @__PURE__ */
|
|
7847
|
+
children: /* @__PURE__ */ jsx19("path", { d: "M3 7a1 1 0 0 1 1-1h5l2 2h9a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7z" })
|
|
7755
7848
|
}
|
|
7756
7849
|
);
|
|
7757
7850
|
}
|
|
7758
7851
|
function FileGlyph() {
|
|
7759
|
-
return /* @__PURE__ */
|
|
7852
|
+
return /* @__PURE__ */ jsxs17(
|
|
7760
7853
|
"svg",
|
|
7761
7854
|
{
|
|
7762
7855
|
viewBox: "0 0 24 24",
|
|
@@ -7766,14 +7859,14 @@ function FileGlyph() {
|
|
|
7766
7859
|
strokeLinejoin: "round",
|
|
7767
7860
|
"aria-hidden": "true",
|
|
7768
7861
|
children: [
|
|
7769
|
-
/* @__PURE__ */
|
|
7770
|
-
/* @__PURE__ */
|
|
7862
|
+
/* @__PURE__ */ jsx19("path", { d: "M6 3h8l5 5v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z" }),
|
|
7863
|
+
/* @__PURE__ */ jsx19("path", { d: "M14 3v5h5" })
|
|
7771
7864
|
]
|
|
7772
7865
|
}
|
|
7773
7866
|
);
|
|
7774
7867
|
}
|
|
7775
7868
|
function CollapseSidebarGlyph() {
|
|
7776
|
-
return /* @__PURE__ */
|
|
7869
|
+
return /* @__PURE__ */ jsxs17(
|
|
7777
7870
|
"svg",
|
|
7778
7871
|
{
|
|
7779
7872
|
viewBox: "0 0 64 64",
|
|
@@ -7784,9 +7877,9 @@ function CollapseSidebarGlyph() {
|
|
|
7784
7877
|
strokeLinejoin: "round",
|
|
7785
7878
|
"aria-hidden": "true",
|
|
7786
7879
|
children: [
|
|
7787
|
-
/* @__PURE__ */
|
|
7788
|
-
/* @__PURE__ */
|
|
7789
|
-
/* @__PURE__ */
|
|
7880
|
+
/* @__PURE__ */ jsx19("rect", { x: "7", y: "10", width: "50", height: "44", rx: "6" }),
|
|
7881
|
+
/* @__PURE__ */ jsx19("path", { d: "M24 10v44" }),
|
|
7882
|
+
/* @__PURE__ */ jsx19("path", { d: "m17 25-7 7 7 7" })
|
|
7790
7883
|
]
|
|
7791
7884
|
}
|
|
7792
7885
|
);
|
|
@@ -7823,10 +7916,10 @@ function DocBlocksShell({
|
|
|
7823
7916
|
offlineReady = false
|
|
7824
7917
|
}) {
|
|
7825
7918
|
const osTheme = useOsTheme();
|
|
7826
|
-
const [themePreference, setThemePreference] =
|
|
7827
|
-
const [accentColor, setAccentColor] =
|
|
7828
|
-
const [interfaceFont, setInterfaceFont] =
|
|
7829
|
-
const [writeCanvasSettings, setWriteCanvasSettings] =
|
|
7919
|
+
const [themePreference, setThemePreference] = useState24(loadThemePreference);
|
|
7920
|
+
const [accentColor, setAccentColor] = useState24(loadAccentColor);
|
|
7921
|
+
const [interfaceFont, setInterfaceFont] = useState24(loadInterfaceFont);
|
|
7922
|
+
const [writeCanvasSettings, setWriteCanvasSettings] = useState24(
|
|
7830
7923
|
loadWriteCanvasPreferences
|
|
7831
7924
|
);
|
|
7832
7925
|
const editorWriteCanvasSettings = useMemo6(
|
|
@@ -7840,66 +7933,67 @@ function DocBlocksShell({
|
|
|
7840
7933
|
const resolvedTheme = resolveShellTheme({ preference: themePreference, hostTheme, osTheme });
|
|
7841
7934
|
const ai = hostSupports2("aiAssist") ? maybeGetDocBlocksHost4()?.ai : void 0;
|
|
7842
7935
|
const speech = hostSupports2("speechModelManagement") ? maybeGetDocBlocksHost4()?.speech : void 0;
|
|
7843
|
-
const
|
|
7844
|
-
const
|
|
7936
|
+
const trayMenu = hostSupports2("trayIcon") ? maybeGetDocBlocksHost4()?.menu : void 0;
|
|
7937
|
+
const [settingsRequest, setSettingsRequest] = useState24(0);
|
|
7938
|
+
const openSettings = useCallback19(() => setSettingsRequest((count) => count + 1), []);
|
|
7845
7939
|
const speechInput = useMemo6(
|
|
7846
7940
|
() => speech && hostSupports2("speechInput") ? createSpeechInputProvider(speech, { onRequestSetup: openSettings }) : null,
|
|
7847
7941
|
[speech, openSettings]
|
|
7848
7942
|
);
|
|
7849
|
-
const handleThemeChange =
|
|
7943
|
+
const handleThemeChange = useCallback19((pref) => {
|
|
7850
7944
|
setThemePreference(pref);
|
|
7851
7945
|
saveThemePreference(pref);
|
|
7852
7946
|
}, []);
|
|
7853
|
-
|
|
7947
|
+
useEffect30(() => {
|
|
7854
7948
|
if (hostSupports2("ownsWindowChrome") || typeof document === "undefined") return;
|
|
7855
7949
|
const metas = document.querySelectorAll('meta[name="theme-color"]');
|
|
7856
7950
|
metas.forEach((meta) => {
|
|
7857
7951
|
meta.content = DB_CHROME_COLORS[resolvedTheme];
|
|
7858
7952
|
});
|
|
7859
7953
|
}, [resolvedTheme]);
|
|
7860
|
-
const handleAccentColorChange =
|
|
7954
|
+
const handleAccentColorChange = useCallback19((color) => {
|
|
7861
7955
|
setAccentColor(color);
|
|
7862
7956
|
saveAccentColor(color);
|
|
7863
7957
|
}, []);
|
|
7864
|
-
const handleWriteCanvasSettingsChange =
|
|
7958
|
+
const handleWriteCanvasSettingsChange = useCallback19((settings) => {
|
|
7865
7959
|
setWriteCanvasSettings(settings);
|
|
7866
7960
|
saveWriteCanvasPreferences(settings);
|
|
7867
7961
|
}, []);
|
|
7868
|
-
const [proofingPreferences, setProofingPreferences] =
|
|
7869
|
-
const handleProofingPreferencesChange =
|
|
7962
|
+
const [proofingPreferences, setProofingPreferences] = useState24(loadProofingPreferences);
|
|
7963
|
+
const handleProofingPreferencesChange = useCallback19((settings) => {
|
|
7870
7964
|
setProofingPreferences(settings);
|
|
7871
7965
|
saveProofingPreferences(settings);
|
|
7872
7966
|
}, []);
|
|
7873
|
-
const [viewPreferences, setViewPreferences] =
|
|
7874
|
-
const handleViewPreferencesChange =
|
|
7967
|
+
const [viewPreferences, setViewPreferences] = useState24(loadViewPreferences);
|
|
7968
|
+
const handleViewPreferencesChange = useCallback19((prefs) => {
|
|
7875
7969
|
setViewPreferences(prefs);
|
|
7876
7970
|
saveViewPreferences(prefs);
|
|
7877
7971
|
}, []);
|
|
7878
|
-
const shellRef =
|
|
7972
|
+
const shellRef = useRef20(null);
|
|
7879
7973
|
const formFactor = useFormFactor(shellRef);
|
|
7880
|
-
const [sidebarPreference, setSidebarPreference] =
|
|
7974
|
+
const [sidebarPreference, setSidebarPreference] = useState24(loadSidebarPreference);
|
|
7881
7975
|
const layoutMode = resolveLayoutMode(formFactor, sidebarPreference);
|
|
7882
7976
|
const singlePane = layoutMode === "single-pane";
|
|
7883
|
-
const updateSidebarPreference =
|
|
7977
|
+
const updateSidebarPreference = useCallback19((preference) => {
|
|
7884
7978
|
setSidebarPreference(preference);
|
|
7885
7979
|
saveSidebarPreference(preference);
|
|
7886
7980
|
}, []);
|
|
7887
7981
|
const defaultPreviewViewportPreset = useResponsivePreviewViewportPreset();
|
|
7888
|
-
const [mobileShowEditor, setMobileShowEditor] =
|
|
7982
|
+
const [mobileShowEditor, setMobileShowEditor] = useState24(
|
|
7889
7983
|
() => singlePane && isWelcomeGatewayDismissed()
|
|
7890
7984
|
);
|
|
7891
|
-
|
|
7985
|
+
useEffect30(() => {
|
|
7892
7986
|
if (singlePane) void loadEditorShell();
|
|
7893
7987
|
}, [singlePane]);
|
|
7894
7988
|
useFormFactorAttributes(shellRef, formFactor, layoutMode, !mobileShowEditor);
|
|
7895
7989
|
useInterfaceFontAttribute(interfaceFont);
|
|
7896
7990
|
useKeyboardInset(formFactor.pointer === "coarse");
|
|
7897
7991
|
const drawerOpen = singlePane && !mobileShowEditor;
|
|
7898
|
-
const [sidebarWidth, setSidebarWidth] =
|
|
7992
|
+
const [sidebarWidth, setSidebarWidth] = useState24(loadSidebarWidth);
|
|
7899
7993
|
const canRestoreSplitView = sidebarPreference === "collapsed" && formFactor.splitPaneAllowed;
|
|
7900
|
-
const editorAreaRef =
|
|
7901
|
-
const [desktopToolbarWrapped, setDesktopToolbarWrapped] =
|
|
7902
|
-
|
|
7994
|
+
const editorAreaRef = useRef20(null);
|
|
7995
|
+
const [desktopToolbarWrapped, setDesktopToolbarWrapped] = useState24(false);
|
|
7996
|
+
useEffect30(() => {
|
|
7903
7997
|
const editorArea = editorAreaRef.current;
|
|
7904
7998
|
if (!editorArea || singlePane) {
|
|
7905
7999
|
setDesktopToolbarWrapped(false);
|
|
@@ -7920,24 +8014,25 @@ function DocBlocksShell({
|
|
|
7920
8014
|
}, [singlePane]);
|
|
7921
8015
|
const showBrowserStorageWarning = hostSupports2("browserOriginStorage");
|
|
7922
8016
|
const hostEnvironment = getHostEnvironment2();
|
|
8017
|
+
const desktopApp = hostEnvironment?.surface === "electron";
|
|
7923
8018
|
const appVersion = hostEnvironment ? `${hostEnvironment.appVersion} ${hostEnvironment.surfaceLabel}` : issueReportVersion ?? "web";
|
|
7924
8019
|
const issueReportUrl = buildIssueReportUrl({
|
|
7925
8020
|
reportedAt: /* @__PURE__ */ new Date(),
|
|
7926
8021
|
version: appVersion,
|
|
7927
8022
|
userAgent: typeof navigator === "undefined" ? "" : navigator.userAgent
|
|
7928
8023
|
});
|
|
7929
|
-
const [browserStoragePersistent, setBrowserStoragePersistent] =
|
|
7930
|
-
const [saveToast, setSaveToast] =
|
|
7931
|
-
const saveToastTimerRef =
|
|
7932
|
-
const showToast =
|
|
8024
|
+
const [browserStoragePersistent, setBrowserStoragePersistent] = useState24(false);
|
|
8025
|
+
const [saveToast, setSaveToast] = useState24(null);
|
|
8026
|
+
const saveToastTimerRef = useRef20(null);
|
|
8027
|
+
const showToast = useCallback19((kind, message) => {
|
|
7933
8028
|
setSaveToast({ kind, message });
|
|
7934
8029
|
if (saveToastTimerRef.current) clearTimeout(saveToastTimerRef.current);
|
|
7935
8030
|
saveToastTimerRef.current = setTimeout(() => setSaveToast(null), 3e3);
|
|
7936
8031
|
}, []);
|
|
7937
8032
|
const { prompt: promptForText, promptDialog } = usePromptDialog();
|
|
7938
|
-
const [newDocumentDialogOpen, setNewDocumentDialogOpen] =
|
|
8033
|
+
const [newDocumentDialogOpen, setNewDocumentDialogOpen] = useState24(false);
|
|
7939
8034
|
const { confirm: confirmAction, acknowledge, confirmDialog } = useConfirmDialog();
|
|
7940
|
-
const confirmDeleteEntry =
|
|
8035
|
+
const confirmDeleteEntry = useCallback19(
|
|
7941
8036
|
(message) => confirmAction({
|
|
7942
8037
|
title: "Delete",
|
|
7943
8038
|
message,
|
|
@@ -7946,15 +8041,15 @@ function DocBlocksShell({
|
|
|
7946
8041
|
}),
|
|
7947
8042
|
[confirmAction]
|
|
7948
8043
|
);
|
|
7949
|
-
const [installPromptEvent, setInstallPromptEvent] =
|
|
8044
|
+
const [installPromptEvent, setInstallPromptEvent] = useState24(
|
|
7950
8045
|
null
|
|
7951
8046
|
);
|
|
7952
|
-
const panesRef =
|
|
7953
|
-
const sidebarRef =
|
|
8047
|
+
const panesRef = useRef20(null);
|
|
8048
|
+
const sidebarRef = useRef20(null);
|
|
7954
8049
|
useInert(sidebarRef, singlePane && !drawerOpen);
|
|
7955
8050
|
useInert(editorAreaRef, drawerOpen);
|
|
7956
|
-
const openDrawer =
|
|
7957
|
-
const closeDrawer =
|
|
8051
|
+
const openDrawer = useCallback19(() => setMobileShowEditor(false), []);
|
|
8052
|
+
const closeDrawer = useCallback19(() => setMobileShowEditor(true), []);
|
|
7958
8053
|
useEdgeSwipe({
|
|
7959
8054
|
surfaceRef: panesRef,
|
|
7960
8055
|
drawerRef: sidebarRef,
|
|
@@ -7963,8 +8058,8 @@ function DocBlocksShell({
|
|
|
7963
8058
|
onOpen: openDrawer,
|
|
7964
8059
|
onClose: closeDrawer
|
|
7965
8060
|
});
|
|
7966
|
-
const dragStateRef =
|
|
7967
|
-
const handleResizerPointerDown =
|
|
8061
|
+
const dragStateRef = useRef20(null);
|
|
8062
|
+
const handleResizerPointerDown = useCallback19(
|
|
7968
8063
|
(e) => {
|
|
7969
8064
|
if (e.button !== 0) return;
|
|
7970
8065
|
dragStateRef.current = { startX: e.clientX, startWidth: sidebarWidth };
|
|
@@ -8016,15 +8111,15 @@ function DocBlocksShell({
|
|
|
8016
8111
|
},
|
|
8017
8112
|
[sidebarWidth, updateSidebarPreference]
|
|
8018
8113
|
);
|
|
8019
|
-
const [provider, setProvider] =
|
|
8020
|
-
const [workspaceStartupError, setWorkspaceStartupError] =
|
|
8114
|
+
const [provider, setProvider] = useState24(null);
|
|
8115
|
+
const [workspaceStartupError, setWorkspaceStartupError] = useState24(null);
|
|
8021
8116
|
const workspaceStarting = provider === null && workspaceStartupError === null;
|
|
8022
|
-
const [activeWorkspaceId, setActiveWorkspaceId] =
|
|
8023
|
-
const [defaultNewFileFormat, setDefaultNewFileFormat] =
|
|
8024
|
-
|
|
8117
|
+
const [activeWorkspaceId, setActiveWorkspaceId] = useState24(null);
|
|
8118
|
+
const [defaultNewFileFormat, setDefaultNewFileFormat] = useState24(DEFAULT_NEW_FILE_FORMAT);
|
|
8119
|
+
useEffect30(() => {
|
|
8025
8120
|
setDefaultNewFileFormat(loadLastNewFileFormat(activeWorkspaceId));
|
|
8026
8121
|
}, [activeWorkspaceId]);
|
|
8027
|
-
const rememberNewFileFormat =
|
|
8122
|
+
const rememberNewFileFormat = useCallback19(
|
|
8028
8123
|
(format) => {
|
|
8029
8124
|
setDefaultNewFileFormat(format);
|
|
8030
8125
|
if (activeWorkspaceId && getTransientWorkspace(activeWorkspaceId) === null) {
|
|
@@ -8033,19 +8128,19 @@ function DocBlocksShell({
|
|
|
8033
8128
|
},
|
|
8034
8129
|
[activeWorkspaceId]
|
|
8035
8130
|
);
|
|
8036
|
-
const [activeWorkspaceDescriptor, setActiveWorkspaceDescriptor] =
|
|
8131
|
+
const [activeWorkspaceDescriptor, setActiveWorkspaceDescriptor] = useState24(null);
|
|
8037
8132
|
const defaultProofingIgnoreStore = useMemo6(
|
|
8038
8133
|
() => createLocalProofingIgnoreStore(() => activeWorkspaceId),
|
|
8039
8134
|
[activeWorkspaceId]
|
|
8040
8135
|
);
|
|
8041
8136
|
const effectiveProofingIgnoreStore = proofingIgnoreStore === void 0 ? defaultProofingIgnoreStore : proofingIgnoreStore;
|
|
8042
|
-
|
|
8137
|
+
useEffect30(() => {
|
|
8043
8138
|
if (!provider || getTransientWorkspace(provider.id)) return;
|
|
8044
8139
|
const providerV2 = getFileSystemProviderV211(provider);
|
|
8045
8140
|
return providerV2 ? retainFileSystemProvider(providerV2) : void 0;
|
|
8046
8141
|
}, [provider]);
|
|
8047
|
-
const [descriptorRefreshKey, setDescriptorRefreshKey] =
|
|
8048
|
-
|
|
8142
|
+
const [descriptorRefreshKey, setDescriptorRefreshKey] = useState24(0);
|
|
8143
|
+
useEffect30(() => {
|
|
8049
8144
|
let cancelled = false;
|
|
8050
8145
|
if (!activeWorkspaceId) {
|
|
8051
8146
|
setActiveWorkspaceDescriptor(null);
|
|
@@ -8058,12 +8153,12 @@ function DocBlocksShell({
|
|
|
8058
8153
|
cancelled = true;
|
|
8059
8154
|
};
|
|
8060
8155
|
}, [activeWorkspaceId, descriptorRefreshKey]);
|
|
8061
|
-
const [pinnedDocuments, setPinnedDocuments] =
|
|
8062
|
-
const [pinnedDocumentAvailability, setPinnedDocumentAvailability] =
|
|
8063
|
-
|
|
8156
|
+
const [pinnedDocuments, setPinnedDocuments] = useState24(loadPinnedDocuments);
|
|
8157
|
+
const [pinnedDocumentAvailability, setPinnedDocumentAvailability] = useState24(() => /* @__PURE__ */ new Map());
|
|
8158
|
+
useEffect30(() => {
|
|
8064
8159
|
savePinnedDocuments(pinnedDocuments);
|
|
8065
8160
|
}, [pinnedDocuments]);
|
|
8066
|
-
|
|
8161
|
+
useEffect30(() => {
|
|
8067
8162
|
const menu = maybeGetDocBlocksHost4()?.menu;
|
|
8068
8163
|
if (!hostSupports2("pinnedDocumentMirror") || !menu) return;
|
|
8069
8164
|
menu.setPinnedDocuments(
|
|
@@ -8074,7 +8169,7 @@ function DocBlocksShell({
|
|
|
8074
8169
|
}))
|
|
8075
8170
|
);
|
|
8076
8171
|
}, [pinnedDocuments]);
|
|
8077
|
-
const setPinnedAvailability =
|
|
8172
|
+
const setPinnedAvailability = useCallback19(
|
|
8078
8173
|
(document2, availability) => {
|
|
8079
8174
|
const key = pinnedDocumentKey(document2);
|
|
8080
8175
|
setPinnedDocumentAvailability((current) => {
|
|
@@ -8093,7 +8188,7 @@ function DocBlocksShell({
|
|
|
8093
8188
|
})),
|
|
8094
8189
|
[pinnedDocumentAvailability, pinnedDocuments]
|
|
8095
8190
|
);
|
|
8096
|
-
|
|
8191
|
+
useEffect30(() => {
|
|
8097
8192
|
if (!provider || !activeWorkspaceId) return;
|
|
8098
8193
|
const activePins = pinnedDocuments.filter(
|
|
8099
8194
|
(document2) => document2.workspaceId === activeWorkspaceId
|
|
@@ -8143,10 +8238,10 @@ function DocBlocksShell({
|
|
|
8143
8238
|
void subscription?.dispose();
|
|
8144
8239
|
};
|
|
8145
8240
|
}, [activeWorkspaceId, pinnedDocuments, provider, setPinnedAvailability]);
|
|
8146
|
-
const [transientMoveDestinations, setTransientMoveDestinations] =
|
|
8241
|
+
const [transientMoveDestinations, setTransientMoveDestinations] = useState24(
|
|
8147
8242
|
[]
|
|
8148
8243
|
);
|
|
8149
|
-
|
|
8244
|
+
useEffect30(() => {
|
|
8150
8245
|
if (activeWorkspaceDescriptor?.type !== "transient") {
|
|
8151
8246
|
setTransientMoveDestinations([]);
|
|
8152
8247
|
return;
|
|
@@ -8168,19 +8263,19 @@ function DocBlocksShell({
|
|
|
8168
8263
|
};
|
|
8169
8264
|
}, [activeWorkspaceDescriptor]);
|
|
8170
8265
|
const nativeWorkspaceId = provider && activeWorkspaceDescriptor?.id === activeWorkspaceId && provider.id === activeWorkspaceId && activeWorkspaceDescriptor.type === "host-native" ? activeWorkspaceDescriptor.id : null;
|
|
8171
|
-
const workingTreeChangedRef =
|
|
8172
|
-
const handleWorkingTreeChanged =
|
|
8266
|
+
const workingTreeChangedRef = useRef20(() => void 0);
|
|
8267
|
+
const handleWorkingTreeChanged = useCallback19(() => workingTreeChangedRef.current(), []);
|
|
8173
8268
|
const git = useGit(provider, nativeWorkspaceId, resolvedTheme, handleWorkingTreeChanged);
|
|
8174
|
-
const gitRef =
|
|
8269
|
+
const gitRef = useRef20(git);
|
|
8175
8270
|
gitRef.current = git;
|
|
8176
8271
|
const { scheduleRefresh: gitScheduleRefresh } = git;
|
|
8177
8272
|
const workspaceSettingsEnabled = provider !== null && provider.id === activeWorkspaceId && getTransientWorkspace(provider.id) === null;
|
|
8178
8273
|
const workspaceSettings = useWorkspaceSettings(provider, workspaceSettingsEnabled);
|
|
8179
8274
|
const { refresh: refreshWorkspaceSettings, save: saveWorkspaceSettings } = workspaceSettings;
|
|
8180
8275
|
const workspaceDefaultThemeId = resolveWorkspaceDefaultThemeId(workspaceSettings.settings);
|
|
8181
|
-
const workspaceDefaultThemeRef =
|
|
8276
|
+
const workspaceDefaultThemeRef = useRef20(workspaceDefaultThemeId);
|
|
8182
8277
|
workspaceDefaultThemeRef.current = workspaceDefaultThemeId;
|
|
8183
|
-
const outsideInRenderRef =
|
|
8278
|
+
const outsideInRenderRef = useRef20({
|
|
8184
8279
|
defaultThemeId: () => workspaceDefaultThemeRef.current
|
|
8185
8280
|
});
|
|
8186
8281
|
const workspaceOutputs = useWorkspaceOutputs(
|
|
@@ -8189,12 +8284,12 @@ function DocBlocksShell({
|
|
|
8189
8284
|
workspaceSettings.settings,
|
|
8190
8285
|
workspaceSettingsEnabled
|
|
8191
8286
|
);
|
|
8192
|
-
const workspaceOutputsSchedulerRef =
|
|
8287
|
+
const workspaceOutputsSchedulerRef = useRef20(workspaceOutputs.scheduler);
|
|
8193
8288
|
workspaceOutputsSchedulerRef.current = workspaceOutputs.scheduler;
|
|
8194
8289
|
const workspaceIndex = useWorkspaceIndex(provider, activeWorkspaceId, workspaceIndexMode);
|
|
8195
|
-
const workspaceIndexRef =
|
|
8290
|
+
const workspaceIndexRef = useRef20(workspaceIndex.index);
|
|
8196
8291
|
workspaceIndexRef.current = workspaceIndex.index;
|
|
8197
|
-
const notifyWorkspaceChanged =
|
|
8292
|
+
const notifyWorkspaceChanged = useCallback19(
|
|
8198
8293
|
(workspaceId, path) => {
|
|
8199
8294
|
const scheduler = workspaceOutputsSchedulerRef.current;
|
|
8200
8295
|
if (scheduler && workspaceId && scheduler.workspaceId === workspaceId) scheduler.notify(path);
|
|
@@ -8211,9 +8306,9 @@ function DocBlocksShell({
|
|
|
8211
8306
|
workspaceOutputsSchedulerRef.current?.notify();
|
|
8212
8307
|
workspaceIndexRef.current?.refresh({ force: true });
|
|
8213
8308
|
};
|
|
8214
|
-
const [workspaceSettingsOpen, setWorkspaceSettingsOpen] =
|
|
8215
|
-
const [versioningPreference, setVersioningPreference] =
|
|
8216
|
-
const handleVersioningPreferenceChange =
|
|
8309
|
+
const [workspaceSettingsOpen, setWorkspaceSettingsOpen] = useState24(false);
|
|
8310
|
+
const [versioningPreference, setVersioningPreference] = useState24(loadVersioningPreference);
|
|
8311
|
+
const handleVersioningPreferenceChange = useCallback19((pref) => {
|
|
8217
8312
|
setVersioningPreference(pref);
|
|
8218
8313
|
saveVersioningPreference(pref);
|
|
8219
8314
|
}, []);
|
|
@@ -8227,11 +8322,11 @@ function DocBlocksShell({
|
|
|
8227
8322
|
() => workspaceVersionKeep !== void 0 ? { type: "keep-last-n", n: workspaceVersionKeep } : versioningPrunePolicy,
|
|
8228
8323
|
[versioningPrunePolicy, workspaceVersionKeep]
|
|
8229
8324
|
);
|
|
8230
|
-
const handleOpenWorkspaceSettings =
|
|
8325
|
+
const handleOpenWorkspaceSettings = useCallback19(() => {
|
|
8231
8326
|
if (!activeWorkspaceDescriptor) return;
|
|
8232
8327
|
setWorkspaceSettingsOpen(true);
|
|
8233
8328
|
}, [activeWorkspaceDescriptor]);
|
|
8234
|
-
const handleSaveWorkspaceSettings =
|
|
8329
|
+
const handleSaveWorkspaceSettings = useCallback19(
|
|
8235
8330
|
async (patch) => {
|
|
8236
8331
|
const descriptor = activeWorkspaceDescriptor;
|
|
8237
8332
|
if (!isEmptyWorkspaceSettingsPatch2(patch)) await saveWorkspaceSettings(patch);
|
|
@@ -8244,22 +8339,22 @@ function DocBlocksShell({
|
|
|
8244
8339
|
},
|
|
8245
8340
|
[activeWorkspaceDescriptor, saveWorkspaceSettings]
|
|
8246
8341
|
);
|
|
8247
|
-
const handleRegenerateWorkspaceOutputs =
|
|
8342
|
+
const handleRegenerateWorkspaceOutputs = useCallback19(() => {
|
|
8248
8343
|
void workspaceOutputsSchedulerRef.current?.regenerate({ force: true });
|
|
8249
8344
|
}, []);
|
|
8250
|
-
const [selectedFile, setSelectedFile] =
|
|
8251
|
-
const [selectedSourceFile, setSelectedSourceFile] =
|
|
8252
|
-
const [selectedOutsideIn, setSelectedOutsideIn] =
|
|
8253
|
-
const [selectedOutsideInEditingEnabled, setSelectedOutsideInEditingEnabled] =
|
|
8254
|
-
const [selectedImage, setSelectedImage] =
|
|
8255
|
-
const [selectedManagedOutput, setSelectedManagedOutput] =
|
|
8256
|
-
const [findMode, setFindMode] =
|
|
8257
|
-
const findModeRef =
|
|
8345
|
+
const [selectedFile, setSelectedFile] = useState24(null);
|
|
8346
|
+
const [selectedSourceFile, setSelectedSourceFile] = useState24(null);
|
|
8347
|
+
const [selectedOutsideIn, setSelectedOutsideIn] = useState24(null);
|
|
8348
|
+
const [selectedOutsideInEditingEnabled, setSelectedOutsideInEditingEnabled] = useState24(false);
|
|
8349
|
+
const [selectedImage, setSelectedImage] = useState24(void 0);
|
|
8350
|
+
const [selectedManagedOutput, setSelectedManagedOutput] = useState24(void 0);
|
|
8351
|
+
const [findMode, setFindMode] = useState24(false);
|
|
8352
|
+
const findModeRef = useRef20(findMode);
|
|
8258
8353
|
findModeRef.current = findMode;
|
|
8259
|
-
|
|
8354
|
+
useEffect30(() => {
|
|
8260
8355
|
setFindMode(false);
|
|
8261
8356
|
}, [selectedFile]);
|
|
8262
|
-
const openFind =
|
|
8357
|
+
const openFind = useCallback19(() => {
|
|
8263
8358
|
if (!findModeRef.current) {
|
|
8264
8359
|
setFindMode(true);
|
|
8265
8360
|
return;
|
|
@@ -8268,14 +8363,14 @@ function DocBlocksShell({
|
|
|
8268
8363
|
}, []);
|
|
8269
8364
|
const findShortcut = useMemo6(findShortcutLabel, []);
|
|
8270
8365
|
const searchShortcut = useMemo6(() => shortcutLabel("workspace-search", isApplePlatform()), []);
|
|
8271
|
-
const [quickOpenOpen, setQuickOpenOpen] =
|
|
8272
|
-
const [shortcutsOpen, setShortcutsOpen] =
|
|
8273
|
-
const openKeyboardShortcuts =
|
|
8274
|
-
const [quickOpenFocusRequest, setQuickOpenFocusRequest] =
|
|
8275
|
-
const [sidebarView, setSidebarView] =
|
|
8276
|
-
const [searchMounted, setSearchMounted] =
|
|
8277
|
-
const [searchFocusRequest, setSearchFocusRequest] =
|
|
8278
|
-
|
|
8366
|
+
const [quickOpenOpen, setQuickOpenOpen] = useState24(false);
|
|
8367
|
+
const [shortcutsOpen, setShortcutsOpen] = useState24(false);
|
|
8368
|
+
const openKeyboardShortcuts = useCallback19(() => setShortcutsOpen(true), []);
|
|
8369
|
+
const [quickOpenFocusRequest, setQuickOpenFocusRequest] = useState24(0);
|
|
8370
|
+
const [sidebarView, setSidebarView] = useState24("files");
|
|
8371
|
+
const [searchMounted, setSearchMounted] = useState24(false);
|
|
8372
|
+
const [searchFocusRequest, setSearchFocusRequest] = useState24(0);
|
|
8373
|
+
useEffect30(() => {
|
|
8279
8374
|
if (!activeWorkspaceId || !selectedFile) return;
|
|
8280
8375
|
if (getTransientWorkspace(activeWorkspaceId) === null) {
|
|
8281
8376
|
recordRecentDocument(activeWorkspaceId, selectedFile);
|
|
@@ -8286,7 +8381,7 @@ function DocBlocksShell({
|
|
|
8286
8381
|
const layoutMode2 = defaultOutsideInLayoutMode(selectedOutsideIn);
|
|
8287
8382
|
return layoutMode2 && viewPreferences.layoutMode === void 0 ? { ...viewPreferences, layoutMode: layoutMode2 } : viewPreferences;
|
|
8288
8383
|
}, [selectedOutsideIn, viewPreferences]);
|
|
8289
|
-
const adoptSelectedDocument =
|
|
8384
|
+
const adoptSelectedDocument = useCallback19((document2) => {
|
|
8290
8385
|
setSelectedFile(document2?.displayPath ?? null);
|
|
8291
8386
|
setSelectedSourceFile(document2?.sourcePath ?? null);
|
|
8292
8387
|
setSelectedOutsideIn(document2?.outsideIn ?? null);
|
|
@@ -8294,7 +8389,7 @@ function DocBlocksShell({
|
|
|
8294
8389
|
setSelectedImage(document2?.image);
|
|
8295
8390
|
setSelectedManagedOutput(document2?.managedOutput);
|
|
8296
8391
|
}, []);
|
|
8297
|
-
const adoptRegularDocument =
|
|
8392
|
+
const adoptRegularDocument = useCallback19((path) => {
|
|
8298
8393
|
if (path === null) {
|
|
8299
8394
|
setSelectedFile(null);
|
|
8300
8395
|
setSelectedSourceFile(null);
|
|
@@ -8317,7 +8412,7 @@ function DocBlocksShell({
|
|
|
8317
8412
|
}
|
|
8318
8413
|
return URL.createObjectURL(new Blob([selectedImage.data], { type: selectedImage.mimeType }));
|
|
8319
8414
|
}, [selectedImage]);
|
|
8320
|
-
|
|
8415
|
+
useEffect30(
|
|
8321
8416
|
() => () => {
|
|
8322
8417
|
if (selectedImageUrl) URL.revokeObjectURL(selectedImageUrl);
|
|
8323
8418
|
},
|
|
@@ -8363,8 +8458,8 @@ function DocBlocksShell({
|
|
|
8363
8458
|
() => hostSupports2("exportDestinations") && exportDestinationAdapter ? createImageSaveOutput(exportDestinationAdapter) : void 0,
|
|
8364
8459
|
[exportDestinationAdapter]
|
|
8365
8460
|
);
|
|
8366
|
-
const [selectedFolder, setSelectedFolder] =
|
|
8367
|
-
const [folderEntries, setFolderEntries] =
|
|
8461
|
+
const [selectedFolder, setSelectedFolder] = useState24(null);
|
|
8462
|
+
const [folderEntries, setFolderEntries] = useState24([]);
|
|
8368
8463
|
const visibleFolderEntries = useMemo6(
|
|
8369
8464
|
() => filterVisibleFileEntries(folderEntries),
|
|
8370
8465
|
[folderEntries]
|
|
@@ -8378,8 +8473,8 @@ function DocBlocksShell({
|
|
|
8378
8473
|
} : null,
|
|
8379
8474
|
[documentSnapshot.frozen, documentSnapshot.generation, documentSnapshot.targetKey]
|
|
8380
8475
|
);
|
|
8381
|
-
const [editorGeneration, setEditorGeneration] =
|
|
8382
|
-
|
|
8476
|
+
const [editorGeneration, setEditorGeneration] = useState24(documentSnapshot.generation);
|
|
8477
|
+
useEffect30(() => {
|
|
8383
8478
|
const sync = () => setEditorGeneration(documentSession.getSnapshot().generation);
|
|
8384
8479
|
const unsubscribe = documentSession.subscribe(sync);
|
|
8385
8480
|
sync();
|
|
@@ -8388,7 +8483,7 @@ function DocBlocksShell({
|
|
|
8388
8483
|
};
|
|
8389
8484
|
}, [documentSession]);
|
|
8390
8485
|
const editorGenerationSettled = editorGeneration === documentSnapshot.generation;
|
|
8391
|
-
|
|
8486
|
+
useEffect30(() => {
|
|
8392
8487
|
setOutsideInPdfWorker(pdfWorkerSrc2);
|
|
8393
8488
|
}, [pdfWorkerSrc2]);
|
|
8394
8489
|
const editorKey = String(editorGeneration);
|
|
@@ -8396,43 +8491,43 @@ function DocBlocksShell({
|
|
|
8396
8491
|
void editorKey;
|
|
8397
8492
|
return pickEmptyDocumentPrompt();
|
|
8398
8493
|
}, [editorKey]);
|
|
8399
|
-
const [explorerKey, setExplorerKey] =
|
|
8494
|
+
const [explorerKey, setExplorerKey] = useState24(0);
|
|
8400
8495
|
const workspaceOutputsResult = workspaceOutputs.status.result;
|
|
8401
|
-
|
|
8496
|
+
useEffect30(() => {
|
|
8402
8497
|
if (!workspaceOutputsResult?.outputs.some((output) => output.created)) return;
|
|
8403
8498
|
if (provider && getFileSystemProviderV211(provider)?.capabilities.watch) return;
|
|
8404
8499
|
setExplorerKey((key) => key + 1);
|
|
8405
8500
|
}, [provider, workspaceOutputsResult]);
|
|
8406
|
-
const [fileExplorerSortMode, setFileExplorerSortMode] =
|
|
8407
|
-
const handleFileExplorerSortModeChange =
|
|
8501
|
+
const [fileExplorerSortMode, setFileExplorerSortMode] = useState24(loadFileExplorerSortMode);
|
|
8502
|
+
const handleFileExplorerSortModeChange = useCallback19((mode) => {
|
|
8408
8503
|
setFileExplorerSortMode(mode);
|
|
8409
8504
|
saveFileExplorerSortMode(mode);
|
|
8410
8505
|
}, []);
|
|
8411
|
-
const [initialView, setInitialView] =
|
|
8412
|
-
const [initialSharedMode, setInitialSharedMode] =
|
|
8413
|
-
const [showWelcomeGateway, setShowWelcomeGateway] =
|
|
8506
|
+
const [initialView, setInitialView] = useState24("wysiwyg");
|
|
8507
|
+
const [initialSharedMode, setInitialSharedMode] = useState24(null);
|
|
8508
|
+
const [showWelcomeGateway, setShowWelcomeGateway] = useState24(false);
|
|
8414
8509
|
const welcomeScreenShown = showWelcomeGateway && !singlePane;
|
|
8415
|
-
const welcomeCoveredRef =
|
|
8510
|
+
const welcomeCoveredRef = useRef20(null);
|
|
8416
8511
|
useInert(welcomeCoveredRef, welcomeScreenShown);
|
|
8417
|
-
const closeWelcomeGateway =
|
|
8512
|
+
const closeWelcomeGateway = useCallback19(() => {
|
|
8418
8513
|
setShowWelcomeGateway((showing) => {
|
|
8419
8514
|
if (showing) markWelcomeGatewayDismissed();
|
|
8420
8515
|
return false;
|
|
8421
8516
|
});
|
|
8422
8517
|
}, []);
|
|
8423
|
-
const [aiPanel, setAiPanel] =
|
|
8424
|
-
const navigationRequestRef =
|
|
8518
|
+
const [aiPanel, setAiPanel] = useState24(null);
|
|
8519
|
+
const navigationRequestRef = useRef20(0);
|
|
8425
8520
|
const workspaceAuthorityBarrier = useMemo6(() => new WorkspaceAuthorityBarrier(), []);
|
|
8426
|
-
const preparedCloseRequestRef =
|
|
8427
|
-
const pendingDbkConflictsRef =
|
|
8428
|
-
const afterWorkspaceCommit =
|
|
8521
|
+
const preparedCloseRequestRef = useRef20(null);
|
|
8522
|
+
const pendingDbkConflictsRef = useRef20(/* @__PURE__ */ new Map());
|
|
8523
|
+
const afterWorkspaceCommit = useCallback19(
|
|
8429
8524
|
(workspaceId, path) => {
|
|
8430
8525
|
gitScheduleRefresh();
|
|
8431
8526
|
notifyWorkspaceChanged(workspaceId, path);
|
|
8432
8527
|
},
|
|
8433
8528
|
[gitScheduleRefresh, notifyWorkspaceChanged]
|
|
8434
8529
|
);
|
|
8435
|
-
const createDocumentTarget =
|
|
8530
|
+
const createDocumentTarget = useCallback19(
|
|
8436
8531
|
(fsProvider, workspaceId, filePath, outsideIn = null) => {
|
|
8437
8532
|
if (outsideIn) {
|
|
8438
8533
|
return createOutsideInDocumentTarget(
|
|
@@ -8608,20 +8703,20 @@ function DocBlocksShell({
|
|
|
8608
8703
|
},
|
|
8609
8704
|
[afterWorkspaceCommit, gitScheduleRefresh]
|
|
8610
8705
|
);
|
|
8611
|
-
const mediaContainerRef =
|
|
8612
|
-
const [mediaProvider, setMediaProvider] =
|
|
8613
|
-
const [mediaProviderScope, setMediaProviderScope] =
|
|
8706
|
+
const mediaContainerRef = useRef20(null);
|
|
8707
|
+
const [mediaProvider, setMediaProvider] = useState24(null);
|
|
8708
|
+
const [mediaProviderScope, setMediaProviderScope] = useState24(null);
|
|
8614
8709
|
const mediaProviderCurrent = mediaProviderScope !== null && mediaProviderScope.provider === provider && mediaProviderScope.file === selectedFile && mediaProviderScope.outsideIn === selectedOutsideIn;
|
|
8615
|
-
const [mediaEpoch, setMediaEpoch] =
|
|
8616
|
-
const versionsContainerRef =
|
|
8617
|
-
const [versionsContainer, setVersionsContainer] =
|
|
8618
|
-
const pushHash =
|
|
8710
|
+
const [mediaEpoch, setMediaEpoch] = useState24(0);
|
|
8711
|
+
const versionsContainerRef = useRef20(null);
|
|
8712
|
+
const [versionsContainer, setVersionsContainer] = useState24(null);
|
|
8713
|
+
const pushHash = useCallback19((wsId, filePath) => {
|
|
8619
8714
|
const hash = buildHash(wsId, filePath);
|
|
8620
8715
|
if (window.location.hash !== hash) {
|
|
8621
8716
|
window.history.pushState(null, "", hash);
|
|
8622
8717
|
}
|
|
8623
8718
|
}, []);
|
|
8624
|
-
const openFromIds =
|
|
8719
|
+
const openFromIds = useCallback19(
|
|
8625
8720
|
async (wsId, filePath, push, view, navigationRequestId, sharedMode = null) => {
|
|
8626
8721
|
const requestId = navigationRequestId ?? ++navigationRequestRef.current;
|
|
8627
8722
|
if (requestId !== navigationRequestRef.current) return null;
|
|
@@ -8708,7 +8803,7 @@ function DocBlocksShell({
|
|
|
8708
8803
|
},
|
|
8709
8804
|
[adoptSelectedDocument, createDocumentTarget, documentSession, pushHash]
|
|
8710
8805
|
);
|
|
8711
|
-
const adoptTransientWorkspace =
|
|
8806
|
+
const adoptTransientWorkspace = useCallback19(
|
|
8712
8807
|
async (options) => {
|
|
8713
8808
|
const descriptor = {
|
|
8714
8809
|
id: options.id,
|
|
@@ -8738,7 +8833,7 @@ function DocBlocksShell({
|
|
|
8738
8833
|
},
|
|
8739
8834
|
[openFromIds, closeWelcomeGateway]
|
|
8740
8835
|
);
|
|
8741
|
-
const openSharedDocument =
|
|
8836
|
+
const openSharedDocument = useCallback19(
|
|
8742
8837
|
async (payload, navigationRequestId) => {
|
|
8743
8838
|
const id = `transient-shared-${navigationRequestId}`;
|
|
8744
8839
|
const mem = await createMemoryFileSystemProvider(id, "Shared document");
|
|
@@ -8771,7 +8866,7 @@ function DocBlocksShell({
|
|
|
8771
8866
|
},
|
|
8772
8867
|
[adoptTransientWorkspace]
|
|
8773
8868
|
);
|
|
8774
|
-
const seedWelcomeFile =
|
|
8869
|
+
const seedWelcomeFile = useCallback19(
|
|
8775
8870
|
async (fs, seedWhenEmpty, navigationRequestId) => {
|
|
8776
8871
|
const isCurrent = () => navigationRequestId === void 0 || navigationRequestId === navigationRequestRef.current;
|
|
8777
8872
|
if (!isCurrent()) return;
|
|
@@ -8796,7 +8891,10 @@ function DocBlocksShell({
|
|
|
8796
8891
|
}
|
|
8797
8892
|
if (!seedWhenEmpty || entries.length > 0) return;
|
|
8798
8893
|
const welcomePath = WELCOME_DOCUMENT_PATH;
|
|
8799
|
-
const welcomeContent =
|
|
8894
|
+
const welcomeContent = welcomeDocumentContent({
|
|
8895
|
+
browserStorage: showBrowserStorageWarning,
|
|
8896
|
+
desktopApp
|
|
8897
|
+
});
|
|
8800
8898
|
let seededContent = welcomeContent;
|
|
8801
8899
|
try {
|
|
8802
8900
|
await writeProviderText(fs, welcomePath, welcomeContent, "create");
|
|
@@ -8820,25 +8918,32 @@ function DocBlocksShell({
|
|
|
8820
8918
|
saveLastState({ workspaceId: fs.id, filePath: welcomePath, view: "wysiwyg" });
|
|
8821
8919
|
if (!isWelcomeGatewayDismissed()) setShowWelcomeGateway(true);
|
|
8822
8920
|
},
|
|
8823
|
-
[
|
|
8921
|
+
[
|
|
8922
|
+
adoptRegularDocument,
|
|
8923
|
+
createDocumentTarget,
|
|
8924
|
+
desktopApp,
|
|
8925
|
+
documentSession,
|
|
8926
|
+
pushHash,
|
|
8927
|
+
showBrowserStorageWarning
|
|
8928
|
+
]
|
|
8824
8929
|
);
|
|
8825
|
-
const startupOpenFromIdsRef =
|
|
8930
|
+
const startupOpenFromIdsRef = useRef20(openFromIds);
|
|
8826
8931
|
startupOpenFromIdsRef.current = openFromIds;
|
|
8827
|
-
const startupOpenSharedDocumentRef =
|
|
8932
|
+
const startupOpenSharedDocumentRef = useRef20(openSharedDocument);
|
|
8828
8933
|
startupOpenSharedDocumentRef.current = openSharedDocument;
|
|
8829
|
-
const startupSeedWelcomeFileRef =
|
|
8934
|
+
const startupSeedWelcomeFileRef = useRef20(seedWelcomeFile);
|
|
8830
8935
|
startupSeedWelcomeFileRef.current = seedWelcomeFile;
|
|
8831
|
-
const [focusAfterWelcome, setFocusAfterWelcome] =
|
|
8832
|
-
const handleTourWelcome =
|
|
8936
|
+
const [focusAfterWelcome, setFocusAfterWelcome] = useState24(false);
|
|
8937
|
+
const handleTourWelcome = useCallback19(() => {
|
|
8833
8938
|
closeWelcomeGateway();
|
|
8834
8939
|
setFocusAfterWelcome(true);
|
|
8835
8940
|
}, [closeWelcomeGateway]);
|
|
8836
|
-
|
|
8941
|
+
useEffect30(() => {
|
|
8837
8942
|
if (!focusAfterWelcome || welcomeScreenShown) return;
|
|
8838
8943
|
setFocusAfterWelcome(false);
|
|
8839
8944
|
editorAreaRef.current?.querySelector('[contenteditable="true"]')?.focus({ preventScroll: true });
|
|
8840
8945
|
}, [focusAfterWelcome, welcomeScreenShown]);
|
|
8841
|
-
|
|
8946
|
+
useEffect30(() => {
|
|
8842
8947
|
const requestId = ++navigationRequestRef.current;
|
|
8843
8948
|
let cancelled = false;
|
|
8844
8949
|
const isCurrent = () => !cancelled && requestId === navigationRequestRef.current;
|
|
@@ -9050,7 +9155,7 @@ function DocBlocksShell({
|
|
|
9050
9155
|
if (navigationRequestRef.current === requestId) navigationRequestRef.current += 1;
|
|
9051
9156
|
};
|
|
9052
9157
|
}, [pushHash, workspaceAuthorityBarrier]);
|
|
9053
|
-
|
|
9158
|
+
useEffect30(() => {
|
|
9054
9159
|
const onPopState = () => {
|
|
9055
9160
|
const requestedHash = window.location.hash;
|
|
9056
9161
|
const restoreCurrentHash = () => {
|
|
@@ -9092,7 +9197,7 @@ function DocBlocksShell({
|
|
|
9092
9197
|
window.addEventListener("popstate", onPopState);
|
|
9093
9198
|
return () => window.removeEventListener("popstate", onPopState);
|
|
9094
9199
|
}, [activeWorkspaceId, openFromIds, openSharedDocument, selectedFile, showToast]);
|
|
9095
|
-
|
|
9200
|
+
useEffect30(() => {
|
|
9096
9201
|
if (!showBrowserStorageWarning || typeof navigator === "undefined") return;
|
|
9097
9202
|
const storage = navigator.storage;
|
|
9098
9203
|
if (!storage || typeof storage.persisted !== "function") return;
|
|
@@ -9105,7 +9210,7 @@ function DocBlocksShell({
|
|
|
9105
9210
|
cancelled = true;
|
|
9106
9211
|
};
|
|
9107
9212
|
}, [showBrowserStorageWarning]);
|
|
9108
|
-
|
|
9213
|
+
useEffect30(() => {
|
|
9109
9214
|
if (hasDocBlocksHost() || typeof window === "undefined") return;
|
|
9110
9215
|
const onBeforeInstallPrompt = (e) => {
|
|
9111
9216
|
e.preventDefault();
|
|
@@ -9128,7 +9233,7 @@ function DocBlocksShell({
|
|
|
9128
9233
|
window.removeEventListener("appinstalled", onAppInstalled);
|
|
9129
9234
|
};
|
|
9130
9235
|
}, []);
|
|
9131
|
-
const handleInstallApp =
|
|
9236
|
+
const handleInstallApp = useCallback19(async () => {
|
|
9132
9237
|
const promptEvent = installPromptEvent;
|
|
9133
9238
|
setInstallPromptEvent(null);
|
|
9134
9239
|
if (!promptEvent) return;
|
|
@@ -9138,7 +9243,7 @@ function DocBlocksShell({
|
|
|
9138
9243
|
} catch {
|
|
9139
9244
|
}
|
|
9140
9245
|
}, [installPromptEvent]);
|
|
9141
|
-
|
|
9246
|
+
useEffect30(() => {
|
|
9142
9247
|
const handler = (e) => {
|
|
9143
9248
|
const target = e.target.closest?.("[data-view]");
|
|
9144
9249
|
if (target) {
|
|
@@ -9154,7 +9259,7 @@ function DocBlocksShell({
|
|
|
9154
9259
|
window.addEventListener("click", handler, true);
|
|
9155
9260
|
return () => window.removeEventListener("click", handler, true);
|
|
9156
9261
|
}, [activeWorkspaceId, selectedFile, closeWelcomeGateway]);
|
|
9157
|
-
const saveActiveDocument =
|
|
9262
|
+
const saveActiveDocument = useCallback19(() => {
|
|
9158
9263
|
void (async () => {
|
|
9159
9264
|
try {
|
|
9160
9265
|
await documentSession.flush("manual");
|
|
@@ -9167,30 +9272,30 @@ function DocBlocksShell({
|
|
|
9167
9272
|
}
|
|
9168
9273
|
})();
|
|
9169
9274
|
}, [documentSession, showToast]);
|
|
9170
|
-
|
|
9275
|
+
useEffect30(() => {
|
|
9171
9276
|
return () => {
|
|
9172
9277
|
if (saveToastTimerRef.current) clearTimeout(saveToastTimerRef.current);
|
|
9173
9278
|
};
|
|
9174
9279
|
}, []);
|
|
9175
|
-
const [offlineReadyToast, setOfflineReadyToast] =
|
|
9176
|
-
const offlineReadyAnnouncedRef =
|
|
9177
|
-
|
|
9280
|
+
const [offlineReadyToast, setOfflineReadyToast] = useState24(false);
|
|
9281
|
+
const offlineReadyAnnouncedRef = useRef20(false);
|
|
9282
|
+
useEffect30(() => {
|
|
9178
9283
|
if (!offlineReady || offlineReadyAnnouncedRef.current) return;
|
|
9179
9284
|
offlineReadyAnnouncedRef.current = true;
|
|
9180
9285
|
setOfflineReadyToast(true);
|
|
9181
9286
|
const timer = setTimeout(() => setOfflineReadyToast(false), 3e3);
|
|
9182
9287
|
return () => clearTimeout(timer);
|
|
9183
9288
|
}, [offlineReady]);
|
|
9184
|
-
const [storageFull, setStorageFull] =
|
|
9185
|
-
|
|
9289
|
+
const [storageFull, setStorageFull] = useState24(false);
|
|
9290
|
+
useEffect30(() => {
|
|
9186
9291
|
if (documentSnapshot.error && isQuotaExceededError(documentSnapshot.error)) {
|
|
9187
9292
|
setStorageFull(true);
|
|
9188
9293
|
} else if (documentSnapshot.status === "saved") {
|
|
9189
9294
|
setStorageFull(false);
|
|
9190
9295
|
}
|
|
9191
9296
|
}, [documentSnapshot.error, documentSnapshot.status]);
|
|
9192
|
-
const autoPersistRequestedRef =
|
|
9193
|
-
|
|
9297
|
+
const autoPersistRequestedRef = useRef20(false);
|
|
9298
|
+
useEffect30(() => {
|
|
9194
9299
|
if (!showBrowserStorageWarning || browserStoragePersistent) return;
|
|
9195
9300
|
if (autoPersistRequestedRef.current) return;
|
|
9196
9301
|
if (documentSnapshot.status !== "saved") return;
|
|
@@ -9238,8 +9343,8 @@ function DocBlocksShell({
|
|
|
9238
9343
|
mp.dispose();
|
|
9239
9344
|
};
|
|
9240
9345
|
}, [provider, selectedFile, selectedOutsideIn, mediaEpoch]);
|
|
9241
|
-
const [mediaEditRenders, setMediaEditRenders] =
|
|
9242
|
-
|
|
9346
|
+
const [mediaEditRenders, setMediaEditRenders] = useState24(null);
|
|
9347
|
+
useEffect30(() => {
|
|
9243
9348
|
setMediaEditRenders(null);
|
|
9244
9349
|
if (!mediaProvider) return;
|
|
9245
9350
|
let manager = null;
|
|
@@ -9263,7 +9368,7 @@ function DocBlocksShell({
|
|
|
9263
9368
|
selectedSourceFile ?? selectedFile,
|
|
9264
9369
|
workspaceIndex.ensure
|
|
9265
9370
|
);
|
|
9266
|
-
|
|
9371
|
+
useEffect30(() => {
|
|
9267
9372
|
const ref = versioningRef;
|
|
9268
9373
|
if (!ref) return;
|
|
9269
9374
|
const assign = (mgr2) => {
|
|
@@ -9287,7 +9392,7 @@ function DocBlocksShell({
|
|
|
9287
9392
|
(output) => output.status === "written" && sameProviderPath(output.path, selectedFile)
|
|
9288
9393
|
) ? workspaceOutputsResult : null;
|
|
9289
9394
|
}, [selectedFile, selectedManagedOutput, workspaceOutputsResult]);
|
|
9290
|
-
|
|
9395
|
+
useEffect30(() => {
|
|
9291
9396
|
if (!provider) return;
|
|
9292
9397
|
const providerV2 = getFileSystemProviderV211(provider);
|
|
9293
9398
|
const lifecycle = maybeGetDocBlocksHost4()?.lifecycle;
|
|
@@ -9368,7 +9473,7 @@ function DocBlocksShell({
|
|
|
9368
9473
|
documentSnapshot.targetKey,
|
|
9369
9474
|
showToast
|
|
9370
9475
|
]);
|
|
9371
|
-
const transitionAwayFromDocument =
|
|
9476
|
+
const transitionAwayFromDocument = useCallback19(
|
|
9372
9477
|
async (requestId) => {
|
|
9373
9478
|
if (requestId !== navigationRequestRef.current) return false;
|
|
9374
9479
|
try {
|
|
@@ -9387,15 +9492,15 @@ function DocBlocksShell({
|
|
|
9387
9492
|
},
|
|
9388
9493
|
[documentSession, showToast]
|
|
9389
9494
|
);
|
|
9390
|
-
const [showConflictComparison, setShowConflictComparison] =
|
|
9391
|
-
const readConflictFile =
|
|
9495
|
+
const [showConflictComparison, setShowConflictComparison] = useState24(false);
|
|
9496
|
+
const readConflictFile = useCallback19(async () => {
|
|
9392
9497
|
const path = selectedSourceFile ?? selectedFile;
|
|
9393
9498
|
if (!provider || !path || activeWorkspaceId && getTransientWorkspace(activeWorkspaceId)) {
|
|
9394
9499
|
return null;
|
|
9395
9500
|
}
|
|
9396
9501
|
return readStableFileSnapshot(provider, path);
|
|
9397
9502
|
}, [provider, selectedSourceFile, selectedFile, activeWorkspaceId]);
|
|
9398
|
-
const handleUseExternalDocument =
|
|
9503
|
+
const handleUseExternalDocument = useCallback19(async () => {
|
|
9399
9504
|
const conflictKey = documentSession.getSnapshot().conflict?.targetKey;
|
|
9400
9505
|
const pendingDbk = conflictKey ? pendingDbkConflictsRef.current.get(conflictKey) : void 0;
|
|
9401
9506
|
try {
|
|
@@ -9419,7 +9524,7 @@ function DocBlocksShell({
|
|
|
9419
9524
|
return false;
|
|
9420
9525
|
}
|
|
9421
9526
|
}, [activeWorkspaceId, adoptSelectedDocument, documentSession, pushHash]);
|
|
9422
|
-
const handleKeepLocalDocument =
|
|
9527
|
+
const handleKeepLocalDocument = useCallback19(async () => {
|
|
9423
9528
|
const conflictKey = documentSession.getSnapshot().conflict?.targetKey;
|
|
9424
9529
|
try {
|
|
9425
9530
|
await documentSession.resolveConflict("use-local");
|
|
@@ -9434,7 +9539,7 @@ function DocBlocksShell({
|
|
|
9434
9539
|
return false;
|
|
9435
9540
|
}
|
|
9436
9541
|
}, [documentSession]);
|
|
9437
|
-
|
|
9542
|
+
useEffect30(() => {
|
|
9438
9543
|
const needsWarning = ["dirty", "saving", "error", "conflict"].includes(documentSnapshot.status);
|
|
9439
9544
|
if (!documentSnapshot.targetKey) return;
|
|
9440
9545
|
const flushBestEffort = () => {
|
|
@@ -9460,7 +9565,7 @@ function DocBlocksShell({
|
|
|
9460
9565
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
9461
9566
|
};
|
|
9462
9567
|
}, [documentSession, documentSnapshot.status, documentSnapshot.targetKey]);
|
|
9463
|
-
|
|
9568
|
+
useEffect30(() => {
|
|
9464
9569
|
const lifecycle = maybeGetDocBlocksHost4()?.lifecycle;
|
|
9465
9570
|
if (!hostSupports2("guardedClose") || !lifecycle) return;
|
|
9466
9571
|
const stopPrepare = lifecycle.onPrepareClose(async (request) => {
|
|
@@ -9486,7 +9591,7 @@ function DocBlocksShell({
|
|
|
9486
9591
|
stopCancel?.();
|
|
9487
9592
|
};
|
|
9488
9593
|
}, [documentSession]);
|
|
9489
|
-
const handleWorkspaceSelect =
|
|
9594
|
+
const handleWorkspaceSelect = useCallback19(
|
|
9490
9595
|
async (ws) => {
|
|
9491
9596
|
const requestId = ++navigationRequestRef.current;
|
|
9492
9597
|
await touchWorkspace2(ws.id);
|
|
@@ -9518,7 +9623,7 @@ function DocBlocksShell({
|
|
|
9518
9623
|
},
|
|
9519
9624
|
[adoptSelectedDocument, pushHash, transitionAwayFromDocument]
|
|
9520
9625
|
);
|
|
9521
|
-
const unpinDocument =
|
|
9626
|
+
const unpinDocument = useCallback19((document2) => {
|
|
9522
9627
|
const key = pinnedDocumentKey(document2);
|
|
9523
9628
|
setPinnedDocuments((current) => removePinnedDocument(current, document2));
|
|
9524
9629
|
setPinnedDocumentAvailability((current) => {
|
|
@@ -9528,7 +9633,7 @@ function DocBlocksShell({
|
|
|
9528
9633
|
return next;
|
|
9529
9634
|
});
|
|
9530
9635
|
}, []);
|
|
9531
|
-
const confirmMissingPinnedDocument =
|
|
9636
|
+
const confirmMissingPinnedDocument = useCallback19(
|
|
9532
9637
|
async (document2) => {
|
|
9533
9638
|
setPinnedAvailability(document2, "missing");
|
|
9534
9639
|
const shouldUnpin = await confirmAction({
|
|
@@ -9541,7 +9646,7 @@ function DocBlocksShell({
|
|
|
9541
9646
|
},
|
|
9542
9647
|
[confirmAction, setPinnedAvailability, unpinDocument]
|
|
9543
9648
|
);
|
|
9544
|
-
const handleTogglePin =
|
|
9649
|
+
const handleTogglePin = useCallback19(
|
|
9545
9650
|
(path) => {
|
|
9546
9651
|
if (!activeWorkspaceId || !provider) return;
|
|
9547
9652
|
const canonicalPath2 = parseWorkspacePath8(path);
|
|
@@ -9579,7 +9684,7 @@ function DocBlocksShell({
|
|
|
9579
9684
|
() => pinnedDocuments.filter((document2) => document2.workspaceId === activeWorkspaceId).map((document2) => document2.path),
|
|
9580
9685
|
[activeWorkspaceId, pinnedDocuments]
|
|
9581
9686
|
);
|
|
9582
|
-
const handlePinnedDocumentSelect =
|
|
9687
|
+
const handlePinnedDocumentSelect = useCallback19(
|
|
9583
9688
|
async (document2) => {
|
|
9584
9689
|
const requestId = ++navigationRequestRef.current;
|
|
9585
9690
|
const workspace = await getWorkspace(document2.workspaceId);
|
|
@@ -9707,7 +9812,7 @@ function DocBlocksShell({
|
|
|
9707
9812
|
showToast
|
|
9708
9813
|
]
|
|
9709
9814
|
);
|
|
9710
|
-
const handleMoveTransientWorkspace =
|
|
9815
|
+
const handleMoveTransientWorkspace = useCallback19(
|
|
9711
9816
|
async (destinationWorkspaceId) => {
|
|
9712
9817
|
if (!activeWorkspaceId || !provider || !selectedFile) {
|
|
9713
9818
|
throw new Error("Select the temporary document before moving it.");
|
|
@@ -9821,7 +9926,7 @@ function DocBlocksShell({
|
|
|
9821
9926
|
transientMoveDestinations
|
|
9822
9927
|
]
|
|
9823
9928
|
);
|
|
9824
|
-
const handleOpenFolder =
|
|
9929
|
+
const handleOpenFolder = useCallback19(async () => {
|
|
9825
9930
|
const requestId = ++navigationRequestRef.current;
|
|
9826
9931
|
try {
|
|
9827
9932
|
if (hostSupports2("workspaceFolderPicker")) {
|
|
@@ -9867,7 +9972,7 @@ function DocBlocksShell({
|
|
|
9867
9972
|
} catch {
|
|
9868
9973
|
}
|
|
9869
9974
|
}, [adoptSelectedDocument, pushHash, transitionAwayFromDocument]);
|
|
9870
|
-
const handleWorkspaceCloned =
|
|
9975
|
+
const handleWorkspaceCloned = useCallback19(
|
|
9871
9976
|
(info) => {
|
|
9872
9977
|
const requestId = ++navigationRequestRef.current;
|
|
9873
9978
|
void (async () => {
|
|
@@ -9892,10 +9997,10 @@ function DocBlocksShell({
|
|
|
9892
9997
|
},
|
|
9893
9998
|
[adoptSelectedDocument, pushHash, transitionAwayFromDocument]
|
|
9894
9999
|
);
|
|
9895
|
-
const handleNewFile =
|
|
10000
|
+
const handleNewFile = useCallback19(() => {
|
|
9896
10001
|
if (provider) setNewDocumentDialogOpen(true);
|
|
9897
10002
|
}, [provider]);
|
|
9898
|
-
const createNewDocument =
|
|
10003
|
+
const createNewDocument = useCallback19(
|
|
9899
10004
|
async ({ filename, format }) => {
|
|
9900
10005
|
if (!provider) return;
|
|
9901
10006
|
const path = "/" + filename;
|
|
@@ -9994,7 +10099,7 @@ function DocBlocksShell({
|
|
|
9994
10099
|
showToast
|
|
9995
10100
|
]
|
|
9996
10101
|
);
|
|
9997
|
-
const handleNewFolder =
|
|
10102
|
+
const handleNewFolder = useCallback19(async () => {
|
|
9998
10103
|
if (!provider) return;
|
|
9999
10104
|
const name = await promptForText({
|
|
10000
10105
|
title: "New folder",
|
|
@@ -10042,15 +10147,15 @@ function DocBlocksShell({
|
|
|
10042
10147
|
singlePane
|
|
10043
10148
|
]);
|
|
10044
10149
|
const canFind = selectedFile !== null && mediaProvider !== null && selectedManagedOutput !== "catalog-html" && selectedImage === void 0;
|
|
10045
|
-
const canFindRef =
|
|
10150
|
+
const canFindRef = useRef20(canFind);
|
|
10046
10151
|
canFindRef.current = canFind;
|
|
10047
10152
|
const { ensure: ensureWorkspaceIndex } = workspaceIndex;
|
|
10048
|
-
const openQuickOpen =
|
|
10153
|
+
const openQuickOpen = useCallback19(() => {
|
|
10049
10154
|
ensureWorkspaceIndex();
|
|
10050
10155
|
setQuickOpenOpen(true);
|
|
10051
10156
|
setQuickOpenFocusRequest((request) => request + 1);
|
|
10052
10157
|
}, [ensureWorkspaceIndex]);
|
|
10053
|
-
const openWorkspaceSearch =
|
|
10158
|
+
const openWorkspaceSearch = useCallback19(() => {
|
|
10054
10159
|
ensureWorkspaceIndex();
|
|
10055
10160
|
if (singlePane) setMobileShowEditor(false);
|
|
10056
10161
|
else if (sidebarPreference === "collapsed") updateSidebarPreference("pinned");
|
|
@@ -10118,7 +10223,7 @@ function DocBlocksShell({
|
|
|
10118
10223
|
]
|
|
10119
10224
|
);
|
|
10120
10225
|
useShellShortcuts(shortcutHandlers, layoutMode);
|
|
10121
|
-
|
|
10226
|
+
useEffect30(
|
|
10122
10227
|
() => maybeGetDocBlocksHost4()?.lifecycle?.onBack?.(() => {
|
|
10123
10228
|
if (dismissTopmostDialog()) return true;
|
|
10124
10229
|
const escape = new KeyboardEvent("keydown", {
|
|
@@ -10140,8 +10245,8 @@ function DocBlocksShell({
|
|
|
10140
10245
|
}),
|
|
10141
10246
|
[singlePane, mobileShowEditor]
|
|
10142
10247
|
);
|
|
10143
|
-
const actionNewHandledRef =
|
|
10144
|
-
|
|
10248
|
+
const actionNewHandledRef = useRef20(false);
|
|
10249
|
+
useEffect30(() => {
|
|
10145
10250
|
if (!provider || actionNewHandledRef.current) return;
|
|
10146
10251
|
if (typeof window === "undefined") return;
|
|
10147
10252
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -10156,7 +10261,7 @@ function DocBlocksShell({
|
|
|
10156
10261
|
);
|
|
10157
10262
|
void handleNewFile();
|
|
10158
10263
|
}, [provider, handleNewFile]);
|
|
10159
|
-
const handleRevealWorkspace =
|
|
10264
|
+
const handleRevealWorkspace = useCallback19(async () => {
|
|
10160
10265
|
const shell = maybeGetDocBlocksHost4()?.shell;
|
|
10161
10266
|
if (!hostSupports2("revealInFileManager") || !shell?.revealInFolder || !activeWorkspaceId) {
|
|
10162
10267
|
return;
|
|
@@ -10166,7 +10271,7 @@ function DocBlocksShell({
|
|
|
10166
10271
|
await shell.revealInFolder(ws.id);
|
|
10167
10272
|
}
|
|
10168
10273
|
}, [activeWorkspaceId]);
|
|
10169
|
-
const handleOpenWorkspaceFolder =
|
|
10274
|
+
const handleOpenWorkspaceFolder = useCallback19(() => {
|
|
10170
10275
|
const shell = maybeGetDocBlocksHost4()?.shell;
|
|
10171
10276
|
if (!hostSupports2("openWorkspaceFolder") || !shell?.openWorkspaceFolder || !nativeWorkspaceId) {
|
|
10172
10277
|
return;
|
|
@@ -10178,7 +10283,7 @@ function DocBlocksShell({
|
|
|
10178
10283
|
);
|
|
10179
10284
|
});
|
|
10180
10285
|
}, [nativeWorkspaceId, showToast]);
|
|
10181
|
-
|
|
10286
|
+
useEffect30(() => {
|
|
10182
10287
|
const host = maybeGetDocBlocksHost4();
|
|
10183
10288
|
if (!hostSupports2("menuCommands") || !host?.onMenuCommand) return;
|
|
10184
10289
|
return host.onMenuCommand((cmd) => {
|
|
@@ -10245,7 +10350,7 @@ function DocBlocksShell({
|
|
|
10245
10350
|
}
|
|
10246
10351
|
});
|
|
10247
10352
|
}, [handleNewFile, handleOpenFolder, handleRevealWorkspace, acknowledge, openFind]);
|
|
10248
|
-
const handleSelect =
|
|
10353
|
+
const handleSelect = useCallback19(
|
|
10249
10354
|
async (path, kind, createWikiArticle = false) => {
|
|
10250
10355
|
if (!provider || !activeWorkspaceId) return;
|
|
10251
10356
|
const requestId = ++navigationRequestRef.current;
|
|
@@ -10329,7 +10434,7 @@ function DocBlocksShell({
|
|
|
10329
10434
|
defaultNewFileFormat
|
|
10330
10435
|
]
|
|
10331
10436
|
);
|
|
10332
|
-
const wikiNavigationRef =
|
|
10437
|
+
const wikiNavigationRef = useRef20(handleSelect);
|
|
10333
10438
|
wikiNavigationRef.current = handleSelect;
|
|
10334
10439
|
const wikiLinks = useMemo6(() => {
|
|
10335
10440
|
if (!provider || !selectedFile || !activeWorkspaceId) return null;
|
|
@@ -10391,7 +10496,7 @@ function DocBlocksShell({
|
|
|
10391
10496
|
workspaceIndex.ensure,
|
|
10392
10497
|
workspaceIndex.status.generation
|
|
10393
10498
|
]);
|
|
10394
|
-
const handleEnableOutsideInEditing =
|
|
10499
|
+
const handleEnableOutsideInEditing = useCallback19(
|
|
10395
10500
|
async (path) => {
|
|
10396
10501
|
if (!provider || !activeWorkspaceId) {
|
|
10397
10502
|
throw new Error("Open the workspace before enabling Markdown editing.");
|
|
@@ -10453,7 +10558,7 @@ function DocBlocksShell({
|
|
|
10453
10558
|
return null;
|
|
10454
10559
|
}
|
|
10455
10560
|
}, [workspaceSettings.settings]);
|
|
10456
|
-
const outsideInActionsForEntry =
|
|
10561
|
+
const outsideInActionsForEntry = useCallback19(
|
|
10457
10562
|
(entry) => {
|
|
10458
10563
|
if (entry.kind !== "file" || resolveOutsideInLayout2(entry.path) === null) return [];
|
|
10459
10564
|
if (catalogHtmlPath !== null && sameProviderPath(entry.path, catalogHtmlPath)) return [];
|
|
@@ -10469,7 +10574,7 @@ function DocBlocksShell({
|
|
|
10469
10574
|
},
|
|
10470
10575
|
[catalogHtmlPath, handleEnableOutsideInEditing, selectedFile, selectedOutsideInEditingEnabled]
|
|
10471
10576
|
);
|
|
10472
|
-
const actionsForEntry =
|
|
10577
|
+
const actionsForEntry = useCallback19(
|
|
10473
10578
|
(entry) => {
|
|
10474
10579
|
const nativeActions = createNativeFileActions(
|
|
10475
10580
|
entry,
|
|
@@ -10492,7 +10597,7 @@ function DocBlocksShell({
|
|
|
10492
10597
|
() => quickOpenOpen && activeWorkspaceId ? loadRecentDocuments(activeWorkspaceId) : [],
|
|
10493
10598
|
[quickOpenOpen, activeWorkspaceId]
|
|
10494
10599
|
);
|
|
10495
|
-
const handleQuickOpenChoice =
|
|
10600
|
+
const handleQuickOpenChoice = useCallback19(
|
|
10496
10601
|
(item) => {
|
|
10497
10602
|
setQuickOpenOpen(false);
|
|
10498
10603
|
if (item.workspaceId === activeWorkspaceId) {
|
|
@@ -10506,13 +10611,13 @@ function DocBlocksShell({
|
|
|
10506
10611
|
},
|
|
10507
10612
|
[activeWorkspaceId, handleSelect, handlePinnedDocumentSelect, pinnedDocumentItems]
|
|
10508
10613
|
);
|
|
10509
|
-
const handleSearchOpen =
|
|
10614
|
+
const handleSearchOpen = useCallback19(
|
|
10510
10615
|
(request) => {
|
|
10511
10616
|
void handleSelect(request.path, "file");
|
|
10512
10617
|
},
|
|
10513
10618
|
[handleSelect]
|
|
10514
10619
|
);
|
|
10515
|
-
const handleEditorLinkClick =
|
|
10620
|
+
const handleEditorLinkClick = useCallback19(
|
|
10516
10621
|
(href) => {
|
|
10517
10622
|
const target = resolveShellEditorLinkTarget(href, selectedSourceFile ?? selectedFile);
|
|
10518
10623
|
if (!target) {
|
|
@@ -10551,7 +10656,7 @@ function DocBlocksShell({
|
|
|
10551
10656
|
},
|
|
10552
10657
|
[handleSelect, provider, selectedFile, selectedSourceFile, showToast]
|
|
10553
10658
|
);
|
|
10554
|
-
const handleTreeMutation =
|
|
10659
|
+
const handleTreeMutation = useCallback19(
|
|
10555
10660
|
async (change, mutate) => {
|
|
10556
10661
|
if (!provider) {
|
|
10557
10662
|
await mutate();
|
|
@@ -10635,7 +10740,7 @@ function DocBlocksShell({
|
|
|
10635
10740
|
showToast
|
|
10636
10741
|
]
|
|
10637
10742
|
);
|
|
10638
|
-
const handleTreeChange =
|
|
10743
|
+
const handleTreeChange = useCallback19(
|
|
10639
10744
|
async (change) => {
|
|
10640
10745
|
if (!provider) return;
|
|
10641
10746
|
notifyWorkspaceChanged(activeWorkspaceId);
|
|
@@ -10706,7 +10811,7 @@ function DocBlocksShell({
|
|
|
10706
10811
|
setPinnedAvailability
|
|
10707
10812
|
]
|
|
10708
10813
|
);
|
|
10709
|
-
const acquirePinnedDocumentProvider =
|
|
10814
|
+
const acquirePinnedDocumentProvider = useCallback19(
|
|
10710
10815
|
async (document2) => {
|
|
10711
10816
|
const workspace = await getWorkspace(document2.workspaceId);
|
|
10712
10817
|
if (!workspace) return { kind: "missing-workspace" };
|
|
@@ -10730,7 +10835,7 @@ function DocBlocksShell({
|
|
|
10730
10835
|
},
|
|
10731
10836
|
[activeWorkspaceId, provider]
|
|
10732
10837
|
);
|
|
10733
|
-
const markRelocatedPinnedDocument =
|
|
10838
|
+
const markRelocatedPinnedDocument = useCallback19((document2, newPath) => {
|
|
10734
10839
|
const relocated = {
|
|
10735
10840
|
workspaceId: document2.workspaceId,
|
|
10736
10841
|
workspaceName: document2.workspaceName,
|
|
@@ -10749,7 +10854,7 @@ function DocBlocksShell({
|
|
|
10749
10854
|
return next;
|
|
10750
10855
|
});
|
|
10751
10856
|
}, []);
|
|
10752
|
-
const handlePinnedDocumentRename =
|
|
10857
|
+
const handlePinnedDocumentRename = useCallback19(
|
|
10753
10858
|
async (document2) => {
|
|
10754
10859
|
if (document2.availability === "missing") {
|
|
10755
10860
|
await confirmMissingPinnedDocument(document2);
|
|
@@ -10836,7 +10941,7 @@ function DocBlocksShell({
|
|
|
10836
10941
|
showToast
|
|
10837
10942
|
]
|
|
10838
10943
|
);
|
|
10839
|
-
const handlePinnedDocumentDelete =
|
|
10944
|
+
const handlePinnedDocumentDelete = useCallback19(
|
|
10840
10945
|
async (document2) => {
|
|
10841
10946
|
if (document2.availability === "missing") {
|
|
10842
10947
|
await confirmMissingPinnedDocument(document2);
|
|
@@ -10904,9 +11009,9 @@ function DocBlocksShell({
|
|
|
10904
11009
|
showToast
|
|
10905
11010
|
]
|
|
10906
11011
|
);
|
|
10907
|
-
const restoreInputRef =
|
|
10908
|
-
const restoreInProgress =
|
|
10909
|
-
const handleRestoreBackup =
|
|
11012
|
+
const restoreInputRef = useRef20(null);
|
|
11013
|
+
const restoreInProgress = useRef20(false);
|
|
11014
|
+
const handleRestoreBackup = useCallback19(
|
|
10910
11015
|
async (file) => {
|
|
10911
11016
|
if (restoreInProgress.current) {
|
|
10912
11017
|
showToast("error", "A backup is already being restored. Please wait.");
|
|
@@ -10933,7 +11038,7 @@ function DocBlocksShell({
|
|
|
10933
11038
|
},
|
|
10934
11039
|
[documentSession, handleWorkspaceSelect, showToast]
|
|
10935
11040
|
);
|
|
10936
|
-
const importOrRestore =
|
|
11041
|
+
const importOrRestore = useCallback19(
|
|
10937
11042
|
async (files) => {
|
|
10938
11043
|
const backups = hostSupports2("nativeWorkspaces") ? [] : files.filter((file) => /\.zip$/i.test(file.name));
|
|
10939
11044
|
const documents = files.filter((file) => !backups.includes(file));
|
|
@@ -10943,7 +11048,7 @@ function DocBlocksShell({
|
|
|
10943
11048
|
},
|
|
10944
11049
|
[handleRestoreBackup, provider]
|
|
10945
11050
|
);
|
|
10946
|
-
const handleImportFiles =
|
|
11051
|
+
const handleImportFiles = useCallback19(
|
|
10947
11052
|
async (files) => {
|
|
10948
11053
|
if (!provider) return;
|
|
10949
11054
|
const result = await importOrRestore(files);
|
|
@@ -10955,7 +11060,7 @@ function DocBlocksShell({
|
|
|
10955
11060
|
},
|
|
10956
11061
|
[activeWorkspaceId, notifyWorkspaceChanged, provider, showToast, importOrRestore]
|
|
10957
11062
|
);
|
|
10958
|
-
const handleImportFilesToEditor =
|
|
11063
|
+
const handleImportFilesToEditor = useCallback19(
|
|
10959
11064
|
async (files) => {
|
|
10960
11065
|
if (!provider) return;
|
|
10961
11066
|
const result = await importOrRestore(files);
|
|
@@ -10977,7 +11082,7 @@ function DocBlocksShell({
|
|
|
10977
11082
|
provider !== null,
|
|
10978
11083
|
(files) => void handleImportFilesToEditor(files)
|
|
10979
11084
|
);
|
|
10980
|
-
const handleEditorChange =
|
|
11085
|
+
const handleEditorChange = useCallback19(
|
|
10981
11086
|
(source) => {
|
|
10982
11087
|
if (!editorSessionScope) return;
|
|
10983
11088
|
try {
|
|
@@ -10987,7 +11092,7 @@ function DocBlocksShell({
|
|
|
10987
11092
|
},
|
|
10988
11093
|
[documentSession, editorSessionScope]
|
|
10989
11094
|
);
|
|
10990
|
-
const handleRenameWorkspace =
|
|
11095
|
+
const handleRenameWorkspace = useCallback19(async () => {
|
|
10991
11096
|
if (!activeWorkspaceId) return;
|
|
10992
11097
|
const ws = await getWorkspace(activeWorkspaceId);
|
|
10993
11098
|
if (!ws) return;
|
|
@@ -11004,7 +11109,7 @@ function DocBlocksShell({
|
|
|
11004
11109
|
);
|
|
11005
11110
|
setDescriptorRefreshKey((key) => key + 1);
|
|
11006
11111
|
}, [activeWorkspaceId, promptForText]);
|
|
11007
|
-
const openTransient =
|
|
11112
|
+
const openTransient = useCallback19(
|
|
11008
11113
|
async (req, navigationRequestId) => {
|
|
11009
11114
|
const isCurrent = () => navigationRequestId === navigationRequestRef.current;
|
|
11010
11115
|
const host = getDocBlocksHost();
|
|
@@ -11081,7 +11186,7 @@ function DocBlocksShell({
|
|
|
11081
11186
|
},
|
|
11082
11187
|
[adoptTransientWorkspace]
|
|
11083
11188
|
);
|
|
11084
|
-
|
|
11189
|
+
useEffect30(() => {
|
|
11085
11190
|
const host = maybeGetDocBlocksHost4();
|
|
11086
11191
|
if (!hostSupports2("openRequests") || !host) return;
|
|
11087
11192
|
return host.onOpenRequest((req) => {
|
|
@@ -11106,7 +11211,7 @@ function DocBlocksShell({
|
|
|
11106
11211
|
});
|
|
11107
11212
|
});
|
|
11108
11213
|
}, [openFromIds, openTransient, workspaceAuthorityBarrier, showToast, closeWelcomeGateway]);
|
|
11109
|
-
const openTransientFromHandle =
|
|
11214
|
+
const openTransientFromHandle = useCallback19(
|
|
11110
11215
|
async (handle) => {
|
|
11111
11216
|
const name = handle.name;
|
|
11112
11217
|
const isBundle = /\.(dbk|zip)$/i.test(name);
|
|
@@ -11148,7 +11253,7 @@ function DocBlocksShell({
|
|
|
11148
11253
|
},
|
|
11149
11254
|
[adoptTransientWorkspace]
|
|
11150
11255
|
);
|
|
11151
|
-
|
|
11256
|
+
useEffect30(() => {
|
|
11152
11257
|
if (hostSupports2("openRequests") || typeof window === "undefined") return;
|
|
11153
11258
|
const launchQueue = window.launchQueue;
|
|
11154
11259
|
if (!launchQueue) return;
|
|
@@ -11164,7 +11269,7 @@ function DocBlocksShell({
|
|
|
11164
11269
|
});
|
|
11165
11270
|
}, [openTransientFromHandle, showToast]);
|
|
11166
11271
|
const updateStatusBarVisible = viewPreferences.showStatusBar === true && selectedFile !== null && mediaProvider !== null;
|
|
11167
|
-
const handleDownloadWorkspace =
|
|
11272
|
+
const handleDownloadWorkspace = useCallback19(async () => {
|
|
11168
11273
|
if (!provider) return;
|
|
11169
11274
|
try {
|
|
11170
11275
|
await documentSession.flush("backup");
|
|
@@ -11189,7 +11294,7 @@ function DocBlocksShell({
|
|
|
11189
11294
|
showToast("error", err instanceof Error ? err.message : "Failed to download workspace.");
|
|
11190
11295
|
}
|
|
11191
11296
|
}, [provider, documentSession, showToast]);
|
|
11192
|
-
const handleDownloadAllWorkspaces =
|
|
11297
|
+
const handleDownloadAllWorkspaces = useCallback19(async () => {
|
|
11193
11298
|
try {
|
|
11194
11299
|
await documentSession.flush("backup");
|
|
11195
11300
|
const [{ MemoryContentContainer }, { containerToZip }] = await Promise.all([
|
|
@@ -11262,7 +11367,7 @@ function DocBlocksShell({
|
|
|
11262
11367
|
showToast("error", err instanceof Error ? err.message : "Failed to download all workspaces.");
|
|
11263
11368
|
}
|
|
11264
11369
|
}, [documentSession, acknowledge, showToast]);
|
|
11265
|
-
const handleKeepBrowserData =
|
|
11370
|
+
const handleKeepBrowserData = useCallback19(async () => {
|
|
11266
11371
|
if (typeof navigator === "undefined") return;
|
|
11267
11372
|
const storage = navigator.storage;
|
|
11268
11373
|
if (!storage || typeof storage.persist !== "function") {
|
|
@@ -11299,7 +11404,7 @@ function DocBlocksShell({
|
|
|
11299
11404
|
});
|
|
11300
11405
|
}
|
|
11301
11406
|
}, [acknowledge, showToast]);
|
|
11302
|
-
const getBrowserStorageEstimate =
|
|
11407
|
+
const getBrowserStorageEstimate = useCallback19(async () => {
|
|
11303
11408
|
if (typeof navigator === "undefined") return null;
|
|
11304
11409
|
const storage = navigator.storage;
|
|
11305
11410
|
if (!storage || typeof storage.estimate !== "function") return null;
|
|
@@ -11311,7 +11416,7 @@ function DocBlocksShell({
|
|
|
11311
11416
|
return null;
|
|
11312
11417
|
}
|
|
11313
11418
|
}, []);
|
|
11314
|
-
const handleRemoveWorkspace =
|
|
11419
|
+
const handleRemoveWorkspace = useCallback19(
|
|
11315
11420
|
async (workspaceId) => {
|
|
11316
11421
|
const ws = await getWorkspace(workspaceId);
|
|
11317
11422
|
const removingActive = workspaceId === activeWorkspaceId;
|
|
@@ -11405,7 +11510,7 @@ function DocBlocksShell({
|
|
|
11405
11510
|
transitionAwayFromDocument
|
|
11406
11511
|
]
|
|
11407
11512
|
);
|
|
11408
|
-
return /* @__PURE__ */
|
|
11513
|
+
return /* @__PURE__ */ jsx19(
|
|
11409
11514
|
"div",
|
|
11410
11515
|
{
|
|
11411
11516
|
ref: shellRef,
|
|
@@ -11414,10 +11519,10 @@ function DocBlocksShell({
|
|
|
11414
11519
|
"data-accent": accentColor,
|
|
11415
11520
|
"data-interface-font": interfaceFont === "fixed" ? "fixed" : void 0,
|
|
11416
11521
|
"data-document-status": documentSnapshot.status,
|
|
11417
|
-
children: /* @__PURE__ */
|
|
11522
|
+
children: /* @__PURE__ */ jsxs17(GitContext.Provider, { value: git, children: [
|
|
11418
11523
|
promptDialog,
|
|
11419
11524
|
confirmDialog,
|
|
11420
|
-
quickOpenOpen && activeWorkspaceId && /* @__PURE__ */
|
|
11525
|
+
quickOpenOpen && activeWorkspaceId && /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(
|
|
11421
11526
|
QuickOpenDialog,
|
|
11422
11527
|
{
|
|
11423
11528
|
index: workspaceIndex.index,
|
|
@@ -11431,8 +11536,8 @@ function DocBlocksShell({
|
|
|
11431
11536
|
onClose: () => setQuickOpenOpen(false)
|
|
11432
11537
|
}
|
|
11433
11538
|
) }),
|
|
11434
|
-
shortcutsOpen && /* @__PURE__ */
|
|
11435
|
-
newDocumentDialogOpen && /* @__PURE__ */
|
|
11539
|
+
shortcutsOpen && /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(KeyboardShortcutsDialog, { onClose: () => setShortcutsOpen(false) }) }),
|
|
11540
|
+
newDocumentDialogOpen && /* @__PURE__ */ jsx19(
|
|
11436
11541
|
NewDocumentDialog,
|
|
11437
11542
|
{
|
|
11438
11543
|
initialFormat: defaultNewFileFormat,
|
|
@@ -11442,8 +11547,8 @@ function DocBlocksShell({
|
|
|
11442
11547
|
}
|
|
11443
11548
|
}
|
|
11444
11549
|
),
|
|
11445
|
-
workspaceStartupError && /* @__PURE__ */
|
|
11446
|
-
saveToast && /* @__PURE__ */
|
|
11550
|
+
workspaceStartupError && /* @__PURE__ */ jsx19("div", { className: "db-save-toast db-save-toast--error", role: "alert", "aria-live": "assertive", children: workspaceStartupError }),
|
|
11551
|
+
saveToast && /* @__PURE__ */ jsx19(
|
|
11447
11552
|
"div",
|
|
11448
11553
|
{
|
|
11449
11554
|
className: "db-save-toast db-save-toast--" + saveToast.kind,
|
|
@@ -11452,12 +11557,12 @@ function DocBlocksShell({
|
|
|
11452
11557
|
children: saveToast.message
|
|
11453
11558
|
}
|
|
11454
11559
|
),
|
|
11455
|
-
offlineReadyToast && !saveToast && /* @__PURE__ */
|
|
11456
|
-
documentSnapshot.conflict && /* @__PURE__ */
|
|
11457
|
-
/* @__PURE__ */
|
|
11458
|
-
/* @__PURE__ */
|
|
11560
|
+
offlineReadyToast && !saveToast && /* @__PURE__ */ jsx19("div", { className: "db-save-toast db-save-toast--success", role: "status", "aria-live": "polite", children: "DocBlocks is ready to work offline." }),
|
|
11561
|
+
documentSnapshot.conflict && /* @__PURE__ */ jsxs17("div", { className: "db-document-conflict", role: "alert", children: [
|
|
11562
|
+
/* @__PURE__ */ jsx19("span", { children: documentSnapshot.conflict.recoveredDraft ? "A recovery draft from a previous session differs from the saved file. The saved file may be newer. Choose which version to use." : "This document changed outside DocBlocks. Your unsaved version is still intact." }),
|
|
11563
|
+
/* @__PURE__ */ jsx19("div", { className: "db-document-conflict-actions", children: /* @__PURE__ */ jsx19("button", { type: "button", onClick: () => setShowConflictComparison(true), children: "Compare versions" }) })
|
|
11459
11564
|
] }),
|
|
11460
|
-
documentSnapshot.conflict && showConflictComparison && /* @__PURE__ */
|
|
11565
|
+
documentSnapshot.conflict && showConflictComparison && /* @__PURE__ */ jsx19(Suspense2, { fallback: /* @__PURE__ */ jsx19("div", { role: "status", children: "Loading version comparison\u2026" }), children: /* @__PURE__ */ jsx19(
|
|
11461
11566
|
DocumentConflictDialog,
|
|
11462
11567
|
{
|
|
11463
11568
|
conflict: documentSnapshot.conflict,
|
|
@@ -11467,14 +11572,14 @@ function DocBlocksShell({
|
|
|
11467
11572
|
onClose: () => setShowConflictComparison(false)
|
|
11468
11573
|
}
|
|
11469
11574
|
) }),
|
|
11470
|
-
storageFull && !documentSnapshot.conflict && /* @__PURE__ */
|
|
11471
|
-
/* @__PURE__ */
|
|
11472
|
-
/* @__PURE__ */
|
|
11473
|
-
/* @__PURE__ */
|
|
11474
|
-
/* @__PURE__ */
|
|
11575
|
+
storageFull && !documentSnapshot.conflict && /* @__PURE__ */ jsxs17("div", { className: "db-storage-full-banner", role: "alert", children: [
|
|
11576
|
+
/* @__PURE__ */ jsx19("span", { children: "Browser storage is full -- changes can\u2019t be saved. Free up space or back up your work now." }),
|
|
11577
|
+
/* @__PURE__ */ jsxs17("div", { className: "db-storage-full-banner-actions", children: [
|
|
11578
|
+
/* @__PURE__ */ jsx19("button", { type: "button", onClick: () => void handleDownloadAllWorkspaces(), children: "Back up all workspaces" }),
|
|
11579
|
+
/* @__PURE__ */ jsx19("button", { type: "button", onClick: () => setStorageFull(false), children: "Dismiss" })
|
|
11475
11580
|
] })
|
|
11476
11581
|
] }),
|
|
11477
|
-
workspaceSettingsOpen && activeWorkspaceDescriptor && /* @__PURE__ */
|
|
11582
|
+
workspaceSettingsOpen && activeWorkspaceDescriptor && /* @__PURE__ */ jsx19(
|
|
11478
11583
|
WorkspaceSettingsDialog,
|
|
11479
11584
|
{
|
|
11480
11585
|
workspace: activeWorkspaceDescriptor,
|
|
@@ -11487,8 +11592,8 @@ function DocBlocksShell({
|
|
|
11487
11592
|
onClose: () => setWorkspaceSettingsOpen(false)
|
|
11488
11593
|
}
|
|
11489
11594
|
),
|
|
11490
|
-
/* @__PURE__ */
|
|
11491
|
-
/* @__PURE__ */
|
|
11595
|
+
/* @__PURE__ */ jsxs17("div", { className: "db-shell-panes", ref: panesRef, children: [
|
|
11596
|
+
/* @__PURE__ */ jsxs17(
|
|
11492
11597
|
"aside",
|
|
11493
11598
|
{
|
|
11494
11599
|
ref: sidebarRef,
|
|
@@ -11496,8 +11601,8 @@ function DocBlocksShell({
|
|
|
11496
11601
|
"aria-label": "Workspace and files",
|
|
11497
11602
|
style: singlePane ? void 0 : { width: `${sidebarWidth}px` },
|
|
11498
11603
|
children: [
|
|
11499
|
-
/* @__PURE__ */
|
|
11500
|
-
/* @__PURE__ */
|
|
11604
|
+
/* @__PURE__ */ jsxs17("div", { className: "db-shell-sidebar-header", children: [
|
|
11605
|
+
/* @__PURE__ */ jsx19(
|
|
11501
11606
|
AppMenu,
|
|
11502
11607
|
{
|
|
11503
11608
|
logoUrl,
|
|
@@ -11529,10 +11634,11 @@ function DocBlocksShell({
|
|
|
11529
11634
|
appBuildDate,
|
|
11530
11635
|
ai,
|
|
11531
11636
|
speech,
|
|
11637
|
+
tray: trayMenu,
|
|
11532
11638
|
settingsRequest
|
|
11533
11639
|
}
|
|
11534
11640
|
),
|
|
11535
|
-
/* @__PURE__ */
|
|
11641
|
+
/* @__PURE__ */ jsx19(
|
|
11536
11642
|
"input",
|
|
11537
11643
|
{
|
|
11538
11644
|
ref: restoreInputRef,
|
|
@@ -11547,7 +11653,7 @@ function DocBlocksShell({
|
|
|
11547
11653
|
}
|
|
11548
11654
|
}
|
|
11549
11655
|
),
|
|
11550
|
-
/* @__PURE__ */
|
|
11656
|
+
/* @__PURE__ */ jsx19(
|
|
11551
11657
|
WorkspacePicker,
|
|
11552
11658
|
{
|
|
11553
11659
|
activeWorkspaceId,
|
|
@@ -11559,7 +11665,7 @@ function DocBlocksShell({
|
|
|
11559
11665
|
onRemoveWorkspace: (workspace) => void handleRemoveWorkspace(workspace.id)
|
|
11560
11666
|
}
|
|
11561
11667
|
),
|
|
11562
|
-
/* @__PURE__ */
|
|
11668
|
+
/* @__PURE__ */ jsx19(
|
|
11563
11669
|
WorkspaceSettingsButton,
|
|
11564
11670
|
{
|
|
11565
11671
|
onSettings: handleOpenWorkspaceSettings,
|
|
@@ -11570,26 +11676,26 @@ function DocBlocksShell({
|
|
|
11570
11676
|
}
|
|
11571
11677
|
}
|
|
11572
11678
|
),
|
|
11573
|
-
canRestoreSplitView && /* @__PURE__ */
|
|
11679
|
+
canRestoreSplitView && /* @__PURE__ */ jsx19(
|
|
11574
11680
|
"button",
|
|
11575
11681
|
{
|
|
11576
11682
|
className: "db-restore-split",
|
|
11577
11683
|
onClick: () => updateSidebarPreference("pinned"),
|
|
11578
11684
|
"aria-label": "Restore split view",
|
|
11579
11685
|
title: "Restore split view",
|
|
11580
|
-
children: /* @__PURE__ */
|
|
11686
|
+
children: /* @__PURE__ */ jsx19(SplitViewIcon, {})
|
|
11581
11687
|
}
|
|
11582
11688
|
),
|
|
11583
|
-
/* @__PURE__ */
|
|
11689
|
+
/* @__PURE__ */ jsx19("span", { className: "db-window-drag-grip", "aria-hidden": true })
|
|
11584
11690
|
] }),
|
|
11585
|
-
git.available && /* @__PURE__ */
|
|
11691
|
+
git.available && /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(
|
|
11586
11692
|
GitUI,
|
|
11587
11693
|
{
|
|
11588
11694
|
onOpenFile: (path) => void handleSelect(path, "file"),
|
|
11589
11695
|
onWorkspaceCloned: handleWorkspaceCloned
|
|
11590
11696
|
}
|
|
11591
11697
|
) }),
|
|
11592
|
-
/* @__PURE__ */
|
|
11698
|
+
/* @__PURE__ */ jsx19(
|
|
11593
11699
|
FileExplorer,
|
|
11594
11700
|
{
|
|
11595
11701
|
loading: workspaceStarting,
|
|
@@ -11624,7 +11730,7 @@ function DocBlocksShell({
|
|
|
11624
11730
|
},
|
|
11625
11731
|
explorerKey
|
|
11626
11732
|
),
|
|
11627
|
-
searchMounted && /* @__PURE__ */
|
|
11733
|
+
searchMounted && /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(
|
|
11628
11734
|
WorkspaceSearchPanel,
|
|
11629
11735
|
{
|
|
11630
11736
|
index: workspaceIndex.index,
|
|
@@ -11635,17 +11741,17 @@ function DocBlocksShell({
|
|
|
11635
11741
|
onShowFiles: () => setSidebarView("files")
|
|
11636
11742
|
}
|
|
11637
11743
|
) }),
|
|
11638
|
-
singlePane && showWelcomeGateway && /* @__PURE__ */
|
|
11639
|
-
/* @__PURE__ */
|
|
11640
|
-
/* @__PURE__ */
|
|
11641
|
-
/* @__PURE__ */
|
|
11744
|
+
singlePane && showWelcomeGateway && /* @__PURE__ */ jsxs17("section", { className: "db-mobile-first-run", "aria-labelledby": "db-mobile-first-run-title", children: [
|
|
11745
|
+
/* @__PURE__ */ jsx19("p", { className: "db-mobile-first-run-eyebrow", children: "Local-first Markdown editor" }),
|
|
11746
|
+
/* @__PURE__ */ jsx19("h1", { id: "db-mobile-first-run-title", children: "Welcome to DocBlocks" }),
|
|
11747
|
+
/* @__PURE__ */ jsxs17("p", { children: [
|
|
11642
11748
|
WELCOME_SUMMARY,
|
|
11643
11749
|
" ",
|
|
11644
11750
|
WELCOME_PRIVACY_NOTE
|
|
11645
11751
|
] }),
|
|
11646
|
-
/* @__PURE__ */
|
|
11647
|
-
/* @__PURE__ */
|
|
11648
|
-
/* @__PURE__ */
|
|
11752
|
+
/* @__PURE__ */ jsxs17("div", { className: "db-mobile-first-run-actions", children: [
|
|
11753
|
+
/* @__PURE__ */ jsx19("button", { type: "button", onClick: () => void handleNewFile(), children: "Create a document" }),
|
|
11754
|
+
/* @__PURE__ */ jsx19(
|
|
11649
11755
|
"button",
|
|
11650
11756
|
{
|
|
11651
11757
|
type: "button",
|
|
@@ -11659,14 +11765,14 @@ function DocBlocksShell({
|
|
|
11659
11765
|
)
|
|
11660
11766
|
] })
|
|
11661
11767
|
] }),
|
|
11662
|
-
git.available && git.pendingGrant && /* @__PURE__ */
|
|
11663
|
-
/* @__PURE__ */
|
|
11664
|
-
/* @__PURE__ */
|
|
11665
|
-
/* @__PURE__ */
|
|
11666
|
-
/* @__PURE__ */
|
|
11667
|
-
/* @__PURE__ */
|
|
11668
|
-
/* @__PURE__ */
|
|
11669
|
-
showBrowserStorageWarning && /* @__PURE__ */
|
|
11768
|
+
git.available && git.pendingGrant && /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(GitGrantNotice, {}) }),
|
|
11769
|
+
/* @__PURE__ */ jsxs17("div", { className: "db-shell-sidebar-footer", children: [
|
|
11770
|
+
/* @__PURE__ */ jsx19("a", { href: "https://docblocks.com/docs/", target: "_blank", rel: "noopener noreferrer", children: "Docs" }),
|
|
11771
|
+
/* @__PURE__ */ jsx19("span", { className: "db-shell-sidebar-footer-separator", "aria-hidden": "true", children: "\u2022" }),
|
|
11772
|
+
/* @__PURE__ */ jsx19("a", { href: "https://docblocks.com/terms/", target: "_blank", rel: "noopener noreferrer", children: "Terms" }),
|
|
11773
|
+
/* @__PURE__ */ jsx19("span", { className: "db-shell-sidebar-footer-separator", "aria-hidden": "true", children: "\u2022" }),
|
|
11774
|
+
/* @__PURE__ */ jsx19("a", { href: issueReportUrl, target: "_blank", rel: "noopener noreferrer", children: "Report issue" }),
|
|
11775
|
+
showBrowserStorageWarning && /* @__PURE__ */ jsx19(Fragment11, { children: /* @__PURE__ */ jsxs17(
|
|
11670
11776
|
"button",
|
|
11671
11777
|
{
|
|
11672
11778
|
type: "button",
|
|
@@ -11675,20 +11781,20 @@ function DocBlocksShell({
|
|
|
11675
11781
|
"aria-label": "Back up all workspaces",
|
|
11676
11782
|
title: "Browsers can clear site data. Download a backup of every workspace.",
|
|
11677
11783
|
children: [
|
|
11678
|
-
/* @__PURE__ */
|
|
11784
|
+
/* @__PURE__ */ jsx19(BackupIcon, {}),
|
|
11679
11785
|
"Back up"
|
|
11680
11786
|
]
|
|
11681
11787
|
}
|
|
11682
11788
|
) })
|
|
11683
11789
|
] }),
|
|
11684
|
-
/* @__PURE__ */
|
|
11685
|
-
/* @__PURE__ */
|
|
11686
|
-
/* @__PURE__ */
|
|
11790
|
+
/* @__PURE__ */ jsxs17("div", { className: "db-sidebar-collapse-preview", "aria-hidden": "true", children: [
|
|
11791
|
+
/* @__PURE__ */ jsx19("span", { className: "db-sidebar-collapse-preview-icon", children: /* @__PURE__ */ jsx19(CollapseSidebarGlyph, {}) }),
|
|
11792
|
+
/* @__PURE__ */ jsx19("span", { className: "db-sidebar-collapse-preview-label", children: "Release to hide files" })
|
|
11687
11793
|
] })
|
|
11688
11794
|
]
|
|
11689
11795
|
}
|
|
11690
11796
|
),
|
|
11691
|
-
!singlePane && /* @__PURE__ */
|
|
11797
|
+
!singlePane && /* @__PURE__ */ jsx19(
|
|
11692
11798
|
"div",
|
|
11693
11799
|
{
|
|
11694
11800
|
className: "db-shell-sidebar-resizer",
|
|
@@ -11698,7 +11804,7 @@ function DocBlocksShell({
|
|
|
11698
11804
|
onPointerDown: handleResizerPointerDown
|
|
11699
11805
|
}
|
|
11700
11806
|
),
|
|
11701
|
-
singlePane && /* @__PURE__ */
|
|
11807
|
+
singlePane && /* @__PURE__ */ jsx19(
|
|
11702
11808
|
"div",
|
|
11703
11809
|
{
|
|
11704
11810
|
className: "db-shell-scrim",
|
|
@@ -11706,7 +11812,7 @@ function DocBlocksShell({
|
|
|
11706
11812
|
onPointerDown: () => setMobileShowEditor(true)
|
|
11707
11813
|
}
|
|
11708
11814
|
),
|
|
11709
|
-
/* @__PURE__ */
|
|
11815
|
+
/* @__PURE__ */ jsxs17(
|
|
11710
11816
|
"main",
|
|
11711
11817
|
{
|
|
11712
11818
|
ref: editorAreaRef,
|
|
@@ -11717,8 +11823,8 @@ function DocBlocksShell({
|
|
|
11717
11823
|
editorDropActive ? "db-shell-editor-area--drop-active" : ""
|
|
11718
11824
|
].filter(Boolean).join(" "),
|
|
11719
11825
|
children: [
|
|
11720
|
-
/* @__PURE__ */
|
|
11721
|
-
selectedFile && mediaProvider ? /* @__PURE__ */
|
|
11826
|
+
/* @__PURE__ */ jsxs17("div", { ref: welcomeCoveredRef, className: "db-shell-editor-content", children: [
|
|
11827
|
+
selectedFile && mediaProvider ? /* @__PURE__ */ jsx19(Fragment11, { children: selectedManagedOutput === "catalog-html" ? /* @__PURE__ */ jsx19(
|
|
11722
11828
|
GeneratedCatalogPage,
|
|
11723
11829
|
{
|
|
11724
11830
|
html: editorContent,
|
|
@@ -11726,17 +11832,17 @@ function DocBlocksShell({
|
|
|
11726
11832
|
onOpenSettings: activeWorkspaceDescriptor ? handleOpenWorkspaceSettings : void 0,
|
|
11727
11833
|
onBack: singlePane ? openDrawer : void 0
|
|
11728
11834
|
}
|
|
11729
|
-
) : /* @__PURE__ */
|
|
11835
|
+
) : /* @__PURE__ */ jsx19(
|
|
11730
11836
|
GeneratedFileFrame,
|
|
11731
11837
|
{
|
|
11732
11838
|
kind: selectedManagedOutput,
|
|
11733
11839
|
onOpenSettings: activeWorkspaceDescriptor ? handleOpenWorkspaceSettings : void 0,
|
|
11734
11840
|
onBack: singlePane ? openDrawer : void 0,
|
|
11735
|
-
children: /* @__PURE__ */
|
|
11841
|
+
children: /* @__PURE__ */ jsx19(
|
|
11736
11842
|
Suspense2,
|
|
11737
11843
|
{
|
|
11738
|
-
fallback: /* @__PURE__ */
|
|
11739
|
-
children: editorGenerationSettled && mediaProviderCurrent && /* @__PURE__ */
|
|
11844
|
+
fallback: /* @__PURE__ */ jsx19("div", { className: "db-shell-empty", role: "status", children: "Loading your document\u2026" }),
|
|
11845
|
+
children: editorGenerationSettled && mediaProviderCurrent && /* @__PURE__ */ jsx19(EditorErrorBoundary, { resetKey: `${selectedFile}-${editorKey}`, children: /* @__PURE__ */ jsx19(
|
|
11740
11846
|
EditorShell,
|
|
11741
11847
|
{
|
|
11742
11848
|
initialMarkdown: editorContent,
|
|
@@ -11787,19 +11893,19 @@ function DocBlocksShell({
|
|
|
11787
11893
|
versioningAutoSaveIdleMs,
|
|
11788
11894
|
onSaveVersion,
|
|
11789
11895
|
statusBarSlotRight,
|
|
11790
|
-
sidePanelSlot: ai && aiPanel && selectedImage === void 0 && (selectedOutsideIn === null || selectedOutsideInEditingEnabled) ? /* @__PURE__ */
|
|
11791
|
-
toolbarSlotLeft: singlePane ? /* @__PURE__ */
|
|
11896
|
+
sidePanelSlot: ai && aiPanel && selectedImage === void 0 && (selectedOutsideIn === null || selectedOutsideInEditingEnabled) ? /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: aiPanel === "review" ? /* @__PURE__ */ jsx19(AiReviewPanel, { ai, onClose: () => setAiPanel(null) }) : /* @__PURE__ */ jsx19(AiIllustratePanel, { ai, onClose: () => setAiPanel(null) }) }) : void 0,
|
|
11897
|
+
toolbarSlotLeft: singlePane ? /* @__PURE__ */ jsx19(
|
|
11792
11898
|
"button",
|
|
11793
11899
|
{
|
|
11794
11900
|
className: "db-mobile-back",
|
|
11795
11901
|
onClick: () => setMobileShowEditor(false),
|
|
11796
11902
|
"aria-label": "Show file list",
|
|
11797
|
-
children: /* @__PURE__ */
|
|
11903
|
+
children: /* @__PURE__ */ jsx19("span", { className: "db-mobile-files-icon", children: /* @__PURE__ */ jsx19(FolderGlyph, {}) })
|
|
11798
11904
|
}
|
|
11799
11905
|
) : void 0,
|
|
11800
|
-
summarizationDesigner: selectedImage === void 0 && selectedManagedOutput === void 0 && (selectedOutsideIn === null || selectedOutsideInEditingEnabled) ? (onClose) => /* @__PURE__ */
|
|
11801
|
-
toolbarSlotRight: /* @__PURE__ */
|
|
11802
|
-
canFind && /* @__PURE__ */
|
|
11906
|
+
summarizationDesigner: selectedImage === void 0 && selectedManagedOutput === void 0 && (selectedOutsideIn === null || selectedOutsideInEditingEnabled) ? (onClose) => /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(PresentationMaker, { ai: ai ?? void 0, onClose }) }) : void 0,
|
|
11907
|
+
toolbarSlotRight: /* @__PURE__ */ jsxs17(Fragment11, { children: [
|
|
11908
|
+
canFind && /* @__PURE__ */ jsx19(
|
|
11803
11909
|
FindButton,
|
|
11804
11910
|
{
|
|
11805
11911
|
active: findMode,
|
|
@@ -11807,7 +11913,7 @@ function DocBlocksShell({
|
|
|
11807
11913
|
shortcutLabel: findShortcut
|
|
11808
11914
|
}
|
|
11809
11915
|
),
|
|
11810
|
-
ai && /* @__PURE__ */
|
|
11916
|
+
ai && /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(
|
|
11811
11917
|
AiToolbarControl,
|
|
11812
11918
|
{
|
|
11813
11919
|
ai,
|
|
@@ -11816,8 +11922,8 @@ function DocBlocksShell({
|
|
|
11816
11922
|
onOpenPanel: setAiPanel
|
|
11817
11923
|
}
|
|
11818
11924
|
) }),
|
|
11819
|
-
speech && /* @__PURE__ */
|
|
11820
|
-
/* @__PURE__ */
|
|
11925
|
+
speech && /* @__PURE__ */ jsxs17(Suspense2, { fallback: null, children: [
|
|
11926
|
+
/* @__PURE__ */ jsx19(
|
|
11821
11927
|
TextFromNarration,
|
|
11822
11928
|
{
|
|
11823
11929
|
speech,
|
|
@@ -11827,27 +11933,27 @@ function DocBlocksShell({
|
|
|
11827
11933
|
onOpenSettings: openSettings
|
|
11828
11934
|
}
|
|
11829
11935
|
),
|
|
11830
|
-
hostSupports2("speechOutput") ? /* @__PURE__ */
|
|
11936
|
+
hostSupports2("speechOutput") ? /* @__PURE__ */ jsx19(
|
|
11831
11937
|
SpeechToolbarControl,
|
|
11832
11938
|
{
|
|
11833
11939
|
speech,
|
|
11834
11940
|
onOpenSettings: openSettings,
|
|
11835
11941
|
readOnly: selectedImage !== void 0 || selectedOutsideIn !== null && !selectedOutsideInEditingEnabled
|
|
11836
11942
|
}
|
|
11837
|
-
) : /* @__PURE__ */
|
|
11943
|
+
) : /* @__PURE__ */ jsx19(SpeechMenuBridge, {})
|
|
11838
11944
|
] }),
|
|
11839
|
-
canRestoreSplitView && /* @__PURE__ */
|
|
11945
|
+
canRestoreSplitView && /* @__PURE__ */ jsx19(
|
|
11840
11946
|
"button",
|
|
11841
11947
|
{
|
|
11842
11948
|
className: "db-restore-split",
|
|
11843
11949
|
onClick: () => updateSidebarPreference("pinned"),
|
|
11844
11950
|
"aria-label": "Restore split view",
|
|
11845
11951
|
title: "Restore split view",
|
|
11846
|
-
children: /* @__PURE__ */
|
|
11952
|
+
children: /* @__PURE__ */ jsx19(SplitViewIcon, {})
|
|
11847
11953
|
}
|
|
11848
11954
|
),
|
|
11849
|
-
git.repo && /* @__PURE__ */
|
|
11850
|
-
/* @__PURE__ */
|
|
11955
|
+
git.repo && /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(GitToolbarControl, { selectedFile }) }),
|
|
11956
|
+
/* @__PURE__ */ jsx19(
|
|
11851
11957
|
ExportToolbarControls,
|
|
11852
11958
|
{
|
|
11853
11959
|
selectedFile,
|
|
@@ -11871,39 +11977,39 @@ function DocBlocksShell({
|
|
|
11871
11977
|
}
|
|
11872
11978
|
)
|
|
11873
11979
|
}
|
|
11874
|
-
) }) : selectedFolder ? /* @__PURE__ */
|
|
11875
|
-
singlePane && /* @__PURE__ */
|
|
11876
|
-
/* @__PURE__ */
|
|
11980
|
+
) }) : selectedFolder ? /* @__PURE__ */ jsxs17("div", { className: "db-folder-view", children: [
|
|
11981
|
+
singlePane && /* @__PURE__ */ jsxs17("button", { className: "db-mobile-back", onClick: () => setMobileShowEditor(false), children: [
|
|
11982
|
+
/* @__PURE__ */ jsx19("span", { className: "db-mobile-files-icon", children: /* @__PURE__ */ jsx19(FolderGlyph, {}) }),
|
|
11877
11983
|
"Back to files"
|
|
11878
11984
|
] }),
|
|
11879
|
-
/* @__PURE__ */
|
|
11880
|
-
/* @__PURE__ */
|
|
11881
|
-
/* @__PURE__ */
|
|
11985
|
+
/* @__PURE__ */ jsxs17("div", { className: "db-folder-view-header", children: [
|
|
11986
|
+
/* @__PURE__ */ jsx19("span", { className: "db-folder-view-icon", children: /* @__PURE__ */ jsx19(FolderGlyph, {}) }),
|
|
11987
|
+
/* @__PURE__ */ jsx19("span", { className: "db-folder-view-path", children: selectedFolder })
|
|
11882
11988
|
] }),
|
|
11883
|
-
visibleFolderEntries.length === 0 ? /* @__PURE__ */
|
|
11989
|
+
visibleFolderEntries.length === 0 ? /* @__PURE__ */ jsx19("p", { className: "db-folder-view-empty", children: "This folder is empty." }) : /* @__PURE__ */ jsx19("ul", { className: "db-folder-view-list", children: visibleFolderEntries.map((entry) => /* @__PURE__ */ jsxs17(
|
|
11884
11990
|
"li",
|
|
11885
11991
|
{
|
|
11886
11992
|
className: "db-folder-view-item",
|
|
11887
11993
|
onClick: () => handleSelect(entry.path, entry.kind),
|
|
11888
11994
|
children: [
|
|
11889
|
-
/* @__PURE__ */
|
|
11995
|
+
/* @__PURE__ */ jsx19("span", { className: "db-folder-view-item-icon", children: entry.kind === "directory" ? /* @__PURE__ */ jsx19(FolderGlyph, {}) : /* @__PURE__ */ jsx19(FileGlyph, {}) }),
|
|
11890
11996
|
entry.name
|
|
11891
11997
|
]
|
|
11892
11998
|
},
|
|
11893
11999
|
entry.path
|
|
11894
12000
|
)) })
|
|
11895
|
-
] }) : /* @__PURE__ */
|
|
11896
|
-
singlePane && /* @__PURE__ */
|
|
11897
|
-
/* @__PURE__ */
|
|
12001
|
+
] }) : /* @__PURE__ */ jsxs17("div", { className: "db-shell-empty db-shell-empty--workspace", children: [
|
|
12002
|
+
singlePane && /* @__PURE__ */ jsxs17("button", { className: "db-mobile-back", onClick: () => setMobileShowEditor(false), children: [
|
|
12003
|
+
/* @__PURE__ */ jsx19("span", { className: "db-mobile-files-icon", children: /* @__PURE__ */ jsx19(FolderGlyph, {}) }),
|
|
11898
12004
|
"Back to files"
|
|
11899
12005
|
] }),
|
|
11900
|
-
/* @__PURE__ */
|
|
11901
|
-
/* @__PURE__ */
|
|
11902
|
-
/* @__PURE__ */
|
|
11903
|
-
/* @__PURE__ */
|
|
11904
|
-
/* @__PURE__ */
|
|
11905
|
-
/* @__PURE__ */
|
|
11906
|
-
/* @__PURE__ */
|
|
12006
|
+
/* @__PURE__ */ jsxs17("div", { className: "db-workspace-empty-content", children: [
|
|
12007
|
+
/* @__PURE__ */ jsx19("span", { className: "db-workspace-empty-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(FileGlyph, {}) }),
|
|
12008
|
+
/* @__PURE__ */ jsx19("h1", { children: activeWorkspaceDescriptor?.name ?? "Workspace" }),
|
|
12009
|
+
/* @__PURE__ */ jsx19("p", { children: "Choose a Markdown document from the sidebar, or create a new one." }),
|
|
12010
|
+
/* @__PURE__ */ jsxs17("div", { className: "db-workspace-empty-actions", children: [
|
|
12011
|
+
/* @__PURE__ */ jsx19("button", { type: "button", onClick: () => void handleNewFile(), children: "New document" }),
|
|
12012
|
+
/* @__PURE__ */ jsx19(
|
|
11907
12013
|
"button",
|
|
11908
12014
|
{
|
|
11909
12015
|
type: "button",
|
|
@@ -11912,7 +12018,7 @@ function DocBlocksShell({
|
|
|
11912
12018
|
children: "New folder"
|
|
11913
12019
|
}
|
|
11914
12020
|
),
|
|
11915
|
-
(hostSupports2("workspaceFolderPicker") || typeof globalThis.showDirectoryPicker === "function") && /* @__PURE__ */
|
|
12021
|
+
(hostSupports2("workspaceFolderPicker") || typeof globalThis.showDirectoryPicker === "function") && /* @__PURE__ */ jsx19(
|
|
11916
12022
|
"button",
|
|
11917
12023
|
{
|
|
11918
12024
|
type: "button",
|
|
@@ -11922,10 +12028,10 @@ function DocBlocksShell({
|
|
|
11922
12028
|
}
|
|
11923
12029
|
)
|
|
11924
12030
|
] }),
|
|
11925
|
-
/* @__PURE__ */
|
|
12031
|
+
showBrowserStorageWarning && /* @__PURE__ */ jsx19("p", { className: "db-workspace-empty-hint", children: "Use the sidebar backup action to keep a portable copy of this workspace." })
|
|
11926
12032
|
] })
|
|
11927
12033
|
] }),
|
|
11928
|
-
/* @__PURE__ */
|
|
12034
|
+
/* @__PURE__ */ jsx19(
|
|
11929
12035
|
UpdateAvailableNotice,
|
|
11930
12036
|
{
|
|
11931
12037
|
available: updateAvailable,
|
|
@@ -11935,7 +12041,7 @@ function DocBlocksShell({
|
|
|
11935
12041
|
}
|
|
11936
12042
|
)
|
|
11937
12043
|
] }),
|
|
11938
|
-
welcomeScreenShown && /* @__PURE__ */
|
|
12044
|
+
welcomeScreenShown && /* @__PURE__ */ jsx19(
|
|
11939
12045
|
WelcomeScreen,
|
|
11940
12046
|
{
|
|
11941
12047
|
onCreateDocument: handleNewFile,
|