@powerhousedao/design-system 6.2.3-staging.0 → 6.3.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/dist/PinFilled-cSbUqZCA.js +41 -0
  2. package/dist/PinFilled-cSbUqZCA.js.map +1 -0
  3. package/dist/add-local-drive-form.impl-COIpcmgW.js +76 -0
  4. package/dist/add-local-drive-form.impl-COIpcmgW.js.map +1 -0
  5. package/dist/add-remote-drive-form.impl-_SqOzbSt.js +123 -0
  6. package/dist/add-remote-drive-form.impl-_SqOzbSt.js.map +1 -0
  7. package/dist/address-DVC3zalI.js +92 -0
  8. package/dist/address-DVC3zalI.js.map +1 -0
  9. package/dist/{checkbox-BmTXBcCE.d.ts → checkbox-BIAGwP7d.d.ts} +2 -2
  10. package/dist/{checkbox-BmTXBcCE.d.ts.map → checkbox-BIAGwP7d.d.ts.map} +1 -1
  11. package/dist/combobox.impl-CQHG0NgO.js +144 -0
  12. package/dist/combobox.impl-CQHG0NgO.js.map +1 -0
  13. package/dist/connect/components/toast/toast.js +2 -2
  14. package/dist/connect/index.d.ts +189 -35
  15. package/dist/connect/index.d.ts.map +1 -1
  16. package/dist/connect/index.js +542 -1648
  17. package/dist/connect/index.js.map +1 -1
  18. package/dist/{content-BMXLcwWY.d.ts → content-Cv0kRppo.d.ts} +2 -2
  19. package/dist/{content-BMXLcwWY.d.ts.map → content-Cv0kRppo.d.ts.map} +1 -1
  20. package/dist/default-editor.impl-a6EOuEme.js +30 -0
  21. package/dist/default-editor.impl-a6EOuEme.js.map +1 -0
  22. package/dist/document-timeline.impl-zx6f7k2d.js +254 -0
  23. package/dist/document-timeline.impl-zx6f7k2d.js.map +1 -0
  24. package/dist/drive-settings-form.impl-yV9u4h5c.js +172 -0
  25. package/dist/drive-settings-form.impl-yV9u4h5c.js.map +1 -0
  26. package/dist/{enum-field-qgV9wsyI.d.ts → enum-field-Cub1rt3e.d.ts} +3 -3
  27. package/dist/{enum-field-qgV9wsyI.d.ts.map → enum-field-Cub1rt3e.d.ts.map} +1 -1
  28. package/dist/formatted-json-viewer.impl-COERJCiE.js +58 -0
  29. package/dist/formatted-json-viewer.impl-COERJCiE.js.map +1 -0
  30. package/dist/icon-DQ2yrWYv.js +358 -0
  31. package/dist/icon-DQ2yrWYv.js.map +1 -0
  32. package/dist/{icon-01W_S_9A.js → icon-components-NK-y5dkv.js} +5 -479
  33. package/dist/icon-components-NK-y5dkv.js.map +1 -0
  34. package/dist/{id-autocomplete-CHvGhffo.d.ts → id-autocomplete-8LcmtjSR.d.ts} +2 -2
  35. package/dist/id-autocomplete-8LcmtjSR.d.ts.map +1 -0
  36. package/dist/{id-autocomplete-input-container-BqRQGpcs.d.ts → id-autocomplete-input-container-D2L7p-Yh.d.ts} +2 -2
  37. package/dist/{id-autocomplete-input-container-BqRQGpcs.d.ts.map → id-autocomplete-input-container-D2L7p-Yh.d.ts.map} +1 -1
  38. package/dist/{id-autocomplete-list-ChQsiJDg.d.ts → id-autocomplete-list-BXvN07Hr.d.ts} +2 -2
  39. package/dist/{id-autocomplete-list-ChQsiJDg.d.ts.map → id-autocomplete-list-BXvN07Hr.d.ts.map} +1 -1
  40. package/dist/{id-autocomplete-list-option-MsqKeLXD.d.ts → id-autocomplete-list-option-D_1BOv50.d.ts} +3 -2
  41. package/dist/id-autocomplete-list-option-D_1BOv50.d.ts.map +1 -0
  42. package/dist/{index-C05uhexJ.d.ts → index-5FEr1tXH.d.ts} +12 -15
  43. package/dist/index-5FEr1tXH.d.ts.map +1 -0
  44. package/dist/index-C-Tup7Br.d.ts +4 -0
  45. package/dist/index-i-xHUsLr.d.ts +30 -0
  46. package/dist/index-jfVVOU-H.d.ts +2 -0
  47. package/dist/index.d.ts +2 -1
  48. package/dist/index.js +2 -2
  49. package/dist/label-nH2HoKfI.js +15 -0
  50. package/dist/label-nH2HoKfI.js.map +1 -0
  51. package/dist/location-info-C3YbSsV0.js +47 -0
  52. package/dist/location-info-C3YbSsV0.js.map +1 -0
  53. package/dist/{radio-group-field-CjX_Zt0C.d.ts → radio-group-field-X18o287K.d.ts} +2 -2
  54. package/dist/{radio-group-field-CjX_Zt0C.d.ts.map → radio-group-field-X18o287K.d.ts.map} +1 -1
  55. package/dist/revision-history.impl-DRbeai2m.js +642 -0
  56. package/dist/revision-history.impl-DRbeai2m.js.map +1 -0
  57. package/dist/{select-field-BuXjM43L.d.ts → select-field-DHaCiAso.d.ts} +2 -2
  58. package/dist/{select-field-BuXjM43L.d.ts.map → select-field-DHaCiAso.d.ts.map} +1 -1
  59. package/dist/{selected-content-C49jmTLU.d.ts → selected-content-CSTFkQr9.d.ts} +2 -2
  60. package/dist/{selected-content-C49jmTLU.d.ts.map → selected-content-CSTFkQr9.d.ts.map} +1 -1
  61. package/dist/{sidebar-4juLhREX.d.ts → sidebar-DFqreKf1.d.ts} +2 -2
  62. package/dist/{sidebar-4juLhREX.d.ts.map → sidebar-DFqreKf1.d.ts.map} +1 -1
  63. package/dist/{sidebar-provider-CMG6WQWo.d.ts → sidebar-provider-CZHhqW5n.d.ts} +2 -2
  64. package/dist/{sidebar-provider-CMG6WQWo.d.ts.map → sidebar-provider-CZHhqW5n.d.ts.map} +1 -1
  65. package/dist/{splitted-input-diff-DBkgDh9Q.d.ts → splitted-input-diff-DNKcSOAB.d.ts} +2 -2
  66. package/dist/{splitted-input-diff-DBkgDh9Q.d.ts.map → splitted-input-diff-DNKcSOAB.d.ts.map} +1 -1
  67. package/dist/{src-CrUksCLW.js → src-DhSJCeu5.js} +165 -12
  68. package/dist/src-DhSJCeu5.js.map +1 -0
  69. package/dist/style.css +144 -62
  70. package/dist/{text-field-3j4fLJ-7.d.ts → text-field-Dq1DTC_t.d.ts} +3 -3
  71. package/dist/{text-field-3j4fLJ-7.d.ts.map → text-field-Dq1DTC_t.d.ts.map} +1 -1
  72. package/dist/{text-input-tkqggbWx.d.ts → text-input-CRjOT54_.d.ts} +2 -2
  73. package/dist/{text-input-tkqggbWx.d.ts.map → text-input-CRjOT54_.d.ts.map} +1 -1
  74. package/dist/{text-input-diff-B7iFyzTK.d.ts → text-input-diff-CcF0QblL.d.ts} +2 -2
  75. package/dist/{text-input-diff-B7iFyzTK.d.ts.map → text-input-diff-CcF0QblL.d.ts.map} +1 -1
  76. package/dist/{types-DDSmPhHp.d.ts → types-FTqFl5du.d.ts} +2 -2
  77. package/dist/{types-DDSmPhHp.d.ts.map → types-FTqFl5du.d.ts.map} +1 -1
  78. package/dist/types-TZijOYrE.d.ts +17 -0
  79. package/dist/types-TZijOYrE.d.ts.map +1 -0
  80. package/dist/ui/components/checkbox/checkbox.d.ts +1 -1
  81. package/dist/ui/components/command/command.js +1 -1
  82. package/dist/ui/components/enum-field/enum-field.d.ts +1 -1
  83. package/dist/ui/components/enum-field/types.d.ts +1 -1
  84. package/dist/ui/components/form-label/form-label.js +1 -1
  85. package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.d.ts +1 -1
  86. package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.js +1 -1
  87. package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.d.ts +1 -1
  88. package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.js +1 -1
  89. package/dist/ui/components/id-autocomplete/id-autocomplete-list.d.ts +1 -1
  90. package/dist/ui/components/id-autocomplete/id-autocomplete.d.ts +1 -1
  91. package/dist/ui/components/id-autocomplete/types.d.ts +1 -1
  92. package/dist/ui/components/id-autocomplete/use-id-autocomplete.d.ts +1 -1
  93. package/dist/ui/components/index.d.ts +20 -20
  94. package/dist/ui/components/input/splitted-input-diff.d.ts +1 -1
  95. package/dist/ui/components/input/splitted-input-diff.js +1 -1
  96. package/dist/ui/components/input/subcomponent/text-diff.d.ts +1 -1
  97. package/dist/ui/components/radio-group-field/radio-group-field.d.ts +1 -1
  98. package/dist/ui/components/select-field/content.d.ts +1 -1
  99. package/dist/ui/components/select-field/content.js +1 -1
  100. package/dist/ui/components/select-field/select-field.d.ts +1 -1
  101. package/dist/ui/components/select-field/selected-content.d.ts +1 -1
  102. package/dist/ui/components/select-field/selected-content.js +1 -1
  103. package/dist/ui/components/select-field/subcomponents/CommandItemList.d.ts +1 -1
  104. package/dist/ui/components/select-field/subcomponents/CommandItemList.js +1 -1
  105. package/dist/ui/components/select-field/use-select-field.d.ts +1 -1
  106. package/dist/ui/components/sidebar/index.d.ts +4 -4
  107. package/dist/ui/components/sidebar/sidebar.d.ts +1 -1
  108. package/dist/ui/components/sidebar/sidebar.js +1 -1
  109. package/dist/ui/components/sidebar/subcomponents/sidebar-content-area.js +1 -1
  110. package/dist/ui/components/sidebar/subcomponents/sidebar-item.d.ts +1 -1
  111. package/dist/ui/components/sidebar/subcomponents/sidebar-item.js +2 -1
  112. package/dist/ui/components/sidebar/subcomponents/sidebar-item.js.map +1 -1
  113. package/dist/ui/components/sidebar/subcomponents/sidebar-provider/index.d.ts +2 -2
  114. package/dist/ui/components/sidebar/subcomponents/sidebar-provider/sidebar-provider.d.ts +1 -1
  115. package/dist/ui/components/sidebar/subcomponents/sidebar-provider/sidebar-reducer.d.ts +1 -1
  116. package/dist/ui/components/sidebar/subcomponents/sidebar-search/sidebar-search.js +1 -1
  117. package/dist/ui/components/sidebar/subcomponents/status-icon.d.ts +1 -1
  118. package/dist/ui/components/sidebar/subcomponents/status-icon.js +1 -1
  119. package/dist/ui/components/sidebar/types.d.ts +1 -1
  120. package/dist/ui/components/sidebar/utils.d.ts +1 -1
  121. package/dist/ui/components/text-field/text-field.d.ts +1 -1
  122. package/dist/ui/components/text-input/text-input-diff.d.ts +1 -1
  123. package/dist/ui/components/text-input/text-input.d.ts +1 -1
  124. package/dist/ui/components/types.d.ts +1 -1
  125. package/dist/ui/components/value-transformer/value-transformer.d.ts +1 -1
  126. package/dist/ui/components/with-field-validation/with-field-validation.d.ts +1 -1
  127. package/dist/ui/index.d.ts +21 -21
  128. package/dist/ui/types.d.ts +1 -1
  129. package/dist/{use-id-autocomplete-wdw3CfYc.d.ts → use-id-autocomplete-m9Bf0qCy.d.ts} +2 -2
  130. package/dist/{use-id-autocomplete-wdw3CfYc.d.ts.map → use-id-autocomplete-m9Bf0qCy.d.ts.map} +1 -1
  131. package/dist/{value-transformer-BAD6r8Ol.d.ts → value-transformer-BtUh3-UP.d.ts} +2 -2
  132. package/dist/{value-transformer-BAD6r8Ol.d.ts.map → value-transformer-BtUh3-UP.d.ts.map} +1 -1
  133. package/dist/{with-field-validation-Bt02MQn2.d.ts → with-field-validation-Bh26a6fr.d.ts} +2 -2
  134. package/dist/{with-field-validation-Bt02MQn2.d.ts.map → with-field-validation-Bh26a6fr.d.ts.map} +1 -1
  135. package/package.json +14 -8
  136. package/plugins.css +6 -0
  137. package/tailwind.css +213 -0
  138. package/vendor.css +3 -0
  139. package/dist/icon-01W_S_9A.js.map +0 -1
  140. package/dist/id-autocomplete-CHvGhffo.d.ts.map +0 -1
  141. package/dist/id-autocomplete-list-option-MsqKeLXD.d.ts.map +0 -1
  142. package/dist/index-C05uhexJ.d.ts.map +0 -1
  143. package/dist/index-CpSqVZKp.d.ts +0 -2
  144. package/dist/index-DSknqh8u.d.ts +0 -30
  145. package/dist/index-DU-WgcAh.d.ts +0 -4
  146. package/dist/index-DaRBrjZI.d.ts +0 -3
  147. package/dist/src-CrUksCLW.js.map +0 -1
@@ -1,31 +1,27 @@
1
- import { _ as DropdownMenuTrigger, c as SidebarHeader, d as PackageAnimation, f as Modal, h as DropdownMenuItem, l as SidebarPanel, m as DropdownMenuContent, n as usePagination, o as Sidebar, p as DropdownMenu, s as SidebarFooter, u as Pagination, v as PowerhouseButton } from "../src-CrUksCLW.js";
2
- import { n as getDimensions, t as Icon } from "../icon-01W_S_9A.js";
1
+ import { _ as DropdownMenuItem, b as PowerhouseButton, c as SidebarHeader, d as PackageAnimation, f as Modal, g as DropdownMenuContent, h as DropdownMenu, l as SidebarPanel, o as Sidebar, s as SidebarFooter, t as useWindowSize, y as DropdownMenuTrigger } from "../src-DhSJCeu5.js";
2
+ import { n as getDimensions, t as Icon } from "../icon-DQ2yrWYv.js";
3
+ import { Checkbox } from "../ui/components/checkbox/checkbox.js";
3
4
  import { Popover, PopoverContent, PopoverTrigger } from "../ui/components/popover/popover.js";
4
- import { SelectFieldRaw } from "../ui/components/select-field/select-field.js";
5
5
  import { Input } from "../ui/components/input/input.js";
6
6
  import { JsonViewer } from "../ui/components/json-viewer/json-viewer.js";
