@wordpress/core-data 7.39.1-next.v.0 → 7.39.1-next.v.202602091733.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.
Files changed (98) hide show
  1. package/build/awareness/awareness-state.cjs +267 -0
  2. package/build/awareness/awareness-state.cjs.map +7 -0
  3. package/build/awareness/base-awareness.cjs +14 -11
  4. package/build/awareness/base-awareness.cjs.map +2 -2
  5. package/build/awareness/config.cjs +5 -2
  6. package/build/awareness/config.cjs.map +2 -2
  7. package/build/awareness/post-editor-awareness.cjs +9 -9
  8. package/build/awareness/post-editor-awareness.cjs.map +2 -2
  9. package/build/awareness/typed-awareness.cjs +56 -0
  10. package/build/awareness/typed-awareness.cjs.map +7 -0
  11. package/build/awareness/types.cjs.map +1 -1
  12. package/build/awareness/utils.cjs +43 -14
  13. package/build/awareness/utils.cjs.map +2 -2
  14. package/build/entities.cjs +1 -1
  15. package/build/entities.cjs.map +1 -1
  16. package/build/hooks/use-post-editor-awareness-state.cjs +11 -11
  17. package/build/hooks/use-post-editor-awareness-state.cjs.map +2 -2
  18. package/build/index.cjs +2 -0
  19. package/build/index.cjs.map +2 -2
  20. package/build/private-apis.cjs +3 -1
  21. package/build/private-apis.cjs.map +2 -2
  22. package/build/sync.cjs +18 -6
  23. package/build/sync.cjs.map +3 -3
  24. package/build/utils/crdt-blocks.cjs +3 -2
  25. package/build/utils/crdt-blocks.cjs.map +3 -3
  26. package/build/utils/crdt-user-selections.cjs +2 -1
  27. package/build/utils/crdt-user-selections.cjs.map +3 -3
  28. package/build/utils/crdt.cjs.map +2 -2
  29. package/build-module/awareness/awareness-state.mjs +242 -0
  30. package/build-module/awareness/awareness-state.mjs.map +7 -0
  31. package/build-module/awareness/base-awareness.mjs +14 -11
  32. package/build-module/awareness/base-awareness.mjs.map +2 -2
  33. package/build-module/awareness/config.mjs +3 -1
  34. package/build-module/awareness/config.mjs.map +2 -2
  35. package/build-module/awareness/post-editor-awareness.mjs +9 -9
  36. package/build-module/awareness/post-editor-awareness.mjs.map +2 -2
  37. package/build-module/awareness/typed-awareness.mjs +31 -0
  38. package/build-module/awareness/typed-awareness.mjs.map +7 -0
  39. package/build-module/awareness/utils.mjs +38 -12
  40. package/build-module/awareness/utils.mjs.map +2 -2
  41. package/build-module/entities.mjs +1 -1
  42. package/build-module/entities.mjs.map +1 -1
  43. package/build-module/hooks/use-post-editor-awareness-state.mjs +10 -10
  44. package/build-module/hooks/use-post-editor-awareness-state.mjs.map +2 -2
  45. package/build-module/index.mjs +1 -0
  46. package/build-module/index.mjs.map +2 -2
  47. package/build-module/private-apis.mjs +3 -1
  48. package/build-module/private-apis.mjs.map +2 -2
  49. package/build-module/sync.mjs +9 -3
  50. package/build-module/sync.mjs.map +2 -2
  51. package/build-module/utils/crdt-blocks.mjs +2 -1
  52. package/build-module/utils/crdt-blocks.mjs.map +2 -2
  53. package/build-module/utils/crdt-user-selections.mjs +2 -1
  54. package/build-module/utils/crdt-user-selections.mjs.map +2 -2
  55. package/build-module/utils/crdt.mjs.map +2 -2
  56. package/build-types/awareness/awareness-state.d.ts +125 -0
  57. package/build-types/awareness/awareness-state.d.ts.map +1 -0
  58. package/build-types/awareness/base-awareness.d.ts +9 -6
  59. package/build-types/awareness/base-awareness.d.ts.map +1 -1
  60. package/build-types/awareness/config.d.ts +4 -0
  61. package/build-types/awareness/config.d.ts.map +1 -1
  62. package/build-types/awareness/post-editor-awareness.d.ts +4 -4
  63. package/build-types/awareness/post-editor-awareness.d.ts.map +1 -1
  64. package/build-types/awareness/typed-awareness.d.ts +25 -0
  65. package/build-types/awareness/typed-awareness.d.ts.map +1 -0
  66. package/build-types/awareness/types.d.ts +19 -10
  67. package/build-types/awareness/types.d.ts.map +1 -1
  68. package/build-types/awareness/utils.d.ts +14 -11
  69. package/build-types/awareness/utils.d.ts.map +1 -1
  70. package/build-types/hooks/use-post-editor-awareness-state.d.ts +6 -6
  71. package/build-types/hooks/use-post-editor-awareness-state.d.ts.map +1 -1
  72. package/build-types/index.d.ts +1 -0
  73. package/build-types/index.d.ts.map +1 -1
  74. package/build-types/private-apis.d.ts.map +1 -1
  75. package/build-types/sync.d.ts +3 -2
  76. package/build-types/sync.d.ts.map +1 -1
  77. package/build-types/utils/crdt-blocks.d.ts.map +1 -1
  78. package/build-types/utils/crdt-user-selections.d.ts +1 -1
  79. package/build-types/utils/crdt-user-selections.d.ts.map +1 -1
  80. package/build-types/utils/crdt.d.ts +1 -2
  81. package/build-types/utils/crdt.d.ts.map +1 -1
  82. package/package.json +18 -18
  83. package/src/awareness/awareness-state.ts +342 -0
  84. package/src/awareness/base-awareness.ts +14 -11
  85. package/src/awareness/config.ts +5 -0
  86. package/src/awareness/post-editor-awareness.ts +11 -11
  87. package/src/awareness/typed-awareness.ts +44 -0
  88. package/src/awareness/types.ts +25 -11
  89. package/src/awareness/utils.ts +67 -27
  90. package/src/entities.js +1 -1
  91. package/src/hooks/use-post-editor-awareness-state.ts +21 -20
  92. package/src/index.js +1 -0
  93. package/src/private-apis.js +2 -0
  94. package/src/sync.ts +14 -3
  95. package/src/utils/crdt-blocks.ts +2 -1
  96. package/src/utils/crdt-user-selections.ts +3 -2
  97. package/src/utils/crdt.ts +1 -2
  98. package/src/utils/test/crdt.ts +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/awareness/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAExD;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,MAAM,QAAQ,GAAG,IAAI,CAC1B,IAAI,CAAE,MAAM,CAAE,EACd,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,CACtC,GAAG;IACH,WAAW,EAAE,MAAM,CAAC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D,eAAe,EAAE,MAAM,CAAE,MAAM,EAAE,qBAAqB,CAAE,CAAC;CACzD;AAGD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACtC,CAAC,CAAC,IAAI,EACN,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CACtC,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CACnC,CAAC,CAAC,IAAI,EACJ,IAAI,GACJ,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,SAAS,GACT,MAAM,CACR,GAAG;IACH,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClC,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAE,KAAK,EAAE,SAAS,SAAS,MAAM,KAAK,IAAK,CACxE,MAAM,CAAC,EAAE,KAAK,CAAE,SAAS,CAAE,EAC3B,MAAM,CAAC,EAAE,KAAK,CAAE,SAAS,CAAE,KACvB,OAAO,CAAC"}
