@liveblocks/core 3.14.0-pre3 → 3.14.0-pre5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +329 -197
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -6
- package/dist/index.d.ts +25 -6
- package/dist/index.js +269 -137
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -716,6 +716,7 @@ type ObjectStorageNode = [id: string, value: SerializedObject];
|
|
|
716
716
|
type ListStorageNode = [id: string, value: SerializedList];
|
|
717
717
|
type MapStorageNode = [id: string, value: SerializedMap];
|
|
718
718
|
type RegisterStorageNode = [id: string, value: SerializedRegister];
|
|
719
|
+
type NodeMap = Map<string, SerializedCrdt>;
|
|
719
720
|
type NodeStream = Iterable<StorageNode>;
|
|
720
721
|
declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
|
|
721
722
|
declare function isObjectStorageNode(node: StorageNode): node is RootStorageNode | ObjectStorageNode;
|
|
@@ -4614,11 +4615,6 @@ declare function convertToSubscriptionData(data: SubscriptionDataPlain): Subscri
|
|
|
4614
4615
|
declare function convertToUserSubscriptionData(data: UserSubscriptionDataPlain): UserSubscriptionData;
|
|
4615
4616
|
declare function convertToGroupData(data: GroupDataPlain): GroupData;
|
|
4616
4617
|
|
|
4617
|
-
/**
|
|
4618
|
-
* Lookup table for nodes (= SerializedCrdt values) by their IDs.
|
|
4619
|
-
*/
|
|
4620
|
-
type NodeMap = Map<string, // Node ID
|
|
4621
|
-
SerializedCrdt>;
|
|
4622
4618
|
/**
|
|
4623
4619
|
* Reverse lookup table for all child nodes (= list of SerializedCrdt values)
|
|
4624
4620
|
* by their parent node's IDs.
|
|
@@ -5068,6 +5064,9 @@ declare function shallow2(a: unknown, b: unknown): boolean;
|
|
|
5068
5064
|
declare class SortedList<T> {
|
|
5069
5065
|
#private;
|
|
5070
5066
|
private constructor();
|
|
5067
|
+
/**
|
|
5068
|
+
* Creates an empty SortedList with the given "less than" function.
|
|
5069
|
+
*/
|
|
5071
5070
|
static with<T>(lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
5072
5071
|
static from<T>(arr: readonly T[], lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
5073
5072
|
static fromAlreadySorted<T>(alreadySorted: T[], lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
@@ -5077,8 +5076,9 @@ declare class SortedList<T> {
|
|
|
5077
5076
|
clone(): SortedList<T>;
|
|
5078
5077
|
/**
|
|
5079
5078
|
* Adds a new item to the sorted list, such that it remains sorted.
|
|
5079
|
+
* Returns the index where the item was inserted.
|
|
5080
5080
|
*/
|
|
5081
|
-
add(value: T):
|
|
5081
|
+
add(value: T): number;
|
|
5082
5082
|
/**
|
|
5083
5083
|
* Removes all values from the sorted list, making it empty again.
|
|
5084
5084
|
* Returns whether the list was mutated or not.
|
|
@@ -5097,6 +5097,25 @@ declare class SortedList<T> {
|
|
|
5097
5097
|
* Returns whether the list was mutated or not.
|
|
5098
5098
|
*/
|
|
5099
5099
|
remove(value: T): boolean;
|
|
5100
|
+
/**
|
|
5101
|
+
* Removes the item at the given index.
|
|
5102
|
+
* Returns the removed item, or undefined if index is out of bounds.
|
|
5103
|
+
*/
|
|
5104
|
+
removeAt(index: number): T | undefined;
|
|
5105
|
+
/**
|
|
5106
|
+
* Repositions an item to maintain sorted order after its sort key has
|
|
5107
|
+
* been mutated in-place. For example:
|
|
5108
|
+
*
|
|
5109
|
+
* const item = sorted.at(3);
|
|
5110
|
+
* item.updatedAt = new Date(); // mutate the item's sort key in-place
|
|
5111
|
+
* sorted.reposition(item); // restore sorted order
|
|
5112
|
+
*
|
|
5113
|
+
* Returns the new index of the item. Throws if the item is not in the list.
|
|
5114
|
+
*
|
|
5115
|
+
* Semantically equivalent to remove(value) + add(value), but optimized
|
|
5116
|
+
* to avoid array shifting when the item only moves a short distance.
|
|
5117
|
+
*/
|
|
5118
|
+
reposition(value: T): number;
|
|
5100
5119
|
at(index: number): T | undefined;
|
|
5101
5120
|
get length(): number;
|
|
5102
5121
|
filter(predicate: (value: T) => boolean): IterableIterator<T>;
|
package/dist/index.d.ts
CHANGED
|
@@ -716,6 +716,7 @@ type ObjectStorageNode = [id: string, value: SerializedObject];
|
|
|
716
716
|
type ListStorageNode = [id: string, value: SerializedList];
|
|
717
717
|
type MapStorageNode = [id: string, value: SerializedMap];
|
|
718
718
|
type RegisterStorageNode = [id: string, value: SerializedRegister];
|
|
719
|
+
type NodeMap = Map<string, SerializedCrdt>;
|
|
719
720
|
type NodeStream = Iterable<StorageNode>;
|
|
720
721
|
declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
|
|
721
722
|
declare function isObjectStorageNode(node: StorageNode): node is RootStorageNode | ObjectStorageNode;
|
|
@@ -4614,11 +4615,6 @@ declare function convertToSubscriptionData(data: SubscriptionDataPlain): Subscri
|
|
|
4614
4615
|
declare function convertToUserSubscriptionData(data: UserSubscriptionDataPlain): UserSubscriptionData;
|
|
4615
4616
|
declare function convertToGroupData(data: GroupDataPlain): GroupData;
|
|
4616
4617
|
|
|
4617
|
-
/**
|
|
4618
|
-
* Lookup table for nodes (= SerializedCrdt values) by their IDs.
|
|
4619
|
-
*/
|
|
4620
|
-
type NodeMap = Map<string, // Node ID
|
|
4621
|
-
SerializedCrdt>;
|
|
4622
4618
|
/**
|
|
4623
4619
|
* Reverse lookup table for all child nodes (= list of SerializedCrdt values)
|
|
4624
4620
|
* by their parent node's IDs.
|
|
@@ -5068,6 +5064,9 @@ declare function shallow2(a: unknown, b: unknown): boolean;
|
|
|
5068
5064
|
declare class SortedList<T> {
|
|
5069
5065
|
#private;
|
|
5070
5066
|
private constructor();
|
|
5067
|
+
/**
|
|
5068
|
+
* Creates an empty SortedList with the given "less than" function.
|
|
5069
|
+
*/
|
|
5071
5070
|
static with<T>(lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
5072
5071
|
static from<T>(arr: readonly T[], lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
5073
5072
|
static fromAlreadySorted<T>(alreadySorted: T[], lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
@@ -5077,8 +5076,9 @@ declare class SortedList<T> {
|
|
|
5077
5076
|
clone(): SortedList<T>;
|
|
5078
5077
|
/**
|
|
5079
5078
|
* Adds a new item to the sorted list, such that it remains sorted.
|
|
5079
|
+
* Returns the index where the item was inserted.
|
|
5080
5080
|
*/
|
|
5081
|
-
add(value: T):
|
|
5081
|
+
add(value: T): number;
|
|
5082
5082
|
/**
|
|
5083
5083
|
* Removes all values from the sorted list, making it empty again.
|
|
5084
5084
|
* Returns whether the list was mutated or not.
|
|
@@ -5097,6 +5097,25 @@ declare class SortedList<T> {
|
|
|
5097
5097
|
* Returns whether the list was mutated or not.
|
|
5098
5098
|
*/
|
|
5099
5099
|
remove(value: T): boolean;
|
|
5100
|
+
/**
|
|
5101
|
+
* Removes the item at the given index.
|
|
5102
|
+
* Returns the removed item, or undefined if index is out of bounds.
|
|
5103
|
+
*/
|
|
5104
|
+
removeAt(index: number): T | undefined;
|
|
5105
|
+
/**
|
|
5106
|
+
* Repositions an item to maintain sorted order after its sort key has
|
|
5107
|
+
* been mutated in-place. For example:
|
|
5108
|
+
*
|
|
5109
|
+
* const item = sorted.at(3);
|
|
5110
|
+
* item.updatedAt = new Date(); // mutate the item's sort key in-place
|
|
5111
|
+
* sorted.reposition(item); // restore sorted order
|
|
5112
|
+
*
|
|
5113
|
+
* Returns the new index of the item. Throws if the item is not in the list.
|
|
5114
|
+
*
|
|
5115
|
+
* Semantically equivalent to remove(value) + add(value), but optimized
|
|
5116
|
+
* to avoid array shifting when the item only moves a short distance.
|
|
5117
|
+
*/
|
|
5118
|
+
reposition(value: T): number;
|
|
5100
5119
|
at(index: number): T | undefined;
|
|
5101
5120
|
get length(): number;
|
|
5102
5121
|
filter(predicate: (value: T) => boolean): IterableIterator<T>;
|