7
- import React, { Fragment, createElement, forwardRef, memo, useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
7
+ import "../ui/index.js";
8
+ import { a as lazyComponent, i as ENSAvatar, n as useEns, r as FormattedJsonViewer, t as formatEthAddress } from "../address-DVC3zalI.js";
9
+ import { t as Label } from "../label-nH2HoKfI.js";
10
+ import React, { Fragment, createContext, createElement, forwardRef, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
8
11
  import { twJoin, twMerge } from "tailwind-merge";
9
12
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
13
  import { Content, Portal, Provider, Root, Trigger } from "@radix-ui/react-tooltip";
11
- import { Controller, useForm } from "react-hook-form";
12
- import { Anchor, Content as Content$1, Portal as Portal$1, Root as Root$1, Trigger as Trigger$1 } from "@radix-ui/react-popover";
13
- import { format, formatDistanceToNow, parseISO } from "date-fns";
14
- import { useCopyToClipboard, useDebounceValue, useEventListener, useOnClickOutside } from "usehooks-ts";
14
+ import { useEventListener, useOnClickOutside } from "usehooks-ts";
15
15
  import { Loader2, Mail, Monitor, Moon, Settings, Smartphone, Sun, Wallet } from "lucide-react";
16
- import { SyncOperationStatus, addFolder, getSyncStatusSync, preloadEditorModule, setSelectedDrive, setSelectedNode, showDeleteNodeModal, showPHModal, showRevisionHistory, useDocumentById, useDocumentVersionStatus, useDownloadDocument, useDownloadFolder, useDragNode, useDropFile, useDropNode, useEditorModulesForDocumentType, useGetSwitchboardLink, useIsDragAndDropEnabled, useNodeActions, useNodeById, useNodeParentFolderById, useOnDropFile, useSelectedDocumentSafe, useSelectedDriveId, useSelectedDriveSafe, useSelectedNodePath, useTheme, useUserPermissions } from "@powerhousedao/reactor-browser";
17
- import Select, { components } from "react-select";
18
- import { Content as Content$2, List, Root as Root$2, Trigger as Trigger$2 } from "@radix-ui/react-tabs";
19
- import { addProp, defaultTo, entries, filter, funnel, hasAtLeast, isArray, isDefined, isIncludedIn, isStrictEqual, isString, isTruthy, keys, map, pipe, prop, values } from "remeda";
20
- import { garbageCollect, redo, sortOperations, undo } from "@powerhousedao/shared/document-model";
16
+ import { SyncOperationStatus, addFolder, getNodeTarget, getSyncStatusSync, isPlainClick, makeDriveSlug, preloadEditorModule, showDeleteNodeModal, showPHModal, showRevisionHistory, useCloseNode, useDocumentById, useDocumentVersionStatus, useDownloadDocument, useDownloadFolder, useDragNode, useDriveContext, useDropFile, useDropNode, useEditorModulesForDocumentType, useGetSwitchboardLink, useIsDragAndDropEnabled, useLinkProps, useNodeActions, useNodeById, useNodeTarget, useOnDropFile, usePHNavigation, usePreloadNode, useReactorClient, useSelectedDocumentSafe, useSelectedDriveId, useSelectedDriveSafe, useSelectedNodePath, useSetSelectedDrive, useSetSelectedNode, useTheme, useUserPermissions } from "@powerhousedao/reactor-browser";
17
+ import { Content as Content$1, List, Root as Root$1, Trigger as Trigger$1 } from "@radix-ui/react-tabs";
18
+ import { addProp, defaultTo, entries, filter, hasAtLeast, isArray, isDefined, isIncludedIn, isTruthy, keys, map, pipe, prop, values } from "remeda";
19
+ import { redo, undo, undoCapabilitiesOf } from "@powerhousedao/shared/document-model";
21
20
  import { RenownLogo } from "@powerhousedao/reactor-browser/renown";
22
- import { JsonView } from "@uiw/react-json-view";
23
- import { darkTheme } from "@uiw/react-json-view/dark";
24
- import { lightTheme } from "@uiw/react-json-view/light";
21
+ import { colorVariants, imageVariants, layerStyle, normalizeBackground } from "@powerhousedao/shared/connect";
25
22
  import { isValidName } from "@powerhousedao/shared/document-drive";
26
23
  import { capitalCase } from "change-case";
27
24
  import { getUpdateTarget, parseInstallSpec } from "@powerhousedao/shared/registry/updates";
28
- import { useVirtualizer } from "@tanstack/react-virtual";
29
25
  //#region src/connect/components/account-popover/account-popover.tsx
30
26
  const AccountPopover = ({ children, content, open, onOpenChange }) => {
31
27
  return /* @__PURE__ */ jsxs(Popover, {
@@ -245,6 +241,9 @@ function Breadcrumbs() {
245
241
  const selectedDriveId = useSelectedDriveId();
246
242
  const selectedNodePath = useSelectedNodePath();
247
243
  const [isCreating, setIsCreating] = useState(false);
244
+ const driveContext = useDriveContext();
245
+ const setSelectedDrive = useSetSelectedDrive();
246
+ const setSelectedNode = useSetSelectedNode();
248
247
  function onAddNew() {
249
248
  setIsCreating(true);
250
249
  }
@@ -261,6 +260,7 @@ function Breadcrumbs() {
261
260
  function onCancel() {
262
261
  setIsCreating(false);
263
262
  }
263
+ const driveTarget = selectedDrive ? { driveSlug: makeDriveSlug(selectedDrive) } : void 0;
264
264
  const hasSelectedDrive = !!selectedDrive;
265
265
  const hasNodePath = !!selectedNodePath.length;
266
266
  return /* @__PURE__ */ jsxs("div", {
@@ -282,6 +282,7 @@ function Breadcrumbs() {
282
282
  id: selectedDriveId,
283
283
  parentId: void 0,
284
284
  name: selectedDrive.state.global.name || selectedDrive.header.name,
285
+ target: driveTarget,
285
286
  onClick: () => setSelectedDrive(selectedDrive)
286
287
  }),
287
288
  /* @__PURE__ */ jsx("span", { children: "/" })
@@ -290,6 +291,7 @@ function Breadcrumbs() {
290
291
  id: node.id,
291
292
  parentId: node.parentFolder,
292
293
  name: node.name,
294
+ target: getNodeTarget(node, driveContext?.drive),
293
295
  onClick: () => setSelectedNode(node)
294
296
  }), /* @__PURE__ */ jsx("span", { children: "/" })] }, node.id)),
295
297
  isAllowedToCreateDocuments && (isCreating ? /* @__PURE__ */ jsx(NodeInput, {
@@ -311,19 +313,45 @@ function Breadcrumbs() {
311
313
  });
312
314
  }
313
315
  function Breadcrumb(props) {
314
- const { name, id, parentId, onClick } = props;
316
+ const { name, id, parentId, target, onClick } = props;
317
+ const navigation = usePHNavigation();
318
+ const isCurrent = navigation.useIsCurrent?.(target) ?? false;
319
+ const href = props.href ?? (target ? navigation.hrefFor?.(target) : void 0);
315
320
  const { isDragging, ...dragProps } = useDragNode({
316
321
  srcId: id,
317
322
  parentId: parentId ?? void 0
318
323
  });
319
324
  const { isDropTarget, ...dropProps } = useDropNode(id);
320
325
  const containerStyles = twMerge("cursor-pointer transition-colors last-of-type:text-foreground hover:hover-effect", isDragging ? "opacity-60" : isDropTarget ? "bg-info/10" : "");
326
+ if (href) {
327
+ const onLinkClick = (event) => {
328
+ if (!isPlainClick(event)) return;
329
+ event.preventDefault();
330
+ onClick();
331
+ };
332
+ return /* @__PURE__ */ jsx("a", {
333
+ ...dragProps,
334
+ ...dropProps,
335
+ href,
336
+ "aria-current": target && isCurrent ? "page" : void 0,
337
+ className: containerStyles,
338
+ onClick: onLinkClick,
339
+ children: name
340
+ });
341
+ }
342
+ const onKeyDown = (event) => {
343
+ if (event.key !== "Enter" && event.key !== " ") return;
344
+ event.preventDefault();
345
+ onClick();
346
+ };
321
347
  return /* @__PURE__ */ jsx("div", {
322
348
  ...dragProps,
323
349
  ...dropProps,
324
350
  className: containerStyles,
325
351
  onClick,
352
+ onKeyDown,
326
353
  role: "button",
354
+ tabIndex: 0,
327
355
  children: name
328
356
  });
329
357
  }
@@ -640,141 +668,7 @@ function CatchUpInspector({ status, onRefresh, onSweepNow }) {
640
668
  }
641
669
  //#endregion
642
670
  //#region src/connect/components/combobox/combobox.tsx
643
- function DropdownIndicator(props) {
644
- return /* @__PURE__ */ jsx(components.DropdownIndicator, {
645
- ...props,
646
- children: /* @__PURE__ */ jsx(Icon, {
647
- name: "ChevronDown",
648
- size: 16
649
- })
650
- });
651
- }
652
- function ClearIndicator(props) {
653
- return /* @__PURE__ */ jsx(components.ClearIndicator, {
654
- ...props,
655
- children: /* @__PURE__ */ jsx(Icon, {
656
- name: "Xmark",
657
- size: 16
658
- })
659
- });
660
- }
661
- function MenuList(props) {
662
- const { label, onClick, ...rest } = props;
663
- const hasAddItemButton = !!label && !!onClick;
664
- return /* @__PURE__ */ jsxs(components.MenuList, {
665
- ...rest,
666
- children: [props.children, hasAddItemButton ? /* @__PURE__ */ jsx("button", {
667
- className: "w-full px-2 py-3 hover:hover-effect",
668
- onClick,
669
- children: label
670
- }) : null]
671
- });
672
- }
673
- function Combobox(props) {
674
- const invalid = props["aria-invalid"] === "true";
675
- const { addItemButtonProps, ...rest } = props;
676
- const { theme } = useTheme();
677
- const dark = theme === "dark";
678
- return /* @__PURE__ */ jsx(Select, {
679
- ...rest,
680
- components: {
681
- DropdownIndicator,
682
- ClearIndicator,
683
- MenuList: (menuListProps) => MenuList({
684
- ...menuListProps,
685
- ...addItemButtonProps
686
- })
687
- },
688
- classNames: { menuList: () => "scrollbar-thin scrollbar-track-transparent scrollbar-thumb-rounded-md scrollbar-thumb-border" },
689
- styles: {
690
- dropdownIndicator: () => {
691
- return {
692
- label: "indicatorContainer",
693
- display: "flex",
694
- transition: "color 150ms",
695
- color: dark ? "var(--color-slate-50)" : "var(--color-gray-900)",
696
- padding: 8,
697
- boxSizing: "border-box"
698
- };
699
- },
700
- clearIndicator: (baseStyles) => {
701
- return {
702
- ...baseStyles,
703
- color: dark ? "var(--color-slate-50)" : "var(--color-gray-900)"
704
- };
705
- },
706
- container: (baseStyles) => {
707
- return {
708
- ...baseStyles,
709
- borderColor: dark ? "var(--color-slate-700)" : "var(--color-gray-200)",
710
- fontSize: 12
711
- };
712
- },
713
- placeholder: (baseStyles) => {
714
- return {
715
- ...baseStyles,
716
- color: invalid ? dark ? "var(--color-red-400)" : "var(--color-red-900)" : dark ? "var(--color-slate-100)" : "var(--color-gray-500)"
717
- };
718
- },
719
- control: () => {
720
- return {
721
- label: "control",
722
- alignItems: "center",
723
- cursor: "default",
724
- display: "flex",
725
- flexWrap: "wrap",
726
- justifyContent: "space-between",
727
- minHeight: 32,
728
- outline: "0 !important",
729
- position: "relative",
730
- transition: "all 100ms",
731
- backgroundColor: dark ? "var(--color-slate-800)" : "var(--color-white)",
732
- borderColor: invalid ? dark ? "var(--color-red-400)" : "var(--color-red-900)" : dark ? "var(--color-slate-600)" : "var(--color-gray-200)",
733
- borderStyle: "solid",
734
- borderWidth: 1,
735
- borderRadius: "6px",
736
- boxSizing: "border-box"
737
- };
738
- },
739
- option: (baseStyles, state) => {
740
- return {
741
- ...baseStyles,
742
- backgroundColor: state.isSelected ? dark ? "var(--color-slate-700)" : "var(--color-slate-50)" : dark ? "var(--color-slate-800)" : "var(--color-white)",
743
- color: dark ? "var(--color-slate-50)" : "var(--color-gray-800)",
744
- ":hover": { backgroundColor: dark ? "var(--color-slate-700)" : "var(--color-slate-50)" }
745
- };
746
- },
747
- menuList: (baseStyles) => ({
748
- ...baseStyles,
749
- padding: 0,
750
- borderRadius: "6px"
751
- })
752
- },
753
- theme: (theme) => ({
754
- ...theme,
755
- colors: {
756
- ...theme.colors,
757
- primary: dark ? "var(--color-slate-700)" : "var(--color-slate-100)",
758
- primary25: dark ? "var(--color-slate-800)" : "var(--color-slate-50)",
759
- primary50: dark ? "var(--color-slate-700)" : "var(--color-slate-100)",
760
- primary75: dark ? "var(--color-slate-700)" : "var(--color-slate-100)",
761
- danger: dark ? "var(--color-red-400)" : "var(--color-red-900)",
762
- dangerLight: dark ? "var(--color-red-900)" : "var(--color-red-100)",
763
- neutral0: dark ? "var(--color-slate-800)" : "var(--color-white)",
764
- neutral5: dark ? "var(--color-slate-800)" : "var(--color-gray-50)",
765
- neutral10: dark ? "var(--color-slate-700)" : "var(--color-gray-100)",
766
- neutral20: dark ? "var(--color-slate-600)" : "var(--color-gray-200)",
767
- neutral30: dark ? "var(--color-slate-600)" : "var(--color-gray-300)",
768
- neutral40: dark ? "var(--color-slate-400)" : "var(--color-gray-400)",
769
- neutral50: dark ? "var(--color-slate-300)" : "var(--color-gray-500)",
770
- neutral60: dark ? "var(--color-slate-200)" : "var(--color-gray-600)",
771
- neutral70: dark ? "var(--color-slate-100)" : "var(--color-gray-700)",
772
- neutral80: dark ? "var(--color-slate-50)" : "var(--color-gray-800)",
773
- neutral90: dark ? "var(--color-slate-50)" : "var(--color-gray-900)"
774
- }
775
- })
776
- });
777
- }
671
+ const Combobox = lazyComponent(() => import("../combobox.impl-CQHG0NgO.js").then((m) => m.Combobox));
778
672
  //#endregion
779
673
  //#region src/connect/components/consent-banner/consent-banner.tsx
780
674
  const CookieBanner = (props) => {
@@ -1966,7 +1860,63 @@ const PATHS = {
1966
1860
  b9: "M18.0156 9.8918C18.0156 9.61566 18.2394 9.39181 18.5155 9.39181L43.0627 9.39138C44.9475 11.8519 46.3659 14.6855 47.1892 17.7635L18.5154 17.7641C18.2392 17.7641 18.0154 17.5402 18.0154 17.2641L18.0156 9.8918Z",
1967
1861
  b10: "M25.0158 -2.51999e-05C31.418 0.265176 37.1737 3.03916 41.3227 7.36511L25.5156 7.36547C25.2395 7.36547 25.0156 7.14161 25.0156 6.86546L25.0158 -2.51999e-05Z"
1968
1862
  };
1863
+ /** A project's loading image, declared by the build as
1864
+ * `<meta name="ph-loader" content="<file>" data-animation data-size>`
1865
+ * (powerhouse.config.json `icons.loader`). */
1866
+ const LOADER_MOTION = {
1867
+ pulse: "ph-loader-pulse 1.6s ease-in-out infinite",
1868
+ spin: "ph-loader-spin 1.4s linear infinite",
1869
+ none: "none"
1870
+ };
1871
+ const LOADER_KEYFRAMES = "@keyframes ph-loader-pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.6;transform:scale(.94)}}@keyframes ph-loader-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[data-ph-loader-img]{animation:none!important}}";
1872
+ let projectLoader;
1873
+ /** The page's project loader, or null when Connect's logo stays. Read once:
1874
+ * the meta tag is static in index.html. */
1875
+ function getProjectLoader() {
1876
+ if (projectLoader !== void 0) return projectLoader;
1877
+ if (typeof document === "undefined") return null;
1878
+ const meta = document.querySelector("meta[name=\"ph-loader\"]");
1879
+ const file = meta?.content;
1880
+ if (!meta || !file) return projectLoader = null;
1881
+ const animation = meta.dataset.animation;
1882
+ const size = Number(meta.dataset.size);
1883
+ projectLoader = {
1884
+ src: new URL(file, document.baseURI).toString(),
1885
+ animation: animation === "spin" || animation === "none" ? animation : "pulse",
1886
+ size: Number.isFinite(size) && size > 0 ? size : 96
1887
+ };
1888
+ return projectLoader;
1889
+ }
1890
+ /** The project's loading image with its motion. */
1891
+ function ProjectLoaderImage({ loader, className = "" }) {
1892
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("style", { children: LOADER_KEYFRAMES }), /* @__PURE__ */ jsx("img", {
1893
+ "data-ph-loader-img": "",
1894
+ src: loader.src,
1895
+ alt: "",
1896
+ "aria-label": "Loading",
1897
+ width: loader.size,
1898
+ className,
1899
+ style: {
1900
+ width: loader.size,
1901
+ height: "auto",
1902
+ animation: LOADER_MOTION[loader.animation]
1903
+ }
1904
+ })] });
1905
+ }
1906
+ /** Connect's loading animation: the project's loader when one is
1907
+ * configured, else the animated Powerhouse logo. */
1969
1908
  function LogoAnimation({ size = 48, className = "" }) {
1909
+ const loader = getProjectLoader();
1910
+ if (loader) return /* @__PURE__ */ jsx(ProjectLoaderImage, {
1911
+ loader,
1912
+ className
1913
+ });
1914
+ return /* @__PURE__ */ jsx(PowerhouseLogoAnimation, {
1915
+ size,
1916
+ className
1917
+ });
1918
+ }
1919
+ function PowerhouseLogoAnimation({ size = 48, className = "" }) {
1970
1920
  const refsMap = useRef({});
1971
1921
  const timers = useRef([]);
1972
1922
  function getEls(id) {
@@ -2100,7 +2050,7 @@ function TabContent(props) {
2100
2050
  const toTabValue = (label) => label.trim().replace(/\s+/g, "-");
2101
2051
  const resolveTabValue = (props) => props.value ?? toTabValue(props.label);
2102
2052
  function Tabs({ children, defaultValue, onValueChange, listClassName }) {
2103
- return /* @__PURE__ */ jsxs(Root$2, {
2053
+ return /* @__PURE__ */ jsxs(Root$1, {
2104
2054
  defaultValue: toTabValue(defaultValue),
2105
2055
  onValueChange,
2106
2056
  className: "flex min-h-0 flex-1 flex-col gap-2",
@@ -2112,7 +2062,7 @@ function Tabs({ children, defaultValue, onValueChange, listClassName }) {
2112
2062
  if (!/*#__PURE__*/ React.isValidElement(child)) return;
2113
2063
  const props = child.props;
2114
2064
  const value = resolveTabValue(props);
2115
- return /* @__PURE__ */ jsx(Trigger$2, {
2065
+ return /* @__PURE__ */ jsx(Trigger$1, {
2116
2066
  className: "flex min-h-7 flex-1 items-center justify-center rounded-lg border border-border bg-background py-2 text-foreground transition duration-300 data-disabled:disabled-effect data-[state=active]:bg-accent data-[state=active]:text-foreground",
2117
2067
  value,
2118
2068
  disabled: props.disabled ?? false,
@@ -2125,7 +2075,7 @@ function Tabs({ children, defaultValue, onValueChange, listClassName }) {
2125
2075
  children: React.Children.map(children, (child, i) => {
2126
2076
  if (!/*#__PURE__*/ React.isValidElement(child)) return;
2127
2077
  const value = resolveTabValue(child.props);
2128
- return /* @__PURE__ */ jsx(Content$2, {
2078
+ return /* @__PURE__ */ jsx(Content$1, {
2129
2079
  className: "h-full",
2130
2080
  value,
2131
2081
  children: child
@@ -2160,272 +2110,8 @@ function DocumentStateViewer({ state, ignoredScopes = ["auth", "document"], defa
2160
2110
  });
2161
2111
  }
2162
2112
  //#endregion
2163
- //#region src/connect/components/tooltip/tooltip.tsx
2164
- function ConnectTooltip(props) {
2165
- const { children, content, open, defaultOpen, onOpenChange, className, side = "top", sideOffset = 5, delayDuration, ...rest } = props;
2166
- return /* @__PURE__ */ jsxs(Root, {
2167
- defaultOpen,
2168
- delayDuration,
2169
- onOpenChange,
2170
- open,
2171
- children: [/* @__PURE__ */ jsx(Trigger, {
2172
- asChild: true,
2173
- children
2174
- }), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, {
2175
- ...rest,
2176
- side,
2177
- sideOffset,
2178
- className: twMerge("z-50 rounded-lg border border-border bg-popover p-2 text-xs text-popover-foreground shadow-tooltip", className),
2179
- children: content
2180
- }) })]
2181
- });
2182
- }
2183
- const ConnectTooltipProvider = Provider;
2184
- //#endregion
2185
- //#region src/connect/components/document-timeline/components/h-divider.tsx
2186
- const HDivider = (props) => {
2187
- const { className, timestampUtcMs: timestamp, title, subtitle, onClick, isSelected = false } = props;
2188
- const [open, setOpen] = useState(false);
2189
- const hasContent = !!title || !!subtitle || !!timestamp;
2190
- useEffect(() => {
2191
- if (open) {
2192
- setOpen(false);
2193
- setTimeout(() => hasContent && setOpen(true), 50);
2194
- }
2195
- }, [
2196
- title,
2197
- subtitle,
2198
- timestamp,
2199
- hasContent
2200
- ]);
2201
- const formatTimestamp = (isoString) => {
2202
- if (!isoString) return "";
2203
- try {
2204
- return formatDistanceToNow(new Date(isoString), { addSuffix: true });
2205
- } catch {
2206
- return isoString;
2207
- }
2208
- };
2209
- const tooltipContent = /* @__PURE__ */ jsxs("div", {
2210
- className: "flex flex-col text-xs",
2211
- children: [
2212
- !!title && /* @__PURE__ */ jsx("div", { children: title }),
2213
- !!subtitle && /* @__PURE__ */ jsx("div", {
2214
- className: "text-foreground",
2215
- children: subtitle
2216
- }),
2217
- !!timestamp && /* @__PURE__ */ jsx("div", { children: formatTimestamp(timestamp) })
2218
- ]
2219
- });
2220
- const handleMouseEnter = () => {
2221
- if (hasContent) setOpen(true);
2222
- };
2223
- const handleMouseLeave = () => {
2224
- setOpen(false);
2225
- };
2226
- return /* @__PURE__ */ jsxs("div", {
2227
- className: "relative",
2228
- onMouseEnter: handleMouseEnter,
2229
- onMouseLeave: handleMouseLeave,
2230
- children: [isSelected && /* @__PURE__ */ jsx(Icon, {
2231
- name: "TimelineCaret",
2232
- color: "#4EA9FF",
2233
- size: 10,
2234
- className: "absolute top-[-11px] z-40"
2235
- }), /* @__PURE__ */ jsx(ConnectTooltip, {
2236
- className: "rounded-md bg-primary text-primary-foreground",
2237
- content: tooltipContent,
2238
- open: open && hasContent,
2239
- onOpenChange: setOpen,
2240
- delayDuration: 0,
2241
- side: "bottom",
2242
- sideOffset: 5,
2243
- children: /* @__PURE__ */ jsx("div", {
2244
- className: twMerge("mx-0.5 flex h-6.25 w-1.5 cursor-pointer flex-col items-center justify-center rounded-xs hover:hover-effect", isSelected && "bg-info/10", className),
2245
- onClick,
2246
- "data-title": title,
2247
- "data-subtitle": subtitle,
2248
- "data-timestamp": timestamp,
2249
- children: /* @__PURE__ */ jsx("div", { className: "h-0.5 w-1 rounded-full bg-muted" })
2250
- })
2251
- })]
2252
- });
2253
- };
2254
- //#endregion
2255
- //#region src/connect/components/document-timeline/components/timeline-bar.tsx
2256
- const getBarHeight = (size = 0) => {
2257
- switch (true) {
2258
- case size <= 0: return "h-[1px]";
2259
- case size === 1: return "h-[3px]";
2260
- case size === 2: return "h-[6px]";
2261
- case size === 3: return "h-[9px]";
2262
- case size >= 4: return "h-[12px]";
2263
- default: return "h-[1px]";
2264
- }
2265
- };
2266
- const formatTimestamp$1 = (isoString) => {
2267
- if (!isoString) return "";
2268
- try {
2269
- const date = parseISO(isoString);
2270
- return format(date, "HH:mm, dd, MMMM");
2271
- } catch {
2272
- return isoString;
2273
- }
2274
- };
2275
- const TimelineBar = ({ onClick, className, timestampUtcMs: timestamp, additions, deletions, addSize = 0, delSize = 0, isSelected = false }) => {
2276
- const [open, setOpen] = useState(false);
2277
- const noChanges = addSize === 0 && delSize === 0;
2278
- const addBarHeight = getBarHeight(addSize);
2279
- const delBarHeight = getBarHeight(delSize);
2280
- const tooltipContent = /* @__PURE__ */ jsxs("div", {
2281
- className: "flex flex-col text-xs",
2282
- children: [
2283
- /* @__PURE__ */ jsx("div", { children: formatTimestamp$1(timestamp) }),
2284
- /* @__PURE__ */ jsx("div", {
2285
- className: "text-success",
2286
- children: `${additions} additions +`
2287
- }),
2288
- /* @__PURE__ */ jsx("div", {
2289
- className: "text-destructive",
2290
- children: `${deletions} deletions -`
2291
- })
2292
- ]
2293
- });
2294
- const handleMouseEnter = () => {
2295
- if (!noChanges) setOpen(true);
2296
- };
2297
- const handleMouseLeave = () => {
2298
- setOpen(false);
2299
- };
2300
- return /* @__PURE__ */ jsxs("div", {
2301
- className: "relative",
2302
- onMouseEnter: handleMouseEnter,
2303
- onMouseLeave: handleMouseLeave,
2304
- children: [isSelected && /* @__PURE__ */ jsx(Icon, {
2305
- name: "TimelineCaret",
2306
- color: "#4EA9FF",
2307
- size: 10,
2308
- className: "absolute top-[-11px] left-[-2px] z-40"
2309
- }), noChanges ? /* @__PURE__ */ jsx("div", {
2310
- className: twMerge("flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:hover-effect", className),
2311
- "data-timestamp": timestamp,
2312
- onClick,
2313
- children: /* @__PURE__ */ jsx("div", { className: "size-[3px] rounded-full bg-muted-foreground" })
2314
- }) : /* @__PURE__ */ jsx(ConnectTooltip, {
2315
- className: "rounded-md bg-primary text-primary-foreground",
2316
- content: tooltipContent,
2317
- open,
2318
- onOpenChange: setOpen,
2319
- delayDuration: 0,
2320
- side: "bottom",
2321
- sideOffset: 5,
2322
- children: /* @__PURE__ */ jsxs("div", {
2323
- className: twMerge("flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:hover-effect", className, isSelected && "bg-info/10"),
2324
- "data-timestamp": timestamp,
2325
- onClick,
2326
- children: [/* @__PURE__ */ jsx("div", {
2327
- className: "flex h-3 w-0.5 items-end",
2328
- children: /* @__PURE__ */ jsx("div", { className: twMerge("h-3 w-0.5 rounded-t-full bg-success", addBarHeight) })
2329
- }), /* @__PURE__ */ jsx("div", {
2330
- className: "flex h-3 w-0.5 items-start",
2331
- children: /* @__PURE__ */ jsx("div", { className: twMerge("h-3 w-0.5 rounded-b-full bg-destructive", delBarHeight) })
2332
- })]
2333
- })
2334
- })]
2335
- });
2336
- };
2337
- //#endregion
2338
2113
  //#region src/connect/components/document-timeline/document-timeline.tsx
2339
- const defaultTimeLineItem = {
2340
- id: "default",
2341
- type: "bar",
2342
- addSize: 0,
2343
- delSize: 0
2344
- };
2345
- const DocumentTimeline = (props) => {
2346
- const { timeline = [], onItemClick } = props;
2347
- const [selectedItem, setSelectedItem] = useState(null);
2348
- const scrollContainerRef = useRef(null);
2349
- const handleClick = (item) => {
2350
- if (item.id === selectedItem || item.id === defaultTimeLineItem.id) {
2351
- onItemClick?.(null);
2352
- setSelectedItem(null);
2353
- } else {
2354
- onItemClick?.(item);
2355
- setSelectedItem(item.id);
2356
- }
2357
- };
2358
- const mergedTimelineItems = [...timeline, defaultTimeLineItem];
2359
- const [unselectedItems, selectedItems] = useMemo(() => {
2360
- const indexSelected = mergedTimelineItems.findIndex((item) => item.id === selectedItem);
2361
- return indexSelected === -1 ? [mergedTimelineItems, []] : [mergedTimelineItems.slice(0, indexSelected), mergedTimelineItems.slice(indexSelected)];
2362
- }, [mergedTimelineItems, selectedItem]);
2363
- const renderTimelineItems = useCallback((items) => {
2364
- return items.map((item) => {
2365
- if (item.type === "divider") {
2366
- const { timestampUtcMs, title, subtitle } = item;
2367
- return /* @__PURE__ */ jsx(HDivider, {
2368
- timestampUtcMs,
2369
- title,
2370
- subtitle,
2371
- onClick: () => handleClick(item),
2372
- isSelected: item.id === selectedItem
2373
- }, item.id);
2374
- }
2375
- return /* @__PURE__ */ jsx(TimelineBar, {
2376
- timestampUtcMs: item.timestampUtcMs,
2377
- addSize: item.addSize,
2378
- delSize: item.delSize,
2379
- additions: item.additions,
2380
- deletions: item.deletions,
2381
- isSelected: item.id === selectedItem,
2382
- onClick: () => handleClick(item)
2383
- }, item.id);
2384
- });
2385
- }, [handleClick, selectedItem]);
2386
- const unselectedContent = useMemo(() => renderTimelineItems(unselectedItems), [unselectedItems, renderTimelineItems]);
2387
- const selectedContent = useMemo(() => renderTimelineItems(selectedItems), [selectedItems, renderTimelineItems]);
2388
- useEffect(() => {
2389
- if (scrollContainerRef.current) scrollContainerRef.current.scrollLeft = scrollContainerRef.current.scrollWidth;
2390
- }, []);
2391
- return /* @__PURE__ */ jsx(ConnectTooltipProvider, {
2392
- delayDuration: 0,
2393
- skipDelayDuration: 0,
2394
- children: /* @__PURE__ */ jsxs("div", {
2395
- className: "relative h-[36px] w-full",
2396
- children: [
2397
- /* @__PURE__ */ jsx("div", {
2398
- className: "absolute left-0 z-20 h-[17px] w-[6px] bg-background",
2399
- children: /* @__PURE__ */ jsx("div", { className: "mt-[11px] h-[6px] w-[6px] rounded-tl-md bg-background" })
2400
- }),
2401
- /* @__PURE__ */ jsx("div", {
2402
- className: "absolute top-[11px] right-0 z-20 h-[6px] w-[6px] bg-background",
2403
- children: /* @__PURE__ */ jsx("div", { className: "h-[6px] w-[6px] rounded-tr-md bg-background" })
2404
- }),
2405
- /* @__PURE__ */ jsx("div", { className: "absolute inset-x-0 bottom-0 h-[25px] rounded-md bg-background" }),
2406
- /* @__PURE__ */ jsx("div", {
2407
- className: "absolute inset-x-0 bottom-0 h-[36px]",
2408
- children: /* @__PURE__ */ jsx("div", {
2409
- ref: scrollContainerRef,
2410
- className: "h-full overflow-x-auto rounded-md",
2411
- children: /* @__PURE__ */ jsxs("div", {
2412
- className: "ml-auto flex h-[36px] w-max items-end px-2 pb-0",
2413
- children: [/* @__PURE__ */ jsx("div", {
2414
- className: "flex",
2415
- children: unselectedContent
2416
- }), /* @__PURE__ */ jsx("div", {
2417
- className: "flex rounded-sm bg-info/10",
2418
- children: selectedContent
2419
- })]
2420
- })
2421
- })
2422
- }),
2423
- /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute bottom-0 left-0 z-10 h-[25px] w-2 rounded-l-md bg-background" }),
2424
- /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute right-0 bottom-0 z-10 h-[25px] w-2 rounded-r-md bg-background" })
2425
- ]
2426
- })
2427
- });
2428
- };
2114
+ const DocumentTimeline = lazyComponent(() => import("../document-timeline.impl-zx6f7k2d.js").then((m) => m.DocumentTimeline));
2429
2115
  //#endregion
2430
2116
  //#region src/connect/components/document-toolbar/containers.tsx
2431
2117
  /**
@@ -2460,6 +2146,105 @@ function ToolbarControlsContainer(props) {
2460
2146
  }
2461
2147
  //#endregion
2462
2148
  //#region src/connect/components/document-toolbar/use-document-undo-redo.ts
2149
+ const UNAVAILABLE = {
2150
+ canUndo: false,
2151
+ canRedo: false
2152
+ };
2153
+ /** The scope `undo()` and `redo()` target by default. */
2154
+ const UNDO_SCOPE = "global";
2155
+ function isRetractionDocument(document) {
2156
+ const create = document.operations?.document?.[0]?.action;
2157
+ const input = create?.type === "CREATE_DOCUMENT" ? create.input : void 0;
2158
+ return undoCapabilitiesOf(document.header, input)?.undo === "retraction";
2159
+ }
2160
+ function undoRoute(client, document) {
2161
+ if (!document || !isRetractionDocument(document)) return "dispatch";
2162
+ return client ? "client" : "none";
2163
+ }
2164
+ const DISABLED = {
2165
+ canUndo: false,
2166
+ canRedo: false,
2167
+ undo: () => void 0,
2168
+ redo: () => void 0
2169
+ };
2170
+ const availabilityReads = /* @__PURE__ */ new WeakMap();
2171
+ function readAvailability(client, documentId, revision) {
2172
+ let reads = availabilityReads.get(client);
2173
+ if (!reads) {
2174
+ reads = /* @__PURE__ */ new Map();
2175
+ availabilityReads.set(client, reads);
2176
+ }
2177
+ const cached = reads.get(documentId);
2178
+ if (cached?.revision === revision) return cached.read;
2179
+ const entry = {
2180
+ revision,
2181
+ read: Promise.resolve(UNAVAILABLE)
2182
+ };
2183
+ entry.read = client.undoRedoAvailability(documentId, UNDO_SCOPE).catch((error) => {
2184
+ console.error("Failed to read undo and redo availability:", error);
2185
+ if (reads.get(documentId) === entry) reads.delete(documentId);
2186
+ return UNAVAILABLE;
2187
+ });
2188
+ reads.set(documentId, entry);
2189
+ return entry.read;
2190
+ }
2191
+ const pendingPresses = /* @__PURE__ */ new WeakMap();
2192
+ function queuePress(client, documentId, press, failure) {
2193
+ let presses = pendingPresses.get(client);
2194
+ if (!presses) {
2195
+ presses = /* @__PURE__ */ new Map();
2196
+ pendingPresses.set(client, presses);
2197
+ }
2198
+ const queue = presses;
2199
+ const prior = queue.get(documentId);
2200
+ const run = (prior ? prior.then(press) : new Promise((resolve) => resolve(press()))).catch((error) => {
2201
+ console.error(failure, error);
2202
+ });
2203
+ queue.set(documentId, run);
2204
+ run.finally(() => {
2205
+ if (queue.get(documentId) === run) queue.delete(documentId);
2206
+ });
2207
+ }
2208
+ /**
2209
+ * Undo and redo of a base-reducer 3 document through the reactor client, so
2210
+ * the author signs the RETRACT it submits. Availability is read when the
2211
+ * global or document revision changes, and presses run one at a time.
2212
+ * Without a client the controls are disabled. Returns undefined below
2213
+ * base-reducer 3, where the caller dispatches UNDO and REDO itself.
2214
+ */
2215
+ function useBaseReducer3UndoRedo(document) {
2216
+ const client = useReactorClient();
2217
+ const route = undoRoute(client, document);
2218
+ const documentId = route === "client" ? document?.header.id : void 0;
2219
+ const revision = `${document?.header.revision[UNDO_SCOPE] ?? 0}:${document?.header.revision.document ?? 0}`;
2220
+ const [availability, setAvailability] = useState({ value: UNAVAILABLE });
2221
+ useEffect(() => {
2222
+ if (!client || !documentId) return;
2223
+ let cancelled = false;
2224
+ readAvailability(client, documentId, revision).then((value) => {
2225
+ if (!cancelled) setAvailability({
2226
+ documentId,
2227
+ value
2228
+ });
2229
+ });
2230
+ return () => {
2231
+ cancelled = true;
2232
+ };
2233
+ }, [
2234
+ client,
2235
+ documentId,
2236
+ revision
2237
+ ]);
2238
+ if (route === "none") return DISABLED;
2239
+ if (!client || !documentId) return void 0;
2240
+ const { canUndo, canRedo } = availability.documentId === documentId ? availability.value : UNAVAILABLE;
2241
+ return {
2242
+ canUndo,
2243
+ canRedo,
2244
+ undo: () => queuePress(client, documentId, () => client.undo(documentId, UNDO_SCOPE), "Failed to undo:"),
2245
+ redo: () => queuePress(client, documentId, () => client.redo(documentId, UNDO_SCOPE), "Failed to redo:")
2246
+ };
2247
+ }
2463
2248
  /**
2464
2249
  * Checks whether a document has at least one non-zero revision count.
2465
2250
  *
@@ -2473,11 +2258,17 @@ function hasRevisions(document) {
2473
2258
  /**
2474
2259
  * Returns undo state and an undo dispatcher for a document.
2475
2260
  *
2476
- * `canUndo` is true when the document has at least one non-zero revision count
2477
- * across any revision scope.
2261
+ * On base-reducer 3 both come from the reactor client, and without one undo
2262
+ * is disabled. Otherwise `canUndo` is true when the document has at least one
2263
+ * non-zero revision count across any revision scope, and undo dispatches UNDO.
2478
2264
  */
2479
2265
  function useUndo(documentId) {
2480
2266
  const [document, dispatch] = useDocumentById(documentId);
2267
+ const client = useBaseReducer3UndoRedo(document);
2268
+ if (client) return {
2269
+ canUndo: client.canUndo,
2270
+ undo: client.undo
2271
+ };
2481
2272
  return {
2482
2273
  canUndo: hasRevisions(document),
2483
2274
  undo: () => dispatch(undo())
@@ -2486,11 +2277,18 @@ function useUndo(documentId) {
2486
2277
  /**
2487
2278
  * Returns redo state and a redo dispatcher for a document.
2488
2279
  *
2489
- * `canRedo` is true when the document clipboard contains at least one operation
2490
- * that can be reapplied.
2280
+ * On base-reducer 3 both come from the reactor client, and without one redo
2281
+ * is disabled. Otherwise `canRedo` is true when the document clipboard
2282
+ * contains at least one operation that can be reapplied, and redo dispatches
2283
+ * REDO.
2491
2284
  */
2492
2285
  function useRedo(documentId) {
2493
2286
  const [document, dispatch] = useDocumentById(documentId);
2287
+ const client = useBaseReducer3UndoRedo(document);
2288
+ if (client) return {
2289
+ canRedo: client.canRedo,
2290
+ redo: client.redo
2291
+ };
2494
2292
  return {
2495
2293
  canRedo: hasAtLeast(document?.clipboard ?? [], 1),
2496
2294
  redo: () => dispatch(redo())
@@ -2627,7 +2425,8 @@ function ToolbarHistoryButton(props) {
2627
2425
  /**
2628
2426
  * Toolbar control for closing the current document view.
2629
2427
  *
2630
- * By default, this selects the current document's parent folder. Provide
2428
+ * By default, this goes back when the app's history allows, else it selects the
2429
+ * current document's parent folder. Provide
2631
2430
  * `children` to replace the default icon, or `onClick` to override the default
2632
2431
  * close behavior.
2633
2432
  */
@@ -2636,8 +2435,7 @@ function ToolbarCloseButton(props) {
2636
2435
  name: "XmarkLight",
2637
2436
  size: 16
2638
2437
  }) } = props;
2639
- const parentFolder = useNodeParentFolderById(document?.header.id);
2640
- const onClick = makeOnClick(document, onClickOverride, () => setSelectedNode(parentFolder));
2438
+ const onClick = makeOnClick(document, onClickOverride, useCloseNode(document?.header.id));
2641
2439
  return /* @__PURE__ */ jsx(ToolbarButton, {
2642
2440
  "data-testid": "toolbar-close-button",
2643
2441
  "aria-label": "Close document",
@@ -3576,6 +3374,7 @@ function DropZone(props) {
3576
3374
  setConflictUploadId(null);
3577
3375
  };
3578
3376
  const { isDropTarget, ...dropProps } = useDropFile(handleAddFile);
3377
+ const setSelectedNode = useSetSelectedNode();
3579
3378
  return /* @__PURE__ */ jsxs("div", {
3580
3379
  className: twMerge("relative", className),
3581
3380
  ...enable ? dropProps : {},
@@ -3743,22 +3542,32 @@ function EditorUndoRedoButtons(props) {
3743
3542
  });
3744
3543
  }
3745
3544
  //#endregion
3746
- //#region assets/powerhouse-rounded.png
3747
- var powerhouse_rounded_default = "data:image/png;base64,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";
3748
- //#endregion
3749
- //#region src/connect/components/ens-avatar/ens-avatar.tsx
3750
- function ENSAvatar(props) {
3751
- const { avatarUrl = powerhouse_rounded_default, size = "14px" } = props;
3752
- return /* @__PURE__ */ jsx("img", {
3753
- alt: "ENS Avatar",
3754
- className: "flex-none rounded-full object-contain",
3755
- src: avatarUrl,
3756
- style: {
3757
- width: size,
3758
- height: size
3759
- }
3545
+ //#region src/connect/components/branding/connect-branding.tsx
3546
+ /**
3547
+ * Connect's branding as the components see it: the host app provides it once
3548
+ * at its root (images already resolved to data URIs) and the components read
3549
+ * it from here instead of reaching into configuration. `icons` are the drive
3550
+ * explorer's, which the generic plugin owns; `appName`, `icon` and
3551
+ * `homeBackground` are Connect's identity (`connect.branding`). Without a
3552
+ * provider every built-in icon renders.
3553
+ */
3554
+ const ConnectBrandingContext = /*#__PURE__*/ createContext({});
3555
+ function ConnectBrandingProvider(props) {
3556
+ return /* @__PURE__ */ jsx(ConnectBrandingContext.Provider, {
3557
+ value: props.branding ?? {},
3558
+ children: props.children
3760
3559
  });
3761
3560
  }
3561
+ /** The provided branding; `{}` (built-in look) without a provider. */
3562
+ function useConnectBranding() {
3563
+ return useContext(ConnectBrandingContext);
3564
+ }
3565
+ /** The icon for a document of `documentType`: the explorer's icon for that
3566
+ * type, else its default document icon, else undefined (the icon the package
3567
+ * ships, or the built-in one). */
3568
+ function brandedDocumentIcon(branding, documentType) {
3569
+ return branding.icons?.documents?.[documentType] ?? branding.icons?.document ?? void 0;
3570
+ }
3762
3571
  //#endregion
3763
3572
  //#region src/connect/constants/options.tsx
3764
3573
  const defaultDriveOptions = [
@@ -3989,6 +3798,11 @@ function getDriveSharingType$1(drive) {
3989
3798
  }
3990
3799
  function FileItem(props) {
3991
3800
  const { fileNode, className, customDocumentIconSrc } = props;
3801
+ const setSelectedNode = useSetSelectedNode();
3802
+ const preloadNode = usePreloadNode();
3803
+ const target = useNodeTarget(fileNode);
3804
+ const link = useLinkProps(target, () => setSelectedNode(fileNode));
3805
+ const href = props.href ?? (target ? link.href : void 0);
3992
3806
  const [mode, setMode] = useState("READ");
3993
3807
  const [isDropdownMenuOpen, setIsDropdownMenuOpen] = useState(false);
3994
3808
  const [selectedDrive] = useSelectedDriveSafe();
@@ -3999,9 +3813,12 @@ function FileItem(props) {
3999
3813
  });
4000
3814
  const { isAllowedToCreateDocuments } = useUserPermissions();
4001
3815
  const editorModules = useEditorModulesForDocumentType(fileNode.documentType);
4002
- const preloadEditors = () => editorModules?.forEach((editorModule) => {
4003
- preloadEditorModule(editorModule);
4004
- });
3816
+ const preload = () => {
3817
+ editorModules?.forEach((editorModule) => {
3818
+ preloadEditorModule(editorModule);
3819
+ });
3820
+ preloadNode(fileNode);
3821
+ };
4005
3822
  const { onRenameNode, onRenameDriveNodes, onDuplicateNode } = useNodeActions();
4006
3823
  const downloadDocument = useDownloadDocument(fileNode.id);
4007
3824
  const isReadMode = mode === "READ";
@@ -4032,13 +3849,15 @@ function FileItem(props) {
4032
3849
  handler();
4033
3850
  setIsDropdownMenuOpen(false);
4034
3851
  }
3852
+ const branding = useConnectBranding();
3853
+ const documentIconSrc = customDocumentIconSrc ?? brandedDocumentIcon(branding, fileNode.documentType);
4035
3854
  const iconNode = /* @__PURE__ */ jsxs("div", {
4036
3855
  className: "relative",
4037
- children: [customDocumentIconSrc ? /* @__PURE__ */ jsx("img", {
3856
+ children: [documentIconSrc ? /* @__PURE__ */ jsx("img", {
4038
3857
  alt: "file icon",
4039
- className: "max-w-none",
3858
+ className: "max-w-none object-contain",
4040
3859
  height: 34,
4041
- src: customDocumentIconSrc,
3860
+ src: documentIconSrc,
4042
3861
  width: 32,
4043
3862
  draggable: false
4044
3863
  }) : /* @__PURE__ */ jsx(DefaultFileIcon, {}), isReadMode && syncStatus && /* @__PURE__ */ jsx("div", {
@@ -4072,6 +3891,7 @@ function FileItem(props) {
4072
3891
  children: /* @__PURE__ */ jsx("button", {
4073
3892
  className: twMerge("hidden group-hover:block", isDropdownMenuOpen && "block"),
4074
3893
  onClick: (e) => {
3894
+ e.preventDefault();
4075
3895
  e.stopPropagation();
4076
3896
  setIsDropdownMenuOpen(true);
4077
3897
  },
@@ -4087,10 +3907,15 @@ function FileItem(props) {
4087
3907
  onCancel,
4088
3908
  onSubmit
4089
3909
  });
4090
- return /* @__PURE__ */ jsx("div", {
4091
- className: "relative w-64",
4092
- onClick: isReadMode ? () => setSelectedNode(fileNode) : void 0,
4093
- onMouseEnter: preloadEditors,
3910
+ const isLink = isReadMode && !!href;
3911
+ return /* @__PURE__ */ jsx(isLink ? "a" : "div", {
3912
+ href: isLink ? href : void 0,
3913
+ "aria-current": isLink ? link["aria-current"] : void 0,
3914
+ className: "relative block w-64",
3915
+ onClick: isLink ? link.onClick : isReadMode ? () => setSelectedNode(fileNode) : void 0,
3916
+ onMouseEnter: preload,
3917
+ onTouchStart: preload,
3918
+ onFocus: preload,
4094
3919
  ...dragProps,
4095
3920
  children: /* @__PURE__ */ jsx("div", {
4096
3921
  className: containerStyles,
@@ -4216,6 +4041,12 @@ function DefaultFileIcon() {
4216
4041
  //#region src/connect/components/folder-item/folder-item.tsx
4217
4042
  function FolderItem(props) {
4218
4043
  const { folderNode, className } = props;
4044
+ const folderIconSrc = useConnectBranding().icons?.folder;
4045
+ const setSelectedNode = useSetSelectedNode();
4046
+ const preloadNode = usePreloadNode();
4047
+ const target = useNodeTarget(folderNode);
4048
+ const link = useLinkProps(target, () => setSelectedNode(folderNode));
4049
+ const href = props.href ?? (target ? link.href : void 0);
4219
4050
  const { isAllowedToCreateDocuments } = useUserPermissions();
4220
4051
  const [mode, setMode] = useState("READ");
4221
4052
  const [isDropdownMenuOpen, setIsDropdownMenuOpen] = useState(false);
@@ -4263,9 +4094,15 @@ function FolderItem(props) {
4263
4094
  onSubmit
4264
4095
  });
4265
4096
  const containerStyles = twMerge("group flex h-12 cursor-pointer items-center rounded-lg bg-muted px-2 select-none", isDragging ? "opacity-60" : isDropTarget ? "bg-info/10" : "", className);
4266
- return /* @__PURE__ */ jsx("div", {
4267
- className: "relative w-64 hover:hover-effect",
4268
- onClick: isReadMode ? () => setSelectedNode(folderNode) : void 0,
4097
+ const isLink = isReadMode && !!href;
4098
+ return /* @__PURE__ */ jsx(isLink ? "a" : "div", {
4099
+ href: isLink ? href : void 0,
4100
+ "aria-current": isLink ? link["aria-current"] : void 0,
4101
+ className: "relative block w-64 hover:hover-effect",
4102
+ onClick: isLink ? link.onClick : isReadMode ? () => setSelectedNode(folderNode) : void 0,
4103
+ onMouseEnter: () => preloadNode(folderNode),
4104
+ onTouchStart: () => preloadNode(folderNode),
4105
+ onFocus: () => preloadNode(folderNode),
4269
4106
  children: /* @__PURE__ */ jsxs("div", {
4270
4107
  ...dragProps,
4271
4108
  ...dropProps,
@@ -4276,7 +4113,14 @@ function FolderItem(props) {
4276
4113
  className: "p-1",
4277
4114
  children: /* @__PURE__ */ jsx("div", {
4278
4115
  className: "relative text-foreground",
4279
- children: /* @__PURE__ */ jsx(Icon, {
4116
+ children: folderIconSrc ? /* @__PURE__ */ jsx("img", {
4117
+ alt: "folder icon",
4118
+ className: "object-contain",
4119
+ src: folderIconSrc,
4120
+ width: 24,
4121
+ height: 24,
4122
+ draggable: false
4123
+ }) : /* @__PURE__ */ jsx(Icon, {
4280
4124
  name: "FolderClose",
4281
4125
  size: 24
4282
4126
  })
@@ -4290,6 +4134,7 @@ function FolderItem(props) {
4290
4134
  children: /* @__PURE__ */ jsx("button", {
4291
4135
  className: twMerge("ml-auto hidden group-hover:block", isDropdownMenuOpen && "block"),
4292
4136
  onClick: (e) => {
4137
+ e.preventDefault();
4293
4138
  e.stopPropagation();
4294
4139
  setIsDropdownMenuOpen(true);
4295
4140
  },
@@ -4343,296 +4188,67 @@ const FormInput = /*#__PURE__*/ forwardRef(function FormInput(props, ref) {
4343
4188
  })] });
4344
4189
  });
4345
4190
  //#endregion
4346
- //#region src/connect/components/form/inputs/app-form-input.tsx
4347
- function appToInputOption(app) {
4348
- return {
4349
- value: app.id,
4350
- displayValue: app.name,
4351
- icon: /* @__PURE__ */ jsx(Icon, { name: "PowerhouseLogoSmall" }),
4352
- description: "Built by Powerhouse"
4353
- };
4354
- }
4355
- function AppFormInput(props) {
4356
- const { control, appOptions, ...delegatedProps } = props;
4357
- const items = appOptions.map(appToInputOption);
4358
- return /* @__PURE__ */ jsx(Controller, {
4359
- control,
4360
- name: "id",
4361
- render: ({ field }) => /* @__PURE__ */ jsx(ConnectSelect, {
4362
- ...delegatedProps,
4363
- ...field,
4364
- id: "id",
4365
- items
4366
- })
4367
- });
4368
- }
4369
- //#endregion
4370
- //#region src/connect/components/form/inputs/label.tsx
4371
- function Label(props) {
4372
- const { children, className, ...labelProps } = props;
4373
- return /* @__PURE__ */ jsx("label", {
4374
- ...labelProps,
4375
- className: twMerge("block font-semibold text-muted-foreground", className),
4376
- children
4377
- });
4378
- }
4379
- //#endregion
4380
4191
  //#region src/connect/components/form/add-local-drive-form.tsx
4381
- function AddLocalDriveForm(props) {
4382
- const { register, handleSubmit, control, formState: { errors } } = useForm({ defaultValues: {
4383
- name: "",
4384
- sharingType: "LOCAL",
4385
- availableOffline: false,
4386
- id: props.appOptions[0].id
4387
- } });
4388
- return /* @__PURE__ */ jsx("form", {
4389
- name: "add-local-drive",
4390
- onSubmit: (e) => void handleSubmit(props.onSubmit)(e),
4391
- className: "flex flex-col gap-4",
4392
- children: /* @__PURE__ */ jsxs("div", {
4393
- className: "flex flex-col gap-4",
4394
- children: [
4395
- /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Label, {
4396
- htmlFor: "name",
4397
- className: "text-sm font-medium text-foreground",
4398
- children: "Drive Name"
4399
- }), /* @__PURE__ */ jsx(FormInput, {
4400
- ...register("name", { required: "Drive name is required" }),
4401
- errorMessage: errors.name?.message,
4402
- placeholder: "Drive name"
4403
- })] }),
4404
- /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Label, {
4405
- htmlFor: "driveApp",
4406
- className: "text-sm font-medium text-foreground",
4407
- children: "Drive App"
4408
- }), /* @__PURE__ */ jsx(AppFormInput, {
4409
- control,
4410
- appOptions: props.appOptions
4411
- })] }),
4412
- /* @__PURE__ */ jsx(PowerhouseButton, {
4413
- className: "mt-2 w-full",
4414
- type: "submit",
4415
- children: "Create new drive"
4416
- })
4417
- ]
4418
- })
4419
- });
4420
- }
4421
- //#endregion
4422
- //#region src/connect/components/toggle/toggle.tsx
4423
- const Toggle = /*#__PURE__*/ forwardRef(function Toggle(props, ref) {
4424
- return /* @__PURE__ */ jsxs("label", {
4425
- className: "relative cursor-pointer items-center",
4426
- htmlFor: props.id,
4427
- children: [/* @__PURE__ */ jsx("input", {
4428
- className: "peer sr-only",
4429
- ref,
4430
- type: "checkbox",
4431
- value: "",
4432
- ...props
4433
- }), /* @__PURE__ */ jsx("div", { className: "peer h-6 w-11 rounded-full bg-muted-foreground peer-checked:bg-info peer-focus:outline-none after:absolute after:inset-s-0.5 after:top-0.5 after:size-5 after:rounded-full after:border after:border-none after:bg-background after:transition-all peer-checked:after:translate-x-full" })]
4434
- });
4435
- });
4436
- //#endregion
4437
- //#region src/connect/components/form/inputs/available-offline-toggle.tsx
4438
- const AvailableOfflineToggle = /*#__PURE__*/ forwardRef(function AvailableOfflineToggle(props, ref) {
4439
- return /* @__PURE__ */ jsxs("div", {
4440
- className: "flex items-center rounded-md border border-border bg-background p-3 text-foreground",
4441
- children: [/* @__PURE__ */ jsxs("div", {
4442
- className: "flex-1",
4443
- children: [/* @__PURE__ */ jsx("label", {
4444
- className: "font-medium text-foreground",
4445
- htmlFor: "availableOffline",
4446
- children: "Make available offline"
4447
- }), /* @__PURE__ */ jsxs("p", {
4448
- className: "text-xs text-foreground",
4449
- children: [
4450
- "Check this options if you keep a local backup",
4451
- /* @__PURE__ */ jsx("br", {}),
4452
- "available at all times."
4453
- ]
4454
- })]
4455
- }), /* @__PURE__ */ jsx(Toggle, {
4456
- id: "availableOffline",
4457
- ref,
4458
- ...props
4459
- })]
4460
- });
4461
- });
4192
+ const AddLocalDriveForm = lazyComponent(() => import("../add-local-drive-form.impl-COIpcmgW.js").then((m) => m.AddLocalDriveForm));
4462
4193
  //#endregion
4463
- //#region src/connect/components/form/inputs/drive-name.tsx
4464
- function DriveName(props) {
4465
- return /* @__PURE__ */ jsxs("div", {
4466
- className: "flex gap-2 rounded-xl bg-muted p-3 font-semibold text-muted-foreground",
4467
- children: [/* @__PURE__ */ jsx(Icon, {
4468
- className: "text-foreground",
4469
- name: "Drive"
4470
- }), props.driveName]
4471
- });
4472
- }
4194
+ //#region src/connect/components/form/add-remote-drive-form.tsx
4195
+ const AddRemoteDriveForm = lazyComponent(() => import("../add-remote-drive-form.impl-_SqOzbSt.js").then((m) => m.AddRemoteDriveForm));
4473
4196
  //#endregion
4474
- //#region src/connect/components/form/inputs/location-info.tsx
4475
- function LocationInfo(props) {
4476
- const { location, className, ...divProps } = props;
4477
- const locationInfo = locationInfoByLocation[location];
4197
+ //#region src/connect/components/branding/background-layers.tsx
4198
+ /**
4199
+ * A decorated pane: the configured page colour with the background's layers
4200
+ * painted over it, in order, and the children above them all. Each layer is
4201
+ * placed by the shared `layerStyle`, the same declarations the desktop
4202
+ * loading page emits as static CSS, so a background configured once looks
4203
+ * the same in both hosts. Images come resolved (data URIs or URLs); a
4204
+ * light/dark pair follows the `.dark` theme class, not the OS scheme.
4205
+ * Without a background the pane is the theme's page colour and nothing more.
4206
+ */
4207
+ function BackgroundLayers(props) {
4208
+ const background = normalizeBackground(props.background);
4209
+ const color = colorVariants(background?.color);
4210
+ const style = color ? {
4211
+ "--ph-pane-bg": color.light,
4212
+ "--ph-pane-bg-dark": color.dark ?? color.light
4213
+ } : void 0;
4478
4214
  return /* @__PURE__ */ jsxs("div", {
4479
- ...divProps,
4480
- className: twMerge("my-3 flex items-center gap-2 rounded-xl border border-border bg-background p-3 text-foreground shadow-sm", className),
4481
- children: [locationInfo.icon, /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", { children: locationInfo.title }), /* @__PURE__ */ jsx("p", {
4482
- className: "text-xs text-foreground",
4483
- children: locationInfo.description
4484
- })] })]
4485
- });
4486
- }
4487
- //#endregion
4488
- //#region src/connect/components/form/add-remote-drive-form.tsx
4489
- function AddRemoteDriveForm(props) {
4490
- const { sharingType = "PUBLIC", requestPublicDrive } = props;
4491
- const [remoteDriveDetails, setPublicDriveDetails] = useState();
4492
- const [showLocationSettings, setShowLocationSettings] = useState(false);
4493
- const [isUrlValid, setIsUrlValid] = useState(true);
4494
- const [hasConfirmedUrl, setHasConfirmedUrl] = useState(false);
4495
- const [errorMessage, setErrorMessage] = useState("");
4496
- const [url, setUrl] = useState("");
4497
- const [debouncedUrl, setDebouncedUrl] = useDebounceValue(url, 500);
4498
- const { register, handleSubmit, setValue } = useForm({
4499
- mode: "onBlur",
4500
- defaultValues: { availableOffline: remoteDriveDetails?.availableOffline ?? false }
4501
- });
4502
- useEffect(() => {
4503
- setDebouncedUrl(url);
4504
- }, [url]);
4505
- useEffect(() => {
4506
- setHasConfirmedUrl(false);
4507
- if (debouncedUrl === "") return;
4508
- fetchPublicDrive().catch(console.error);
4509
- async function fetchPublicDrive() {
4510
- try {
4511
- const { id, name } = await requestPublicDrive(debouncedUrl);
4512
- setPublicDriveDetails({
4513
- id,
4514
- name,
4515
- sharingType,
4516
- location: "SWITCHBOARD",
4517
- availableOffline: true
4518
- });
4519
- setValue("availableOffline", true);
4520
- setIsUrlValid(true);
4521
- setErrorMessage("");
4522
- } catch (error) {
4523
- setPublicDriveDetails(void 0);
4524
- setIsUrlValid(false);
4525
- setErrorMessage(error.message);
4526
- }
4527
- }
4528
- }, [
4529
- debouncedUrl,
4530
- setValue,
4531
- sharingType
4532
- ]);
4533
- function onSubmit({ availableOffline }) {
4534
- if (!remoteDriveDetails) return;
4535
- props.onSubmit({
4536
- ...remoteDriveDetails,
4537
- availableOffline,
4538
- url: debouncedUrl
4539
- });
4540
- }
4541
- return /* @__PURE__ */ jsx("form", {
4542
- onSubmit: (e) => void handleSubmit(onSubmit)(e),
4543
- children: hasConfirmedUrl ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
4544
- /* @__PURE__ */ jsx(DriveName, { driveName: remoteDriveDetails?.name ?? "New drive" }),
4545
- /* @__PURE__ */ jsx(Divider, { className: "my-3" }),
4546
- /* @__PURE__ */ jsxs(Disclosure, {
4547
- isOpen: showLocationSettings,
4548
- onOpenChange: () => setShowLocationSettings(!showLocationSettings),
4549
- title: "Location",
4550
- children: [/* @__PURE__ */ jsx(LocationInfo, { location: "SWITCHBOARD" }), /* @__PURE__ */ jsx(AvailableOfflineToggle, { ...register("availableOffline") })]
4551
- }),
4552
- /* @__PURE__ */ jsx(PowerhouseButton, {
4553
- className: "mt-4 w-full",
4554
- color: "dark",
4555
- type: "submit",
4556
- children: "Add new drive"
4557
- })
4558
- ] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FormInput, {
4559
- errorMessage,
4560
- onChange: (e) => setUrl(e.target.value),
4561
- placeholder: "Drive URL",
4562
- required: true,
4563
- type: "url",
4564
- value: url
4565
- }), /* @__PURE__ */ jsx(PowerhouseButton, {
4566
- className: "mt-4 w-full py-2 text-base",
4567
- color: "dark",
4568
- size: "small",
4569
- disabled: !isUrlValid || url === "",
4570
- onClick: (e) => {
4571
- e.preventDefault();
4572
- setHasConfirmedUrl(true);
4573
- },
4574
- type: "button",
4575
- children: "Add drive"
4576
- })] })
4577
- });
4578
- }
4579
- //#endregion
4580
- //#region src/connect/components/formatted-json-viewer.tsx
4581
- function FormattedJsonViewer(props) {
4582
- const { theme } = useTheme();
4583
- return /* @__PURE__ */ jsxs(JsonView, {
4584
- displayDataTypes: false,
4585
- displayObjectSize: false,
4586
- style: theme === "light" ? lightTheme : darkTheme,
4587
- ...props,
4588
- children: [/* @__PURE__ */ jsx(JsonView.Copied, { render: ({ onClick, ...props }) => {
4589
- if (props["data-copied"]) return /* @__PURE__ */ jsx(Icon, {
4590
- ...props,
4591
- className: "inline-block text-success",
4592
- name: "FilesEarmark",
4593
- size: 16
4594
- });
4595
- return /* @__PURE__ */ jsx(Icon, {
4596
- ...props,
4597
- onClick,
4598
- className: "inline-block cursor-pointer text-foreground",
4599
- name: "FilesEarmark",
4600
- size: 16
4601
- });
4602
- } }), /* @__PURE__ */ jsx(JsonView.String, { render: ({ children, ...rest }, { value, keyName }) => {
4603
- if (isString(children) && isString(value) && isStrictEqual(children, value) && value.length > 30) return /* @__PURE__ */ jsx("span", {
4604
- ...rest,
4605
- className: "inline-grid",
4606
- children: /* @__PURE__ */ jsxs("span", {
4607
- className: "pl-[1ch] indent-[-1ch] wrap-anywhere hyphens-none",
4608
- style: { maxWidth: `${60 - keyName.toString().length}ch` },
4609
- children: [
4610
- "\"",
4611
- children,
4612
- "\""
4613
- ]
4614
- })
4615
- });
4616
- return /* @__PURE__ */ jsxs("span", {
4617
- ...rest,
4618
- children: [
4619
- "\"",
4620
- children,
4621
- "\""
4622
- ]
4623
- });
4624
- } })]
4625
- });
4215
+ className: twMerge("relative size-full overflow-hidden", color ? "bg-(--ph-pane-bg) dark:bg-(--ph-pane-bg-dark)" : "bg-background", props.className),
4216
+ style,
4217
+ children: [background?.layers.map((layer, index) => /* @__PURE__ */ jsx(BackgroundLayer, { layer }, index)), props.children]
4218
+ });
4219
+ }
4220
+ function BackgroundLayer({ layer }) {
4221
+ const { light, dark } = imageVariants(layer.src);
4222
+ const style = layerStyle(layer);
4223
+ if (!dark) return /* @__PURE__ */ jsx("img", {
4224
+ src: light,
4225
+ alt: "",
4226
+ style
4227
+ });
4228
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("img", {
4229
+ src: light,
4230
+ alt: "",
4231
+ style,
4232
+ className: "dark:hidden"
4233
+ }), /* @__PURE__ */ jsx("img", {
4234
+ src: dark,
4235
+ alt: "",
4236
+ style,
4237
+ className: "hidden dark:block"
4238
+ })] });
4626
4239
  }
4627
4240
  //#endregion
4628
4241
  //#region src/connect/components/home-screen/home-background-image.tsx
4242
+ /** The default home-screen gradient. A custom `src` is kept for callers that
4243
+ * still pass one, sized to its box; HomeScreen itself renders custom images
4244
+ * as a hero below the drive tiles instead. */
4629
4245
  const HomeBackgroundImage = ({ src } = {}) => {
4630
4246
  if (src) return /* @__PURE__ */ jsx("picture", {
4631
- className: "pointer-events-none absolute inset-8 z-0 size-[calc(100%-32px)] object-contain",
4247
+ className: "pointer-events-none absolute inset-8 z-0",
4632
4248
  children: /* @__PURE__ */ jsx("img", {
4633
4249
  src,
4634
- alt: "background",
4635
- className: "object-contain"
4250
+ alt: "",
4251
+ className: "size-full object-contain"
4636
4252
  })
4637
4253
  });
4638
4254
  return /* @__PURE__ */ jsx("div", {
@@ -4721,10 +4337,15 @@ const HomeBackgroundImage = ({ src } = {}) => {
4721
4337
  //#endregion
4722
4338
  //#region src/connect/components/home-screen/home-screen-item.tsx
4723
4339
  const HomeScreenItem = function HomeScreenItem(props) {
4724
- const { icon, title, description, containerClassName, shareable, onClick } = props;
4725
- return /* @__PURE__ */ jsxs("div", {
4340
+ const { icon, title, description, containerClassName, shareable, href, onClick, onPreload } = props;
4341
+ return /* @__PURE__ */ jsxs(href ? "a" : "div", {
4342
+ href,
4343
+ "aria-current": href ? props["aria-current"] : void 0,
4726
4344
  className: twMerge("relative flex h-24 w-40 cursor-pointer flex-col items-center justify-center overflow-hidden rounded-md p-2 text-center text-sm text-foreground hover:hover-effect", containerClassName, onClick && "cursor-pointer"),
4727
4345
  onClick,
4346
+ onMouseEnter: onPreload,
4347
+ onTouchStart: onPreload,
4348
+ onFocus: href ? onPreload : void 0,
4728
4349
  children: [
4729
4350
  /* @__PURE__ */ jsx("div", {
4730
4351
  className: "mx-auto pb-2",
@@ -4774,13 +4395,19 @@ const HomeScreenAddDriveItem = function HomeScreenAddDriveItem(props) {
4774
4395
  //#endregion
4775
4396
  //#region src/connect/components/home-screen/home-screen.tsx
4776
4397
  const HomeScreen = function HomeScreen(props) {
4777
- const { children, containerClassName, homeBackground } = props;
4778
- return /* @__PURE__ */ jsx("div", {
4779
- className: twMerge("relative container mx-auto flex h-full flex-col", containerClassName),
4780
- children: /* @__PURE__ */ jsxs("div", {
4781
- className: "m-8 flex flex-wrap justify-center gap-4 bg-background pt-12",
4782
- children: [/* @__PURE__ */ jsx(HomeBackgroundImage, { src: homeBackground ?? void 0 }), children]
4783
- })
4398
+ const { children, containerClassName } = props;
4399
+ const background = normalizeBackground(props.homeBackground);
4400
+ const content = /* @__PURE__ */ jsxs("div", {
4401
+ className: twMerge("relative isolate container mx-auto flex h-full flex-col", containerClassName),
4402
+ children: [!background && /* @__PURE__ */ jsx(HomeBackgroundImage, {}), /* @__PURE__ */ jsx("div", {
4403
+ className: twMerge("relative z-10 m-8 flex flex-wrap justify-center gap-4 pt-12", background && "rounded-2xl bg-background/75 px-6 pb-6 backdrop-blur-sm"),
4404
+ children
4405
+ })]
4406
+ });
4407
+ if (!background) return content;
4408
+ return /* @__PURE__ */ jsx(BackgroundLayers, {
4409
+ background,
4410
+ children: content
4784
4411
  });
4785
4412
  };
4786
4413
  //#endregion
@@ -5181,7 +4808,8 @@ function AddDriveModal(props) {
5181
4808
  //#region src/connect/components/modal/create-document-modal.tsx
5182
4809
  const CLOSE_ANIMATION_DURATION$1 = 300;
5183
4810
  function CreateDocumentModal(props) {
5184
- const { onOpenChange, onContinue, overlayProps, contentProps, ...restProps } = props;
4811
+ const { onOpenChange, onContinue, overlayProps, contentProps, drives, driveId, onDriveChange, onAddDrive, ...restProps } = props;
4812
+ const needsDrive = !!drives && !driveId;
5185
4813
  const [nodeName, setNodeName] = useState("");
5186
4814
  const [isValid, setIsValid] = useState(false);
5187
4815
  const handleCancel = () => {
@@ -5189,11 +4817,12 @@ function CreateDocumentModal(props) {
5189
4817
  setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION$1);
5190
4818
  };
5191
4819
  const handleCreate = useCallback(() => {
5192
- if (!isValid) return;
4820
+ if (!isValid || needsDrive) return;
5193
4821
  onContinue(nodeName);
5194
4822
  setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION$1);
5195
4823
  }, [
5196
4824
  isValid,
4825
+ needsDrive,
5197
4826
  nodeName,
5198
4827
  onContinue
5199
4828
  ]);
@@ -5220,20 +4849,51 @@ function CreateDocumentModal(props) {
5220
4849
  }),
5221
4850
  /* @__PURE__ */ jsxs("div", {
5222
4851
  className: "my-6",
5223
- children: [!isValid && nodeName && /* @__PURE__ */ jsx("div", {
5224
- className: "mb-2 text-destructive",
5225
- children: "Document name must not be empty or contain control characters."
5226
- }), /* @__PURE__ */ jsx(FormInput, {
5227
- icon: /* @__PURE__ */ jsx(Icon, { name: "BrickGlobe" }),
5228
- onChange: (e) => {
5229
- const name = e.target.value;
5230
- setNodeName(name);
5231
- setIsValid(isValidName(name));
5232
- },
5233
- placeholder: "Document name",
5234
- required: true,
5235
- value: nodeName
5236
- })]
4852
+ children: [
4853
+ !isValid && nodeName && /* @__PURE__ */ jsx("div", {
4854
+ className: "mb-2 text-destructive",
4855
+ children: "Document name must not be empty or contain control characters."
4856
+ }),
4857
+ /* @__PURE__ */ jsx(FormInput, {
4858
+ icon: /* @__PURE__ */ jsx(Icon, { name: "BrickGlobe" }),
4859
+ onChange: (e) => {
4860
+ const name = e.target.value;
4861
+ setNodeName(name);
4862
+ setIsValid(isValidName(name));
4863
+ },
4864
+ placeholder: "Document name",
4865
+ required: true,
4866
+ value: nodeName
4867
+ }),
4868
+ !!drives?.length && /* @__PURE__ */ jsxs("label", {
4869
+ className: "mt-4 flex flex-col gap-1 text-sm text-muted-foreground",
4870
+ children: ["Drive", /* @__PURE__ */ jsxs("select", {
4871
+ className: "rounded-md border border-border bg-background px-3 py-2 text-foreground",
4872
+ value: driveId ?? "",
4873
+ onChange: (e) => onDriveChange?.(e.target.value),
4874
+ children: [!driveId && /* @__PURE__ */ jsx("option", {
4875
+ value: "",
4876
+ children: "Choose a drive"
4877
+ }), drives.map((drive) => /* @__PURE__ */ jsx("option", {
4878
+ value: drive.id,
4879
+ children: drive.name
4880
+ }, drive.id))]
4881
+ })]
4882
+ }),
4883
+ drives?.length === 0 && /* @__PURE__ */ jsxs("p", {
4884
+ className: "mt-4 text-sm text-muted-foreground",
4885
+ children: [
4886
+ "There's no drive to create it in.",
4887
+ " ",
4888
+ onAddDrive && /* @__PURE__ */ jsx("button", {
4889
+ type: "button",
4890
+ className: "cursor-pointer text-foreground underline",
4891
+ onClick: onAddDrive,
4892
+ children: "Add a drive"
4893
+ })
4894
+ ]
4895
+ })
4896
+ ]
5237
4897
  }),
5238
4898
  /* @__PURE__ */ jsxs("div", {
5239
4899
  className: "mt-8 flex justify-between gap-3",
@@ -5245,7 +4905,7 @@ function CreateDocumentModal(props) {
5245
4905
  }), /* @__PURE__ */ jsx(ModalButton, {
5246
4906
  variant: "confirm",
5247
4907
  type: "submit",
5248
- disabled: !isValid,
4908
+ disabled: !isValid || needsDrive,
5249
4909
  children: "Create"
5250
4910
  })]
5251
4911
  })
@@ -5419,169 +5079,12 @@ function ConnectDeleteItemModal(props) {
5419
5079
  });
5420
5080
  }
5421
5081
  //#endregion
5422
- //#region src/connect/components/form/inputs/drive-name-input.tsx
5423
- const DriveNameInput = /*#__PURE__*/ forwardRef(function DriveNameInput(props, ref) {
5424
- return /* @__PURE__ */ jsx(FormInput, {
5425
- ...props,
5426
- icon: props.icon ?? /* @__PURE__ */ jsx(Icon, { name: "Drive" }),
5427
- id: "driveName",
5428
- placeholder: "Drive name",
5429
- ref
5430
- });
5431
- });
5432
- //#endregion
5433
- //#region src/connect/components/form/inputs/delete-drive.tsx
5434
- function DeleteDrive(props) {
5435
- const { drive, handleDeleteDrive, onCancel } = props;
5436
- const [driveNameInput, setDriveNameInput] = useState("");
5437
- const isAllowedToDelete = driveNameInput === drive.header.name;
5438
- function deleteDrive() {
5439
- if (isAllowedToDelete) handleDeleteDrive();
5440
- }
5441
- return /* @__PURE__ */ jsxs("div", { children: [
5442
- /* @__PURE__ */ jsx("p", {
5443
- className: "mb-2 rounded-md bg-background p-4 text-center text-foreground",
5444
- children: "Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?"
5445
- }),
5446
- /* @__PURE__ */ jsx(DriveNameInput, {
5447
- icon: /* @__PURE__ */ jsx(Icon, { name: "Lock" }),
5448
- onChange: (event) => setDriveNameInput(event.target.value),
5449
- placeholder: "Enter drive name...",
5450
- value: driveNameInput
5451
- }),
5452
- /* @__PURE__ */ jsxs("div", {
5453
- className: "flex gap-3",
5454
- children: [/* @__PURE__ */ jsx(PowerhouseButton, {
5455
- className: "w-full",
5456
- color: "light",
5457
- onClick: onCancel,
5458
- children: "Cancel"
5459
- }), /* @__PURE__ */ jsx(PowerhouseButton, {
5460
- className: "w-full",
5461
- color: "red",
5462
- disabled: !isAllowedToDelete,
5463
- onClick: deleteDrive,
5464
- children: "Delete"
5465
- })]
5466
- })
5467
- ] });
5468
- }
5469
- //#endregion
5470
- //#region src/connect/components/form/inputs/sharing-type-form-input.tsx
5471
- function SharingTypeFormInput(props) {
5472
- const { control, ...delegatedProps } = props;
5473
- return /* @__PURE__ */ jsx(Controller, {
5474
- control,
5475
- name: "sharingType",
5476
- render: ({ field }) => /* @__PURE__ */ jsx(ConnectSelect, {
5477
- ...delegatedProps,
5478
- ...field,
5479
- id: "sharingType",
5480
- items: sharingTypeOptions
5481
- })
5482
- });
5483
- }
5484
- //#endregion
5485
5082
  //#region src/connect/components/form/drive-settings-form.tsx
5486
- function DriveSettingsForm(props) {
5487
- const { drive, sharingType, availableOffline, systemInfo, onSubmit, handleDeleteDrive } = props;
5488
- const name = drive.header.name;
5489
- const [showLocationSettings, setShowLocationSettings] = useState(false);
5490
- const [showAbout, setShowAbout] = useState(false);
5491
- const [showDangerZone, setShowDangerZone] = useState(false);
5492
- const [showDeleteDrive, setShowDeleteDrive] = useState(false);
5493
- const { register, handleSubmit, control } = useForm({
5494
- mode: "onBlur",
5495
- defaultValues: {
5496
- name,
5497
- sharingType,
5498
- availableOffline
5499
- }
5500
- });
5501
- const location = sharingType === "PUBLIC" ? "SWITCHBOARD" : sharingType;
5502
- return /* @__PURE__ */ jsxs("form", {
5503
- onSubmit: (e) => void handleSubmit(onSubmit)(e),
5504
- children: [
5505
- /* @__PURE__ */ jsx(DriveNameInput, { ...register("name") }),
5506
- /* @__PURE__ */ jsx(Divider, { className: "my-4" }),
5507
- /* @__PURE__ */ jsx(Label, {
5508
- htmlFor: "sharingType",
5509
- children: "Sharing settings"
5510
- }),
5511
- /* @__PURE__ */ jsx(SharingTypeFormInput, { control }),
5512
- /* @__PURE__ */ jsx(Divider, { className: "my-3" }),
5513
- /* @__PURE__ */ jsxs(Disclosure, {
5514
- isOpen: showLocationSettings,
5515
- onOpenChange: () => setShowLocationSettings(!showLocationSettings),
5516
- title: "Location",
5517
- children: [/* @__PURE__ */ jsx(LocationInfo, { location }), /* @__PURE__ */ jsx(AvailableOfflineToggle, { ...register("availableOffline") })]
5518
- }),
5519
- /* @__PURE__ */ jsx(Divider, { className: "my-3" }),
5520
- /* @__PURE__ */ jsxs(Disclosure, {
5521
- isOpen: showAbout,
5522
- onOpenChange: () => setShowAbout(!showAbout),
5523
- title: "About this drive",
5524
- children: [
5525
- systemInfo.status === "local" && /* @__PURE__ */ jsx("p", {
5526
- className: "py-2 text-sm text-muted-foreground",
5527
- children: "Local drive — N/A"
5528
- }),
5529
- systemInfo.status === "loading" && /* @__PURE__ */ jsx("p", {
5530
- className: "py-2 text-sm text-muted-foreground",
5531
- children: "Loading…"
5532
- }),
5533
- systemInfo.status === "error" && /* @__PURE__ */ jsx("p", {
5534
- className: "py-2 text-sm text-destructive",
5535
- children: "Could not load system info"
5536
- }),
5537
- systemInfo.status === "ready" && /* @__PURE__ */ jsxs("div", {
5538
- className: "py-2 text-sm text-foreground",
5539
- children: [/* @__PURE__ */ jsxs("div", { children: [
5540
- /* @__PURE__ */ jsx("span", {
5541
- className: "font-medium",
5542
- children: "Version:"
5543
- }),
5544
- " ",
5545
- systemInfo.version
5546
- ] }), /* @__PURE__ */ jsxs("div", { children: [
5547
- /* @__PURE__ */ jsx("span", {
5548
- className: "font-medium",
5549
- children: "Git hash:"
5550
- }),
5551
- " ",
5552
- systemInfo.gitHash
5553
- ] })]
5554
- })
5555
- ]
5556
- }),
5557
- /* @__PURE__ */ jsx(Divider, { className: "my-3" }),
5558
- /* @__PURE__ */ jsx(Disclosure, {
5559
- isOpen: showDangerZone,
5560
- onOpenChange: () => setShowDangerZone(!showDangerZone),
5561
- title: "Danger zone",
5562
- children: /* @__PURE__ */ jsxs("button", {
5563
- className: "flex gap-2 py-3 font-semibold text-destructive transition hover:hover-effect",
5564
- onClick: () => setShowDeleteDrive(true),
5565
- type: "button",
5566
- children: [/* @__PURE__ */ jsx(Icon, { name: "Trash" }), "Delete drive"]
5567
- })
5568
- }),
5569
- showDeleteDrive && showDangerZone ? /* @__PURE__ */ jsx(DeleteDrive, {
5570
- drive,
5571
- handleDeleteDrive,
5572
- onCancel: () => setShowDeleteDrive(false)
5573
- }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Divider, { className: "my-3" }), /* @__PURE__ */ jsx(PowerhouseButton, {
5574
- className: "mb-4 w-full",
5575
- type: "submit",
5576
- children: "Confirm"
5577
- })] })
5578
- ]
5579
- });
5580
- }
5083
+ const DriveSettingsForm = lazyComponent(() => import("../drive-settings-form.impl-yV9u4h5c.js").then((m) => m.DriveSettingsForm));
5581
5084
  //#endregion
5582
5085
  //#region src/connect/components/modal/drive-settings-modal.tsx
5583
5086
  function DriveSettingsModal(props) {
5584
- const { drive, open, sharingType, availableOffline, systemInfo, onOpenChange, onDeleteDrive, onRenameDrive, onChangeSharingType, onChangeAvailableOffline, modalProps, containerProps } = props;
5087
+ const { drive, open, sharingType, availableOffline, systemInfo, onOpenChange, onDeleteDrive, onRenameDrive, onChangeSharingType, onChangeAvailableOffline, modalProps, containerProps, children } = props;
5585
5088
  const onSubmit = (data) => {
5586
5089
  if (data.name !== drive.header.name) onRenameDrive(drive, data.name);
5587
5090
  if (data.sharingType !== sharingType) onChangeSharingType(drive, data.sharingType);
@@ -5628,7 +5131,8 @@ function DriveSettingsModal(props) {
5628
5131
  drive,
5629
5132
  sharingType,
5630
5133
  availableOffline,
5631
- systemInfo
5134
+ systemInfo,
5135
+ children
5632
5136
  })
5633
5137
  ]
5634
5138
  })
@@ -8204,28 +7708,8 @@ function LocalStorage(props) {
8204
7708
  }
8205
7709
  //#endregion
8206
7710
  //#region src/connect/components/modal/settings-modal-v2/default-editor.tsx
8207
- function DefaultEditor(props) {
8208
- const { className, ...rest } = props;
8209
- return /* @__PURE__ */ jsx("div", {
8210
- className: twMerge("rounded-lg bg-background p-3", className),
8211
- children: /* @__PURE__ */ jsx(DefaultEditorSelect, { ...rest })
8212
- });
8213
- }
8214
- function DefaultEditorSelect(props) {
8215
- const { documentModelEditor, setDocumentModelEditor, documentModelEditorOptions, className } = props;
8216
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
8217
- className: "mb-4 font-semibold text-foreground",
8218
- children: "Default Editor Selection"
8219
- }), /* @__PURE__ */ jsx(SelectFieldRaw, {
8220
- className: twMerge("max-w-fit min-w-36", className),
8221
- name: "default-editor",
8222
- required: true,
8223
- value: documentModelEditor,
8224
- options: documentModelEditorOptions,
8225
- multiple: false,
8226
- onChange: (value) => setDocumentModelEditor(value)
8227
- })] });
8228
- }
7711
+ const DefaultEditor = lazyComponent(() => import("../default-editor.impl-a6EOuEme.js").then((m) => m.DefaultEditor));
7712
+ const DefaultEditorSelect = lazyComponent(() => import("../default-editor.impl-a6EOuEme.js").then((m) => m.DefaultEditorSelect));
8229
7713
  //#endregion
8230
7714
  //#region src/connect/components/modal/settings-modal-v2/package-manager/parse-package-spec.ts
8231
7715
  /**
@@ -9163,681 +8647,8 @@ function ConnectUpgradeDriveModal(props) {
9163
8647
  });
9164
8648
  }
9165
8649
  //#endregion
9166
- //#region src/connect/components/revision-history/header/branch.tsx
9167
- function Branch(props) {
9168
- const { branch = "main" } = props;
9169
- return /* @__PURE__ */ jsxs("button", {
9170
- className: "flex h-8 w-fit items-center gap-1 rounded-lg bg-background pr-2 pl-1 text-xs text-foreground",
9171
- children: [
9172
- /* @__PURE__ */ jsx(Icon, { name: "Branch" }),
9173
- /* @__PURE__ */ jsx("span", { children: "BRANCH" }),
9174
- /* @__PURE__ */ jsx("span", {
9175
- className: "text-foreground",
9176
- children: branch
9177
- })
9178
- ]
9179
- });
9180
- }
9181
- //#endregion
9182
- //#region src/connect/components/revision-history/header/doc-id.tsx
9183
- function DocId(props) {
9184
- const { docId, onCopy } = props;
9185
- const [, copy] = useCopyToClipboard();
9186
- function handleCopy(text) {
9187
- return () => {
9188
- copy(text).then(() => {
9189
- onCopy?.();
9190
- }).catch((error) => {
9191
- console.error("Failed to copy!", error);
9192
- });
9193
- };
9194
- }
9195
- return /* @__PURE__ */ jsxs("button", {
9196
- className: "flex h-8 w-fit items-center gap-1 rounded-lg bg-background pr-2 pl-1 text-xs text-foreground",
9197
- onClick: handleCopy(docId),
9198
- children: [
9199
- /* @__PURE__ */ jsx(Icon, { name: "Link" }),
9200
- "DOC ID",
9201
- /* @__PURE__ */ jsx("span", {
9202
- className: "text-foreground",
9203
- children: docId
9204
- })
9205
- ]
9206
- });
9207
- }
9208
- //#endregion
9209
- //#region src/connect/components/revision-history/header/document-state.tsx
9210
- const DocumentState = (props) => {
9211
- const { documentState, onCopyState } = props;
9212
- const [, copy] = useCopyToClipboard();
9213
- function handleCopy() {
9214
- const jsonState = JSON.stringify(documentState, null, 2);
9215
- copy(jsonState).then(() => {
9216
- onCopyState?.();
9217
- }).catch((error) => {
9218
- console.error("Failed to copy document state!", error);
9219
- });
9220
- }
9221
- return /* @__PURE__ */ jsx("button", {
9222
- className: "rounded-lg bg-background p-1 text-foreground",
9223
- onClick: handleCopy,
9224
- children: /* @__PURE__ */ jsx(Icon, { name: "CurlyBrackets" })
9225
- });
9226
- };
9227
- //#endregion
9228
- //#region src/connect/components/revision-history/header/scope.tsx
9229
- function labelFor(scope) {
9230
- return `${scope.charAt(0).toUpperCase()}${scope.slice(1)} scope`;
9231
- }
9232
- function Scope(props) {
9233
- const { scopes, value, onChange } = props;
9234
- const items = scopes.map((scope) => ({
9235
- displayValue: labelFor(scope),
9236
- value: scope
9237
- }));
9238
- return /* @__PURE__ */ jsx(ConnectSelect, {
9239
- absolutePositionMenu: true,
9240
- containerClassName: "z-10 w-fit rounded-lg bg-background text-xs text-muted-foreground",
9241
- id: "scope select",
9242
- itemClassName: "grid grid-cols-[auto,auto] gap-1 py-2 text-muted-foreground",
9243
- items,
9244
- menuClassName: "min-w-0 text-muted-foreground",
9245
- onChange,
9246
- value
9247
- });
9248
- }
9249
- //#endregion
9250
- //#region src/connect/components/revision-history/header/header.tsx
9251
- function Header(props) {
9252
- const { title, docId, scope, scopes, onChangeScope, onClose, className, documentState, onCopyState, onCopyDocId, ...divProps } = props;
9253
- return /* @__PURE__ */ jsxs("header", {
9254
- className: twMerge("flex items-center justify-between bg-transparent", className),
9255
- ...divProps,
9256
- children: [/* @__PURE__ */ jsxs("div", {
9257
- className: "flex items-center gap-3",
9258
- children: [/* @__PURE__ */ jsx("button", {
9259
- name: "close-revision-history",
9260
- className: "rounded-lg bg-background p-1 text-foreground shadow-button",
9261
- onClick: onClose,
9262
- children: /* @__PURE__ */ jsx(Icon, { name: "VariantArrowLeft" })
9263
- }), /* @__PURE__ */ jsx("h1", {
9264
- className: "text-xs text-foreground",
9265
- children: title
9266
- })]
9267
- }), /* @__PURE__ */ jsxs("div", {
9268
- className: "flex items-center gap-2",
9269
- children: [
9270
- /* @__PURE__ */ jsx(DocId, {
9271
- docId,
9272
- onCopy: onCopyDocId
9273
- }),
9274
- documentState && /* @__PURE__ */ jsx(DocumentState, {
9275
- documentState,
9276
- onCopyState
9277
- }),
9278
- /* @__PURE__ */ jsx(Branch, {}),
9279
- /* @__PURE__ */ jsx(Scope, {
9280
- onChange: onChangeScope,
9281
- scopes,
9282
- value: scope
9283
- })
9284
- ]
9285
- })]
9286
- });
9287
- }
9288
- //#endregion
9289
- //#region src/connect/hooks/use-ens.ts
9290
- const ensCache = /* @__PURE__ */ new Map();
9291
- function fetchEns(address) {
9292
- const cached = ensCache.get(address);
9293
- if (cached) return cached;
9294
- const promise = fetch(`https://api.ensdata.net/${address}`).then((res) => {
9295
- if (!res.ok) throw new Error(`ENS lookup failed: ${res.status}`);
9296
- return res.json();
9297
- }).catch((err) => {
9298
- ensCache.delete(address);
9299
- throw err instanceof Error ? err : /* @__PURE__ */ new Error("ENS lookup failed");
9300
- });
9301
- ensCache.set(address, promise);
9302
- return promise;
9303
- }
9304
- function useEns(address) {
9305
- const [data, setData] = useState();
9306
- const [isLoading, setIsLoading] = useState(false);
9307
- const [error, setError] = useState();
9308
- useEffect(() => {
9309
- if (!address) {
9310
- setData(void 0);
9311
- setError(void 0);
9312
- return;
9313
- }
9314
- let cancelled = false;
9315
- setIsLoading(true);
9316
- setError(void 0);
9317
- fetchEns(address).then((json) => {
9318
- if (cancelled) return;
9319
- setData(json);
9320
- }).catch((err) => {
9321
- if (cancelled) return;
9322
- setError(err instanceof Error ? err : /* @__PURE__ */ new Error("ENS lookup failed"));
9323
- }).finally(() => {
9324
- if (cancelled) return;
9325
- setIsLoading(false);
9326
- });
9327
- return () => {
9328
- cancelled = true;
9329
- };
9330
- }, [address]);
9331
- return {
9332
- data,
9333
- isLoading,
9334
- error
9335
- };
9336
- }
9337
- //#endregion
9338
- //#region src/connect/utils/address.ts
9339
- function formatEthAddress(address) {
9340
- return `${address.slice(0, 7)}...${address.slice(-5)}`;
9341
- }
9342
- //#endregion
9343
- //#region src/connect/components/code-popover.tsx
9344
- function CodePopover(props) {
9345
- const { content, trigger, anchor } = props;
9346
- const [isOpen, setIsOpen] = useState(false);
9347
- const opener = funnel(() => setIsOpen(true), {
9348
- triggerAt: "start",
9349
- minQuietPeriodMs: 300
9350
- });
9351
- const closer = funnel(() => setIsOpen(false), {
9352
- triggerAt: "start",
9353
- minQuietPeriodMs: 100
9354
- });
9355
- function open() {
9356
- closer.cancel();
9357
- opener.call();
9358
- }
9359
- function close() {
9360
- opener.cancel();
9361
- closer.call();
9362
- }
9363
- return /* @__PURE__ */ jsxs(Root$1, {
9364
- open: isOpen,
9365
- onOpenChange: (changedIsOpen) => changedIsOpen ? open() : close(),
9366
- children: [
9367
- /* @__PURE__ */ jsx(Trigger$1, {
9368
- onMouseEnter: open,
9369
- children: trigger
9370
- }),
9371
- !!anchor && /* @__PURE__ */ jsx(Anchor, {
9372
- asChild: true,
9373
- children: anchor
9374
- }),
9375
- /* @__PURE__ */ jsx(Portal$1, { children: /* @__PURE__ */ jsx(Content$1, {
9376
- forceMount: true,
9377
- onMouseLeave: close,
9378
- sideOffset: -28,
9379
- onCloseAutoFocus: (e) => e.preventDefault(),
9380
- collisionPadding: {
9381
- top: 24,
9382
- right: 24,
9383
- bottom: -1e4,
9384
- left: 24
9385
- },
9386
- className: "z-50 rounded-lg border border-border bg-popover p-2 text-xs text-popover-foreground shadow-tooltip outline-none",
9387
- children: content
9388
- }) })
9389
- ]
9390
- });
9391
- }
9392
- //#endregion
9393
- //#region src/connect/components/revision-history/revision/address.tsx
9394
- function Address(props) {
9395
- const { address, chainId } = props;
9396
- const { data: ensData } = useEns(address);
9397
- if (!address) return null;
9398
- const shortenedAddress = formatEthAddress(address);
9399
- return /* @__PURE__ */ jsx(CodePopover, {
9400
- content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: { address } }),
9401
- trigger: /* @__PURE__ */ jsxs("span", {
9402
- className: "flex w-fit cursor-pointer items-center gap-1 rounded-lg bg-muted p-1 text-xs text-muted-foreground",
9403
- children: [/* @__PURE__ */ jsx(ENSAvatar, {
9404
- address,
9405
- chainId,
9406
- avatarUrl: ensData?.avatar_url ?? void 0
9407
- }), shortenedAddress]
9408
- })
9409
- });
9410
- }
9411
- //#endregion
9412
- //#region src/connect/components/revision-history/revision/errors.tsx
9413
- function Errors(props) {
9414
- const { errors } = props;
9415
- const hasErrors = !!errors?.length;
9416
- const color = hasErrors ? "text-destructive" : "text-success";
9417
- const icon = hasErrors ? /* @__PURE__ */ jsx(Icon, {
9418
- name: "Exclamation",
9419
- size: 16
9420
- }) : /* @__PURE__ */ jsx(Icon, {
9421
- name: "Check",
9422
- size: 16
9423
- });
9424
- const text = hasErrors ? `Error: ${errors[0]}` : "No errors";
9425
- const content = /* @__PURE__ */ jsxs("span", {
9426
- className: twMerge("flex w-fit items-center rounded-lg border border-border bg-background px-2 py-1 text-xs", color, hasErrors && "cursor-pointer"),
9427
- children: [icon, /* @__PURE__ */ jsx("span", {
9428
- className: twMerge("inline-block max-w-36 truncate"),
9429
- children: text
9430
- })]
9431
- });
9432
- if (hasErrors) return /* @__PURE__ */ jsx(CodePopover, {
9433
- content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: errors }),
9434
- trigger: content
9435
- });
9436
- return content;
9437
- }
9438
- //#endregion
9439
- //#region src/connect/components/revision-history/revision/operation.tsx
9440
- function Operation$1(props) {
9441
- const { operationType, operationInput } = props;
9442
- return /* @__PURE__ */ jsx(CodePopover, {
9443
- content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: operationInput }),
9444
- trigger: /* @__PURE__ */ jsxs("span", {
9445
- className: "flex cursor-pointer items-center gap-2 text-xs text-foreground",
9446
- children: [operationType, /* @__PURE__ */ jsx(Icon, {
9447
- className: "text-foreground",
9448
- name: "Braces",
9449
- size: 16
9450
- })]
9451
- })
9452
- });
9453
- }
9454
- //#endregion
9455
- //#region src/connect/components/revision-history/revision/revision-number.tsx
9456
- function RevisionNumber(props) {
9457
- const { operationIndex, eventId, stateHash } = props;
9458
- const revisionNumber = operationIndex + 1;
9459
- return /* @__PURE__ */ jsx(CodePopover, {
9460
- content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: {
9461
- revisionNumber,
9462
- eventId,
9463
- stateHash
9464
- } }),
9465
- trigger: /* @__PURE__ */ jsxs("span", {
9466
- className: "flex cursor-pointer items-center gap-2 text-xs text-foreground",
9467
- children: [
9468
- "Revision ",
9469
- revisionNumber,
9470
- ".",
9471
- /* @__PURE__ */ jsx("a", { children: /* @__PURE__ */ jsx(Icon, {
9472
- className: "cursor-pointer text-foreground",
9473
- name: "Ellipsis",
9474
- size: 14
9475
- }) })
9476
- ]
9477
- })
9478
- });
9479
- }
9480
- //#endregion
9481
- //#region src/connect/components/revision-history/revision/signature.tsx
9482
- function Signature(props) {
9483
- const { signatures } = props;
9484
- if (!signatures?.length) return null;
9485
- return /* @__PURE__ */ jsx(CodePopover, {
9486
- trigger: /* @__PURE__ */ jsxs("span", {
9487
- className: "flex w-fit cursor-pointer items-center gap-1 rounded-lg border border-border bg-background px-2 py-1",
9488
- children: [
9489
- /* @__PURE__ */ jsx(VerificationStatus, { signatures }),
9490
- " ",
9491
- /* @__PURE__ */ jsx(Icon, {
9492
- className: "text-foreground",
9493
- name: "InfoSquare",
9494
- size: 16
9495
- })
9496
- ]
9497
- }),
9498
- content: /* @__PURE__ */ jsx(FormattedJsonViewer, {
9499
- value: signatures,
9500
- collapsed: 1
9501
- })
9502
- });
9503
- }
9504
- function VerificationStatus(props) {
9505
- const { signatures } = props;
9506
- if (!signatures?.length) return null;
9507
- const signatureCount = signatures.length;
9508
- const verifiedSignaturesCount = signatures.filter((signature) => signature.isVerified).length;
9509
- const verificationStatusText = `${verifiedSignaturesCount}/${signatureCount} ${signatureCount === 1 ? "signature" : "signatures"} verified`;
9510
- return /* @__PURE__ */ jsx("span", {
9511
- className: twMerge(`text-xs`, verifiedSignaturesCount === 0 ? "text-destructive" : verifiedSignaturesCount === signatureCount ? "text-success" : "text-warning"),
9512
- children: verificationStatusText
9513
- });
9514
- }
9515
- //#endregion
9516
- //#region src/connect/components/revision-history/revision/timestamp.tsx
9517
- function Timestamp(props) {
9518
- const { timestampUtcMs: timestamp } = props;
9519
- const timestampNumber = typeof timestamp === "string" && !timestamp.includes("-") ? parseInt(timestamp) : timestamp;
9520
- const date = new Date(timestampNumber);
9521
- const shortDate = format(date, "HH:mm 'UTC'");
9522
- const longDate = format(date, "eee, dd MMM yyyy HH:mm:ss 'UTC'");
9523
- return /* @__PURE__ */ jsx(CodePopover, {
9524
- content: /* @__PURE__ */ jsx(FormattedJsonViewer, { value: {
9525
- timestampFormatted: longDate,
9526
- timestampUtcMs: timestamp
9527
- } }),
9528
- trigger: /* @__PURE__ */ jsxs("span", {
9529
- className: "cursor-pointer text-xs text-foreground",
9530
- children: ["committed at ", shortDate]
9531
- })
9532
- });
9533
- }
9534
- //#endregion
9535
- //#region src/connect/components/revision-history/revision/revision.tsx
9536
- function _Revision(props) {
9537
- return /* @__PURE__ */ jsxs("article", {
9538
- className: "flex items-center justify-between rounded-xl border border-border bg-background px-4 py-2",
9539
- children: [/* @__PURE__ */ jsxs("div", {
9540
- className: "flex items-center gap-2",
9541
- children: [
9542
- /* @__PURE__ */ jsx(RevisionNumber, { ...props }),
9543
- /* @__PURE__ */ jsx(Operation$1, { ...props }),
9544
- /* @__PURE__ */ jsx(Address, { ...props }),
9545
- /* @__PURE__ */ jsx(Timestamp, { ...props })
9546
- ]
9547
- }), /* @__PURE__ */ jsxs("div", {
9548
- className: "flex items-center gap-1",
9549
- children: [/* @__PURE__ */ jsx(Signature, { ...props }), /* @__PURE__ */ jsx(Errors, { ...props })]
9550
- })]
9551
- });
9552
- }
9553
- const Revision = /*#__PURE__*/ memo(_Revision);
9554
- //#endregion
9555
- //#region src/connect/components/revision-history/skip/skip.tsx
9556
- function Skip(props) {
9557
- const { operationIndex, skipCount } = props;
9558
- const revisionNumber = operationIndex;
9559
- const skippedRevisions = skipCount === 1 ? `${revisionNumber}` : `${revisionNumber} - ${revisionNumber + 1 - skipCount}`;
9560
- return /* @__PURE__ */ jsxs("article", {
9561
- className: "grid grid-cols-[1fr,auto,1fr] items-center py-2",
9562
- children: [
9563
- /* @__PURE__ */ jsx("div", { className: "h-px rounded-full bg-muted" }),
9564
- /* @__PURE__ */ jsxs("div", {
9565
- className: "mx-3 text-xs text-foreground",
9566
- children: [
9567
- "[Skipped Revision ",
9568
- skippedRevisions,
9569
- "]"
9570
- ]
9571
- }),
9572
- /* @__PURE__ */ jsx("div", { className: "h-px rounded-full bg-muted" })
9573
- ]
9574
- });
9575
- }
9576
- //#endregion
9577
- //#region src/connect/components/revision-history/utils.ts
9578
- function makeRows(operations) {
9579
- const revisionsAndSkips = [];
9580
- const seenDays = /* @__PURE__ */ new Set();
9581
- for (const operation of operations) {
9582
- if (!operation.timestampUtcMs) continue;
9583
- const day = operation.timestampUtcMs.split("T")[0];
9584
- if (!seenDays.has(day)) {
9585
- seenDays.add(day);
9586
- revisionsAndSkips.push({
9587
- type: "day",
9588
- height: 32,
9589
- timestampUtcMs: day
9590
- });
9591
- }
9592
- revisionsAndSkips.push({
9593
- type: "revision",
9594
- height: 46,
9595
- operationIndex: operation.index,
9596
- eventId: operation.id ?? "EVENT_ID_NOT_FOUND",
9597
- stateHash: operation.hash,
9598
- operationType: operation.action.type,
9599
- operationInput: operation.action.input ?? {},
9600
- address: operation.action?.context?.signer?.user.address,
9601
- chainId: operation.action?.context?.signer?.user.chainId,
9602
- timestampUtcMs: operation.timestampUtcMs,
9603
- signatures: makeSignatures(operation.action?.context?.signer?.signatures ?? []),
9604
- errors: operation.error ? [operation.error] : void 0
9605
- });
9606
- if (operation.skip > 0) revisionsAndSkips.push({
9607
- type: "skip",
9608
- height: 34,
9609
- operationIndex: operation.index,
9610
- skipCount: operation.skip,
9611
- timestampUtcMs: operation.timestampUtcMs
9612
- });
9613
- }
9614
- return revisionsAndSkips;
9615
- }
9616
- function makeSignatureFromSignatureArray(signatureArray) {
9617
- const [signerAddress, hash, prevStateHash, signatureBytes] = signatureArray;
9618
- return {
9619
- signerAddress,
9620
- hash,
9621
- prevStateHash,
9622
- signatureBytes,
9623
- isVerified: true
9624
- };
9625
- }
9626
- function makeSignatures(signaturesArray) {
9627
- return signaturesArray?.map(makeSignatureFromSignatureArray);
9628
- }
9629
- //#endregion
9630
- //#region src/connect/components/revision-history/timeline/day.tsx
9631
- function Day(props) {
9632
- const { timestampUtcMs: timestamp } = props;
9633
- const formattedDate = format(timestamp, "MMM dd, yyyy");
9634
- return /* @__PURE__ */ jsxs("h2", {
9635
- className: "-ml-6 flex items-center gap-1 bg-background py-2 text-xs text-foreground",
9636
- children: [
9637
- /* @__PURE__ */ jsx(Icon, {
9638
- name: "Ring",
9639
- size: 16
9640
- }),
9641
- " Changes on ",
9642
- formattedDate
9643
- ]
9644
- });
9645
- }
9646
- //#endregion
9647
- //#region src/connect/components/revision-history/timeline/timeline.tsx
9648
- /** How far each row is indented from the timeline's vertical line. */
9649
- const ROW_INSET = 16;
9650
- /**
9651
- * How far the line is inset from the scroll container's clip edge -- exactly
9652
- * the amount the day marker hangs past it (24 pulled back from a 16 inset
9653
- * leaves 8 on the wrong side of zero). Without this the ring is sliced in
9654
- * half, since a scrolling box clips on both axes.
9655
- */
9656
- const DAY_MARKER_OVERHANG = 8;
9657
- /**
9658
- * The revision timeline, windowed by row.
9659
- *
9660
- * The scroll element and the content are deliberately two different
9661
- * elements. A virtualizer decides what is visible by comparing its scroll
9662
- * element's viewport against the total content size, so a scroll element
9663
- * sized to the content is a viewport that shows everything at once: it never
9664
- * scrolls, every row is "visible", and the whole page renders while still
9665
- * paying the virtualizer's bookkeeping. The outer element here is therefore
9666
- * bounded and scrollable, and the inner sizer carries the full height that
9667
- * the absolutely positioned rows are placed within.
9668
- */
9669
- function Timeline(props) {
9670
- const { operations, maxHeight = "70vh" } = props;
9671
- const rows = useMemo(() => makeRows([...operations]), [operations]);
9672
- const parentRef = useRef(null);
9673
- const rowVirtualizer = useVirtualizer({
9674
- count: rows.length,
9675
- getScrollElement: () => parentRef.current,
9676
- estimateSize: (i) => rows[i]?.height ?? 0,
9677
- gap: 8,
9678
- overscan: 8
9679
- });
9680
- return /* @__PURE__ */ jsx("div", {
9681
- "data-testid": "revision-timeline",
9682
- ref: parentRef,
9683
- style: {
9684
- maxHeight,
9685
- overflowY: "auto",
9686
- width: "100%",
9687
- position: "relative"
9688
- },
9689
- children: /* @__PURE__ */ jsx("div", {
9690
- className: "border-l border-border dark:border-none",
9691
- style: {
9692
- height: `${rowVirtualizer.getTotalSize()}px`,
9693
- marginLeft: DAY_MARKER_OVERHANG,
9694
- position: "relative"
9695
- },
9696
- children: rowVirtualizer.getVirtualItems().map((virtualRow) => {
9697
- const row = rows[virtualRow.index];
9698
- if (!row) return null;
9699
- return /* @__PURE__ */ jsxs("div", {
9700
- style: {
9701
- position: "absolute",
9702
- top: 0,
9703
- left: ROW_INSET,
9704
- right: 0,
9705
- height: `${virtualRow.size}px`,
9706
- transform: `translateY(${virtualRow.start}px)`
9707
- },
9708
- children: [
9709
- row.type === "revision" && /* @__PURE__ */ jsx(Revision, { ...row }),
9710
- row.type === "skip" && /* @__PURE__ */ jsx(Skip, { ...row }),
9711
- row.type === "day" && /* @__PURE__ */ jsx(Day, { ...row })
9712
- ]
9713
- }, virtualRow.key);
9714
- })
9715
- })
9716
- });
9717
- }
9718
- //#endregion
9719
8650
  //#region src/connect/components/revision-history/revision-history.tsx
9720
- /** The current, scoped props. */
9721
- /**
9722
- * Legacy props: the whole global and local history, toggled inside the
9723
- * component.
9724
- * @deprecated Pass one scope's `operations` with `scopes`/`scope`/`onScopeChange` and the loading props. Removed in the next major.
9725
- */
9726
- /**
9727
- * The revision history panel. Pages arrive oldest first while the timeline
9728
- * renders newest first, so rendering progressively would show operations in
9729
- * the wrong order until the last page landed and would repaint the whole
9730
- * timeline on every page in between. Instead the component keeps asking for
9731
- * the next page, showing "Loading operations…" and a running count, until
9732
- * the walk completes, then renders the pagination and timeline once.
9733
- */
9734
- function ScopedRevisionHistory(props) {
9735
- const { documentTitle, documentId, operations, isLoading, hasNextPage, onLoadNextPage, scopes, scope, onScopeChange, onClose, itemsPerPage = 100, documentState, onCopyState, onCopyDocId, error } = props;
9736
- useEffect(() => {
9737
- if (!hasNextPage || isLoading || error) return;
9738
- const handle = window.setTimeout(onLoadNextPage, 0);
9739
- return () => window.clearTimeout(handle);
9740
- }, [
9741
- hasNextPage,
9742
- isLoading,
9743
- onLoadNextPage,
9744
- error
9745
- ]);
9746
- const isWalking = !error && (hasNextPage || isLoading && operations.length === 0);
9747
- const visibleOperations = useMemo(() => isWalking ? [] : garbageCollect(sortOperations([...operations])).sort((a, b) => b.index - a.index), [operations, isWalking]);
9748
- const { pageItems, pages, goToPage, goToNextPage, goToPreviousPage, goToFirstPage, goToLastPage, hiddenNextPages, isNextPageAvailable, isPreviousPageAvailable } = usePagination(visibleOperations, { itemsPerPage });
9749
- function onChangeScope(nextScope) {
9750
- goToFirstPage();
9751
- onScopeChange(nextScope);
9752
- }
9753
- const PaginationComponent = visibleOperations.length > itemsPerPage ? /* @__PURE__ */ jsx("div", {
9754
- className: "mt-4 flex w-full justify-end",
9755
- children: /* @__PURE__ */ jsx(Pagination, {
9756
- firstPageLabel: "First Page",
9757
- goToFirstPage,
9758
- goToLastPage,
9759
- goToNextPage,
9760
- goToPage,
9761
- goToPreviousPage,
9762
- hiddenNextPages,
9763
- isNextPageAvailable,
9764
- isPreviousPageAvailable,
9765
- lastPageLabel: "Last Page",
9766
- nextPageLabel: "Next",
9767
- pages,
9768
- previousPageLabel: "Previous"
9769
- })
9770
- }) : /* @__PURE__ */ jsx("hr", { className: "h-12 border-none" });
9771
- const hasOperations = visibleOperations.length > 0;
9772
- return /* @__PURE__ */ jsx(ConnectTooltipProvider, { children: /* @__PURE__ */ jsxs("div", {
9773
- className: "p-6",
9774
- children: [/* @__PURE__ */ jsx(Header, {
9775
- docId: documentId,
9776
- onChangeScope,
9777
- onClose,
9778
- scope,
9779
- scopes,
9780
- title: documentTitle,
9781
- documentState,
9782
- onCopyState,
9783
- onCopyDocId
9784
- }), isWalking ? /* @__PURE__ */ jsxs("div", {
9785
- className: "mt-4 flex flex-col items-center rounded-md bg-background p-4",
9786
- children: [/* @__PURE__ */ jsx("h3", {
9787
- className: "my-40 text-foreground",
9788
- children: "Loading operations…"
9789
- }), operations.length > 0 && /* @__PURE__ */ jsxs("p", {
9790
- className: "text-xs text-muted-foreground",
9791
- children: [operations.length, " loaded so far"]
9792
- })]
9793
- }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
9794
- PaginationComponent,
9795
- /* @__PURE__ */ jsxs("div", {
9796
- className: "mt-4 flex flex-col items-center rounded-md bg-background p-4",
9797
- children: [error && /* @__PURE__ */ jsxs("p", {
9798
- className: "mb-2 text-xs text-destructive",
9799
- children: ["Could not load the rest of the history: ", error.message]
9800
- }), hasOperations ? /* @__PURE__ */ jsx("div", {
9801
- className: "grid grid-cols-[minmax(min-content,1018px)]",
9802
- children: /* @__PURE__ */ jsx(Timeline, { operations: pageItems })
9803
- }) : error ? null : /* @__PURE__ */ jsx("h3", {
9804
- className: "my-40 text-foreground",
9805
- children: "This document has no recorded operations yet."
9806
- })]
9807
- }),
9808
- PaginationComponent
9809
- ] })]
9810
- }) });
9811
- }
9812
- const LEGACY_SCOPES = ["global", "local"];
9813
- const noop = () => {};
9814
- /** Toggles between the whole global and local history loaded up front. */
9815
- function LegacyRevisionHistory(props) {
9816
- const { globalOperations, localOperations, ...common } = props;
9817
- const [scope, setScope] = useState("global");
9818
- return /* @__PURE__ */ jsx(ScopedRevisionHistory, {
9819
- ...common,
9820
- operations: scope === "local" ? localOperations : globalOperations,
9821
- isLoading: false,
9822
- hasNextPage: false,
9823
- onLoadNextPage: noop,
9824
- scopes: LEGACY_SCOPES,
9825
- scope,
9826
- onScopeChange: setScope
9827
- });
9828
- }
9829
- /**
9830
- * The revision history panel. Pages arrive oldest first while the timeline
9831
- * renders newest first, so it waits for the whole history to load before
9832
- * rendering the timeline, showing "Loading operations…" and a running count
9833
- * in the meantime.
9834
- *
9835
- * Also accepts the deprecated `globalOperations`/`localOperations` pair
9836
- * (see `RevisionHistoryLegacyProps`), toggling between them internally.
9837
- */
9838
- function RevisionHistory(props) {
9839
- return "globalOperations" in props ? /* @__PURE__ */ jsx(LegacyRevisionHistory, { ...props }) : /* @__PURE__ */ jsx(ScopedRevisionHistory, { ...props });
9840
- }
8651
+ const RevisionHistory = lazyComponent(() => import("../revision-history.impl-DRbeai2m.js").then((m) => m.RevisionHistory));
9841
8652
  //#endregion
9842
8653
  //#region src/connect/components/search-bar/filter-item.tsx
9843
8654
  const FilterItem = (props) => {
@@ -9903,27 +8714,70 @@ const ConnectSearchBar = (props) => {
9903
8714
  });
9904
8715
  };
9905
8716
  //#endregion
8717
+ //#region src/connect/components/tooltip/tooltip.tsx
8718
+ function ConnectTooltip(props) {
8719
+ const { children, content, open, defaultOpen, onOpenChange, className, side = "top", sideOffset = 5, delayDuration, ...rest } = props;
8720
+ return /* @__PURE__ */ jsxs(Root, {
8721
+ defaultOpen,
8722
+ delayDuration,
8723
+ onOpenChange,
8724
+ open,
8725
+ children: [/* @__PURE__ */ jsx(Trigger, {
8726
+ asChild: true,
8727
+ children
8728
+ }), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, {
8729
+ ...rest,
8730
+ side,
8731
+ sideOffset,
8732
+ className: twMerge("z-50 rounded-lg border border-border bg-popover p-2 text-xs text-popover-foreground shadow-tooltip", className),
8733
+ children: content
8734
+ }) })]
8735
+ });
8736
+ }
8737
+ const ConnectTooltipProvider = Provider;
8738
+ //#endregion
9906
8739
  //#region src/connect/components/sidebar/sidebar-item.tsx
9907
8740
  const SidebarItem = function SidebarItem(props) {
9908
- const { icon, title, description: _description, containerClassName, active, onClick } = props;
8741
+ const { icon, title, description, containerClassName, active, href, onClick, onPreload } = props;
8742
+ const Element = href ? "a" : onClick ? "button" : "div";
8743
+ const current = href ? props["aria-current"] : void 0;
9909
8744
  return /* @__PURE__ */ jsx(ConnectTooltip, {
9910
- content: title,
8745
+ content: description ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
8746
+ className: "block font-medium",
8747
+ children: title
8748
+ }), /* @__PURE__ */ jsx("span", {
8749
+ className: "block opacity-80",
8750
+ children: description
8751
+ })] }) : title,
9911
8752
  side: "right",
9912
8753
  sideOffset: 12,
9913
8754
  className: "border-none bg-primary px-3 py-2 text-sm text-primary-foreground",
9914
- children: /* @__PURE__ */ jsxs("div", {
9915
- className: twMerge("group/sidebar-item relative flex cursor-pointer flex-col items-center justify-center text-center text-sm text-foreground", containerClassName, active && "bg-sidebar-accent text-sidebar-accent-foreground", onClick && "cursor-pointer"),
8755
+ children: /* @__PURE__ */ jsxs(Element, {
8756
+ href,
8757
+ type: Element === "button" ? "button" : void 0,
8758
+ "aria-label": title,
8759
+ "aria-description": description,
8760
+ "aria-current": current,
8761
+ className: twMerge("group/sidebar-item relative flex cursor-pointer flex-col items-center justify-center text-center text-sm text-foreground", containerClassName, "aria-[current=page]:bg-sidebar-accent aria-[current=page]:text-sidebar-accent-foreground", active && "bg-sidebar-accent text-sidebar-accent-foreground", onClick && "cursor-pointer"),
9916
8762
  onClick,
9917
- children: [active ? /* @__PURE__ */ jsx("div", { className: "absolute top-1/2 left-0 h-10 w-1 -translate-y-1/2 rounded-r-sm bg-info" }) : /* @__PURE__ */ jsx("div", { className: "absolute top-1/2 left-0 h-6 w-1 -translate-y-1/2 rounded-r-sm bg-secondary opacity-0 transition-opacity group-hover/sidebar-item:opacity-100" }), /* @__PURE__ */ jsx("div", {
9918
- className: "mx-auto py-4",
9919
- children: icon || /* @__PURE__ */ jsx("div", {
9920
- className: "flex size-8 items-center justify-center rounded-lg bg-primary",
9921
- children: /* @__PURE__ */ jsx("span", {
9922
- className: "text-sm font-medium text-primary-foreground",
9923
- children: title.slice(0, 1).toUpperCase()
8763
+ onMouseEnter: onPreload,
8764
+ onTouchStart: onPreload,
8765
+ onFocus: href ? onPreload : void 0,
8766
+ children: [
8767
+ /* @__PURE__ */ jsx("div", { className: twMerge("absolute top-1/2 left-0 hidden h-10 w-1 -translate-y-1/2 rounded-r-sm bg-info group-aria-[current=page]/sidebar-item:block max-sm:hidden!", active && "block") }),
8768
+ /* @__PURE__ */ jsx("div", { className: twMerge("absolute top-1/2 left-0 h-6 w-1 -translate-y-1/2 rounded-r-sm bg-secondary opacity-0 transition-opacity group-hover/sidebar-item:opacity-100 group-aria-[current=page]/sidebar-item:hidden max-sm:hidden", active && "hidden") }),
8769
+ /* @__PURE__ */ jsx("div", {
8770
+ className: "mx-auto py-4 max-sm:px-3 max-sm:py-2",
8771
+ children: icon || /* @__PURE__ */ jsx("div", {
8772
+ "aria-hidden": true,
8773
+ className: "flex size-8 items-center justify-center rounded-lg bg-primary",
8774
+ children: /* @__PURE__ */ jsx("span", {
8775
+ className: "text-sm font-medium text-primary-foreground",
8776
+ children: title.slice(0, 1).toUpperCase()
8777
+ })
9924
8778
  })
9925
8779
  })
9926
- })]
8780
+ ]
9927
8781
  })
9928
8782
  });
9929
8783
  };
@@ -10088,17 +8942,32 @@ const SidebarUser = ({ address, ensName, avatarUrl, etherscanUrl, onDisconnect }
10088
8942
  };
10089
8943
  //#endregion
10090
8944
  //#region src/connect/components/sidebar/sidebar-footer.tsx
10091
- const ConnectSidebarFooter = ({ address, ensName, avatarUrl, className, onLogin, onClickSettings, onDisconnect, onHomeClick, showDebug, onDebugClick, etherscanUrl = "", ...props }) => {
8945
+ const ConnectSidebarFooter = ({ address, ensName, avatarUrl, className, onLogin, onClickSettings, settingsHref, settingsCurrent, onDisconnect, onHomeClick, showDebug, onDebugClick, etherscanUrl = "", ...props }) => {
8946
+ const appLogoSrc = useConnectBranding().icon;
8947
+ const settingsIcon = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Settings, {
8948
+ className: "text-foreground",
8949
+ size: 24,
8950
+ strokeWidth: 2
8951
+ }), /* @__PURE__ */ jsx("span", {
8952
+ className: "hidden text-sm/6 font-semibold text-foreground",
8953
+ children: "Settings"
8954
+ })] });
10092
8955
  return /* @__PURE__ */ jsxs(SidebarFooter, {
10093
8956
  ...props,
10094
- className: twMerge("flex flex-col items-center gap-3 border-t border-sidebar-border px-2 py-4 dark:border-none", className),
8957
+ className: twMerge("flex flex-col items-center gap-3 border-t border-sidebar-border px-2 py-4 max-sm:flex-row max-sm:border-t-0 max-sm:border-l max-sm:py-2 dark:border-none", className),
10095
8958
  children: [
10096
8959
  onHomeClick && /* @__PURE__ */ jsx("button", {
10097
8960
  "aria-label": "Home",
10098
8961
  type: "button",
10099
8962
  className: "cursor-pointer",
10100
8963
  onClick: onHomeClick,
10101
- children: /* @__PURE__ */ jsx(Icon, {
8964
+ children: appLogoSrc ? /* @__PURE__ */ jsx("img", {
8965
+ alt: "",
8966
+ className: "object-contain",
8967
+ src: appLogoSrc,
8968
+ width: 24,
8969
+ height: 24
8970
+ }) : /* @__PURE__ */ jsx(Icon, {
10102
8971
  className: "text-muted-foreground",
10103
8972
  name: "ConnectSmall",
10104
8973
  size: 24
@@ -10116,7 +8985,7 @@ const ConnectSidebarFooter = ({ address, ensName, avatarUrl, className, onLogin,
10116
8985
  })
10117
8986
  }),
10118
8987
  /* @__PURE__ */ jsx("div", {
10119
- className: onHomeClick ? "mt-3" : "",
8988
+ className: onHomeClick ? "mt-3 max-sm:mt-0" : "",
10120
8989
  children: address ? /* @__PURE__ */ jsx(SidebarUser, {
10121
8990
  address,
10122
8991
  ensName,
@@ -10125,19 +8994,19 @@ const ConnectSidebarFooter = ({ address, ensName, avatarUrl, className, onLogin,
10125
8994
  etherscanUrl
10126
8995
  }) : /* @__PURE__ */ jsx(SidebarLogin, { onLogin })
10127
8996
  }),
10128
- /* @__PURE__ */ jsxs("button", {
8997
+ settingsHref ? /* @__PURE__ */ jsx("a", {
8998
+ "aria-label": "Settings",
8999
+ href: settingsHref,
9000
+ "aria-current": settingsCurrent,
9001
+ className: "cursor-pointer rounded-md aria-[current=page]:bg-sidebar-accent",
9002
+ onClick: onClickSettings,
9003
+ children: settingsIcon
9004
+ }) : /* @__PURE__ */ jsx("button", {
10129
9005
  "aria-label": "Settings",
10130
9006
  type: "button",
10131
9007
  className: twMerge(onClickSettings ? "cursor-pointer" : "cursor-wait"),
10132
9008
  onClick: onClickSettings,
10133
- children: [/* @__PURE__ */ jsx(Settings, {
10134
- className: "text-foreground",
10135
- size: 24,
10136
- strokeWidth: 2
10137
- }), /* @__PURE__ */ jsx("span", {
10138
- className: "hidden text-sm/6 font-semibold text-foreground",
10139
- children: "Settings"
10140
- })]
9009
+ children: settingsIcon
10141
9010
  })
10142
9011
  ]
10143
9012
  });
@@ -10154,19 +9023,29 @@ const ConnectSidebarHeader = ({ className, children, ...props }) => {
10154
9023
  };
10155
9024
  //#endregion
10156
9025
  //#region src/connect/components/sidebar/sidebar.tsx
10157
- const ConnectSidebar = ({ onClick, address, ensName, avatarUrl, headerContent, onClickSettings, maxWidth = "304px", minWidth = "58px", onLogin, onDisconnect, etherscanUrl, showDebug, onDebugClick, ...props }) => {
9026
+ const ConnectSidebar = ({ onClick, address, ensName, avatarUrl, headerContent, onClickSettings, settingsHref, settingsCurrent, maxWidth = "304px", minWidth = "58px", onLogin, onDisconnect, etherscanUrl, showDebug, onDebugClick, ...props }) => {
10158
9027
  return /* @__PURE__ */ jsxs(Sidebar, {
10159
9028
  ...props,
9029
+ "data-connect-sidebar": "",
10160
9030
  maxWidth,
10161
9031
  minWidth,
10162
- children: [/* @__PURE__ */ jsxs(SidebarPanel, { children: [/* @__PURE__ */ jsx(ConnectSidebarHeader, { children: headerContent }), /* @__PURE__ */ jsx("div", {
10163
- className: "flex flex-col",
10164
- children: props.children
10165
- })] }), /* @__PURE__ */ jsx(ConnectSidebarFooter, {
9032
+ children: [/* @__PURE__ */ jsxs(SidebarPanel, {
9033
+ className: "max-sm:flex max-sm:overflow-x-auto max-sm:overflow-y-hidden",
9034
+ children: [/* @__PURE__ */ jsx(ConnectSidebarHeader, {
9035
+ className: "max-sm:hidden",
9036
+ children: headerContent
9037
+ }), /* @__PURE__ */ jsx("nav", {
9038
+ "aria-label": "Drives and pages",
9039
+ className: "flex flex-col max-sm:flex-row",
9040
+ children: props.children
9041
+ })]
9042
+ }), /* @__PURE__ */ jsx(ConnectSidebarFooter, {
10166
9043
  address,
10167
9044
  ensName,
10168
9045
  avatarUrl,
10169
9046
  onClickSettings,
9047
+ settingsHref,
9048
+ settingsCurrent,
10170
9049
  onLogin,
10171
9050
  onDisconnect,
10172
9051
  etherscanUrl,
@@ -10245,6 +9124,21 @@ function ThemeSwitch({ horizontal = false }) {
10245
9124
  });
10246
9125
  }
10247
9126
  //#endregion
9127
+ //#region src/connect/components/toggle/toggle.tsx
9128
+ const Toggle = /*#__PURE__*/ forwardRef(function Toggle(props, ref) {
9129
+ return /* @__PURE__ */ jsxs("label", {
9130
+ className: "relative cursor-pointer items-center",
9131
+ htmlFor: props.id,
9132
+ children: [/* @__PURE__ */ jsx("input", {
9133
+ className: "peer sr-only",
9134
+ ref,
9135
+ type: "checkbox",
9136
+ value: "",
9137
+ ...props
9138
+ }), /* @__PURE__ */ jsx("div", { className: "peer h-6 w-11 rounded-full bg-muted-foreground peer-checked:bg-info peer-focus:outline-none after:absolute after:inset-s-0.5 after:top-0.5 after:size-5 after:rounded-full after:border after:border-none after:bg-background after:transition-all peer-checked:after:translate-x-full" })]
9139
+ });
9140
+ });
9141
+ //#endregion
10248
9142
  //#region src/connect/utils/get-folder-status.ts
10249
9143
  /**
10250
9144
  * Retrieves the sync status of a folder based on its path and their children files.
@@ -10291,6 +9185,6 @@ const removeSuccessFiles = (files) => {
10291
9185
  return files.filter((file) => file.status !== "SUCCESS");
10292
9186
  };
10293
9187
  //#endregion
10294
- export { About, AccountPopover, AccountPopoverLogin, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, AvailablePackagesPanel, Breadcrumb, Breadcrumbs, CONFLICT, CatchUpInspector, ChannelInspector, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, CreateDocumentWithTypeModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, InstalledPackagesPanel, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, ModalButton, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageList, PackageManager, PackageManagerListItem, PackagePanelScrollArea, PackageRegistryError, PackageSubSection, PeerAgreementPanel, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RenownLoginMethods, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, ThemeSwitch, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, WorkerInspector, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, formatFileSize, generateId, getFolderStatus, locationInfoByLocation, mapProgressStageToStatus, mapUploadsToFileItems, nodeOptions, normalNodeOptions, peerManifestLabel, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
9188
+ export { About, AccountPopover, AccountPopoverLogin, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, AvailablePackagesPanel, BackgroundLayers, Breadcrumb, Breadcrumbs, CONFLICT, CatchUpInspector, ChannelInspector, Checkbox, Combobox, ConnectBrandingProvider, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, CreateDocumentWithTypeModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, Icon, InspectorModal, InstalledPackagesPanel, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, Modal, ModalButton, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageList, PackageManager, PackageManagerListItem, PackagePanelScrollArea, PackageRegistryError, PackageSubSection, PeerAgreementPanel, PowerhouseButton, ProcessorsInspector, ProjectLoaderImage, QueueInspector, ReadRequiredModal, RemotesInspector, RenownLoginMethods, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, ThemeSwitch, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, WorkerInspector, brandedDocumentIcon, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, formatFileSize, generateId, getFolderStatus, getProjectLoader, locationInfoByLocation, mapProgressStageToStatus, mapUploadsToFileItems, nodeOptions, normalNodeOptions, peerManifestLabel, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useBaseReducer3UndoRedo, useConnectBranding, useEns, useWindowSize, verifyPackageJsonFields };
10295
9189
 
10296
9190
  //# sourceMappingURL=index.js.map