@mocanvas/editor 4.4.2 → 4.5.0
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/index.d.ts +388 -353
- package/dist/index.js +199 -139
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createRecordType, isIndexKey, createMigrationIds, uniqueId, isRecordsDi
|
|
|
4
4
|
export { ZERO_INDEX_KEY, createComputedCache, getGraphemeLength, getGraphemes, getIndexAbove, getIndexBelow, getIndexBetween, getIndices, getIndicesAbove, getIndicesBelow, getIndicesBetween, iterateGraphemes, sortByIndex } from '@mocanvas/store';
|
|
5
5
|
import { PATH_OP, FLAG, GEO_FLAG, EngineBridge, VERTEX_FLOATS, BATCH_WORDS, readClip } from '@mocanvas/wasm';
|
|
6
6
|
export { EngineBridge, FLAG, GEO_FLAG, GEO_KIND, PATH_OP, getLoadedEngine, loadEngine, loadEngineSync } from '@mocanvas/wasm';
|
|
7
|
-
import { createContext, useRef, useLayoutEffect,
|
|
7
|
+
import { createContext, useEffect, useRef, useLayoutEffect, useContext, Component, useMemo, useId, useCallback, useState } from 'react';
|
|
8
8
|
import { track as track$1, useValue } from '@mocanvas/state/react';
|
|
9
9
|
export { track, useAtom, useComputed, useQuickReactor, useReactor, useStateTracking, useValue } from '@mocanvas/state/react';
|
|
10
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -2521,7 +2521,10 @@ var InstanceRecordType = createRecordType("instance", { scope: "session" }).with
|
|
|
2521
2521
|
isFocusMode: false,
|
|
2522
2522
|
isDebugMode: false,
|
|
2523
2523
|
isToolLocked: false,
|
|
2524
|
-
|
|
2524
|
+
// On by default: a canvas is a drawing surface and the grid is how a
|
|
2525
|
+
// person judges size and alignment on one. An app that wants a blank page
|
|
2526
|
+
// sets it false on its instance record.
|
|
2527
|
+
isGridMode: true,
|
|
2525
2528
|
isReadonly: false,
|
|
2526
2529
|
isFocused: false,
|
|
2527
2530
|
isPenMode: false,
|
|
@@ -5202,7 +5205,7 @@ var LIGHT_SURFACE = {
|
|
|
5202
5205
|
selectFill: "rgba(68, 101, 233, 0.10)",
|
|
5203
5206
|
selectStroke: "#4465e9",
|
|
5204
5207
|
hint: "#cc00cc",
|
|
5205
|
-
grid: "#
|
|
5208
|
+
grid: "#b4bcc4"
|
|
5206
5209
|
};
|
|
5207
5210
|
var DARK_SURFACE = {
|
|
5208
5211
|
background: "#101011",
|
|
@@ -5211,7 +5214,7 @@ var DARK_SURFACE = {
|
|
|
5211
5214
|
selectFill: "rgba(122, 151, 245, 0.14)",
|
|
5212
5215
|
selectStroke: "#7a97f5",
|
|
5213
5216
|
hint: "#ff66ff",
|
|
5214
|
-
grid: "#
|
|
5217
|
+
grid: "#46464d"
|
|
5215
5218
|
};
|
|
5216
5219
|
var DARK_INKS = {
|
|
5217
5220
|
black: "#f2f2f2",
|
|
@@ -14432,6 +14435,150 @@ var WebGL2Backend = class {
|
|
|
14432
14435
|
function createBackend(canvas) {
|
|
14433
14436
|
return new WebGL2Backend(canvas);
|
|
14434
14437
|
}
|
|
14438
|
+
var UNSAFE = /[^a-zA-Z0-9_-]/g;
|
|
14439
|
+
function sanitizeId(id) {
|
|
14440
|
+
return `mc_${id.replace(UNSAFE, "_")}`;
|
|
14441
|
+
}
|
|
14442
|
+
var toSafeId = sanitizeId;
|
|
14443
|
+
function suffixSafeId(id, suffix) {
|
|
14444
|
+
return `${id}_${suffix.replace(UNSAFE, "_")}`;
|
|
14445
|
+
}
|
|
14446
|
+
function useUniqueSafeId(suffix) {
|
|
14447
|
+
const id = toSafeId(useId());
|
|
14448
|
+
return suffix === void 0 ? id : suffixSafeId(id, suffix);
|
|
14449
|
+
}
|
|
14450
|
+
function useSharedSafeId(name) {
|
|
14451
|
+
return toSafeId(name);
|
|
14452
|
+
}
|
|
14453
|
+
function DefaultCanvas() {
|
|
14454
|
+
const editor = useEditor();
|
|
14455
|
+
return /* @__PURE__ */ jsx(Canvas, { editor });
|
|
14456
|
+
}
|
|
14457
|
+
function DefaultBackground() {
|
|
14458
|
+
return /* @__PURE__ */ jsx("div", { className: "mocanvas-background", style: { position: "absolute", inset: 0, background: "var(--mocanvas-canvas, transparent)" } });
|
|
14459
|
+
}
|
|
14460
|
+
function DefaultGrid({ x, y, z, size }) {
|
|
14461
|
+
const id = useSharedSafeId("grid");
|
|
14462
|
+
const step = size * z;
|
|
14463
|
+
const fineOpacity = Math.min(1, Math.max(0, (step - 4) / 12));
|
|
14464
|
+
const FINE = 0.7;
|
|
14465
|
+
const MAJOR = 0.9;
|
|
14466
|
+
return /* @__PURE__ */ jsxs("svg", { className: "mocanvas-grid", style: { position: "absolute", inset: 0, width: "100%", height: "100%", pointerEvents: "none" }, "aria-hidden": "true", children: [
|
|
14467
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
14468
|
+
/* @__PURE__ */ jsx("pattern", { id, width: step, height: step, patternUnits: "userSpaceOnUse", patternTransform: `translate(${x * z} ${y * z})`, children: /* @__PURE__ */ jsx("circle", { cx: 0, cy: 0, r: 1, fill: "var(--mocanvas-grid, currentColor)", opacity: fineOpacity * FINE }) }),
|
|
14469
|
+
/* @__PURE__ */ jsx("pattern", { id: `${id}_major`, width: step * 5, height: step * 5, patternUnits: "userSpaceOnUse", patternTransform: `translate(${x * z} ${y * z})`, children: /* @__PURE__ */ jsx("circle", { cx: 0, cy: 0, r: 1.5, fill: "var(--mocanvas-grid, currentColor)", opacity: MAJOR }) })
|
|
14470
|
+
] }),
|
|
14471
|
+
/* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` }),
|
|
14472
|
+
/* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id}_major)` })
|
|
14473
|
+
] });
|
|
14474
|
+
}
|
|
14475
|
+
function DefaultShapeErrorFallback({ error }) {
|
|
14476
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
14477
|
+
return /* @__PURE__ */ jsx(
|
|
14478
|
+
"div",
|
|
14479
|
+
{
|
|
14480
|
+
className: "mocanvas-shape-error",
|
|
14481
|
+
role: "img",
|
|
14482
|
+
"aria-label": `This shape could not be drawn: ${message}`,
|
|
14483
|
+
title: message,
|
|
14484
|
+
style: { position: "absolute", inset: 0, border: "1px dashed var(--mocanvas-selection, #e03131)", borderRadius: 2, opacity: 0.6, pointerEvents: "none" }
|
|
14485
|
+
}
|
|
14486
|
+
);
|
|
14487
|
+
}
|
|
14488
|
+
function DefaultSvgDefs({ children }) {
|
|
14489
|
+
return /* @__PURE__ */ jsx("svg", { className: "mocanvas-svg-defs", style: { position: "absolute", width: 0, height: 0, overflow: "hidden" }, "aria-hidden": "true", children: /* @__PURE__ */ jsx("defs", { children }) });
|
|
14490
|
+
}
|
|
14491
|
+
function DefaultCursor({ rotation, color, name, point }) {
|
|
14492
|
+
if (!point) return null;
|
|
14493
|
+
return /* @__PURE__ */ jsxs(
|
|
14494
|
+
"div",
|
|
14495
|
+
{
|
|
14496
|
+
className: "mocanvas-cursor",
|
|
14497
|
+
style: { position: "absolute", top: 0, left: 0, transform: `translate(${point.x}px, ${point.y}px) rotate(${rotation}rad)`, pointerEvents: "none" },
|
|
14498
|
+
children: [
|
|
14499
|
+
/* @__PURE__ */ jsx("svg", { width: "20", height: "24", viewBox: "0 0 20 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 2l14 10-6 1.5L7 21z", fill: color ?? "currentColor", stroke: "var(--mocanvas-selection-fg, #fff)", strokeWidth: "1.5", strokeLinejoin: "round" }) }),
|
|
14500
|
+
name ? /* @__PURE__ */ jsx("div", { className: "mocanvas-cursor-name", style: { position: "absolute", left: 14, top: 18, background: color ?? "currentColor", color: "#fff", borderRadius: 4, padding: "1px 5px", font: "11px/1.4 system-ui, sans-serif", whiteSpace: "nowrap" }, children: name }) : null
|
|
14501
|
+
]
|
|
14502
|
+
}
|
|
14503
|
+
);
|
|
14504
|
+
}
|
|
14505
|
+
function DefaultShapeWrapper({ children }) {
|
|
14506
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
14507
|
+
}
|
|
14508
|
+
var MenuClickCapture = track$1(function MenuClickCapture2({ onClose }) {
|
|
14509
|
+
const editor = useMaybeEditor();
|
|
14510
|
+
const isOpen = (editor?.menus.getOpenMenus().length ?? 0) > 0;
|
|
14511
|
+
useEffect(() => {
|
|
14512
|
+
if (!isOpen || !editor) return;
|
|
14513
|
+
return () => void editor.menus.clearOpenMenus();
|
|
14514
|
+
}, [isOpen, editor]);
|
|
14515
|
+
if (!isOpen) return null;
|
|
14516
|
+
const style = { position: "absolute", inset: 0, zIndex: 1 };
|
|
14517
|
+
return /* @__PURE__ */ jsx("div", { className: "mocanvas-menu-click-capture", style, onPointerDown: () => onClose?.(), "aria-hidden": "true" });
|
|
14518
|
+
});
|
|
14519
|
+
function useIsCropping(shapeId) {
|
|
14520
|
+
const editor = useMaybeEditor();
|
|
14521
|
+
if (!editor) return false;
|
|
14522
|
+
if (!editor.isInAny("select.crop", "select.crop.idle", "select.crop.pointing_crop_handle", "select.crop.cropping")) return false;
|
|
14523
|
+
if (shapeId === void 0) return true;
|
|
14524
|
+
return editor.getOnlySelectedShape()?.id === shapeId;
|
|
14525
|
+
}
|
|
14526
|
+
var ErrorBoundary = class extends Component {
|
|
14527
|
+
state = { error: null, hasError: false };
|
|
14528
|
+
static getDerivedStateFromError(error) {
|
|
14529
|
+
return { error, hasError: true };
|
|
14530
|
+
}
|
|
14531
|
+
componentDidCatch(error, info) {
|
|
14532
|
+
this.props.onError?.(error, info);
|
|
14533
|
+
}
|
|
14534
|
+
resetError = () => {
|
|
14535
|
+
this.setState({ error: null, hasError: false });
|
|
14536
|
+
};
|
|
14537
|
+
render() {
|
|
14538
|
+
if (this.state.hasError) {
|
|
14539
|
+
return this.props.fallback({ error: this.state.error, resetError: this.resetError });
|
|
14540
|
+
}
|
|
14541
|
+
return this.props.children;
|
|
14542
|
+
}
|
|
14543
|
+
};
|
|
14544
|
+
function DefaultErrorFallback({ error, resetError }) {
|
|
14545
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
14546
|
+
return /* @__PURE__ */ jsxs("div", { className: "mocanvas-error-fallback", role: "alert", style: { padding: 16, font: "13px/1.5 system-ui, sans-serif" }, children: [
|
|
14547
|
+
/* @__PURE__ */ jsx("h2", { style: { margin: "0 0 8px", fontSize: 15 }, children: "Something went wrong" }),
|
|
14548
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "0 0 12px", whiteSpace: "pre-wrap" }, children: message }),
|
|
14549
|
+
resetError ? /* @__PURE__ */ jsx("button", { type: "button", onClick: resetError, children: "Try again" }) : null
|
|
14550
|
+
] });
|
|
14551
|
+
}
|
|
14552
|
+
function ErrorScreen({ children }) {
|
|
14553
|
+
return /* @__PURE__ */ jsx(
|
|
14554
|
+
"div",
|
|
14555
|
+
{
|
|
14556
|
+
className: "mocanvas-error-screen",
|
|
14557
|
+
role: "alert",
|
|
14558
|
+
style: { position: "absolute", inset: 0, display: "grid", placeItems: "center", font: "13px/1.5 system-ui, sans-serif" },
|
|
14559
|
+
children: /* @__PURE__ */ jsx("div", { children })
|
|
14560
|
+
}
|
|
14561
|
+
);
|
|
14562
|
+
}
|
|
14563
|
+
function DefaultSpinner() {
|
|
14564
|
+
return /* @__PURE__ */ jsx("svg", { className: "mocanvas-spinner", width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsxs("g", { strokeWidth: "2", fill: "none", stroke: "currentColor", children: [
|
|
14565
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6", opacity: "0.25" }),
|
|
14566
|
+
/* @__PURE__ */ jsx("path", { d: "M14 8a6 6 0 0 0-6-6", strokeLinecap: "round", children: /* @__PURE__ */ jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 8 8", to: "360 8 8", dur: "0.75s", repeatCount: "indefinite" }) })
|
|
14567
|
+
] }) });
|
|
14568
|
+
}
|
|
14569
|
+
function LoadingScreen({ children }) {
|
|
14570
|
+
return /* @__PURE__ */ jsx(
|
|
14571
|
+
"div",
|
|
14572
|
+
{
|
|
14573
|
+
className: "mocanvas-loading-screen",
|
|
14574
|
+
role: "progressbar",
|
|
14575
|
+
"aria-busy": "true",
|
|
14576
|
+
"aria-label": "Loading",
|
|
14577
|
+
style: { position: "absolute", inset: 0, display: "grid", placeItems: "center", font: "13px/1.5 system-ui, sans-serif" },
|
|
14578
|
+
children: children ?? /* @__PURE__ */ jsx(DefaultSpinner, {})
|
|
14579
|
+
}
|
|
14580
|
+
);
|
|
14581
|
+
}
|
|
14435
14582
|
|
|
14436
14583
|
// src/react/translations.ts
|
|
14437
14584
|
function getLocaleChain(locale) {
|
|
@@ -14755,6 +14902,13 @@ function isEditableTarget(t) {
|
|
|
14755
14902
|
const tag = t.tagName;
|
|
14756
14903
|
return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || t.isContentEditable;
|
|
14757
14904
|
}
|
|
14905
|
+
var CanvasComponentsContext = createContext(void 0);
|
|
14906
|
+
function useErrorSlot(key, fallback) {
|
|
14907
|
+
const local = useContext(CanvasComponentsContext);
|
|
14908
|
+
const provided = useEditorComponents();
|
|
14909
|
+
const slot = local?.[key] !== void 0 ? local[key] : provided[key];
|
|
14910
|
+
return slot === void 0 ? fallback : slot;
|
|
14911
|
+
}
|
|
14758
14912
|
var containerStyle = {
|
|
14759
14913
|
position: "relative",
|
|
14760
14914
|
width: "100%",
|
|
@@ -14782,7 +14936,21 @@ var MAX_TICK_MS = 64;
|
|
|
14782
14936
|
function hasFrameWork(editor) {
|
|
14783
14937
|
return editor.scribbles.hasPendingWork() || editor.edgeScrollManager.getIsEnabled();
|
|
14784
14938
|
}
|
|
14785
|
-
function Canvas(
|
|
14939
|
+
function Canvas(props) {
|
|
14940
|
+
return /* @__PURE__ */ jsx(CanvasComponentsContext.Provider, { value: props.components, children: /* @__PURE__ */ jsx(EditorBoundary, { children: /* @__PURE__ */ jsx(CanvasBody, { ...props }) }) });
|
|
14941
|
+
}
|
|
14942
|
+
function EditorBoundary({ children }) {
|
|
14943
|
+
const Fallback = useErrorSlot("ErrorFallback", DefaultErrorFallback);
|
|
14944
|
+
return /* @__PURE__ */ jsx(
|
|
14945
|
+
ErrorBoundary,
|
|
14946
|
+
{
|
|
14947
|
+
fallback: (fallbackProps) => Fallback ? /* @__PURE__ */ jsx(Fallback, { ...fallbackProps }) : null,
|
|
14948
|
+
onError: (error) => console.error("mocanvas: the editor stopped", error),
|
|
14949
|
+
children
|
|
14950
|
+
}
|
|
14951
|
+
);
|
|
14952
|
+
}
|
|
14953
|
+
function CanvasBody({ editor, className, style, children, components, indicatorOverlayUtil }) {
|
|
14786
14954
|
const containerRef = useRef(null);
|
|
14787
14955
|
const canvasRef = useRef(null);
|
|
14788
14956
|
const [backend, setBackend] = useState(null);
|
|
@@ -14869,6 +15037,10 @@ function Canvas({ editor, className, style, children, components, indicatorOverl
|
|
|
14869
15037
|
const hasChromeContextMenu = useEditorComponents().ContextMenu != null;
|
|
14870
15038
|
const themeVars = useThemeCssVars(editor);
|
|
14871
15039
|
const cameraVars = useCameraCssVars(editor);
|
|
15040
|
+
const isGridMode = useValue("isGridMode", () => editor.getInstanceState().isGridMode, [editor]);
|
|
15041
|
+
const camera = useValue("camera", () => editor.getCamera(), [editor]);
|
|
15042
|
+
const gridSize = useValue("gridSize", () => editor.getDocumentSettings().gridSize, [editor]);
|
|
15043
|
+
const Grid = components?.Grid === void 0 ? DefaultGrid : components.Grid;
|
|
14872
15044
|
const Indicators = components?.Indicators ?? DefaultIndicators;
|
|
14873
15045
|
const Brush = components?.Brush ?? (hasOverlay(editor, "brush") ? null : DefaultBrush);
|
|
14874
15046
|
const Background = components?.Background;
|
|
@@ -14887,6 +15059,7 @@ function Canvas({ editor, className, style, children, components, indicatorOverl
|
|
|
14887
15059
|
"data-testid": "mocanvas-container",
|
|
14888
15060
|
children: [
|
|
14889
15061
|
Background ? /* @__PURE__ */ jsx(Background, { editor }) : null,
|
|
15062
|
+
Grid !== null && isGridMode ? /* @__PURE__ */ jsx(Grid, { x: camera.x, y: camera.y, z: camera.z, size: gridSize }) : null,
|
|
14890
15063
|
/* @__PURE__ */ jsx("canvas", { ref: canvasRef, style: { ...layerStyle, display: "block" } }),
|
|
14891
15064
|
/* @__PURE__ */ jsx(OverlayLayer, { editor }),
|
|
14892
15065
|
/* @__PURE__ */ jsx(IndicatorCanvas, { editor, util: indicatorOverlayUtil ?? ShapeIndicatorCompositor }),
|
|
@@ -14984,7 +15157,7 @@ var OverlayShape = track$1(function OverlayShape2({
|
|
|
14984
15157
|
const m = editor.getShapePageTransform(shape);
|
|
14985
15158
|
const bounds = editor.getShapeGeometryBounds(shape);
|
|
14986
15159
|
const offset = clip ? `translate(${-clip[0]}px, ${-clip[1]}px) ` : "";
|
|
14987
|
-
const el = /* @__PURE__ */
|
|
15160
|
+
const el = /* @__PURE__ */ jsx(
|
|
14988
15161
|
"div",
|
|
14989
15162
|
{
|
|
14990
15163
|
className: "mocanvas-shape",
|
|
@@ -15001,10 +15174,10 @@ var OverlayShape = track$1(function OverlayShape2({
|
|
|
15001
15174
|
opacity: shape.opacity,
|
|
15002
15175
|
pointerEvents: isEditing ? "auto" : "none"
|
|
15003
15176
|
},
|
|
15004
|
-
children: [
|
|
15005
|
-
|
|
15177
|
+
children: /* @__PURE__ */ jsxs(ShapeBoundary, { shape, children: [
|
|
15178
|
+
/* @__PURE__ */ jsx(ShapeBody, { editor, shape }),
|
|
15006
15179
|
util.getContentElement ? /* @__PURE__ */ jsx(ContentElementSlot, { editor, shape }) : null
|
|
15007
|
-
]
|
|
15180
|
+
] })
|
|
15008
15181
|
}
|
|
15009
15182
|
);
|
|
15010
15183
|
if (!clip) return el;
|
|
@@ -15189,6 +15362,22 @@ var DefaultBrush = track$1(function DefaultBrush2({ editor }) {
|
|
|
15189
15362
|
}
|
|
15190
15363
|
);
|
|
15191
15364
|
});
|
|
15365
|
+
var ShapeBody = track$1(function ShapeBody2({ editor, shape }) {
|
|
15366
|
+
return /* @__PURE__ */ jsx(Fragment, { children: editor.getShapeUtil(shape).component(shape) });
|
|
15367
|
+
});
|
|
15368
|
+
function ShapeBoundary({ shape, children }) {
|
|
15369
|
+
const Fallback = useErrorSlot("ShapeErrorFallback", DefaultShapeErrorFallback);
|
|
15370
|
+
return /* @__PURE__ */ jsx(
|
|
15371
|
+
ErrorBoundary,
|
|
15372
|
+
{
|
|
15373
|
+
fallback: ({ error }) => Fallback ? /* @__PURE__ */ jsx(Fallback, { error }) : null,
|
|
15374
|
+
onError: (error) => {
|
|
15375
|
+
console.error(`mocanvas: the "${shape.type}" shape ${shape.id} failed to render`, error);
|
|
15376
|
+
},
|
|
15377
|
+
children
|
|
15378
|
+
}
|
|
15379
|
+
);
|
|
15380
|
+
}
|
|
15192
15381
|
var CONTAINER_BOX = {
|
|
15193
15382
|
position: "absolute",
|
|
15194
15383
|
top: 0,
|
|
@@ -15228,62 +15417,6 @@ function AssetUrlsProvider({ assetUrls, children }) {
|
|
|
15228
15417
|
function useAssetUrls() {
|
|
15229
15418
|
return useContext(AssetUrlsContext);
|
|
15230
15419
|
}
|
|
15231
|
-
var ErrorBoundary = class extends Component {
|
|
15232
|
-
state = { error: null, hasError: false };
|
|
15233
|
-
static getDerivedStateFromError(error) {
|
|
15234
|
-
return { error, hasError: true };
|
|
15235
|
-
}
|
|
15236
|
-
componentDidCatch(error, info) {
|
|
15237
|
-
this.props.onError?.(error, info);
|
|
15238
|
-
}
|
|
15239
|
-
resetError = () => {
|
|
15240
|
-
this.setState({ error: null, hasError: false });
|
|
15241
|
-
};
|
|
15242
|
-
render() {
|
|
15243
|
-
if (this.state.hasError) {
|
|
15244
|
-
return this.props.fallback({ error: this.state.error, resetError: this.resetError });
|
|
15245
|
-
}
|
|
15246
|
-
return this.props.children;
|
|
15247
|
-
}
|
|
15248
|
-
};
|
|
15249
|
-
function DefaultErrorFallback({ error, resetError }) {
|
|
15250
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
15251
|
-
return /* @__PURE__ */ jsxs("div", { className: "mocanvas-error-fallback", role: "alert", style: { padding: 16, font: "13px/1.5 system-ui, sans-serif" }, children: [
|
|
15252
|
-
/* @__PURE__ */ jsx("h2", { style: { margin: "0 0 8px", fontSize: 15 }, children: "Something went wrong" }),
|
|
15253
|
-
/* @__PURE__ */ jsx("p", { style: { margin: "0 0 12px", whiteSpace: "pre-wrap" }, children: message }),
|
|
15254
|
-
resetError ? /* @__PURE__ */ jsx("button", { type: "button", onClick: resetError, children: "Try again" }) : null
|
|
15255
|
-
] });
|
|
15256
|
-
}
|
|
15257
|
-
function ErrorScreen({ children }) {
|
|
15258
|
-
return /* @__PURE__ */ jsx(
|
|
15259
|
-
"div",
|
|
15260
|
-
{
|
|
15261
|
-
className: "mocanvas-error-screen",
|
|
15262
|
-
role: "alert",
|
|
15263
|
-
style: { position: "absolute", inset: 0, display: "grid", placeItems: "center", font: "13px/1.5 system-ui, sans-serif" },
|
|
15264
|
-
children: /* @__PURE__ */ jsx("div", { children })
|
|
15265
|
-
}
|
|
15266
|
-
);
|
|
15267
|
-
}
|
|
15268
|
-
function DefaultSpinner() {
|
|
15269
|
-
return /* @__PURE__ */ jsx("svg", { className: "mocanvas-spinner", width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsxs("g", { strokeWidth: "2", fill: "none", stroke: "currentColor", children: [
|
|
15270
|
-
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6", opacity: "0.25" }),
|
|
15271
|
-
/* @__PURE__ */ jsx("path", { d: "M14 8a6 6 0 0 0-6-6", strokeLinecap: "round", children: /* @__PURE__ */ jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 8 8", to: "360 8 8", dur: "0.75s", repeatCount: "indefinite" }) })
|
|
15272
|
-
] }) });
|
|
15273
|
-
}
|
|
15274
|
-
function LoadingScreen({ children }) {
|
|
15275
|
-
return /* @__PURE__ */ jsx(
|
|
15276
|
-
"div",
|
|
15277
|
-
{
|
|
15278
|
-
className: "mocanvas-loading-screen",
|
|
15279
|
-
role: "progressbar",
|
|
15280
|
-
"aria-busy": "true",
|
|
15281
|
-
"aria-label": "Loading",
|
|
15282
|
-
style: { position: "absolute", inset: 0, display: "grid", placeItems: "center", font: "13px/1.5 system-ui, sans-serif" },
|
|
15283
|
-
children: children ?? /* @__PURE__ */ jsx(DefaultSpinner, {})
|
|
15284
|
-
}
|
|
15285
|
-
);
|
|
15286
|
-
}
|
|
15287
15420
|
var ContainerContext = createContext(null);
|
|
15288
15421
|
function ContainerProvider({ container, children }) {
|
|
15289
15422
|
return /* @__PURE__ */ jsx(ContainerContext.Provider, { value: container, children });
|
|
@@ -15307,79 +15440,6 @@ function EditorPortal({ container, children }) {
|
|
|
15307
15440
|
if (!target) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
15308
15441
|
return createPortal(children, target);
|
|
15309
15442
|
}
|
|
15310
|
-
var UNSAFE = /[^a-zA-Z0-9_-]/g;
|
|
15311
|
-
function sanitizeId(id) {
|
|
15312
|
-
return `mc_${id.replace(UNSAFE, "_")}`;
|
|
15313
|
-
}
|
|
15314
|
-
var toSafeId = sanitizeId;
|
|
15315
|
-
function suffixSafeId(id, suffix) {
|
|
15316
|
-
return `${id}_${suffix.replace(UNSAFE, "_")}`;
|
|
15317
|
-
}
|
|
15318
|
-
function useUniqueSafeId(suffix) {
|
|
15319
|
-
const id = toSafeId(useId());
|
|
15320
|
-
return suffix === void 0 ? id : suffixSafeId(id, suffix);
|
|
15321
|
-
}
|
|
15322
|
-
function useSharedSafeId(name) {
|
|
15323
|
-
return toSafeId(name);
|
|
15324
|
-
}
|
|
15325
|
-
function DefaultCanvas() {
|
|
15326
|
-
const editor = useEditor();
|
|
15327
|
-
return /* @__PURE__ */ jsx(Canvas, { editor });
|
|
15328
|
-
}
|
|
15329
|
-
function DefaultBackground() {
|
|
15330
|
-
return /* @__PURE__ */ jsx("div", { className: "mocanvas-background", style: { position: "absolute", inset: 0, background: "var(--mocanvas-canvas, transparent)" } });
|
|
15331
|
-
}
|
|
15332
|
-
function DefaultGrid({ x, y, z, size }) {
|
|
15333
|
-
const id = useSharedSafeId("grid");
|
|
15334
|
-
const step = size * z;
|
|
15335
|
-
const fineOpacity = Math.min(1, Math.max(0, (step - 4) / 12));
|
|
15336
|
-
return /* @__PURE__ */ jsxs("svg", { className: "mocanvas-grid", style: { position: "absolute", inset: 0, width: "100%", height: "100%", pointerEvents: "none" }, "aria-hidden": "true", children: [
|
|
15337
|
-
/* @__PURE__ */ jsxs("defs", { children: [
|
|
15338
|
-
/* @__PURE__ */ jsx("pattern", { id, width: step, height: step, patternUnits: "userSpaceOnUse", patternTransform: `translate(${x * z} ${y * z})`, children: /* @__PURE__ */ jsx("circle", { cx: 0, cy: 0, r: 1, fill: "var(--mocanvas-grid, currentColor)", opacity: fineOpacity * 0.5 }) }),
|
|
15339
|
-
/* @__PURE__ */ jsx("pattern", { id: `${id}_major`, width: step * 5, height: step * 5, patternUnits: "userSpaceOnUse", patternTransform: `translate(${x * z} ${y * z})`, children: /* @__PURE__ */ jsx("circle", { cx: 0, cy: 0, r: 1.5, fill: "var(--mocanvas-grid, currentColor)", opacity: 0.8 }) })
|
|
15340
|
-
] }),
|
|
15341
|
-
/* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id})` }),
|
|
15342
|
-
/* @__PURE__ */ jsx("rect", { width: "100%", height: "100%", fill: `url(#${id}_major)` })
|
|
15343
|
-
] });
|
|
15344
|
-
}
|
|
15345
|
-
function DefaultSvgDefs({ children }) {
|
|
15346
|
-
return /* @__PURE__ */ jsx("svg", { className: "mocanvas-svg-defs", style: { position: "absolute", width: 0, height: 0, overflow: "hidden" }, "aria-hidden": "true", children: /* @__PURE__ */ jsx("defs", { children }) });
|
|
15347
|
-
}
|
|
15348
|
-
function DefaultCursor({ rotation, color, name, point }) {
|
|
15349
|
-
if (!point) return null;
|
|
15350
|
-
return /* @__PURE__ */ jsxs(
|
|
15351
|
-
"div",
|
|
15352
|
-
{
|
|
15353
|
-
className: "mocanvas-cursor",
|
|
15354
|
-
style: { position: "absolute", top: 0, left: 0, transform: `translate(${point.x}px, ${point.y}px) rotate(${rotation}rad)`, pointerEvents: "none" },
|
|
15355
|
-
children: [
|
|
15356
|
-
/* @__PURE__ */ jsx("svg", { width: "20", height: "24", viewBox: "0 0 20 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 2l14 10-6 1.5L7 21z", fill: color ?? "currentColor", stroke: "var(--mocanvas-selection-fg, #fff)", strokeWidth: "1.5", strokeLinejoin: "round" }) }),
|
|
15357
|
-
name ? /* @__PURE__ */ jsx("div", { className: "mocanvas-cursor-name", style: { position: "absolute", left: 14, top: 18, background: color ?? "currentColor", color: "#fff", borderRadius: 4, padding: "1px 5px", font: "11px/1.4 system-ui, sans-serif", whiteSpace: "nowrap" }, children: name }) : null
|
|
15358
|
-
]
|
|
15359
|
-
}
|
|
15360
|
-
);
|
|
15361
|
-
}
|
|
15362
|
-
function DefaultShapeWrapper({ children }) {
|
|
15363
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
15364
|
-
}
|
|
15365
|
-
var MenuClickCapture = track$1(function MenuClickCapture2({ onClose }) {
|
|
15366
|
-
const editor = useMaybeEditor();
|
|
15367
|
-
const isOpen = (editor?.menus.getOpenMenus().length ?? 0) > 0;
|
|
15368
|
-
useEffect(() => {
|
|
15369
|
-
if (!isOpen || !editor) return;
|
|
15370
|
-
return () => void editor.menus.clearOpenMenus();
|
|
15371
|
-
}, [isOpen, editor]);
|
|
15372
|
-
if (!isOpen) return null;
|
|
15373
|
-
const style = { position: "absolute", inset: 0, zIndex: 1 };
|
|
15374
|
-
return /* @__PURE__ */ jsx("div", { className: "mocanvas-menu-click-capture", style, onPointerDown: () => onClose?.(), "aria-hidden": "true" });
|
|
15375
|
-
});
|
|
15376
|
-
function useIsCropping(shapeId) {
|
|
15377
|
-
const editor = useMaybeEditor();
|
|
15378
|
-
if (!editor) return false;
|
|
15379
|
-
if (!editor.isInAny("select.crop", "select.crop.idle", "select.crop.pointing_crop_handle", "select.crop.cropping")) return false;
|
|
15380
|
-
if (shapeId === void 0) return true;
|
|
15381
|
-
return editor.getOnlySelectedShape()?.id === shapeId;
|
|
15382
|
-
}
|
|
15383
15443
|
function useTransform(ref, x, y, scale, rotate, additionalOffset) {
|
|
15384
15444
|
useLayoutEffect(() => {
|
|
15385
15445
|
const elm = ref.current;
|
|
@@ -15781,6 +15841,6 @@ function setDefaultCdnBaseUrl(url) {
|
|
|
15781
15841
|
cdnBaseUrl = url.replace(/\/+$/, "");
|
|
15782
15842
|
}
|
|
15783
15843
|
|
|
15784
|
-
export { ARROWHEAD_KINDS, ARROW_SHAPE_KINDS, ASSET_MIGRATION_SEQUENCE_PREFIX, Arc2d, ArrayOfValidator, ArrowShapeArrowheadEndStyle, ArrowShapeArrowheadStartStyle, ArrowShapeKindStyle, AssetRecordType, AssetUrlsProvider, AssetUtil, AssetUtilRegistry, BINDING_MIGRATION_SEQUENCE_PREFIX, BUILTIN_ASSET_MIGRATION_SEQUENCE_PREFIX, BUILTIN_BINDING_MIGRATION_SEQUENCE_PREFIX, BUILTIN_SHAPE_MIGRATION_SEQUENCE_PREFIX, BaseBoxShapeUtil, BaseFrameLikeShapeUtil, BindingRecordType, BindingUtil, BoundsSnaps, Box, CANVAS_THEME_VARS, COLLABORATOR_INACTIVE_TIMEOUT, CURRENT_SESSION_SCHEMA_VERSION, CURSOR_TYPES, CUSTOM_RECORD_MIGRATION_SEQUENCE_PREFIX, CUSTOM_RECORD_TYPE_NAME, CameraRecordType, CameraStateTracker, Canvas, Circle2d, ClickManager, CollaboratorsManager, CommentReactionRecordType, CommentRecordType, CommentThreadRecordType, ContainerProvider, ContentElementManager, CubicBezier2d, CubicSpline2d, DEFAULT_ASSET_CONTEXT, DEFAULT_CAMERA_OPTIONS, DEFAULT_COLORS, DEFAULT_DARK_COLORS, DEFAULT_DASHES, DEFAULT_EDITOR_CONFIG, DEFAULT_FILLS, DEFAULT_FILL_TOKENS, DEFAULT_FONTS, DEFAULT_FONT_FAMILIES, DEFAULT_H_ALIGNS, DEFAULT_LIGHT_COLORS, DEFAULT_LINE_HEIGHT, DEFAULT_MENU_CONTEXT, DEFAULT_PAGE_ID, DEFAULT_SHAPE_INDICATOR_OPTIONS, DEFAULT_SIZES, DEFAULT_TEXT_ALIGNS, DEFAULT_THEME, DEFAULT_TIME_CONTEXT, DEFAULT_V_ALIGNS, DIM_2D, DIM_3D, DOCUMENT_ID, DefaultBackground, DefaultCanvas, DefaultColorStyle, DefaultCursor, DefaultDashStyle, DefaultErrorFallback, DefaultFillStyle, DefaultFontFaces, DefaultFontFamilies, DefaultFontStyle, DefaultGrid, DefaultHorizontalAlignStyle, DefaultLabelColorStyle, DefaultShapeWrapper, DefaultSizeStyle, DefaultSpinner, DefaultSvgDefs, DefaultTextAlignStyle, DefaultVerticalAlignStyle, DictValidator, DocumentRecordType, EASINGS, ELBOW_ARROW_SNAP_MODES, EVENT_NAME_MAP, Edge2d, EdgeScrollManager, Editor, EditorAtom, EditorContext, EditorManager, EditorPortal, EditorProvider, ElbowArrowSnap, Ellipse2d, EnumStyleProp, ErrorBoundary, ErrorScreen, EventEmitter, FIRST_PAGE_INDEX, FONT_SIZES, FontManager, GEO_SHAPE_KINDS, GeoShapeGeoStyle, Geometry2d, Geometry2dFilters, Group2d, HALF_PI, HANDLE_HIT_RADIUS, HTMLContainer, HandleSnaps, HandleTable, HistoryManager, INSTANCE_ID, ImageShapeCrop, InputsManager, InstancePageStateRecordType, InstancePresenceRecordType, InstanceRecordType, LIGHT_THEME, LINE_SPLINE_KINDS, LOCAL_STATE_PREFIX, LineShapeSplineStyle, LoadingScreen, MAX_TEXTURE_RESOLUTION, MAX_TEXTURE_ZOOM, Mat, MenuClickCapture, MenuManager, MocanvasUiProvider, ObjectValidator, OverlayManager, OverlayUtil, PI, PI2, PRESENCE_COLORS, PageRecordType, PerformanceApiAdapter, PerformanceManager, Point2d, PointerRecordType, Polygon2d, Polyline2d, ROTATE_CORNER_TO_SELECTION_CORNER, ROTATE_HANDLE_OFFSET, ReadonlySharedStyleMap, Rectangle2d, RootState, SHAPE_MIGRATION_SEQUENCE_PREFIX, SIDES, SIN, STROKE_SIZES, SVGContainer, ScribbleManager, ShapeIndicatorCompositor, ShapeRecordType, ShapeUtil, SharedStyleMap, SnapManager, Stadium2d, StateNode, StyleProp, SvgExportContextProvider, T, TAB_ID, TLEditorsRegistry, TLPOINTER_ID, TL_CANVAS_UI_COLOR_TYPES, TL_CURSOR_TYPES, TL_HANDLE_TYPES, TL_SCRIBBLE_STATES, TextManager, TextureManager, ThemeManager, Timers, TransformedGeometry2d, UNKNOWN_EDIT_START_INFO, USER_PREFERENCES_DEFAULTS, UnionValidator, UserPreferencesManager, UserRecordType, ValidationError, Validator, Vec, WebGL2Backend, angleDistance, animateShape, animateShapes, applyThemePatch, approximately, areAnglesCompatible, arrowBindingVersions, assetIdValidator, assetMigrations, assetPropsMigrationSequenceId, assetValidator, assetValidators, average, b64Vecs, bindingIdValidator, bindingPropsMigrationSequenceId, bookmarkAssetMigrations, bookmarkAssetProps, bookmarkAssetPropsValidator, bookmarkAssetValidator, boundsIndicatorPath, boxModelValidator, bucketTextureResolution, canBindShapes, canBuildIndicatorPaths, canCreateShape, canCreateShapes, canCropShape, canEditShape, canonicalizeRotation, canvasUiColorTypeValidator, centerOfCircleFromThreePoints, clamp, clampRadians, clockwiseAngleDist, commentAnchorValidator, commentReactionRecordConfig, commentReactionValidator, commentRecordConfig, commentSchemaRecords, commentThreadRecordConfig, commentThreadValidator, commentValidator, compressLegacySegments, coreShapes, counterClockwiseAngleDist, createAssetId, createAssetPropsMigrationIds, createAssetPropsMigrationSequence, createAssetPropsValidator, createAssetValidator, createBackend, createBaseAssetValidator, createBaseBindingValidator, createBaseShapeValidator, createBindingId, createBindingPropsMigrationIds, createBindingPropsMigrationSequence, createBindingValidator, createBuiltInAssetPropsMigrationIds, createBuiltInBindingPropsMigrationIds, createBuiltInShapePropsMigrationIds, createCachedUserResolve, createComment, createCommentId, createCommentReaction, createCommentReactionId, createCommentThread, createCommentThreadId, createCurrentUser, createCustomRecord, createCustomRecordId, createCustomRecordMigrationIds, createCustomRecordMigrationSequence, createCustomRecordMigrationSequences, createCustomRecordType, createCustomRecordTypeMap, createCustomRecordValidator, createDeepLinkString, createInMemoryAssetStore, createMemoryUserStore, createPresenceStateDerivation, createPropsMigrationSequences, createRootState, createSchema, createSessionStateSnapshotSignal, createShapeId, createShapePropsMigrationIds, createShapePropsMigrationSequence, createShapeValidator, createStore, createTLCurrentUser, createTLSchemaFromUtils, createTheme, createUserId, createUserPreferences, createUserRecordType, cursorTypeValidator, cursorValidator, customRecordMigrationSequenceId, dataUrlToFile, decodeDrawSegmentPath, defaultAssetMigrations, defaultAssetSchemas, defaultBindingSchemas, defaultShapeSchemas, defaultTldrawOptions, defaultUserPreferences, defaultUserStore, degreesToRadians, deselect, drawShapeSegmentValidator, dropShapesOnFrameLike, duplicatePage, easeInOutCubic, fileToBase64DataUrl, fileToDataUrl, findCommonAncestor, findShapeAncestor, fontKey, formatValidationPath, getArcMeasure, getAssetSrc, getBaseZoomForCameraOptions, getCameraCssVars, getColorNamesFromThemes, getColorValue, getCulledShapes, getCurrentPageRenderingShapesSorted, getCurrentPageShapesInReadingOrder, getCursor, getCustomRecordIdType, getDefaultAssetContext, getDefaultCdnBaseUrl, getDefaultCrop, getDefaultDisplayValues, getDefaultUserPresence, getDefaultUserProperties, getDisplayValues, getDroppedShapesToNewParents, getEngineProvider, getExportImplementation, getFocusedGroup, getFocusedGroupId, getFontNamesFromThemes, getFontsFromRichText, getFrameLikeDropTarget, getFreshUserPreferences, getHandleHitRadius, getIncrementedName, getIndicatorSource, getInitialMetaForShape, getLocaleChain, getNearestAdjacentShape, getNotVisibleShapes, getOnlySelectedShapeId, getOverlayDisplayValues, getOwnerDocument, getOwnerWindow, getPageStates, getPaletteEntries, getPerfectDashProps, getPointInArcT, getPointOnCircle, getPointerInfo, getPointsOnArc, getPolygonVertices, getRenderingShapes, getSelectedShapeAtPoint, getSelectionHandlePositions, getSelectionRotatedPageBounds, getSelectionRotatedScreenBounds, getSelectionScreenBounds, getSessionStateSnapshot, getSessionStateSnapshotFromStore, getShapeAndDescendantIds, getShapeClipPath, getShapeHandles, getShapeIdsInsideBounds, getShapeIndicatorNode, getShapeIndicatorPath, getShapeMaskedPageBounds, getShapeStyleIfExists, getShapesPageBounds, getSharedOpacity, getSnapshot, getStylePropsOf, getSvgAsImage, getSvgPathFromPoints, getTextMeasureProvider, getThemeCssVars, getUncroppedSize, getUserPreferences, handleTypeValidator, hardReset, hardResetEditor, hasAncestor, hexToRgba, hitTestSelectionBounds, hitTestSelectionHandles, idValidator, imageAssetMigrations, imageAssetProps, imageAssetPropsValidator, imageAssetValidator, inlineBase64AssetStore, intersectCircleCircle, intersectCirclePolygon, intersectCirclePolyline, intersectLineSegmentCircle, intersectLineSegmentLineSegment, intersectLineSegmentPolygon, intersectLineSegmentPolyline, intersectPolygonBounds, intersectPolygonPolygon, isAncestorSelected, isAsset, isAssetId, isBinding, isBindingId, isCommentId, isCommentReactionId, isCommentThreadId, isCursorInViewport, isCustomRecord, isCustomRecordId, isDocument, isFullCrop, isInstancePresenceId, isOptionalValidator, isPage, isPageId, isPointInShape, isPropsMigrations, isSafeFloat, isShape, isShapeHidden, isShapeId, isShapeInPage, isUserId, isValidProps, kickoutOccludedShapes, lerp, linesIntersect, loadSessionStateSnapshotIntoStore, loadSnapshot, loopToHtmlElement, maybeSnapToGrid, mixHexColors, moveElementInto, moveShapesToPage, normalizeIndicatorPath, normalizeLoadedRecords, noteReactivePointerType, opacityValidator, openWindow, packShapes, pageIdValidator, parentIdValidator, parseDeepLinkString, perimeterOfEllipse, pointInPolygon, pointerValidator, polygonIntersectsPolyline, polygonsIntersect, popFocusedGroupId, precise, prefixError, preventDefault, radiansToDegrees, randomPresenceColor, rangeIntersection, refreshPage, refreshReactiveEnvironment, registerColorsFromThemes, registerCoreShape, registerDefaultAssetSchema, registerDefaultBindingSchema, registerDefaultShapeSchema, registerEngineProvider, registerExportImplementation, registerFontsFromThemes, registerTextMeasureImplementation, releasePointerCapture, resizeBox, resizeScaled, resizeToBounds, resolveAssetUrl, resolveLineHeightPx, resolveShape, resolveThemes, resolveUiMessage, richTextToPlainText, rootBindingMigrations, rootShapeMigrations, rotateSelectionHandle, runtime, sanitizeId, scribbleValidator, selectAdjacentShape, selectFirstChildShape, selectParentShape, setDefaultCdnBaseUrl, setFocusedGroup, setOpacityForNextShapes, setOpacityForSelectedShapes, setPointerCapture, setRuntimeOverrides, setUserPreferences, shapeIdValidator, shapePropsMigrationSequenceId, shortAngleDist, snapAngle, stopEventPropagation, strokeShapeIndicators, suffixSafeId, tleditors, tlenv, tlenvReactive, tlmenus, tltime, toCustomRecordMigrationSequence, toDomPrecision, toFixed, toMigrationSequence, toPrecision, trackPointer, uniq, updatePage, useActions, useAssetUrls, useCameraCssVars, useColorMode, useContainer, useContainerIfExists, useCurrentTheme, useCurrentUser, useDelaySvgExport, useEditor, useEditorComponents, useEditorPortalHost, useGlobalMenuIsOpen, useIsCropping, useIsEditing, useIsToolSelected, useMaybeEditor, useMocanvasUi, usePassThroughWheelEvents, useSharedSafeId, useSvgExportContext, useTLSchemaFromUtils, useTLStore, useThemeColors, useThemeCssVars, useTools, useTransform, useUniqueSafeId, useViewportHeight, userIdValidator, userPreferencesValidator, userTypeValidator, userValidator, validateCustomRecordInfos, validateProps, vecModelValidator, videoAssetMigrations, videoAssetProps, videoAssetValidator, visitDescendants, warnOnce, withCoreShapes };
|
|
15844
|
+
export { ARROWHEAD_KINDS, ARROW_SHAPE_KINDS, ASSET_MIGRATION_SEQUENCE_PREFIX, Arc2d, ArrayOfValidator, ArrowShapeArrowheadEndStyle, ArrowShapeArrowheadStartStyle, ArrowShapeKindStyle, AssetRecordType, AssetUrlsProvider, AssetUtil, AssetUtilRegistry, BINDING_MIGRATION_SEQUENCE_PREFIX, BUILTIN_ASSET_MIGRATION_SEQUENCE_PREFIX, BUILTIN_BINDING_MIGRATION_SEQUENCE_PREFIX, BUILTIN_SHAPE_MIGRATION_SEQUENCE_PREFIX, BaseBoxShapeUtil, BaseFrameLikeShapeUtil, BindingRecordType, BindingUtil, BoundsSnaps, Box, CANVAS_THEME_VARS, COLLABORATOR_INACTIVE_TIMEOUT, CURRENT_SESSION_SCHEMA_VERSION, CURSOR_TYPES, CUSTOM_RECORD_MIGRATION_SEQUENCE_PREFIX, CUSTOM_RECORD_TYPE_NAME, CameraRecordType, CameraStateTracker, Canvas, Circle2d, ClickManager, CollaboratorsManager, CommentReactionRecordType, CommentRecordType, CommentThreadRecordType, ContainerProvider, ContentElementManager, CubicBezier2d, CubicSpline2d, DEFAULT_ASSET_CONTEXT, DEFAULT_CAMERA_OPTIONS, DEFAULT_COLORS, DEFAULT_DARK_COLORS, DEFAULT_DASHES, DEFAULT_EDITOR_CONFIG, DEFAULT_FILLS, DEFAULT_FILL_TOKENS, DEFAULT_FONTS, DEFAULT_FONT_FAMILIES, DEFAULT_H_ALIGNS, DEFAULT_LIGHT_COLORS, DEFAULT_LINE_HEIGHT, DEFAULT_MENU_CONTEXT, DEFAULT_PAGE_ID, DEFAULT_SHAPE_INDICATOR_OPTIONS, DEFAULT_SIZES, DEFAULT_TEXT_ALIGNS, DEFAULT_THEME, DEFAULT_TIME_CONTEXT, DEFAULT_V_ALIGNS, DIM_2D, DIM_3D, DOCUMENT_ID, DefaultBackground, DefaultCanvas, DefaultColorStyle, DefaultCursor, DefaultDashStyle, DefaultErrorFallback, DefaultFillStyle, DefaultFontFaces, DefaultFontFamilies, DefaultFontStyle, DefaultGrid, DefaultHorizontalAlignStyle, DefaultLabelColorStyle, DefaultShapeErrorFallback, DefaultShapeWrapper, DefaultSizeStyle, DefaultSpinner, DefaultSvgDefs, DefaultTextAlignStyle, DefaultVerticalAlignStyle, DictValidator, DocumentRecordType, EASINGS, ELBOW_ARROW_SNAP_MODES, EVENT_NAME_MAP, Edge2d, EdgeScrollManager, Editor, EditorAtom, EditorContext, EditorManager, EditorPortal, EditorProvider, ElbowArrowSnap, Ellipse2d, EnumStyleProp, ErrorBoundary, ErrorScreen, EventEmitter, FIRST_PAGE_INDEX, FONT_SIZES, FontManager, GEO_SHAPE_KINDS, GeoShapeGeoStyle, Geometry2d, Geometry2dFilters, Group2d, HALF_PI, HANDLE_HIT_RADIUS, HTMLContainer, HandleSnaps, HandleTable, HistoryManager, INSTANCE_ID, ImageShapeCrop, InputsManager, InstancePageStateRecordType, InstancePresenceRecordType, InstanceRecordType, LIGHT_THEME, LINE_SPLINE_KINDS, LOCAL_STATE_PREFIX, LineShapeSplineStyle, LoadingScreen, MAX_TEXTURE_RESOLUTION, MAX_TEXTURE_ZOOM, Mat, MenuClickCapture, MenuManager, MocanvasUiProvider, ObjectValidator, OverlayManager, OverlayUtil, PI, PI2, PRESENCE_COLORS, PageRecordType, PerformanceApiAdapter, PerformanceManager, Point2d, PointerRecordType, Polygon2d, Polyline2d, ROTATE_CORNER_TO_SELECTION_CORNER, ROTATE_HANDLE_OFFSET, ReadonlySharedStyleMap, Rectangle2d, RootState, SHAPE_MIGRATION_SEQUENCE_PREFIX, SIDES, SIN, STROKE_SIZES, SVGContainer, ScribbleManager, ShapeIndicatorCompositor, ShapeRecordType, ShapeUtil, SharedStyleMap, SnapManager, Stadium2d, StateNode, StyleProp, SvgExportContextProvider, T, TAB_ID, TLEditorsRegistry, TLPOINTER_ID, TL_CANVAS_UI_COLOR_TYPES, TL_CURSOR_TYPES, TL_HANDLE_TYPES, TL_SCRIBBLE_STATES, TextManager, TextureManager, ThemeManager, Timers, TransformedGeometry2d, UNKNOWN_EDIT_START_INFO, USER_PREFERENCES_DEFAULTS, UnionValidator, UserPreferencesManager, UserRecordType, ValidationError, Validator, Vec, WebGL2Backend, angleDistance, animateShape, animateShapes, applyThemePatch, approximately, areAnglesCompatible, arrowBindingVersions, assetIdValidator, assetMigrations, assetPropsMigrationSequenceId, assetValidator, assetValidators, average, b64Vecs, bindingIdValidator, bindingPropsMigrationSequenceId, bookmarkAssetMigrations, bookmarkAssetProps, bookmarkAssetPropsValidator, bookmarkAssetValidator, boundsIndicatorPath, boxModelValidator, bucketTextureResolution, canBindShapes, canBuildIndicatorPaths, canCreateShape, canCreateShapes, canCropShape, canEditShape, canonicalizeRotation, canvasUiColorTypeValidator, centerOfCircleFromThreePoints, clamp, clampRadians, clockwiseAngleDist, commentAnchorValidator, commentReactionRecordConfig, commentReactionValidator, commentRecordConfig, commentSchemaRecords, commentThreadRecordConfig, commentThreadValidator, commentValidator, compressLegacySegments, coreShapes, counterClockwiseAngleDist, createAssetId, createAssetPropsMigrationIds, createAssetPropsMigrationSequence, createAssetPropsValidator, createAssetValidator, createBackend, createBaseAssetValidator, createBaseBindingValidator, createBaseShapeValidator, createBindingId, createBindingPropsMigrationIds, createBindingPropsMigrationSequence, createBindingValidator, createBuiltInAssetPropsMigrationIds, createBuiltInBindingPropsMigrationIds, createBuiltInShapePropsMigrationIds, createCachedUserResolve, createComment, createCommentId, createCommentReaction, createCommentReactionId, createCommentThread, createCommentThreadId, createCurrentUser, createCustomRecord, createCustomRecordId, createCustomRecordMigrationIds, createCustomRecordMigrationSequence, createCustomRecordMigrationSequences, createCustomRecordType, createCustomRecordTypeMap, createCustomRecordValidator, createDeepLinkString, createInMemoryAssetStore, createMemoryUserStore, createPresenceStateDerivation, createPropsMigrationSequences, createRootState, createSchema, createSessionStateSnapshotSignal, createShapeId, createShapePropsMigrationIds, createShapePropsMigrationSequence, createShapeValidator, createStore, createTLCurrentUser, createTLSchemaFromUtils, createTheme, createUserId, createUserPreferences, createUserRecordType, cursorTypeValidator, cursorValidator, customRecordMigrationSequenceId, dataUrlToFile, decodeDrawSegmentPath, defaultAssetMigrations, defaultAssetSchemas, defaultBindingSchemas, defaultShapeSchemas, defaultTldrawOptions, defaultUserPreferences, defaultUserStore, degreesToRadians, deselect, drawShapeSegmentValidator, dropShapesOnFrameLike, duplicatePage, easeInOutCubic, fileToBase64DataUrl, fileToDataUrl, findCommonAncestor, findShapeAncestor, fontKey, formatValidationPath, getArcMeasure, getAssetSrc, getBaseZoomForCameraOptions, getCameraCssVars, getColorNamesFromThemes, getColorValue, getCulledShapes, getCurrentPageRenderingShapesSorted, getCurrentPageShapesInReadingOrder, getCursor, getCustomRecordIdType, getDefaultAssetContext, getDefaultCdnBaseUrl, getDefaultCrop, getDefaultDisplayValues, getDefaultUserPresence, getDefaultUserProperties, getDisplayValues, getDroppedShapesToNewParents, getEngineProvider, getExportImplementation, getFocusedGroup, getFocusedGroupId, getFontNamesFromThemes, getFontsFromRichText, getFrameLikeDropTarget, getFreshUserPreferences, getHandleHitRadius, getIncrementedName, getIndicatorSource, getInitialMetaForShape, getLocaleChain, getNearestAdjacentShape, getNotVisibleShapes, getOnlySelectedShapeId, getOverlayDisplayValues, getOwnerDocument, getOwnerWindow, getPageStates, getPaletteEntries, getPerfectDashProps, getPointInArcT, getPointOnCircle, getPointerInfo, getPointsOnArc, getPolygonVertices, getRenderingShapes, getSelectedShapeAtPoint, getSelectionHandlePositions, getSelectionRotatedPageBounds, getSelectionRotatedScreenBounds, getSelectionScreenBounds, getSessionStateSnapshot, getSessionStateSnapshotFromStore, getShapeAndDescendantIds, getShapeClipPath, getShapeHandles, getShapeIdsInsideBounds, getShapeIndicatorNode, getShapeIndicatorPath, getShapeMaskedPageBounds, getShapeStyleIfExists, getShapesPageBounds, getSharedOpacity, getSnapshot, getStylePropsOf, getSvgAsImage, getSvgPathFromPoints, getTextMeasureProvider, getThemeCssVars, getUncroppedSize, getUserPreferences, handleTypeValidator, hardReset, hardResetEditor, hasAncestor, hexToRgba, hitTestSelectionBounds, hitTestSelectionHandles, idValidator, imageAssetMigrations, imageAssetProps, imageAssetPropsValidator, imageAssetValidator, inlineBase64AssetStore, intersectCircleCircle, intersectCirclePolygon, intersectCirclePolyline, intersectLineSegmentCircle, intersectLineSegmentLineSegment, intersectLineSegmentPolygon, intersectLineSegmentPolyline, intersectPolygonBounds, intersectPolygonPolygon, isAncestorSelected, isAsset, isAssetId, isBinding, isBindingId, isCommentId, isCommentReactionId, isCommentThreadId, isCursorInViewport, isCustomRecord, isCustomRecordId, isDocument, isFullCrop, isInstancePresenceId, isOptionalValidator, isPage, isPageId, isPointInShape, isPropsMigrations, isSafeFloat, isShape, isShapeHidden, isShapeId, isShapeInPage, isUserId, isValidProps, kickoutOccludedShapes, lerp, linesIntersect, loadSessionStateSnapshotIntoStore, loadSnapshot, loopToHtmlElement, maybeSnapToGrid, mixHexColors, moveElementInto, moveShapesToPage, normalizeIndicatorPath, normalizeLoadedRecords, noteReactivePointerType, opacityValidator, openWindow, packShapes, pageIdValidator, parentIdValidator, parseDeepLinkString, perimeterOfEllipse, pointInPolygon, pointerValidator, polygonIntersectsPolyline, polygonsIntersect, popFocusedGroupId, precise, prefixError, preventDefault, radiansToDegrees, randomPresenceColor, rangeIntersection, refreshPage, refreshReactiveEnvironment, registerColorsFromThemes, registerCoreShape, registerDefaultAssetSchema, registerDefaultBindingSchema, registerDefaultShapeSchema, registerEngineProvider, registerExportImplementation, registerFontsFromThemes, registerTextMeasureImplementation, releasePointerCapture, resizeBox, resizeScaled, resizeToBounds, resolveAssetUrl, resolveLineHeightPx, resolveShape, resolveThemes, resolveUiMessage, richTextToPlainText, rootBindingMigrations, rootShapeMigrations, rotateSelectionHandle, runtime, sanitizeId, scribbleValidator, selectAdjacentShape, selectFirstChildShape, selectParentShape, setDefaultCdnBaseUrl, setFocusedGroup, setOpacityForNextShapes, setOpacityForSelectedShapes, setPointerCapture, setRuntimeOverrides, setUserPreferences, shapeIdValidator, shapePropsMigrationSequenceId, shortAngleDist, snapAngle, stopEventPropagation, strokeShapeIndicators, suffixSafeId, tleditors, tlenv, tlenvReactive, tlmenus, tltime, toCustomRecordMigrationSequence, toDomPrecision, toFixed, toMigrationSequence, toPrecision, trackPointer, uniq, updatePage, useActions, useAssetUrls, useCameraCssVars, useColorMode, useContainer, useContainerIfExists, useCurrentTheme, useCurrentUser, useDelaySvgExport, useEditor, useEditorComponents, useEditorPortalHost, useGlobalMenuIsOpen, useIsCropping, useIsEditing, useIsToolSelected, useMaybeEditor, useMocanvasUi, usePassThroughWheelEvents, useSharedSafeId, useSvgExportContext, useTLSchemaFromUtils, useTLStore, useThemeColors, useThemeCssVars, useTools, useTransform, useUniqueSafeId, useViewportHeight, userIdValidator, userPreferencesValidator, userTypeValidator, userValidator, validateCustomRecordInfos, validateProps, vecModelValidator, videoAssetMigrations, videoAssetProps, videoAssetValidator, visitDescendants, warnOnce, withCoreShapes };
|
|
15785
15845
|
//# sourceMappingURL=index.js.map
|
|
15786
15846
|
//# sourceMappingURL=index.js.map
|