@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/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.1.1",
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": "^3.2.4"
51
+ "vitest": "^4.1.7"
51
52
  },
52
53
  "dependencies": {
53
- "@tldraw/state": "5.1.1",
54
- "@tldraw/store": "5.1.1",
55
- "@tldraw/utils": "5.1.1",
56
- "@tldraw/validate": "5.1.1"
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: string | null
47
- highlightedUserIds: string[]
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: T.string.nullable(),
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(T.string),
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: string
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: string | null
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: T.string,
105
+ userId: userIdValidator,
105
106
  userName: T.string,
106
107
  lastActivityTimestamp: T.number.nullable(),
107
- followingUserId: T.string.nullable(),
108
+ followingUserId: userIdValidator.nullable(),
108
109
  cursor: T.object({
109
110
  x: T.number,
110
111
  y: T.number,