@liveblocks/react
Advanced tools
Comparing version 0.16.12 to 0.16.13
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { Client } from '@liveblocks/client'; | ||
@@ -24,34 +23,34 @@ export { Json, JsonObject } from '@liveblocks/client'; | ||
children: React.ReactNode; | ||
initialPresence?: Record<string, unknown> | ((roomId: string) => Record<string, unknown>) | undefined; | ||
initialPresence?: _liveblocks_client_shared.P | ((roomId: string) => _liveblocks_client_shared.P) | undefined; | ||
initialStorage?: TStorage | ((roomId: string) => TStorage) | undefined; | ||
defaultPresence?: (() => Record<string, unknown>) | undefined; | ||
defaultPresence?: (() => _liveblocks_client_shared.P) | undefined; | ||
defaultStorageRoot?: TStorage | undefined; | ||
}) => JSX.Element; | ||
declare const useRoom: () => _liveblocks_client_shared.R; | ||
declare const useMyPresence: <T extends Record<string, unknown>>() => [T, (overrides: Partial<T>, options?: { | ||
declare const useMyPresence: <T extends _liveblocks_client_shared.P>() => [T, (overrides: Partial<T>, options?: { | ||
addToHistory: boolean; | ||
} | undefined) => void]; | ||
declare const useUpdateMyPresence: <T extends Record<string, unknown>>() => (overrides: Partial<T>, options?: { | ||
declare const useUpdateMyPresence: <T extends _liveblocks_client_shared.P>() => (overrides: Partial<T>, options?: { | ||
addToHistory: boolean; | ||
} | undefined) => void; | ||
declare const useOthers: <T extends Record<string, unknown>>() => _liveblocks_client_shared.O<T>; | ||
declare const useOthers: <T extends _liveblocks_client_shared.P>() => _liveblocks_client_shared.O<T>; | ||
declare const useBroadcastEvent: () => (event: any, options?: _liveblocks_client_shared.B | undefined) => void; | ||
declare const useErrorListener: (callback: (err: Error) => void) => void; | ||
declare const useEventListener: <TEvent extends _liveblocks_client_shared.J>(callback: ({ connectionId, event, }: { | ||
declare const useEventListener: (callback: ({ connectionId, event, }: { | ||
connectionId: number; | ||
event: TEvent; | ||
event: _liveblocks_client_shared.J; | ||
}) => void) => void; | ||
declare const useSelf: <TPresence extends Record<string, unknown> = Record<string, unknown>>() => _liveblocks_client_shared.U<TPresence> | null; | ||
declare const useStorage: <TStorage extends Record<string, any>>() => [root: _liveblocks_client_shared.L<TStorage> | null]; | ||
declare const useSelf: <TPresence extends _liveblocks_client_shared.P = _liveblocks_client_shared.P>() => _liveblocks_client_shared.U<TPresence> | null; | ||
declare const useStorage: <TStorage extends Record<string, any>>() => [root: _liveblocks_client_shared.c<TStorage> | null]; | ||
declare const useMap: { | ||
<TKey extends string, TValue extends _liveblocks_client_shared.e>(key: string): _liveblocks_client_shared.b<TKey, TValue> | null; | ||
<TKey_1 extends string, TValue_1 extends _liveblocks_client_shared.e>(key: string, entries: readonly (readonly [TKey_1, TValue_1])[] | null): _liveblocks_client_shared.b<TKey_1, TValue_1> | null; | ||
<TKey extends string, TValue extends _liveblocks_client_shared.f>(key: string): _liveblocks_client_shared.b<TKey, TValue> | null; | ||
<TKey_1 extends string, TValue_1 extends _liveblocks_client_shared.f>(key: string, entries: readonly (readonly [TKey_1, TValue_1])[] | null): _liveblocks_client_shared.b<TKey_1, TValue_1> | null; | ||
}; | ||
declare const useList: { | ||
<TValue extends _liveblocks_client_shared.e>(key: string): _liveblocks_client_shared.c<TValue> | null; | ||
<TValue_1 extends _liveblocks_client_shared.e>(key: string, items: TValue_1[]): _liveblocks_client_shared.c<TValue_1> | null; | ||
<TValue extends _liveblocks_client_shared.f>(key: string): _liveblocks_client_shared.L<TValue> | null; | ||
<TValue_1 extends _liveblocks_client_shared.f>(key: string, items: TValue_1[]): _liveblocks_client_shared.L<TValue_1> | null; | ||
}; | ||
declare const useObject: { | ||
<TData extends _liveblocks_client_shared.f>(key: string): _liveblocks_client_shared.L<TData> | null; | ||
<TData_1 extends _liveblocks_client_shared.f>(key: string, initialData: TData_1): _liveblocks_client_shared.L<TData_1> | null; | ||
<TData extends _liveblocks_client_shared.g>(key: string): _liveblocks_client_shared.c<TData> | null; | ||
<TData_1 extends _liveblocks_client_shared.g>(key: string, initialData: TData_1): _liveblocks_client_shared.c<TData_1> | null; | ||
}; | ||
@@ -58,0 +57,0 @@ declare const useUndo: () => () => void; |
18
index.js
@@ -136,4 +136,4 @@ "use strict"; | ||
} | ||
internal.deprecateIf(defaultPresence, "RoomProvider's `defaultPresence` prop will be removed in @liveblocks/react 0.18. Please use `initialPresence` instead. For more info, see https://bit.ly/3Niy5aP", "defaultPresence"), | ||
internal.deprecateIf(defaultStorageRoot, "RoomProvider's `defaultStorageRoot` prop will be removed in @liveblocks/react 0.18. Please use `initialStorage` instead. For more info, see https://bit.ly/3Niy5aP", "defaultStorageRoot"); | ||
internal.errorIf(defaultPresence, "RoomProvider's `defaultPresence` prop will be removed in @liveblocks/react 0.18. Please use `initialPresence` instead. For more info, see https://bit.ly/3Niy5aP"), | ||
internal.errorIf(defaultStorageRoot, "RoomProvider's `defaultStorageRoot` prop will be removed in @liveblocks/react 0.18. Please use `initialStorage` instead. For more info, see https://bit.ly/3Niy5aP"); | ||
var client = useClient(), _React$useState = React__namespace.useState((function() { | ||
@@ -192,3 +192,3 @@ return client.enter(roomId, { | ||
var unsubscribe = room.subscribe("event", (function(e) { | ||
return savedCallback.current(e); | ||
savedCallback.current(e); | ||
})); | ||
@@ -202,11 +202,11 @@ return function() { | ||
useList: function(key, items) { | ||
internal.deprecateIf(items, 'Support for initializing items in useList() directly will be removed in @liveblocks/react 0.18.\n\nInstead, please initialize this data where you set up your RoomProvider:\n\n import { LiveList } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveList(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."); | ||
internal.errorIf(items, 'Support for initializing items in useList() directly will be removed in @liveblocks/react 0.18.\n\nInstead, please initialize this data where you set up your RoomProvider:\n\n import { LiveList } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveList(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."); | ||
var value = useStorageValue(key, new client.LiveList(items)); | ||
return "ok" === value.status ? value.value : (internal.deprecateIf("notfound" === value.status, "Key " + JSON.stringify(key) + ' was not found in Storage. Starting with 0.18, useList() will no longer automatically create this key.\n\nInstead, please initialize your storage where you set up your RoomProvider:\n\n import { LiveList } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveList(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."), | ||
return "ok" === value.status ? value.value : (internal.errorIf("notfound" === value.status, "Key " + JSON.stringify(key) + ' was not found in Storage. Starting with 0.18, useList() will no longer automatically create this key.\n\nInstead, please initialize your storage where you set up your RoomProvider:\n\n import { LiveList } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveList(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."), | ||
null); | ||
}, | ||
useMap: function(key, entries) { | ||
internal.deprecateIf(entries, "Support for initializing entries in useMap() directly will be removed in @liveblocks/react 0.18.\n\nInstead, please initialize this data where you set up your RoomProvider:\n\n const initialStorage = () => ({\n " + JSON.stringify(key) + ": new LiveMap(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."); | ||
internal.errorIf(entries, "Support for initializing entries in useMap() directly will be removed in @liveblocks/react 0.18.\n\nInstead, please initialize this data where you set up your RoomProvider:\n\n const initialStorage = () => ({\n " + JSON.stringify(key) + ": new LiveMap(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."); | ||
var value = useStorageValue(key, new client.LiveMap(null != entries ? entries : void 0)); | ||
return "ok" === value.status ? value.value : (internal.deprecateIf("notfound" === value.status, "Key " + JSON.stringify(key) + ' was not found in Storage. Starting with 0.18, useMap() will no longer automatically create this key.\n\nInstead, please initialize your storage where you set up your RoomProvider:\n\n import { LiveMap } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveMap(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."), | ||
return "ok" === value.status ? value.value : (internal.errorIf("notfound" === value.status, "Key " + JSON.stringify(key) + ' was not found in Storage. Starting with 0.18, useMap() will no longer automatically create this key.\n\nInstead, please initialize your storage where you set up your RoomProvider:\n\n import { LiveMap } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveMap(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."), | ||
null); | ||
@@ -226,5 +226,5 @@ }, | ||
useObject: function(key, initialData) { | ||
internal.deprecateIf(initialData, 'Support for initializing data in useObject() directly will be removed in @liveblocks/react 0.18.\n\nInstead, please initialize this data where you set up your RoomProvider:\n\n import { LiveObject } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveObject(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."); | ||
internal.errorIf(initialData, 'Support for initializing data in useObject() directly will be removed in @liveblocks/react 0.18.\n\nInstead, please initialize this data where you set up your RoomProvider:\n\n import { LiveObject } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveObject(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."); | ||
var value = useStorageValue(key, new client.LiveObject(initialData)); | ||
return "ok" === value.status ? value.value : (internal.deprecateIf("notfound" === value.status, "Key " + JSON.stringify(key) + ' was not found in Storage. Starting with 0.18, useObject() will no longer automatically create this key.\n\nInstead, please initialize your storage where you set up your RoomProvider:\n\n import { LiveObject } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveObject(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."), | ||
return "ok" === value.status ? value.value : (internal.errorIf("notfound" === value.status, "Key " + JSON.stringify(key) + ' was not found in Storage. Starting with 0.18, useObject() will no longer automatically create this key.\n\nInstead, please initialize your storage where you set up your RoomProvider:\n\n import { LiveObject } from "@liveblocks/client";\n\n const initialStorage = () => ({\n ' + JSON.stringify(key) + ": new LiveObject(...),\n ...\n });\n\n <RoomProvider initialStorage={initialStorage}>\n ...\n </RoomProvider>\n\nPlease see https://bit.ly/3Niy5aP for details."), | ||
null); | ||
@@ -231,0 +231,0 @@ }, |
{ | ||
"name": "@liveblocks/react", | ||
"version": "0.16.12", | ||
"version": "0.16.13", | ||
"description": "A set of React hooks and providers to use Liveblocks declaratively.", | ||
@@ -26,8 +26,8 @@ "main": "./index.js", | ||
"lint": "eslint src/", | ||
"test": "jest --watch", | ||
"test-ci": "jest" | ||
"test": "jest --watch --silent --verbose", | ||
"test-ci": "jest --silent --verbose" | ||
}, | ||
"license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@liveblocks/client": "0.16.12", | ||
"@liveblocks/client": "0.16.13", | ||
"react": "^16.14.0 || ^17 || ^18" | ||
@@ -46,7 +46,5 @@ }, | ||
"@testing-library/react": "^13.1.1", | ||
"@types/jest": "^26.0.20", | ||
"@types/react": "^16.14.0", | ||
"@types/react-dom": "^17.0.14", | ||
"@typescript-eslint/eslint-plugin": "^5.18.0", | ||
"@typescript-eslint/parser": "^5.18.0", | ||
"@types/jest": "^26.0.24", | ||
"@typescript-eslint/eslint-plugin": "^5.26.0", | ||
"@typescript-eslint/parser": "^5.26.0", | ||
"eslint": "^8.12.0", | ||
@@ -62,3 +60,3 @@ "eslint-plugin-import": "^2.26.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"typescript": "^4.1.5", | ||
"typescript": "^4.7.2", | ||
"whatwg-fetch": "^3.6.2" | ||
@@ -65,0 +63,0 @@ }, |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
25
32230
556
1