@tldraw/tlschema 5.1.1 → 5.2.0-canary.0878dbd31f0d
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/DOCS.md +682 -0
- package/README.md +9 -1
- package/dist-cjs/index.d.ts +5 -5
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/records/TLInstance.js +3 -2
- package/dist-cjs/records/TLInstance.js.map +2 -2
- package/dist-cjs/records/TLPresence.js +3 -2
- package/dist-cjs/records/TLPresence.js.map +2 -2
- package/dist-esm/index.d.mts +5 -5
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/records/TLInstance.mjs +3 -2
- package/dist-esm/records/TLInstance.mjs.map +2 -2
- package/dist-esm/records/TLPresence.mjs +3 -2
- package/dist-esm/records/TLPresence.mjs.map +2 -2
- package/package.json +8 -7
- package/src/records/TLInstance.ts +5 -4
- package/src/records/TLPresence.ts +5 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tldraw/tlschema",
|
|
3
3
|
"description": "tldraw infinite canvas SDK (schema).",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.2.0-canary.0878dbd31f0d",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"dist-esm",
|
|
31
31
|
"dist-cjs",
|
|
32
|
-
"src"
|
|
32
|
+
"src",
|
|
33
|
+
"DOCS.md"
|
|
33
34
|
],
|
|
34
35
|
"scripts": {
|
|
35
36
|
"test-ci": "yarn run -T vitest run --passWithNoTests",
|
|
@@ -47,13 +48,13 @@
|
|
|
47
48
|
"kleur": "^4.1.5",
|
|
48
49
|
"lazyrepo": "0.0.0-alpha.27",
|
|
49
50
|
"react": "^19.2.1",
|
|
50
|
-
"vitest": "^
|
|
51
|
+
"vitest": "^4.1.7"
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
53
|
-
"@tldraw/state": "5.
|
|
54
|
-
"@tldraw/store": "5.
|
|
55
|
-
"@tldraw/utils": "5.
|
|
56
|
-
"@tldraw/validate": "5.
|
|
54
|
+
"@tldraw/state": "5.2.0-canary.0878dbd31f0d",
|
|
55
|
+
"@tldraw/store": "5.2.0-canary.0878dbd31f0d",
|
|
56
|
+
"@tldraw/utils": "5.2.0-canary.0878dbd31f0d",
|
|
57
|
+
"@tldraw/validate": "5.2.0-canary.0878dbd31f0d"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"react": "^18.2.0 || ^19.2.1",
|
|
@@ -15,6 +15,7 @@ import { scribbleValidator, TLScribble } from '../misc/TLScribble'
|
|
|
15
15
|
import { StyleProp } from '../styles/StyleProp'
|
|
16
16
|
import { pageIdValidator, TLPageId } from './TLPage'
|
|
17
17
|
import { TLShapeId } from './TLShape'
|
|
18
|
+
import { TLUserId, userIdValidator } from './TLUser'
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* State that is particular to a single browser tab. The TLInstance record stores
|
|
@@ -43,8 +44,8 @@ export interface TLInstance extends BaseRecord<'instance', TLInstanceId> {
|
|
|
43
44
|
currentPageId: TLPageId
|
|
44
45
|
opacityForNextShape: TLOpacityType
|
|
45
46
|
stylesForNextShape: Record<string, unknown>
|
|
46
|
-
followingUserId:
|
|
47
|
-
highlightedUserIds:
|
|
47
|
+
followingUserId: TLUserId | null
|
|
48
|
+
highlightedUserIds: TLUserId[]
|
|
48
49
|
brush: BoxModel | null
|
|
49
50
|
cursor: TLCursor
|
|
50
51
|
scribbles: TLScribble[]
|
|
@@ -211,7 +212,7 @@ export function createInstanceRecordType(stylesById: Map<string, StyleProp<unkno
|
|
|
211
212
|
typeName: T.literal('instance'),
|
|
212
213
|
id: idValidator<TLInstanceId>('instance'),
|
|
213
214
|
currentPageId: pageIdValidator,
|
|
214
|
-
followingUserId:
|
|
215
|
+
followingUserId: userIdValidator.nullable(),
|
|
215
216
|
brush: boxModelValidator.nullable(),
|
|
216
217
|
opacityForNextShape: opacityValidator,
|
|
217
218
|
stylesForNextShape: T.object(stylesForNextShapeValidators),
|
|
@@ -228,7 +229,7 @@ export function createInstanceRecordType(stylesById: Map<string, StyleProp<unkno
|
|
|
228
229
|
isGridMode: T.boolean,
|
|
229
230
|
chatMessage: T.string,
|
|
230
231
|
isChatting: T.boolean,
|
|
231
|
-
highlightedUserIds: T.arrayOf(
|
|
232
|
+
highlightedUserIds: T.arrayOf(userIdValidator),
|
|
232
233
|
isFocused: T.boolean,
|
|
233
234
|
devicePixelRatio: T.number,
|
|
234
235
|
isCoarsePointer: T.boolean,
|
|
@@ -13,6 +13,7 @@ import { cursorTypeValidator, TLCursor } from '../misc/TLCursor'
|
|
|
13
13
|
import { scribbleValidator, TLScribble } from '../misc/TLScribble'
|
|
14
14
|
import { TLPageId } from './TLPage'
|
|
15
15
|
import { TLShapeId } from './TLShape'
|
|
16
|
+
import { TLUserId, userIdValidator } from './TLUser'
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Represents the presence state of a user in a collaborative tldraw session.
|
|
@@ -39,7 +40,7 @@ import { TLShapeId } from './TLShape'
|
|
|
39
40
|
* @public
|
|
40
41
|
*/
|
|
41
42
|
export interface TLInstancePresence extends BaseRecord<'instance_presence', TLInstancePresenceID> {
|
|
42
|
-
userId:
|
|
43
|
+
userId: TLUserId
|
|
43
44
|
userName: string
|
|
44
45
|
lastActivityTimestamp: number | null
|
|
45
46
|
color: string // can be any hex color
|
|
@@ -49,7 +50,7 @@ export interface TLInstancePresence extends BaseRecord<'instance_presence', TLIn
|
|
|
49
50
|
brush: BoxModel | null
|
|
50
51
|
scribbles: TLScribble[]
|
|
51
52
|
screenBounds: BoxModel | null
|
|
52
|
-
followingUserId:
|
|
53
|
+
followingUserId: TLUserId | null
|
|
53
54
|
cursor: {
|
|
54
55
|
x: number
|
|
55
56
|
y: number
|
|
@@ -101,10 +102,10 @@ export const instancePresenceValidator: T.Validator<TLInstancePresence> = T.mode
|
|
|
101
102
|
T.object({
|
|
102
103
|
typeName: T.literal('instance_presence'),
|
|
103
104
|
id: idValidator<TLInstancePresenceID>('instance_presence'),
|
|
104
|
-
userId:
|
|
105
|
+
userId: userIdValidator,
|
|
105
106
|
userName: T.string,
|
|
106
107
|
lastActivityTimestamp: T.number.nullable(),
|
|
107
|
-
followingUserId:
|
|
108
|
+
followingUserId: userIdValidator.nullable(),
|
|
108
109
|
cursor: T.object({
|
|
109
110
|
x: T.number,
|
|
110
111
|
y: T.number,
|