@kedataindo/docflow-core 0.0.34 → 0.0.35
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 +19 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +19 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -201,6 +201,24 @@ function createCollaboration(options) {
|
|
|
201
201
|
awareness.on("change", notify);
|
|
202
202
|
notify();
|
|
203
203
|
}
|
|
204
|
+
const readyParts = [];
|
|
205
|
+
if (persistence) {
|
|
206
|
+
readyParts.push(
|
|
207
|
+
persistence.whenSynced.then(
|
|
208
|
+
() => void 0,
|
|
209
|
+
() => void 0
|
|
210
|
+
)
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
if (provider && options.provider === "websocket") {
|
|
214
|
+
const ws = provider;
|
|
215
|
+
readyParts.push(
|
|
216
|
+
new Promise((resolve) => {
|
|
217
|
+
ws.once("sync", () => resolve());
|
|
218
|
+
})
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
const whenReady = readyParts.length === 0 ? Promise.resolve() : Promise.all(readyParts).then(() => void 0);
|
|
204
222
|
const destroy = () => {
|
|
205
223
|
if (awarenessHandler) {
|
|
206
224
|
awareness.off("change", awarenessHandler);
|
|
@@ -211,7 +229,7 @@ function createCollaboration(options) {
|
|
|
211
229
|
void persistence?.destroy();
|
|
212
230
|
ydoc.destroy();
|
|
213
231
|
};
|
|
214
|
-
return { ydoc, provider, awareness, persistence, destroy, setLocalCursorEnabled };
|
|
232
|
+
return { ydoc, provider, awareness, persistence, whenReady, destroy, setLocalCursorEnabled };
|
|
215
233
|
}
|
|
216
234
|
function collaborationExtensions(options) {
|
|
217
235
|
const setup = "ydoc" in options ? options : createCollaboration(options);
|
package/dist/index.d.cts
CHANGED
|
@@ -99,6 +99,16 @@ interface CollaborationSetup {
|
|
|
99
99
|
* use it as a seed source.
|
|
100
100
|
*/
|
|
101
101
|
persistence?: IndexeddbPersistence;
|
|
102
|
+
/**
|
|
103
|
+
* Issue #117 — resolves after BOTH the offline mirror (if `offline`) AND
|
|
104
|
+
* the provider's first sync (if `websocket`) have completed. Hosts MUST
|
|
105
|
+
* `await setup.whenReady` before binding the editor, otherwise the
|
|
106
|
+
* TipTap view can render against the IndexedDB cache before the
|
|
107
|
+
* authoritative server state arrives, briefly showing — and on a
|
|
108
|
+
* disconnected peer potentially re-broadcasting — nodes the server has
|
|
109
|
+
* since deleted. Resolves immediately when neither side applies.
|
|
110
|
+
*/
|
|
111
|
+
whenReady: Promise<void>;
|
|
102
112
|
destroy: () => void;
|
|
103
113
|
/**
|
|
104
114
|
* Phase 9 PR2 — toggle the local cursor emission + present flag.
|
package/dist/index.d.ts
CHANGED
|
@@ -99,6 +99,16 @@ interface CollaborationSetup {
|
|
|
99
99
|
* use it as a seed source.
|
|
100
100
|
*/
|
|
101
101
|
persistence?: IndexeddbPersistence;
|
|
102
|
+
/**
|
|
103
|
+
* Issue #117 — resolves after BOTH the offline mirror (if `offline`) AND
|
|
104
|
+
* the provider's first sync (if `websocket`) have completed. Hosts MUST
|
|
105
|
+
* `await setup.whenReady` before binding the editor, otherwise the
|
|
106
|
+
* TipTap view can render against the IndexedDB cache before the
|
|
107
|
+
* authoritative server state arrives, briefly showing — and on a
|
|
108
|
+
* disconnected peer potentially re-broadcasting — nodes the server has
|
|
109
|
+
* since deleted. Resolves immediately when neither side applies.
|
|
110
|
+
*/
|
|
111
|
+
whenReady: Promise<void>;
|
|
102
112
|
destroy: () => void;
|
|
103
113
|
/**
|
|
104
114
|
* Phase 9 PR2 — toggle the local cursor emission + present flag.
|
package/dist/index.js
CHANGED
|
@@ -143,6 +143,24 @@ function createCollaboration(options) {
|
|
|
143
143
|
awareness.on("change", notify);
|
|
144
144
|
notify();
|
|
145
145
|
}
|
|
146
|
+
const readyParts = [];
|
|
147
|
+
if (persistence) {
|
|
148
|
+
readyParts.push(
|
|
149
|
+
persistence.whenSynced.then(
|
|
150
|
+
() => void 0,
|
|
151
|
+
() => void 0
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
if (provider && options.provider === "websocket") {
|
|
156
|
+
const ws = provider;
|
|
157
|
+
readyParts.push(
|
|
158
|
+
new Promise((resolve) => {
|
|
159
|
+
ws.once("sync", () => resolve());
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
const whenReady = readyParts.length === 0 ? Promise.resolve() : Promise.all(readyParts).then(() => void 0);
|
|
146
164
|
const destroy = () => {
|
|
147
165
|
if (awarenessHandler) {
|
|
148
166
|
awareness.off("change", awarenessHandler);
|
|
@@ -153,7 +171,7 @@ function createCollaboration(options) {
|
|
|
153
171
|
void persistence?.destroy();
|
|
154
172
|
ydoc.destroy();
|
|
155
173
|
};
|
|
156
|
-
return { ydoc, provider, awareness, persistence, destroy, setLocalCursorEnabled };
|
|
174
|
+
return { ydoc, provider, awareness, persistence, whenReady, destroy, setLocalCursorEnabled };
|
|
157
175
|
}
|
|
158
176
|
function collaborationExtensions(options) {
|
|
159
177
|
const setup = "ydoc" in options ? options : createCollaboration(options);
|