plitejs 0.0.1 → 54.0.0-beta.3
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/LICENSE +4 -1
- package/README.md +83 -0
- package/dist/annotation-store-metrics-Ccjkef45.js +12 -0
- package/dist/annotations/index.d.ts +2 -0
- package/dist/annotations/index.js +2 -0
- package/dist/authored/index.d.ts +596 -0
- package/dist/authored/index.js +18558 -0
- package/dist/authored-veto-DSnQcHGR.js +6 -0
- package/dist/browser-protocol-pvt4HFF7.js +5 -0
- package/dist/comparison-plan-CEQL0ooW.js +1338 -0
- package/dist/comparison-types-Dt-unJZY.d.ts +179 -0
- package/dist/create-editor-CkHtPWXV.js +1107 -0
- package/dist/diff/index.d.ts +32 -0
- package/dist/diff/index.js +1748 -0
- package/dist/dom/index.d.ts +2 -0
- package/dist/dom/index.js +2 -0
- package/dist/dom-Cgfscvnm.js +9220 -0
- package/dist/editor-owner-IUmkTeXz.js +171 -0
- package/dist/editor-view-lifetime-GJKa_QGh.js +23 -0
- package/dist/history/index.d.ts +170 -0
- package/dist/history/index.js +6718 -0
- package/dist/hyperscript/index.d.ts +2 -0
- package/dist/hyperscript/index.js +2 -0
- package/dist/hyperscript-FPuoArEi.js +299 -0
- package/dist/index-BpQx2UG4.d.ts +1093 -0
- package/dist/index-Cw-oC2ps.d.ts +190 -0
- package/dist/index-DPWyk3lG.d.ts +65 -0
- package/dist/index-DpltOCot.d.ts +9753 -0
- package/dist/index-HPYawTae.d.ts +119 -0
- package/dist/index-K0Za9YXc.d.ts +1246 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/internal/index.d.ts +2 -0
- package/dist/internal/index.js +156 -0
- package/dist/mapped-view-store-ld-6uxEU.js +120 -0
- package/dist/native-grouping-input-DMNcsIaW.js +8 -0
- package/dist/pagination/index.d.ts +169 -0
- package/dist/pagination/index.js +2 -0
- package/dist/pagination/react.d.ts +33 -0
- package/dist/pagination/react.js +1509 -0
- package/dist/pagination-D_A8iPJP.js +1021 -0
- package/dist/plugin-DWzkJbnJ.js +50999 -0
- package/dist/range-geometry-BLAHRE11.d.ts +38 -0
- package/dist/range-geometry-BjeLHOnl.js +486 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.js +7 -0
- package/dist/react/virtualized.d.ts +13 -0
- package/dist/react/virtualized.js +209 -0
- package/dist/react-DZ15gmz2.js +1018 -0
- package/dist/retraction-BMem8Rfk.js +109 -0
- package/dist/src-cT1OTKP_.js +1386 -0
- package/dist/store-Cz2mXyDe.js +704 -0
- package/dist/testing/index.d.ts +183 -0
- package/dist/testing/index.js +96 -0
- package/dist/use-editor-dom-scope-BbMDSCpW.js +28354 -0
- package/dist/yjs/index.d.ts +2 -0
- package/dist/yjs/index.js +2 -0
- package/dist/yjs/react/index.d.ts +26 -0
- package/dist/yjs/react/index.js +85 -0
- package/dist/yjs-DOK-m7kl.js +13413 -0
- package/package.json +191 -43
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as YjsAwarenessState, c as YjsInitialReadiness, d as YjsRemoteCursor, f as YjsRemoteCursorData, i as YjsAwarenessLike, l as YjsPluginOptions, n as YjsAdmissionStatus, p as YjsUpdatePolicy, r as YjsAwarenessChange, s as YjsCursorDataSchema, t as yjs } from "../index-Cw-oC2ps.js";
|
|
2
|
+
export { type YjsAdmissionStatus, type YjsAwarenessChange, type YjsAwarenessLike, type YjsAwarenessState, type YjsCursorDataSchema, type YjsInitialReadiness, type YjsPluginOptions, type YjsRemoteCursor, type YjsRemoteCursorData, YjsUpdatePolicy, yjs };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../../index-DpltOCot.js";
|
|
2
|
+
import { t as RangeGeometry } from "../../range-geometry-BLAHRE11.js";
|
|
3
|
+
import { a as YjsAwarenessState, c as YjsInitialReadiness, d as YjsRemoteCursor, f as YjsRemoteCursorData, i as YjsAwarenessLike, l as YjsPluginOptions, n as YjsAdmissionStatus, o as YjsBaseApi, p as YjsUpdatePolicy, r as YjsAwarenessChange, s as YjsCursorDataSchema, t as yjs, u as YjsPresenceApi } from "../../index-Cw-oC2ps.js";
|
|
4
|
+
import { RefObject } from "react";
|
|
5
|
+
import "yjs";
|
|
6
|
+
//#region src/yjs/react/useYjs.d.ts
|
|
7
|
+
type YjsCursorDataForApi<TApi> = TApi extends YjsPresenceApi<infer TCursorData> ? TCursorData : YjsRemoteCursorData;
|
|
8
|
+
type YjsEditorRuntimeCarrier = Readonly<{
|
|
9
|
+
id: string;
|
|
10
|
+
read: object;
|
|
11
|
+
update: object;
|
|
12
|
+
}>;
|
|
13
|
+
type YjsEditorWithApi<TApi> = YjsEditorRuntimeCarrier & Readonly<{
|
|
14
|
+
api: {
|
|
15
|
+
yjs: TApi;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
type YjsPresenceReadApi = YjsBaseApi & Pick<YjsPresenceApi, 'remoteCursor' | 'remoteCursors' | 'subscribeRemoteCursors'>;
|
|
19
|
+
declare function useYjsAdmissionStatus<TApi extends YjsBaseApi>(editor: YjsEditorWithApi<TApi>): YjsAdmissionStatus;
|
|
20
|
+
declare function useYjsRemoteCursor<TApi extends YjsPresenceReadApi>(editor: YjsEditorWithApi<TApi>, clientId: number): YjsRemoteCursor<YjsCursorDataForApi<TApi>> | null;
|
|
21
|
+
declare function useYjsRemoteCursorIds<TApi extends YjsPresenceReadApi>(editor: YjsEditorWithApi<TApi>): readonly number[];
|
|
22
|
+
declare function useYjsRemoteCursorGeometry<TApi extends YjsPresenceReadApi>(editor: YjsEditorWithApi<TApi>, clientId: number, { editableRef }: Readonly<{
|
|
23
|
+
editableRef: RefObject<HTMLElement | null>;
|
|
24
|
+
}>): RangeGeometry | null;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { type YjsAdmissionStatus, type YjsAwarenessChange, type YjsAwarenessLike, type YjsAwarenessState, type YjsCursorDataSchema, type YjsInitialReadiness, type YjsPluginOptions, type YjsRemoteCursor, type YjsRemoteCursorData, YjsUpdatePolicy, useYjsAdmissionStatus, useYjsRemoteCursor, useYjsRemoteCursorGeometry, useYjsRemoteCursorIds, yjs };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { wu as getEditorRuntimeOwner } from "../../plugin-DWzkJbnJ.js";
|
|
2
|
+
import { a as useRangeGeometryOwner, t as createRangeGeometryOwner } from "../../range-geometry-BjeLHOnl.js";
|
|
3
|
+
import { n as getActiveYjsBinding, r as YjsUpdatePolicy, t as yjs } from "../../yjs-DOK-m7kl.js";
|
|
4
|
+
import { useCallback, useMemo, useSyncExternalStore } from "react";
|
|
5
|
+
//#region src/yjs/react/useYjs.ts
|
|
6
|
+
const getYjsCursorCache = (editor) => {
|
|
7
|
+
const binding = getActiveYjsBinding(getEditorRuntimeOwner(editor));
|
|
8
|
+
if (!binding) throw new Error("Yjs plugin is not active on this editor.");
|
|
9
|
+
return binding.cursorCache();
|
|
10
|
+
};
|
|
11
|
+
const createYjsRemoteCursorGeometryOwner = (editor, cache, clientId, editableRef) => {
|
|
12
|
+
const binding = getActiveYjsBinding(getEditorRuntimeOwner(editor));
|
|
13
|
+
if (!binding) throw new Error("Yjs plugin is not active on this editor.");
|
|
14
|
+
const api = binding.baseApi();
|
|
15
|
+
return createRangeGeometryOwner(getEditorRuntimeOwner(editor), {
|
|
16
|
+
read: (view) => api.admissionStatus().state === "ready" ? cache.forView(view).remoteCursor(clientId)?.selection ?? null : null,
|
|
17
|
+
subscribe: (_view, listener) => {
|
|
18
|
+
const unsubscribeCursor = cache.subscribeCursor(clientId, listener);
|
|
19
|
+
const unsubscribeAdmission = api.subscribeAdmissionStatus(listener);
|
|
20
|
+
let active = true;
|
|
21
|
+
return () => {
|
|
22
|
+
if (!active) return;
|
|
23
|
+
active = false;
|
|
24
|
+
unsubscribeCursor();
|
|
25
|
+
unsubscribeAdmission();
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}, editableRef);
|
|
29
|
+
};
|
|
30
|
+
function useYjsAdmissionStatus(editor) {
|
|
31
|
+
const api = editor.api.yjs;
|
|
32
|
+
return useSyncExternalStore(api.subscribeAdmissionStatus, api.admissionStatus, api.admissionStatus);
|
|
33
|
+
}
|
|
34
|
+
function useYjsRemoteCursor(editor, clientId) {
|
|
35
|
+
const api = editor.api.yjs;
|
|
36
|
+
const cache = getYjsCursorCache(editor);
|
|
37
|
+
const getSnapshot = useCallback(() => api.admissionStatus().state === "ready" ? cache.remoteCursor(clientId) : null, [
|
|
38
|
+
api,
|
|
39
|
+
cache,
|
|
40
|
+
clientId
|
|
41
|
+
]);
|
|
42
|
+
return useSyncExternalStore(useCallback((listener) => {
|
|
43
|
+
const unsubscribeCursor = cache.subscribeCursor(clientId, listener);
|
|
44
|
+
const unsubscribeAdmission = api.subscribeAdmissionStatus(listener);
|
|
45
|
+
let active = true;
|
|
46
|
+
return () => {
|
|
47
|
+
if (!active) return;
|
|
48
|
+
active = false;
|
|
49
|
+
unsubscribeCursor();
|
|
50
|
+
unsubscribeAdmission();
|
|
51
|
+
};
|
|
52
|
+
}, [
|
|
53
|
+
api,
|
|
54
|
+
cache,
|
|
55
|
+
clientId
|
|
56
|
+
]), getSnapshot, getSnapshot);
|
|
57
|
+
}
|
|
58
|
+
function useYjsRemoteCursorIds(editor) {
|
|
59
|
+
const api = editor.api.yjs;
|
|
60
|
+
const cache = getYjsCursorCache(editor);
|
|
61
|
+
const getSnapshot = useCallback(() => api.admissionStatus().state === "ready" ? cache.remoteCursorIds() : EMPTY_REMOTE_CURSOR_IDS, [api, cache]);
|
|
62
|
+
return useSyncExternalStore(useCallback((listener) => {
|
|
63
|
+
const unsubscribeIds = cache.subscribeIds(listener);
|
|
64
|
+
const unsubscribeAdmission = api.subscribeAdmissionStatus(listener);
|
|
65
|
+
let active = true;
|
|
66
|
+
return () => {
|
|
67
|
+
if (!active) return;
|
|
68
|
+
active = false;
|
|
69
|
+
unsubscribeIds();
|
|
70
|
+
unsubscribeAdmission();
|
|
71
|
+
};
|
|
72
|
+
}, [api, cache]), getSnapshot, getSnapshot);
|
|
73
|
+
}
|
|
74
|
+
function useYjsRemoteCursorGeometry(editor, clientId, { editableRef }) {
|
|
75
|
+
const cache = getYjsCursorCache(editor);
|
|
76
|
+
return useRangeGeometryOwner(useMemo(() => createYjsRemoteCursorGeometryOwner(editor, cache, clientId, editableRef), [
|
|
77
|
+
cache,
|
|
78
|
+
clientId,
|
|
79
|
+
editableRef,
|
|
80
|
+
editor
|
|
81
|
+
]));
|
|
82
|
+
}
|
|
83
|
+
const EMPTY_REMOTE_CURSOR_IDS = Object.freeze([]);
|
|
84
|
+
//#endregion
|
|
85
|
+
export { YjsUpdatePolicy, useYjsAdmissionStatus, useYjsRemoteCursor, useYjsRemoteCursorGeometry, useYjsRemoteCursorIds, yjs };
|