@@ -2,21 +2,24 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import type { User } from '../entity-types';
5
- import type { UserInfo } from './types';
5
+ import type { CollaboratorInfo } from './types';
6
+ export declare function areMapsEqual<Key, Value>(map1: Map<Key, Value>, map2: Map<Key, Value>, comparatorFn: (value1: Value, value2: Value) => boolean): boolean;
6
7
  /**
7
- * Check if two user infos are equal.
8
+ * Check if two collaborator infos are equal.
8
9
  *
9
- * @param userInfo1 - The first user info.
10
- * @param userInfo2 - The second user info.
11
- * @return True if the user infos are equal, false otherwise.
10
+ * @param collaboratorInfo1 - The first collaborator info.
11
+ * @param collaboratorInfo2 - The second collaborator info.
12
+ * @return True if the collaborator infos are equal, false otherwise.
12
13
  */
13
- export declare function areUserInfosEqual(userInfo1?: UserInfo, userInfo2?: UserInfo): boolean;
14
+ export declare function areCollaboratorInfosEqual(collaboratorInfo1?: CollaboratorInfo, collaboratorInfo2?: CollaboratorInfo): boolean;
14
15
  /**
15
- * Generate a user info object from a current user and a list of existing colors.
16
+ * Generate a collaborator info object from a current collaborator and a list of existing colors.
16
17
  *
17
- * @param currentUser - The current user.
18
- * @param existingColors - The existing colors.
19
- * @return The user info object.
18
+ * @param currentCollaborator - The current collaborator.
19
+ * @param existingColors - The existing colors.
20
+ * @return The collaborator info object.
20
21
  */
