@yorkie-js/react 0.6.38 → 0.6.39
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/yorkie-js-react.js
CHANGED
|
@@ -22296,7 +22296,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
22296
22296
|
};
|
|
22297
22297
|
}
|
|
22298
22298
|
const name$1 = "@yorkie-js/sdk";
|
|
22299
|
-
const version$1 = "0.6.
|
|
22299
|
+
const version$1 = "0.6.39";
|
|
22300
22300
|
const pkg$1 = {
|
|
22301
22301
|
name: name$1,
|
|
22302
22302
|
version: version$1
|
|
@@ -23717,7 +23717,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
23717
23717
|
};
|
|
23718
23718
|
}
|
|
23719
23719
|
const name = "@yorkie-js/react";
|
|
23720
|
-
const version = "0.6.
|
|
23720
|
+
const version = "0.6.39";
|
|
23721
23721
|
const pkg = {
|
|
23722
23722
|
name,
|
|
23723
23723
|
version
|
|
@@ -23907,7 +23907,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
23907
23907
|
valueB
|
|
23908
23908
|
);
|
|
23909
23909
|
}
|
|
23910
|
-
function useYorkieDocument(client, clientLoading, clientError, docKey, initialRoot, initialPresence,
|
|
23910
|
+
function useYorkieDocument(client, clientLoading, clientError, docKey, initialRoot, initialPresence, enableDevtools, docStore) {
|
|
23911
23911
|
const initialRootRef = react.useRef(initialRoot);
|
|
23912
23912
|
const initialPresenceRef = react.useRef(initialPresence);
|
|
23913
23913
|
const [didMount, setDidMount] = react.useState(false);
|
|
@@ -23916,7 +23916,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
23916
23916
|
}, []);
|
|
23917
23917
|
react.useEffect(() => {
|
|
23918
23918
|
if (clientError) {
|
|
23919
|
-
|
|
23919
|
+
docStore.setState((state) => ({
|
|
23920
23920
|
...state,
|
|
23921
23921
|
loading: false,
|
|
23922
23922
|
error: clientError
|
|
@@ -23924,22 +23924,22 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
23924
23924
|
return;
|
|
23925
23925
|
}
|
|
23926
23926
|
if (!client || clientLoading || !didMount) {
|
|
23927
|
-
|
|
23927
|
+
docStore.setState((state) => ({
|
|
23928
23928
|
...state,
|
|
23929
23929
|
loading: true
|
|
23930
23930
|
}));
|
|
23931
23931
|
return;
|
|
23932
23932
|
}
|
|
23933
|
-
|
|
23933
|
+
docStore.setState((state) => ({
|
|
23934
23934
|
...state,
|
|
23935
23935
|
loading: true,
|
|
23936
23936
|
error: void 0
|
|
23937
23937
|
}));
|
|
23938
|
-
const newDoc = new Document(docKey);
|
|
23938
|
+
const newDoc = new Document(docKey, { enableDevtools });
|
|
23939
23939
|
const unsubs = [];
|
|
23940
23940
|
unsubs.push(
|
|
23941
23941
|
newDoc.subscribe(() => {
|
|
23942
|
-
|
|
23942
|
+
docStore.setState((state) => ({
|
|
23943
23943
|
...state,
|
|
23944
23944
|
root: newDoc.getRoot()
|
|
23945
23945
|
}));
|
|
@@ -23947,7 +23947,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
23947
23947
|
);
|
|
23948
23948
|
unsubs.push(
|
|
23949
23949
|
newDoc.subscribe("presence", () => {
|
|
23950
|
-
|
|
23950
|
+
docStore.setState((state) => ({
|
|
23951
23951
|
...state,
|
|
23952
23952
|
presences: newDoc.getPresences()
|
|
23953
23953
|
}));
|
|
@@ -23955,7 +23955,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
23955
23955
|
);
|
|
23956
23956
|
unsubs.push(
|
|
23957
23957
|
newDoc.subscribe("connection", (event) => {
|
|
23958
|
-
|
|
23958
|
+
docStore.setState((state) => ({
|
|
23959
23959
|
...state,
|
|
23960
23960
|
connection: event.value
|
|
23961
23961
|
}));
|
|
@@ -23971,13 +23971,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
23971
23971
|
try {
|
|
23972
23972
|
newDoc.update(callback);
|
|
23973
23973
|
} catch (err) {
|
|
23974
|
-
|
|
23974
|
+
docStore.setState((state) => ({
|
|
23975
23975
|
...state,
|
|
23976
23976
|
error: err instanceof Error ? err : new Error("Failed to update document")
|
|
23977
23977
|
}));
|
|
23978
23978
|
}
|
|
23979
23979
|
};
|
|
23980
|
-
|
|
23980
|
+
docStore.setState((state) => ({
|
|
23981
23981
|
...state,
|
|
23982
23982
|
doc: newDoc,
|
|
23983
23983
|
root: newDoc.getRoot(),
|
|
@@ -23985,12 +23985,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
23985
23985
|
update
|
|
23986
23986
|
}));
|
|
23987
23987
|
} catch (err) {
|
|
23988
|
-
|
|
23988
|
+
docStore.setState((state) => ({
|
|
23989
23989
|
...state,
|
|
23990
23990
|
error: err instanceof Error ? err : new Error("Failed to attach document")
|
|
23991
23991
|
}));
|
|
23992
23992
|
} finally {
|
|
23993
|
-
|
|
23993
|
+
docStore.setState((state) => ({
|
|
23994
23994
|
...state,
|
|
23995
23995
|
loading: false
|
|
23996
23996
|
}));
|
|
@@ -24005,13 +24005,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
24005
24005
|
unsub();
|
|
24006
24006
|
}
|
|
24007
24007
|
};
|
|
24008
|
-
}, [client, clientLoading, clientError, docKey,
|
|
24008
|
+
}, [client, clientLoading, clientError, docKey, docStore, didMount]);
|
|
24009
24009
|
}
|
|
24010
24010
|
const DocumentContext = react.createContext(void 0);
|
|
24011
24011
|
const DocumentProvider = ({
|
|
24012
24012
|
docKey,
|
|
24013
24013
|
initialRoot = {},
|
|
24014
24014
|
initialPresence = {},
|
|
24015
|
+
enableDevtools = false,
|
|
24015
24016
|
children
|
|
24016
24017
|
}) => {
|
|
24017
24018
|
const { client, loading: clientLoading, error: clientError } = useYorkie();
|
|
@@ -24036,6 +24037,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
24036
24037
|
docKey,
|
|
24037
24038
|
initialRoot,
|
|
24038
24039
|
initialPresence,
|
|
24040
|
+
enableDevtools,
|
|
24039
24041
|
documentStore
|
|
24040
24042
|
);
|
|
24041
24043
|
return /* @__PURE__ */ jsxRuntime.jsx(DocumentContext.Provider, { value: documentStore, children });
|
|
@@ -24110,6 +24112,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
24110
24112
|
docKey,
|
|
24111
24113
|
(opts == null ? void 0 : opts.initialRoot) ?? {},
|
|
24112
24114
|
(opts == null ? void 0 : opts.initialPresence) ?? {},
|
|
24115
|
+
(opts == null ? void 0 : opts.enableDevtools) ?? false,
|
|
24113
24116
|
documentStore
|
|
24114
24117
|
);
|
|
24115
24118
|
const documentState = useSelector(documentStore);
|