@powerhousedao/connect 6.0.0-dev.135 → 6.0.0-dev.136
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/dist/{AddDriveModal-A2SuEFot.js → AddDriveModal-CT8C5KqN.js} +7 -7
- package/dist/AddDriveModal-CT8C5KqN.js.map +1 -0
- package/dist/{ClearStorageModal-BW6OgSQZ.js → ClearStorageModal-CGFmu0pv.js} +2 -2
- package/dist/{ClearStorageModal-BW6OgSQZ.js.map → ClearStorageModal-CGFmu0pv.js.map} +1 -1
- package/dist/{DebugSettingsModal-Ko7M_1hz.js → DebugSettingsModal-ZNWhlMQN.js} +3 -3
- package/dist/{DebugSettingsModal-Ko7M_1hz.js.map → DebugSettingsModal-ZNWhlMQN.js.map} +1 -1
- package/dist/{SettingsModal-Cic7jYhm.js → SettingsModal-PBE6DxKf.js} +3 -3
- package/dist/{SettingsModal-Cic7jYhm.js.map → SettingsModal-PBE6DxKf.js.map} +1 -1
- package/dist/{connect.config-CUbxYkCy.js → connect.config-DDu1QWU1.js} +3 -3
- package/dist/connect.config-DDu1QWU1.js.map +1 -0
- package/dist/{load-Cj671zwU.js → load-MLceYDvj.js} +4 -4
- package/dist/{load-Cj671zwU.js.map → load-MLceYDvj.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{package-J4OYYMmC.js → package-CXlSzdXy.js} +2 -2
- package/dist/package-CXlSzdXy.js.map +1 -0
- package/dist/{reactor-Be0fd4-f.js → reactor-XtvM2Ar4.js} +3 -3
- package/dist/{reactor-Be0fd4-f.js.map → reactor-XtvM2Ar4.js.map} +1 -1
- package/dist/{registerServiceWorker-fSbJUcrq.js → registerServiceWorker-19nMRUMW.js} +2 -2
- package/dist/{registerServiceWorker-fSbJUcrq.js.map → registerServiceWorker-19nMRUMW.js.map} +1 -1
- package/dist/{sidebar-DNioAbBU.js → sidebar-DFgKyko9.js} +182 -182
- package/dist/sidebar-DFgKyko9.js.map +1 -0
- package/dist/start-connect.js +1 -1
- package/package.json +9 -9
- package/dist/AddDriveModal-A2SuEFot.js.map +0 -1
- package/dist/connect.config-CUbxYkCy.js.map +0 -1
- package/dist/package-J4OYYMmC.js.map +0 -1
- package/dist/sidebar-DNioAbBU.js.map +0 -1
package/dist/{registerServiceWorker-fSbJUcrq.js.map → registerServiceWorker-19nMRUMW.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerServiceWorker-
|
|
1
|
+
{"version":3,"file":"registerServiceWorker-19nMRUMW.js","names":["#handleServiceWorkerMessage","#register","#handleServiceWorker"],"sources":["../src/utils/registerServiceWorker.ts"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\n\nconst basePath = connectConfig.routerBasename;\n\nconst serviceWorkerScriptPath = [basePath, \"service-worker.js\"]\n .join(\"/\")\n .replace(/\\/{2,}/gm, \"/\");\n\nclass ServiceWorkerManager {\n ready = false;\n debug = false;\n registration: ServiceWorkerRegistration | null = null;\n\n constructor(debug = false) {\n this.debug = debug;\n }\n\n setDebug(debug: boolean) {\n this.debug = debug;\n }\n\n #handleServiceWorkerMessage(\n event: MessageEvent<{\n type: \"NEW_VERSION_AVAILABLE\";\n version: string;\n requiresHardRefresh: boolean;\n }>,\n ) {\n if (this.debug) {\n console.log(\"ServiceWorker message: \", event);\n }\n const message = \"type\" in event.data ? event : null;\n switch (message?.data.type) {\n case \"NEW_VERSION_AVAILABLE\": {\n if (message.data.version === connectConfig.appVersion) {\n return;\n }\n if (message.data.requiresHardRefresh) {\n if (this.debug) {\n console.log(\"New version available\");\n }\n\n window.location.reload(); // Reload the page to load the new version\n }\n break;\n }\n default: {\n console.warn(\"Unhandled message:\", message);\n break;\n }\n }\n }\n\n #handleServiceWorker(registration: ServiceWorkerRegistration) {\n {\n // Listen for messages from the service worker\n if (this.debug) {\n console.log(\"ServiceWorker registered: \", registration);\n }\n\n navigator.serviceWorker.addEventListener(\n \"message\",\n this.#handleServiceWorkerMessage.bind(this),\n );\n\n this.registration = registration;\n this.ready = true;\n }\n }\n\n async #register() {\n try {\n // checks if there is a service worker installed already and calls\n // its the update method to check if there is a new version available\n const existingRegistration =\n await navigator.serviceWorker.getRegistration();\n if (existingRegistration) {\n await existingRegistration.update();\n this.#handleServiceWorker(existingRegistration);\n }\n\n // if no service worker is installed then registers the service worker\n else {\n const registration = await navigator.serviceWorker.register(\n serviceWorkerScriptPath,\n );\n this.#handleServiceWorker(registration);\n\n registration.addEventListener(\"updatefound\", () => {\n this.#handleServiceWorker(registration);\n });\n }\n\n // calls the update on an interval to force\n // the browser to check for a new version\n const intervalId = setInterval(async () => {\n const existingRegistration =\n await navigator.serviceWorker.getRegistration();\n if (existingRegistration) {\n await existingRegistration.update();\n } else {\n clearInterval(intervalId);\n this.registerServiceWorker();\n }\n }, connectConfig.appVersionCheckInterval);\n } catch (error) {\n console.error(\"ServiceWorker registration failed: \", error);\n }\n }\n\n registerServiceWorker(debug = false) {\n this.debug = debug;\n\n if (!(\"serviceWorker\" in navigator)) {\n console.warn(\"Service Worker not available\");\n return;\n }\n window.addEventListener(\"load\", () => {\n this.#register().catch(console.error);\n });\n }\n}\n\nexport const serviceWorkerManager = new ServiceWorkerManager();\n"],"mappings":";;AAIA,MAAM,0BAA0B,CAFf,cAAc,gBAEY,oBAAoB,CAC5D,KAAK,IAAI,CACT,QAAQ,YAAY,IAAI;AAE3B,IAAM,uBAAN,MAA2B;CACzB,QAAQ;CACR,QAAQ;CACR,eAAiD;CAEjD,YAAY,QAAQ,OAAO;AACzB,OAAK,QAAQ;;CAGf,SAAS,OAAgB;AACvB,OAAK,QAAQ;;CAGf,4BACE,OAKA;AACA,MAAI,KAAK,MACP,SAAQ,IAAI,2BAA2B,MAAM;EAE/C,MAAM,UAAU,UAAU,MAAM,OAAO,QAAQ;AAC/C,UAAQ,SAAS,KAAK,MAAtB;GACE,KAAK;AACH,QAAI,QAAQ,KAAK,YAAY,cAAc,WACzC;AAEF,QAAI,QAAQ,KAAK,qBAAqB;AACpC,SAAI,KAAK,MACP,SAAQ,IAAI,wBAAwB;AAGtC,YAAO,SAAS,QAAQ;;AAE1B;GAEF;AACE,YAAQ,KAAK,sBAAsB,QAAQ;AAC3C;;;CAKN,qBAAqB,cAAyC;AAG1D,MAAI,KAAK,MACP,SAAQ,IAAI,8BAA8B,aAAa;AAGzD,YAAU,cAAc,iBACtB,WACA,MAAA,2BAAiC,KAAK,KAAK,CAC5C;AAED,OAAK,eAAe;AACpB,OAAK,QAAQ;;CAIjB,OAAA,WAAkB;AAChB,MAAI;GAGF,MAAM,uBACJ,MAAM,UAAU,cAAc,iBAAiB;AACjD,OAAI,sBAAsB;AACxB,UAAM,qBAAqB,QAAQ;AACnC,UAAA,oBAA0B,qBAAqB;UAI5C;IACH,MAAM,eAAe,MAAM,UAAU,cAAc,SACjD,wBACD;AACD,UAAA,oBAA0B,aAAa;AAEvC,iBAAa,iBAAiB,qBAAqB;AACjD,WAAA,oBAA0B,aAAa;MACvC;;GAKJ,MAAM,aAAa,YAAY,YAAY;IACzC,MAAM,uBACJ,MAAM,UAAU,cAAc,iBAAiB;AACjD,QAAI,qBACF,OAAM,qBAAqB,QAAQ;SAC9B;AACL,mBAAc,WAAW;AACzB,UAAK,uBAAuB;;MAE7B,cAAc,wBAAwB;WAClC,OAAO;AACd,WAAQ,MAAM,uCAAuC,MAAM;;;CAI/D,sBAAsB,QAAQ,OAAO;AACnC,OAAK,QAAQ;AAEb,MAAI,EAAE,mBAAmB,YAAY;AACnC,WAAQ,KAAK,+BAA+B;AAC5C;;AAEF,SAAO,iBAAiB,cAAc;AACpC,SAAA,UAAgB,CAAC,MAAM,QAAQ,MAAM;IACrC;;;AAIN,MAAa,uBAAuB,IAAI,sBAAsB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { n as defaultPHAppConfig, r as defaultPHDocumentEditorConfig, t as connectConfig } from "./connect.config-DDu1QWU1.js";
|
|
2
2
|
import { t as toast$1 } from "./toast-iD-70hL8.js";
|
|
3
3
|
import { t as i18n } from "./i18n-Ch408v5-.js";
|
|
4
|
-
import { t as serviceWorkerManager } from "./registerServiceWorker-
|
|
5
|
-
import { addRemoteDrive, driveCollectionId, exportFile, getRevisionFromDate, logout, openRenown,
|
|
4
|
+
import { t as serviceWorkerManager } from "./registerServiceWorker-19nMRUMW.js";
|
|
5
|
+
import { addRemoteDrive, driveCollectionId, exportFile, getRevisionFromDate, logout, openRenown, setPHAppConfig, setPHDocumentEditorConfig, setRevisionHistoryVisible, setSelectedDrive, setSelectedNode, showPHModal, useAppModuleById, useDefaultAppModule, useDocumentById, useDocumentModelModuleById, useDocumentOperations, useDrives, useEditorModuleById, useFallbackEditorModule, useInspectorEnabled, useNodeParentFolderById, usePHModal, useReactorClient, useRevisionHistoryVisible, useSelectedDocument, useSelectedDocumentId, useSelectedDrive, useSelectedDriveSafe, useSelectedFolder, useSelectedTimelineItem, useSyncList, useUser, validateDocument } from "@powerhousedao/reactor-browser";
|
|
6
6
|
import { childLogger } from "document-model";
|
|
7
7
|
import React, { StrictMode, Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
8
8
|
import { AnimatedLoader, ConnectSidebar, ConnectTooltipProvider, CookieBanner, DefaultEditorLoader, DropZoneWrapper, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, RevisionHistory, SidebarAddDriveItem, SidebarItem, ToastContainer, WagmiContext } from "@powerhousedao/design-system/connect";
|
|
@@ -10,8 +10,8 @@ import { Trans, useTranslation } from "react-i18next";
|
|
|
10
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { Outlet, RouterProvider, createBrowserRouter, createRoutesFromChildren, matchRoutes, useLocation, useNavigate, useNavigationType, useParams } from "react-router-dom";
|
|
12
12
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
13
|
-
import { ErrorBoundary } from "react-error-boundary";
|
|
14
13
|
import { GenericDriveExplorer } from "@powerhousedao/powerhouse-vetra-packages/editors";
|
|
14
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
15
15
|
import { Icon, PowerhouseButton } from "@powerhousedao/design-system";
|
|
16
16
|
import { redo, undo } from "@powerhousedao/shared/document-model";
|
|
17
17
|
import { gql, request } from "graphql-request";
|
|
@@ -182,110 +182,52 @@ const Analytics = () => {
|
|
|
182
182
|
return null;
|
|
183
183
|
};
|
|
184
184
|
//#endregion
|
|
185
|
-
//#region src/
|
|
186
|
-
function
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
//#region src/components/document-editor-container.tsx
|
|
186
|
+
function DocumentEditorContainer() {
|
|
187
|
+
const [selectedDocument] = useSelectedDocument();
|
|
188
|
+
const parentFolder = useNodeParentFolderById(selectedDocument.header.id);
|
|
189
|
+
const onExport = useCallback(() => {
|
|
190
|
+
if (validateDocument(selectedDocument).length) showPHModal({
|
|
191
|
+
type: "exportDocumentWithErrors",
|
|
192
|
+
documentId: selectedDocument.header.id
|
|
193
|
+
});
|
|
194
|
+
else exportFile(selectedDocument).catch((error) => {
|
|
195
|
+
console.error(error);
|
|
196
|
+
toast$1(`Failed to export document: ${error instanceof Error ? error.message : JSON.stringify(error, null, 1)}`);
|
|
197
|
+
});
|
|
198
|
+
}, [selectedDocument]);
|
|
199
|
+
const onOpenSwitchboardLink = useMemo(() => {
|
|
200
|
+
return async () => {};
|
|
201
|
+
}, []);
|
|
202
|
+
const onClose = useCallback(() => {
|
|
203
|
+
setSelectedNode(parentFolder);
|
|
204
|
+
}, [parentFolder, setSelectedNode]);
|
|
205
|
+
return /* @__PURE__ */ jsx("div", {
|
|
206
|
+
id: "document-editor-container",
|
|
207
|
+
className: "flex-1",
|
|
208
|
+
"data-document-type": selectedDocument.header.documentType,
|
|
209
|
+
children: /* @__PURE__ */ jsx(DocumentEditor, {
|
|
210
|
+
document: selectedDocument,
|
|
211
|
+
onClose,
|
|
212
|
+
onExport,
|
|
213
|
+
onOpenSwitchboardLink
|
|
214
|
+
})
|
|
215
|
+
});
|
|
189
216
|
}
|
|
190
217
|
//#endregion
|
|
191
|
-
//#region src/
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
operations = [];
|
|
195
|
-
constructor(document) {
|
|
196
|
-
if (document) this.document = document;
|
|
197
|
-
}
|
|
198
|
-
operationsToTableObject(operations) {
|
|
199
|
-
return operations.map((op) => ({
|
|
200
|
-
...op,
|
|
201
|
-
input: JSON.stringify(op.action.input)
|
|
202
|
-
}));
|
|
203
|
-
}
|
|
204
|
-
setDocument(document) {
|
|
205
|
-
this.document = document;
|
|
206
|
-
}
|
|
207
|
-
getDocument() {
|
|
208
|
-
return this.document;
|
|
209
|
-
}
|
|
210
|
-
getOperations() {
|
|
211
|
-
return this.operations;
|
|
212
|
-
}
|
|
213
|
-
pushOperation(operation) {
|
|
214
|
-
this.operations.push(operation);
|
|
215
|
-
}
|
|
216
|
-
operationsTable() {
|
|
217
|
-
if (!this.document) console.warn("No document");
|
|
218
|
-
const ops = Object.values(this.document?.operations || {}).filter((array) => array !== void 0).flatMap((array) => array).sort((a, b) => a.index - b.index);
|
|
219
|
-
console.table(this.operationsToTableObject(ops));
|
|
220
|
-
}
|
|
221
|
-
scopeOperationsTable(scope) {
|
|
222
|
-
if (!this.document) console.warn("No document");
|
|
223
|
-
const ops = this.document?.operations[scope] || [];
|
|
224
|
-
console.table(this.operationsToTableObject(ops));
|
|
225
|
-
}
|
|
226
|
-
operationsLog() {
|
|
227
|
-
console.log(this.operations);
|
|
228
|
-
}
|
|
229
|
-
operationsLogTable() {
|
|
230
|
-
console.table(this.operationsToTableObject(this.operations));
|
|
231
|
-
}
|
|
232
|
-
clear() {
|
|
233
|
-
this.operations = [];
|
|
234
|
-
this.document = void 0;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
//#endregion
|
|
238
|
-
//#region src/components/app-skeleton.tsx
|
|
239
|
-
const LOADER_DELAY = 250;
|
|
240
|
-
const Loader = ({ delay = LOADER_DELAY }) => {
|
|
241
|
-
const isSSR = typeof window === "undefined";
|
|
242
|
-
const showInitialLoader = typeof document !== "undefined" && document.body.getAttribute("data-show-loader") === "true";
|
|
243
|
-
const [showLoading, setShowLoading] = useState(!delay || showInitialLoader);
|
|
218
|
+
//#region src/components/editor-loader.tsx
|
|
219
|
+
function EditorLoader(props) {
|
|
220
|
+
const [showLoading, setShowLoading] = useState(false);
|
|
244
221
|
useEffect(() => {
|
|
245
|
-
|
|
222
|
+
setTimeout(() => {
|
|
246
223
|
setShowLoading(true);
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
children: /* @__PURE__ */ jsx(AnimatedLoader, {})
|
|
255
|
-
}), isSSR ? /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `setTimeout(() => {
|
|
256
|
-
document.querySelector('.skeleton-loader')?.classList.remove('hidden');
|
|
257
|
-
document.body.setAttribute('data-show-loader', 'true');
|
|
258
|
-
}, ${delay})` } }) : null]
|
|
259
|
-
});
|
|
260
|
-
};
|
|
261
|
-
const AppSkeleton = () => {
|
|
262
|
-
const isSSR = typeof window === "undefined";
|
|
263
|
-
const isHomeScreen = !isSSR && window.location.pathname === getBasePath();
|
|
264
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
265
|
-
className: "flex h-screen",
|
|
266
|
-
children: [
|
|
267
|
-
/* @__PURE__ */ jsx(ConnectSidebar, {
|
|
268
|
-
className: "animate-pulse",
|
|
269
|
-
onLogin: void 0,
|
|
270
|
-
onDisconnect: void 0,
|
|
271
|
-
onClickSettings: void 0,
|
|
272
|
-
address: void 0
|
|
273
|
-
}),
|
|
274
|
-
/* @__PURE__ */ jsx(HomeScreen, {
|
|
275
|
-
containerClassName: isSSR || !isHomeScreen ? "hidden home-screen" : void 0,
|
|
276
|
-
children: null
|
|
277
|
-
}),
|
|
278
|
-
isSSR ? /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `
|
|
279
|
-
const baseEl = document.querySelector('base');
|
|
280
|
-
const href = baseEl?.getAttribute('href');
|
|
281
|
-
const basePath = href || '/';
|
|
282
|
-
if (window.location.pathname === basePath) {
|
|
283
|
-
document.querySelector('.home-screen')?.classList.remove('hidden')
|
|
284
|
-
}` } }) : null,
|
|
285
|
-
/* @__PURE__ */ jsx(Loader, {})
|
|
286
|
-
]
|
|
287
|
-
});
|
|
288
|
-
};
|
|
224
|
+
}, props.loadingTimeout ?? 200);
|
|
225
|
+
}, [props]);
|
|
226
|
+
if (!showLoading) return null;
|
|
227
|
+
const { customEditorLoader, ...defaultProps } = props;
|
|
228
|
+
if (customEditorLoader) return /* @__PURE__ */ jsx(Fragment, { children: customEditorLoader });
|
|
229
|
+
return /* @__PURE__ */ jsx(DefaultEditorLoader, { ...defaultProps });
|
|
230
|
+
}
|
|
289
231
|
//#endregion
|
|
290
232
|
//#region src/components/error-boundary.tsx
|
|
291
233
|
const logger$1 = childLogger(["Connect"]);
|
|
@@ -402,18 +344,145 @@ function ErrorBoundary$1(props) {
|
|
|
402
344
|
});
|
|
403
345
|
}
|
|
404
346
|
//#endregion
|
|
347
|
+
//#region src/components/app-container.tsx
|
|
348
|
+
function AppContainer() {
|
|
349
|
+
const [selectedDrive] = useSelectedDrive();
|
|
350
|
+
const selectedDocumentId = useSelectedDocumentId();
|
|
351
|
+
const app = useAppModuleById(selectedDrive.header.meta?.preferredEditor);
|
|
352
|
+
const defaultApp = useDefaultAppModule();
|
|
353
|
+
const AppComponent = app?.Component ?? defaultApp?.Component ?? GenericDriveExplorer.Component;
|
|
354
|
+
if (!AppComponent) throw new Error("No app component found");
|
|
355
|
+
return /* @__PURE__ */ jsx(ErrorBoundary$1, {
|
|
356
|
+
variant: "detailed",
|
|
357
|
+
resetKeys: [selectedDrive.header.id],
|
|
358
|
+
loggerContext: ["Connect", "App"],
|
|
359
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
360
|
+
fallback: /* @__PURE__ */ jsx(EditorLoader, {}),
|
|
361
|
+
children: /* @__PURE__ */ jsx(DropZoneWrapper, {
|
|
362
|
+
className: "flex h-full flex-col overflow-auto",
|
|
363
|
+
children: /* @__PURE__ */ jsx(AppComponent, { children: selectedDocumentId ? /* @__PURE__ */ jsx(DocumentEditorContainer, {}) : null })
|
|
364
|
+
})
|
|
365
|
+
})
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/utils/browser.ts
|
|
370
|
+
function getBasePath() {
|
|
371
|
+
if (typeof document === "undefined") return "/";
|
|
372
|
+
return document.querySelector("base")?.getAttribute("href") || "/";
|
|
373
|
+
}
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region src/utils/document-editor-debug-tools.ts
|
|
376
|
+
var DocumentEditorDebugTools = class {
|
|
377
|
+
document;
|
|
378
|
+
operations = [];
|
|
379
|
+
constructor(document) {
|
|
380
|
+
if (document) this.document = document;
|
|
381
|
+
}
|
|
382
|
+
operationsToTableObject(operations) {
|
|
383
|
+
return operations.map((op) => ({
|
|
384
|
+
...op,
|
|
385
|
+
input: JSON.stringify(op.action.input)
|
|
386
|
+
}));
|
|
387
|
+
}
|
|
388
|
+
setDocument(document) {
|
|
389
|
+
this.document = document;
|
|
390
|
+
}
|
|
391
|
+
getDocument() {
|
|
392
|
+
return this.document;
|
|
393
|
+
}
|
|
394
|
+
getOperations() {
|
|
395
|
+
return this.operations;
|
|
396
|
+
}
|
|
397
|
+
pushOperation(operation) {
|
|
398
|
+
this.operations.push(operation);
|
|
399
|
+
}
|
|
400
|
+
operationsTable() {
|
|
401
|
+
if (!this.document) console.warn("No document");
|
|
402
|
+
const ops = Object.values(this.document?.operations || {}).filter((array) => array !== void 0).flatMap((array) => array).sort((a, b) => a.index - b.index);
|
|
403
|
+
console.table(this.operationsToTableObject(ops));
|
|
404
|
+
}
|
|
405
|
+
scopeOperationsTable(scope) {
|
|
406
|
+
if (!this.document) console.warn("No document");
|
|
407
|
+
const ops = this.document?.operations[scope] || [];
|
|
408
|
+
console.table(this.operationsToTableObject(ops));
|
|
409
|
+
}
|
|
410
|
+
operationsLog() {
|
|
411
|
+
console.log(this.operations);
|
|
412
|
+
}
|
|
413
|
+
operationsLogTable() {
|
|
414
|
+
console.table(this.operationsToTableObject(this.operations));
|
|
415
|
+
}
|
|
416
|
+
clear() {
|
|
417
|
+
this.operations = [];
|
|
418
|
+
this.document = void 0;
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/components/app-skeleton.tsx
|
|
423
|
+
const LOADER_DELAY = 250;
|
|
424
|
+
const Loader = ({ delay = LOADER_DELAY }) => {
|
|
425
|
+
const isSSR = typeof window === "undefined";
|
|
426
|
+
const showInitialLoader = typeof document !== "undefined" && document.body.getAttribute("data-show-loader") === "true";
|
|
427
|
+
const [showLoading, setShowLoading] = useState(!delay || showInitialLoader);
|
|
428
|
+
useEffect(() => {
|
|
429
|
+
const id = setTimeout(() => {
|
|
430
|
+
setShowLoading(true);
|
|
431
|
+
}, delay);
|
|
432
|
+
return () => clearTimeout(id);
|
|
433
|
+
}, []);
|
|
434
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
435
|
+
className: `skeleton-loader absolute inset-0 z-10 flex items-center justify-center ${showLoading ? "" : "hidden"}`,
|
|
436
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
437
|
+
className: "animate-pulse overflow-hidden rounded-full shadow-lg",
|
|
438
|
+
children: /* @__PURE__ */ jsx(AnimatedLoader, {})
|
|
439
|
+
}), isSSR ? /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `setTimeout(() => {
|
|
440
|
+
document.querySelector('.skeleton-loader')?.classList.remove('hidden');
|
|
441
|
+
document.body.setAttribute('data-show-loader', 'true');
|
|
442
|
+
}, ${delay})` } }) : null]
|
|
443
|
+
});
|
|
444
|
+
};
|
|
445
|
+
const AppSkeleton = () => {
|
|
446
|
+
const isSSR = typeof window === "undefined";
|
|
447
|
+
const isHomeScreen = !isSSR && window.location.pathname === getBasePath();
|
|
448
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
449
|
+
className: "flex h-screen",
|
|
450
|
+
children: [
|
|
451
|
+
/* @__PURE__ */ jsx(ConnectSidebar, {
|
|
452
|
+
className: "animate-pulse",
|
|
453
|
+
onLogin: void 0,
|
|
454
|
+
onDisconnect: void 0,
|
|
455
|
+
onClickSettings: void 0,
|
|
456
|
+
address: void 0
|
|
457
|
+
}),
|
|
458
|
+
/* @__PURE__ */ jsx(HomeScreen, {
|
|
459
|
+
containerClassName: isSSR || !isHomeScreen ? "hidden home-screen" : void 0,
|
|
460
|
+
children: null
|
|
461
|
+
}),
|
|
462
|
+
isSSR ? /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `
|
|
463
|
+
const baseEl = document.querySelector('base');
|
|
464
|
+
const href = baseEl?.getAttribute('href');
|
|
465
|
+
const basePath = href || '/';
|
|
466
|
+
if (window.location.pathname === basePath) {
|
|
467
|
+
document.querySelector('.home-screen')?.classList.remove('hidden')
|
|
468
|
+
}` } }) : null,
|
|
469
|
+
/* @__PURE__ */ jsx(Loader, {})
|
|
470
|
+
]
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
//#endregion
|
|
405
474
|
//#region src/components/modal/modals-container.tsx
|
|
406
|
-
const AddDriveModal$1 = lazy(() => import("./AddDriveModal-
|
|
407
|
-
const ClearStorageModal = lazy(() => import("./ClearStorageModal-
|
|
475
|
+
const AddDriveModal$1 = lazy(() => import("./AddDriveModal-CT8C5KqN.js").then((m) => ({ default: m.AddDriveModal })));
|
|
476
|
+
const ClearStorageModal = lazy(() => import("./ClearStorageModal-CGFmu0pv.js").then((m) => ({ default: m.ClearStorageModal })));
|
|
408
477
|
const CookiesPolicyModal = lazy(() => import("./CookiesPolicyModal-Gae1QuhA.js").then((m) => ({ default: m.CookiesPolicyModal })));
|
|
409
478
|
const CreateDocumentModal$1 = lazy(() => import("./CreateDocumentModal-5i6rmv3C.js").then((m) => ({ default: m.CreateDocumentModal })));
|
|
410
|
-
const DebugSettingsModal = lazy(() => import("./DebugSettingsModal-
|
|
479
|
+
const DebugSettingsModal = lazy(() => import("./DebugSettingsModal-ZNWhlMQN.js").then((m) => ({ default: m.DebugSettingsModal })));
|
|
411
480
|
const DeleteDriveModal = lazy(() => import("./DeleteDriveModal-BbAx_yXt.js").then((m) => ({ default: m.DeleteDriveModal })));
|
|
412
481
|
const DeleteItemModal = lazy(() => import("./DeleteItemModal-CkWegLlh.js").then((m) => ({ default: m.DeleteItemModal })));
|
|
413
482
|
const DisclaimerModal = lazy(() => import("./DisclaimerModal-CCnvwoB5.js").then((m) => ({ default: m.DisclaimerModal })));
|
|
414
483
|
const DriveSettingsModal$1 = lazy(() => import("./DriveSettingsModal-DxMjOsLg.js").then((m) => ({ default: m.DriveSettingsModal })));
|
|
415
484
|
const ExportDocumentWithErrorsModal = lazy(() => import("./ExportDocumentWithErrorsModal-hgliF8Gy.js").then((m) => ({ default: m.ExportDocumentWithErrorsModal })));
|
|
416
|
-
const SettingsModal$1 = lazy(() => import("./SettingsModal-
|
|
485
|
+
const SettingsModal$1 = lazy(() => import("./SettingsModal-PBE6DxKf.js").then((m) => ({ default: m.SettingsModal })));
|
|
417
486
|
const UpgradeDriveModal = lazy(() => import("./UpgradeDriveModal-DldcNCaT.js").then((m) => ({ default: m.UpgradeDriveModal })));
|
|
418
487
|
const modalComponents = {
|
|
419
488
|
addDrive: AddDriveModal$1,
|
|
@@ -449,7 +518,7 @@ const ModalsContainer = lazy(async () => {
|
|
|
449
518
|
//#endregion
|
|
450
519
|
//#region src/components/app-loader.tsx
|
|
451
520
|
const AppLoader = (props) => {
|
|
452
|
-
const Load = lazy(() => import("./load-
|
|
521
|
+
const Load = lazy(() => import("./load-MLceYDvj.js").then((m) => m.loadComponent(props.localPackage)));
|
|
453
522
|
return /* @__PURE__ */ jsxs(StrictMode, { children: [
|
|
454
523
|
/* @__PURE__ */ jsx(Suspense, {
|
|
455
524
|
fallback: /* @__PURE__ */ jsx(AppSkeleton, {}),
|
|
@@ -560,75 +629,6 @@ const CookieBanner$1 = () => {
|
|
|
560
629
|
});
|
|
561
630
|
};
|
|
562
631
|
//#endregion
|
|
563
|
-
//#region src/components/document-editor-container.tsx
|
|
564
|
-
function DocumentEditorContainer() {
|
|
565
|
-
const [selectedDocument] = useSelectedDocument();
|
|
566
|
-
const parentFolder = useNodeParentFolderById(selectedDocument.header.id);
|
|
567
|
-
const onExport = useCallback(() => {
|
|
568
|
-
if (validateDocument(selectedDocument).length) showPHModal({
|
|
569
|
-
type: "exportDocumentWithErrors",
|
|
570
|
-
documentId: selectedDocument.header.id
|
|
571
|
-
});
|
|
572
|
-
else exportFile(selectedDocument).catch((error) => {
|
|
573
|
-
console.error(error);
|
|
574
|
-
toast$1(`Failed to export document: ${error instanceof Error ? error.message : JSON.stringify(error, null, 1)}`);
|
|
575
|
-
});
|
|
576
|
-
}, [selectedDocument]);
|
|
577
|
-
const onOpenSwitchboardLink = useMemo(() => {
|
|
578
|
-
return async () => {};
|
|
579
|
-
}, []);
|
|
580
|
-
const onClose = useCallback(() => {
|
|
581
|
-
setSelectedNode(parentFolder);
|
|
582
|
-
}, [parentFolder, setSelectedNode]);
|
|
583
|
-
return /* @__PURE__ */ jsx("div", {
|
|
584
|
-
id: "document-editor-container",
|
|
585
|
-
className: "flex-1",
|
|
586
|
-
"data-document-type": selectedDocument.header.documentType,
|
|
587
|
-
children: /* @__PURE__ */ jsx(DocumentEditor, {
|
|
588
|
-
document: selectedDocument,
|
|
589
|
-
onClose,
|
|
590
|
-
onExport,
|
|
591
|
-
onOpenSwitchboardLink
|
|
592
|
-
})
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
//#endregion
|
|
596
|
-
//#region src/components/editor-loader.tsx
|
|
597
|
-
function EditorLoader(props) {
|
|
598
|
-
const [showLoading, setShowLoading] = useState(false);
|
|
599
|
-
useEffect(() => {
|
|
600
|
-
setTimeout(() => {
|
|
601
|
-
setShowLoading(true);
|
|
602
|
-
}, props.loadingTimeout ?? 200);
|
|
603
|
-
}, [props]);
|
|
604
|
-
if (!showLoading) return null;
|
|
605
|
-
const { customEditorLoader, ...defaultProps } = props;
|
|
606
|
-
if (customEditorLoader) return /* @__PURE__ */ jsx(Fragment, { children: customEditorLoader });
|
|
607
|
-
return /* @__PURE__ */ jsx(DefaultEditorLoader, { ...defaultProps });
|
|
608
|
-
}
|
|
609
|
-
//#endregion
|
|
610
|
-
//#region src/components/drive-editor-container.tsx
|
|
611
|
-
function DriveEditorContainer() {
|
|
612
|
-
const [selectedDrive] = useSelectedDrive();
|
|
613
|
-
const selectedDocumentId = useSelectedDocumentId();
|
|
614
|
-
const driveEditor = useDriveEditorModuleById(selectedDrive.header.meta?.preferredEditor);
|
|
615
|
-
const defaultDriveEditor = useDefaultDriveEditorModule();
|
|
616
|
-
const DriveEditorComponent = driveEditor?.Component ?? defaultDriveEditor?.Component ?? GenericDriveExplorer.Component;
|
|
617
|
-
if (!DriveEditorComponent) throw new Error("No drive editor component found");
|
|
618
|
-
return /* @__PURE__ */ jsx(ErrorBoundary$1, {
|
|
619
|
-
variant: "detailed",
|
|
620
|
-
resetKeys: [selectedDrive.header.id],
|
|
621
|
-
loggerContext: ["Connect", "DriveEditor"],
|
|
622
|
-
children: /* @__PURE__ */ jsx(Suspense, {
|
|
623
|
-
fallback: /* @__PURE__ */ jsx(EditorLoader, {}),
|
|
624
|
-
children: /* @__PURE__ */ jsx(DropZoneWrapper, {
|
|
625
|
-
className: "flex h-full flex-col overflow-auto",
|
|
626
|
-
children: /* @__PURE__ */ jsx(DriveEditorComponent, { children: selectedDocumentId ? /* @__PURE__ */ jsx(DocumentEditorContainer, {}) : null })
|
|
627
|
-
})
|
|
628
|
-
})
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
//#endregion
|
|
632
632
|
//#region src/components/drive-icon.tsx
|
|
633
633
|
function DriveIcon({ drive }) {
|
|
634
634
|
const remotes = useSyncList();
|
|
@@ -819,9 +819,9 @@ function Content() {
|
|
|
819
819
|
if (!selectedDocumentId) setPHDocumentEditorConfig(defaultPHDocumentEditorConfig);
|
|
820
820
|
}, [selectedDocumentId]);
|
|
821
821
|
useEffect(() => {
|
|
822
|
-
if (!selectedDrive)
|
|
822
|
+
if (!selectedDrive) setPHAppConfig(defaultPHAppConfig);
|
|
823
823
|
}, [selectedDrive]);
|
|
824
|
-
return /* @__PURE__ */ jsx(ContentContainer, { children: !selectedDocumentId && !selectedDrive && !selectedFolder ? /* @__PURE__ */ jsx(HomeScreenContainer, {}) : /* @__PURE__ */ jsx(
|
|
824
|
+
return /* @__PURE__ */ jsx(ContentContainer, { children: !selectedDocumentId && !selectedDrive && !selectedFolder ? /* @__PURE__ */ jsx(HomeScreenContainer, {}) : /* @__PURE__ */ jsx(AppContainer, {}) });
|
|
825
825
|
}
|
|
826
826
|
function ContentContainer({ children }) {
|
|
827
827
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -831,7 +831,7 @@ function ContentContainer({ children }) {
|
|
|
831
831
|
});
|
|
832
832
|
}
|
|
833
833
|
function DriveItem({ drive }) {
|
|
834
|
-
const description =
|
|
834
|
+
const description = useAppModuleById(drive.header.meta?.preferredEditor)?.name || "Drive Explorer App";
|
|
835
835
|
return /* @__PURE__ */ jsx(HomeScreenItem, {
|
|
836
836
|
title: drive.state.global.name,
|
|
837
837
|
description,
|
|
@@ -1144,4 +1144,4 @@ function Sidebar() {
|
|
|
1144
1144
|
//#endregion
|
|
1145
1145
|
export { AppLoader as t };
|
|
1146
1146
|
|
|
1147
|
-
//# sourceMappingURL=sidebar-
|
|
1147
|
+
//# sourceMappingURL=sidebar-DFgKyko9.js.map
|