@excalidraw/common 0.18.0-c158187 → 0.18.0-c1dbbdf
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 +232 -290
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +3 -3
- package/dist/types/common/debug.d.ts +21 -0
- package/dist/types/common/src/colors.d.ts +57 -40
- package/dist/types/common/src/constants.d.ts +4 -0
- package/dist/types/common/src/editorInterface.d.ts +1 -1
- package/dist/types/common/src/index.d.ts +1 -1
- package/dist/types/common/src/utils.d.ts +3 -5
- package/dist/types/element/src/Scene.d.ts +2 -0
- package/dist/types/element/src/arrows/focus.d.ts +27 -0
- package/dist/types/element/src/arrows/helpers.d.ts +5 -0
- package/dist/types/element/src/binding.d.ts +13 -8
- package/dist/types/element/src/collision.d.ts +4 -3
- package/dist/types/element/src/distribute.d.ts +2 -1
- package/dist/types/element/src/elbowArrow.d.ts +2 -0
- package/dist/types/element/src/index.d.ts +2 -0
- package/dist/types/element/src/linearElementEditor.d.ts +5 -0
- package/dist/types/element/src/mutateElement.d.ts +2 -0
- package/dist/types/element/src/types.d.ts +1 -1
- package/dist/types/element/src/utils.d.ts +5 -3
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +30 -27
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +20 -18
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +121 -109
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +20 -18
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +10 -9
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +32 -27
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -9
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +20 -18
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +10 -9
- package/dist/types/excalidraw/actions/actionExport.d.ts +42 -42
- package/dist/types/excalidraw/actions/actionFrame.d.ts +40 -36
- package/dist/types/excalidraw/actions/actionGroup.d.ts +20 -18
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +12 -9
- package/dist/types/excalidraw/actions/actionLink.d.ts +10 -9
- package/dist/types/excalidraw/actions/actionMenu.d.ts +6 -9
- package/dist/types/excalidraw/actions/actionProperties.d.ts +20 -18
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +10 -9
- package/dist/types/excalidraw/actions/actionStyles.d.ts +10 -9
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +172 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +10 -9
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +172 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +10 -9
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +6 -9
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +10 -9
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +10 -9
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +10 -9
- package/dist/types/excalidraw/actions/index.d.ts +2 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +9 -7
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
- package/dist/types/excalidraw/charts/index.d.ts +7 -0
- package/dist/types/excalidraw/clipboard.d.ts +4 -4
- package/dist/types/excalidraw/components/App.d.ts +10 -3
- package/dist/types/excalidraw/components/Card.d.ts +1 -2
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +0 -5
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +0 -1
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -1
- package/dist/types/excalidraw/components/FilledButton.d.ts +1 -0
- package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -28
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +14 -13
- package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +24 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +30 -16
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -12
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
- package/dist/types/excalidraw/components/icons.d.ts +11 -2
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +17 -0
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +23 -14
- package/dist/types/excalidraw/components/shapes.d.ts +74 -1
- package/dist/types/excalidraw/data/blob.d.ts +32 -30
- package/dist/types/excalidraw/data/json.d.ts +16 -15
- package/dist/types/excalidraw/errors.d.ts +14 -0
- package/dist/types/excalidraw/index.d.ts +4 -0
- package/dist/types/excalidraw/types.d.ts +24 -13
- package/dist/types/math/src/point.d.ts +6 -1
- package/dist/types/math/src/types.d.ts +25 -1
- package/package.json +1 -1
- package/dist/types/common/src/visualdebug.d.ts +0 -41
- package/dist/types/excalidraw/charts.d.ts +0 -27
package/dist/dev/index.js
CHANGED
|
@@ -370,168 +370,6 @@ var isBounds = (box) => Array.isArray(box) && box.length === 4 && typeof box[0]
|
|
|
370
370
|
// src/colors.ts
|
|
371
371
|
init_define_import_meta_env();
|
|
372
372
|
|
|
373
|
-
// ../../node_modules/open-color/open-color.json
|
|
374
|
-
var open_color_default = {
|
|
375
|
-
white: "#ffffff",
|
|
376
|
-
black: "#000000",
|
|
377
|
-
gray: [
|
|
378
|
-
"#f8f9fa",
|
|
379
|
-
"#f1f3f5",
|
|
380
|
-
"#e9ecef",
|
|
381
|
-
"#dee2e6",
|
|
382
|
-
"#ced4da",
|
|
383
|
-
"#adb5bd",
|
|
384
|
-
"#868e96",
|
|
385
|
-
"#495057",
|
|
386
|
-
"#343a40",
|
|
387
|
-
"#212529"
|
|
388
|
-
],
|
|
389
|
-
red: [
|
|
390
|
-
"#fff5f5",
|
|
391
|
-
"#ffe3e3",
|
|
392
|
-
"#ffc9c9",
|
|
393
|
-
"#ffa8a8",
|
|
394
|
-
"#ff8787",
|
|
395
|
-
"#ff6b6b",
|
|
396
|
-
"#fa5252",
|
|
397
|
-
"#f03e3e",
|
|
398
|
-
"#e03131",
|
|
399
|
-
"#c92a2a"
|
|
400
|
-
],
|
|
401
|
-
pink: [
|
|
402
|
-
"#fff0f6",
|
|
403
|
-
"#ffdeeb",
|
|
404
|
-
"#fcc2d7",
|
|
405
|
-
"#faa2c1",
|
|
406
|
-
"#f783ac",
|
|
407
|
-
"#f06595",
|
|
408
|
-
"#e64980",
|
|
409
|
-
"#d6336c",
|
|
410
|
-
"#c2255c",
|
|
411
|
-
"#a61e4d"
|
|
412
|
-
],
|
|
413
|
-
grape: [
|
|
414
|
-
"#f8f0fc",
|
|
415
|
-
"#f3d9fa",
|
|
416
|
-
"#eebefa",
|
|
417
|
-
"#e599f7",
|
|
418
|
-
"#da77f2",
|
|
419
|
-
"#cc5de8",
|
|
420
|
-
"#be4bdb",
|
|
421
|
-
"#ae3ec9",
|
|
422
|
-
"#9c36b5",
|
|
423
|
-
"#862e9c"
|
|
424
|
-
],
|
|
425
|
-
violet: [
|
|
426
|
-
"#f3f0ff",
|
|
427
|
-
"#e5dbff",
|
|
428
|
-
"#d0bfff",
|
|
429
|
-
"#b197fc",
|
|
430
|
-
"#9775fa",
|
|
431
|
-
"#845ef7",
|
|
432
|
-
"#7950f2",
|
|
433
|
-
"#7048e8",
|
|
434
|
-
"#6741d9",
|
|
435
|
-
"#5f3dc4"
|
|
436
|
-
],
|
|
437
|
-
indigo: [
|
|
438
|
-
"#edf2ff",
|
|
439
|
-
"#dbe4ff",
|
|
440
|
-
"#bac8ff",
|
|
441
|
-
"#91a7ff",
|
|
442
|
-
"#748ffc",
|
|
443
|
-
"#5c7cfa",
|
|
444
|
-
"#4c6ef5",
|
|
445
|
-
"#4263eb",
|
|
446
|
-
"#3b5bdb",
|
|
447
|
-
"#364fc7"
|
|
448
|
-
],
|
|
449
|
-
blue: [
|
|
450
|
-
"#e7f5ff",
|
|
451
|
-
"#d0ebff",
|
|
452
|
-
"#a5d8ff",
|
|
453
|
-
"#74c0fc",
|
|
454
|
-
"#4dabf7",
|
|
455
|
-
"#339af0",
|
|
456
|
-
"#228be6",
|
|
457
|
-
"#1c7ed6",
|
|
458
|
-
"#1971c2",
|
|
459
|
-
"#1864ab"
|
|
460
|
-
],
|
|
461
|
-
cyan: [
|
|
462
|
-
"#e3fafc",
|
|
463
|
-
"#c5f6fa",
|
|
464
|
-
"#99e9f2",
|
|
465
|
-
"#66d9e8",
|
|
466
|
-
"#3bc9db",
|
|
467
|
-
"#22b8cf",
|
|
468
|
-
"#15aabf",
|
|
469
|
-
"#1098ad",
|
|
470
|
-
"#0c8599",
|
|
471
|
-
"#0b7285"
|
|
472
|
-
],
|
|
473
|
-
teal: [
|
|
474
|
-
"#e6fcf5",
|
|
475
|
-
"#c3fae8",
|
|
476
|
-
"#96f2d7",
|
|
477
|
-
"#63e6be",
|
|
478
|
-
"#38d9a9",
|
|
479
|
-
"#20c997",
|
|
480
|
-
"#12b886",
|
|
481
|
-
"#0ca678",
|
|
482
|
-
"#099268",
|
|
483
|
-
"#087f5b"
|
|
484
|
-
],
|
|
485
|
-
green: [
|
|
486
|
-
"#ebfbee",
|
|
487
|
-
"#d3f9d8",
|
|
488
|
-
"#b2f2bb",
|
|
489
|
-
"#8ce99a",
|
|
490
|
-
"#69db7c",
|
|
491
|
-
"#51cf66",
|
|
492
|
-
"#40c057",
|
|
493
|
-
"#37b24d",
|
|
494
|
-
"#2f9e44",
|
|
495
|
-
"#2b8a3e"
|
|
496
|
-
],
|
|
497
|
-
lime: [
|
|
498
|
-
"#f4fce3",
|
|
499
|
-
"#e9fac8",
|
|
500
|
-
"#d8f5a2",
|
|
501
|
-
"#c0eb75",
|
|
502
|
-
"#a9e34b",
|
|
503
|
-
"#94d82d",
|
|
504
|
-
"#82c91e",
|
|
505
|
-
"#74b816",
|
|
506
|
-
"#66a80f",
|
|
507
|
-
"#5c940d"
|
|
508
|
-
],
|
|
509
|
-
yellow: [
|
|
510
|
-
"#fff9db",
|
|
511
|
-
"#fff3bf",
|
|
512
|
-
"#ffec99",
|
|
513
|
-
"#ffe066",
|
|
514
|
-
"#ffd43b",
|
|
515
|
-
"#fcc419",
|
|
516
|
-
"#fab005",
|
|
517
|
-
"#f59f00",
|
|
518
|
-
"#f08c00",
|
|
519
|
-
"#e67700"
|
|
520
|
-
],
|
|
521
|
-
orange: [
|
|
522
|
-
"#fff4e6",
|
|
523
|
-
"#ffe8cc",
|
|
524
|
-
"#ffd8a8",
|
|
525
|
-
"#ffc078",
|
|
526
|
-
"#ffa94d",
|
|
527
|
-
"#ff922b",
|
|
528
|
-
"#fd7e14",
|
|
529
|
-
"#f76707",
|
|
530
|
-
"#e8590c",
|
|
531
|
-
"#d9480f"
|
|
532
|
-
]
|
|
533
|
-
};
|
|
534
|
-
|
|
535
373
|
// ../../node_modules/tinycolor2/esm/tinycolor.js
|
|
536
374
|
init_define_import_meta_env();
|
|
537
375
|
function _typeof(obj) {
|
|
@@ -1577,7 +1415,6 @@ var applyDarkModeFilter = (color) => {
|
|
|
1577
1415
|
}
|
|
1578
1416
|
return result;
|
|
1579
1417
|
};
|
|
1580
|
-
var COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
|
|
1581
1418
|
var pick = (source, keys) => {
|
|
1582
1419
|
return keys.reduce((acc, key) => {
|
|
1583
1420
|
if (key in source) {
|
|
@@ -1591,28 +1428,24 @@ var COLORS_PER_ROW = 5;
|
|
|
1591
1428
|
var DEFAULT_CHART_COLOR_INDEX = 4;
|
|
1592
1429
|
var DEFAULT_ELEMENT_STROKE_COLOR_INDEX = 4;
|
|
1593
1430
|
var DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX = 1;
|
|
1594
|
-
var ELEMENTS_PALETTE_SHADE_INDEXES = [0, 2, 4, 6, 8];
|
|
1595
|
-
var CANVAS_PALETTE_SHADE_INDEXES = [0, 1, 2, 3, 4];
|
|
1596
|
-
var getSpecificColorShades = (color, indexArr) => {
|
|
1597
|
-
return indexArr.map((index) => open_color_default[color][index]);
|
|
1598
|
-
};
|
|
1599
1431
|
var COLOR_PALETTE = {
|
|
1600
1432
|
transparent: "transparent",
|
|
1601
1433
|
black: "#1e1e1e",
|
|
1602
1434
|
white: "#ffffff",
|
|
1603
|
-
// open-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1435
|
+
// open-color from https://github.com/yeun/open-color/blob/master/open-color.js
|
|
1436
|
+
// corresponds to indexes [0,2,4,6,8] (weights: 50, 200, 400, 600, 800)
|
|
1437
|
+
gray: ["#f8f9fa", "#e9ecef", "#ced4da", "#868e96", "#343a40"],
|
|
1438
|
+
red: ["#fff5f5", "#ffc9c9", "#ff8787", "#fa5252", "#e03131"],
|
|
1439
|
+
pink: ["#fff0f6", "#fcc2d7", "#f783ac", "#e64980", "#c2255c"],
|
|
1440
|
+
grape: ["#f8f0fc", "#eebefa", "#da77f2", "#be4bdb", "#9c36b5"],
|
|
1441
|
+
violet: ["#f3f0ff", "#d0bfff", "#9775fa", "#7950f2", "#6741d9"],
|
|
1442
|
+
blue: ["#e7f5ff", "#a5d8ff", "#4dabf7", "#228be6", "#1971c2"],
|
|
1443
|
+
cyan: ["#e3fafc", "#99e9f2", "#3bc9db", "#15aabf", "#0c8599"],
|
|
1444
|
+
teal: ["#e6fcf5", "#96f2d7", "#38d9a9", "#12b886", "#099268"],
|
|
1445
|
+
green: ["#ebfbee", "#b2f2bb", "#69db7c", "#40c057", "#2f9e44"],
|
|
1446
|
+
yellow: ["#fff9db", "#ffec99", "#ffd43b", "#fab005", "#f08c00"],
|
|
1447
|
+
orange: ["#fff4e6", "#ffd8a8", "#ffa94d", "#fd7e14", "#e8590c"],
|
|
1448
|
+
// radix bronze shades [3,5,7,9,11]
|
|
1616
1449
|
bronze: ["#f8f1ee", "#eaddd7", "#d2bab0", "#a18072", "#846358"]
|
|
1617
1450
|
};
|
|
1618
1451
|
var COMMON_ELEMENT_SHADES = pick(COLOR_PALETTE, [
|
|
@@ -1692,6 +1525,50 @@ var rgbToHex2 = (r, g, b, a) => {
|
|
|
1692
1525
|
}
|
|
1693
1526
|
return hex6;
|
|
1694
1527
|
};
|
|
1528
|
+
var colorToHex = (color) => {
|
|
1529
|
+
const tc = tinycolor(color);
|
|
1530
|
+
if (!tc.isValid()) {
|
|
1531
|
+
return null;
|
|
1532
|
+
}
|
|
1533
|
+
const { r, g, b, a } = tc.toRgb();
|
|
1534
|
+
return rgbToHex2(r, g, b, a);
|
|
1535
|
+
};
|
|
1536
|
+
var isTransparent = (color) => {
|
|
1537
|
+
return tinycolor(color).getAlpha() === 0;
|
|
1538
|
+
};
|
|
1539
|
+
var COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
|
|
1540
|
+
var calculateContrast = (r, g, b) => {
|
|
1541
|
+
const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
1542
|
+
return yiq;
|
|
1543
|
+
};
|
|
1544
|
+
var isColorDark = (color, threshold = 160) => {
|
|
1545
|
+
if (!color) {
|
|
1546
|
+
return true;
|
|
1547
|
+
}
|
|
1548
|
+
if (isTransparent(color)) {
|
|
1549
|
+
return false;
|
|
1550
|
+
}
|
|
1551
|
+
const tc = tinycolor(color);
|
|
1552
|
+
if (!tc.isValid()) {
|
|
1553
|
+
return true;
|
|
1554
|
+
}
|
|
1555
|
+
const { r, g, b } = tc.toRgb();
|
|
1556
|
+
return calculateContrast(r, g, b) < threshold;
|
|
1557
|
+
};
|
|
1558
|
+
var normalizeInputColor = (color) => {
|
|
1559
|
+
color = color.trim();
|
|
1560
|
+
if (isTransparent(color)) {
|
|
1561
|
+
return color;
|
|
1562
|
+
}
|
|
1563
|
+
const tc = tinycolor(color);
|
|
1564
|
+
if (tc.isValid()) {
|
|
1565
|
+
if (["hex", "hex8"].includes(tc.getFormat()) && !color.startsWith("#")) {
|
|
1566
|
+
return `#${color}`;
|
|
1567
|
+
}
|
|
1568
|
+
return color;
|
|
1569
|
+
}
|
|
1570
|
+
return null;
|
|
1571
|
+
};
|
|
1695
1572
|
|
|
1696
1573
|
// src/constants.ts
|
|
1697
1574
|
init_define_import_meta_env();
|
|
@@ -1782,7 +1659,8 @@ var CLASSES = {
|
|
|
1782
1659
|
SEARCH_MENU_INPUT_WRAPPER: "layer-ui__search-inputWrapper",
|
|
1783
1660
|
CONVERT_ELEMENT_TYPE_POPUP: "ConvertElementTypePopup",
|
|
1784
1661
|
SHAPE_ACTIONS_THEME_SCOPE: "shape-actions-theme-scope",
|
|
1785
|
-
FRAME_NAME: "frame-name"
|
|
1662
|
+
FRAME_NAME: "frame-name",
|
|
1663
|
+
DROPDOWN_MENU_EVENT_WRAPPER: "dropdown-menu-event-wrapper"
|
|
1786
1664
|
};
|
|
1787
1665
|
var FONT_SIZES = {
|
|
1788
1666
|
sm: 16,
|
|
@@ -1841,6 +1719,7 @@ var THEME = {
|
|
|
1841
1719
|
LIGHT: "light",
|
|
1842
1720
|
DARK: "dark"
|
|
1843
1721
|
};
|
|
1722
|
+
var DARK_THEME_FILTER = "invert(93%) hue-rotate(180deg)";
|
|
1844
1723
|
var FRAME_STYLE = {
|
|
1845
1724
|
strokeColor: "#bbb",
|
|
1846
1725
|
strokeWidth: 2,
|
|
@@ -1889,6 +1768,7 @@ var STRING_MIME_TYPES = {
|
|
|
1889
1768
|
json: "application/json",
|
|
1890
1769
|
// excalidraw data
|
|
1891
1770
|
excalidraw: "application/vnd.excalidraw+json",
|
|
1771
|
+
excalidrawClipboard: "application/vnd.excalidraw.clipboard+json",
|
|
1892
1772
|
// LEGACY: fully-qualified library JSON data
|
|
1893
1773
|
excalidrawlib: "application/vnd.excalidrawlib+json",
|
|
1894
1774
|
// list of excalidraw library item ids
|
|
@@ -2240,7 +2120,7 @@ var MQ_MAX_MOBILE = 599;
|
|
|
2240
2120
|
var MQ_MAX_WIDTH_LANDSCAPE = 1e3;
|
|
2241
2121
|
var MQ_MAX_HEIGHT_LANDSCAPE = 500;
|
|
2242
2122
|
var MQ_MIN_TABLET = MQ_MAX_MOBILE + 1;
|
|
2243
|
-
var MQ_MAX_TABLET =
|
|
2123
|
+
var MQ_MAX_TABLET = 1180;
|
|
2244
2124
|
var MQ_MIN_WIDTH_DESKTOP = 1440;
|
|
2245
2125
|
var MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
|
|
2246
2126
|
var isDarwin = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
@@ -2604,7 +2484,7 @@ var isInteractive = (target) => {
|
|
|
2604
2484
|
return isInputLike(target) || target instanceof Element && !!target.closest("label, button");
|
|
2605
2485
|
};
|
|
2606
2486
|
var isWritableElement = (target) => target instanceof HTMLElement && target.dataset.type === "wysiwyg" || target instanceof HTMLBRElement || // newline in wysiwyg
|
|
2607
|
-
target instanceof HTMLTextAreaElement || target instanceof HTMLInputElement && (target.type === "text" || target.type === "number" || target.type === "password" || target.type === "search");
|
|
2487
|
+
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;
|
|
2608
2488
|
var getFontFamilyString = ({
|
|
2609
2489
|
fontFamily
|
|
2610
2490
|
}) => {
|
|
@@ -2885,9 +2765,6 @@ var mapFind = (collection, iteratee) => {
|
|
|
2885
2765
|
}
|
|
2886
2766
|
return void 0;
|
|
2887
2767
|
};
|
|
2888
|
-
var isTransparent = (color) => {
|
|
2889
|
-
return tinycolor(color).getAlpha() === 0;
|
|
2890
|
-
};
|
|
2891
2768
|
var resolvablePromise = () => {
|
|
2892
2769
|
let resolve;
|
|
2893
2770
|
let reject;
|
|
@@ -3282,6 +3159,9 @@ var setFeatureFlag = (flag, value) => {
|
|
|
3282
3159
|
console.error("unable to set feature flag", e);
|
|
3283
3160
|
}
|
|
3284
3161
|
};
|
|
3162
|
+
var oneOf = (needle, haystack) => {
|
|
3163
|
+
return haystack.includes(needle);
|
|
3164
|
+
};
|
|
3285
3165
|
|
|
3286
3166
|
// src/random.ts
|
|
3287
3167
|
var random = new Random(Date.now());
|
|
@@ -3356,105 +3236,172 @@ var Emitter = class {
|
|
|
3356
3236
|
}
|
|
3357
3237
|
};
|
|
3358
3238
|
|
|
3359
|
-
//
|
|
3239
|
+
// debug.ts
|
|
3360
3240
|
init_define_import_meta_env();
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
};
|
|
3383
|
-
var debugDrawPoint = (p, opts) => {
|
|
3384
|
-
const xOffset = opts?.fuzzy ? Math.random() * 3 : 0;
|
|
3385
|
-
const yOffset = opts?.fuzzy ? Math.random() * 3 : 0;
|
|
3386
|
-
debugDrawLine(
|
|
3387
|
-
lineSegment(
|
|
3388
|
-
pointFrom(p[0] + xOffset - 10, p[1] + yOffset - 10),
|
|
3389
|
-
pointFrom(p[0] + xOffset + 10, p[1] + yOffset + 10)
|
|
3390
|
-
),
|
|
3391
|
-
{
|
|
3392
|
-
color: opts?.color ?? "cyan",
|
|
3393
|
-
permanent: opts?.permanent
|
|
3241
|
+
var lessPrecise = (num, precision = 5) => parseFloat(num.toPrecision(precision));
|
|
3242
|
+
var getAvgFrameTime = (times) => lessPrecise(times.reduce((a, b) => a + b) / times.length);
|
|
3243
|
+
var Debug = class _Debug {
|
|
3244
|
+
static DEBUG_LOG_TIMES = true;
|
|
3245
|
+
static TIMES_AGGR = {};
|
|
3246
|
+
static TIMES_AVG = {};
|
|
3247
|
+
static LAST_DEBUG_LOG_CALL = 0;
|
|
3248
|
+
static DEBUG_LOG_INTERVAL_ID = null;
|
|
3249
|
+
static LAST_FRAME_TIMESTAMP = 0;
|
|
3250
|
+
static FRAME_COUNT = 0;
|
|
3251
|
+
static ANIMATION_FRAME_ID = null;
|
|
3252
|
+
static scheduleAnimationFrame = () => {
|
|
3253
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3254
|
+
_Debug.ANIMATION_FRAME_ID = requestAnimationFrame((timestamp) => {
|
|
3255
|
+
if (_Debug.LAST_FRAME_TIMESTAMP !== timestamp) {
|
|
3256
|
+
_Debug.LAST_FRAME_TIMESTAMP = timestamp;
|
|
3257
|
+
_Debug.FRAME_COUNT++;
|
|
3258
|
+
}
|
|
3259
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3260
|
+
_Debug.scheduleAnimationFrame();
|
|
3261
|
+
}
|
|
3262
|
+
});
|
|
3394
3263
|
}
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
{
|
|
3402
|
-
color: opts?.color ?? "cyan",
|
|
3403
|
-
permanent: opts?.permanent
|
|
3264
|
+
};
|
|
3265
|
+
static setupInterval = () => {
|
|
3266
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID === null) {
|
|
3267
|
+
console.info("%c(starting perf recording)", "color: lime");
|
|
3268
|
+
_Debug.DEBUG_LOG_INTERVAL_ID = window.setInterval(_Debug.debugLogger, 1e3);
|
|
3269
|
+
_Debug.scheduleAnimationFrame();
|
|
3404
3270
|
}
|
|
3405
|
-
|
|
3406
|
-
};
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
),
|
|
3419
|
-
lineSegment(
|
|
3420
|
-
pointFrom(bbox[2], bbox[3]),
|
|
3421
|
-
pointFrom(bbox[0], bbox[3])
|
|
3422
|
-
),
|
|
3423
|
-
lineSegment(
|
|
3424
|
-
pointFrom(bbox[0], bbox[3]),
|
|
3425
|
-
pointFrom(bbox[0], bbox[1])
|
|
3426
|
-
)
|
|
3427
|
-
],
|
|
3428
|
-
{
|
|
3429
|
-
color: opts?.color ?? "green",
|
|
3430
|
-
permanent: !!opts?.permanent
|
|
3271
|
+
_Debug.LAST_DEBUG_LOG_CALL = Date.now();
|
|
3272
|
+
};
|
|
3273
|
+
static debugLogger = () => {
|
|
3274
|
+
if (_Debug.DEBUG_LOG_TIMES) {
|
|
3275
|
+
for (const [name, { t, times }] of Object.entries(_Debug.TIMES_AGGR)) {
|
|
3276
|
+
if (times.length) {
|
|
3277
|
+
console.info(
|
|
3278
|
+
name,
|
|
3279
|
+
lessPrecise(times.reduce((a, b) => a + b)),
|
|
3280
|
+
times.sort((a, b) => a - b).map((x) => lessPrecise(x))
|
|
3281
|
+
);
|
|
3282
|
+
_Debug.TIMES_AGGR[name] = { t, times: [] };
|
|
3283
|
+
}
|
|
3431
3284
|
}
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3285
|
+
for (const [name, { t, times, avg }] of Object.entries(_Debug.TIMES_AVG)) {
|
|
3286
|
+
if (times.length) {
|
|
3287
|
+
const totalTime = times.reduce((a, b) => a + b);
|
|
3288
|
+
const avgFrameTime = lessPrecise(totalTime / _Debug.FRAME_COUNT);
|
|
3289
|
+
console.info(
|
|
3290
|
+
name,
|
|
3291
|
+
`- ${times.length} calls - ${avgFrameTime}ms/frame across ${_Debug.FRAME_COUNT} frames (${lessPrecise(
|
|
3292
|
+
avgFrameTime / 16.67 * 100,
|
|
3293
|
+
1
|
|
3294
|
+
)}% of frame budget)`
|
|
3295
|
+
);
|
|
3296
|
+
_Debug.TIMES_AVG[name] = {
|
|
3297
|
+
t,
|
|
3298
|
+
times: [],
|
|
3299
|
+
avg: avg != null ? getAvgFrameTime([avg, avgFrameTime]) : avgFrameTime
|
|
3300
|
+
};
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
_Debug.FRAME_COUNT = 0;
|
|
3305
|
+
if (Date.now() - _Debug.LAST_DEBUG_LOG_CALL > 600 && _Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3306
|
+
console.info("%c(stopping perf recording)", "color: red");
|
|
3307
|
+
window.clearInterval(_Debug.DEBUG_LOG_INTERVAL_ID);
|
|
3308
|
+
window.cancelAnimationFrame(_Debug.ANIMATION_FRAME_ID);
|
|
3309
|
+
_Debug.ANIMATION_FRAME_ID = null;
|
|
3310
|
+
_Debug.FRAME_COUNT = 0;
|
|
3311
|
+
_Debug.LAST_FRAME_TIMESTAMP = 0;
|
|
3312
|
+
_Debug.DEBUG_LOG_INTERVAL_ID = null;
|
|
3313
|
+
_Debug.TIMES_AGGR = {};
|
|
3314
|
+
_Debug.TIMES_AVG = {};
|
|
3315
|
+
}
|
|
3316
|
+
};
|
|
3317
|
+
static logTime = (time, name = "default") => {
|
|
3318
|
+
_Debug.setupInterval();
|
|
3319
|
+
const now = performance.now();
|
|
3320
|
+
const { t, times } = _Debug.TIMES_AGGR[name] = _Debug.TIMES_AGGR[name] || {
|
|
3321
|
+
t: 0,
|
|
3322
|
+
times: []
|
|
3323
|
+
};
|
|
3324
|
+
if (t) {
|
|
3325
|
+
times.push(time != null ? time : now - t);
|
|
3326
|
+
}
|
|
3327
|
+
_Debug.TIMES_AGGR[name].t = now;
|
|
3328
|
+
};
|
|
3329
|
+
static logTimeAverage = (time, name = "default") => {
|
|
3330
|
+
_Debug.setupInterval();
|
|
3331
|
+
const now = performance.now();
|
|
3332
|
+
const { t, times } = _Debug.TIMES_AVG[name] = _Debug.TIMES_AVG[name] || {
|
|
3333
|
+
t: 0,
|
|
3334
|
+
times: []
|
|
3335
|
+
};
|
|
3336
|
+
if (t) {
|
|
3337
|
+
times.push(time != null ? time : now - t);
|
|
3338
|
+
}
|
|
3339
|
+
_Debug.TIMES_AVG[name].t = now;
|
|
3340
|
+
};
|
|
3341
|
+
static logWrapper = (type) => (fn, name = "default") => {
|
|
3342
|
+
return (...args) => {
|
|
3343
|
+
const t0 = performance.now();
|
|
3344
|
+
const ret = fn(...args);
|
|
3345
|
+
_Debug[type](performance.now() - t0, name);
|
|
3346
|
+
return ret;
|
|
3347
|
+
};
|
|
3348
|
+
};
|
|
3349
|
+
static logTimeWrap = _Debug.logWrapper("logTime");
|
|
3350
|
+
static logTimeAverageWrap = _Debug.logWrapper("logTimeAverage");
|
|
3351
|
+
static perfWrap = (fn, name = "default") => {
|
|
3352
|
+
return (...args) => {
|
|
3353
|
+
console.time(name);
|
|
3354
|
+
const ret = fn(...args);
|
|
3355
|
+
console.timeEnd(name);
|
|
3356
|
+
return ret;
|
|
3357
|
+
};
|
|
3358
|
+
};
|
|
3359
|
+
static CHANGED_CACHE = {};
|
|
3360
|
+
static logChanged(name, obj) {
|
|
3361
|
+
const prev = _Debug.CHANGED_CACHE[name];
|
|
3362
|
+
_Debug.CHANGED_CACHE[name] = obj;
|
|
3363
|
+
if (!prev) {
|
|
3364
|
+
return;
|
|
3365
|
+
}
|
|
3366
|
+
const allKeys = /* @__PURE__ */ new Set([...Object.keys(prev), ...Object.keys(obj)]);
|
|
3367
|
+
const changed = {};
|
|
3368
|
+
for (const key of allKeys) {
|
|
3369
|
+
const prevVal = prev[key];
|
|
3370
|
+
const nextVal = obj[key];
|
|
3371
|
+
if (!deepEqual(prevVal, nextVal)) {
|
|
3372
|
+
changed[key] = { prev: prevVal, next: nextVal };
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
if (Object.keys(changed).length > 0) {
|
|
3376
|
+
console.info(`[${name}] changed:`, changed);
|
|
3377
|
+
}
|
|
3450
3378
|
}
|
|
3451
3379
|
};
|
|
3452
|
-
|
|
3453
|
-
if (
|
|
3454
|
-
|
|
3380
|
+
function deepEqual(a, b) {
|
|
3381
|
+
if (Object.is(a, b)) {
|
|
3382
|
+
return true;
|
|
3455
3383
|
}
|
|
3456
|
-
|
|
3457
|
-
|
|
3384
|
+
if (a === null || b === null || typeof a !== "object" || typeof b !== "object") {
|
|
3385
|
+
return false;
|
|
3386
|
+
}
|
|
3387
|
+
if (Array.isArray(a) !== Array.isArray(b)) {
|
|
3388
|
+
return false;
|
|
3389
|
+
}
|
|
3390
|
+
const keysA = Object.keys(a);
|
|
3391
|
+
const keysB = Object.keys(b);
|
|
3392
|
+
if (keysA.length !== keysB.length) {
|
|
3393
|
+
return false;
|
|
3394
|
+
}
|
|
3395
|
+
for (const key of keysA) {
|
|
3396
|
+
if (!deepEqual(
|
|
3397
|
+
a[key],
|
|
3398
|
+
b[key]
|
|
3399
|
+
)) {
|
|
3400
|
+
return false;
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
return true;
|
|
3404
|
+
}
|
|
3458
3405
|
export {
|
|
3459
3406
|
ACTIVE_THRESHOLD,
|
|
3460
3407
|
ALLOWED_PASTE_MIME_TYPES,
|
|
@@ -3466,7 +3413,6 @@ export {
|
|
|
3466
3413
|
BOUND_TEXT_PADDING,
|
|
3467
3414
|
BinaryHeap,
|
|
3468
3415
|
CANVAS_ONLY_ACTIONS,
|
|
3469
|
-
CANVAS_PALETTE_SHADE_INDEXES,
|
|
3470
3416
|
CANVAS_SEARCH_TAB,
|
|
3471
3417
|
CJK_HAND_DRAWN_FALLBACK_FONT,
|
|
3472
3418
|
CLASSES,
|
|
@@ -3478,6 +3424,7 @@ export {
|
|
|
3478
3424
|
COLOR_VOICE_CALL,
|
|
3479
3425
|
COLOR_WHITE,
|
|
3480
3426
|
CURSOR_TYPE,
|
|
3427
|
+
DARK_THEME_FILTER,
|
|
3481
3428
|
DEFAULT_ADAPTIVE_RADIUS,
|
|
3482
3429
|
DEFAULT_CANVAS_BACKGROUND_PICKS,
|
|
3483
3430
|
DEFAULT_CHART_COLOR_INDEX,
|
|
@@ -3507,8 +3454,8 @@ export {
|
|
|
3507
3454
|
DEFAULT_VERTICAL_ALIGN,
|
|
3508
3455
|
DOUBLE_TAP_POSITION_THRESHOLD,
|
|
3509
3456
|
DRAGGING_THRESHOLD,
|
|
3457
|
+
Debug,
|
|
3510
3458
|
EDITOR_LS_KEYS,
|
|
3511
|
-
ELEMENTS_PALETTE_SHADE_INDEXES,
|
|
3512
3459
|
ELEMENT_LINK_KEY,
|
|
3513
3460
|
ELEMENT_READY_TO_ERASE_OPACITY,
|
|
3514
3461
|
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
|
@@ -3603,16 +3550,10 @@ export {
|
|
|
3603
3550
|
castArray,
|
|
3604
3551
|
chunk,
|
|
3605
3552
|
cloneJSON,
|
|
3553
|
+
colorToHex,
|
|
3606
3554
|
composeEventHandlers,
|
|
3607
3555
|
createUserAgentDescriptor,
|
|
3608
3556
|
debounce,
|
|
3609
|
-
debugClear,
|
|
3610
|
-
debugCloseFrame,
|
|
3611
|
-
debugDrawBounds,
|
|
3612
|
-
debugDrawCubicBezier,
|
|
3613
|
-
debugDrawLine,
|
|
3614
|
-
debugDrawPoint,
|
|
3615
|
-
debugDrawPoints,
|
|
3616
3557
|
deriveStylesPanelMode,
|
|
3617
3558
|
distance,
|
|
3618
3559
|
easeOut,
|
|
@@ -3637,7 +3578,6 @@ export {
|
|
|
3637
3578
|
getLineHeight,
|
|
3638
3579
|
getNearestScrollableContainer,
|
|
3639
3580
|
getSizeFromPoints,
|
|
3640
|
-
getSpecificColorShades,
|
|
3641
3581
|
getSvgPathFromStroke,
|
|
3642
3582
|
getUpdatedTimestamp,
|
|
3643
3583
|
getVersion,
|
|
@@ -3649,6 +3589,7 @@ export {
|
|
|
3649
3589
|
isBounds,
|
|
3650
3590
|
isBrave,
|
|
3651
3591
|
isChrome,
|
|
3592
|
+
isColorDark,
|
|
3652
3593
|
isDarwin,
|
|
3653
3594
|
isDevEnv,
|
|
3654
3595
|
isFirefox,
|
|
@@ -3684,7 +3625,9 @@ export {
|
|
|
3684
3625
|
nFormatter,
|
|
3685
3626
|
nextAnimationFrame,
|
|
3686
3627
|
normalizeEOL,
|
|
3628
|
+
normalizeInputColor,
|
|
3687
3629
|
normalizeLink,
|
|
3630
|
+
oneOf,
|
|
3688
3631
|
preventUnload,
|
|
3689
3632
|
promiseTry,
|
|
3690
3633
|
queryFocusableElements,
|
|
@@ -3709,7 +3652,6 @@ export {
|
|
|
3709
3652
|
supportsEmoji,
|
|
3710
3653
|
supportsResizeObserver,
|
|
3711
3654
|
throttleRAF,
|
|
3712
|
-
tinycolor,
|
|
3713
3655
|
toArray,
|
|
3714
3656
|
toBrandedType,
|
|
3715
3657
|
toIterable,
|