@excalidraw/common 0.18.0-ab0255f → 0.18.0-abeeaeb
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 +39 -4
- package/dist/dev/index.js.map +2 -2
- package/dist/prod/index.js +3 -3
- package/dist/types/common/src/colors.d.ts +5 -7
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +35 -14
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionExport.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +15 -6
- package/dist/types/excalidraw/actions/actionGroup.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionLink.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionMenu.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionProperties.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +5 -2
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -2
- package/dist/types/excalidraw/appState.d.ts +5 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +14 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +2 -3
- package/dist/types/excalidraw/components/App.d.ts +12 -5
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +6 -2
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +4 -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/topPicksDnD.d.ts +31 -0
- package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
- 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/icons.d.ts +3 -0
- package/dist/types/excalidraw/data/blob.d.ts +10 -4
- package/dist/types/excalidraw/data/json.d.ts +5 -2
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/types.d.ts +47 -4
- package/dist/types/excalidraw/viewport.d.ts +5 -2
- package/package.json +1 -1
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
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],
|
|
@@ -1513,7 +1548,6 @@ var DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE = {
|
|
|
1513
1548
|
bronze: COLOR_PALETTE.bronze,
|
|
1514
1549
|
...COMMON_ELEMENT_SHADES
|
|
1515
1550
|
};
|
|
1516
|
-
var getBucketFillBackgroundColor = (backgroundColor) => isTransparent(backgroundColor) ? COLOR_PALETTE.green[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX] : backgroundColor;
|
|
1517
1551
|
var getAllColorsSpecificShade = (index) => [
|
|
1518
1552
|
// 2nd row
|
|
1519
1553
|
COLOR_PALETTE.cyan[index],
|
|
@@ -3519,6 +3553,7 @@ export {
|
|
|
3519
3553
|
COLOR_CHARCOAL_BLACK,
|
|
3520
3554
|
COLOR_OUTLINE_CONTRAST_THRESHOLD,
|
|
3521
3555
|
COLOR_PALETTE,
|
|
3556
|
+
COLOR_TOP_PICKS_SLOTS,
|
|
3522
3557
|
COLOR_VOICE_CALL,
|
|
3523
3558
|
COLOR_WHITE,
|
|
3524
3559
|
CURSOR_TYPE,
|
|
@@ -3667,7 +3702,6 @@ export {
|
|
|
3667
3702
|
findLastIndex,
|
|
3668
3703
|
focusNearestParent,
|
|
3669
3704
|
getAllColorsSpecificShade,
|
|
3670
|
-
getBucketFillBackgroundColor,
|
|
3671
3705
|
getDateTime,
|
|
3672
3706
|
getExportSource,
|
|
3673
3707
|
getFeatureFlag,
|
|
@@ -3740,6 +3774,7 @@ export {
|
|
|
3740
3774
|
randomId,
|
|
3741
3775
|
randomInteger,
|
|
3742
3776
|
reduceToCommonValue,
|
|
3777
|
+
removeDarkModeFilter,
|
|
3743
3778
|
removeSelection,
|
|
3744
3779
|
rescalePoints,
|
|
3745
3780
|
reseed,
|