21
- export declare function generateUserInfo(currentUser: User<'view'>, existingColors: string[]): UserInfo;
22
+ export declare function generateCollaboratorInfo(currentCollaborator: User<'view'>, existingColors: string[]): CollaboratorInfo;
23
+ export declare function getRecordValue<RecordType, Key extends keyof RecordType>(obj: unknown, key: Key): RecordType[Key] | null;
24
+ export declare function getTypedKeys<T extends object>(obj: T): Array<keyof T>;
22
25
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/awareness/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAgHxC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,SAAS,CAAC,EAAE,QAAQ,EACpB,SAAS,CAAC,EAAE,QAAQ,GAClB,OAAO,CAaT;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC/B,WAAW,EAAE,IAAI,CAAE,MAAM,CAAE,EAC3B,cAAc,EAAE,MAAM,EAAE,GACtB,QAAQ,CAOV"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/awareness/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAgHhD,wBAAgB,YAAY,CAAE,GAAG,EAAE,KAAK,EACvC,IAAI,EAAE,GAAG,CAAE,GAAG,EAAE,KAAK,CAAE,EACvB,IAAI,EAAE,GAAG,CAAE,GAAG,EAAE,KAAK,CAAE,EACvB,YAAY,EAAE,CAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,KAAM,OAAO,GACvD,OAAO,CAgBT;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACxC,iBAAiB,CAAC,EAAE,gBAAgB,EACpC,iBAAiB,CAAC,EAAE,gBAAgB,GAClC,OAAO,CAgBT;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACvC,mBAAmB,EAAE,IAAI,CAAE,MAAM,CAAE,EACnC,cAAc,EAAE,MAAM,EAAE,GACtB,gBAAgB,CAOlB;AAED,wBAAgB,cAAc,CAAE,UAAU,EAAE,GAAG,SAAS,MAAM,UAAU,EACvE,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,GAAG,GACN,UAAU,CAAE,GAAG,CAAE,GAAG,IAAI,CAM1B;AAED,wBAAgB,YAAY,CAAE,CAAC,SAAS,MAAM,EAAI,GAAG,EAAE,CAAC,GAAI,KAAK,CAAE,MAAM,CAAC,CAAE,CAE3E"}
@@ -1,13 +1,13 @@
1
- import type { PostEditorAwarenessState as ActiveUser, YDocDebugData } from '../awareness/types';
1
+ import type { PostEditorAwarenessState as ActiveCollaborator, YDocDebugData } from '../awareness/types';
2
2
  import type { SelectionCursor } from '../types';
3
3
  /**
4
- * Hook to get the active users for a post editor.
4
+ * Hook to get the active collaborators for a post editor.
5
5
  *
6
6
  * @param postId - The ID of the post.
7
7
  * @param postType - The type of the post.
8
- * @return {ActiveUser[]} The active users.
8
+ * @return {ActiveCollaborator[]} The active collaborators.
9
9
  */
10
- export declare function useActiveUsers(postId: number | null, postType: string | null): ActiveUser[];
10
+ export declare function useActiveCollaborators(postId: number | null, postType: string | null): ActiveCollaborator[];
11
11
  /**
12
12
  * Hook to get the absolute position index for a post editor.
13
13
  *
@@ -25,11 +25,11 @@ export declare function useGetAbsolutePositionIndex(postId: number | null, postT
25
25
  */
26
26
  export declare function useGetDebugData(postId: number | null, postType: string | null): YDocDebugData;
27
27
  /**
28
- * Hook to check if the current user is disconnected.
28
+ * Hook to check if the current collaborator is disconnected.
29
29
  *
30
30
  * @param postId - The ID of the post.
31
31
  * @param postType - The type of the post.
32
- * @return {boolean} Whether the current user is disconnected.
32
+ * @return {boolean} Whether the current collaborator is disconnected.
33
33
  */
34
34
  export declare function useIsDisconnected(postId: number | null, postType: string | null): boolean;
35
35
  //# sourceMappingURL=use-post-editor-awareness-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-post-editor-awareness-state.d.ts","sourceRoot":"","sources":["../../src/hooks/use-post-editor-awareness-state.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACX,wBAAwB,IAAI,UAAU,EACtC,aAAa,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA8EhD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACrB,UAAU,EAAE,CAEd;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACrB,CAAE,SAAS,EAAE,eAAe,KAAM,MAAM,GAAG,IAAI,CAGjD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACrB,aAAa,CAEf;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAGT"}
