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.
Files changed (61) hide show
  1. package/LICENSE +4 -1
  2. package/README.md +83 -0
  3. package/dist/annotation-store-metrics-Ccjkef45.js +12 -0
  4. package/dist/annotations/index.d.ts +2 -0
  5. package/dist/annotations/index.js +2 -0
  6. package/dist/authored/index.d.ts +596 -0
  7. package/dist/authored/index.js +18558 -0
  8. package/dist/authored-veto-DSnQcHGR.js +6 -0
  9. package/dist/browser-protocol-pvt4HFF7.js +5 -0
  10. package/dist/comparison-plan-CEQL0ooW.js +1338 -0
  11. package/dist/comparison-types-Dt-unJZY.d.ts +179 -0
  12. package/dist/create-editor-CkHtPWXV.js +1107 -0
  13. package/dist/diff/index.d.ts +32 -0
  14. package/dist/diff/index.js +1748 -0
  15. package/dist/dom/index.d.ts +2 -0
  16. package/dist/dom/index.js +2 -0
  17. package/dist/dom-Cgfscvnm.js +9220 -0
  18. package/dist/editor-owner-IUmkTeXz.js +171 -0
  19. package/dist/editor-view-lifetime-GJKa_QGh.js +23 -0
  20. package/dist/history/index.d.ts +170 -0
  21. package/dist/history/index.js +6718 -0
  22. package/dist/hyperscript/index.d.ts +2 -0
  23. package/dist/hyperscript/index.js +2 -0
  24. package/dist/hyperscript-FPuoArEi.js +299 -0
  25. package/dist/index-BpQx2UG4.d.ts +1093 -0
  26. package/dist/index-Cw-oC2ps.d.ts +190 -0
  27. package/dist/index-DPWyk3lG.d.ts +65 -0
  28. package/dist/index-DpltOCot.d.ts +9753 -0
  29. package/dist/index-HPYawTae.d.ts +119 -0
  30. package/dist/index-K0Za9YXc.d.ts +1246 -0
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.js +5 -0
  33. package/dist/internal/index.d.ts +2 -0
  34. package/dist/internal/index.js +156 -0
  35. package/dist/mapped-view-store-ld-6uxEU.js +120 -0
  36. package/dist/native-grouping-input-DMNcsIaW.js +8 -0
  37. package/dist/pagination/index.d.ts +169 -0
  38. package/dist/pagination/index.js +2 -0
  39. package/dist/pagination/react.d.ts +33 -0
  40. package/dist/pagination/react.js +1509 -0
  41. package/dist/pagination-D_A8iPJP.js +1021 -0
  42. package/dist/plugin-DWzkJbnJ.js +50999 -0
  43. package/dist/range-geometry-BLAHRE11.d.ts +38 -0
  44. package/dist/range-geometry-BjeLHOnl.js +486 -0
  45. package/dist/react/index.d.ts +5 -0
  46. package/dist/react/index.js +7 -0
  47. package/dist/react/virtualized.d.ts +13 -0
  48. package/dist/react/virtualized.js +209 -0
  49. package/dist/react-DZ15gmz2.js +1018 -0
  50. package/dist/retraction-BMem8Rfk.js +109 -0
  51. package/dist/src-cT1OTKP_.js +1386 -0
  52. package/dist/store-Cz2mXyDe.js +704 -0
  53. package/dist/testing/index.d.ts +183 -0
  54. package/dist/testing/index.js +96 -0
  55. package/dist/use-editor-dom-scope-BbMDSCpW.js +28354 -0
  56. package/dist/yjs/index.d.ts +2 -0
  57. package/dist/yjs/index.js +2 -0
  58. package/dist/yjs/react/index.d.ts +26 -0
  59. package/dist/yjs/react/index.js +85 -0
  60. package/dist/yjs-DOK-m7kl.js +13413 -0
  61. package/package.json +191 -43
