@tldraw/tlschema 5.3.0-next.fc37bd96825b → 5.4.0-canary.074b19f2c11f
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/dist-cjs/index.d.ts +384 -101
- package/dist-cjs/index.js +16 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/misc/TLCursor.js +1 -0
- package/dist-cjs/misc/TLCursor.js.map +2 -2
- package/dist-cjs/misc/b64Vecs.js.map +2 -2
- package/dist-cjs/records/TLComment.js +232 -0
- package/dist-cjs/records/TLComment.js.map +7 -0
- package/dist-cjs/records/TLPage.js +5 -0
- package/dist-cjs/records/TLPage.js.map +2 -2
- package/dist-cjs/shapes/TLGeoShape.js +15 -1
- package/dist-cjs/shapes/TLGeoShape.js.map +2 -2
- package/dist-esm/index.d.mts +384 -101
- package/dist-esm/index.mjs +31 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/misc/TLCursor.mjs +1 -0
- package/dist-esm/misc/TLCursor.mjs.map +2 -2
- package/dist-esm/misc/b64Vecs.mjs.map +2 -2
- package/dist-esm/records/TLComment.mjs +212 -0
- package/dist-esm/records/TLComment.mjs.map +7 -0
- package/dist-esm/records/TLPage.mjs +5 -0
- package/dist-esm/records/TLPage.mjs.map +2 -2
- package/dist-esm/shapes/TLGeoShape.mjs +15 -1
- package/dist-esm/shapes/TLGeoShape.mjs.map +2 -2
- package/package.json +5 -5
- package/src/index.ts +23 -0
- package/src/migrations.test.ts +12 -0
- package/src/misc/TLCursor.ts +1 -0
- package/src/misc/b64Vecs.ts +2 -11
- package/src/records/TLComment.test.ts +255 -0
- package/src/records/TLComment.ts +446 -0
- package/src/records/TLPage.ts +23 -0
- package/src/shapes/TLGeoShape.ts +21 -1
package/dist-cjs/index.d.ts
CHANGED
|
@@ -529,6 +529,43 @@ export declare const CameraRecordType: RecordType<TLCamera, never>;
|
|
|
529
529
|
*/
|
|
530
530
|
export declare const canvasUiColorTypeValidator: T.Validator<"accent" | "black" | "laser" | "muted-1" | "selection-fill" | "selection-stroke" | "white">;
|
|
531
531
|
|
|
532
|
+
/**
|
|
533
|
+
* Config for registering the `comment-reaction` record type in a tldraw schema. Pass via
|
|
534
|
+
* `commentSchemaRecords`; see `TLCommentReaction`.
|
|
535
|
+
*
|
|
536
|
+
* @public
|
|
537
|
+
*/
|
|
538
|
+
export declare const commentReactionRecordConfig: CustomRecordInfo;
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Config for registering the `comment` record type in a tldraw schema. Pass via
|
|
542
|
+
* `commentSchemaRecords`; see `TLComment`.
|
|
543
|
+
*
|
|
544
|
+
* @public
|
|
545
|
+
*/
|
|
546
|
+
export declare const commentRecordConfig: CustomRecordInfo;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* The `records` map to pass to `createTLSchema` / the client `records` option so comment
|
|
550
|
+
* threads, comments, and reactions sync. Register the types together — one without the others
|
|
551
|
+
* will fail schema validation on one side of the connection.
|
|
552
|
+
*
|
|
553
|
+
* @public
|
|
554
|
+
*/
|
|
555
|
+
export declare const commentSchemaRecords: {
|
|
556
|
+
'comment-reaction': CustomRecordInfo;
|
|
557
|
+
'comment-thread': CustomRecordInfo;
|
|
558
|
+
comment: CustomRecordInfo;
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Config for registering the `comment-thread` record type in a tldraw schema. Pass via
|
|
563
|
+
* `commentSchemaRecords`; see `TLCommentThread`.
|
|
564
|
+
*
|
|
565
|
+
* @public
|
|
566
|
+
*/
|
|
567
|
+
export declare const commentThreadRecordConfig: CustomRecordInfo;
|
|
568
|
+
|
|
532
569
|
/**
|
|
533
570
|
* Compress legacy draw shape segments by converting VecModel[] points to delta-encoded base64 format.
|
|
534
571
|
* This function is useful for converting old draw shape data to the new compressed format.
|
|
@@ -810,6 +847,66 @@ export declare function createBindingValidator<Type extends string, Props extend
|
|
|
810
847
|
*/
|
|
811
848
|
export declare function createCachedUserResolve(resolveFn: (userId: string) => null | TLUser): (userId: string) => Signal<null | TLUser>;
|
|
812
849
|
|
|
850
|
+
/**
|
|
851
|
+
* Create a new comment record within a thread.
|
|
852
|
+
*
|
|
853
|
+
* @public
|
|
854
|
+
*/
|
|
855
|
+
export declare function createComment(props: {
|
|
856
|
+
authorId: string;
|
|
857
|
+
body: TLRichText;
|
|
858
|
+
meta?: JsonObject;
|
|
859
|
+
now?: number;
|
|
860
|
+
pageId: TLPageId;
|
|
861
|
+
threadId: TLCommentThreadId;
|
|
862
|
+
}): TLComment;
|
|
863
|
+
|
|
864
|
+
/** @public */
|
|
865
|
+
export declare function createCommentId(id?: string): TLCommentId;
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Create a reaction record for one user's reaction to one comment. The id is derived from the
|
|
869
|
+
* comment and user (see `createCommentReactionId`), so re-reacting overwrites rather than adding.
|
|
870
|
+
*
|
|
871
|
+
* @public
|
|
872
|
+
*/
|
|
873
|
+
export declare function createCommentReaction(props: {
|
|
874
|
+
commentId: TLCommentId;
|
|
875
|
+
emoji: string;
|
|
876
|
+
meta?: JsonObject;
|
|
877
|
+
now?: number;
|
|
878
|
+
pageId: TLPageId;
|
|
879
|
+
threadId: TLCommentThreadId;
|
|
880
|
+
userId: string;
|
|
881
|
+
}): TLCommentReaction;
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* The id of one user's reaction to one comment, derived from the (comment, user, emoji) triple
|
|
885
|
+
* rather than random, so the same triple always addresses the same record and two tabs converge
|
|
886
|
+
* instead of racing to create duplicates. The sync authorizer leans on this, so it must be
|
|
887
|
+
* injective: all three parts are URI-encoded before joining, so a `:` in any of them can't shift
|
|
888
|
+
* the boundary and collapse two triples onto one id.
|
|
889
|
+
*
|
|
890
|
+
* @public
|
|
891
|
+
*/
|
|
892
|
+
export declare function createCommentReactionId(commentId: TLCommentId, userId: string, emoji: string): TLCommentReactionId;
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* Create a new comment thread record. Pair with `createComment` for the thread's first message.
|
|
896
|
+
*
|
|
897
|
+
* @public
|
|
898
|
+
*/
|
|
899
|
+
export declare function createCommentThread(props: {
|
|
900
|
+
anchor: TLCommentAnchor;
|
|
901
|
+
createdBy: string;
|
|
902
|
+
meta?: JsonObject;
|
|
903
|
+
now?: number;
|
|
904
|
+
pageId: TLPageId;
|
|
905
|
+
}): TLCommentThread;
|
|
906
|
+
|
|
907
|
+
/** @public */
|
|
908
|
+
export declare function createCommentThreadId(id?: string): TLCommentThreadId;
|
|
909
|
+
|
|
813
910
|
/**
|
|
814
911
|
* Creates a unique ID for a custom record type.
|
|
815
912
|
*
|
|
@@ -913,7 +1010,7 @@ export declare function createCustomRecordMigrationSequence(migrations: TLPropsM
|
|
|
913
1010
|
*
|
|
914
1011
|
* @public
|
|
915
1012
|
*/
|
|
916
|
-
export declare function createPresenceStateDerivation($user: Signal<null | TLUser>, opts?: CreatePresenceStateDerivationOpts): (store: TLStore) => Signal<null | TLInstancePresence
|
|
1013
|
+
export declare function createPresenceStateDerivation($user: Signal<null | TLUser>, opts?: CreatePresenceStateDerivationOpts): (store: TLStore) => Signal<null | TLInstancePresence>;
|
|
917
1014
|
|
|
918
1015
|
/** @public */
|
|
919
1016
|
export declare interface CreatePresenceStateDerivationOpts {
|
|
@@ -1136,7 +1233,7 @@ export declare function createShapeValidator<Type extends string, Props extends
|
|
|
1136
1233
|
* })
|
|
1137
1234
|
* ```
|
|
1138
1235
|
*/
|
|
1139
|
-
export declare function createTLSchema({ shapes, bindings, assets, user, records, migrations }?: {
|
|
1236
|
+
export declare function createTLSchema({ shapes, bindings, assets, user, records, migrations, }?: {
|
|
1140
1237
|
assets?: Record<string, SchemaPropsInfo>;
|
|
1141
1238
|
bindings?: Record<string, SchemaPropsInfo>;
|
|
1142
1239
|
migrations?: readonly MigrationSequence[];
|
|
@@ -2226,6 +2323,28 @@ export declare function isBinding(record?: UnknownRecord): record is TLBinding;
|
|
|
2226
2323
|
*/
|
|
2227
2324
|
export declare function isBindingId(id?: string): id is TLBindingId;
|
|
2228
2325
|
|
|
2326
|
+
/**
|
|
2327
|
+
* Type guard for `TLCommentId`. See `isCommentThreadId`.
|
|
2328
|
+
*
|
|
2329
|
+
* @public
|
|
2330
|
+
*/
|
|
2331
|
+
export declare function isCommentId(id: string): id is TLCommentId;
|
|
2332
|
+
|
|
2333
|
+
/**
|
|
2334
|
+
* Type guard for `TLCommentReactionId`. See `isCommentThreadId`.
|
|
2335
|
+
*
|
|
2336
|
+
* @public
|
|
2337
|
+
*/
|
|
2338
|
+
export declare function isCommentReactionId(id: string): id is TLCommentReactionId;
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Type guard for `TLCommentThreadId`. `isCommentId` rejects these — `comment-thread:` and
|
|
2342
|
+
* `comment:` differ in the character after `comment`, so the prefixes never overlap.
|
|
2343
|
+
*
|
|
2344
|
+
* @public
|
|
2345
|
+
*/
|
|
2346
|
+
export declare function isCommentThreadId(id: string): id is TLCommentThreadId;
|
|
2347
|
+
|
|
2229
2348
|
/**
|
|
2230
2349
|
* Type guard to check if a record is of a specific custom type.
|
|
2231
2350
|
*
|
|
@@ -2295,6 +2414,25 @@ export declare function isDocument(record?: UnknownRecord): record is TLDocument
|
|
|
2295
2414
|
|
|
2296
2415
|
/* Excluded from this release type: isFontEntry */
|
|
2297
2416
|
|
|
2417
|
+
/**
|
|
2418
|
+
* Type guard to check if a record is a page.
|
|
2419
|
+
*
|
|
2420
|
+
* @param record - The record to check
|
|
2421
|
+
* @returns True if the record is a page, false otherwise
|
|
2422
|
+
*
|
|
2423
|
+
* @example
|
|
2424
|
+
* ```ts
|
|
2425
|
+
* const record = store.get('page:abc123')
|
|
2426
|
+
|
|
2427
|
+
* if (isPage(record)) {
|
|
2428
|
+
* console.log(`Page name: ${record.name}`)
|
|
2429
|
+
* }
|
|
2430
|
+
* ```
|
|
2431
|
+
*
|
|
2432
|
+
* @public
|
|
2433
|
+
*/
|
|
2434
|
+
export declare function isPage(record?: UnknownRecord): record is TLPage;
|
|
2435
|
+
|
|
2298
2436
|
/**
|
|
2299
2437
|
* Type guard to check if a string is a valid TLPageId.
|
|
2300
2438
|
*
|
|
@@ -2364,152 +2502,152 @@ export declare function isUserId(id: string): id is TLUserId;
|
|
|
2364
2502
|
|
|
2365
2503
|
/** @public */
|
|
2366
2504
|
export declare const LANGUAGES: readonly [{
|
|
2367
|
-
readonly label:
|
|
2368
|
-
readonly locale:
|
|
2505
|
+
readonly label: 'Bahasa Indonesia';
|
|
2506
|
+
readonly locale: 'id';
|
|
2369
2507
|
}, {
|
|
2370
|
-
readonly label:
|
|
2371
|
-
readonly locale:
|
|
2508
|
+
readonly label: 'Bahasa Melayu';
|
|
2509
|
+
readonly locale: 'ms';
|
|
2372
2510
|
}, {
|
|
2373
|
-
readonly label:
|
|
2374
|
-
readonly locale:
|
|
2511
|
+
readonly label: 'Català';
|
|
2512
|
+
readonly locale: 'ca';
|
|
2375
2513
|
}, {
|
|
2376
|
-
readonly label:
|
|
2377
|
-
readonly locale:
|
|
2514
|
+
readonly label: 'Čeština';
|
|
2515
|
+
readonly locale: 'cs';
|
|
2378
2516
|
}, {
|
|
2379
|
-
readonly label:
|
|
2380
|
-
readonly locale:
|
|
2517
|
+
readonly label: 'Danish';
|
|
2518
|
+
readonly locale: 'da';
|
|
2381
2519
|
}, {
|
|
2382
|
-
readonly label:
|
|
2383
|
-
readonly locale:
|
|
2520
|
+
readonly label: 'Deutsch';
|
|
2521
|
+
readonly locale: 'de';
|
|
2384
2522
|
}, {
|
|
2385
|
-
readonly label:
|
|
2386
|
-
readonly locale:
|
|
2523
|
+
readonly label: 'English';
|
|
2524
|
+
readonly locale: 'en';
|
|
2387
2525
|
}, {
|
|
2388
|
-
readonly label:
|
|
2389
|
-
readonly locale:
|
|
2526
|
+
readonly label: 'Español';
|
|
2527
|
+
readonly locale: 'es';
|
|
2390
2528
|
}, {
|
|
2391
|
-
readonly label:
|
|
2392
|
-
readonly locale:
|
|
2529
|
+
readonly label: 'Filipino';
|
|
2530
|
+
readonly locale: 'tl';
|
|
2393
2531
|
}, {
|
|
2394
|
-
readonly label:
|
|
2395
|
-
readonly locale:
|
|
2532
|
+
readonly label: 'Français';
|
|
2533
|
+
readonly locale: 'fr';
|
|
2396
2534
|
}, {
|
|
2397
|
-
readonly label:
|
|
2398
|
-
readonly locale:
|
|
2535
|
+
readonly label: 'Galego';
|
|
2536
|
+
readonly locale: 'gl';
|
|
2399
2537
|
}, {
|
|
2400
|
-
readonly label:
|
|
2401
|
-
readonly locale:
|
|
2538
|
+
readonly label: 'Hrvatski';
|
|
2539
|
+
readonly locale: 'hr';
|
|
2402
2540
|
}, {
|
|
2403
|
-
readonly label:
|
|
2404
|
-
readonly locale:
|
|
2541
|
+
readonly label: 'Italiano';
|
|
2542
|
+
readonly locale: 'it';
|
|
2405
2543
|
}, {
|
|
2406
|
-
readonly label:
|
|
2407
|
-
readonly locale:
|
|
2544
|
+
readonly label: 'Magyar';
|
|
2545
|
+
readonly locale: 'hu';
|
|
2408
2546
|
}, {
|
|
2409
|
-
readonly label:
|
|
2410
|
-
readonly locale:
|
|
2547
|
+
readonly label: 'Nederlands';
|
|
2548
|
+
readonly locale: 'nl';
|
|
2411
2549
|
}, {
|
|
2412
|
-
readonly label:
|
|
2413
|
-
readonly locale:
|
|
2550
|
+
readonly label: 'Norwegian';
|
|
2551
|
+
readonly locale: 'no';
|
|
2414
2552
|
}, {
|
|
2415
|
-
readonly label:
|
|
2416
|
-
readonly locale:
|
|
2553
|
+
readonly label: 'Polski';
|
|
2554
|
+
readonly locale: 'pl';
|
|
2417
2555
|
}, {
|
|
2418
|
-
readonly label:
|
|
2419
|
-
readonly locale:
|
|
2556
|
+
readonly label: 'Português - Brasil';
|
|
2557
|
+
readonly locale: 'pt-br';
|
|
2420
2558
|
}, {
|
|
2421
|
-
readonly label:
|
|
2422
|
-
readonly locale:
|
|
2559
|
+
readonly label: 'Português - Europeu';
|
|
2560
|
+
readonly locale: 'pt-pt';
|
|
2423
2561
|
}, {
|
|
2424
|
-
readonly label:
|
|
2425
|
-
readonly locale:
|
|
2562
|
+
readonly label: 'Română';
|
|
2563
|
+
readonly locale: 'ro';
|
|
2426
2564
|
}, {
|
|
2427
|
-
readonly label:
|
|
2428
|
-
readonly locale:
|
|
2565
|
+
readonly label: 'Slovenščina';
|
|
2566
|
+
readonly locale: 'sl';
|
|
2429
2567
|
}, {
|
|
2430
|
-
readonly label:
|
|
2431
|
-
readonly locale:
|
|
2568
|
+
readonly label: 'Somali';
|
|
2569
|
+
readonly locale: 'so';
|
|
2432
2570
|
}, {
|
|
2433
|
-
readonly label:
|
|
2434
|
-
readonly locale:
|
|
2571
|
+
readonly label: 'Suomi';
|
|
2572
|
+
readonly locale: 'fi';
|
|
2435
2573
|
}, {
|
|
2436
|
-
readonly label:
|
|
2437
|
-
readonly locale:
|
|
2574
|
+
readonly label: 'Svenska';
|
|
2575
|
+
readonly locale: 'sv';
|
|
2438
2576
|
}, {
|
|
2439
|
-
readonly label:
|
|
2440
|
-
readonly locale:
|
|
2577
|
+
readonly label: 'Tiếng Việt';
|
|
2578
|
+
readonly locale: 'vi';
|
|
2441
2579
|
}, {
|
|
2442
|
-
readonly label:
|
|
2443
|
-
readonly locale:
|
|
2580
|
+
readonly label: 'Türkçe';
|
|
2581
|
+
readonly locale: 'tr';
|
|
2444
2582
|
}, {
|
|
2445
|
-
readonly label:
|
|
2446
|
-
readonly locale:
|
|
2583
|
+
readonly label: 'Ελληνικά';
|
|
2584
|
+
readonly locale: 'el';
|
|
2447
2585
|
}, {
|
|
2448
|
-
readonly label:
|
|
2449
|
-
readonly locale:
|
|
2586
|
+
readonly label: 'Русский';
|
|
2587
|
+
readonly locale: 'ru';
|
|
2450
2588
|
}, {
|
|
2451
|
-
readonly label:
|
|
2452
|
-
readonly locale:
|
|
2589
|
+
readonly label: 'Українська';
|
|
2590
|
+
readonly locale: 'uk';
|
|
2453
2591
|
}, {
|
|
2454
|
-
readonly label:
|
|
2455
|
-
readonly locale:
|
|
2592
|
+
readonly label: 'עברית';
|
|
2593
|
+
readonly locale: 'he';
|
|
2456
2594
|
}, {
|
|
2457
|
-
readonly label:
|
|
2458
|
-
readonly locale:
|
|
2595
|
+
readonly label: 'اردو';
|
|
2596
|
+
readonly locale: 'ur';
|
|
2459
2597
|
}, {
|
|
2460
|
-
readonly label:
|
|
2461
|
-
readonly locale:
|
|
2598
|
+
readonly label: 'عربي';
|
|
2599
|
+
readonly locale: 'ar';
|
|
2462
2600
|
}, {
|
|
2463
|
-
readonly label:
|
|
2464
|
-
readonly locale:
|
|
2601
|
+
readonly label: 'فارسی';
|
|
2602
|
+
readonly locale: 'fa';
|
|
2465
2603
|
}, {
|
|
2466
|
-
readonly label:
|
|
2467
|
-
readonly locale:
|
|
2604
|
+
readonly label: 'नेपाली';
|
|
2605
|
+
readonly locale: 'ne';
|
|
2468
2606
|
}, {
|
|
2469
|
-
readonly label:
|
|
2470
|
-
readonly locale:
|
|
2607
|
+
readonly label: 'मराठी';
|
|
2608
|
+
readonly locale: 'mr';
|
|
2471
2609
|
}, {
|
|
2472
|
-
readonly label:
|
|
2473
|
-
readonly locale:
|
|
2610
|
+
readonly label: 'हिन्दी';
|
|
2611
|
+
readonly locale: 'hi-in';
|
|
2474
2612
|
}, {
|
|
2475
|
-
readonly label:
|
|
2476
|
-
readonly locale:
|
|
2613
|
+
readonly label: 'বাংলা';
|
|
2614
|
+
readonly locale: 'bn';
|
|
2477
2615
|
}, {
|
|
2478
|
-
readonly label:
|
|
2479
|
-
readonly locale:
|
|
2616
|
+
readonly label: 'ਪੰਜਾਬੀ';
|
|
2617
|
+
readonly locale: 'pa';
|
|
2480
2618
|
}, {
|
|
2481
|
-
readonly label:
|
|
2482
|
-
readonly locale:
|
|
2619
|
+
readonly label: 'ગુજરાતી';
|
|
2620
|
+
readonly locale: 'gu-in';
|
|
2483
2621
|
}, {
|
|
2484
|
-
readonly label:
|
|
2485
|
-
readonly locale:
|
|
2622
|
+
readonly label: 'தமிழ்';
|
|
2623
|
+
readonly locale: 'ta';
|
|
2486
2624
|
}, {
|
|
2487
|
-
readonly label:
|
|
2488
|
-
readonly locale:
|
|
2625
|
+
readonly label: 'తెలుగు';
|
|
2626
|
+
readonly locale: 'te';
|
|
2489
2627
|
}, {
|
|
2490
|
-
readonly label:
|
|
2491
|
-
readonly locale:
|
|
2628
|
+
readonly label: 'ಕನ್ನಡ';
|
|
2629
|
+
readonly locale: 'kn';
|
|
2492
2630
|
}, {
|
|
2493
|
-
readonly label:
|
|
2494
|
-
readonly locale:
|
|
2631
|
+
readonly label: 'മലയാളം';
|
|
2632
|
+
readonly locale: 'ml';
|
|
2495
2633
|
}, {
|
|
2496
|
-
readonly label:
|
|
2497
|
-
readonly locale:
|
|
2634
|
+
readonly label: 'ภาษาไทย';
|
|
2635
|
+
readonly locale: 'th';
|
|
2498
2636
|
}, {
|
|
2499
|
-
readonly label:
|
|
2500
|
-
readonly locale:
|
|
2637
|
+
readonly label: 'ភាសាខ្មែរ';
|
|
2638
|
+
readonly locale: 'km-kh';
|
|
2501
2639
|
}, {
|
|
2502
|
-
readonly label:
|
|
2503
|
-
readonly locale:
|
|
2640
|
+
readonly label: '한국어';
|
|
2641
|
+
readonly locale: 'ko-kr';
|
|
2504
2642
|
}, {
|
|
2505
|
-
readonly label:
|
|
2506
|
-
readonly locale:
|
|
2643
|
+
readonly label: '日本語';
|
|
2644
|
+
readonly locale: 'ja';
|
|
2507
2645
|
}, {
|
|
2508
|
-
readonly label:
|
|
2509
|
-
readonly locale:
|
|
2646
|
+
readonly label: '简体中文';
|
|
2647
|
+
readonly locale: 'zh-cn';
|
|
2510
2648
|
}, {
|
|
2511
|
-
readonly label:
|
|
2512
|
-
readonly locale:
|
|
2649
|
+
readonly label: '繁體中文 (台灣)';
|
|
2650
|
+
readonly locale: 'zh-tw';
|
|
2513
2651
|
}];
|
|
2514
2652
|
|
|
2515
2653
|
/**
|
|
@@ -4005,6 +4143,145 @@ export declare type TLCameraId = RecordId<TLCamera>;
|
|
|
4005
4143
|
*/
|
|
4006
4144
|
export declare type TLCanvasUiColor = SetValue<typeof TL_CANVAS_UI_COLOR_TYPES>;
|
|
4007
4145
|
|
|
4146
|
+
/**
|
|
4147
|
+
* A single comment message within a thread. See `TLCommentThread` for the overall model and
|
|
4148
|
+
* sync/registration notes.
|
|
4149
|
+
*
|
|
4150
|
+
* Comment mutations are deliberately not undoable — create/edit them with
|
|
4151
|
+
* `{ history: 'ignore' }` to avoid multiplayer surprises like a comment reappearing after
|
|
4152
|
+
* someone else deleted it.
|
|
4153
|
+
*
|
|
4154
|
+
* @public
|
|
4155
|
+
*/
|
|
4156
|
+
export declare interface TLComment extends BaseRecord<'comment', TLCommentId> {
|
|
4157
|
+
/** The thread this comment belongs to. */
|
|
4158
|
+
threadId: TLCommentThreadId;
|
|
4159
|
+
/** Denormalized from the thread so per-page queries don't need a join. */
|
|
4160
|
+
pageId: TLPageId;
|
|
4161
|
+
/** See `TLCommentThread.createdBy` — same server-stamping caveat applies. */
|
|
4162
|
+
authorId: string;
|
|
4163
|
+
createdAt: number;
|
|
4164
|
+
/** Null until the comment is first edited. */
|
|
4165
|
+
editedAt: null | number;
|
|
4166
|
+
/** Rich text body. Use `toRichText(...)` for plaintext input. */
|
|
4167
|
+
body: TLRichText;
|
|
4168
|
+
/** Whether the comment is soft-deleted. Same model as `TLCommentThread.isDeleted`. */
|
|
4169
|
+
isDeleted: boolean;
|
|
4170
|
+
meta: JsonObject;
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
/**
|
|
4174
|
+
* Where a comment thread is anchored on the canvas. Modeled as a discriminated union so new
|
|
4175
|
+
* anchor kinds can be added without breaking existing threads:
|
|
4176
|
+
*
|
|
4177
|
+
* - `shape` — pinned to a shape. `x`/`y` are normalized (0–1) within the shape's bounds, so the pin
|
|
4178
|
+
* keeps its spot as the shape moves, resizes, and rotates. `isPrecise` mirrors arrow bindings:
|
|
4179
|
+
* when false (the default) the pin sits at a consumer-defined spot instead, top-right out of the
|
|
4180
|
+
* box, and `x`/`y` are the remembered precise position
|
|
4181
|
+
* - `point` — pinned to a fixed point on the page, in page coordinates
|
|
4182
|
+
* - `region` — pinned to a rectangular area of the page, in page coordinates
|
|
4183
|
+
* - `page` — a page-level thread with no spatial anchor
|
|
4184
|
+
*
|
|
4185
|
+
* @public
|
|
4186
|
+
*/
|
|
4187
|
+
export declare type TLCommentAnchor = {
|
|
4188
|
+
/** The normalized (0–1) corner the pin sits on — where the creating drag was released.
|
|
4189
|
+
* Absent on older records; consumers fall back to a corner of their own choosing. */
|
|
4190
|
+
pinX?: number;
|
|
4191
|
+
h: number;
|
|
4192
|
+
pinY?: number;
|
|
4193
|
+
type: 'region';
|
|
4194
|
+
w: number;
|
|
4195
|
+
x: number;
|
|
4196
|
+
y: number;
|
|
4197
|
+
} | {
|
|
4198
|
+
isPrecise: boolean;
|
|
4199
|
+
shapeId: TLShapeId;
|
|
4200
|
+
type: 'shape';
|
|
4201
|
+
x: number;
|
|
4202
|
+
y: number;
|
|
4203
|
+
} | {
|
|
4204
|
+
type: 'page';
|
|
4205
|
+
} | {
|
|
4206
|
+
type: 'point';
|
|
4207
|
+
x: number;
|
|
4208
|
+
y: number;
|
|
4209
|
+
};
|
|
4210
|
+
|
|
4211
|
+
/** @public */
|
|
4212
|
+
export declare type TLCommentId = RecordId<TLComment>;
|
|
4213
|
+
|
|
4214
|
+
/**
|
|
4215
|
+
* One person's emoji reaction to one comment.
|
|
4216
|
+
*
|
|
4217
|
+
* A reaction is its own record rather than a field on the comment: comment records are owner-only
|
|
4218
|
+
* for updates, and a shared field would make concurrent reactions race to overwrite each other.
|
|
4219
|
+
*
|
|
4220
|
+
* A user holds at most one record per (comment, emoji) pair, enforced by the derived id — see
|
|
4221
|
+
* `createCommentReactionId`. Limiting a user to one reaction overall is client-side policy (the
|
|
4222
|
+
* commenting package's `reactionMode`), not a property of this record.
|
|
4223
|
+
*
|
|
4224
|
+
* @public
|
|
4225
|
+
*/
|
|
4226
|
+
export declare interface TLCommentReaction extends BaseRecord<'comment-reaction', TLCommentReactionId> {
|
|
4227
|
+
/** The comment being reacted to. */
|
|
4228
|
+
commentId: TLCommentId;
|
|
4229
|
+
/** Denormalized from the comment, so a thread's reactions can be found without a join. */
|
|
4230
|
+
threadId: TLCommentThreadId;
|
|
4231
|
+
/** Denormalized from the comment — see `TLComment.pageId`. */
|
|
4232
|
+
pageId: TLPageId;
|
|
4233
|
+
/** Who reacted. See `TLCommentThread.createdBy` — same server-stamping caveat applies. */
|
|
4234
|
+
userId: string;
|
|
4235
|
+
/** The emoji itself, as a string (e.g. `'👍'`), not a shortcode. */
|
|
4236
|
+
emoji: string;
|
|
4237
|
+
createdAt: number;
|
|
4238
|
+
meta: JsonObject;
|
|
4239
|
+
}
|
|
4240
|
+
|
|
4241
|
+
/** @public */
|
|
4242
|
+
export declare type TLCommentReactionId = RecordId<TLCommentReaction>;
|
|
4243
|
+
|
|
4244
|
+
/**
|
|
4245
|
+
* A comment thread. The thread owns the anchor (where the conversation lives on the canvas) and
|
|
4246
|
+
* the resolution state; the messages themselves are `TLComment` records pointing at the thread
|
|
4247
|
+
* via `threadId`, ordered by `createdAt`. v1 threads are flat — no nested replies.
|
|
4248
|
+
*
|
|
4249
|
+
* Threads and comments are document records, but they're intended to be served through the sync
|
|
4250
|
+
* server's object-store lane: gated by the session's `objectAccess` rather than `isReadonly`
|
|
4251
|
+
* (so "can comment but not edit" is expressible), excluded from document snapshots and `.tldr`
|
|
4252
|
+
* exports server-side, and persisted in a separate lane from the main document.
|
|
4253
|
+
*
|
|
4254
|
+
* Opt-in: register with `createTLSchema({ records: commentSchemaRecords })` on the server and
|
|
4255
|
+
* the matching `records` option on the client — neither type is part of the default schema, and
|
|
4256
|
+
* both sides must register them identically.
|
|
4257
|
+
*
|
|
4258
|
+
* @public
|
|
4259
|
+
*/
|
|
4260
|
+
export declare interface TLCommentThread extends BaseRecord<'comment-thread', TLCommentThreadId> {
|
|
4261
|
+
/** The page the thread lives on. */
|
|
4262
|
+
pageId: TLPageId;
|
|
4263
|
+
/** Where the thread is anchored on that page. */
|
|
4264
|
+
anchor: TLCommentAnchor;
|
|
4265
|
+
/** Who started the thread. Client-supplied; sync servers are expected to stamp/verify it. */
|
|
4266
|
+
createdBy: string;
|
|
4267
|
+
createdAt: number;
|
|
4268
|
+
/** Resolution state: when and by whom the thread was resolved, or null while open. */
|
|
4269
|
+
resolved: {
|
|
4270
|
+
at: number;
|
|
4271
|
+
by: string;
|
|
4272
|
+
} | null;
|
|
4273
|
+
/**
|
|
4274
|
+
* Whether the thread is soft-deleted. Clients set the flag and leave the record in place. Sync
|
|
4275
|
+
* servers are expected to enforce it as write-once and creator-only, reject client hard
|
|
4276
|
+
* deletes, and drop flagged threads from future room loads.
|
|
4277
|
+
*/
|
|
4278
|
+
isDeleted: boolean;
|
|
4279
|
+
meta: JsonObject;
|
|
4280
|
+
}
|
|
4281
|
+
|
|
4282
|
+
/** @public */
|
|
4283
|
+
export declare type TLCommentThreadId = RecordId<TLCommentThread>;
|
|
4284
|
+
|
|
4008
4285
|
/**
|
|
4009
4286
|
* A partial version of a shape, useful for creating shapes.
|
|
4010
4287
|
*
|
|
@@ -4730,7 +5007,9 @@ export declare interface TLFrameShapeProps {
|
|
|
4730
5007
|
* labelColor: 'black',
|
|
4731
5008
|
* url: '',
|
|
4732
5009
|
* growY: 0,
|
|
4733
|
-
* scale: 1
|
|
5010
|
+
* scale: 1,
|
|
5011
|
+
* flipX: false,
|
|
5012
|
+
* flipY: false
|
|
4734
5013
|
* },
|
|
4735
5014
|
* meta: {}
|
|
4736
5015
|
* }
|
|
@@ -4765,6 +5044,10 @@ export declare interface TLGeoShapeProps {
|
|
|
4765
5044
|
growY: number;
|
|
4766
5045
|
/** Scale factor applied to the shape */
|
|
4767
5046
|
scale: number;
|
|
5047
|
+
/** Whether to mirror the shape horizontally */
|
|
5048
|
+
flipX: boolean;
|
|
5049
|
+
/** Whether to mirror the shape vertically */
|
|
5050
|
+
flipY: boolean;
|
|
4768
5051
|
/** Color style for text label */
|
|
4769
5052
|
labelColor: TLDefaultColorStyle;
|
|
4770
5053
|
/** Color style for the shape outline */
|
package/dist-cjs/index.js
CHANGED
|
@@ -70,6 +70,10 @@ __export(index_exports, {
|
|
|
70
70
|
bookmarkShapeProps: () => import_TLBookmarkShape.bookmarkShapeProps,
|
|
71
71
|
boxModelValidator: () => import_geometry_types.boxModelValidator,
|
|
72
72
|
canvasUiColorTypeValidator: () => import_TLColor.canvasUiColorTypeValidator,
|
|
73
|
+
commentReactionRecordConfig: () => import_TLComment.commentReactionRecordConfig,
|
|
74
|
+
commentRecordConfig: () => import_TLComment.commentRecordConfig,
|
|
75
|
+
commentSchemaRecords: () => import_TLComment.commentSchemaRecords,
|
|
76
|
+
commentThreadRecordConfig: () => import_TLComment.commentThreadRecordConfig,
|
|
73
77
|
compressLegacySegments: () => import_TLDrawShape.compressLegacySegments,
|
|
74
78
|
createAssetPropsMigrationIds: () => import_TLAsset.createAssetPropsMigrationIds,
|
|
75
79
|
createAssetPropsMigrationSequence: () => import_TLAsset.createAssetPropsMigrationSequence,
|
|
@@ -80,6 +84,12 @@ __export(index_exports, {
|
|
|
80
84
|
createBindingPropsMigrationSequence: () => import_TLBinding.createBindingPropsMigrationSequence,
|
|
81
85
|
createBindingValidator: () => import_TLBaseBinding.createBindingValidator,
|
|
82
86
|
createCachedUserResolve: () => import_TLStore.createCachedUserResolve,
|
|
87
|
+
createComment: () => import_TLComment.createComment,
|
|
88
|
+
createCommentId: () => import_TLComment.createCommentId,
|
|
89
|
+
createCommentReaction: () => import_TLComment.createCommentReaction,
|
|
90
|
+
createCommentReactionId: () => import_TLComment.createCommentReactionId,
|
|
91
|
+
createCommentThread: () => import_TLComment.createCommentThread,
|
|
92
|
+
createCommentThreadId: () => import_TLComment.createCommentThreadId,
|
|
83
93
|
createCustomRecordId: () => import_TLCustomRecord.createCustomRecordId,
|
|
84
94
|
createCustomRecordMigrationIds: () => import_TLCustomRecord.createCustomRecordMigrationIds,
|
|
85
95
|
createCustomRecordMigrationSequence: () => import_TLCustomRecord.createCustomRecordMigrationSequence,
|
|
@@ -116,10 +126,14 @@ __export(index_exports, {
|
|
|
116
126
|
imageShapeProps: () => import_TLImageShape.imageShapeProps,
|
|
117
127
|
isBinding: () => import_TLBinding.isBinding,
|
|
118
128
|
isBindingId: () => import_TLBinding.isBindingId,
|
|
129
|
+
isCommentId: () => import_TLComment.isCommentId,
|
|
130
|
+
isCommentReactionId: () => import_TLComment.isCommentReactionId,
|
|
131
|
+
isCommentThreadId: () => import_TLComment.isCommentThreadId,
|
|
119
132
|
isCustomRecord: () => import_TLCustomRecord.isCustomRecord,
|
|
120
133
|
isCustomRecordId: () => import_TLCustomRecord.isCustomRecordId,
|
|
121
134
|
isDocument: () => import_TLDocument.isDocument,
|
|
122
135
|
isFontEntry: () => import_TLFontStyle.isFontEntry,
|
|
136
|
+
isPage: () => import_TLPage.isPage,
|
|
123
137
|
isPageId: () => import_TLPage.isPageId,
|
|
124
138
|
isShape: () => import_TLShape.isShape,
|
|
125
139
|
isShapeId: () => import_TLShape.isShapeId,
|
|
@@ -170,6 +184,7 @@ var import_TLScribble = require("./misc/TLScribble");
|
|
|
170
184
|
var import_TLAsset = require("./records/TLAsset");
|
|
171
185
|
var import_TLBinding = require("./records/TLBinding");
|
|
172
186
|
var import_TLCamera = require("./records/TLCamera");
|
|
187
|
+
var import_TLComment = require("./records/TLComment");
|
|
173
188
|
var import_TLCustomRecord = require("./records/TLCustomRecord");
|
|
174
189
|
var import_TLDocument = require("./records/TLDocument");
|
|
175
190
|
var import_TLInstance = require("./records/TLInstance");
|
|
@@ -207,7 +222,7 @@ var import_translations = require("./translations/translations");
|
|
|
207
222
|
var import_b64Vecs = require("./misc/b64Vecs");
|
|
208
223
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
209
224
|
"@tldraw/tlschema",
|
|
210
|
-
"5.
|
|
225
|
+
"5.4.0-canary.074b19f2c11f",
|
|
211
226
|
"cjs"
|
|
212
227
|
);
|
|
213
228
|
//# sourceMappingURL=index.js.map
|