@ixo/editor 2.19.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18329,7 +18329,7 @@ function useCollaborativeYDoc(_options) {
18329
18329
  }
18330
18330
 
18331
18331
  // src/mantine/hooks/useCollaborativeIxoEditor.ts
18332
- import { useMemo as useMemo64, useEffect as useEffect52 } from "react";
18332
+ import { useMemo as useMemo64, useEffect as useEffect52, useState as useState68 } from "react";
18333
18333
 
18334
18334
  // src/core/lib/matrixMetadata.ts
18335
18335
  var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
@@ -18762,18 +18762,66 @@ function useCreateCollaborativeIxoEditor(options) {
18762
18762
  titleText.insert(0, options.title);
18763
18763
  }
18764
18764
  }, [connectionStatus, root, titleText, permissions.write, options.docId, options.title, memoizedUser.id]);
18765
+ const [connectedUsers, setConnectedUsers] = useState68([]);
18766
+ const webrtcProvider = matrixProvider?.webrtcProvider;
18767
+ useEffect52(() => {
18768
+ if (!matrixProvider?.awarenessInstance || !webrtcProvider || connectionStatus !== "connected") {
18769
+ return;
18770
+ }
18771
+ const awareness = matrixProvider.awarenessInstance;
18772
+ const updateUsers = () => {
18773
+ const states = awareness.getStates();
18774
+ const users = Array.from(states.entries()).map(([clientId, state]) => ({
18775
+ clientId,
18776
+ state
18777
+ }));
18778
+ setConnectedUsers(users);
18779
+ };
18780
+ updateUsers();
18781
+ awareness.on("change", updateUsers);
18782
+ return () => {
18783
+ awareness.off("change", updateUsers);
18784
+ };
18785
+ }, [matrixProvider, webrtcProvider, connectionStatus]);
18786
+ useEffect52(() => {
18787
+ if (!matrixProvider?.awarenessInstance || !webrtcProvider || connectionStatus !== "connected") {
18788
+ return;
18789
+ }
18790
+ const awareness = matrixProvider.awarenessInstance;
18791
+ const setAwarenessState = () => {
18792
+ awareness.setLocalState({
18793
+ user: {
18794
+ name: memoizedUser.name || "Anonymous",
18795
+ color: memoizedUser.color || "#ffffff",
18796
+ clientId: awareness.clientID
18797
+ },
18798
+ timestamp: Date.now(),
18799
+ matrixUserId: memoizedUser.id
18800
+ // Custom field for Matrix user mapping
18801
+ });
18802
+ };
18803
+ console.log("[Awareness] Initializing local state for clientId:", awareness.clientID);
18804
+ setAwarenessState();
18805
+ const intervalId = setInterval(setAwarenessState, 15e3);
18806
+ return () => {
18807
+ console.log("[Awareness] Cleaning up local state for clientId:", awareness.clientID);
18808
+ clearInterval(intervalId);
18809
+ awareness.setLocalState(null);
18810
+ };
18811
+ }, [matrixProvider, webrtcProvider, connectionStatus, memoizedUser.id]);
18765
18812
  return {
18766
18813
  editor: ixoEditor,
18767
18814
  connectionStatus,
18768
18815
  title: titleText,
18769
18816
  yDoc,
18770
18817
  root,
18771
- flowArray
18818
+ flowArray,
18819
+ connectedUsers
18772
18820
  };
18773
18821
  }
18774
18822
 
18775
18823
  // src/mantine/components/Base/BaseIconPicker.tsx
18776
- import React196, { useState as useState68, useMemo as useMemo65, useEffect as useEffect53 } from "react";
18824
+ import React196, { useState as useState69, useMemo as useMemo65, useEffect as useEffect53 } from "react";
18777
18825
  import { TextInput as TextInput6, Tabs as Tabs3, Box as Box36, Stack as Stack125, UnstyledButton as UnstyledButton2, Text as Text101, Center as Center12, ScrollArea as ScrollArea7, Group as Group61, Popover as Popover2 } from "@mantine/core";
