@tldraw/editor 5.6.0-canary.e9e8ec003426 → 5.6.0-canary.f283055556fc
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 +167 -2
- package/dist-cjs/index.js +7 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +18 -5
- package/dist-cjs/lib/TldrawEditor.js.map +3 -3
- package/dist-cjs/lib/components/LiveCollaborators.js +3 -3
- package/dist-cjs/lib/components/LiveCollaborators.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +57 -15
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
- package/dist-cjs/lib/config/TLI18n.js +64 -0
- package/dist-cjs/lib/config/TLI18n.js.map +7 -0
- package/dist-cjs/lib/editor/Editor.js +29 -12
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js +10 -3
- package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js.map +2 -2
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +1 -1
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js +19 -2
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js +3 -5
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +7 -1
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +28 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +3 -0
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
- package/dist-cjs/lib/hooks/useDocumentEvents.js +28 -3
- package/dist-cjs/lib/hooks/useDocumentEvents.js.map +2 -2
- package/dist-cjs/lib/license/LicenseManager.js +62 -4
- package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
- package/dist-cjs/lib/options.js +1 -1
- package/dist-cjs/lib/options.js.map +1 -1
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +167 -2
- package/dist-esm/index.mjs +13 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +18 -5
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- package/dist-esm/lib/components/LiveCollaborators.mjs +3 -3
- package/dist-esm/lib/components/LiveCollaborators.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +61 -16
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
- package/dist-esm/lib/config/TLI18n.mjs +44 -0
- package/dist-esm/lib/config/TLI18n.mjs.map +7 -0
- package/dist-esm/lib/editor/Editor.mjs +29 -12
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs +10 -3
- package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +1 -1
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs +20 -3
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs +3 -5
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +7 -1
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +28 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +3 -0
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/hooks/useDocumentEvents.mjs +28 -3
- package/dist-esm/lib/hooks/useDocumentEvents.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseManager.mjs +62 -4
- package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
- package/dist-esm/lib/options.mjs +1 -1
- package/dist-esm/lib/options.mjs.map +1 -1
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +2 -1
- package/package.json +7 -7
- package/src/index.ts +14 -2
- package/src/lib/TldrawEditor.tsx +44 -4
- package/src/lib/components/LiveCollaborators.tsx +3 -3
- package/src/lib/components/default-components/DefaultErrorFallback.tsx +66 -18
- package/src/lib/config/TLI18n.test.ts +84 -0
- package/src/lib/config/TLI18n.ts +172 -0
- package/src/lib/editor/Editor.ts +52 -24
- package/src/lib/editor/derivations/shapeIdsInCurrentPage.ts +19 -3
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +17 -0
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +2 -2
- package/src/lib/editor/managers/FontManager/FontManager.test.ts +1 -0
- package/src/lib/editor/managers/FontManager/FontManager.ts +26 -3
- package/src/lib/editor/managers/HistoryManager/HistoryManager.test.ts +32 -0
- package/src/lib/editor/managers/ScribbleManager/ScribbleManager.ts +4 -6
- package/src/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.ts +16 -7
- package/src/lib/editor/shapes/ShapeUtil.ts +30 -0
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +4 -0
- package/src/lib/hooks/useDocumentEvents.ts +51 -3
- package/src/lib/license/LicenseManager.test.ts +204 -0
- package/src/lib/license/LicenseManager.ts +88 -4
- package/src/lib/options.ts +1 -1
- package/src/lib/test/useDocumentEvents.test.tsx +153 -22
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1000,6 +1000,16 @@ export declare function DefaultErrorFallback({ error, editor }: TLErrorFallbackP
|
|
|
1000
1000
|
/** @public @react */
|
|
1001
1001
|
export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
|
|
1002
1002
|
|
|
1003
|
+
/**
|
|
1004
|
+
* The i18n used when the host app supplies none: every message comes back as its own English.
|
|
1005
|
+
*
|
|
1006
|
+
* Placeholders are left as they are, because formatting ICU needs a formatter and this package
|
|
1007
|
+
* deliberately has none — it is the floor for an editor running with no translations at all.
|
|
1008
|
+
*
|
|
1009
|
+
* @public
|
|
1010
|
+
*/
|
|
1011
|
+
export declare function defaultI18n(): TLI18n;
|
|
1012
|
+
|
|
1003
1013
|
/** @public @react */
|
|
1004
1014
|
export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
|
|
1005
1015
|
|
|
@@ -1059,7 +1069,7 @@ export declare const defaultTldrawOptions: {
|
|
|
1059
1069
|
readonly step: 1;
|
|
1060
1070
|
}];
|
|
1061
1071
|
readonly handleRadius: 12;
|
|
1062
|
-
readonly hitTestMargin:
|
|
1072
|
+
readonly hitTestMargin: 4.5;
|
|
1063
1073
|
readonly laserDelayMs: 1200;
|
|
1064
1074
|
readonly laserFadeoutMs: 500;
|
|
1065
1075
|
readonly longPressDurationMs: 500;
|
|
@@ -1108,6 +1118,39 @@ export declare const defaultUserPreferences: Readonly<{
|
|
|
1108
1118
|
/** @public */
|
|
1109
1119
|
export declare const defaultUserStore: TLUserStore;
|
|
1110
1120
|
|
|
1121
|
+
/**
|
|
1122
|
+
* Declares messages so the extractor can find them, next to the UI that shows them — the English
|
|
1123
|
+
* then lives with the code rather than in a catalog edited by hand. Call it by this name:
|
|
1124
|
+
* `formatjs extract` matches the call by name, wherever it was imported from, so a wrapper under
|
|
1125
|
+
* another name extracts nothing.
|
|
1126
|
+
*
|
|
1127
|
+
* Write the id yourself, as the SDK's own messages do — an app overrides by id, so an id has to
|
|
1128
|
+
* survive a reworded English string. Leave it out only where a bundler plugin injects one; with no
|
|
1129
|
+
* plugin either the English stands in, so the message still renders as itself. An id missing from
|
|
1130
|
+
* a real build is caught by `pnpm i18n-extract --check`.
|
|
1131
|
+
*
|
|
1132
|
+
* The type parameter is `const` so each written `id` keeps its literal type, which is what lets a
|
|
1133
|
+
* declared id go where a `TLUiTranslationKey` is expected — a menu item's `label`, say — instead
|
|
1134
|
+
* of widening to `string` and needing a cast.
|
|
1135
|
+
*
|
|
1136
|
+
* For a message rendered as an element, write it inline on the `<F>` instead; the extractor reads
|
|
1137
|
+
* those props directly. This is for the ones that can't be: a label the UI takes as data, and
|
|
1138
|
+
* anything translated as a string through `useTranslation`.
|
|
1139
|
+
*
|
|
1140
|
+
* @example
|
|
1141
|
+
*
|
|
1142
|
+
* ```ts
|
|
1143
|
+
* const messages = defineMessages({
|
|
1144
|
+
* copy: { id: 'action.copy', defaultMessage: 'Copy' },
|
|
1145
|
+
* })
|
|
1146
|
+
* ```
|
|
1147
|
+
*
|
|
1148
|
+
* @public
|
|
1149
|
+
*/
|
|
1150
|
+
export declare function defineMessages<const Messages extends Record<string, TLI18nMessageInput>>(msgs: Messages): {
|
|
1151
|
+
[K in keyof Messages]: Messages[K] & TLI18nMessage;
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1111
1154
|
/**
|
|
1112
1155
|
* Convert degrees to radians.
|
|
1113
1156
|
*
|
|
@@ -1183,13 +1226,19 @@ export declare class EdgeScrollManager {
|
|
|
1183
1226
|
/** @public */
|
|
1184
1227
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
1185
1228
|
readonly id: string;
|
|
1186
|
-
constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, overlayUtils: overlayUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme, }: TLEditorOptions);
|
|
1229
|
+
constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, overlayUtils: overlayUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme, i18n, }: TLEditorOptions);
|
|
1187
1230
|
private readonly _getShapeVisibility?;
|
|
1188
1231
|
private getIsShapeHiddenCache;
|
|
1189
1232
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
1190
1233
|
readonly options: TldrawOptions;
|
|
1191
1234
|
/* Excluded from this release type: licenseManager */
|
|
1192
1235
|
readonly contextId: string;
|
|
1236
|
+
/**
|
|
1237
|
+
* The i18n adapter for translating strings.
|
|
1238
|
+
*
|
|
1239
|
+
* @public
|
|
1240
|
+
*/
|
|
1241
|
+
readonly i18n: TLI18nAdapter;
|
|
1193
1242
|
/**
|
|
1194
1243
|
* The editor's store
|
|
1195
1244
|
*
|
|
@@ -1922,6 +1971,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1922
1971
|
/**
|
|
1923
1972
|
* Generates a reading order for shapes based on rows grouping.
|
|
1924
1973
|
* Tries to keep a natural reading order (left-to-right, top-to-bottom).
|
|
1974
|
+
* Shapes whose util returns `false` from {@link ShapeUtil.canTabTo} are left out. Locked
|
|
1975
|
+
* shapes are included, so keyboard users can reach them to unlock them.
|
|
1925
1976
|
*
|
|
1926
1977
|
* @public
|
|
1927
1978
|
*/
|
|
@@ -4564,6 +4615,8 @@ export declare class EditorAtom<T> {
|
|
|
4564
4615
|
/** @public */
|
|
4565
4616
|
export declare const EditorContext: React_3.Context<Editor | null>;
|
|
4566
4617
|
|
|
4618
|
+
/* Excluded from this release type: EditorI18nFallbackContext */
|
|
4619
|
+
|
|
4567
4620
|
/**
|
|
4568
4621
|
* Base class for editor-attached managers that need to clean up after themselves.
|
|
4569
4622
|
*
|
|
@@ -4734,6 +4787,10 @@ export declare class FontManager {
|
|
|
4734
4787
|
loadRequiredFontsForCurrentPage(limit?: number): Promise<void>;
|
|
4735
4788
|
private readonly fontStates;
|
|
4736
4789
|
private getFontState;
|
|
4790
|
+
private readonly fontLoadEpoch;
|
|
4791
|
+
/* Excluded from this release type: getFontLoadEpoch */
|
|
4792
|
+
private isFontLoadEpochBumpPending;
|
|
4793
|
+
private setFontState;
|
|
4737
4794
|
ensureFontIsLoaded(font: TLFontFace): Promise<void>;
|
|
4738
4795
|
private fontsToLoad;
|
|
4739
4796
|
requestFonts(fonts: TLFontFace[]): void;
|
|
@@ -4883,6 +4940,8 @@ export declare function getColorValue(colors: TLThemeColors, color: string | TLD
|
|
|
4883
4940
|
/** @public */
|
|
4884
4941
|
export declare function getCursor(cursor: TLCursorType, rotation?: number, color?: string): string;
|
|
4885
4942
|
|
|
4943
|
+
/* Excluded from this release type: getDeclaredMessages */
|
|
4944
|
+
|
|
4886
4945
|
/**
|
|
4887
4946
|
* Gets the default CDN base URL.
|
|
4888
4947
|
* @returns The default CDN base URL.
|
|
@@ -5061,6 +5120,7 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
|
5061
5120
|
static props: RecordProps<TLGroupShape>;
|
|
5062
5121
|
static migrations: TLPropsMigrations;
|
|
5063
5122
|
hideSelectionBoundsFg(shape: TLGroupShape): boolean;
|
|
5123
|
+
canFlip(): boolean;
|
|
5064
5124
|
canBind(): boolean;
|
|
5065
5125
|
canResize(): boolean;
|
|
5066
5126
|
canResizeChildren(): boolean;
|
|
@@ -6568,6 +6628,21 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6568
6628
|
* @public
|
|
6569
6629
|
*/
|
|
6570
6630
|
createShapeForAsset?(asset: TLAsset, position: VecModel): null | TLShapePartial;
|
|
6631
|
+
/**
|
|
6632
|
+
* The shape's name, translated, as a screen reader should announce it.
|
|
6633
|
+
*
|
|
6634
|
+
* Return `undefined` — the default — and the shape is announced by its tool's label, under the
|
|
6635
|
+
* `tool.<type>` convention. Override this when the name isn't that: a geo shape is a "Rectangle"
|
|
6636
|
+
* or an "Ellipse" rather than a "Shape", so it names itself from its geo style.
|
|
6637
|
+
*
|
|
6638
|
+
* Resolve the name through {@link translateMessage} and the editor's `i18n` rather than
|
|
6639
|
+
* returning English, so it follows the user's locale and still reads as words when an app
|
|
6640
|
+
* supplies no translations.
|
|
6641
|
+
*
|
|
6642
|
+
* @param shape - The shape.
|
|
6643
|
+
* @public
|
|
6644
|
+
*/
|
|
6645
|
+
getShapeName(_shape: Shape): string | undefined;
|
|
6571
6646
|
/**
|
|
6572
6647
|
* Get the shape's geometry.
|
|
6573
6648
|
*
|
|
@@ -6678,6 +6753,15 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6678
6753
|
* @public
|
|
6679
6754
|
*/
|
|
6680
6755
|
canCrop(shape: Shape): boolean;
|
|
6756
|
+
/**
|
|
6757
|
+
* Whether flipping changes the shape itself, by mirroring it or toggling its stored flip. The
|
|
6758
|
+
* default UI only offers flip for a lone selected shape when this is true; {@link Editor.flipShapes}
|
|
6759
|
+
* doesn't check it, so shapes that return false still move when flipped as part of a larger
|
|
6760
|
+
* selection. Use {@link ShapeUtil.canBeLaidOut} to opt out of that.
|
|
6761
|
+
*
|
|
6762
|
+
* @public
|
|
6763
|
+
*/
|
|
6764
|
+
canFlip(shape: Shape): boolean;
|
|
6681
6765
|
/**
|
|
6682
6766
|
* Whether the shape can participate in layout functions such as alignment or distribution.
|
|
6683
6767
|
*
|
|
@@ -8132,6 +8216,10 @@ export declare interface TldrawEditorBaseProps {
|
|
|
8132
8216
|
[key: string]: string | undefined;
|
|
8133
8217
|
};
|
|
8134
8218
|
};
|
|
8219
|
+
/**
|
|
8220
|
+
* An i18n adapter for translating strings.
|
|
8221
|
+
*/
|
|
8222
|
+
i18n?: TLI18nAdapter;
|
|
8135
8223
|
}
|
|
8136
8224
|
|
|
8137
8225
|
/** @public */
|
|
@@ -8496,6 +8584,10 @@ export declare interface TLEditorOptions {
|
|
|
8496
8584
|
* given, the body element will be used.
|
|
8497
8585
|
*/
|
|
8498
8586
|
getContainer(): HTMLElement;
|
|
8587
|
+
/**
|
|
8588
|
+
* An i18n adapter for translating strings.
|
|
8589
|
+
*/
|
|
8590
|
+
i18n?: TLI18nAdapter;
|
|
8499
8591
|
/**
|
|
8500
8592
|
* Provides a way to hide shapes.
|
|
8501
8593
|
*
|
|
@@ -8903,6 +8995,65 @@ export declare interface TLHistoryMark {
|
|
|
8903
8995
|
id: string;
|
|
8904
8996
|
}
|
|
8905
8997
|
|
|
8998
|
+
/**
|
|
8999
|
+
* The editor's view of the host app's translations. Lets code with no access to React context —
|
|
9000
|
+
* a {@link ShapeUtil}, say — translate a string in the user's locale.
|
|
9001
|
+
*
|
|
9002
|
+
* @public
|
|
9003
|
+
*/
|
|
9004
|
+
export declare interface TLI18n {
|
|
9005
|
+
locale: string;
|
|
9006
|
+
dir: 'ltr' | 'rtl';
|
|
9007
|
+
/**
|
|
9008
|
+
* Translate `message` in the current locale, substituting `values` into its ICU placeholders.
|
|
9009
|
+
*
|
|
9010
|
+
* Takes the whole message rather than its id so an implementation can fall back to the English
|
|
9011
|
+
* and still substitute into it. A message absent from the catalog — anything not yet through
|
|
9012
|
+
* Lokalise — would otherwise have to come back as its own source text, placeholders and all.
|
|
9013
|
+
*/
|
|
9014
|
+
translate(message: TLI18nMessage, values?: TLI18nValues): string;
|
|
9015
|
+
}
|
|
9016
|
+
|
|
9017
|
+
/**
|
|
9018
|
+
* Supplies a {@link TLI18n}. Called on each use rather than held as a value, so the editor reads
|
|
9019
|
+
* the current locale instead of pinning whichever one was active when it was constructed.
|
|
9020
|
+
*
|
|
9021
|
+
* @public
|
|
9022
|
+
*/
|
|
9023
|
+
export declare type TLI18nAdapter = () => TLI18n;
|
|
9024
|
+
|
|
9025
|
+
/**
|
|
9026
|
+
* One translatable message: a stable `id` naming it in the catalog, and the English it falls back
|
|
9027
|
+
* to. `defaultMessage` is required, because this package's strings have to read correctly with no
|
|
9028
|
+
* translations loaded at all — `@tldraw/editor` can be used without any of tldraw's UI.
|
|
9029
|
+
*
|
|
9030
|
+
* @public
|
|
9031
|
+
*/
|
|
9032
|
+
export declare interface TLI18nMessage {
|
|
9033
|
+
id: string;
|
|
9034
|
+
defaultMessage: string;
|
|
9035
|
+
description?: string;
|
|
9036
|
+
}
|
|
9037
|
+
|
|
9038
|
+
/**
|
|
9039
|
+
* A message as it's written. The id is optional because a bundler plugin may supply it:
|
|
9040
|
+
* `@formatjs/unplugin` with an `idInterpolationPattern` derives one from the message's own text,
|
|
9041
|
+
* which is how tldraw.com does it. Everywhere downstream takes a {@link TLI18nMessage}, whose id
|
|
9042
|
+
* is required, because {@link defineMessages} fills one in.
|
|
9043
|
+
*
|
|
9044
|
+
* @public
|
|
9045
|
+
*/
|
|
9046
|
+
export declare type TLI18nMessageInput = Omit<TLI18nMessage, 'id'> & {
|
|
9047
|
+
id?: string;
|
|
9048
|
+
};
|
|
9049
|
+
|
|
9050
|
+
/**
|
|
9051
|
+
* Values substituted into a message's ICU placeholders.
|
|
9052
|
+
*
|
|
9053
|
+
* @public
|
|
9054
|
+
*/
|
|
9055
|
+
export declare type TLI18nValues = Record<string, bigint | boolean | Date | null | number | string | undefined>;
|
|
9056
|
+
|
|
8906
9057
|
/** @public */
|
|
8907
9058
|
export declare interface TLImageExportOptions extends TLSvgExportOptions {
|
|
8908
9059
|
/**
|
|
@@ -9894,6 +10045,20 @@ export declare interface TransformedGeometry2dOptions {
|
|
|
9894
10045
|
excludeFromShapeBounds?: boolean;
|
|
9895
10046
|
}
|
|
9896
10047
|
|
|
10048
|
+
/**
|
|
10049
|
+
* Translates `message` through an editor's i18n, falling back to its English.
|
|
10050
|
+
*
|
|
10051
|
+
* Takes the editor's i18n rather than reading a context, so it works in the places this package
|
|
10052
|
+
* has to keep working: a `ShapeUtil` with no hooks available, or an error fallback rendered
|
|
10053
|
+
* outside the editor it's reporting on.
|
|
10054
|
+
*
|
|
10055
|
+
* With no i18n at all the English is returned unformatted, for the reason given on
|
|
10056
|
+
* {@link defaultI18n}. Every other case goes through the adapter, which does substitute.
|
|
10057
|
+
*
|
|
10058
|
+
* @public
|
|
10059
|
+
*/
|
|
10060
|
+
export declare function translateMessage(i18n: null | TLI18n | undefined, message: TLI18nMessage, values?: TLI18nValues): string;
|
|
10061
|
+
|
|
9897
10062
|
/** @public */
|
|
9898
10063
|
export declare type UiEvent = TLCancelEvent | TLClickEvent | TLCompleteEvent | TLKeyboardEvent | TLPinchEvent | TLPointerEvent;
|
|
9899
10064
|
|
package/dist-cjs/index.js
CHANGED
|
@@ -51,6 +51,7 @@ __export(index_exports, {
|
|
|
51
51
|
Editor: () => import_Editor.Editor,
|
|
52
52
|
EditorAtom: () => import_EditorAtom.EditorAtom,
|
|
53
53
|
EditorContext: () => import_useEditor.EditorContext,
|
|
54
|
+
EditorI18nFallbackContext: () => import_TldrawEditor.EditorI18nFallbackContext,
|
|
54
55
|
EditorManager: () => import_EditorManager.EditorManager,
|
|
55
56
|
EditorPortal: () => import_EditorPortal.EditorPortal,
|
|
56
57
|
EditorProvider: () => import_useEditor.EditorProvider,
|
|
@@ -128,9 +129,11 @@ __export(index_exports, {
|
|
|
128
129
|
createTLStore: () => import_createTLStore.createTLStore,
|
|
129
130
|
dataUrlToFile: () => import_assets.dataUrlToFile,
|
|
130
131
|
debugFlags: () => import_debug_flags.debugFlags,
|
|
132
|
+
defaultI18n: () => import_TLI18n.defaultI18n,
|
|
131
133
|
defaultTldrawOptions: () => import_options.defaultTldrawOptions,
|
|
132
134
|
defaultUserPreferences: () => import_TLUserPreferences.defaultUserPreferences,
|
|
133
135
|
defaultUserStore: () => import_createTLStore.defaultUserStore,
|
|
136
|
+
defineMessages: () => import_TLI18n.defineMessages,
|
|
134
137
|
degreesToRadians: () => import_utils2.degreesToRadians,
|
|
135
138
|
elementShouldCaptureKeys: () => import_dom.elementShouldCaptureKeys,
|
|
136
139
|
extractSessionStateFromLegacySnapshot: () => import_TLSessionStateSnapshot.extractSessionStateFromLegacySnapshot,
|
|
@@ -138,6 +141,7 @@ __export(index_exports, {
|
|
|
138
141
|
getArcMeasure: () => import_utils2.getArcMeasure,
|
|
139
142
|
getColorValue: () => import_defaultThemes2.getColorValue,
|
|
140
143
|
getCursor: () => import_useCursor.getCursor,
|
|
144
|
+
getDeclaredMessages: () => import_TLI18n.getDeclaredMessages,
|
|
141
145
|
getDefaultCdnBaseUrl: () => import_assets.getDefaultCdnBaseUrl,
|
|
142
146
|
getDroppedShapesToNewParents: () => import_reparenting.getDroppedShapesToNewParents,
|
|
143
147
|
getFontsFromRichText: () => import_richText.getFontsFromRichText,
|
|
@@ -218,6 +222,7 @@ __export(index_exports, {
|
|
|
218
222
|
toDomPrecision: () => import_utils2.toDomPrecision,
|
|
219
223
|
toFixed: () => import_utils2.toFixed,
|
|
220
224
|
toPrecision: () => import_utils2.toPrecision,
|
|
225
|
+
translateMessage: () => import_TLI18n.translateMessage,
|
|
221
226
|
uniq: () => import_uniq.uniq,
|
|
222
227
|
useColorMode: () => import_useColorMode.useColorMode,
|
|
223
228
|
useContainer: () => import_useContainer.useContainer,
|
|
@@ -278,6 +283,7 @@ var import_createTLCurrentUser = require("./lib/config/createTLCurrentUser");
|
|
|
278
283
|
var import_createTLStore = require("./lib/config/createTLStore");
|
|
279
284
|
var import_defaultShapes = require("./lib/config/defaultShapes");
|
|
280
285
|
var import_TLEditorSnapshot = require("./lib/config/TLEditorSnapshot");
|
|
286
|
+
var import_TLI18n = require("./lib/config/TLI18n");
|
|
281
287
|
var import_TLSessionStateSnapshot = require("./lib/config/TLSessionStateSnapshot");
|
|
282
288
|
var import_TLUserPreferences = require("./lib/config/TLUserPreferences");
|
|
283
289
|
var import_constants = require("./lib/constants");
|
|
@@ -392,7 +398,7 @@ var import_uniq = require("./lib/utils/uniq");
|
|
|
392
398
|
var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
|
|
393
399
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
394
400
|
"@tldraw/editor",
|
|
395
|
-
"5.6.0-canary.
|
|
401
|
+
"5.6.0-canary.f283055556fc",
|
|
396
402
|
"cjs"
|
|
397
403
|
);
|
|
398
404
|
//# sourceMappingURL=index.js.map
|
package/dist-cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\n\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n\ttype TLErrorFallbackProps,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport {\n\tDefaultSpinner,\n\ttype TLSpinnerProps,\n} from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tEditorPortal,\n\tuseEditorPortalHost,\n\ttype EditorPortalProps,\n} from './lib/components/EditorPortal'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLCurrentUser,\n\tuseTldrawCurrentUser,\n\ttype TLCurrentUser,\n} from './lib/config/createTLCurrentUser'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tdefaultUserStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { type TLAnyAssetUtilConstructor } from './lib/config/defaultAssets'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport { AssetUtil, type TLAssetUtilConstructor } from './lib/editor/assets/AssetUtil'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport { FontManager } from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { EditorManager } from './lib/editor/managers/EditorManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n\ttype ScribbleSessionOptions,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\tresolveLineHeightPx,\n\ttype BatchMeasurementRequest,\n\ttype TLMeasuredTextSize,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { DEFAULT_THEME } from './lib/editor/managers/ThemeManager/defaultThemes'\nexport { ThemeManager, resolveThemes } from './lib/editor/managers/ThemeManager/ThemeManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { CollaboratorsManager } from './lib/editor/managers/CollaboratorsManager/CollaboratorsManager'\nexport { PerformanceApiAdapter } from './lib/editor/managers/PerformanceManager/PerformanceApiAdapter'\nexport { PerformanceManager } from './lib/editor/managers/PerformanceManager/PerformanceManager'\nexport {\n\ttype TLCameraEndPerfEvent,\n\ttype TLCameraStartPerfEvent,\n\ttype TLFramePerfEvent,\n\ttype TLInteractionEndPerfEvent,\n\ttype TLInteractionStartPerfEvent,\n\ttype TLPerfEventMap,\n\ttype TLPerfFrameTimeStats,\n\ttype TLPerfLongAnimationFrame,\n\ttype TLPerfLongAnimationFrameScript,\n\ttype TLShapeOperationPerfEvent,\n\ttype TLUndoRedoPerfEvent,\n} from './lib/editor/managers/PerformanceManager/perf-types'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { BaseFrameLikeShapeUtil } from './lib/editor/shapes/BaseFrameLikeShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLIndicatorPath,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetOverlayDisplayValues,\n\ttype OverlayOptionsWithDisplayValues,\n} from './lib/editor/overlays/getOverlayDisplayValues'\nexport { OverlayManager, type TLOverlayEntry } from './lib/editor/overlays/OverlayManager'\nexport {\n\tOverlayUtil,\n\ttype TLAnyOverlayUtilConstructor,\n\ttype TLOverlay,\n\ttype TLOverlayUtilConstructor,\n} from './lib/editor/overlays/OverlayUtil'\nexport { strokeShapeIndicators } from './lib/editor/overlays/strokeShapeIndicators'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getOwnerDocument, getOwnerWindow } from './lib/exports/domUtils'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } from './lib/globals/environment'\nexport { tleditors } from './lib/globals/editors'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { useColorMode } from './lib/hooks/useColorMode'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { isCursorInViewport } from './lib/utils/collaborators'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\n// oxlint-disable-next-line typescript/no-deprecated\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFeatureName,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport {\n\tLICENSE_TIMEOUT,\n\tuseLicenseContext,\n\tuseMaybeLicenseManager,\n} from './lib/license/LicenseProvider'\nexport { useLicenseFeatureFlag } from './lib/license/useLicenseManagerState'\nexport {\n\tdefaultTldrawOptions,\n\ttype TLClipboardPasteRawInfo,\n\ttype TLClipboardWriteInfo,\n\ttype TldrawOptions,\n} from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\telementShouldCaptureKeys,\n\tgetGlobalDocument,\n\tgetGlobalWindow,\n\tloopToHtmlElement,\n\tmoveElementInto,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport {\n\thardResetEditor,\n\topenWindow,\n\trefreshPage,\n\truntime,\n\tsetRuntimeOverrides,\n} from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { getColorValue } from './lib/editor/managers/ThemeManager/defaultThemes'\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAA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AAC1B,uBAMO;AACP,iCAAoC;AAEpC,sBAA2C;AAC3C,iCAAoC;AACpC,yBAAkE;AAClE,2BAA8B;AAC9B,0BAA6B;AAC7B,2BAA8B;AAC9B,uCAA0C;AAC1C,wBAA2B;AAC3B,yBAA4B;AAC5B,yBAA4B;AAC5B,uBAMO;AACP,0BAA6B;AAC7B,2BAAmC;AACnC,wBAAiD;AAEjD,+BAAkC;AAClC,4BASO;AACP,6BAIO;AACP,oCAAsC;AACtC,qBAKO;AACP,iBASO;AACP,qBAAwB;AACxB,mBAAsB;AACtB,sBAAyB;AACzB,2BAA8B;AAC9B,2BAA8B;AAC9B,oBAAuB;AACvB,uBAA0B;AAC1B,gCAA6C;AAC7C,wBAMO;AACP,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,wBAA2B;AAC3B,yBAA4B;AAC5B,uBAA0B;AAC1B,uBAaO;AACP,iBAAiD;AACjD,IAAAA,gBAgCO;AACP,iBAAkC;AAClC,
|
|
4
|
+
"sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\n\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n\ttype TLErrorFallbackProps,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport {\n\tDefaultSpinner,\n\ttype TLSpinnerProps,\n} from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tEditorPortal,\n\tuseEditorPortalHost,\n\ttype EditorPortalProps,\n} from './lib/components/EditorPortal'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLCurrentUser,\n\tuseTldrawCurrentUser,\n\ttype TLCurrentUser,\n} from './lib/config/createTLCurrentUser'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tdefaultUserStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { type TLAnyAssetUtilConstructor } from './lib/config/defaultAssets'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tdefaultI18n,\n\tdefineMessages,\n\tgetDeclaredMessages,\n\ttranslateMessage,\n\ttype TLI18n,\n\ttype TLI18nAdapter,\n\ttype TLI18nMessage,\n\ttype TLI18nMessageInput,\n\ttype TLI18nValues,\n} from './lib/config/TLI18n'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport { AssetUtil, type TLAssetUtilConstructor } from './lib/editor/assets/AssetUtil'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport { FontManager } from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { EditorManager } from './lib/editor/managers/EditorManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n\ttype ScribbleSessionOptions,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\tresolveLineHeightPx,\n\ttype BatchMeasurementRequest,\n\ttype TLMeasuredTextSize,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { DEFAULT_THEME } from './lib/editor/managers/ThemeManager/defaultThemes'\nexport { ThemeManager, resolveThemes } from './lib/editor/managers/ThemeManager/ThemeManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { CollaboratorsManager } from './lib/editor/managers/CollaboratorsManager/CollaboratorsManager'\nexport { PerformanceApiAdapter } from './lib/editor/managers/PerformanceManager/PerformanceApiAdapter'\nexport { PerformanceManager } from './lib/editor/managers/PerformanceManager/PerformanceManager'\nexport {\n\ttype TLCameraEndPerfEvent,\n\ttype TLCameraStartPerfEvent,\n\ttype TLFramePerfEvent,\n\ttype TLInteractionEndPerfEvent,\n\ttype TLInteractionStartPerfEvent,\n\ttype TLPerfEventMap,\n\ttype TLPerfFrameTimeStats,\n\ttype TLPerfLongAnimationFrame,\n\ttype TLPerfLongAnimationFrameScript,\n\ttype TLShapeOperationPerfEvent,\n\ttype TLUndoRedoPerfEvent,\n} from './lib/editor/managers/PerformanceManager/perf-types'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { BaseFrameLikeShapeUtil } from './lib/editor/shapes/BaseFrameLikeShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLIndicatorPath,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetOverlayDisplayValues,\n\ttype OverlayOptionsWithDisplayValues,\n} from './lib/editor/overlays/getOverlayDisplayValues'\nexport { OverlayManager, type TLOverlayEntry } from './lib/editor/overlays/OverlayManager'\nexport {\n\tOverlayUtil,\n\ttype TLAnyOverlayUtilConstructor,\n\ttype TLOverlay,\n\ttype TLOverlayUtilConstructor,\n} from './lib/editor/overlays/OverlayUtil'\nexport { strokeShapeIndicators } from './lib/editor/overlays/strokeShapeIndicators'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getOwnerDocument, getOwnerWindow } from './lib/exports/domUtils'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } from './lib/globals/environment'\nexport { tleditors } from './lib/globals/editors'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { useColorMode } from './lib/hooks/useColorMode'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { isCursorInViewport } from './lib/utils/collaborators'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\n// oxlint-disable-next-line typescript/no-deprecated\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFeatureName,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport {\n\tLICENSE_TIMEOUT,\n\tuseLicenseContext,\n\tuseMaybeLicenseManager,\n} from './lib/license/LicenseProvider'\nexport { useLicenseFeatureFlag } from './lib/license/useLicenseManagerState'\nexport {\n\tdefaultTldrawOptions,\n\ttype TLClipboardPasteRawInfo,\n\ttype TLClipboardWriteInfo,\n\ttype TldrawOptions,\n} from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tEditorI18nFallbackContext,\n\tErrorScreen,\n\tLoadingScreen,\n\ttype LoadingScreenProps,\n\tTldrawEditor,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n\tuseOnMount,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\telementShouldCaptureKeys,\n\tgetGlobalDocument,\n\tgetGlobalWindow,\n\tloopToHtmlElement,\n\tmoveElementInto,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport {\n\thardResetEditor,\n\topenWindow,\n\trefreshPage,\n\truntime,\n\tsetRuntimeOverrides,\n} from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { getColorValue } from './lib/editor/managers/ThemeManager/defaultThemes'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AAQrB,IAAAC,wBAA8B;AAAA,IAN9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": ["import_utils", "import_defaultThemes"]
|
|
7
7
|
}
|
|
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var TldrawEditor_exports = {};
|
|
30
30
|
__export(TldrawEditor_exports, {
|
|
31
|
+
EditorI18nFallbackContext: () => EditorI18nFallbackContext,
|
|
31
32
|
ErrorScreen: () => ErrorScreen,
|
|
32
33
|
LoadingScreen: () => LoadingScreen,
|
|
33
34
|
TL_CONTAINER_CLASS: () => TL_CONTAINER_CLASS,
|
|
@@ -46,6 +47,7 @@ var import_DefaultErrorFallback = require("./components/default-components/Defau
|
|
|
46
47
|
var import_EditorPortal = require("./components/EditorPortal");
|
|
47
48
|
var import_ErrorBoundary = require("./components/ErrorBoundary");
|
|
48
49
|
var import_createTLCurrentUser = require("./config/createTLCurrentUser");
|
|
50
|
+
var import_TLI18n = require("./config/TLI18n");
|
|
49
51
|
var import_Editor = require("./editor/Editor");
|
|
50
52
|
var import_ThemeManager = require("./editor/managers/ThemeManager/ThemeManager");
|
|
51
53
|
var import_EditorComponentsContext = require("./hooks/EditorComponentsContext");
|
|
@@ -210,6 +212,7 @@ const TldrawEditorWithLoadingStore = (0, import_react.memo)(function TldrawEdito
|
|
|
210
212
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithReadyStore, { ...rest, store: store.store, user });
|
|
211
213
|
});
|
|
212
214
|
const noAutoFocus = () => (0, import_dom.getGlobalDocument)().location.search.includes("tldraw_preserve_focus");
|
|
215
|
+
const EditorI18nFallbackContext = import_react.default.createContext(null);
|
|
213
216
|
function TldrawEditorWithReadyStore({
|
|
214
217
|
onMount,
|
|
215
218
|
children,
|
|
@@ -230,7 +233,8 @@ function TldrawEditorWithReadyStore({
|
|
|
230
233
|
colorScheme,
|
|
231
234
|
assetUrls,
|
|
232
235
|
themes,
|
|
233
|
-
initialTheme
|
|
236
|
+
initialTheme,
|
|
237
|
+
i18n
|
|
234
238
|
}) {
|
|
235
239
|
const { ErrorFallback } = (0, import_EditorComponentsContext.useEditorComponents)();
|
|
236
240
|
const container = (0, import_useContainer.useContainer)();
|
|
@@ -261,6 +265,13 @@ function TldrawEditorWithReadyStore({
|
|
|
261
265
|
initialTheme
|
|
262
266
|
};
|
|
263
267
|
}, [autoFocus, initialState, colorScheme, cameraOptions, deepLinks, themes, initialTheme]);
|
|
268
|
+
const i18nRef = (0, import_react.useRef)(i18n);
|
|
269
|
+
i18nRef.current = i18n;
|
|
270
|
+
const fallbackI18nRef = (0, import_react.useRef)(null);
|
|
271
|
+
const stableI18n = (0, import_react.useCallback)(
|
|
272
|
+
() => (i18nRef.current ?? fallbackI18nRef.current ?? import_TLI18n.defaultI18n)(),
|
|
273
|
+
[]
|
|
274
|
+
);
|
|
264
275
|
(0, import_react.useLayoutEffect)(
|
|
265
276
|
() => {
|
|
266
277
|
const {
|
|
@@ -291,7 +302,8 @@ function TldrawEditorWithReadyStore({
|
|
|
291
302
|
colorScheme: initColorScheme,
|
|
292
303
|
fontAssetUrls: assetUrls?.fonts,
|
|
293
304
|
themes: themes2,
|
|
294
|
-
initialTheme: initialTheme2
|
|
305
|
+
initialTheme: initialTheme2,
|
|
306
|
+
i18n: stableI18n
|
|
295
307
|
});
|
|
296
308
|
editor2.licenseManager = licenseManager;
|
|
297
309
|
editor2.updateViewportScreenBounds(canvasRef.current ?? container);
|
|
@@ -323,7 +335,8 @@ function TldrawEditorWithReadyStore({
|
|
|
323
335
|
licenseKey,
|
|
324
336
|
licenseManager,
|
|
325
337
|
getShapeVisibility,
|
|
326
|
-
assetUrls
|
|
338
|
+
assetUrls,
|
|
339
|
+
stableI18n
|
|
327
340
|
]
|
|
328
341
|
);
|
|
329
342
|
(0, import_react.useLayoutEffect)(() => {
|
|
@@ -427,10 +440,10 @@ function TldrawEditorWithReadyStore({
|
|
|
427
440
|
{
|
|
428
441
|
fallback: ErrorFallback,
|
|
429
442
|
onError: (error) => editor.annotateError(error, { origin: "react.tldraw", willCrashApp: true }),
|
|
430
|
-
children: crashingError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Crash, { crashingError }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useEditor.EditorProvider, { editor, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Layout, { onMount, children: [
|
|
443
|
+
children: crashingError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Crash, { crashingError }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useEditor.EditorProvider, { editor, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditorI18nFallbackContext.Provider, { value: fallbackI18nRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Layout, { onMount, children: [
|
|
431
444
|
children ?? (Canvas ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Canvas, {}, editor.contextId) : null),
|
|
432
445
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Watermark.Watermark, {})
|
|
433
|
-
] }) })
|
|
446
|
+
] }) }) })
|
|
434
447
|
}
|
|
435
448
|
)
|
|
436
449
|
);
|