jazz-tools 0.13.10 → 0.13.12
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +18 -0
- package/dist/{chunk-NFVKGXSH.js → chunk-GIZWJXSR.js} +51 -418
- package/dist/chunk-GIZWJXSR.js.map +1 -0
- package/dist/coValues/coMap.d.ts +4 -4
- package/dist/coValues/coMap.d.ts.map +1 -1
- package/dist/coValues/coPlainText.d.ts +7 -0
- package/dist/coValues/coPlainText.d.ts.map +1 -1
- package/dist/coValues/coRichText.d.ts +2 -257
- package/dist/coValues/coRichText.d.ts.map +1 -1
- package/dist/exports.d.ts +1 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +2 -2
- package/src/coValues/coMap.ts +35 -20
- package/src/coValues/coPlainText.ts +23 -1
- package/src/coValues/coRichText.ts +2 -660
- package/src/exports.ts +1 -7
- package/src/implementation/refs.ts +1 -1
- package/src/implementation/subscriptionScope.ts +2 -2
- package/src/tests/coMap.test.ts +65 -0
- package/src/tests/coPlainText.test.ts +21 -3
- package/dist/chunk-NFVKGXSH.js.map +0 -1
- package/dist/tests/coRichText.test.d.ts +0 -2
- package/dist/tests/coRichText.test.d.ts.map +0 -1
- package/src/tests/coRichText.test.ts +0 -937
package/dist/coValues/coMap.d.ts
CHANGED
@@ -131,8 +131,8 @@ export declare class CoMap extends CoValueBase implements CoValue {
|
|
131
131
|
* Return a JSON representation of the `CoMap`
|
132
132
|
* @category Content
|
133
133
|
*/
|
134
|
-
toJSON(_key?: string,
|
135
|
-
[inspect](): any
|
134
|
+
toJSON(_key?: string, processedValues?: ID<CoValue>[]): any;
|
135
|
+
[inspect](): any;
|
136
136
|
/**
|
137
137
|
* Create a new `RawCoMap` from an initialization object
|
138
138
|
* @internal
|
@@ -218,7 +218,7 @@ export declare class CoMap extends CoValueBase implements CoValue {
|
|
218
218
|
* Return a JSON representation of the `CoMap`
|
219
219
|
* @category Content
|
220
220
|
*/
|
221
|
-
toJSON(_key?: string,
|
221
|
+
toJSON(_key?: string, processedValues?: ID<CoValue>[]): any;
|
222
222
|
/**
|
223
223
|
* Create a new `RawCoMap` from an initialization object
|
224
224
|
* @internal
|
@@ -267,7 +267,7 @@ export declare class CoMap extends CoValueBase implements CoValue {
|
|
267
267
|
waitForSync(options?: {
|
268
268
|
timeout?: number;
|
269
269
|
}): Promise<unknown[]>;
|
270
|
-
[inspect](): any
|
270
|
+
[inspect](): any;
|
271
271
|
_instanceID: string;
|
272
272
|
readonly _owner: Account | Group;
|
273
273
|
readonly _loadedAs: Account | AnonymousJazzAgent;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coMap.d.ts","sourceRoot":"","sources":["../../src/coValues/coMap.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,KAAK,SAAS,EACd,YAAY,EACZ,KAAK,QAAQ,EAEd,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,EACV,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,EAAE,EACF,IAAI,EAEJ,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,QAAQ,EACR,MAAM,EACN,wBAAwB,EAExB,EAAE,EACH,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,GAAG,EAGH,OAAO,EASR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC,KAAK,SAAS,CAAC,CAAC,IAAI;IAClB,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,GAAG,CAAC,EAAE,YAAY,CAA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AG,MAAM,EAClB,MAAM,KAAK,CACZ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,GACtE,WAAW,CAAC,CAAC,CAAC,GACd,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,GAClD,CAAC,GAAG,IAAI,GACR,CAAC,CAAC;AAER,MAAM,MAAM,SAAS,CAAC,GAAG,SAAS,MAAM,IAAI;KACzC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,SAAS,SAAS,GAAG,CAAC,GAAG,CAAC,GAC7C,KAAK,GACL,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACrD,GAAG;KACD,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACzE,CAAC"}
|
@@ -24,6 +24,7 @@ export declare class CoPlainText extends String implements CoValue {
|
|
24
24
|
valueOf(): string;
|
25
25
|
toJSON(): string;
|
26
26
|
[inspect](): string;
|
27
|
+
insertBefore(idx: number, text: string): void;
|
27
28
|
insertAfter(idx: number, text: string): void;
|
28
29
|
deleteRange(range: {
|
29
30
|
from: number;
|
@@ -34,6 +35,12 @@ export declare class CoPlainText extends String implements CoValue {
|
|
34
35
|
idxBefore(pos: TextPos): number | undefined;
|
35
36
|
idxAfter(pos: TextPos): number | undefined;
|
36
37
|
static fromRaw<V extends CoPlainText>(this: CoValueClass<V> & typeof CoPlainText, raw: RawCoPlainText): V & CoPlainText;
|
38
|
+
/**
|
39
|
+
* Apply text, modifying the text in place. Calculates the diff and applies it to the CoValue.
|
40
|
+
*
|
41
|
+
* @category Mutation
|
42
|
+
*/
|
43
|
+
applyDiff(other: string): void;
|
37
44
|
/**
|
38
45
|
* Load a `CoPlainText` with a given ID, as a given account.
|
39
46
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coPlainText.d.ts","sourceRoot":"","sources":["../../src/coValues/coPlainText.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAET,KAAK,cAAc,EAEpB,MAAM,QAAQ,CAAC;
|
1
|
+
{"version":3,"file":"coPlainText.d.ts","sourceRoot":"","sources":["../../src/coValues/coPlainText.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAET,KAAK,cAAc,EAEpB,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,EACV,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,EAAE,EACF,QAAQ,EACR,wBAAwB,EAEzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,OAAO,EAKR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC;AAE3B,qBAAa,WAAY,SAAQ,MAAO,YAAW,OAAO;IAChD,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACb,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,cAAc,CAAC;IAE7B,IAAI,MAAM,IAAI,OAAO,GAAG,KAAK,CAI5B;IAED,IAAI,SAAS,YAEZ;gBAGC,OAAO,EACH;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE,GAC3B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAAA;KAAE;IAmB9C,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,WAAW,EACjC,IAAI,EAA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AY,CAAC,CAAC,CAAC,EACrB,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EACT,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,WAAW,EAAE,MAAM,IAAI,KAAK,IAAI,GACpE,MAAM,IAAI;IACb,MAAM,CAAC,SAAS,CAAC,CAAC,SAAS,WAAW,EACpC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EACrB,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EACT,OAAO,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,CAAC,EAC3D,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,WAAW,EAAE,MAAM,IAAI,KAAK,IAAI,GACpE,MAAM,IAAI;IAUb;;;;;;;;QAQI;IACJ,SAAS,CAAC,CAAC,SAAS,WAAW,EAC7B,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,WAAW,EAAE,MAAM,IAAI,KAAK,IAAI,GACpE,MAAM,IAAI;CAGd"}
|
@@ -1,259 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
import { CoList } from "./coList.js";
|
4
|
-
import { CoMap, type CoMapInit } from "./coMap.js";
|
5
|
-
import { CoPlainText, type TextPos } from "./coPlainText.js";
|
6
|
-
import type { Group } from "./group.js";
|
7
|
-
/**
|
8
|
-
* Base class for text annotations and formatting marks.
|
9
|
-
* Represents a mark with start and end positions in text.
|
10
|
-
*
|
11
|
-
* Example text: "Hello world! How are you?"
|
12
|
-
* If we want to mark "world" with bold:
|
13
|
-
*
|
14
|
-
* ```
|
15
|
-
* uncertainty region
|
16
|
-
* ↓
|
17
|
-
* Hello [····]world[····]! How are you?
|
18
|
-
* ↑ ↑ ↑ ↑
|
19
|
-
* | | | |
|
20
|
-
* startAfter | | endBefore
|
21
|
-
* startBefore endAfter
|
22
|
-
* ```
|
23
|
-
*
|
24
|
-
* - startAfter: Position after "Hello " (exclusive boundary)
|
25
|
-
* - startBefore: Position before "world" (inclusive boundary)
|
26
|
-
* - endAfter: Position after "world" (inclusive boundary)
|
27
|
-
* - endBefore: Position before "!" (exclusive boundary)
|
28
|
-
*
|
29
|
-
* The regions marked with [····] are "uncertainty regions" where:
|
30
|
-
* - Text inserted in the left uncertainty region may or may not be part of the mark
|
31
|
-
* - Text inserted in the right uncertainty region may or may not be part of the mark
|
32
|
-
* - Text inserted between startBefore and endAfter is definitely part of the mark
|
33
|
-
*
|
34
|
-
* Positions must satisfy:
|
35
|
-
* 0 ≤ startAfter ≤ startBefore < endAfter ≤ endBefore ≤ textLength
|
36
|
-
* A mark cannot be zero-length, so endAfter must be greater than startBefore.
|
37
|
-
*/
|
38
|
-
export declare class Mark extends CoMap {
|
39
|
-
startAfter: co<import("cojson").OpID | null>;
|
40
|
-
startBefore: co<import("cojson").OpID>;
|
41
|
-
endAfter: co<import("cojson").OpID>;
|
42
|
-
endBefore: co<import("cojson").OpID | null>;
|
43
|
-
tag: co<string>;
|
44
|
-
/**
|
45
|
-
* Validates and clamps mark positions to ensure they are in the correct order
|
46
|
-
* @returns Normalized positions or null if invalid
|
47
|
-
*/
|
48
|
-
validatePositions(textLength: number, idxAfter: (pos: TextPos) => number | undefined, idxBefore: (pos: TextPos) => number | undefined): {
|
49
|
-
startAfter: number;
|
50
|
-
startBefore: number;
|
51
|
-
endAfter: number;
|
52
|
-
endBefore: number;
|
53
|
-
} | null;
|
1
|
+
import { CoPlainText } from "./coPlainText.js";
|
2
|
+
export declare class CoRichText extends CoPlainText {
|
54
3
|
}
|
55
|
-
/**
|
56
|
-
* A mark with resolved numeric positions in text.
|
57
|
-
* Contains both position information and reference to the source mark.
|
58
|
-
* @template R Type extending Mark, defaults to Mark
|
59
|
-
*/
|
60
|
-
export type ResolvedMark<R extends Mark = Mark> = {
|
61
|
-
startAfter: number;
|
62
|
-
startBefore: number;
|
63
|
-
endAfter: number;
|
64
|
-
endBefore: number;
|
65
|
-
sourceMark: R;
|
66
|
-
};
|
67
|
-
/**
|
68
|
-
* A mark that has been resolved and diffused with certainty information.
|
69
|
-
* Includes start/end positions and indication of boundary certainty.
|
70
|
-
* @template R Type extending Mark, defaults to Mark
|
71
|
-
*/
|
72
|
-
export type ResolvedAndDiffusedMark<R extends Mark = Mark> = {
|
73
|
-
start: number;
|
74
|
-
end: number;
|
75
|
-
side: "uncertainStart" | "certainMiddle" | "uncertainEnd";
|
76
|
-
sourceMark: R;
|
77
|
-
};
|
78
|
-
/**
|
79
|
-
* Defines how marks should be focused when resolving positions.
|
80
|
-
* - 'far': Positions marks at furthest valid positions
|
81
|
-
* - 'close': Positions marks at nearest valid positions
|
82
|
-
* - 'closestWhitespace': Positions marks at nearest whitespace
|
83
|
-
*/
|
84
|
-
export type FocusBias = "far" | "close" | "closestWhitespace";
|
85
|
-
/**
|
86
|
-
* A mark that has been resolved and focused to specific positions.
|
87
|
-
* Contains simplified position information and reference to source mark.
|
88
|
-
* @template R Type extending Mark, defaults to Mark
|
89
|
-
*/
|
90
|
-
export type ResolvedAndFocusedMark<R extends Mark = Mark> = {
|
91
|
-
start: number;
|
92
|
-
end: number;
|
93
|
-
sourceMark: R;
|
94
|
-
};
|
95
|
-
/**
|
96
|
-
* Main class for handling rich text content with marks.
|
97
|
-
* Combines plain text with a list of marks for formatting and annotations.
|
98
|
-
* Provides methods for text manipulation, mark insertion, and tree conversion.
|
99
|
-
*/
|
100
|
-
export declare class CoRichText extends CoMap {
|
101
|
-
text: co<CoPlainText | null>;
|
102
|
-
marks: co<CoList<co<Mark | null>> | null>;
|
103
|
-
/**
|
104
|
-
* Create a CoRichText from plain text.
|
105
|
-
*/
|
106
|
-
static createFromPlainText(text: string, options: {
|
107
|
-
owner: Account | Group;
|
108
|
-
}): CoRichText;
|
109
|
-
/**
|
110
|
-
* Create a CoRichText from plain text and a mark.
|
111
|
-
*/
|
112
|
-
static createFromPlainTextAndMark<MarkClass extends {
|
113
|
-
new (...args: any[]): Mark;
|
114
|
-
create(init: any, options: {
|
115
|
-
owner: Account | Group;
|
116
|
-
}): Mark;
|
117
|
-
}>(text: string, WrapIn: MarkClass, extraArgs: Omit<CoMapInit<InstanceType<MarkClass>>, "startAfter" | "startBefore" | "endAfter" | "endBefore">, options: {
|
118
|
-
owner: Account | Group;
|
119
|
-
}): CoRichText;
|
120
|
-
/**
|
121
|
-
* Insert text at a specific index.
|
122
|
-
*/
|
123
|
-
insertAfter(idx: number, text: string): void;
|
124
|
-
/**
|
125
|
-
* Delete a range of text.
|
126
|
-
*/
|
127
|
-
deleteRange(range: {
|
128
|
-
from: number;
|
129
|
-
to: number;
|
130
|
-
}): void;
|
131
|
-
/**
|
132
|
-
* Get the position of a specific index.
|
133
|
-
*/
|
134
|
-
posBefore(idx: number): TextPos | undefined;
|
135
|
-
/**
|
136
|
-
* Get the position of a specific index.
|
137
|
-
*/
|
138
|
-
posAfter(idx: number): TextPos | undefined;
|
139
|
-
/**
|
140
|
-
* Get the index of a specific position.
|
141
|
-
*/
|
142
|
-
idxBefore(pos: TextPos): number | undefined;
|
143
|
-
/**
|
144
|
-
* Get the index of a specific position.
|
145
|
-
*/
|
146
|
-
idxAfter(pos: TextPos): number | undefined;
|
147
|
-
/**
|
148
|
-
* Insert a mark at a specific range.
|
149
|
-
*/
|
150
|
-
insertMark<MarkClass extends {
|
151
|
-
new (...args: any[]): Mark;
|
152
|
-
create(init: any, options: {
|
153
|
-
owner: Account | Group;
|
154
|
-
}): Mark;
|
155
|
-
}>(start: number, end: number, RangeClass: MarkClass, extraArgs: Omit<CoMapInit<InstanceType<MarkClass>>, "startAfter" | "startBefore" | "endAfter" | "endBefore">, options?: {
|
156
|
-
markOwner?: Account | Group;
|
157
|
-
}): void;
|
158
|
-
/**
|
159
|
-
* Remove a mark at a specific range.
|
160
|
-
*/
|
161
|
-
removeMark<MarkClass extends {
|
162
|
-
new (...args: any[]): Mark;
|
163
|
-
create(init: any, options: {
|
164
|
-
owner: Account | Group;
|
165
|
-
}): Mark;
|
166
|
-
}>(start: number, end: number, RangeClass: MarkClass, options: {
|
167
|
-
tag: string;
|
168
|
-
}): void;
|
169
|
-
/**
|
170
|
-
* Resolve the positions of all marks.
|
171
|
-
*/
|
172
|
-
resolveMarks(): ResolvedMark[];
|
173
|
-
/**
|
174
|
-
* Resolve and diffuse the positions of all marks.
|
175
|
-
*/
|
176
|
-
resolveAndDiffuseMarks(): ResolvedAndDiffusedMark[];
|
177
|
-
/**
|
178
|
-
* Resolve, diffuse, and focus the positions of all marks.
|
179
|
-
*/
|
180
|
-
resolveAndDiffuseAndFocusMarks(): ResolvedAndFocusedMark[];
|
181
|
-
/**
|
182
|
-
* Convert a CoRichText to a tree structure useful for client libraries.
|
183
|
-
*/
|
184
|
-
toTree(tagPrecedence: string[]): TreeNode;
|
185
|
-
get length(): number;
|
186
|
-
/**
|
187
|
-
* Convert a CoRichText to plain text.
|
188
|
-
*/
|
189
|
-
toString(): string;
|
190
|
-
}
|
191
|
-
/**
|
192
|
-
* Represents a leaf node in the rich text tree structure.
|
193
|
-
* Contains plain text without any marks.
|
194
|
-
*/
|
195
|
-
export type TreeLeaf = {
|
196
|
-
type: "leaf";
|
197
|
-
start: number;
|
198
|
-
end: number;
|
199
|
-
};
|
200
|
-
/**
|
201
|
-
* Represents a node in the rich text tree structure.
|
202
|
-
* Can contain other nodes or leaves, and includes formatting information.
|
203
|
-
*/
|
204
|
-
export type TreeNode = {
|
205
|
-
type: "node";
|
206
|
-
tag: string;
|
207
|
-
start: number;
|
208
|
-
end: number;
|
209
|
-
range?: ResolvedAndFocusedMark;
|
210
|
-
children: (TreeNode | TreeLeaf)[];
|
211
|
-
};
|
212
|
-
/**
|
213
|
-
* Split a node at a specific index. So that the node is split into two parts, one before the index, and one after the index.
|
214
|
-
*/
|
215
|
-
export declare function splitNode(node: TreeNode | TreeLeaf, at: number): [TreeNode | TreeLeaf | undefined, TreeNode | TreeLeaf | undefined];
|
216
|
-
/**
|
217
|
-
* Heading mark for rich text formatting.
|
218
|
-
*/
|
219
|
-
export declare class Heading extends Mark {
|
220
|
-
tag: co<"heading">;
|
221
|
-
level: co<number>;
|
222
|
-
}
|
223
|
-
/**
|
224
|
-
* Paragraph mark for rich text formatting.
|
225
|
-
*/
|
226
|
-
export declare class Paragraph extends Mark {
|
227
|
-
tag: co<"paragraph">;
|
228
|
-
}
|
229
|
-
/**
|
230
|
-
* Link mark for rich text formatting.
|
231
|
-
*/
|
232
|
-
export declare class Link extends Mark {
|
233
|
-
tag: co<"link">;
|
234
|
-
url: co<string>;
|
235
|
-
}
|
236
|
-
/**
|
237
|
-
* Strong (bold) mark for rich text formatting.
|
238
|
-
*/
|
239
|
-
export declare class Strong extends Mark {
|
240
|
-
tag: co<"strong">;
|
241
|
-
}
|
242
|
-
/**
|
243
|
-
* Emphasis (italic) mark for rich text formatting.
|
244
|
-
*/
|
245
|
-
export declare class Em extends Mark {
|
246
|
-
tag: co<"em">;
|
247
|
-
}
|
248
|
-
/**
|
249
|
-
* Collection of predefined mark types for common text formatting.
|
250
|
-
* Includes marks for headings, paragraphs, links, and text styling.
|
251
|
-
*/
|
252
|
-
export declare const Marks: {
|
253
|
-
Heading: typeof Heading;
|
254
|
-
Paragraph: typeof Paragraph;
|
255
|
-
Link: typeof Link;
|
256
|
-
Strong: typeof Strong;
|
257
|
-
Em: typeof Em;
|
258
|
-
};
|
259
4
|
//# sourceMappingURL=coRichText.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coRichText.d.ts","sourceRoot":"","sources":["../../src/coValues/coRichText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"coRichText.d.ts","sourceRoot":"","sources":["../../src/coValues/coRichText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,UAAW,SAAQ,WAAW;CAAG"}
|
package/dist/exports.d.ts
CHANGED
@@ -7,7 +7,7 @@ export { BinaryCoStream, CoFeed, CoStream, type CoFeedEntry, FileStream, } from
|
|
7
7
|
export { CoList } from "./coValues/coList.js";
|
8
8
|
export { CoMap, type CoMapInit } from "./coValues/coMap.js";
|
9
9
|
export { CoPlainText, type TextPos } from "./coValues/coPlainText.js";
|
10
|
-
export { CoRichText
|
10
|
+
export { CoRichText } from "./coValues/coRichText.js";
|
11
11
|
export { ImageDefinition } from "./coValues/extensions/imageDef.js";
|
12
12
|
export { Group } from "./coValues/group.js";
|
13
13
|
export { CoValueBase } from "./coValues/interfaces.js";
|
package/dist/exports.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,WAAW,GACZ,MAAM,QAAQ,CAAC;AAEhB,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,MAAM,EACN,QAAQ,EACR,KAAK,WAAW,EAChB,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,KAAK,OAAO,EAAE,M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B,EACvB,WAAW,EACX,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,KAAK,2BAA2B,GACjC,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,wCAAwC,EACxC,8BAA8B,EAC9B,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,sBAAsB,GAC5B,MAAM,eAAe,CAAC;AAEvB,mBAAmB,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
@@ -18,7 +18,6 @@ import {
|
|
18
18
|
InboxSender,
|
19
19
|
JazzContextManager,
|
20
20
|
KvStoreContext,
|
21
|
-
Marks,
|
22
21
|
PassphraseAuth,
|
23
22
|
Profile,
|
24
23
|
SchemaUnion,
|
@@ -35,7 +34,7 @@ import {
|
|
35
34
|
parseInviteLink,
|
36
35
|
randomSessionProvider,
|
37
36
|
subscribeToCoValue
|
38
|
-
} from "./chunk-
|
37
|
+
} from "./chunk-GIZWJXSR.js";
|
39
38
|
|
40
39
|
// src/index.ts
|
41
40
|
import { MAX_RECOMMENDED_TX_SIZE, cojsonInternals } from "cojson";
|
@@ -62,7 +61,6 @@ export {
|
|
62
61
|
JazzContextManager,
|
63
62
|
KvStoreContext,
|
64
63
|
MAX_RECOMMENDED_TX_SIZE,
|
65
|
-
Marks,
|
66
64
|
PassphraseAuth,
|
67
65
|
Profile,
|
68
66
|
SchemaUnion,
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./exports.js\";\n\nexport { MAX_RECOMMENDED_TX_SIZE, cojsonInternals } from \"cojson\";\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./exports.js\";\n\nexport { MAX_RECOMMENDED_TX_SIZE, cojsonInternals } from \"cojson\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,yBAAyB,uBAAuB;","names":[]}
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
@@ -17,11 +17,11 @@
|
|
17
17
|
},
|
18
18
|
"type": "module",
|
19
19
|
"license": "MIT",
|
20
|
-
"version": "0.13.
|
20
|
+
"version": "0.13.12",
|
21
21
|
"dependencies": {
|
22
22
|
"@scure/bip39": "^1.3.0",
|
23
23
|
"fast-myers-diff": "^3.2.0",
|
24
|
-
"cojson": "0.13.
|
24
|
+
"cojson": "0.13.12"
|
25
25
|
},
|
26
26
|
"devDependencies": {
|
27
27
|
"tsup": "8.3.5",
|
package/src/coValues/coMap.ts
CHANGED
@@ -308,36 +308,51 @@ export class CoMap extends CoValueBase implements CoValue {
|
|
308
308
|
* @category Content
|
309
309
|
*/
|
310
310
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
311
|
-
toJSON(_key?: string,
|
312
|
-
const
|
311
|
+
toJSON(_key?: string, processedValues?: ID<CoValue>[]): any {
|
312
|
+
const result = {
|
313
|
+
id: this.id,
|
314
|
+
_type: this._type,
|
315
|
+
} as Record<string, any>;
|
316
|
+
|
317
|
+
for (const key of this._raw.keys()) {
|
313
318
|
const tKey = key as CoKeys<this>;
|
314
319
|
const descriptor = (this._schema[tKey] ||
|
315
320
|
this._schema[ItemsSym]) as Schema;
|
316
321
|
|
322
|
+
if (!descriptor) {
|
323
|
+
continue;
|
324
|
+
}
|
325
|
+
|
317
326
|
if (descriptor == "json" || "encoded" in descriptor) {
|
318
|
-
|
327
|
+
result[key] = this._raw.get(key);
|
319
328
|
} else if (isRefEncoded(descriptor)) {
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
329
|
+
const id = this._raw.get(key) as ID<CoValue>;
|
330
|
+
|
331
|
+
if (processedValues?.includes(id) || id === this.id) {
|
332
|
+
result[key] = { _circular: id };
|
333
|
+
continue;
|
334
|
+
}
|
335
|
+
|
336
|
+
const ref = this[tKey];
|
337
|
+
|
338
|
+
if (
|
339
|
+
ref &&
|
340
|
+
typeof ref === "object" &&
|
341
|
+
"toJSON" in ref &&
|
342
|
+
typeof ref.toJSON === "function"
|
343
|
+
) {
|
344
|
+
const jsonedRef = ref.toJSON(tKey, [
|
345
|
+
...(processedValues || []),
|
346
|
+
this.id,
|
347
|
+
]);
|
348
|
+
result[key] = jsonedRef;
|
324
349
|
}
|
325
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
326
|
-
const jsonedRef = (this as any)[tKey]?.toJSON(tKey, [
|
327
|
-
...(seenAbove || []),
|
328
|
-
this.id,
|
329
|
-
]);
|
330
|
-
return [key, jsonedRef];
|
331
350
|
} else {
|
332
|
-
|
351
|
+
result[key] = undefined;
|
333
352
|
}
|
334
|
-
}
|
353
|
+
}
|
335
354
|
|
336
|
-
return
|
337
|
-
id: this.id,
|
338
|
-
_type: this._type,
|
339
|
-
...Object.fromEntries(jsonedFields),
|
340
|
-
};
|
355
|
+
return result;
|
341
356
|
}
|
342
357
|
|
343
358
|
[inspect]() {
|
@@ -4,6 +4,7 @@ import {
|
|
4
4
|
type RawCoPlainText,
|
5
5
|
stringifyOpID,
|
6
6
|
} from "cojson";
|
7
|
+
import { calcPatch } from "fast-myers-diff";
|
7
8
|
import type {
|
8
9
|
AnonymousJazzAgent,
|
9
10
|
CoValue,
|
@@ -45,7 +46,7 @@ export class CoPlainText extends String implements CoValue {
|
|
45
46
|
| { fromRaw: RawCoPlainText }
|
46
47
|
| { text: string; owner: Account | Group },
|
47
48
|
) {
|
48
|
-
super();
|
49
|
+
super("fromRaw" in options ? options.fromRaw.toString() : options.text);
|
49
50
|
|
50
51
|
let raw;
|
51
52
|
|
@@ -90,6 +91,10 @@ export class CoPlainText extends String implements CoValue {
|
|
90
91
|
return this.toJSON();
|
91
92
|
}
|
92
93
|
|
94
|
+
insertBefore(idx: number, text: string) {
|
95
|
+
this._raw.insertBefore(idx, text);
|
96
|
+
}
|
97
|
+
|
93
98
|
insertAfter(idx: number, text: string) {
|
94
99
|
this._raw.insertAfter(idx, text);
|
95
100
|
}
|
@@ -121,6 +126,23 @@ export class CoPlainText extends String implements CoValue {
|
|
121
126
|
return new this({ fromRaw: raw });
|
122
127
|
}
|
123
128
|
|
129
|
+
/**
|
130
|
+
* Apply text, modifying the text in place. Calculates the diff and applies it to the CoValue.
|
131
|
+
*
|
132
|
+
* @category Mutation
|
133
|
+
*/
|
134
|
+
applyDiff(other: string) {
|
135
|
+
const current = this._raw.toString();
|
136
|
+
for (const [from, to, insert] of [...calcPatch(current, other)].reverse()) {
|
137
|
+
if (to > from) {
|
138
|
+
this.deleteRange({ from, to });
|
139
|
+
}
|
140
|
+
if (insert.length > 0) {
|
141
|
+
this.insertBefore(from, insert);
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
124
146
|
/**
|
125
147
|
* Load a `CoPlainText` with a given ID, as a given account.
|
126
148
|
*
|