@liveblocks/core 2.14.0-v2encoding → 2.15.0-debug1
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/README.md +1 -1
- package/dist/index.d.mts +86 -29
- package/dist/index.d.ts +86 -29
- package/dist/index.js +239 -301
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -276
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,4 +9,4 @@ not import anything directly from this package**.
|
|
|
9
9
|
- At the `packages/liveblocks-core` root level, add a file `.env`
|
|
10
10
|
- In this file, add the environment variable:
|
|
11
11
|
`LIVEBLOCKS_PUBLIC_KEY="pk_YOUR_PUBLIC_API_KEY"`
|
|
12
|
-
- Run `
|
|
12
|
+
- Run `turbo run test:e2e`
|
package/dist/index.d.mts
CHANGED
|
@@ -1130,13 +1130,11 @@ declare type FetchYDocClientMsg = {
|
|
|
1130
1130
|
readonly type: ClientMsgCode.FETCH_YDOC;
|
|
1131
1131
|
readonly vector: string;
|
|
1132
1132
|
readonly guid?: string;
|
|
1133
|
-
readonly v2?: boolean;
|
|
1134
1133
|
};
|
|
1135
1134
|
declare type UpdateYDocClientMsg = {
|
|
1136
1135
|
readonly type: ClientMsgCode.UPDATE_YDOC;
|
|
1137
1136
|
readonly update: string;
|
|
1138
1137
|
readonly guid?: string;
|
|
1139
|
-
readonly v2?: boolean;
|
|
1140
1138
|
};
|
|
1141
1139
|
|
|
1142
1140
|
declare type IdTuple<T> = [id: string, value: T];
|
|
@@ -1339,7 +1337,6 @@ declare type YDocUpdateServerMsg = {
|
|
|
1339
1337
|
readonly isSync: boolean;
|
|
1340
1338
|
readonly stateVector: string | null;
|
|
1341
1339
|
readonly guid?: string;
|
|
1342
|
-
readonly v2?: boolean;
|
|
1343
1340
|
};
|
|
1344
1341
|
/**
|
|
1345
1342
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
@@ -1911,11 +1908,11 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
1911
1908
|
*
|
|
1912
1909
|
* @param {string} data the doc update to send to the server, base64 encoded uint8array
|
|
1913
1910
|
*/
|
|
1914
|
-
updateYDoc(data: string, guid?: string
|
|
1911
|
+
updateYDoc(data: string, guid?: string): void;
|
|
1915
1912
|
/**
|
|
1916
1913
|
* Sends a request for the current document from liveblocks server
|
|
1917
1914
|
*/
|
|
1918
|
-
fetchYDoc(stateVector: string, guid?: string
|
|
1915
|
+
fetchYDoc(stateVector: string, guid?: string): void;
|
|
1919
1916
|
/**
|
|
1920
1917
|
* Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
|
|
1921
1918
|
* @param {any} event the event to broadcast. Should be serializable to JSON
|
|
@@ -2587,24 +2584,93 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
2587
2584
|
}
|
|
2588
2585
|
|
|
2589
2586
|
/**
|
|
2590
|
-
*
|
|
2587
|
+
* Back-port of TypeScript 5.4's built-in NoInfer utility type.
|
|
2588
|
+
* See https://stackoverflow.com/a/56688073/148872
|
|
2591
2589
|
*/
|
|
2592
|
-
declare type
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
subscribe: (callback: () => void) => () => void;
|
|
2596
|
-
batch: (callback: () => void) => void;
|
|
2597
|
-
};
|
|
2590
|
+
declare type NoInfr<A> = [A][A extends any ? 0 : never];
|
|
2591
|
+
|
|
2592
|
+
declare const kTrigger: unique symbol;
|
|
2598
2593
|
/**
|
|
2599
|
-
*
|
|
2594
|
+
* Runs a callback function that is allowed to change multiple signals. At the
|
|
2595
|
+
* end of the batch, all changed signals will be notified (at most once).
|
|
2596
|
+
*
|
|
2597
|
+
* Nesting batches is supported.
|
|
2600
2598
|
*/
|
|
2601
|
-
declare function
|
|
2602
|
-
|
|
2599
|
+
declare function batch(callback: Callback<void>): void;
|
|
2600
|
+
declare type SignalType<S extends ISignal<any>> = S extends ISignal<infer T> ? T : never;
|
|
2601
|
+
interface ISignal<T> {
|
|
2602
|
+
get(): T;
|
|
2603
|
+
subscribe(callback: Callback<void>): UnsubscribeCallback;
|
|
2604
|
+
addSink(sink: DerivedSignal<unknown>): void;
|
|
2605
|
+
removeSink(sink: DerivedSignal<unknown>): void;
|
|
2606
|
+
}
|
|
2603
2607
|
/**
|
|
2604
|
-
*
|
|
2605
|
-
* See https://stackoverflow.com/a/56688073/148872
|
|
2608
|
+
* Base functionality every Signal implementation needs.
|
|
2606
2609
|
*/
|
|
2607
|
-
declare
|
|
2610
|
+
declare abstract class AbstractSignal<T> implements ISignal<T>, Observable<void> {
|
|
2611
|
+
#private;
|
|
2612
|
+
constructor(equals?: (a: T, b: T) => boolean);
|
|
2613
|
+
[Symbol.dispose](): void;
|
|
2614
|
+
abstract get(): T;
|
|
2615
|
+
get hasWatchers(): boolean;
|
|
2616
|
+
[kTrigger](): void;
|
|
2617
|
+
subscribe(callback: Callback<void>): UnsubscribeCallback;
|
|
2618
|
+
subscribeOnce(callback: Callback<void>): UnsubscribeCallback;
|
|
2619
|
+
waitUntil(): never;
|
|
2620
|
+
markSinksDirty(): void;
|
|
2621
|
+
addSink(sink: DerivedSignal<unknown>): void;
|
|
2622
|
+
removeSink(sink: DerivedSignal<unknown>): void;
|
|
2623
|
+
}
|
|
2624
|
+
declare class Signal<T> extends AbstractSignal<T> {
|
|
2625
|
+
#private;
|
|
2626
|
+
constructor(value: T, equals?: (a: T, b: T) => boolean);
|
|
2627
|
+
[Symbol.dispose](): void;
|
|
2628
|
+
get(): T;
|
|
2629
|
+
set(newValue: T | ((oldValue: T) => T)): void;
|
|
2630
|
+
}
|
|
2631
|
+
declare class DerivedSignal<T> extends AbstractSignal<T> {
|
|
2632
|
+
#private;
|
|
2633
|
+
static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
|
|
2634
|
+
[K in keyof Ts]: ISignal<Ts[K]>;
|
|
2635
|
+
}, transform: (...values: Ts) => V]): DerivedSignal<V>;
|
|
2636
|
+
static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
|
|
2637
|
+
[K in keyof Ts]: ISignal<Ts[K]>;
|
|
2638
|
+
}, transform: (...values: Ts) => V, equals: (a: V, b: V) => boolean]): DerivedSignal<V>;
|
|
2639
|
+
private constructor();
|
|
2640
|
+
[Symbol.dispose](): void;
|
|
2641
|
+
get isDirty(): boolean;
|
|
2642
|
+
markDirty(): void;
|
|
2643
|
+
get(): T;
|
|
2644
|
+
/**
|
|
2645
|
+
* Called by the Signal system if one or more of the dependent signals have
|
|
2646
|
+
* changed. In the case of a DerivedSignal, we'll only want to re-evaluate
|
|
2647
|
+
* the actual value if it's being watched, or any of their sinks are being
|
|
2648
|
+
* watched actively.
|
|
2649
|
+
*/
|
|
2650
|
+
[kTrigger](): void;
|
|
2651
|
+
}
|
|
2652
|
+
/**
|
|
2653
|
+
* A MutableSignal is a bit like Signal, except its state is managed by
|
|
2654
|
+
* a single value whose reference does not change but is mutated.
|
|
2655
|
+
*
|
|
2656
|
+
* Similar to how useSyncExternalState() works in React, there is a way to read
|
|
2657
|
+
* the current state at any point in time synchronously, and a way to update
|
|
2658
|
+
* its reference.
|
|
2659
|
+
*/
|
|
2660
|
+
declare class MutableSignal<T extends object> extends AbstractSignal<T> {
|
|
2661
|
+
#private;
|
|
2662
|
+
constructor(initialState: T);
|
|
2663
|
+
[Symbol.dispose](): void;
|
|
2664
|
+
get(): T;
|
|
2665
|
+
/**
|
|
2666
|
+
* Invokes a callback function that is allowed to mutate the given state
|
|
2667
|
+
* value. Do not change the value outside of the callback.
|
|
2668
|
+
*
|
|
2669
|
+
* If the callback explicitly returns `false`, it's assumed that the state
|
|
2670
|
+
* was not changed.
|
|
2671
|
+
*/
|
|
2672
|
+
mutate(callback?: (state: T) => unknown): void;
|
|
2673
|
+
}
|
|
2608
2674
|
|
|
2609
2675
|
declare type OptionalPromise<T> = T | Promise<T>;
|
|
2610
2676
|
|
|
@@ -2639,15 +2705,6 @@ declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS>
|
|
|
2639
2705
|
* the authentication endpoint or connect via WebSocket.
|
|
2640
2706
|
*/
|
|
2641
2707
|
autoConnect?: boolean;
|
|
2642
|
-
/**
|
|
2643
|
-
* Only necessary when you’re using Liveblocks with React v17 or lower.
|
|
2644
|
-
*
|
|
2645
|
-
* If so, pass in a reference to `ReactDOM.unstable_batchedUpdates` here.
|
|
2646
|
-
* This will allow Liveblocks to circumvent the so-called "zombie child
|
|
2647
|
-
* problem". To learn more, see
|
|
2648
|
-
* https://liveblocks.io/docs/guides/troubleshooting#stale-props-zombie-child
|
|
2649
|
-
*/
|
|
2650
|
-
unstable_batchedUpdates?: (cb: () => void) => void;
|
|
2651
2708
|
} & PartialUnless<P, {
|
|
2652
2709
|
/**
|
|
2653
2710
|
* The initial Presence to use and announce when you enter the Room. The
|
|
@@ -2677,7 +2734,7 @@ declare type InternalSyncStatus = SyncStatus | "has-local-changes";
|
|
|
2677
2734
|
* will probably happen if you do.
|
|
2678
2735
|
*/
|
|
2679
2736
|
declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
2680
|
-
readonly
|
|
2737
|
+
readonly currentUserId: Signal<string | undefined>;
|
|
2681
2738
|
readonly mentionSuggestionsCache: Map<string, string[]>;
|
|
2682
2739
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
2683
2740
|
readonly usersStore: BatchStore<U["info"] | undefined, string>;
|
|
@@ -3654,4 +3711,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3654
3711
|
/** @deprecated Use HttpError instead. */
|
|
3655
3712
|
declare const NotificationsApiError: typeof HttpError;
|
|
3656
3713
|
|
|
3657
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, SortedList, type Status, type StorageStatus, type StorageUpdate, type
|
|
3714
|
+
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -1130,13 +1130,11 @@ declare type FetchYDocClientMsg = {
|
|
|
1130
1130
|
readonly type: ClientMsgCode.FETCH_YDOC;
|
|
1131
1131
|
readonly vector: string;
|
|
1132
1132
|
readonly guid?: string;
|
|
1133
|
-
readonly v2?: boolean;
|
|
1134
1133
|
};
|
|
1135
1134
|
declare type UpdateYDocClientMsg = {
|
|
1136
1135
|
readonly type: ClientMsgCode.UPDATE_YDOC;
|
|
1137
1136
|
readonly update: string;
|
|
1138
1137
|
readonly guid?: string;
|
|
1139
|
-
readonly v2?: boolean;
|
|
1140
1138
|
};
|
|
1141
1139
|
|
|
1142
1140
|
declare type IdTuple<T> = [id: string, value: T];
|
|
@@ -1339,7 +1337,6 @@ declare type YDocUpdateServerMsg = {
|
|
|
1339
1337
|
readonly isSync: boolean;
|
|
1340
1338
|
readonly stateVector: string | null;
|
|
1341
1339
|
readonly guid?: string;
|
|
1342
|
-
readonly v2?: boolean;
|
|
1343
1340
|
};
|
|
1344
1341
|
/**
|
|
1345
1342
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
@@ -1911,11 +1908,11 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
1911
1908
|
*
|
|
1912
1909
|
* @param {string} data the doc update to send to the server, base64 encoded uint8array
|
|
1913
1910
|
*/
|
|
1914
|
-
updateYDoc(data: string, guid?: string
|
|
1911
|
+
updateYDoc(data: string, guid?: string): void;
|
|
1915
1912
|
/**
|
|
1916
1913
|
* Sends a request for the current document from liveblocks server
|
|
1917
1914
|
*/
|
|
1918
|
-
fetchYDoc(stateVector: string, guid?: string
|
|
1915
|
+
fetchYDoc(stateVector: string, guid?: string): void;
|
|
1919
1916
|
/**
|
|
1920
1917
|
* Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
|
|
1921
1918
|
* @param {any} event the event to broadcast. Should be serializable to JSON
|
|
@@ -2587,24 +2584,93 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
2587
2584
|
}
|
|
2588
2585
|
|
|
2589
2586
|
/**
|
|
2590
|
-
*
|
|
2587
|
+
* Back-port of TypeScript 5.4's built-in NoInfer utility type.
|
|
2588
|
+
* See https://stackoverflow.com/a/56688073/148872
|
|
2591
2589
|
*/
|
|
2592
|
-
declare type
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
subscribe: (callback: () => void) => () => void;
|
|
2596
|
-
batch: (callback: () => void) => void;
|
|
2597
|
-
};
|
|
2590
|
+
declare type NoInfr<A> = [A][A extends any ? 0 : never];
|
|
2591
|
+
|
|
2592
|
+
declare const kTrigger: unique symbol;
|
|
2598
2593
|
/**
|
|
2599
|
-
*
|
|
2594
|
+
* Runs a callback function that is allowed to change multiple signals. At the
|
|
2595
|
+
* end of the batch, all changed signals will be notified (at most once).
|
|
2596
|
+
*
|
|
2597
|
+
* Nesting batches is supported.
|
|
2600
2598
|
*/
|
|
2601
|
-
declare function
|
|
2602
|
-
|
|
2599
|
+
declare function batch(callback: Callback<void>): void;
|
|
2600
|
+
declare type SignalType<S extends ISignal<any>> = S extends ISignal<infer T> ? T : never;
|
|
2601
|
+
interface ISignal<T> {
|
|
2602
|
+
get(): T;
|
|
2603
|
+
subscribe(callback: Callback<void>): UnsubscribeCallback;
|
|
2604
|
+
addSink(sink: DerivedSignal<unknown>): void;
|
|
2605
|
+
removeSink(sink: DerivedSignal<unknown>): void;
|
|
2606
|
+
}
|
|
2603
2607
|
/**
|
|
2604
|
-
*
|
|
2605
|
-
* See https://stackoverflow.com/a/56688073/148872
|
|
2608
|
+
* Base functionality every Signal implementation needs.
|
|
2606
2609
|
*/
|
|
2607
|
-
declare
|
|
2610
|
+
declare abstract class AbstractSignal<T> implements ISignal<T>, Observable<void> {
|
|
2611
|
+
#private;
|
|
2612
|
+
constructor(equals?: (a: T, b: T) => boolean);
|
|
2613
|
+
[Symbol.dispose](): void;
|
|
2614
|
+
abstract get(): T;
|
|
2615
|
+
get hasWatchers(): boolean;
|
|
2616
|
+
[kTrigger](): void;
|
|
2617
|
+
subscribe(callback: Callback<void>): UnsubscribeCallback;
|
|
2618
|
+
subscribeOnce(callback: Callback<void>): UnsubscribeCallback;
|
|
2619
|
+
waitUntil(): never;
|
|
2620
|
+
markSinksDirty(): void;
|
|
2621
|
+
addSink(sink: DerivedSignal<unknown>): void;
|
|
2622
|
+
removeSink(sink: DerivedSignal<unknown>): void;
|
|
2623
|
+
}
|
|
2624
|
+
declare class Signal<T> extends AbstractSignal<T> {
|
|
2625
|
+
#private;
|
|
2626
|
+
constructor(value: T, equals?: (a: T, b: T) => boolean);
|
|
2627
|
+
[Symbol.dispose](): void;
|
|
2628
|
+
get(): T;
|
|
2629
|
+
set(newValue: T | ((oldValue: T) => T)): void;
|
|
2630
|
+
}
|
|
2631
|
+
declare class DerivedSignal<T> extends AbstractSignal<T> {
|
|
2632
|
+
#private;
|
|
2633
|
+
static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
|
|
2634
|
+
[K in keyof Ts]: ISignal<Ts[K]>;
|
|
2635
|
+
}, transform: (...values: Ts) => V]): DerivedSignal<V>;
|
|
2636
|
+
static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
|
|
2637
|
+
[K in keyof Ts]: ISignal<Ts[K]>;
|
|
2638
|
+
}, transform: (...values: Ts) => V, equals: (a: V, b: V) => boolean]): DerivedSignal<V>;
|
|
2639
|
+
private constructor();
|
|
2640
|
+
[Symbol.dispose](): void;
|
|
2641
|
+
get isDirty(): boolean;
|
|
2642
|
+
markDirty(): void;
|
|
2643
|
+
get(): T;
|
|
2644
|
+
/**
|
|
2645
|
+
* Called by the Signal system if one or more of the dependent signals have
|
|
2646
|
+
* changed. In the case of a DerivedSignal, we'll only want to re-evaluate
|
|
2647
|
+
* the actual value if it's being watched, or any of their sinks are being
|
|
2648
|
+
* watched actively.
|
|
2649
|
+
*/
|
|
2650
|
+
[kTrigger](): void;
|
|
2651
|
+
}
|
|
2652
|
+
/**
|
|
2653
|
+
* A MutableSignal is a bit like Signal, except its state is managed by
|
|
2654
|
+
* a single value whose reference does not change but is mutated.
|
|
2655
|
+
*
|
|
2656
|
+
* Similar to how useSyncExternalState() works in React, there is a way to read
|
|
2657
|
+
* the current state at any point in time synchronously, and a way to update
|
|
2658
|
+
* its reference.
|
|
2659
|
+
*/
|
|
2660
|
+
declare class MutableSignal<T extends object> extends AbstractSignal<T> {
|
|
2661
|
+
#private;
|
|
2662
|
+
constructor(initialState: T);
|
|
2663
|
+
[Symbol.dispose](): void;
|
|
2664
|
+
get(): T;
|
|
2665
|
+
/**
|
|
2666
|
+
* Invokes a callback function that is allowed to mutate the given state
|
|
2667
|
+
* value. Do not change the value outside of the callback.
|
|
2668
|
+
*
|
|
2669
|
+
* If the callback explicitly returns `false`, it's assumed that the state
|
|
2670
|
+
* was not changed.
|
|
2671
|
+
*/
|
|
2672
|
+
mutate(callback?: (state: T) => unknown): void;
|
|
2673
|
+
}
|
|
2608
2674
|
|
|
2609
2675
|
declare type OptionalPromise<T> = T | Promise<T>;
|
|
2610
2676
|
|
|
@@ -2639,15 +2705,6 @@ declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS>
|
|
|
2639
2705
|
* the authentication endpoint or connect via WebSocket.
|
|
2640
2706
|
*/
|
|
2641
2707
|
autoConnect?: boolean;
|
|
2642
|
-
/**
|
|
2643
|
-
* Only necessary when you’re using Liveblocks with React v17 or lower.
|
|
2644
|
-
*
|
|
2645
|
-
* If so, pass in a reference to `ReactDOM.unstable_batchedUpdates` here.
|
|
2646
|
-
* This will allow Liveblocks to circumvent the so-called "zombie child
|
|
2647
|
-
* problem". To learn more, see
|
|
2648
|
-
* https://liveblocks.io/docs/guides/troubleshooting#stale-props-zombie-child
|
|
2649
|
-
*/
|
|
2650
|
-
unstable_batchedUpdates?: (cb: () => void) => void;
|
|
2651
2708
|
} & PartialUnless<P, {
|
|
2652
2709
|
/**
|
|
2653
2710
|
* The initial Presence to use and announce when you enter the Room. The
|
|
@@ -2677,7 +2734,7 @@ declare type InternalSyncStatus = SyncStatus | "has-local-changes";
|
|
|
2677
2734
|
* will probably happen if you do.
|
|
2678
2735
|
*/
|
|
2679
2736
|
declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
2680
|
-
readonly
|
|
2737
|
+
readonly currentUserId: Signal<string | undefined>;
|
|
2681
2738
|
readonly mentionSuggestionsCache: Map<string, string[]>;
|
|
2682
2739
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
2683
2740
|
readonly usersStore: BatchStore<U["info"] | undefined, string>;
|
|
@@ -3654,4 +3711,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3654
3711
|
/** @deprecated Use HttpError instead. */
|
|
3655
3712
|
declare const NotificationsApiError: typeof HttpError;
|
|
3656
3713
|
|
|
3657
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, SortedList, type Status, type StorageStatus, type StorageUpdate, type
|
|
3714
|
+
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|