@excalidraw/common 0.18.0-2a82821 → 0.18.0-2b1c2a9
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/dev/index.js +94 -79
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +3 -3
- package/dist/types/common/src/colors.d.ts +19 -0
- package/dist/types/common/src/constants.d.ts +3 -0
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utils.d.ts +1 -43
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/align.d.ts +2 -2
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrows/focus.d.ts +5 -2
- package/dist/types/element/src/binding.d.ts +17 -8
- package/dist/types/element/src/bounds.d.ts +5 -9
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +1 -1
- package/dist/types/element/src/comparisons.d.ts +4 -4
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/distribute.d.ts +2 -2
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/duplicate.d.ts +3 -3
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +7 -7
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +4 -4
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/index.d.ts +4 -1
- package/dist/types/element/src/linearElementEditor.d.ts +27 -10
- package/dist/types/element/src/newElement.d.ts +14 -0
- package/dist/types/element/src/renderElement.d.ts +0 -3
- package/dist/types/element/src/resizeElements.d.ts +2 -2
- package/dist/types/element/src/selection.d.ts +5 -5
- package/dist/types/element/src/shape.d.ts +12 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/textElement.d.ts +13 -9
- package/dist/types/element/src/transform.d.ts +2 -2
- package/dist/types/element/src/typeChecks.d.ts +25 -25
- package/dist/types/element/src/types.d.ts +9 -1
- package/dist/types/element/src/utils.d.ts +7 -3
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +36 -12
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +24 -8
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +146 -931
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +24 -8
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +38 -13
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +9 -4
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +25 -9
- package/dist/types/excalidraw/actions/actionExport.d.ts +29 -13
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +48 -197
- package/dist/types/excalidraw/actions/actionGroup.d.ts +39 -23
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +16 -6
- package/dist/types/excalidraw/actions/actionLink.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionMenu.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionProperties.d.ts +43 -24
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +17 -9
- package/dist/types/excalidraw/actions/actionStyles.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -9
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -9
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +13 -5
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +14 -6
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +13 -5
- package/dist/types/excalidraw/actions/index.d.ts +1 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +8 -4
- package/dist/types/excalidraw/appState.d.ts +10 -5
- package/dist/types/excalidraw/components/Actions.d.ts +17 -12
- package/dist/types/excalidraw/components/App.arrowText.d.ts +104 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +372 -67
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +31 -0
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +1 -3
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +146 -0
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
- package/dist/types/excalidraw/components/icons.d.ts +4 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +34 -18
- package/dist/types/excalidraw/data/index.d.ts +4 -4
- package/dist/types/excalidraw/data/json.d.ts +23 -15
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +1 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +7 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -3
- package/dist/types/excalidraw/scene/Renderer.d.ts +12 -11
- package/dist/types/excalidraw/scene/export.d.ts +3 -3
- package/dist/types/excalidraw/scene/index.d.ts +1 -1
- package/dist/types/excalidraw/scene/types.d.ts +4 -3
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/types.d.ts +410 -20
- package/dist/types/excalidraw/viewport.d.ts +275 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -3
- package/dist/types/laser-pointer/src/state.d.ts +1 -0
- package/dist/types/math/src/curve.d.ts +19 -12
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/math/src/segment.d.ts +6 -0
- package/dist/types/utils/src/export.d.ts +3 -3
- package/package.json +1 -1
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -172
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
- package/dist/types/excalidraw/components/shapes.d.ts +0 -270
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
package/dist/dev/index.js
CHANGED
|
@@ -1356,6 +1356,8 @@ function validateWCAG2Parms(parms) {
|
|
|
1356
1356
|
import { clamp } from "@excalidraw/math";
|
|
1357
1357
|
import { degreesToRadians } from "@excalidraw/math";
|
|
1358
1358
|
var DARK_MODE_COLORS_CACHE = typeof window !== "undefined" ? /* @__PURE__ */ new Map() : null;
|
|
1359
|
+
var DARK_MODE_FILTER_INVERT_PERCENT = 93;
|
|
1360
|
+
var DARK_MODE_FILTER_HUE_ROTATE_DEGREES = 180;
|
|
1359
1361
|
function cssHueRotate(red, green, blue, degrees) {
|
|
1360
1362
|
const r = red / 255;
|
|
1361
1363
|
const g = green / 255;
|
|
@@ -1405,12 +1407,17 @@ var applyDarkModeFilter = (color, enable = true) => {
|
|
|
1405
1407
|
const tc = tinycolor(color);
|
|
1406
1408
|
const alpha = tc.getAlpha();
|
|
1407
1409
|
const rgb = tc.toRgb();
|
|
1408
|
-
const inverted = cssInvert(
|
|
1410
|
+
const inverted = cssInvert(
|
|
1411
|
+
rgb.r,
|
|
1412
|
+
rgb.g,
|
|
1413
|
+
rgb.b,
|
|
1414
|
+
DARK_MODE_FILTER_INVERT_PERCENT
|
|
1415
|
+
);
|
|
1409
1416
|
const rotated = cssHueRotate(
|
|
1410
1417
|
inverted.r,
|
|
1411
1418
|
inverted.g,
|
|
1412
1419
|
inverted.b,
|
|
1413
|
-
|
|
1420
|
+
DARK_MODE_FILTER_HUE_ROTATE_DEGREES
|
|
1414
1421
|
);
|
|
1415
1422
|
const result = rgbToHex2(rotated.r, rotated.g, rotated.b, alpha);
|
|
1416
1423
|
if (DARK_MODE_COLORS_CACHE) {
|
|
@@ -1418,6 +1425,33 @@ var applyDarkModeFilter = (color, enable = true) => {
|
|
|
1418
1425
|
}
|
|
1419
1426
|
return result;
|
|
1420
1427
|
};
|
|
1428
|
+
var _reverseDarkModeInvert = (r, g, b) => {
|
|
1429
|
+
const p = DARK_MODE_FILTER_INVERT_PERCENT / 100;
|
|
1430
|
+
const denominator = 1 - 2 * p;
|
|
1431
|
+
const restore = (color) => Math.round(clamp((color - 255 * p) / denominator, 0, 255));
|
|
1432
|
+
return {
|
|
1433
|
+
r: restore(r),
|
|
1434
|
+
g: restore(g),
|
|
1435
|
+
b: restore(b)
|
|
1436
|
+
};
|
|
1437
|
+
};
|
|
1438
|
+
var removeDarkModeFilter = (color) => {
|
|
1439
|
+
const tc = tinycolor(color);
|
|
1440
|
+
const alpha = tc.getAlpha();
|
|
1441
|
+
const rgb = tc.toRgb();
|
|
1442
|
+
const rotatedBack = cssHueRotate(
|
|
1443
|
+
rgb.r,
|
|
1444
|
+
rgb.g,
|
|
1445
|
+
rgb.b,
|
|
1446
|
+
DARK_MODE_FILTER_HUE_ROTATE_DEGREES
|
|
1447
|
+
);
|
|
1448
|
+
const restored = _reverseDarkModeInvert(
|
|
1449
|
+
rotatedBack.r,
|
|
1450
|
+
rotatedBack.g,
|
|
1451
|
+
rotatedBack.b
|
|
1452
|
+
);
|
|
1453
|
+
return rgbToHex2(restored.r, restored.g, restored.b, alpha);
|
|
1454
|
+
};
|
|
1421
1455
|
var pick = (source, keys) => {
|
|
1422
1456
|
return keys.reduce((acc, key) => {
|
|
1423
1457
|
if (key in source) {
|
|
@@ -1463,6 +1497,7 @@ var COMMON_ELEMENT_SHADES = pick(COLOR_PALETTE, [
|
|
|
1463
1497
|
"orange",
|
|
1464
1498
|
"red"
|
|
1465
1499
|
]);
|
|
1500
|
+
var COLOR_TOP_PICKS_SLOTS = 5;
|
|
1466
1501
|
var DEFAULT_ELEMENT_STROKE_PICKS = [
|
|
1467
1502
|
COLOR_PALETTE.black,
|
|
1468
1503
|
COLOR_PALETTE.red[DEFAULT_ELEMENT_STROKE_COLOR_INDEX],
|
|
@@ -1477,6 +1512,13 @@ var DEFAULT_ELEMENT_BACKGROUND_PICKS = [
|
|
|
1477
1512
|
COLOR_PALETTE.blue[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1478
1513
|
COLOR_PALETTE.yellow[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX]
|
|
1479
1514
|
];
|
|
1515
|
+
var BUCKET_FILL_BACKGROUND_PICKS = [
|
|
1516
|
+
COLOR_PALETTE.white,
|
|
1517
|
+
COLOR_PALETTE.red[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1518
|
+
COLOR_PALETTE.green[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1519
|
+
COLOR_PALETTE.blue[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1520
|
+
COLOR_PALETTE.yellow[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX]
|
|
1521
|
+
];
|
|
1480
1522
|
var DEFAULT_CANVAS_BACKGROUND_PICKS = [
|
|
1481
1523
|
COLOR_PALETTE.white,
|
|
1482
1524
|
// radix slate2
|
|
@@ -1528,6 +1570,14 @@ var rgbToHex2 = (r, g, b, a) => {
|
|
|
1528
1570
|
}
|
|
1529
1571
|
return hex6;
|
|
1530
1572
|
};
|
|
1573
|
+
var setColorAlpha = (color, alpha) => {
|
|
1574
|
+
const tc = tinycolor(color);
|
|
1575
|
+
if (!tc.isValid()) {
|
|
1576
|
+
return color;
|
|
1577
|
+
}
|
|
1578
|
+
const { r, g, b } = tc.toRgb();
|
|
1579
|
+
return rgbToHex2(r, g, b, alpha);
|
|
1580
|
+
};
|
|
1531
1581
|
var colorToHex = (color) => {
|
|
1532
1582
|
const tc = tinycolor(color);
|
|
1533
1583
|
if (!tc.isValid()) {
|
|
@@ -1539,6 +1589,9 @@ var colorToHex = (color) => {
|
|
|
1539
1589
|
var isTransparent = (color) => {
|
|
1540
1590
|
return tinycolor(color).getAlpha() === 0;
|
|
1541
1591
|
};
|
|
1592
|
+
var isOpaqueColor = (color) => {
|
|
1593
|
+
return tinycolor(color).getAlpha() === 1;
|
|
1594
|
+
};
|
|
1542
1595
|
var COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
|
|
1543
1596
|
var calculateContrast = (r, g, b) => {
|
|
1544
1597
|
const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
@@ -1866,6 +1919,7 @@ var TEXT_ALIGN = {
|
|
|
1866
1919
|
RIGHT: "right"
|
|
1867
1920
|
};
|
|
1868
1921
|
var ELEMENT_READY_TO_ERASE_OPACITY = 20;
|
|
1922
|
+
var ELEMENT_PENDING_DRAW_SHAPE_OPACITY = 70;
|
|
1869
1923
|
var DEFAULT_PROPORTIONAL_RADIUS = 0.25;
|
|
1870
1924
|
var DEFAULT_ADAPTIVE_RADIUS = 32;
|
|
1871
1925
|
var ROUNDNESS = {
|
|
@@ -1949,7 +2003,9 @@ var TOOL_TYPE = {
|
|
|
1949
2003
|
frame: "frame",
|
|
1950
2004
|
magicframe: "magicframe",
|
|
1951
2005
|
embeddable: "embeddable",
|
|
1952
|
-
laser: "laser"
|
|
2006
|
+
laser: "laser",
|
|
2007
|
+
autoshape: "autoshape",
|
|
2008
|
+
bucketfill: "bucketfill"
|
|
1953
2009
|
};
|
|
1954
2010
|
var EDITOR_LS_KEYS = {
|
|
1955
2011
|
OAI_API_KEY: "excalidraw-oai-api-key",
|
|
@@ -2311,6 +2367,7 @@ var KEYS = {
|
|
|
2311
2367
|
SUBTRACT: "-",
|
|
2312
2368
|
SLASH: "/",
|
|
2313
2369
|
A: "a",
|
|
2370
|
+
B: "b",
|
|
2314
2371
|
C: "c",
|
|
2315
2372
|
D: "d",
|
|
2316
2373
|
E: "e",
|
|
@@ -2362,6 +2419,7 @@ var shouldRotateWithDiscreteAngle = (event) => event.shiftKey;
|
|
|
2362
2419
|
// src/points.ts
|
|
2363
2420
|
init_define_import_meta_env();
|
|
2364
2421
|
import {
|
|
2422
|
+
pointFrom,
|
|
2365
2423
|
pointFromPair
|
|
2366
2424
|
} from "@excalidraw/math";
|
|
2367
2425
|
var getSizeFromPoints = (points) => {
|
|
@@ -2406,12 +2464,12 @@ var rescalePoints = (dimension, newSize, points, normalize) => {
|
|
|
2406
2464
|
};
|
|
2407
2465
|
var getGridPoint = (x, y, gridSize) => {
|
|
2408
2466
|
if (gridSize) {
|
|
2409
|
-
return
|
|
2467
|
+
return pointFrom(
|
|
2410
2468
|
Math.round(x / gridSize) * gridSize,
|
|
2411
2469
|
Math.round(y / gridSize) * gridSize
|
|
2412
|
-
|
|
2470
|
+
);
|
|
2413
2471
|
}
|
|
2414
|
-
return
|
|
2472
|
+
return pointFrom(x, y);
|
|
2415
2473
|
};
|
|
2416
2474
|
|
|
2417
2475
|
// src/promise-pool.ts
|
|
@@ -2502,14 +2560,25 @@ var getDateTime = () => {
|
|
|
2502
2560
|
return `${year}-${month}-${day}-${hr}${min}`;
|
|
2503
2561
|
};
|
|
2504
2562
|
var capitalizeString = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
2505
|
-
var
|
|
2506
|
-
var
|
|
2507
|
-
|
|
2563
|
+
var getTargetWindow = (target) => target?.ownerDocument?.defaultView ?? (typeof window === "undefined" ? null : window);
|
|
2564
|
+
var isToolIcon = (target) => {
|
|
2565
|
+
const targetWindow = getTargetWindow(target);
|
|
2566
|
+
return !!targetWindow && target instanceof targetWindow.HTMLElement && target.className.includes("ToolIcon");
|
|
2567
|
+
};
|
|
2568
|
+
var isInputLike = (target) => {
|
|
2569
|
+
const targetWindow = getTargetWindow(target);
|
|
2570
|
+
return !!targetWindow && (target instanceof targetWindow.HTMLElement && target.dataset.type === "wysiwyg" || target instanceof targetWindow.HTMLBRElement || // newline in wysiwyg
|
|
2571
|
+
target instanceof targetWindow.HTMLInputElement || target instanceof targetWindow.HTMLTextAreaElement || target instanceof targetWindow.HTMLSelectElement);
|
|
2572
|
+
};
|
|
2508
2573
|
var isInteractive = (target) => {
|
|
2509
|
-
|
|
2574
|
+
const targetWindow = getTargetWindow(target);
|
|
2575
|
+
return isInputLike(target) || !!targetWindow && target instanceof targetWindow.Element && !!target.closest("label, button");
|
|
2576
|
+
};
|
|
2577
|
+
var isWritableElement = (target) => {
|
|
2578
|
+
const targetWindow = getTargetWindow(target);
|
|
2579
|
+
return !!targetWindow && (target instanceof targetWindow.HTMLElement && target.dataset.type === "wysiwyg" || target instanceof targetWindow.HTMLBRElement || // newline in wysiwyg
|
|
2580
|
+
target instanceof targetWindow.HTMLTextAreaElement || target instanceof targetWindow.HTMLInputElement && (target.type === "text" || target.type === "number" || target.type === "password" || target.type === "search") || target instanceof targetWindow.HTMLElement && target.closest(".cm-editor") !== null);
|
|
2510
2581
|
};
|
|
2511
|
-
var isWritableElement = (target) => target instanceof HTMLElement && target.dataset.type === "wysiwyg" || target instanceof HTMLBRElement || // newline in wysiwyg
|
|
2512
|
-
target instanceof HTMLTextAreaElement || target instanceof HTMLInputElement && (target.type === "text" || target.type === "number" || target.type === "password" || target.type === "search") || target instanceof HTMLElement && target.closest(".cm-editor") !== null;
|
|
2513
2582
|
var getFontFamilyString = ({
|
|
2514
2583
|
fontFamily
|
|
2515
2584
|
}) => {
|
|
@@ -2595,67 +2664,6 @@ var throttleRAF = (fn) => {
|
|
|
2595
2664
|
var easeOut = (k) => {
|
|
2596
2665
|
return 1 - Math.pow(1 - k, 4);
|
|
2597
2666
|
};
|
|
2598
|
-
var easeOutInterpolate = (from, to, progress) => {
|
|
2599
|
-
return (to - from) * easeOut(progress) + from;
|
|
2600
|
-
};
|
|
2601
|
-
var easeToValuesRAF = ({
|
|
2602
|
-
fromValues,
|
|
2603
|
-
toValues,
|
|
2604
|
-
onStep,
|
|
2605
|
-
duration = 250,
|
|
2606
|
-
interpolateValue,
|
|
2607
|
-
onStart,
|
|
2608
|
-
onEnd,
|
|
2609
|
-
onCancel
|
|
2610
|
-
}) => {
|
|
2611
|
-
let canceled = false;
|
|
2612
|
-
let frameId = 0;
|
|
2613
|
-
let startTime;
|
|
2614
|
-
function step(timestamp) {
|
|
2615
|
-
if (canceled) {
|
|
2616
|
-
return;
|
|
2617
|
-
}
|
|
2618
|
-
if (startTime === void 0) {
|
|
2619
|
-
startTime = timestamp;
|
|
2620
|
-
onStart?.();
|
|
2621
|
-
}
|
|
2622
|
-
const elapsed = Math.min(timestamp - startTime, duration);
|
|
2623
|
-
const factor = easeOut(elapsed / duration);
|
|
2624
|
-
const newValues = {};
|
|
2625
|
-
Object.keys(fromValues).forEach((key) => {
|
|
2626
|
-
const _key = key;
|
|
2627
|
-
const result = (toValues[_key] - fromValues[_key]) * factor + fromValues[_key];
|
|
2628
|
-
newValues[_key] = result;
|
|
2629
|
-
});
|
|
2630
|
-
onStep(newValues);
|
|
2631
|
-
if (elapsed < duration) {
|
|
2632
|
-
const progress = elapsed / duration;
|
|
2633
|
-
const newValues2 = {};
|
|
2634
|
-
Object.keys(fromValues).forEach((key) => {
|
|
2635
|
-
const _key = key;
|
|
2636
|
-
const startValue = fromValues[_key];
|
|
2637
|
-
const endValue = toValues[_key];
|
|
2638
|
-
let result;
|
|
2639
|
-
result = interpolateValue ? interpolateValue(startValue, endValue, progress, _key) : easeOutInterpolate(startValue, endValue, progress);
|
|
2640
|
-
if (result == null) {
|
|
2641
|
-
result = easeOutInterpolate(startValue, endValue, progress);
|
|
2642
|
-
}
|
|
2643
|
-
newValues2[_key] = result;
|
|
2644
|
-
});
|
|
2645
|
-
onStep(newValues2);
|
|
2646
|
-
frameId = window.requestAnimationFrame(step);
|
|
2647
|
-
} else {
|
|
2648
|
-
onStep(toValues);
|
|
2649
|
-
onEnd?.();
|
|
2650
|
-
}
|
|
2651
|
-
}
|
|
2652
|
-
frameId = window.requestAnimationFrame(step);
|
|
2653
|
-
return () => {
|
|
2654
|
-
onCancel?.();
|
|
2655
|
-
canceled = true;
|
|
2656
|
-
window.cancelAnimationFrame(frameId);
|
|
2657
|
-
};
|
|
2658
|
-
};
|
|
2659
2667
|
var chunk = (array, size) => {
|
|
2660
2668
|
if (!array.length || size < 1) {
|
|
2661
2669
|
return [];
|
|
@@ -2698,7 +2706,7 @@ var updateActiveTool = (appState, data) => {
|
|
|
2698
2706
|
}
|
|
2699
2707
|
return {
|
|
2700
2708
|
...appState.activeTool,
|
|
2701
|
-
lastActiveTool: data.
|
|
2709
|
+
lastActiveTool: data.lastActiveTool === void 0 ? appState.activeTool.lastActiveTool : data.lastActiveTool,
|
|
2702
2710
|
type: data.type,
|
|
2703
2711
|
customType: null,
|
|
2704
2712
|
locked: data.locked ?? appState.activeTool.locked,
|
|
@@ -2825,19 +2833,21 @@ var supportsEmoji = () => {
|
|
|
2825
2833
|
return ctx.getImageData(offset, offset, 1, 1).data[0] !== 0;
|
|
2826
2834
|
};
|
|
2827
2835
|
var getNearestScrollableContainer = (element) => {
|
|
2836
|
+
const ownerDocument = element.ownerDocument;
|
|
2837
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
2828
2838
|
let parent = element.parentElement;
|
|
2829
2839
|
while (parent) {
|
|
2830
|
-
if (parent ===
|
|
2831
|
-
return
|
|
2840
|
+
if (parent === ownerDocument.body) {
|
|
2841
|
+
return ownerDocument;
|
|
2832
2842
|
}
|
|
2833
|
-
const { overflowY } =
|
|
2843
|
+
const { overflowY } = ownerWindow.getComputedStyle(parent);
|
|
2834
2844
|
const hasScrollableContent = parent.scrollHeight > parent.clientHeight;
|
|
2835
2845
|
if (hasScrollableContent && (overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay")) {
|
|
2836
2846
|
return parent;
|
|
2837
2847
|
}
|
|
2838
2848
|
parent = parent.parentElement;
|
|
2839
2849
|
}
|
|
2840
|
-
return
|
|
2850
|
+
return ownerDocument;
|
|
2841
2851
|
};
|
|
2842
2852
|
var focusNearestParent = (element) => {
|
|
2843
2853
|
let parent = element.parentElement;
|
|
@@ -3553,6 +3563,7 @@ export {
|
|
|
3553
3563
|
AppEventBus,
|
|
3554
3564
|
BIND_MODE_TIMEOUT,
|
|
3555
3565
|
BOUND_TEXT_PADDING,
|
|
3566
|
+
BUCKET_FILL_BACKGROUND_PICKS,
|
|
3556
3567
|
BinaryHeap,
|
|
3557
3568
|
CANVAS_ONLY_ACTIONS,
|
|
3558
3569
|
CANVAS_SEARCH_TAB,
|
|
@@ -3563,6 +3574,7 @@ export {
|
|
|
3563
3574
|
COLOR_CHARCOAL_BLACK,
|
|
3564
3575
|
COLOR_OUTLINE_CONTRAST_THRESHOLD,
|
|
3565
3576
|
COLOR_PALETTE,
|
|
3577
|
+
COLOR_TOP_PICKS_SLOTS,
|
|
3566
3578
|
COLOR_VOICE_CALL,
|
|
3567
3579
|
COLOR_WHITE,
|
|
3568
3580
|
CURSOR_TYPE,
|
|
@@ -3602,6 +3614,7 @@ export {
|
|
|
3602
3614
|
Debug,
|
|
3603
3615
|
EDITOR_LS_KEYS,
|
|
3604
3616
|
ELEMENT_LINK_KEY,
|
|
3617
|
+
ELEMENT_PENDING_DRAW_SHAPE_OPACITY,
|
|
3605
3618
|
ELEMENT_READY_TO_ERASE_OPACITY,
|
|
3606
3619
|
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
|
3607
3620
|
ELEMENT_TRANSLATE_AMOUNT,
|
|
@@ -3704,7 +3717,6 @@ export {
|
|
|
3704
3717
|
deriveStylesPanelMode,
|
|
3705
3718
|
distance,
|
|
3706
3719
|
easeOut,
|
|
3707
|
-
easeToValuesRAF,
|
|
3708
3720
|
escapeDoubleQuotes,
|
|
3709
3721
|
exitFullScreen,
|
|
3710
3722
|
findIndex,
|
|
@@ -3749,6 +3761,7 @@ export {
|
|
|
3749
3761
|
isLocalLink,
|
|
3750
3762
|
isMemberOf,
|
|
3751
3763
|
isMobileBreakpoint,
|
|
3764
|
+
isOpaqueColor,
|
|
3752
3765
|
isPrimitive,
|
|
3753
3766
|
isProdEnv,
|
|
3754
3767
|
isPromiseLike,
|
|
@@ -3782,6 +3795,7 @@ export {
|
|
|
3782
3795
|
randomId,
|
|
3783
3796
|
randomInteger,
|
|
3784
3797
|
reduceToCommonValue,
|
|
3798
|
+
removeDarkModeFilter,
|
|
3785
3799
|
removeSelection,
|
|
3786
3800
|
rescalePoints,
|
|
3787
3801
|
reseed,
|
|
@@ -3790,6 +3804,7 @@ export {
|
|
|
3790
3804
|
safelyParseJSON,
|
|
3791
3805
|
sceneCoordsToViewportCoords,
|
|
3792
3806
|
selectNode,
|
|
3807
|
+
setColorAlpha,
|
|
3793
3808
|
setDateTimeForTests,
|
|
3794
3809
|
setDesktopUIMode,
|
|
3795
3810
|
setFeatureFlag,
|