@tldraw/tlschema
Advanced tools
Comparing version 3.8.0-canary.dd058c1cfe16 to 3.8.0-canary.dfac53c137bb
@@ -367,3 +367,3 @@ import { BaseRecord } from '@tldraw/store'; | ||
/** @public */ | ||
export declare const ImageShapeCrop: T.ObjectValidator<TLImageShapeCrop>; | ||
export declare const ImageShapeCrop: T.ObjectValidator<TLShapeCrop>; | ||
@@ -517,3 +517,3 @@ /** @public */ | ||
readonly label: "ગુજરાતી"; | ||
readonly locale: "gu"; | ||
readonly locale: "gu-in"; | ||
}, { | ||
@@ -536,3 +536,3 @@ readonly label: "தமிழ்"; | ||
readonly label: "ភាសាខ្មែរ"; | ||
readonly locale: "km"; | ||
readonly locale: "km-kh"; | ||
}, { | ||
@@ -618,2 +618,9 @@ readonly label: "한국어"; | ||
/** @public */ | ||
export declare type ShapeWithCrop = TLBaseShape<string, { | ||
crop: null | TLShapeCrop; | ||
h: number; | ||
w: number; | ||
}>; | ||
/** | ||
@@ -782,6 +789,26 @@ * A `StyleProp` is a property of a shape that follows some special rules. | ||
export declare interface TLAssetContext { | ||
/** | ||
* The scale at which the asset is being rendered on-screen relative to its native dimensions. | ||
* If the asset is 1000px wide, but it's been resized/zoom so it takes 500px on-screen, this | ||
* will be 0.5. | ||
* | ||
* The scale measures CSS pixels, not device pixels. | ||
*/ | ||
screenScale: number; | ||
/** The {@link TLAssetContext.screenScale}, stepped to the nearest power-of-2 multiple. */ | ||
steppedScreenScale: number; | ||
/** The device pixel ratio - how many CSS pixels are in one device pixel? */ | ||
dpr: number; | ||
/** | ||
* An alias for | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/effectiveType | `navigator.connection.effectiveType` } | ||
* if it's available in the current browser. Use this to e.g. serve lower-resolution images to | ||
* users on slow connections. | ||
*/ | ||
networkEffectiveType: null | string; | ||
/** | ||
* In some circumstances, we need to resolve a URL that points to the original version of a | ||
* particular asset. This is used when the asset will leave the current tldraw instance - e.g. | ||
* for copy/paste, or exports. | ||
*/ | ||
shouldResolveToOriginal: boolean; | ||
@@ -830,3 +857,6 @@ } | ||
*/ | ||
upload(asset: TLAsset, file: File, abortSignal?: AbortSignal): Promise<string>; | ||
upload(asset: TLAsset, file: File, abortSignal?: AbortSignal): Promise<{ | ||
meta?: JsonObject; | ||
src: string; | ||
}>; | ||
/** | ||
@@ -1173,8 +1203,2 @@ * Resolve an asset to a URL. This is used when rendering the asset in the editor. By default, | ||
/** @public */ | ||
export declare interface TLImageShapeCrop { | ||
topLeft: VecModel; | ||
bottomRight: VecModel; | ||
} | ||
/** @public */ | ||
export declare interface TLImageShapeProps { | ||
@@ -1186,3 +1210,3 @@ w: number; | ||
assetId: null | TLAssetId; | ||
crop: null | TLImageShapeCrop; | ||
crop: null | TLShapeCrop; | ||
flipX: boolean; | ||
@@ -1466,2 +1490,8 @@ flipY: boolean; | ||
/** @public */ | ||
export declare interface TLShapeCrop { | ||
topLeft: VecModel; | ||
bottomRight: VecModel; | ||
} | ||
/** @public */ | ||
export declare type TLShapeId = RecordId<TLUnknownShape>; | ||
@@ -1468,0 +1498,0 @@ |
@@ -19,4 +19,4 @@ "use strict"; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
var index_exports = {}; | ||
__export(index_exports, { | ||
ArrowShapeArrowheadEndStyle: () => import_TLArrowShape.ArrowShapeArrowheadEndStyle, | ||
@@ -123,3 +123,3 @@ ArrowShapeArrowheadStartStyle: () => import_TLArrowShape.ArrowShapeArrowheadStartStyle, | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
module.exports = __toCommonJS(index_exports); | ||
var import_utils = require("@tldraw/utils"); | ||
@@ -174,5 +174,5 @@ var import_TLBaseAsset = require("./assets/TLBaseAsset"); | ||
"@tldraw/tlschema", | ||
"3.8.0-canary.dd058c1cfe16", | ||
"3.8.0-canary.dfac53c137bb", | ||
"cjs" | ||
); | ||
//# sourceMappingURL=index.js.map |
@@ -63,3 +63,3 @@ "use strict"; | ||
{ locale: "pa", label: "\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40" }, | ||
{ locale: "gu", label: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0" }, | ||
{ locale: "gu-in", label: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0" }, | ||
{ locale: "ta", label: "\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD" }, | ||
@@ -70,3 +70,3 @@ { locale: "te", label: "\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41" }, | ||
{ locale: "th", label: "\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22" }, | ||
{ locale: "km", label: "\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A" }, | ||
{ locale: "km-kh", label: "\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A" }, | ||
{ locale: "ko-kr", label: "\uD55C\uAD6D\uC5B4" }, | ||
@@ -73,0 +73,0 @@ { locale: "ja", label: "\u65E5\u672C\u8A9E" }, |
{ | ||
"name": "@tldraw/tlschema", | ||
"description": "A tiny little drawing app (schema).", | ||
"version": "3.8.0-canary.dd058c1cfe16", | ||
"version": "3.8.0-canary.dfac53c137bb", | ||
"author": { | ||
@@ -56,9 +56,10 @@ "name": "tldraw Inc.", | ||
"dependencies": { | ||
"@tldraw/state": "3.8.0-canary.dd058c1cfe16", | ||
"@tldraw/store": "3.8.0-canary.dd058c1cfe16", | ||
"@tldraw/utils": "3.8.0-canary.dd058c1cfe16", | ||
"@tldraw/validate": "3.8.0-canary.dd058c1cfe16" | ||
"@tldraw/state": "3.8.0-canary.dfac53c137bb", | ||
"@tldraw/store": "3.8.0-canary.dfac53c137bb", | ||
"@tldraw/utils": "3.8.0-canary.dfac53c137bb", | ||
"@tldraw/validate": "3.8.0-canary.dfac53c137bb" | ||
}, | ||
"peerDependencies": { | ||
"react": "^18.2.0" | ||
"react": "^18.2.0 || ^19.0.0", | ||
"react-dom": "^18.2.0 || ^19.0.0" | ||
}, | ||
@@ -65,0 +66,0 @@ "module": "dist-esm/index.mjs", |
@@ -136,2 +136,3 @@ import { registerTldrawLibraryVersion } from '@tldraw/utils' | ||
} from './recordsWithProps' | ||
export { type ShapeWithCrop, type TLShapeCrop } from './shapes/ShapeWithCrop' | ||
export { | ||
@@ -202,3 +203,2 @@ ArrowShapeArrowheadEndStyle, | ||
type TLImageShape, | ||
type TLImageShapeCrop, | ||
type TLImageShapeProps, | ||
@@ -205,0 +205,0 @@ } from './shapes/TLImageShape' |
import { T } from '@tldraw/validate' | ||
import { assetIdValidator } from '../assets/TLBaseAsset' | ||
import { VecModel, vecModelValidator } from '../misc/geometry-types' | ||
import { vecModelValidator } from '../misc/geometry-types' | ||
import { TLAssetId } from '../records/TLAsset' | ||
import { createShapePropsMigrationIds, createShapePropsMigrationSequence } from '../records/TLShape' | ||
import { RecordProps } from '../recordsWithProps' | ||
import { TLShapeCrop } from './ShapeWithCrop' | ||
import { TLBaseShape } from './TLBaseShape' | ||
/** @public */ | ||
export interface TLImageShapeCrop { | ||
topLeft: VecModel | ||
bottomRight: VecModel | ||
} | ||
/** @public */ | ||
export const ImageShapeCrop: T.ObjectValidator<TLImageShapeCrop> = T.object({ | ||
export const ImageShapeCrop: T.ObjectValidator<TLShapeCrop> = T.object({ | ||
topLeft: vecModelValidator, | ||
@@ -28,3 +23,3 @@ bottomRight: vecModelValidator, | ||
assetId: TLAssetId | null | ||
crop: TLImageShapeCrop | null | ||
crop: TLShapeCrop | null | ||
flipX: boolean | ||
@@ -31,0 +26,0 @@ flipY: boolean |
@@ -9,3 +9,3 @@ import { Signal } from '@tldraw/state' | ||
} from '@tldraw/store' | ||
import { IndexKey, annotateError, structuredClone } from '@tldraw/utils' | ||
import { IndexKey, JsonObject, annotateError, structuredClone } from '@tldraw/utils' | ||
import { TLAsset } from './records/TLAsset' | ||
@@ -52,6 +52,26 @@ import { CameraRecordType, TLCameraId } from './records/TLCamera' | ||
export interface TLAssetContext { | ||
/** | ||
* The scale at which the asset is being rendered on-screen relative to its native dimensions. | ||
* If the asset is 1000px wide, but it's been resized/zoom so it takes 500px on-screen, this | ||
* will be 0.5. | ||
* | ||
* The scale measures CSS pixels, not device pixels. | ||
*/ | ||
screenScale: number | ||
/** The {@link TLAssetContext.screenScale}, stepped to the nearest power-of-2 multiple. */ | ||
steppedScreenScale: number | ||
/** The device pixel ratio - how many CSS pixels are in one device pixel? */ | ||
dpr: number | ||
/** | ||
* An alias for | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/effectiveType | `navigator.connection.effectiveType` } | ||
* if it's available in the current browser. Use this to e.g. serve lower-resolution images to | ||
* users on slow connections. | ||
*/ | ||
networkEffectiveType: string | null | ||
/** | ||
* In some circumstances, we need to resolve a URL that points to the original version of a | ||
* particular asset. This is used when the asset will leave the current tldraw instance - e.g. | ||
* for copy/paste, or exports. | ||
*/ | ||
shouldResolveToOriginal: boolean | ||
@@ -82,3 +102,7 @@ } | ||
*/ | ||
upload(asset: TLAsset, file: File, abortSignal?: AbortSignal): Promise<string> | ||
upload( | ||
asset: TLAsset, | ||
file: File, | ||
abortSignal?: AbortSignal | ||
): Promise<{ src: string; meta?: JsonObject }> | ||
/** | ||
@@ -85,0 +109,0 @@ * Resolve an asset to a URL. This is used when rendering the asset in the editor. By default, |
@@ -44,3 +44,3 @@ // This file is automatically generated by internal/scripts/refresh-assets.ts. | ||
{ locale: 'pa', label: 'ਪੰਜਾਬੀ' }, | ||
{ locale: 'gu', label: 'ગુજરાતી' }, | ||
{ locale: 'gu-in', label: 'ગુજરાતી' }, | ||
{ locale: 'ta', label: 'தமிழ்' }, | ||
@@ -51,3 +51,3 @@ { locale: 'te', label: 'తెలుగు' }, | ||
{ locale: 'th', label: 'ภาษาไทย' }, | ||
{ locale: 'km', label: 'ភាសាខ្មែរ' }, | ||
{ locale: 'km-kh', label: 'ភាសាខ្មែរ' }, | ||
{ locale: 'ko-kr', label: '한국어' }, | ||
@@ -54,0 +54,0 @@ { locale: 'ja', label: '日本語' }, |
@@ -15,3 +15,3 @@ import { LANGUAGES } from './languages' | ||
export function getDefaultTranslationLocale(): TLLanguage['locale'] { | ||
const locales = typeof window !== 'undefined' ? window.navigator.languages ?? ['en'] : ['en'] | ||
const locales = typeof window !== 'undefined' ? (window.navigator.languages ?? ['en']) : ['en'] | ||
return _getDefaultTranslationLocale(locales) | ||
@@ -18,0 +18,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1122382
294
18169
6
+ Added@tldraw/state@3.8.0-canary.dfac53c137bb(transitive)
+ Added@tldraw/store@3.8.0-canary.dfac53c137bb(transitive)
+ Added@tldraw/utils@3.8.0-canary.dfac53c137bb(transitive)
+ Added@tldraw/validate@3.8.0-canary.dfac53c137bb(transitive)
+ Addedreact@19.0.0(transitive)
+ Addedreact-dom@19.0.0(transitive)
+ Addedscheduler@0.25.0(transitive)
- Removed@tldraw/state@3.8.0-canary.dd058c1cfe16(transitive)
- Removed@tldraw/store@3.8.0-canary.dd058c1cfe16(transitive)
- Removed@tldraw/utils@3.8.0-canary.dd058c1cfe16(transitive)
- Removed@tldraw/validate@3.8.0-canary.dd058c1cfe16(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedreact@18.3.1(transitive)