@atom.io/template-react-realtime-text-editor 0.0.18 → 0.0.19
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/CHANGELOG.md +9 -0
- package/node/service.ts +5 -6
- package/package.json +4 -4
- package/src/document-domain.ts +17 -6
- package/src/identities.ts +0 -4
- package/src/protocol.ts +3 -8
- package/src/session.ts +0 -7
- package/src/workspace-state.ts +3 -3
package/CHANGELOG.md
CHANGED
package/node/service.ts
CHANGED
|
@@ -42,13 +42,12 @@ import {
|
|
|
42
42
|
type MarkdownCommand,
|
|
43
43
|
} from "../src/protocol.ts"
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
45
|
+
type MarkdownDocumentInstrumentation = MosaicTextDocumentInstrumentation & {
|
|
46
|
+
readonly activeFullDocumentModels: 1
|
|
47
|
+
readonly maximumFullDocumentModels: 1
|
|
48
|
+
}
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
type MarkdownDocumentRangeInspection = MosaicTextDocumentRangeInspection
|
|
52
51
|
|
|
53
52
|
export type MarkdownDocumentService = Disposable & {
|
|
54
53
|
bindSocket(options: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atom.io/template-react-realtime-text-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "A realtime text editor built with atom.io, React, and Lasertag.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@atom.io/realtime": "0.1.2",
|
|
15
15
|
"@lexical/react": "0.53.0",
|
|
16
16
|
"@lexical/selection": "0.53.0",
|
|
17
|
-
"atom.io": "0.54.
|
|
17
|
+
"atom.io": "0.54.7",
|
|
18
18
|
"lexical": "0.53.0",
|
|
19
19
|
"react": "19.3.1",
|
|
20
20
|
"react-dom": "19.3.1",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"@typescript-eslint/parser": "8.72.1",
|
|
37
37
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
38
38
|
"@vitejs/plugin-react": "6.2.1",
|
|
39
|
-
"concurrently": "10.0.
|
|
39
|
+
"concurrently": "10.0.7",
|
|
40
40
|
"dprint": "0.64.3",
|
|
41
41
|
"dprint-plugin-malva": "0.16.0",
|
|
42
42
|
"eslint": "10.14.0",
|
|
43
43
|
"happy-dom": "21.0.4",
|
|
44
|
-
"lasertag": "0.8.
|
|
44
|
+
"lasertag": "0.8.11",
|
|
45
45
|
"oxlint": "1.92.0",
|
|
46
46
|
"oxlint-tsgolint": "7.0.2006",
|
|
47
47
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
package/src/document-domain.ts
CHANGED
|
@@ -31,7 +31,7 @@ export const MarkdownText = mosaicText({
|
|
|
31
31
|
maximumRunsPerOperation: 65_536,
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
const {
|
|
35
35
|
emptyIndexRoot: EMPTY_MARKDOWN_INDEX_ROOT,
|
|
36
36
|
indexMemberModel: markdownIndexMemberModel,
|
|
37
37
|
indexMemberSchema: markdownIndexMemberSchema,
|
|
@@ -44,6 +44,14 @@ export const {
|
|
|
44
44
|
text: MarkdownText,
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
+
/** @internal Used by implementation tests. */
|
|
48
|
+
export {
|
|
49
|
+
EMPTY_MARKDOWN_INDEX_ROOT,
|
|
50
|
+
markdownIndexMemberModel,
|
|
51
|
+
markdownIndexRootModel,
|
|
52
|
+
markdownSourceModel,
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
const id = z.string().min(1).max(512)
|
|
48
56
|
const emptyIndexMember = (memberId: string): MosaicTextIndexMember => ({
|
|
49
57
|
fragments: [],
|
|
@@ -56,10 +64,12 @@ const emptyIndexMember = (memberId: string): MosaicTextIndexMember => ({
|
|
|
56
64
|
export const markdownSourceAtom = mutableAtom<InstanceType<typeof MarkdownText>>(
|
|
57
65
|
{ class: MarkdownText, key: `markdownSource` },
|
|
58
66
|
)
|
|
67
|
+
/** @internal Used by implementation tests. */
|
|
59
68
|
export const markdownIndexRootAtom = atom<MosaicTextIndexRoot>({
|
|
60
69
|
default: EMPTY_MARKDOWN_INDEX_ROOT,
|
|
61
70
|
key: `markdownIndexRoot`,
|
|
62
71
|
})
|
|
72
|
+
/** @internal Used by implementation tests. */
|
|
63
73
|
export const markdownIndexMemberAtoms = atomFamily<
|
|
64
74
|
MosaicTextIndexMember,
|
|
65
75
|
string
|
|
@@ -88,7 +98,7 @@ const relativePosition = z
|
|
|
88
98
|
})
|
|
89
99
|
.strict()
|
|
90
100
|
|
|
91
|
-
|
|
101
|
+
const markdownPresenceSchema: z.ZodType<MarkdownPresence> = z
|
|
92
102
|
.object({
|
|
93
103
|
actor: id,
|
|
94
104
|
color: z.string().min(1).max(64),
|
|
@@ -105,14 +115,15 @@ export const markdownPresenceSchema: z.ZodType<MarkdownPresence> = z
|
|
|
105
115
|
})
|
|
106
116
|
.strict()
|
|
107
117
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
const markdownPresenceAtoms = atomFamily<MarkdownPresence | null, string>({
|
|
119
|
+
default: null,
|
|
120
|
+
key: `markdownPresence`,
|
|
121
|
+
})
|
|
111
122
|
export const markdownPresenceKey = (
|
|
112
123
|
identity: Pick<MarkdownPresence, `actor` | `session`>,
|
|
113
124
|
): string => `${identity.actor}\u0000${identity.session}`
|
|
114
125
|
|
|
115
|
-
|
|
126
|
+
const markdownDocumentDomain = mosaicDomain({
|
|
116
127
|
configSchema: z.object({}).strict(),
|
|
117
128
|
key: `markdown-document`,
|
|
118
129
|
members: {
|
package/src/identities.ts
CHANGED
package/src/protocol.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
MosaicTextIndexRange,
|
|
3
|
-
MosaicTextRelativePosition,
|
|
4
|
-
} from "@atom.io/realtime"
|
|
1
|
+
import type { MosaicTextRelativePosition } from "@atom.io/realtime"
|
|
5
2
|
|
|
6
3
|
export const MARKDOWN_EVENTS = {
|
|
7
4
|
command: `markdown-domain:command`,
|
|
@@ -14,7 +11,7 @@ export type MarkdownAcknowledgement<Value> =
|
|
|
14
11
|
| { readonly ok: true; readonly value: Value }
|
|
15
12
|
| { readonly ok: false; readonly reason: string }
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
type MarkdownEditCommand = {
|
|
18
15
|
readonly anchor: MosaicTextRelativePosition
|
|
19
16
|
readonly gestureId: string
|
|
20
17
|
readonly head: MosaicTextRelativePosition
|
|
@@ -23,7 +20,7 @@ export type MarkdownEditCommand = {
|
|
|
23
20
|
readonly type: `replace`
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
type MarkdownImportCommand = {
|
|
27
24
|
readonly gestureId: string
|
|
28
25
|
readonly sequence: number
|
|
29
26
|
readonly text: string
|
|
@@ -31,5 +28,3 @@ export type MarkdownImportCommand = {
|
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
export type MarkdownCommand = MarkdownEditCommand | MarkdownImportCommand
|
|
34
|
-
|
|
35
|
-
export type MarkdownViewport = MosaicTextIndexRange
|
package/src/session.ts
CHANGED
|
@@ -14,13 +14,6 @@ export function getBrowserSession(): { clientId: string; identity: Identity } {
|
|
|
14
14
|
return { clientId, identity }
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export function realtimeAuth(
|
|
18
|
-
identity: Identity,
|
|
19
|
-
clientId: string,
|
|
20
|
-
): { sessionId: string; userId: string } {
|
|
21
|
-
return { sessionId: clientId, userId: identity.id }
|
|
22
|
-
}
|
|
23
|
-
|
|
24
17
|
export function switchBrowserIdentity(identityId: string): void {
|
|
25
18
|
window.localStorage.setItem(IDENTITY_KEY, identityId)
|
|
26
19
|
const url = new URL(window.location.href)
|
package/src/workspace-state.ts
CHANGED
|
@@ -21,12 +21,12 @@ import {
|
|
|
21
21
|
type MarkdownVirtualWindow,
|
|
22
22
|
} from "./virtualization.ts"
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
type MarkdownScrollViewport = {
|
|
25
25
|
readonly height: number
|
|
26
26
|
readonly scrollTop: number
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
type MarkdownWorkspacePeer = {
|
|
30
30
|
readonly id: string
|
|
31
31
|
readonly selection: MosaicTextSelection | null
|
|
32
32
|
readonly value: MarkdownPresence
|
|
@@ -56,7 +56,7 @@ export type MarkdownWorkspaceState = Disposable & {
|
|
|
56
56
|
setScroll(viewport: MarkdownScrollViewport, defer: boolean): void
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
const EMPTY_PARSE_METRICS: MarkdownParseInstrumentation = {
|
|
60
60
|
canceled: false,
|
|
61
61
|
elapsedMs: 0,
|
|
62
62
|
parsedBlocks: 0,
|