18778
18826
  import * as TablerIcons from "@tabler/icons-react";
18779
18827
  import { IconSearch as IconSearch5, IconX as IconX8, IconChevronLeft, IconChevronRight as IconChevronRight10 } from "@tabler/icons-react";
@@ -18831,9 +18879,9 @@ var localStorageService = {
18831
18879
  var iconsKey = "editor_recent_icons";
18832
18880
  var ICONS_PER_PAGE = 500;
18833
18881
  function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children, currentIcon }) {
18834
- const [searchQuery, setSearchQuery] = useState68("");
18835
- const [activeTab, setActiveTab] = useState68("icons");
18836
- const [currentPage, setCurrentPage] = useState68(1);
18882
+ const [searchQuery, setSearchQuery] = useState69("");
18883
+ const [activeTab, setActiveTab] = useState69("icons");
18884
+ const [currentPage, setCurrentPage] = useState69(1);
18837
18885
  const allIcons = useMemo65(() => {
18838
18886
  const iconEntries = Object.entries(TablerIcons).filter(([name]) => name.startsWith("Icon") && name !== "IconProps");
18839
18887
  return iconEntries;
@@ -18954,7 +19002,7 @@ function BaseIconPicker({ opened, onClose, onSelectIcon, onUploadClick, children
18954
19002
  }
18955
19003
 
18956
19004
  // src/mantine/components/CoverImage.tsx
18957
- import React198, { useState as useState69, useRef as useRef12, useEffect as useEffect54 } from "react";
19005
+ import React198, { useState as useState70, useRef as useRef12, useEffect as useEffect54 } from "react";
18958
19006
  import { Box as Box38, Group as Group62 } from "@mantine/core";
18959
19007
 
18960
19008
  // src/core/lib/imageTransform.ts
@@ -19140,13 +19188,13 @@ function PageIcon({ src, iconSize = 64, useCenter = false, style }) {
19140
19188
  import { useDisclosure as useDisclosure4 } from "@mantine/hooks";
19141
19189
  function CoverImage({ coverImageUrl, logoUrl }) {
19142
19190
  const { editor, handlers, editable } = useBlocknoteContext();
19143
- const [isHovering, setIsHovering] = useState69(false);
19144
- const [isRepositioning, setIsRepositioning] = useState69(false);
19145
- const [coverPosition, setCoverPosition] = useState69(50);
19191
+ const [isHovering, setIsHovering] = useState70(false);
19192
+ const [isRepositioning, setIsRepositioning] = useState70(false);
19193
+ const [coverPosition, setCoverPosition] = useState70(50);
19146
19194
  const coverFileInputRef = useRef12(null);
19147
19195
  const logoFileInputRef = useRef12(null);
19148
19196
  const [opened, { open, close }] = useDisclosure4(false);
19149
- const [metadata, setMetadata] = useState69(() => editor?.getPageMetadata?.() || null);
19197
+ const [metadata, setMetadata] = useState70(() => editor?.getPageMetadata?.() || null);
19150
19198
  useEffect54(() => {
19151
19199
  if (!editor?._metadataManager) {
19152
19200
  return;
@@ -19422,7 +19470,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
19422
19470
  }
19423
19471
 
19424
19472
  // src/mantine/components/PageHeader.tsx
19425
- import React199, { useState as useState70, useRef as useRef13, useEffect as useEffect55 } from "react";
19473
+ import React199, { useState as useState71, useRef as useRef13, useEffect as useEffect55 } from "react";
19426
19474
  function PageHeader({
19427
19475
  title = "New page",
19428
19476
  icon,
@@ -19433,7 +19481,7 @@ function PageHeader({
19433
19481
  isFavorited = false,
19434
19482
  menuItems = []
19435
19483
  }) {
19436
- const [isMenuOpen, setIsMenuOpen] = useState70(false);
19484
+ const [isMenuOpen, setIsMenuOpen] = useState71(false);
19437
19485
  const menuRef = useRef13(null);
19438
19486
  useEffect55(() => {
19439
19487
  function handleClickOutside(event) {
@@ -19615,7 +19663,7 @@ var styles = {
19615
19663
  };
19616
19664
 
19617
19665
  // src/mantine/components/ExternalDropZone.tsx
19618
- import React200, { useCallback as useCallback52, useEffect as useEffect56, useRef as useRef14, useState as useState71 } from "react";
19666
+ import React200, { useCallback as useCallback52, useEffect as useEffect56, useRef as useRef14, useState as useState72 } from "react";
19619
19667
  import { Box as Box39 } from "@mantine/core";
19620
19668
  var SCROLL_ZONE_SIZE = 80;
19621
19669
  var SCROLL_SPEED = 12;
@@ -19629,9 +19677,9 @@ var ExternalDropZone = ({
19629
19677
  children
19630
19678
  }) => {
19631
19679
  const containerRef = useRef14(null);
19632
- const [isValidDrag, setIsValidDrag] = useState71(false);
19633
- const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState71(false);
19634
- const [indicatorStyle, setIndicatorStyle] = useState71({});
19680
+ const [isValidDrag, setIsValidDrag] = useState72(false);
19681
+ const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState72(false);
19682
+ const [indicatorStyle, setIndicatorStyle] = useState72({});
19635
19683
  const dropPositionRef = useRef14(null);
19636
19684
  const scrollAnimationRef = useRef14(null);
19637
19685
  const scrollDirectionRef = useRef14(null);
@@ -20153,7 +20201,7 @@ function IxoEditor({
20153
20201
  }
20154
20202
 
20155
20203
  // src/mantine/components/EntitySigningSetup.tsx
20156
- import React203, { useState as useState72 } from "react";
20204
+ import React203, { useState as useState73 } from "react";
20157
20205
  import { Modal as Modal3, Stack as Stack126, Text as Text102, TextInput as TextInput7, Button as Button36, Alert as Alert26, Group as Group63 } from "@mantine/core";
20158
20206
  import { IconAlertCircle as IconAlertCircle13, IconCheck as IconCheck7, IconKey as IconKey2 } from "@tabler/icons-react";
20159
20207
  var EntitySigningSetup = ({
@@ -20163,11 +20211,11 @@ var EntitySigningSetup = ({
20163
20211
  entityName,
20164
20212
  onSetup
20165
20213
  }) => {
20166
- const [pin, setPin] = useState72("");
20167
- const [confirmPin, setConfirmPin] = useState72("");
20168
- const [loading, setLoading] = useState72(false);
20169
- const [error, setError] = useState72(null);
20170
- const [success, setSuccess] = useState72(false);
20214
+ const [pin, setPin] = useState73("");
20215
+ const [confirmPin, setConfirmPin] = useState73("");
20216
+ const [loading, setLoading] = useState73(false);
20217
+ const [error, setError] = useState73(null);
20218
+ const [success, setSuccess] = useState73(false);
20171
20219
  const handleSetup = async () => {
20172
20220
  if (pin.length < 4) {
20173
20221
  setError("PIN must be at least 4 characters");
@@ -20249,7 +20297,7 @@ var EntitySigningSetup = ({
20249
20297
  };
20250
20298
 
20251
20299
  // src/mantine/components/FlowPermissionsPanel.tsx
20252
- import React204, { useState as useState73, useEffect as useEffect57, useMemo as useMemo67 } from "react";
20300
+ import React204, { useState as useState74, useEffect as useEffect57, useMemo as useMemo67 } from "react";
20253
20301
  import { Stack as Stack127, Text as Text103, Paper as Paper17, Group as Group64, Badge as Badge31, Button as Button37, ActionIcon as ActionIcon30, Loader as Loader26, Alert as Alert27, Divider as Divider12 } from "@mantine/core";
20254
20302
  import { IconPlus as IconPlus5, IconTrash as IconTrash6, IconShieldCheck as IconShieldCheck2, IconUser as IconUser4, IconRobot as IconRobot3, IconBuilding } from "@tabler/icons-react";
20255
20303
  var FlowPermissionsPanel = ({
@@ -20260,9 +20308,9 @@ var FlowPermissionsPanel = ({
20260
20308
  onRevokePermission,
20261
20309
  getUserDisplayName
20262
20310
  }) => {
20263
- const [delegations, setDelegations] = useState73([]);
20264
- const [loading, setLoading] = useState73(true);
20265
- const [revoking, setRevoking] = useState73(null);
20311
+ const [delegations, setDelegations] = useState74([]);
20312
+ const [loading, setLoading] = useState74(true);
20313
+ const [revoking, setRevoking] = useState74(null);
20266
20314
  const rootCapability = useMemo67(() => editor.getRootCapability?.(), [editor]);
20267
20315
  useEffect57(() => {
20268
20316
  const loadDelegations = async () => {
@@ -20348,7 +20396,7 @@ var FlowPermissionsPanel = ({
20348
20396
  };
20349
20397
 
20350
20398
  // src/mantine/components/GrantPermissionModal.tsx
20351
- import React205, { useState as useState74, useCallback as useCallback53 } from "react";
20399
+ import React205, { useState as useState75, useCallback as useCallback53 } from "react";
20352
20400
  import {
20353
20401
  Modal as Modal4,
20354
20402
  Stack as Stack128,
@@ -20380,20 +20428,20 @@ var GrantPermissionModal = ({
20380
20428
  const singleBlockMode = !!targetBlockId || blocks.length === 1;
20381
20429
  const fixedBlockId = targetBlockId || (blocks.length === 1 ? blocks[0].id : null);
20382
20430
  const fixedBlock = fixedBlockId ? blocks.find((b) => b.id === fixedBlockId) || blocks[0] : null;
20383
- const [recipientType, setRecipientType] = useState74("user");
20384
- const [searchQuery, setSearchQuery] = useState74("");
20385
- const [searchResults, setSearchResults] = useState74([]);
20386
- const [searching, setSearching] = useState74(false);
20387
- const [selectedRecipient, setSelectedRecipient] = useState74(null);
20388
- const [manualDid, setManualDid] = useState74("");
20389
- const [scopeType, setScopeType] = useState74("full");
20390
- const [selectedBlocks, setSelectedBlocks] = useState74([]);
20391
- const [expirationEnabled, setExpirationEnabled] = useState74(false);
20392
- const [expirationDays, setExpirationDays] = useState74(30);
20393
- const [canDelegate, setCanDelegate] = useState74(false);
20394
- const [pin, setPin] = useState74("");
20395
- const [loading, setLoading] = useState74(false);
20396
- const [error, setError] = useState74(null);
20431
+ const [recipientType, setRecipientType] = useState75("user");
20432
+ const [searchQuery, setSearchQuery] = useState75("");
20433
+ const [searchResults, setSearchResults] = useState75([]);
20434
+ const [searching, setSearching] = useState75(false);
20435
+ const [selectedRecipient, setSelectedRecipient] = useState75(null);
20436
+ const [manualDid, setManualDid] = useState75("");
20437
+ const [scopeType, setScopeType] = useState75("full");
20438
+ const [selectedBlocks, setSelectedBlocks] = useState75([]);
20439
+ const [expirationEnabled, setExpirationEnabled] = useState75(false);
20440
+ const [expirationDays, setExpirationDays] = useState75(30);
20441
+ const [canDelegate, setCanDelegate] = useState75(false);
20442
+ const [pin, setPin] = useState75("");
20443
+ const [loading, setLoading] = useState75(false);
20444
+ const [error, setError] = useState75(null);
20397
20445
  const handleSearch = useCallback53(async () => {
20398
20446
  if (searchQuery.length < 2) return;
20399
20447
  setSearching(true);
@@ -20682,4 +20730,4 @@ export {
20682
20730
  ixoGraphQLClient,
20683
20731
  getEntity
20684
20732
  };
20685
- //# sourceMappingURL=chunk-HJL3K6NS.mjs.map
20733
+ //# sourceMappingURL=chunk-5JZLDFPC.mjs.map