@@ -0,0 +1,190 @@
1
+ import { Id as PluginFactoryTypeLambda, Ld as PluginFactoryTypeProvider, _g as Range, xd as Plugin } from "./index-DpltOCot.js";
2
+ import * as Y from "yjs";
3
+ //#region src/yjs/core/editor-adapter.d.ts
4
+ /**
5
+ * Update policies for host adapters that import canonical `DocumentChange`
6
+ * values without the built-in Yjs binding. `remote` marks the commit as a
7
+ * remote Yjs import, so history and outbound subscriptions treat it like the
8
+ * binding's own imports.
9
+ */
10
+ declare const YjsUpdatePolicy: Readonly<{
11
+ remote: Readonly<{
12
+ tags: readonly string[];
13
+ }>;
14
+ }>;
15
+ //#endregion
16
+ //#region src/yjs/core/types.d.ts
17
+ type YjsInitialReadiness = Readonly<{
18
+ doc: Y.Doc;
19
+ getSnapshot: () => boolean;
20
+ subscribe: (listener: () => void) => () => void;
21
+ }>;
22
+ type YjsAdmissionStatus = Readonly<{
23
+ state: 'waiting';
24
+ reason: 'load' | 'reference' | 'seed';
25
+ }> | Readonly<{
26
+ state: 'ready';
27
+ }> | Readonly<{
28
+ state: 'error';
29
+ cause: unknown;
30
+ }>;
31
+ type YjsAwarenessChange = Readonly<{
32
+ added: readonly number[];
33
+ removed: readonly number[];
34
+ updated: readonly number[];
35
+ }>;
36
+ type YjsAwarenessState = Readonly<Record<string, unknown>>;
37
+ type YjsAwarenessLike = Readonly<{
38
+ doc: Y.Doc;
39
+ getLocalState: () => YjsAwarenessState | null;
40
+ getStates: () => ReadonlyMap<number, YjsAwarenessState>;
41
+ off: (event: 'change', handler: (event: YjsAwarenessChange) => void) => void;
42
+ on: (event: 'change', handler: (event: YjsAwarenessChange) => void) => void;
43
+ setLocalStateField: (field: string, value: unknown) => void;
44
+ }>;
45
+ type YjsRemoteCursorData = Readonly<Record<string, unknown>>;
46
+ /** Runtime contract for cursor metadata received from other collaborators. */
47
+ type YjsCursorDataSchema<TCursorData extends YjsRemoteCursorData = YjsRemoteCursorData> = Readonly<{
48
+ validate: (value: unknown) => value is TCursorData;
49
+ }>;
50
+ type YjsRemoteCursor<TCursorData extends YjsRemoteCursorData = YjsRemoteCursorData> = Readonly<{
51
+ clientId: number;
52
+ selection: Range | null;
53
+ data?: TCursorData;
54
+ }>;
55
+ type YjsCursorDataOption<TCursorData extends YjsRemoteCursorData> = [YjsRemoteCursorData] extends [TCursorData] ? Readonly<{
56
+ cursorData?: never;
57
+ }> | Readonly<{
58
+ cursorData: YjsCursorDataSchema<TCursorData>;
59
+ }> : Readonly<{
60
+ cursorData: YjsCursorDataSchema<TCursorData>;
61
+ }>;
62
+ type YjsPluginOptions<TCursorData extends YjsRemoteCursorData = YjsRemoteCursorData> = Readonly<{
63
+ awareness?: YjsAwarenessLike;
64
+ doc: Y.Doc;
65
+ initialReady: true | YjsInitialReadiness;
66
+ rootName?: string;
67
+ seed?: true;
68
+ sharedEffectCompaction?: Readonly<{
69
+ /** Stable host identity for the sole active compaction authority. */
70
+ authorityId: string;
71
+ threshold?: number;
72
+ }>;
73
+ }> & YjsCursorDataOption<TCursorData>;
74
+ type YjsBaseApi = Readonly<{
75
+ admissionStatus: () => YjsAdmissionStatus;
76
+ retryImport: () => void;
77
+ subscribeAdmissionStatus: (listener: () => void) => () => void;
78
+ }>;
79
+ type YjsPresenceApi<TCursorData extends YjsRemoteCursorData = YjsRemoteCursorData> = Readonly<{
80
+ clearSelection: () => void;
81
+ remoteCursor: (clientId: number) => YjsRemoteCursor<TCursorData> | null;
82
+ remoteCursors: () => ReadonlyArray<YjsRemoteCursor<TCursorData>>;
83
+ setCursorData: (data: TCursorData | null) => void;
84
+ subscribeRemoteCursors: (listener: () => void) => () => void;
85
+ syncSelection: () => void;
86
+ }>;
87
+ //#endregion
88
+ //#region src/yjs/core/plugin.d.ts
89
+ type YjsCursorDataOfOptions<TOptions> = TOptions extends YjsPluginOptions<infer TCursorData> ? TCursorData : YjsRemoteCursorData;
90
+ type YjsOptionsWithAwareness<TCursorData extends YjsRemoteCursorData = YjsRemoteCursorData> = YjsPluginOptions<TCursorData> & Readonly<{
91
+ awareness: YjsAwarenessLike;
92
+ }>;
93
+ type YjsOptionsWithCompaction<TCursorData extends YjsRemoteCursorData = YjsRemoteCursorData> = YjsPluginOptions<TCursorData> & Readonly<{
94
+ sharedEffectCompaction: Readonly<{
95
+ authorityId: string;
96
+ threshold?: number;
97
+ }>;
98
+ }>;
99
+ declare const createBaseYjsPlugin: <TCursorData extends YjsRemoteCursorData>(options: YjsPluginOptions<TCursorData>) => Plugin<Readonly<{
100
+ readonly activate: true;
101
+ readonly on: true;
102
+ readonly validate: true;
103
+ readonly api: Readonly<{
104
+ admissionStatus: () => YjsAdmissionStatus;
105
+ retryImport: () => void;
106
+ subscribeAdmissionStatus: (listener: () => void) => () => void;
107
+ }>;
108
+ }> & Readonly<{
109
+ name: "yjs";
110
+ }>>;
111
+ declare const createPresenceYjsPlugin: <TCursorData extends YjsRemoteCursorData>(options: YjsOptionsWithAwareness<TCursorData>) => Plugin<Readonly<{
112
+ readonly activate: true;
113
+ readonly on: true;
114
+ readonly validate: true;
115
+ readonly api: {
116
+ admissionStatus: () => YjsAdmissionStatus;
117
+ retryImport: () => void;
118
+ subscribeAdmissionStatus: (listener: () => void) => () => void;
119
+ clearSelection: () => void;
120
+ remoteCursor: (clientId: number) => Readonly<{
121
+ clientId: number;
122
+ selection: Range | null;
123
+ data?: TCursorData | undefined;
124
+ }> | null;
125
+ remoteCursors: () => readonly Readonly<{
126
+ clientId: number;
127
+ selection: Range | null;
128
+ data?: TCursorData | undefined;
129
+ }>[];
130
+ setCursorData: (data: TCursorData | null) => void;
131
+ subscribeRemoteCursors: (listener: () => void) => () => void;
132
+ syncSelection: () => void;
133
+ };
134
+ }> & Readonly<{
135
+ name: "yjs";
136
+ }>>;
137
+ declare const createCompactionYjsPlugin: <TCursorData extends YjsRemoteCursorData>(options: YjsOptionsWithCompaction<TCursorData>) => Plugin<Readonly<{
138
+ readonly activate: true;
139
+ readonly on: true;
140
+ readonly validate: true;
141
+ readonly api: {
142
+ admissionStatus: () => YjsAdmissionStatus;
143
+ retryImport: () => void;
144
+ subscribeAdmissionStatus: (listener: () => void) => () => void;
145
+ retireSharedEffectPeer: (clientId: number) => void;
146
+ };
147
+ }> & Readonly<{
148
+ name: "yjs";
149
+ }>>;
150
+ declare const createPresenceCompactionYjsPlugin: <TCursorData extends YjsRemoteCursorData>(options: YjsOptionsWithAwareness<TCursorData> & YjsOptionsWithCompaction<TCursorData>) => Plugin<Readonly<{
151
+ readonly activate: true;
152
+ readonly on: true;
153
+ readonly validate: true;
154
+ readonly api: {
155
+ admissionStatus: () => YjsAdmissionStatus;
156
+ retryImport: () => void;
157
+ subscribeAdmissionStatus: (listener: () => void) => () => void;
158
+ clearSelection: () => void;
159
+ remoteCursor: (clientId: number) => Readonly<{
160
+ clientId: number;
161
+ selection: Range | null;
162
+ data?: TCursorData | undefined;
163
+ }> | null;
164
+ remoteCursors: () => readonly Readonly<{
165
+ clientId: number;
166
+ selection: Range | null;
167
+ data?: TCursorData | undefined;
168
+ }>[];
169
+ setCursorData: (data: TCursorData | null) => void;
170
+ subscribeRemoteCursors: (listener: () => void) => () => void;
171
+ syncSelection: () => void;
172
+ retireSharedEffectPeer: (clientId: number) => void;
173
+ };
174
+ }> & Readonly<{
175
+ name: "yjs";
176
+ }>>;
177
+ type BaseYjsPlugin<TCursorData extends YjsRemoteCursorData> = ReturnType<typeof createBaseYjsPlugin<TCursorData>>;
178
+ type PresenceYjsPlugin<TCursorData extends YjsRemoteCursorData> = ReturnType<typeof createPresenceYjsPlugin<TCursorData>>;
179
+ type CompactionYjsPlugin<TCursorData extends YjsRemoteCursorData> = ReturnType<typeof createCompactionYjsPlugin<TCursorData>>;
180
+ type PresenceCompactionYjsPlugin<TCursorData extends YjsRemoteCursorData> = ReturnType<typeof createPresenceCompactionYjsPlugin<TCursorData>>;
181
+ type YjsPluginForOptions<TOptions extends YjsPluginOptions> = TOptions extends YjsOptionsWithAwareness & YjsOptionsWithCompaction ? PresenceCompactionYjsPlugin<YjsCursorDataOfOptions<TOptions>> : TOptions extends YjsOptionsWithAwareness ? PresenceYjsPlugin<YjsCursorDataOfOptions<TOptions>> : TOptions extends YjsOptionsWithCompaction ? CompactionYjsPlugin<YjsCursorDataOfOptions<TOptions>> : BaseYjsPlugin<YjsCursorDataOfOptions<TOptions>>;
182
+ interface YjsFactoryType extends PluginFactoryTypeLambda {
183
+ readonly input: YjsPluginOptions;
184
+ readonly output: YjsPluginForOptions<this['input']>;
185
+ }
186
+ declare function createYjsDescriptor<const TOptions extends YjsPluginOptions>(options: TOptions): YjsPluginForOptions<TOptions>;
187
+ /** Create one Yjs binding descriptor for an app-owned document. */
188
+ declare const yjs: typeof createYjsDescriptor & PluginFactoryTypeProvider<YjsFactoryType>;
189
+ //#endregion
190
+ export { YjsAwarenessState as a, YjsInitialReadiness as c, YjsRemoteCursor as d, YjsRemoteCursorData as f, YjsAwarenessLike as i, YjsPluginOptions as l, YjsAdmissionStatus as n, YjsBaseApi as o, YjsUpdatePolicy as p, YjsAwarenessChange as r, YjsCursorDataSchema as s, yjs as t, YjsPresenceApi as u };
@@ -0,0 +1,65 @@
1
+ import { Dc as Editor, _g as Range, bf as Value, lg as Anchor, vd as NodeKey } from "./index-DpltOCot.js";
2
+ //#region src/internal/view/view-source.d.ts
3
+ type ViewSourcePhase = 'project' | 'read' | 'resolve';
4
+ /** Diagnostic emitted when an optional view source is deactivated. */
5
+ type ViewSourceError = Readonly<{
6
+ cause: unknown;
7
+ phase: ViewSourcePhase;
8
+ sourceId: string;
9
+ }>;
10
+ type ViewSourceErrorSink = (error: ViewSourceError) => void;
11
+ type ViewSourceOptions = Readonly<{
12
+ id: string;
13
+ onError?: ViewSourceErrorSink;
14
+ }>;
15
+ /** Current isolation state for an optional view source. */
16
+ type ViewSourceStatus = Readonly<{
17
+ active: boolean;
18
+ failureCount: number;
19
+ }>;
20
+ //#endregion
21
+ //#region src/annotations/store.d.ts
22
+ type AnnotationAnchor = Pick<Anchor<Range>, 'resolve'>;
23
+ interface Annotation<TData = unknown> {
24
+ anchor: AnnotationAnchor;
25
+ data?: TData;
26
+ id: string;
27
+ }
28
+ interface ResolvedAnnotation<TData = unknown> {
29
+ data?: TData;
30
+ id: string;
31
+ range: Range | null;
32
+ }
33
+ interface AnnotationSnapshot<TData = unknown> {
34
+ allIds: readonly string[];
35
+ byId: ReadonlyMap<string, ResolvedAnnotation<TData>>;
36
+ }
37
+ type AnnotationChange = Readonly<{
38
+ ids: readonly string[];
39
+ nodeKeys: readonly NodeKey[];
40
+ reason: 'annotation' | 'editor' | 'external' | 'refresh';
41
+ }>;
42
+ type AnnotationRefreshOptions = Readonly<{
43
+ ids?: readonly string[];
44
+ reason?: 'annotation' | 'external' | 'refresh';
45
+ }>;
46
+ type AnnotationStoreOptions = Readonly<{
47
+ id?: string;
48
+ onError?: ViewSourceErrorSink;
49
+ }>;
50
+ interface AnnotationStore<TData = unknown> {
51
+ getAnnotation: (id: string) => ResolvedAnnotation<TData> | null;
52
+ getAnnotationsAt: (nodeKey: NodeKey) => ReadonlyArray<ResolvedAnnotation<TData>>;
53
+ getSnapshot: () => AnnotationSnapshot<TData>;
54
+ refresh: (options?: AnnotationRefreshOptions) => void;
55
+ subscribe: (listener: () => void) => () => void;
56
+ subscribeAnnotation: (id: string, listener: () => void) => () => void;
57
+ subscribeChanges: (listener: (change: AnnotationChange) => void) => () => void;
58
+ }
59
+ interface OwnedAnnotationStore<TData = unknown> extends AnnotationStore<TData> {
60
+ destroy: () => void;
61
+ }
62
+ /** Read a lazy view index; editor observation lasts only while subscribed. */
63
+ declare const createAnnotationStore: <TData = unknown, V extends Value = Value, TPlugins extends readonly unknown[] = readonly []>(editor: Editor<V, TPlugins>, source: ReadonlyArray<Annotation<TData>> | (() => ReadonlyArray<Annotation<TData>>), options?: AnnotationStoreOptions) => OwnedAnnotationStore<TData>;
64
+ //#endregion
65
+ export { AnnotationSnapshot as a, OwnedAnnotationStore as c, ViewSourceError as d, ViewSourceErrorSink as f, ViewSourceStatus as h, AnnotationRefreshOptions as i, ResolvedAnnotation as l, ViewSourcePhase as m, AnnotationAnchor as n, AnnotationStore as o, ViewSourceOptions as p, AnnotationChange as r, AnnotationStoreOptions as s, Annotation as t, createAnnotationStore as u };