@tldraw/editor 3.13.0-canary.8e04030e54fe → 3.13.0-canary.8f8ae1660cdb
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 +74 -96
- package/dist-cjs/index.js +7 -22
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +3 -5
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/shared/getPerfectDashProps.js.map +2 -2
- package/dist-cjs/lib/primitives/Box.js +16 -0
- package/dist-cjs/lib/primitives/Box.js.map +2 -2
- package/dist-cjs/lib/primitives/Mat.js +1 -1
- package/dist-cjs/lib/primitives/Mat.js.map +2 -2
- package/dist-cjs/lib/primitives/Vec.js +20 -0
- package/dist-cjs/lib/primitives/Vec.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Arc2d.js +2 -2
- package/dist-cjs/lib/primitives/geometry/Arc2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Circle2d.js +1 -1
- package/dist-cjs/lib/primitives/geometry/Circle2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/CubicBezier2d.js +1 -1
- package/dist-cjs/lib/primitives/geometry/CubicBezier2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/CubicSpline2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Edge2d.js +1 -1
- package/dist-cjs/lib/primitives/geometry/Edge2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js +91 -20
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Group2d.js +55 -2
- package/dist-cjs/lib/primitives/geometry/Group2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Point2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Polyline2d.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Stadium2d.js.map +2 -2
- package/dist-cjs/lib/utils/debug-flags.js +5 -2
- package/dist-cjs/lib/utils/debug-flags.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +74 -96
- package/dist-esm/index.mjs +9 -41
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +3 -5
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/shared/getPerfectDashProps.mjs.map +2 -2
- package/dist-esm/lib/primitives/Box.mjs +16 -0
- package/dist-esm/lib/primitives/Box.mjs.map +2 -2
- package/dist-esm/lib/primitives/Mat.mjs +1 -1
- package/dist-esm/lib/primitives/Mat.mjs.map +2 -2
- package/dist-esm/lib/primitives/Vec.mjs +20 -0
- package/dist-esm/lib/primitives/Vec.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Arc2d.mjs +2 -2
- package/dist-esm/lib/primitives/geometry/Arc2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Circle2d.mjs +1 -1
- package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/CubicBezier2d.mjs +1 -1
- package/dist-esm/lib/primitives/geometry/CubicBezier2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/CubicSpline2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Edge2d.mjs +1 -1
- package/dist-esm/lib/primitives/geometry/Edge2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +92 -21
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Group2d.mjs +55 -2
- package/dist-esm/lib/primitives/geometry/Group2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Point2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Polyline2d.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Stadium2d.mjs.map +2 -2
- package/dist-esm/lib/utils/debug-flags.mjs +5 -2
- package/dist-esm/lib/utils/debug-flags.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +29 -0
- package/package.json +7 -7
- package/src/index.ts +16 -31
- package/src/lib/editor/Editor.test.ts +1 -1
- package/src/lib/editor/Editor.ts +3 -5
- package/src/lib/editor/managers/SnapManager/HandleSnaps.ts +0 -1
- package/src/lib/editor/shapes/shared/getPerfectDashProps.ts +9 -9
- package/src/lib/primitives/Box.ts +20 -0
- package/src/lib/primitives/Mat.ts +5 -4
- package/src/lib/primitives/Vec.ts +23 -0
- package/src/lib/primitives/geometry/Arc2d.ts +5 -5
- package/src/lib/primitives/geometry/Circle2d.ts +4 -4
- package/src/lib/primitives/geometry/CubicBezier2d.ts +4 -4
- package/src/lib/primitives/geometry/CubicSpline2d.ts +3 -3
- package/src/lib/primitives/geometry/Edge2d.ts +3 -3
- package/src/lib/primitives/geometry/Ellipse2d.ts +3 -3
- package/src/lib/primitives/geometry/Geometry2d.test.ts +42 -0
- package/src/lib/primitives/geometry/Geometry2d.ts +123 -35
- package/src/lib/primitives/geometry/Group2d.ts +70 -7
- package/src/lib/primitives/geometry/Point2d.ts +2 -2
- package/src/lib/primitives/geometry/Polyline2d.ts +3 -3
- package/src/lib/primitives/geometry/Stadium2d.ts +3 -3
- package/src/lib/test/currentToolIdMask.test.ts +1 -1
- package/src/lib/test/user.test.ts +1 -1
- package/src/lib/utils/debug-flags.ts +7 -2
- package/src/lib/utils/sync/LocalIndexedDb.test.ts +1 -1
- package/src/lib/utils/sync/TLLocalSyncClient.test.ts +1 -1
- package/src/version.ts +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/primitives/geometry/Stadium2d.ts"],
|
|
4
|
-
"sourcesContent": ["import { Box } from '../Box'\nimport { Vec } from '../Vec'\nimport { PI } from '../utils'\nimport { Arc2d } from './Arc2d'\nimport { Edge2d } from './Edge2d'\nimport { Geometry2d, Geometry2dOptions } from './Geometry2d'\n\n/** @public */\nexport class Stadium2d extends Geometry2d {\n\tw: number\n\th: number\n\n\ta: Arc2d\n\tb: Edge2d\n\tc: Arc2d\n\td: Edge2d\n\n\tconstructor(\n\t\tpublic config: Omit<Geometry2dOptions, 'isClosed'> & {\n\t\t\twidth: number\n\t\t\theight: number\n\t\t}\n\t) {\n\t\tsuper({ ...config, isClosed: true })\n\t\tconst { width: w, height: h } = config\n\t\tthis.w = w\n\t\tthis.h = h\n\n\t\tif (h > w) {\n\t\t\tconst r = w / 2\n\t\t\tthis.a = new Arc2d({\n\t\t\t\tstart: new Vec(0, r),\n\t\t\t\tend: new Vec(w, r),\n\t\t\t\tcenter: new Vec(w / 2, r),\n\t\t\t\tsweepFlag: 1,\n\t\t\t\tlargeArcFlag: 1,\n\t\t\t})\n\t\t\tthis.b = new Edge2d({ start: new Vec(w, r), end: new Vec(w, h - r) })\n\t\t\tthis.c = new Arc2d({\n\t\t\t\tstart: new Vec(w, h - r),\n\t\t\t\tend: new Vec(0, h - r),\n\t\t\t\tcenter: new Vec(w / 2, h - r),\n\t\t\t\tsweepFlag: 1,\n\t\t\t\tlargeArcFlag: 1,\n\t\t\t})\n\t\t\tthis.d = new Edge2d({ start: new Vec(0, h - r), end: new Vec(0, r) })\n\t\t} else {\n\t\t\tconst r = h / 2\n\t\t\tthis.a = new Arc2d({\n\t\t\t\tstart: new Vec(r, h),\n\t\t\t\tend: new Vec(r, 0),\n\t\t\t\tcenter: new Vec(r, r),\n\t\t\t\tsweepFlag: 1,\n\t\t\t\tlargeArcFlag: 1,\n\t\t\t})\n\t\t\tthis.b = new Edge2d({ start: new Vec(r, 0), end: new Vec(w - r, 0) })\n\t\t\tthis.c = new Arc2d({\n\t\t\t\tstart: new Vec(w - r, 0),\n\t\t\t\tend: new Vec(w - r, h),\n\t\t\t\tcenter: new Vec(w - r, r),\n\t\t\t\tsweepFlag: 1,\n\t\t\t\tlargeArcFlag: 1,\n\t\t\t})\n\t\t\tthis.d = new Edge2d({ start: new Vec(w - r, h), end: new Vec(r, h) })\n\t\t}\n\t}\n\n\tnearestPoint(A:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoB;AACpB,
|
|
4
|
+
"sourcesContent": ["import { Box } from '../Box'\nimport { Vec, VecLike } from '../Vec'\nimport { PI } from '../utils'\nimport { Arc2d } from './Arc2d'\nimport { Edge2d } from './Edge2d'\nimport { Geometry2d, Geometry2dOptions } from './Geometry2d'\n\n/** @public */\nexport class Stadium2d extends Geometry2d {\n\tw: number\n\th: number\n\n\ta: Arc2d\n\tb: Edge2d\n\tc: Arc2d\n\td: Edge2d\n\n\tconstructor(\n\t\tpublic config: Omit<Geometry2dOptions, 'isClosed'> & {\n\t\t\twidth: number\n\t\t\theight: number\n\t\t}\n\t) {\n\t\tsuper({ ...config, isClosed: true })\n\t\tconst { width: w, height: h } = config\n\t\tthis.w = w\n\t\tthis.h = h\n\n\t\tif (h > w) {\n\t\t\tconst r = w / 2\n\t\t\tthis.a = new Arc2d({\n\t\t\t\tstart: new Vec(0, r),\n\t\t\t\tend: new Vec(w, r),\n\t\t\t\tcenter: new Vec(w / 2, r),\n\t\t\t\tsweepFlag: 1,\n\t\t\t\tlargeArcFlag: 1,\n\t\t\t})\n\t\t\tthis.b = new Edge2d({ start: new Vec(w, r), end: new Vec(w, h - r) })\n\t\t\tthis.c = new Arc2d({\n\t\t\t\tstart: new Vec(w, h - r),\n\t\t\t\tend: new Vec(0, h - r),\n\t\t\t\tcenter: new Vec(w / 2, h - r),\n\t\t\t\tsweepFlag: 1,\n\t\t\t\tlargeArcFlag: 1,\n\t\t\t})\n\t\t\tthis.d = new Edge2d({ start: new Vec(0, h - r), end: new Vec(0, r) })\n\t\t} else {\n\t\t\tconst r = h / 2\n\t\t\tthis.a = new Arc2d({\n\t\t\t\tstart: new Vec(r, h),\n\t\t\t\tend: new Vec(r, 0),\n\t\t\t\tcenter: new Vec(r, r),\n\t\t\t\tsweepFlag: 1,\n\t\t\t\tlargeArcFlag: 1,\n\t\t\t})\n\t\t\tthis.b = new Edge2d({ start: new Vec(r, 0), end: new Vec(w - r, 0) })\n\t\t\tthis.c = new Arc2d({\n\t\t\t\tstart: new Vec(w - r, 0),\n\t\t\t\tend: new Vec(w - r, h),\n\t\t\t\tcenter: new Vec(w - r, r),\n\t\t\t\tsweepFlag: 1,\n\t\t\t\tlargeArcFlag: 1,\n\t\t\t})\n\t\t\tthis.d = new Edge2d({ start: new Vec(w - r, h), end: new Vec(r, h) })\n\t\t}\n\t}\n\n\tnearestPoint(A: VecLike): Vec {\n\t\tlet nearest: Vec | undefined\n\t\tlet dist = Infinity\n\t\tlet _d: number\n\t\tlet p: Vec\n\n\t\tconst { a, b, c, d } = this\n\t\tfor (const part of [a, b, c, d]) {\n\t\t\tp = part.nearestPoint(A)\n\t\t\t_d = Vec.Dist2(p, A)\n\t\t\tif (_d < dist) {\n\t\t\t\tnearest = p\n\t\t\t\tdist = _d\n\t\t\t}\n\t\t}\n\t\tif (!nearest) throw Error('nearest point not found')\n\t\treturn nearest\n\t}\n\n\thitTestLineSegment(A: VecLike, B: VecLike): boolean {\n\t\tconst { a, b, c, d } = this\n\t\treturn [a, b, c, d].some((edge) => edge.hitTestLineSegment(A, B))\n\t}\n\n\tgetVertices() {\n\t\tconst { a, b, c, d } = this\n\t\treturn [a, b, c, d].reduce<Vec[]>((a, p) => {\n\t\t\ta.push(...p.vertices)\n\t\t\treturn a\n\t\t}, [])\n\t}\n\n\tgetBounds() {\n\t\treturn new Box(0, 0, this.w, this.h)\n\t}\n\n\tgetLength() {\n\t\tconst { h, w } = this\n\t\tif (h > w) return (PI * (w / 2) + (h - w)) * 2\n\t\telse return (PI * (h / 2) + (w - h)) * 2\n\t}\n\n\tgetSvgPathData() {\n\t\tconst { a, b, c, d } = this\n\t\treturn [a, b, c, d].map((p, i) => p.getSvgPathData(i === 0)).join(' ') + ' Z'\n\t}\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["a"]
|
|
7
7
|
}
|
|
@@ -66,7 +66,8 @@ const debugFlags = {
|
|
|
66
66
|
debugGeometry: createDebugValue("debugGeometry", { defaults: { all: false } }),
|
|
67
67
|
hideShapes: createDebugValue("hideShapes", { defaults: { all: false } }),
|
|
68
68
|
editOnType: createDebugValue("editOnType", { defaults: { all: false } }),
|
|
69
|
-
a11y: createDebugValue("a11y", { defaults: { all: false } })
|
|
69
|
+
a11y: createDebugValue("a11y", { defaults: { all: false } }),
|
|
70
|
+
debugElbowArrows: createDebugValue("debugElbowArrows", { defaults: { all: false } })
|
|
70
71
|
};
|
|
71
72
|
if (typeof Element !== "undefined") {
|
|
72
73
|
const nativeElementRemoveChild = Element.prototype.removeChild;
|
|
@@ -116,7 +117,9 @@ function createDebugValueBase(def) {
|
|
|
116
117
|
configurable: true
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
|
-
return Object.assign(valueAtom, def
|
|
120
|
+
return Object.assign(valueAtom, def, {
|
|
121
|
+
reset: () => valueAtom.set(defaultValue)
|
|
122
|
+
});
|
|
120
123
|
}
|
|
121
124
|
function getStoredInitialValue(name) {
|
|
122
125
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/utils/debug-flags.ts"],
|
|
4
|
-
"sourcesContent": ["import { Atom, atom, react } from '@tldraw/state'\nimport { deleteFromSessionStorage, getFromSessionStorage, setInSessionStorage } from '@tldraw/utils'\n\n// --- 1. DEFINE ---\n//\n// Define your debug values and feature flags here. Use `createDebugValue` to\n// create an arbitrary value with defaults for production, staging, and\n// development. Use `createFeatureFlag` to create a boolean flag which will be\n// `true` by default in development and staging, and `false` in production.\n/** @internal */\nexport const featureFlags: Record<string, DebugFlag<boolean>> = {}\n\n/** @internal */\nexport const pointerCaptureTrackingObject = createDebugValue(\n\t'pointerCaptureTrackingObject',\n\t// ideally we wouldn't store this mutable value in an atom but it's not\n\t// a big deal for debug values\n\t{\n\t\tdefaults: { all: new Map<Element, number>() },\n\t\tshouldStoreForSession: false,\n\t}\n)\n\n/** @internal */\nexport const debugFlags = {\n\t// --- DEBUG VALUES ---\n\tlogPreventDefaults: createDebugValue('logPreventDefaults', {\n\t\tdefaults: { all: false },\n\t}),\n\tlogPointerCaptures: createDebugValue('logPointerCaptures', {\n\t\tdefaults: { all: false },\n\t}),\n\tlogElementRemoves: createDebugValue('logElementRemoves', {\n\t\tdefaults: { all: false },\n\t}),\n\tdebugSvg: createDebugValue('debugSvg', {\n\t\tdefaults: { all: false },\n\t}),\n\tshowFps: createDebugValue('showFps', {\n\t\tdefaults: { all: false },\n\t}),\n\tmeasurePerformance: createDebugValue('measurePerformance', { defaults: { all: false } }),\n\tthrowToBlob: createDebugValue('throwToBlob', {\n\t\tdefaults: { all: false },\n\t}),\n\treconnectOnPing: createDebugValue('reconnectOnPing', {\n\t\tdefaults: { all: false },\n\t}),\n\tdebugCursors: createDebugValue('debugCursors', {\n\t\tdefaults: { all: false },\n\t}),\n\tforceSrgb: createDebugValue('forceSrgbColors', { defaults: { all: false } }),\n\tdebugGeometry: createDebugValue('debugGeometry', { defaults: { all: false } }),\n\thideShapes: createDebugValue('hideShapes', { defaults: { all: false } }),\n\teditOnType: createDebugValue('editOnType', { defaults: { all: false } }),\n\ta11y: createDebugValue('a11y', { defaults: { all: false } }),\n} as const\n\ndeclare global {\n\tinterface Window {\n\t\ttldrawLog(message: any): void\n\t}\n}\n\n// --- 2. USE ---\n// In normal code, read from debug flags directly by calling .value on them:\n// if (debugFlags.preventDefaultLogging.value) { ... }\n//\n// In react, wrap your reads in `useValue` (or your component in `track`)\n// so they react to changes:\n// const shouldLog = useValue(debugFlags.preventDefaultLogging)\n\n// --- 3. GET FUNKY ---\n// If you need to do fun stuff like monkey-patching in response to flag changes,\n// add that here. Make sure you wrap your code in `react` so it runs\n// automatically when values change!\n\nif (typeof Element !== 'undefined') {\n\tconst nativeElementRemoveChild = Element.prototype.removeChild\n\treact('element removal logging', () => {\n\t\tif (debugFlags.logElementRemoves.get()) {\n\t\t\tElement.prototype.removeChild = function <T extends Node>(this: any, child: Node): T {\n\t\t\t\tconsole.warn('[tldraw] removing child:', child)\n\t\t\t\treturn nativeElementRemoveChild.call(this, child) as T\n\t\t\t}\n\t\t} else {\n\t\t\tElement.prototype.removeChild = nativeElementRemoveChild\n\t\t}\n\t})\n}\n\n// --- IMPLEMENTATION ---\n// you probably don't need to read this if you're just using the debug values system\nfunction createDebugValue<T>(\n\tname: string,\n\t{\n\t\tdefaults,\n\t\tshouldStoreForSession = true,\n\t}: { defaults: DebugFlagDefaults<T>; shouldStoreForSession?: boolean }\n) {\n\treturn createDebugValueBase({\n\t\tname,\n\t\tdefaults,\n\t\tshouldStoreForSession,\n\t})\n}\n\n// function createFeatureFlag<T>(\n// \tname: string,\n// \t{\n// \t\tdefaults,\n// \t\tshouldStoreForSession = true,\n// \t}: { defaults: DebugFlagDefaults<T>; shouldStoreForSession?: boolean }\n// ) {\n// \treturn createDebugValueBase({\n// \t\tname,\n// \t\tdefaults,\n// \t\tshouldStoreForSession,\n// \t})\n// }\n\nfunction createDebugValueBase<T>(def: DebugFlagDef<T>): DebugFlag<T> {\n\tconst defaultValue = getDefaultValue(def)\n\tconst storedValue = def.shouldStoreForSession\n\t\t? (getStoredInitialValue(def.name) as T | null)\n\t\t: null\n\tconst valueAtom = atom(`debug:${def.name}`, storedValue ?? defaultValue)\n\n\tif (typeof window !== 'undefined') {\n\t\tif (def.shouldStoreForSession) {\n\t\t\treact(`debug:${def.name}`, () => {\n\t\t\t\tconst currentValue = valueAtom.get()\n\t\t\t\tif (currentValue === defaultValue) {\n\t\t\t\t\tdeleteFromSessionStorage(`tldraw_debug:${def.name}`)\n\t\t\t\t} else {\n\t\t\t\t\tsetInSessionStorage(`tldraw_debug:${def.name}`, JSON.stringify(currentValue))\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tObject.defineProperty(window, `tldraw${def.name.replace(/^[a-z]/, (l) => l.toUpperCase())}`, {\n\t\t\tget() {\n\t\t\t\treturn valueAtom.get()\n\t\t\t},\n\t\t\tset(newValue) {\n\t\t\t\tvalueAtom.set(newValue)\n\t\t\t},\n\t\t\tconfigurable: true,\n\t\t})\n\t}\n\n\treturn Object.assign(valueAtom, def)\n}\n\nfunction getStoredInitialValue(name: string) {\n\ttry {\n\t\treturn JSON.parse(getFromSessionStorage(`tldraw_debug:${name}`) ?? 'null')\n\t} catch {\n\t\treturn null\n\t}\n}\n\n// process.env might not be defined, but we can't access it using optional\n// chaining because some bundlers search for `process.env.SOMETHING` as a string\n// and replace it with its value.\nfunction readEnv(fn: () => string | undefined) {\n\ttry {\n\t\treturn fn()\n\t} catch {\n\t\treturn null\n\t}\n}\n\nfunction getDefaultValue<T>(def: DebugFlagDef<T>): T {\n\tconst env =\n\t\treadEnv(() => process.env.TLDRAW_ENV) ??\n\t\treadEnv(() => process.env.VERCEL_PUBLIC_TLDRAW_ENV) ??\n\t\treadEnv(() => process.env.NEXT_PUBLIC_TLDRAW_ENV) ??\n\t\t// default to production because if we don't have one of these, this is probably a library use\n\t\t'production'\n\n\tswitch (env) {\n\t\tcase 'production':\n\t\t\treturn def.defaults.production ?? def.defaults.all\n\t\tcase 'preview':\n\t\tcase 'staging':\n\t\t\treturn def.defaults.staging ?? def.defaults.all\n\t\tdefault:\n\t\t\treturn def.defaults.development ?? def.defaults.all\n\t}\n}\n\n/** @internal */\nexport interface DebugFlagDefaults<T> {\n\tdevelopment?: T\n\tstaging?: T\n\tproduction?: T\n\tall: T\n}\n\n/** @internal */\nexport interface DebugFlagDef<T> {\n\tname: string\n\tdefaults: DebugFlagDefaults<T>\n\tshouldStoreForSession: boolean\n}\n\n/** @internal */\nexport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAClC,mBAAqF;AAS9E,MAAM,eAAmD,CAAC;AAG1D,MAAM,+BAA+B;AAAA,EAC3C;AAAA;AAAA;AAAA,EAGA;AAAA,IACC,UAAU,EAAE,KAAK,oBAAI,IAAqB,EAAE;AAAA,IAC5C,uBAAuB;AAAA,EACxB;AACD;AAGO,MAAM,aAAa;AAAA;AAAA,EAEzB,oBAAoB,iBAAiB,sBAAsB;AAAA,IAC1D,UAAU,EAAE,KAAK,MAAM;AAAA,EACxB,CAAC;AAAA,EACD,oBAAoB,iBAAiB,sBAAsB;AAAA,IAC1D,UAAU,EAAE,KAAK,MAAM;AAAA,EACxB,CAAC;AAAA,EACD,mBAAmB,iBAAiB,qBAAqB;AAAA,IACxD,UAAU,EAAE,KAAK,MAAM;AAAA,EACxB,CAAC;AAAA,EACD,UAAU,iBAAiB,YAAY;AAAA,IACtC,UAAU,EAAE,KAAK,MAAM;AAAA,EACxB,CAAC;AAAA,EACD,SAAS,iBAAiB,WAAW;AAAA,IACpC,UAAU,EAAE,KAAK,MAAM;AAAA,EACxB,CAAC;AAAA,EACD,oBAAoB,iBAAiB,sBAAsB,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;AAAA,EACvF,aAAa,iBAAiB,eAAe;AAAA,IAC5C,UAAU,EAAE,KAAK,MAAM;AAAA,EACxB,CAAC;AAAA,EACD,iBAAiB,iBAAiB,mBAAmB;AAAA,IACpD,UAAU,EAAE,KAAK,MAAM;AAAA,EACxB,CAAC;AAAA,EACD,cAAc,iBAAiB,gBAAgB;AAAA,IAC9C,UAAU,EAAE,KAAK,MAAM;AAAA,EACxB,CAAC;AAAA,EACD,WAAW,iBAAiB,mBAAmB,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;AAAA,EAC3E,eAAe,iBAAiB,iBAAiB,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;AAAA,EAC7E,YAAY,iBAAiB,cAAc,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;AAAA,EACvE,YAAY,iBAAiB,cAAc,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;AAAA,EACvE,MAAM,iBAAiB,QAAQ,EAAE,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;
|
|
4
|
+
"sourcesContent": ["import { Atom, atom, react } from '@tldraw/state'\nimport { deleteFromSessionStorage, getFromSessionStorage, setInSessionStorage } from '@tldraw/utils'\n\n// --- 1. DEFINE ---\n//\n// Define your debug values and feature flags here. Use `createDebugValue` to\n// create an arbitrary value with defaults for production, staging, and\n// development. Use `createFeatureFlag` to create a boolean flag which will be\n// `true` by default in development and staging, and `false` in production.\n/** @internal */\nexport const featureFlags: Record<string, DebugFlag<boolean>> = {}\n\n/** @internal */\nexport const pointerCaptureTrackingObject = createDebugValue(\n\t'pointerCaptureTrackingObject',\n\t// ideally we wouldn't store this mutable value in an atom but it's not\n\t// a big deal for debug values\n\t{\n\t\tdefaults: { all: new Map<Element, number>() },\n\t\tshouldStoreForSession: false,\n\t}\n)\n\n/** @internal */\nexport const debugFlags = {\n\t// --- DEBUG VALUES ---\n\tlogPreventDefaults: createDebugValue('logPreventDefaults', {\n\t\tdefaults: { all: false },\n\t}),\n\tlogPointerCaptures: createDebugValue('logPointerCaptures', {\n\t\tdefaults: { all: false },\n\t}),\n\tlogElementRemoves: createDebugValue('logElementRemoves', {\n\t\tdefaults: { all: false },\n\t}),\n\tdebugSvg: createDebugValue('debugSvg', {\n\t\tdefaults: { all: false },\n\t}),\n\tshowFps: createDebugValue('showFps', {\n\t\tdefaults: { all: false },\n\t}),\n\tmeasurePerformance: createDebugValue('measurePerformance', { defaults: { all: false } }),\n\tthrowToBlob: createDebugValue('throwToBlob', {\n\t\tdefaults: { all: false },\n\t}),\n\treconnectOnPing: createDebugValue('reconnectOnPing', {\n\t\tdefaults: { all: false },\n\t}),\n\tdebugCursors: createDebugValue('debugCursors', {\n\t\tdefaults: { all: false },\n\t}),\n\tforceSrgb: createDebugValue('forceSrgbColors', { defaults: { all: false } }),\n\tdebugGeometry: createDebugValue('debugGeometry', { defaults: { all: false } }),\n\thideShapes: createDebugValue('hideShapes', { defaults: { all: false } }),\n\teditOnType: createDebugValue('editOnType', { defaults: { all: false } }),\n\ta11y: createDebugValue('a11y', { defaults: { all: false } }),\n\tdebugElbowArrows: createDebugValue('debugElbowArrows', { defaults: { all: false } }),\n} as const\n\ndeclare global {\n\tinterface Window {\n\t\ttldrawLog(message: any): void\n\t}\n}\n\n// --- 2. USE ---\n// In normal code, read from debug flags directly by calling .value on them:\n// if (debugFlags.preventDefaultLogging.value) { ... }\n//\n// In react, wrap your reads in `useValue` (or your component in `track`)\n// so they react to changes:\n// const shouldLog = useValue(debugFlags.preventDefaultLogging)\n\n// --- 3. GET FUNKY ---\n// If you need to do fun stuff like monkey-patching in response to flag changes,\n// add that here. Make sure you wrap your code in `react` so it runs\n// automatically when values change!\n\nif (typeof Element !== 'undefined') {\n\tconst nativeElementRemoveChild = Element.prototype.removeChild\n\treact('element removal logging', () => {\n\t\tif (debugFlags.logElementRemoves.get()) {\n\t\t\tElement.prototype.removeChild = function <T extends Node>(this: any, child: Node): T {\n\t\t\t\tconsole.warn('[tldraw] removing child:', child)\n\t\t\t\treturn nativeElementRemoveChild.call(this, child) as T\n\t\t\t}\n\t\t} else {\n\t\t\tElement.prototype.removeChild = nativeElementRemoveChild\n\t\t}\n\t})\n}\n\n// --- IMPLEMENTATION ---\n// you probably don't need to read this if you're just using the debug values system\nfunction createDebugValue<T>(\n\tname: string,\n\t{\n\t\tdefaults,\n\t\tshouldStoreForSession = true,\n\t}: { defaults: DebugFlagDefaults<T>; shouldStoreForSession?: boolean }\n) {\n\treturn createDebugValueBase({\n\t\tname,\n\t\tdefaults,\n\t\tshouldStoreForSession,\n\t})\n}\n\n// function createFeatureFlag<T>(\n// \tname: string,\n// \t{\n// \t\tdefaults,\n// \t\tshouldStoreForSession = true,\n// \t}: { defaults: DebugFlagDefaults<T>; shouldStoreForSession?: boolean }\n// ) {\n// \treturn createDebugValueBase({\n// \t\tname,\n// \t\tdefaults,\n// \t\tshouldStoreForSession,\n// \t})\n// }\n\nfunction createDebugValueBase<T>(def: DebugFlagDef<T>): DebugFlag<T> {\n\tconst defaultValue = getDefaultValue(def)\n\tconst storedValue = def.shouldStoreForSession\n\t\t? (getStoredInitialValue(def.name) as T | null)\n\t\t: null\n\tconst valueAtom = atom(`debug:${def.name}`, storedValue ?? defaultValue)\n\n\tif (typeof window !== 'undefined') {\n\t\tif (def.shouldStoreForSession) {\n\t\t\treact(`debug:${def.name}`, () => {\n\t\t\t\tconst currentValue = valueAtom.get()\n\t\t\t\tif (currentValue === defaultValue) {\n\t\t\t\t\tdeleteFromSessionStorage(`tldraw_debug:${def.name}`)\n\t\t\t\t} else {\n\t\t\t\t\tsetInSessionStorage(`tldraw_debug:${def.name}`, JSON.stringify(currentValue))\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tObject.defineProperty(window, `tldraw${def.name.replace(/^[a-z]/, (l) => l.toUpperCase())}`, {\n\t\t\tget() {\n\t\t\t\treturn valueAtom.get()\n\t\t\t},\n\t\t\tset(newValue) {\n\t\t\t\tvalueAtom.set(newValue)\n\t\t\t},\n\t\t\tconfigurable: true,\n\t\t})\n\t}\n\n\treturn Object.assign(valueAtom, def, {\n\t\treset: () => valueAtom.set(defaultValue),\n\t})\n}\n\nfunction getStoredInitialValue(name: string) {\n\ttry {\n\t\treturn JSON.parse(getFromSessionStorage(`tldraw_debug:${name}`) ?? 'null')\n\t} catch {\n\t\treturn null\n\t}\n}\n\n// process.env might not be defined, but we can't access it using optional\n// chaining because some bundlers search for `process.env.SOMETHING` as a string\n// and replace it with its value.\nfunction readEnv(fn: () => string | undefined) {\n\ttry {\n\t\treturn fn()\n\t} catch {\n\t\treturn null\n\t}\n}\n\nfunction getDefaultValue<T>(def: DebugFlagDef<T>): T {\n\tconst env =\n\t\treadEnv(() => process.env.TLDRAW_ENV) ??\n\t\treadEnv(() => process.env.VERCEL_PUBLIC_TLDRAW_ENV) ??\n\t\treadEnv(() => process.env.NEXT_PUBLIC_TLDRAW_ENV) ??\n\t\t// default to production because if we don't have one of these, this is probably a library use\n\t\t'production'\n\n\tswitch (env) {\n\t\tcase 'production':\n\t\t\treturn def.defaults.production ?? def.defaults.all\n\t\tcase 'preview':\n\t\tcase 'staging':\n\t\t\treturn def.defaults.staging ?? def.defaults.all\n\t\tdefault:\n\t\t\treturn def.defaults.development ?? def.defaults.all\n\t}\n}\n\n/** @internal */\nexport interface DebugFlagDefaults<T> {\n\tdevelopment?: T\n\tstaging?: T\n\tproduction?: T\n\tall: T\n}\n\n/** @internal */\nexport interface DebugFlagDef<T> {\n\tname: string\n\tdefaults: DebugFlagDefaults<T>\n\tshouldStoreForSession: boolean\n}\n\n/** @internal */\nexport interface DebugFlag<T> extends DebugFlagDef<T>, Atom<T> {\n\treset(): void\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist-cjs/version.js
CHANGED
|
@@ -22,10 +22,10 @@ __export(version_exports, {
|
|
|
22
22
|
version: () => version
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(version_exports);
|
|
25
|
-
const version = "3.13.0-canary.
|
|
25
|
+
const version = "3.13.0-canary.8f8ae1660cdb";
|
|
26
26
|
const publishDates = {
|
|
27
27
|
major: "2024-09-13T14:36:29.063Z",
|
|
28
|
-
minor: "2025-05-
|
|
29
|
-
patch: "2025-05-
|
|
28
|
+
minor: "2025-05-08T11:53:57.810Z",
|
|
29
|
+
patch: "2025-05-08T11:53:57.810Z"
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=version.js.map
|
package/dist-cjs/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/version.ts"],
|
|
4
|
-
"sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.13.0-canary.
|
|
4
|
+
"sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.13.0-canary.8f8ae1660cdb'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-05-08T11:53:57.810Z',\n\tpatch: '2025-05-08T11:53:57.810Z',\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist-esm/index.d.mts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
|
|
3
3
|
import { Atom } from '@tldraw/state';
|
|
4
|
-
import { atom } from '@tldraw/state';
|
|
5
4
|
import { BoxModel } from '@tldraw/tlschema';
|
|
6
5
|
import { ComponentType } from 'react';
|
|
7
6
|
import { Computed } from '@tldraw/state';
|
|
8
|
-
import { computed } from '@tldraw/state';
|
|
9
7
|
import { Dispatch } from 'react';
|
|
10
8
|
import { Editor as Editor_2 } from '@tiptap/core';
|
|
11
9
|
import { EditorProviderProps } from '@tiptap/react';
|
|
12
|
-
import { EffectScheduler } from '@tldraw/state';
|
|
13
|
-
import { EMPTY_ARRAY } from '@tldraw/state';
|
|
14
10
|
import EventEmitter from 'eventemitter3';
|
|
15
11
|
import { ExoticComponent } from 'react';
|
|
16
12
|
import { HistoryEntry } from '@tldraw/store';
|
|
@@ -23,7 +19,6 @@ import { NamedExoticComponent } from 'react';
|
|
|
23
19
|
import { Node as Node_2 } from '@tiptap/pm/model';
|
|
24
20
|
import { PerformanceTracker } from '@tldraw/utils';
|
|
25
21
|
import { PointerEventHandler } from 'react';
|
|
26
|
-
import { react } from '@tldraw/state';
|
|
27
22
|
import { default as React_2 } from 'react';
|
|
28
23
|
import * as React_3 from 'react';
|
|
29
24
|
import { ReactElement } from 'react';
|
|
@@ -82,18 +77,8 @@ import { TLStoreSnapshot } from '@tldraw/tlschema';
|
|
|
82
77
|
import { TLUnknownBinding } from '@tldraw/tlschema';
|
|
83
78
|
import { TLUnknownShape } from '@tldraw/tlschema';
|
|
84
79
|
import { TLVideoAsset } from '@tldraw/tlschema';
|
|
85
|
-
import { track } from '@tldraw/state-react';
|
|
86
|
-
import { transact } from '@tldraw/state';
|
|
87
|
-
import { transaction } from '@tldraw/state';
|
|
88
80
|
import { UnknownRecord } from '@tldraw/store';
|
|
89
|
-
import { useAtom } from '@tldraw/state-react';
|
|
90
|
-
import { useComputed } from '@tldraw/state-react';
|
|
91
|
-
import { useQuickReactor } from '@tldraw/state-react';
|
|
92
|
-
import { useReactor } from '@tldraw/state-react';
|
|
93
|
-
import { useStateTracking } from '@tldraw/state-react';
|
|
94
|
-
import { useValue } from '@tldraw/state-react';
|
|
95
81
|
import { VecModel } from '@tldraw/tlschema';
|
|
96
|
-
import { whyAmIRunning } from '@tldraw/state';
|
|
97
82
|
|
|
98
83
|
/* Excluded from this release type: activeElementShouldCaptureKeys */
|
|
99
84
|
|
|
@@ -136,8 +121,8 @@ export declare class Arc2d extends Geometry2d {
|
|
|
136
121
|
start: Vec;
|
|
137
122
|
sweepFlag: number;
|
|
138
123
|
});
|
|
139
|
-
nearestPoint(point:
|
|
140
|
-
hitTestLineSegment(A:
|
|
124
|
+
nearestPoint(point: VecLike): Vec;
|
|
125
|
+
hitTestLineSegment(A: VecLike, B: VecLike): boolean;
|
|
141
126
|
getVertices(): Vec[];
|
|
142
127
|
getSvgPathData(first?: boolean): string;
|
|
143
128
|
getLength(): number;
|
|
@@ -153,10 +138,6 @@ export declare class Arc2d extends Geometry2d {
|
|
|
153
138
|
*/
|
|
154
139
|
export declare function areAnglesCompatible(a: number, b: number): boolean;
|
|
155
140
|
|
|
156
|
-
export { Atom }
|
|
157
|
-
|
|
158
|
-
export { atom }
|
|
159
|
-
|
|
160
141
|
/** @public */
|
|
161
142
|
export declare function average(A: VecLike, B: VecLike): string;
|
|
162
143
|
|
|
@@ -477,12 +458,16 @@ export declare class Box {
|
|
|
477
458
|
set point(val: Vec);
|
|
478
459
|
get minX(): number;
|
|
479
460
|
set minX(n: number);
|
|
461
|
+
get left(): number;
|
|
480
462
|
get midX(): number;
|
|
481
463
|
get maxX(): number;
|
|
464
|
+
get right(): number;
|
|
482
465
|
get minY(): number;
|
|
483
466
|
set minY(n: number);
|
|
467
|
+
get top(): number;
|
|
484
468
|
get midY(): number;
|
|
485
469
|
get maxY(): number;
|
|
470
|
+
get bottom(): number;
|
|
486
471
|
get width(): number;
|
|
487
472
|
set width(n: number);
|
|
488
473
|
get height(): number;
|
|
@@ -578,8 +563,8 @@ export declare class Circle2d extends Geometry2d {
|
|
|
578
563
|
});
|
|
579
564
|
getBounds(): Box;
|
|
580
565
|
getVertices(): Vec[];
|
|
581
|
-
nearestPoint(point:
|
|
582
|
-
hitTestLineSegment(A:
|
|
566
|
+
nearestPoint(point: VecLike): Vec;
|
|
567
|
+
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number): boolean;
|
|
583
568
|
getSvgPathData(): string;
|
|
584
569
|
}
|
|
585
570
|
|
|
@@ -656,8 +641,6 @@ export declare class ClickManager {
|
|
|
656
641
|
*/
|
|
657
642
|
export declare function clockwiseAngleDist(a0: number, a1: number): number;
|
|
658
643
|
|
|
659
|
-
export { computed }
|
|
660
|
-
|
|
661
644
|
/**
|
|
662
645
|
* @public
|
|
663
646
|
* @react
|
|
@@ -745,10 +728,10 @@ export declare class CubicBezier2d extends Polyline2d {
|
|
|
745
728
|
});
|
|
746
729
|
getVertices(): Vec[];
|
|
747
730
|
midPoint(): Vec;
|
|
748
|
-
nearestPoint(A:
|
|
731
|
+
nearestPoint(A: VecLike): Vec;
|
|
749
732
|
getSvgPathData(first?: boolean): string;
|
|
750
733
|
static GetAtT(segment: CubicBezier2d, t: number): Vec;
|
|
751
|
-
getLength(precision?: number): number;
|
|
734
|
+
getLength(filters?: Geometry2dFilters, precision?: number): number;
|
|
752
735
|
}
|
|
753
736
|
|
|
754
737
|
/** @public */
|
|
@@ -761,8 +744,8 @@ export declare class CubicSpline2d extends Geometry2d {
|
|
|
761
744
|
get segments(): CubicBezier2d[];
|
|
762
745
|
getLength(): number;
|
|
763
746
|
getVertices(): Vec[];
|
|
764
|
-
nearestPoint(A:
|
|
765
|
-
hitTestLineSegment(A:
|
|
747
|
+
nearestPoint(A: VecLike): Vec;
|
|
748
|
+
hitTestLineSegment(A: VecLike, B: VecLike): boolean;
|
|
766
749
|
getSvgPathData(): string;
|
|
767
750
|
}
|
|
768
751
|
|
|
@@ -956,8 +939,8 @@ export declare class Edge2d extends Geometry2d {
|
|
|
956
939
|
getLength(): number;
|
|
957
940
|
midPoint(): Vec;
|
|
958
941
|
getVertices(): Vec[];
|
|
959
|
-
nearestPoint(point:
|
|
960
|
-
hitTestLineSegment(A:
|
|
942
|
+
nearestPoint(point: VecLike): Vec;
|
|
943
|
+
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number): boolean;
|
|
961
944
|
getSvgPathData(first?: boolean): string;
|
|
962
945
|
}
|
|
963
946
|
|
|
@@ -3994,8 +3977,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3994
3977
|
/** @public */
|
|
3995
3978
|
export declare const EditorContext: React_2.Context<Editor | null>;
|
|
3996
3979
|
|
|
3997
|
-
export { EffectScheduler }
|
|
3998
|
-
|
|
3999
3980
|
/** @public */
|
|
4000
3981
|
export declare class Ellipse2d extends Geometry2d {
|
|
4001
3982
|
config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
@@ -4011,15 +3992,13 @@ export declare class Ellipse2d extends Geometry2d {
|
|
|
4011
3992
|
_edges?: Edge2d[];
|
|
4012
3993
|
get edges(): Edge2d[];
|
|
4013
3994
|
getVertices(): any[];
|
|
4014
|
-
nearestPoint(A:
|
|
4015
|
-
hitTestLineSegment(A:
|
|
3995
|
+
nearestPoint(A: VecLike): Vec;
|
|
3996
|
+
hitTestLineSegment(A: VecLike, B: VecLike): boolean;
|
|
4016
3997
|
getBounds(): Box;
|
|
4017
3998
|
getLength(): number;
|
|
4018
3999
|
getSvgPathData(first?: boolean): string;
|
|
4019
4000
|
}
|
|
4020
4001
|
|
|
4021
|
-
export { EMPTY_ARRAY }
|
|
4022
|
-
|
|
4023
4002
|
/** @public */
|
|
4024
4003
|
export declare class ErrorBoundary extends React_3.Component<React_3.PropsWithRef<React_3.PropsWithChildren<TLErrorBoundaryProps>>, {
|
|
4025
4004
|
error: Error | null;
|
|
@@ -4087,18 +4066,27 @@ export declare abstract class Geometry2d {
|
|
|
4087
4066
|
constructor(opts: Geometry2dOptions);
|
|
4088
4067
|
isExcludedByFilter(filters?: Geometry2dFilters): boolean;
|
|
4089
4068
|
abstract getVertices(filters: Geometry2dFilters): Vec[];
|
|
4090
|
-
abstract nearestPoint(point:
|
|
4091
|
-
hitTestPoint(point:
|
|
4092
|
-
distanceToPoint(point:
|
|
4093
|
-
distanceToLineSegment(A:
|
|
4094
|
-
hitTestLineSegment(A:
|
|
4069
|
+
abstract nearestPoint(point: VecLike, _filters?: Geometry2dFilters): Vec;
|
|
4070
|
+
hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean, _filters?: Geometry2dFilters): boolean;
|
|
4071
|
+
distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
4072
|
+
distanceToLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): number;
|
|
4073
|
+
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number, filters?: Geometry2dFilters): boolean;
|
|
4095
4074
|
intersectLineSegment(A: VecLike, B: VecLike, _filters?: Geometry2dFilters): VecLike[];
|
|
4096
4075
|
intersectCircle(center: VecLike, radius: number, _filters?: Geometry2dFilters): VecLike[];
|
|
4097
4076
|
intersectPolygon(polygon: VecLike[], _filters?: Geometry2dFilters): VecLike[];
|
|
4098
4077
|
intersectPolyline(polyline: VecLike[], _filters?: Geometry2dFilters): VecLike[];
|
|
4078
|
+
/**
|
|
4079
|
+
* Find a point along the edge of the geometry that is a fraction `t` along the entire way round.
|
|
4080
|
+
*/
|
|
4081
|
+
interpolateAlongEdge(t: number, _filters?: Geometry2dFilters): Vec;
|
|
4082
|
+
/**
|
|
4083
|
+
* Take `point`, find the closest point to it on the edge of the geometry, and return how far
|
|
4084
|
+
* along the edge it is as a fraction of the total length.
|
|
4085
|
+
*/
|
|
4086
|
+
uninterpolateAlongEdge(point: VecLike, _filters?: Geometry2dFilters): number;
|
|
4099
4087
|
/** @deprecated Iterate the vertices instead. */
|
|
4100
|
-
nearestPointOnLineSegment(A:
|
|
4101
|
-
isPointInBounds(point:
|
|
4088
|
+
nearestPointOnLineSegment(A: VecLike, B: VecLike): Vec;
|
|
4089
|
+
isPointInBounds(point: VecLike, margin?: number): boolean;
|
|
4102
4090
|
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
4103
4091
|
private _vertices;
|
|
4104
4092
|
get vertices(): Vec[];
|
|
@@ -4112,7 +4100,7 @@ export declare abstract class Geometry2d {
|
|
|
4112
4100
|
toSimpleSvgPath(): string;
|
|
4113
4101
|
private _length?;
|
|
4114
4102
|
get length(): number;
|
|
4115
|
-
getLength(): number;
|
|
4103
|
+
getLength(_filters?: Geometry2dFilters): number;
|
|
4116
4104
|
abstract getSvgPathData(first: boolean): string;
|
|
4117
4105
|
}
|
|
4118
4106
|
|
|
@@ -4180,15 +4168,15 @@ export declare function getFreshUserPreferences(): TLUserPreferences;
|
|
|
4180
4168
|
export declare function getIncrementedName(name: string, others: string[]): string;
|
|
4181
4169
|
|
|
4182
4170
|
/** @public */
|
|
4183
|
-
export declare function getPerfectDashProps(totalLength: number, strokeWidth: number, opts?:
|
|
4184
|
-
closed
|
|
4185
|
-
end
|
|
4186
|
-
forceSolid
|
|
4187
|
-
lengthRatio
|
|
4188
|
-
snap
|
|
4189
|
-
start
|
|
4190
|
-
style
|
|
4191
|
-
}
|
|
4171
|
+
export declare function getPerfectDashProps(totalLength: number, strokeWidth: number, opts?: {
|
|
4172
|
+
closed?: boolean;
|
|
4173
|
+
end?: 'none' | 'outset' | 'skip';
|
|
4174
|
+
forceSolid?: boolean;
|
|
4175
|
+
lengthRatio?: number;
|
|
4176
|
+
snap?: number;
|
|
4177
|
+
start?: 'none' | 'outset' | 'skip';
|
|
4178
|
+
style?: TLDefaultDashStyle;
|
|
4179
|
+
}): {
|
|
4192
4180
|
strokeDasharray: string;
|
|
4193
4181
|
strokeDashoffset: string;
|
|
4194
4182
|
};
|
|
@@ -4275,18 +4263,20 @@ export declare class Group2d extends Geometry2d {
|
|
|
4275
4263
|
children: Geometry2d[];
|
|
4276
4264
|
});
|
|
4277
4265
|
getVertices(filters: Geometry2dFilters): Vec[];
|
|
4278
|
-
nearestPoint(point:
|
|
4279
|
-
distanceToPoint(point:
|
|
4280
|
-
hitTestPoint(point:
|
|
4281
|
-
hitTestLineSegment(A:
|
|
4266
|
+
nearestPoint(point: VecLike, filters?: Geometry2dFilters): Vec;
|
|
4267
|
+
distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
4268
|
+
hitTestPoint(point: VecLike, margin: number, hitInside: boolean, filters?: Geometry2dFilters): boolean;
|
|
4269
|
+
hitTestLineSegment(A: VecLike, B: VecLike, zoom: number, filters?: Geometry2dFilters): boolean;
|
|
4282
4270
|
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): VecLike[];
|
|
4283
4271
|
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): VecLike[];
|
|
4284
4272
|
intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
4285
4273
|
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
4274
|
+
interpolateAlongEdge(t: number, filters?: Geometry2dFilters): Vec;
|
|
4275
|
+
uninterpolateAlongEdge(point: VecLike, filters?: Geometry2dFilters): number;
|
|
4286
4276
|
transform(transform: Mat): Geometry2d;
|
|
4287
4277
|
getArea(): number;
|
|
4288
4278
|
toSimpleSvgPath(): string;
|
|
4289
|
-
getLength(): number;
|
|
4279
|
+
getLength(filters?: Geometry2dFilters): number;
|
|
4290
4280
|
getSvgPathData(): string;
|
|
4291
4281
|
}
|
|
4292
4282
|
|
|
@@ -4591,8 +4581,8 @@ export declare class Mat {
|
|
|
4591
4581
|
static Identity(): Mat;
|
|
4592
4582
|
static Translate(x: number, y: number): Mat;
|
|
4593
4583
|
static Rotate(r: number, cx?: number, cy?: number): Mat;
|
|
4594
|
-
static Scale(x: number, y: number):
|
|
4595
|
-
static Scale(x: number, y: number, cx: number, cy: number):
|
|
4584
|
+
static Scale(x: number, y: number): Mat;
|
|
4585
|
+
static Scale(x: number, y: number, cx: number, cy: number): Mat;
|
|
4596
4586
|
static Multiply(m1: MatModel, m2: MatModel): MatModel;
|
|
4597
4587
|
static Inverse(m: MatModel): MatModel;
|
|
4598
4588
|
static Absolute(m: MatLike): MatModel;
|
|
@@ -4687,7 +4677,7 @@ export declare class Point2d extends Geometry2d {
|
|
|
4687
4677
|
});
|
|
4688
4678
|
getVertices(): Vec[];
|
|
4689
4679
|
nearestPoint(): Vec;
|
|
4690
|
-
hitTestLineSegment(A:
|
|
4680
|
+
hitTestLineSegment(A: VecLike, B: VecLike, margin: number): boolean;
|
|
4691
4681
|
getSvgPathData(): string;
|
|
4692
4682
|
}
|
|
4693
4683
|
|
|
@@ -4732,8 +4722,8 @@ export declare class Polyline2d extends Geometry2d {
|
|
|
4732
4722
|
get segments(): Edge2d[];
|
|
4733
4723
|
getLength(): number;
|
|
4734
4724
|
getVertices(): Vec[];
|
|
4735
|
-
nearestPoint(A:
|
|
4736
|
-
hitTestLineSegment(A:
|
|
4725
|
+
nearestPoint(A: VecLike): Vec;
|
|
4726
|
+
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number): boolean;
|
|
4737
4727
|
getSvgPathData(): string;
|
|
4738
4728
|
}
|
|
4739
4729
|
|
|
@@ -4774,8 +4764,6 @@ export declare function radiansToDegrees(r: number): number;
|
|
|
4774
4764
|
*/
|
|
4775
4765
|
export declare function rangeIntersection(a0: number, a1: number, b0: number, b1: number): [number, number] | null;
|
|
4776
4766
|
|
|
4777
|
-
export { react }
|
|
4778
|
-
|
|
4779
4767
|
/**
|
|
4780
4768
|
* A map of {@link @tldraw/tlschema#StyleProp | StyleProps} to their {@link SharedStyle} values. See
|
|
4781
4769
|
* {@link Editor.getSharedStyles}.
|
|
@@ -5489,8 +5477,6 @@ export declare function shortAngleDist(a0: number, a1: number): number;
|
|
|
5489
5477
|
/** @public */
|
|
5490
5478
|
export declare const SIDES: readonly ["top", "right", "bottom", "left"];
|
|
5491
5479
|
|
|
5492
|
-
export { Signal }
|
|
5493
|
-
|
|
5494
5480
|
/** @public */
|
|
5495
5481
|
export declare const SIN: (x: number) => number;
|
|
5496
5482
|
|
|
@@ -5542,8 +5528,8 @@ export declare class Stadium2d extends Geometry2d {
|
|
|
5542
5528
|
height: number;
|
|
5543
5529
|
width: number;
|
|
5544
5530
|
});
|
|
5545
|
-
nearestPoint(A:
|
|
5546
|
-
hitTestLineSegment(A:
|
|
5531
|
+
nearestPoint(A: VecLike): Vec;
|
|
5532
|
+
hitTestLineSegment(A: VecLike, B: VecLike): boolean;
|
|
5547
5533
|
getVertices(): Vec[];
|
|
5548
5534
|
getBounds(): Box;
|
|
5549
5535
|
getLength(): number;
|
|
@@ -7424,12 +7410,6 @@ export declare function toFixed(v: number): number;
|
|
|
7424
7410
|
*/
|
|
7425
7411
|
export declare function toPrecision(n: number, precision?: number): number;
|
|
7426
7412
|
|
|
7427
|
-
export { track }
|
|
7428
|
-
|
|
7429
|
-
export { transact }
|
|
7430
|
-
|
|
7431
|
-
export { transaction }
|
|
7432
|
-
|
|
7433
7413
|
/** @public */
|
|
7434
7414
|
export declare class TransformedGeometry2d extends Geometry2d {
|
|
7435
7415
|
private readonly geometry;
|
|
@@ -7438,13 +7418,13 @@ export declare class TransformedGeometry2d extends Geometry2d {
|
|
|
7438
7418
|
private readonly decomposed;
|
|
7439
7419
|
constructor(geometry: Geometry2d, matrix: MatModel, opts?: TransformedGeometry2dOptions);
|
|
7440
7420
|
getVertices(filters: Geometry2dFilters): Vec[];
|
|
7441
|
-
nearestPoint(point:
|
|
7442
|
-
hitTestPoint(point:
|
|
7443
|
-
distanceToPoint(point:
|
|
7444
|
-
distanceToLineSegment(A:
|
|
7445
|
-
hitTestLineSegment(A:
|
|
7446
|
-
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters):
|
|
7447
|
-
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters):
|
|
7421
|
+
nearestPoint(point: VecLike, filters?: Geometry2dFilters): Vec;
|
|
7422
|
+
hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean, filters?: Geometry2dFilters): boolean;
|
|
7423
|
+
distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
7424
|
+
distanceToLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): number;
|
|
7425
|
+
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number, filters?: Geometry2dFilters): boolean;
|
|
7426
|
+
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): Vec[];
|
|
7427
|
+
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): Vec[];
|
|
7448
7428
|
intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
7449
7429
|
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
7450
7430
|
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
@@ -7471,10 +7451,6 @@ export declare function uniq<T>(array: {
|
|
|
7471
7451
|
readonly length: number;
|
|
7472
7452
|
} | null | undefined): T[];
|
|
7473
7453
|
|
|
7474
|
-
export { useAtom }
|
|
7475
|
-
|
|
7476
|
-
export { useComputed }
|
|
7477
|
-
|
|
7478
7454
|
/** @public */
|
|
7479
7455
|
export declare function useContainer(): HTMLElement;
|
|
7480
7456
|
|
|
@@ -7544,12 +7520,9 @@ export declare function usePeerIds(): string[];
|
|
|
7544
7520
|
*/
|
|
7545
7521
|
export declare function usePresence(userId: string): null | TLInstancePresence;
|
|
7546
7522
|
|
|
7547
|
-
export { useQuickReactor }
|
|
7548
|
-
|
|
7549
7523
|
/* Excluded from this release type: USER_COLORS */
|
|
7550
7524
|
|
|
7551
7525
|
/* Excluded from this release type: useReactiveEvent */
|
|
7552
|
-
export { useReactor }
|
|
7553
7526
|
|
|
7554
7527
|
/* Excluded from this release type: useRefState */
|
|
7555
7528
|
|
|
@@ -7612,8 +7585,6 @@ export declare function useSelectionEvents(handle: TLSelectionHandle): {
|
|
|
7612
7585
|
*/
|
|
7613
7586
|
export declare function useSharedSafeId(id: string): SafeId;
|
|
7614
7587
|
|
|
7615
|
-
export { useStateTracking }
|
|
7616
|
-
|
|
7617
7588
|
/**
|
|
7618
7589
|
* Returns the current SVG export context. Returns null if the component isn't being rendered for an
|
|
7619
7590
|
* SVG export.
|
|
@@ -7647,8 +7618,6 @@ export declare function useTransform(ref: React.RefObject<HTMLElement | SVGEleme
|
|
|
7647
7618
|
*/
|
|
7648
7619
|
export declare function useUniqueSafeId(suffix?: string): SafeId;
|
|
7649
7620
|
|
|
7650
|
-
export { useValue }
|
|
7651
|
-
|
|
7652
7621
|
/** @public */
|
|
7653
7622
|
export declare function useViewportHeight(): number;
|
|
7654
7623
|
|
|
@@ -7720,6 +7689,7 @@ export declare class Vec {
|
|
|
7720
7689
|
static Per(A: VecLike): Vec;
|
|
7721
7690
|
static Abs(A: VecLike): Vec;
|
|
7722
7691
|
static Dist(A: VecLike, B: VecLike): number;
|
|
7692
|
+
static ManhattanDist(A: VecLike, B: VecLike): number;
|
|
7723
7693
|
static DistMin(A: VecLike, B: VecLike, n: number): boolean;
|
|
7724
7694
|
static Dist2(A: VecLike, B: VecLike): number;
|
|
7725
7695
|
/**
|
|
@@ -7767,7 +7737,15 @@ export declare class Vec {
|
|
|
7767
7737
|
static Cast(A: VecLike): Vec;
|
|
7768
7738
|
static Slope(A: VecLike, B: VecLike): number;
|
|
7769
7739
|
static IsNaN(A: VecLike): boolean;
|
|
7740
|
+
/**
|
|
7741
|
+
* Get the angle from position A to position B.
|
|
7742
|
+
*/
|
|
7770
7743
|
static Angle(A: VecLike, B: VecLike): number;
|
|
7744
|
+
/**
|
|
7745
|
+
* Get the angle between vector A and vector B. This will return the smallest angle between the
|
|
7746
|
+
* two vectors, between -π and π. The sign indicates direction of angle.
|
|
7747
|
+
*/
|
|
7748
|
+
static AngleBetween(A: VecLike, B: VecLike): number;
|
|
7771
7749
|
/**
|
|
7772
7750
|
* Linearly interpolate between two points.
|
|
7773
7751
|
* @param A - The first point.
|
|
@@ -7811,9 +7789,9 @@ export declare class Vec {
|
|
|
7811
7789
|
/** @public */
|
|
7812
7790
|
export declare type VecLike = Vec | VecModel;
|
|
7813
7791
|
|
|
7814
|
-
export { whyAmIRunning }
|
|
7815
|
-
|
|
7816
7792
|
|
|
7793
|
+
export * from "@tldraw/state";
|
|
7794
|
+
export * from "@tldraw/state-react";
|
|
7817
7795
|
export * from "@tldraw/store";
|
|
7818
7796
|
export * from "@tldraw/tlschema";
|
|
7819
7797
|
export * from "@tldraw/utils";
|