1
+ {"version":3,"file":"use-post-editor-awareness-state.d.ts","sourceRoot":"","sources":["../../src/hooks/use-post-editor-awareness-state.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACX,wBAAwB,IAAI,kBAAkB,EAC9C,aAAa,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA+EhD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACrB,kBAAkB,EAAE,CAEtB;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACrB,CAAE,SAAS,EAAE,eAAe,KAAM,MAAM,GAAG,IAAI,CAGjD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACrB,aAAa,CAEf;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAGT"}
@@ -339,6 +339,7 @@ export const store: import("@wordpress/data").StoreDescriptor<import("@wordpress
339
339
  export { default as EntityProvider } from "./entity-provider";
340
340
  export * from "./entity-provider";
341
341
  export * from "./entity-types";
342
+ export * from "./awareness/types";
342
343
  export * from "./fetch";
343
344
  export * from "./hooks";
344
345
  export * from "./private-apis";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA6HA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;4CAW4ptB,OAAO;;yBAAx+nB,YAAO,EAAC,YAAO,EAAC,yBAAW,EAAC,iBAAQ,EAAC;;;KAA4D,MAAe;;;KAA4B;uBAAw3E,YAAK,EAAC,YAAK,EAAC,yBAAS,E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AywF;;;KAAqB;iBAA4R;;;KAAqB;;uBAAutC,YAAO,EAAC,YAAO,EAAC,WAAS,EAAC;;;;KAA4F,MAAe;;;;KAAoC;0BAA+6N,eAAS;6BAAgtC,YAAK,EAAC,YAAK,EAAC,aAAS,EAAC,yBAAQ,MAAc;;;;KAAoC;6CAAslC,YAAK,EAAC,YAAK,EAAC,yBAAS,EAAC,kBAAY,EAAC,YAAQ,MAAc;;;;KAAoC;uBAAgzJ,YAAK,EAAC,YAAK,EAAC,0BAAU,EAAC,oBAAQ,EAAC,iBAAM,EAAC,6CAAwB,EAAC,gBAAK,MAAc;;;KAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAAl0S,sBAAc,EAAC,YAAc,EAAC,YAAc,EAAC,oCAA4B;iCAAu9B,sBAAc,EAAC,YAAc,EAAC,YAAc,EAAC,oCAA4B;;;;;;;;;;;;;;;;;;;;mBAAykqB,sBAAc,EAAC,YAAc,EAAC,YAAc,EAAC,0BAA4B,EAAC,qCAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAZn1pC;;;;;;;;2BAzHxC,aAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"private-apis.d.ts","sourceRoot":"","sources":["../src/private-apis.js"],"names":[],"mappings":"AAOA,6BAA8B"}
1
+ {"version":3,"file":"private-apis.d.ts","sourceRoot":"","sources":["../src/private-apis.js"],"names":[],"mappings":"AAQA,6BAA8B"}
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { CRDT_DOC_META_PERSISTENCE_KEY, CRDT_RECORD_MAP_KEY, LOCAL_EDITOR_ORIGIN, LOCAL_SYNC_MANAGER_ORIGIN, WORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE, type SyncManager } from '@wordpress/sync';
5
- export { CRDT_DOC_META_PERSISTENCE_KEY, CRDT_RECORD_MAP_KEY, LOCAL_EDITOR_ORIGIN, LOCAL_SYNC_MANAGER_ORIGIN, WORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE, };
4
+ import { type SyncManager } from '@wordpress/sync';
5
+ declare const Delta: any, CRDT_DOC_META_PERSISTENCE_KEY: any, CRDT_RECORD_MAP_KEY: any, LOCAL_EDITOR_ORIGIN: any, LOCAL_SYNC_MANAGER_ORIGIN: any, WORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE: any;
6
+ export { Delta, CRDT_DOC_META_PERSISTENCE_KEY, CRDT_RECORD_MAP_KEY, LOCAL_EDITOR_ORIGIN, LOCAL_SYNC_MANAGER_ORIGIN, WORDPRESS_META_KEY_FOR_CRDT_DOC_PERSISTENCE, };
6
7
  export declare function getSyncManager(): SyncManager | undefined;
7
8
  //# sourceMappingURL=sync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACN,6BAA6B,EAC7B,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,2CAA2C,EAC3C,KAAK,WAAW,EAEhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,6BAA6B,EAC7B,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,2CAA2C,GAC3C,CAAC;AAIF,wBAAgB,cAAc,IAAI,WAAW,GAAG,SAAS,CAQxD"}
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEN,KAAK,WAAW,EAChB,MAAM,iBAAiB,CAAC;AAOzB,QAAA,MAEC,KAAK,OACL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AC,IAAI,GAAG,OAAO,CAAE,CAAC;AAiIzD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,KAAK,EAAE,EACvB,cAAc,EAAE,MAAM,GAAG,IAAI,GAC3B,IAAI,CAwMN"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * External dependencies
2
+ * WordPress dependencies
3
3
  */
4
4
  import { Y } from '@wordpress/sync';
5
5
  import type { WPBlockSelection, SelectionState } from '../types';
@@ -1 +1 @@
1
- {"version":3,"file":"crdt-user-selections.d.ts","sourceRoot":"","sources":["../../src/utils/crdt-user-selections.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAuB,MAAM,iBAAiB,CAAC;AAQzD,OAAO,KAAK,EACX,gBAAgB,EAChB,cAAc,EAOd,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,oBAAY,aAAa;IACxB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,mBAAmB,2BAA2B;IAC9C,yBAAyB,iCAAiC;IAC1D,UAAU,gBAAgB;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,cAAc,EAAE,gBAAgB,EAChC,YAAY,EAAE,gBAAgB,EAC9B,IAAI,EAAE,CAAC,CAAC,GAAG,GACT,cAAc,CAgFhB;AAkED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACvC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,cAAc,GACxB,OAAO,CA2DT"}
1
+ {"version":3,"file":"crdt-user-selections.d.ts","sourceRoot":"","sources":["../../src/utils/crdt-user-selections.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AASpC,OAAO,KAAK,EACX,gBAAgB,EAChB,cAAc,EAOd,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,oBAAY,aAAa;IACxB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,mBAAmB,2BAA2B;IAC9C,yBAAyB,iCAAiC;IAC1D,UAAU,gBAAgB;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,cAAc,EAAE,gBAAgB,EAChC,YAAY,EAAE,gBAAgB,EAC9B,IAAI,EAAE,CAAC,CAAC,GAAG,GACT,cAAc,CAgFhB;AAkED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACvC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,cAAc,GACxB,OAAO,CA2DT"}
@@ -1,5 +1,4 @@
1
1
  import { type CRDTDoc, type SyncConfig } from '@wordpress/sync';
2
- import { type BaseState } from '../awareness/types';
3
2
  import { type Block, type YBlocks } from './crdt-blocks';
4
3
  import { type Post } from '../entity-types/post';
5
4
  import { type Type } from '../entity-types';
@@ -54,5 +53,5 @@ export declare function getPostChangesFromCRDTDoc(ydoc: CRDTDoc, editedRecord: P
54
53
  * This default sync config can be used for entities that are flat maps of
55
54
  * primitive values and do not require custom logic to merge changes.
56
55
  */
57
- export declare const defaultSyncConfig: SyncConfig<BaseState>;
56
+ export declare const defaultSyncConfig: SyncConfig;
58
57
  //# sourceMappingURL=crdt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"crdt.d.ts","sourceRoot":"","sources":["../../src/utils/crdt.ts"],"names":[],"mappings":"AAUA,OAAO,EACN,KAAK,OAAO,EAEZ,KAAK,UAAU,EAEf,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAEN,KAAK,KAAK,EAEV,KAAK,OAAO,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAM5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAIN,KAA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EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACd;AA0DD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,IAAI,GACb,IAAI,CA2HN;AAMD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,OAAO,EACb,YAAY,EAAE,IAAI,EAClB,SAAS,EAAE,IAAI,GACb,WAAW,CAwHb;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAI/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/core-data",
3
- "version": "7.39.1-next.v.0+5aba098fc",
3
+ "version": "7.39.1-next.v.202602091733.0+daa0b19c4",
4
4
  "description": "Access to and manipulation of core WordPress entities.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -49,22 +49,22 @@
49
49
  "build-module/index.mjs"
50
50
  ],
51
51
  "dependencies": {
52
- "@wordpress/api-fetch": "^7.39.1-next.v.0+5aba098fc",
53
- "@wordpress/block-editor": "^15.12.1-next.v.0+5aba098fc",
54
- "@wordpress/blocks": "^15.12.1-next.v.0+5aba098fc",
55
- "@wordpress/compose": "^7.39.1-next.v.0+5aba098fc",
56
- "@wordpress/data": "^10.39.1-next.v.0+5aba098fc",
57
- "@wordpress/deprecated": "^4.39.1-next.v.0+5aba098fc",
58
- "@wordpress/element": "^6.39.1-next.v.0+5aba098fc",
59
- "@wordpress/html-entities": "^4.39.1-next.v.0+5aba098fc",
60
- "@wordpress/i18n": "^6.12.1-next.v.0+5aba098fc",
61
- "@wordpress/is-shallow-equal": "^5.39.1-next.v.0+5aba098fc",
62
- "@wordpress/private-apis": "^1.39.1-next.v.0+5aba098fc",
63
- "@wordpress/rich-text": "^7.39.1-next.v.0+5aba098fc",
64
- "@wordpress/sync": "^1.39.1-next.v.0+5aba098fc",
65
- "@wordpress/undo-manager": "^1.39.1-next.v.0+5aba098fc",
66
- "@wordpress/url": "^4.39.1-next.v.0+5aba098fc",
67
- "@wordpress/warning": "^3.39.1-next.v.0+5aba098fc",
52
+ "@wordpress/api-fetch": "^7.39.1-next.v.202602091733.0+daa0b19c4",
53
+ "@wordpress/block-editor": "^15.12.2-next.v.202602091733.0+daa0b19c4",
54
+ "@wordpress/blocks": "^15.12.1-next.v.202602091733.0+daa0b19c4",
55
+ "@wordpress/compose": "^7.39.1-next.v.202602091733.0+daa0b19c4",
56
+ "@wordpress/data": "^10.39.1-next.v.202602091733.0+daa0b19c4",
57
+ "@wordpress/deprecated": "^4.39.1-next.v.202602091733.0+daa0b19c4",
58
+ "@wordpress/element": "^6.39.1-next.v.202602091733.0+daa0b19c4",
59
+ "@wordpress/html-entities": "^4.39.1-next.v.202602091733.0+daa0b19c4",
60
+ "@wordpress/i18n": "^6.12.1-next.v.202602091733.0+daa0b19c4",
61
+ "@wordpress/is-shallow-equal": "^5.39.1-next.v.202602091733.0+daa0b19c4",
62
+ "@wordpress/private-apis": "^1.39.1-next.v.202602091733.0+daa0b19c4",
63
+ "@wordpress/rich-text": "^7.39.1-next.v.202602091733.0+daa0b19c4",
64
+ "@wordpress/sync": "^1.39.1-next.v.202602091733.0+daa0b19c4",
65
+ "@wordpress/undo-manager": "^1.39.1-next.v.202602091733.0+daa0b19c4",
66
+ "@wordpress/url": "^4.39.1-next.v.202602091733.0+daa0b19c4",
67
+ "@wordpress/warning": "^3.39.1-next.v.202602091733.0+daa0b19c4",
68
68
  "change-case": "^4.1.2",
69
69
  "equivalent-key-map": "^0.2.2",
70
70
  "fast-deep-equal": "^3.1.3",
@@ -84,5 +84,5 @@
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  },
87
- "gitHead": "d730f9e00f5462d1b9d2660632850f5f43ccff44"
87
+ "gitHead": "74f59922b25e30904319373dda91bf8e81f3544e"
88
88
  }
@@ -0,0 +1,342 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { REMOVAL_DELAY_IN_MS } from './config';
5
+ import { TypedAwareness } from './typed-awareness';
6
+ import type { EnhancedState, EqualityFieldCheck } from './types';
7
+ import { getTypedKeys, areMapsEqual } from './utils';
8
+
9
+ type AwarenessClientID = number;
10
+
11
+ interface AwarenessStateChange {
12
+ added: AwarenessClientID[];
13
+ updated: AwarenessClientID[];
14
+ removed: AwarenessClientID[];
15
+ }
16
+
17
+ abstract class AwarenessWithEqualityChecks<
18
+ State extends object,
19
+ > extends TypedAwareness< State > {
20
+ /** OVERRIDDEN METHODS */
21
+
22
+ /**
23
+ * Set a local state field on an awareness document. Calling this method may
24
+ * trigger rerenders of any subscribed components.
25
+ *
26
+ * Equality checks are provided by the abstract `equalityFieldChecks` property.
27
+ * @param field - The field to set.
28
+ * @param value - The value to set.
29
+ */
30
+ public setLocalStateField< FieldName extends string & keyof State >(
31
+ field: FieldName,
32
+ value: State[ FieldName ]
33
+ ): void {
34
+ if (
35
+ this.isFieldEqual(
36
+ field,
37
+ value,
38
+ this.getLocalStateField( field ) ?? undefined
39
+ )
40
+ ) {
41
+ return;
42
+ }
43
+
44
+ super.setLocalStateField( field, value );
45
+ }
46
+
47
+ /** ABSTRACT PROPERTIES */
48
+
49
+ /**
50
+ * Extending classes must implement equality checks for each awareness state
51
+ * field they manage.
52
+ */
53
+ protected abstract equalityFieldChecks: {
54
+ [ FieldName in keyof State ]: EqualityFieldCheck< State, FieldName >;
55
+ };
56
+
57
+ /** CUSTOM METHODS */
58
+
59
+ /**
60
+ * Determine if a field value has changed using the provided equality checks.
61
+ * @param field - The field to check.
62
+ * @param value1 - The first value to compare.
63
+ * @param value2 - The second value to compare.
64
+ */
65
+ protected isFieldEqual< FieldName extends keyof State >(
66
+ field: FieldName,
67
+ value1?: State[ FieldName ],
68
+ value2?: State[ FieldName ]
69
+ ): boolean {
70
+ if (
71
+ [ 'clientId', 'isConnected', 'isMe' ].includes( field as string )
72
+ ) {
73
+ return value1 === value2;
74
+ }
75
+
76
+ if ( field in this.equalityFieldChecks ) {
77
+ const fn = this.equalityFieldChecks[ field ];
78
+ return fn( value1, value2 );
79
+ }
80
+
81
+ throw new Error(
82
+ `No equality check implemented for awareness state field "${ field.toString() }".`
83
+ );
84
+ }
85
+
86
+ /**
87
+ * Determine if two states are equal by comparing each field using the
88
+ * provided equality checks.
89
+ * @param state1 - The first state to compare.
90
+ * @param state2 - The second state to compare.
91
+ */
92
+ protected isStateEqual( state1: State, state2: State ): boolean {
93
+ return [
94
+ ...new Set< keyof State >( [
95
+ ...getTypedKeys( state1 ),
96
+ ...getTypedKeys( state2 ),
97
+ ] ),
98
+ ].every( ( field ) => {
99
+ const value1 = state1[ field ];
100
+ const value2 = state2[ field ];
101
+
102
+ return this.isFieldEqual( field, value1, value2 );
103
+ } );
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Abstract class to manage awareness and allow external code to subscribe to
109
+ * state updates.
110
+ */
111
+ export abstract class AwarenessState<
112
+ State extends object = {},
113
+ > extends AwarenessWithEqualityChecks< State > {
114
+ /** CUSTOM PROPERTIES */
115
+
116
+ /**
117
+ * Whether the setUp method has been called, to avoid running it multiple
118
+ * times.
119
+ */
120
+ private hasSetupRun = false;
121
+
122
+ /**
123
+ * We keep track of all seen states during the current session for two reasons:
124
+ *
125
+ * 1. So that we can represent recently disconnected collaborators in our UI, even
126
+ * after they have been removed from the awareness document.
127
+ * 2. So that we can provide debug information about all collaborators seen during
128
+ * the session.
129
+ */
130
+ private disconnectedCollaborators: Set< number > = new Set();
131
+ private seenStates: Map< number, State > = new Map();
132
+
133
+ /**
134
+ * Hold a snapshot of the previous awareness state allows us to compare the
135
+ * state values and avoid unnecessary updates to subscribers.
136
+ */
137
+ private previousSnapshot = new Map< number, EnhancedState< State > >();
138
+ private stateSubscriptions: Array<
139
+ ( newState: EnhancedState< State >[] ) => void
140
+ > = [];
141
+
142
+ /**
143
+ * In some cases, we may want to throttle setting local state fields to avoid
144
+ * overwhelming the awareness document with rapid updates. At the same time, we
145
+ * want to ensure that when we read our own state locally, we get the latest
146
+ * value -- even if it hasn't yet been set on the awareness instance.
147
+ */
148
+ private myThrottledState: Partial< State > = {};
149
+ private throttleTimeouts: Map< string, NodeJS.Timeout > = new Map();
150
+
151
+ /** CUSTOM METHODS */
152
+
153
+ /**
154
+ * Set up the awareness state. This method is idempotent and will only run
155
+ * once. Subclasses should override `onSetUp()` instead of this method to
156
+ * add their own setup logic.
157
+ *
158
+ * This is defined as a readonly arrow function property to prevent
159
+ * subclasses from overriding it.
160
+ */
161
+ public readonly setUp = (): void => {
162
+ if ( this.hasSetupRun ) {
163
+ return;
164
+ }
165
+
166
+ this.hasSetupRun = true;
167
+
168
+ this.onSetUp();
169
+
170
+ this.on(
171
+ 'change',
172
+ ( { added, removed, updated }: AwarenessStateChange ) => {
173
+ [ ...added, ...updated ].forEach( ( id ) => {
174
+ this.disconnectedCollaborators.delete( id );
175
+ } );
176
+
177
+ removed.forEach( ( id ) => {
178
+ this.disconnectedCollaborators.add( id );
179
+
180
+ setTimeout( () => {
181
+ this.disconnectedCollaborators.delete( id );
182
+ this.updateSubscribers( true /* force update */ );
183
+ }, REMOVAL_DELAY_IN_MS );
184
+ } );
185
+
186
+ // Do not force-update the store here, since this change handler can be
187
+ // called even when there are no actual state changes.
188
+ this.updateSubscribers();
189
+ }
190
+ );
191
+ };
192
+
193
+ /**
194
+ * Hook method for subclasses to add their own setup logic. This is called
195
+ * once after the base class setup completes. All subclasses must implement
196
+ * this method. If extending a class that already implements `onSetUp()`,
197
+ * call `super.onSetUp()` to ensure parent setup runs.
198
+ */
199
+ protected abstract onSetUp(): void;
200
+
201
+ /**
202
+ * Get the most recent state from the last processed change event.
203
+ *
204
+ * @return An array of EnhancedState< State >.
205
+ */
206
+ public getCurrentState(): EnhancedState< State >[] {
207
+ return Array.from( this.previousSnapshot.values() );
208
+ }
209
+
210
+ /**
211
+ * Get all seen states in this session to enable debug reporting.
212
+ */
213
+ public getSeenStates(): Map< number, State > {
214
+ return this.seenStates;
215
+ }
216
+
217
+ /**
218
+ * Allow external code to subscribe to awareness state changes.
219
+ * @param callback - The callback to subscribe to.
220
+ */
221
+ public onStateChange(
222
+ callback: ( newState: EnhancedState< State >[] ) => void
223
+ ): () => void {
224
+ this.stateSubscriptions.push( callback );
225
+
226
+ return () => {
227
+ this.stateSubscriptions = this.stateSubscriptions.filter(
228
+ ( cb ) => cb !== callback
229
+ );
230
+ };
231
+ }
232
+
233
+ /**
234
+ * Set a local state field on an awareness document with throttle. See caveats
235
+ * of this.setLocalStateField.
236
+ * @param field - The field to set.
237
+ * @param value - The value to set.
238
+ * @param wait - The wait time in milliseconds.
239
+ */
240
+ public setThrottledLocalStateField<
241
+ FieldName extends string & keyof State,
242
+ >( field: FieldName, value: State[ FieldName ], wait: number ): void {
243
+ this.setLocalStateField( field, value );
244
+
245
+ this.throttleTimeouts.set(
246
+ field,
247
+ setTimeout( () => {
248
+ this.throttleTimeouts.delete( field );
249
+ if ( this.myThrottledState[ field ] ) {
250
+ this.setLocalStateField(
251
+ field,
252
+ this.myThrottledState[ field ]
253
+ );
254
+
255
+ delete this.myThrottledState[ field ];
256
+ }
257
+ }, wait )
258
+ );
259
+ }
260
+
261
+ /**
262
+ * Set the current collaborator's connection status as awareness state.
263
+ * @param isConnected - The connection status.
264
+ */
265
+ public setConnectionStatus( isConnected: boolean ): void {
266
+ if ( isConnected ) {
267
+ this.disconnectedCollaborators.delete( this.clientID );
268
+ } else {
269
+ this.disconnectedCollaborators.add( this.clientID );
270
+ }
271
+
272
+ this.updateSubscribers( true /* force update */ );
273
+ }
274
+
275
+ /**
276
+ * Update all subscribed listeners with the latest awareness state.
277
+ * @param forceUpdate - Whether to force an update.
278
+ */
279
+ protected updateSubscribers( forceUpdate = false ): void {
280
+ if ( ! this.stateSubscriptions.length ) {
281
+ return;
282
+ }
283
+
284
+ const states = this.getStates();
285
+
286
+ this.seenStates = new Map< number, State >( [
287
+ ...this.seenStates.entries(),
288
+ ...states.entries(),
289
+ ] );
290
+
291
+ const updatedStates = new Map< number, EnhancedState< State > >(
292
+ [ ...this.disconnectedCollaborators, ...states.keys() ]
293
+ .filter( ( clientId ) => {
294
+ // Exclude any collaborators with empty awareness state. This can happen from
295
+ // the Yjs inspector.
296
+ return (
297
+ Object.keys( this.seenStates.get( clientId ) ?? {} )
298
+ .length > 0
299
+ );
300
+ } )
301
+ .map( ( clientId ) => {
302
+ // The filter above ensures that seenStates has the clientId.
303
+ const rawState: State = this.seenStates.get( clientId )!;
304
+
305
+ const isConnected =
306
+ ! this.disconnectedCollaborators.has( clientId );
307
+ const isMe = clientId === this.clientID;
308
+ const myState: Partial< State > = isMe
309
+ ? this.myThrottledState
310
+ : {};
311
+ const state: EnhancedState< State > = {
312
+ ...rawState,
313
+ ...myState,
314
+ clientId,
315
+ isConnected,
316
+ isMe,
317
+ };
318
+
319
+ return [ clientId, state ];
320
+ } )
321
+ );
322
+
323
+ if ( ! forceUpdate ) {
324
+ if (
325
+ areMapsEqual(
326
+ this.previousSnapshot,
327
+ updatedStates,
328
+ this.isStateEqual.bind( this )
329
+ )
330
+ ) {
331
+ // Awareness state unchanged, do not update subscribers.
332
+ return;
333
+ }
334
+ }
335
+
336
+ // Update subscribers.
337
+ this.previousSnapshot = updatedStates;
338
+ this.stateSubscriptions.forEach( ( callback ) => {
339
+ callback( Array.from( updatedStates.values() ) );
340
+ } );
341
+ }
342
+ }
@@ -2,13 +2,13 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { resolveSelect } from '@wordpress/data';
5
- import { AwarenessState } from '@wordpress/sync';
6
5
 
7
6
  /**
8
7
  * Internal dependencies
9
8
  */
9
+ import { AwarenessState } from './awareness-state';
10
10
  import { STORE_NAME as coreStore } from '../name';
11
- import { generateUserInfo, areUserInfosEqual } from './utils';
11
+ import { generateCollaboratorInfo, areCollaboratorInfosEqual } from './utils';
12
12
 
13
13
  import type { BaseState } from './types';
14
14
 
@@ -16,31 +16,34 @@ export abstract class BaseAwarenessState<
16
16
  State extends BaseState,
17
17
  > extends AwarenessState< State > {
18
18
  protected onSetUp(): void {
19
- void this.setCurrentUserInfo();
19
+ void this.setCurrentCollaboratorInfo();
20
20
  }
21
21
 
22
22
  /**
23
- * Set the current user info in the local state.
23
+ * Set the current collaborator info in the local state.
24
24
  */
25
- private async setCurrentUserInfo(): Promise< void > {
25
+ private async setCurrentCollaboratorInfo(): Promise< void > {
26
26
  const states = this.getStates();
27
- const otherUserColors = Array.from( states.entries() )
27
+ const otherCollaboratorColors = Array.from( states.entries() )
28
28
  .filter(
29
29
  ( [ clientId, state ] ) =>
30
- state.userInfo && clientId !== this.clientID
30
+ state.collaboratorInfo && clientId !== this.clientID
31
31
  )
32
- .map( ( [ , state ] ) => state.userInfo.color )
32
+ .map( ( [ , state ] ) => state.collaboratorInfo.color )
33
33
  .filter( Boolean );
34
34
 
35
35
  // Get current user info and set it in local state.
36
36
  const currentUser = await resolveSelect( coreStore ).getCurrentUser();
37
- const userInfo = generateUserInfo( currentUser, otherUserColors );
38
- this.setLocalStateField( 'userInfo', userInfo );
37
+ const collaboratorInfo = generateCollaboratorInfo(
38
+ currentUser,
39
+ otherCollaboratorColors
40
+ );
41
+ this.setLocalStateField( 'collaboratorInfo', collaboratorInfo );
39
42
  }
40
43
  }
41
44
 
42
45
  export const baseEqualityFieldChecks = {
43
- userInfo: areUserInfosEqual,
46
+ collaboratorInfo: areCollaboratorInfosEqual,
44
47
  };
45
48
 
46
49
  export class BaseAwareness extends BaseAwarenessState< BaseState > {
@@ -7,3 +7,8 @@ export const AWARENESS_CURSOR_UPDATE_THROTTLE_IN_MS = 100;
7
7
  * Delay in milliseconds before updating the cursor position.
8
8
  */
9
9
  export const LOCAL_CURSOR_UPDATE_DEBOUNCE_IN_MS = 5;
10
+
11
+ /**
12
+ * Delay in milliseconds before removing a collaborator from presence indicators.
13
+ */
14
+ export const REMOVAL_DELAY_IN_MS = 5000;