microboard-temp 0.6.5 → 0.7.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/cjs/browser.js +245 -34
- package/dist/cjs/index.js +245 -34
- package/dist/cjs/node.js +245 -34
- package/dist/esm/browser.js +245 -34
- package/dist/esm/index.js +245 -34
- package/dist/esm/node.js +245 -34
- package/dist/types/Color/ColorValue.d.ts +54 -0
- package/dist/types/Color/ContrastPalette.d.ts +45 -0
- package/dist/types/Color/colorUtils.d.ts +32 -0
- package/dist/types/Color/index.d.ts +6 -0
- package/dist/types/Color/resolveColor.d.ts +26 -0
- package/dist/types/Items/Connector/Connector.d.ts +4 -3
- package/dist/types/Items/Connector/ConnectorOperations.d.ts +3 -2
- package/dist/types/Items/Drawing/Drawing.d.ts +5 -3
- package/dist/types/Items/Drawing/DrawingOperation.d.ts +2 -1
- package/dist/types/Items/Frame/Frame.d.ts +7 -6
- package/dist/types/Items/Frame/FrameData.d.ts +6 -5
- package/dist/types/Items/Frame/FrameOperation.d.ts +2 -1
- package/dist/types/Items/Mbr/Mbr.d.ts +3 -3
- package/dist/types/Items/Shape/Shape.d.ts +9 -8
- package/dist/types/Items/Shape/ShapeData.d.ts +6 -5
- package/dist/types/Items/Shape/ShapeOperation.d.ts +3 -2
- package/dist/types/Items/Sticker/Sticker.d.ts +5 -4
- package/dist/types/Items/Sticker/StickerOperation.d.ts +4 -3
- package/dist/types/Settings.d.ts +7 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/node.js
CHANGED
|
@@ -1674,12 +1674,17 @@ __export(exports_node, {
|
|
|
1674
1674
|
tempStorage: () => tempStorage,
|
|
1675
1675
|
tagByType: () => tagByType,
|
|
1676
1676
|
stickerColors: () => stickerColors,
|
|
1677
|
+
srgbChannelToLinear: () => srgbChannelToLinear,
|
|
1677
1678
|
sha256: () => sha256,
|
|
1679
|
+
semanticColor: () => semanticColor,
|
|
1678
1680
|
scalePatterns: () => scalePatterns,
|
|
1679
1681
|
scaleElementBy: () => scaleElementBy,
|
|
1680
1682
|
rgbToRgba: () => rgbToRgba,
|
|
1683
|
+
resolvePairedForeground: () => resolvePairedForeground,
|
|
1684
|
+
resolveColor: () => resolveColor,
|
|
1681
1685
|
resizeAndConvertToPng: () => resizeAndConvertToPng,
|
|
1682
1686
|
resetElementScale: () => resetElementScale,
|
|
1687
|
+
relativeLuminance: () => relativeLuminance,
|
|
1683
1688
|
registerItem: () => registerItem,
|
|
1684
1689
|
quickAddItem: () => quickAddItem,
|
|
1685
1690
|
prepareVideo: () => prepareVideo,
|
|
@@ -1688,8 +1693,11 @@ __export(exports_node, {
|
|
|
1688
1693
|
positionRelatively: () => positionRelatively,
|
|
1689
1694
|
positionAbsolutely: () => positionAbsolutely,
|
|
1690
1695
|
parsersHTML: () => parsersHTML,
|
|
1696
|
+
parseCssRgb: () => parseCssRgb,
|
|
1691
1697
|
omitDefaultProperties: () => omitDefaultProperties,
|
|
1692
1698
|
messageRouter: () => messageRouter,
|
|
1699
|
+
meetsWCAG_AAA: () => meetsWCAG_AAA,
|
|
1700
|
+
meetsWCAG_AA: () => meetsWCAG_AA,
|
|
1693
1701
|
itemValidators: () => itemValidators,
|
|
1694
1702
|
itemFactories: () => itemFactories,
|
|
1695
1703
|
isShallowSimilarTo: () => isShallowSimilarTo,
|
|
@@ -1716,14 +1724,19 @@ __export(exports_node, {
|
|
|
1716
1724
|
getControlPointData: () => getControlPointData,
|
|
1717
1725
|
getBlobFromDataURL: () => getBlobFromDataURL,
|
|
1718
1726
|
forceNumberIntoInterval: () => forceNumberIntoInterval,
|
|
1727
|
+
fixedColor: () => fixedColor,
|
|
1719
1728
|
fileTosha256: () => fileTosha256,
|
|
1720
1729
|
exportBoardSnapshot: () => exportBoardSnapshot,
|
|
1721
1730
|
editModeHotkeyRegistry: () => editModeHotkeyRegistry,
|
|
1722
1731
|
decodeHtml: () => decodeHtml,
|
|
1723
1732
|
cursors: () => defaultCursors,
|
|
1733
|
+
cssContrastRatio: () => cssContrastRatio,
|
|
1724
1734
|
createVideoItem: () => createVideoItem,
|
|
1725
1735
|
createEvents: () => createEvents,
|
|
1736
|
+
contrastRatio: () => contrastRatio,
|
|
1726
1737
|
conf: () => conf,
|
|
1738
|
+
coerceOptionalColorValue: () => coerceOptionalColorValue,
|
|
1739
|
+
coerceColorValue: () => coerceColorValue,
|
|
1727
1740
|
checkHotkeys: () => checkHotkeys,
|
|
1728
1741
|
catmullRomInterpolate: () => catmullRomInterpolate,
|
|
1729
1742
|
captureFrame: () => captureFrame,
|
|
@@ -1749,6 +1762,7 @@ __export(exports_node, {
|
|
|
1749
1762
|
STEP_STROKE_WIDTH: () => STEP_STROKE_WIDTH,
|
|
1750
1763
|
SHAPE_LAST_TYPE_KEY: () => SHAPE_LAST_TYPE_KEY,
|
|
1751
1764
|
SHAPES_CATEGORIES: () => SHAPES_CATEGORIES,
|
|
1765
|
+
SEMANTIC_COLOR_IDS: () => SEMANTIC_COLOR_IDS,
|
|
1752
1766
|
RichText: () => RichText,
|
|
1753
1767
|
QuadraticBezier: () => QuadraticBezier,
|
|
1754
1768
|
Presence: () => Presence,
|
|
@@ -1800,6 +1814,8 @@ __export(exports_node, {
|
|
|
1800
1814
|
Camera: () => Camera,
|
|
1801
1815
|
CURSORS_IDLE_CLEANUP_DELAY: () => CURSORS_IDLE_CLEANUP_DELAY,
|
|
1802
1816
|
CURSORS_ANIMATION_DURATION: () => CURSORS_ANIMATION_DURATION,
|
|
1817
|
+
CONTRAST_PALETTE_LIST: () => CONTRAST_PALETTE_LIST,
|
|
1818
|
+
CONTRAST_PALETTE: () => CONTRAST_PALETTE,
|
|
1803
1819
|
CONTEXT_NODE_HIGHLIGHT_COLOR: () => CONTEXT_NODE_HIGHLIGHT_COLOR,
|
|
1804
1820
|
CONNECTOR_POINTER_TYPES: () => CONNECTOR_POINTER_TYPES,
|
|
1805
1821
|
BoardSelection: () => BoardSelection,
|
|
@@ -1815,6 +1831,184 @@ __export(exports_node, {
|
|
|
1815
1831
|
});
|
|
1816
1832
|
module.exports = __toCommonJS(exports_node);
|
|
1817
1833
|
|
|
1834
|
+
// src/Color/ColorValue.ts
|
|
1835
|
+
var SEMANTIC_COLOR_IDS = [
|
|
1836
|
+
"contrastNeutral",
|
|
1837
|
+
"contrastGray",
|
|
1838
|
+
"contrastRed",
|
|
1839
|
+
"contrastOrange",
|
|
1840
|
+
"contrastYellow",
|
|
1841
|
+
"contrastGreen",
|
|
1842
|
+
"contrastTeal",
|
|
1843
|
+
"contrastBlue",
|
|
1844
|
+
"contrastPurple",
|
|
1845
|
+
"contrastPink",
|
|
1846
|
+
"contrastBrown"
|
|
1847
|
+
];
|
|
1848
|
+
var semanticColor = (id) => ({
|
|
1849
|
+
type: "semantic",
|
|
1850
|
+
id
|
|
1851
|
+
});
|
|
1852
|
+
var fixedColor = (value) => ({
|
|
1853
|
+
type: "fixed",
|
|
1854
|
+
value
|
|
1855
|
+
});
|
|
1856
|
+
function coerceColorValue(value) {
|
|
1857
|
+
if (typeof value === "string")
|
|
1858
|
+
return fixedColor(value);
|
|
1859
|
+
return value;
|
|
1860
|
+
}
|
|
1861
|
+
function coerceOptionalColorValue(value) {
|
|
1862
|
+
if (value === undefined)
|
|
1863
|
+
return;
|
|
1864
|
+
return coerceColorValue(value);
|
|
1865
|
+
}
|
|
1866
|
+
// src/Color/ContrastPalette.ts
|
|
1867
|
+
var CONTRAST_PALETTE = {
|
|
1868
|
+
contrastNeutral: {
|
|
1869
|
+
id: "contrastNeutral",
|
|
1870
|
+
label: "Neutral",
|
|
1871
|
+
light: "rgb(245, 246, 248)",
|
|
1872
|
+
dark: "rgb(20, 21, 26)",
|
|
1873
|
+
contrastRatio: 17.2
|
|
1874
|
+
},
|
|
1875
|
+
contrastGray: {
|
|
1876
|
+
id: "contrastGray",
|
|
1877
|
+
label: "Gray",
|
|
1878
|
+
light: "rgb(224, 225, 229)",
|
|
1879
|
+
dark: "rgb(55, 58, 70)",
|
|
1880
|
+
contrastRatio: 8.6
|
|
1881
|
+
},
|
|
1882
|
+
contrastRed: {
|
|
1883
|
+
id: "contrastRed",
|
|
1884
|
+
label: "Red",
|
|
1885
|
+
light: "rgb(255, 215, 210)",
|
|
1886
|
+
dark: "rgb(120, 10, 10)",
|
|
1887
|
+
contrastRatio: 8.5
|
|
1888
|
+
},
|
|
1889
|
+
contrastOrange: {
|
|
1890
|
+
id: "contrastOrange",
|
|
1891
|
+
label: "Orange",
|
|
1892
|
+
light: "rgb(255, 229, 195)",
|
|
1893
|
+
dark: "rgb(110, 44, 0)",
|
|
1894
|
+
contrastRatio: 8.4
|
|
1895
|
+
},
|
|
1896
|
+
contrastYellow: {
|
|
1897
|
+
id: "contrastYellow",
|
|
1898
|
+
label: "Yellow",
|
|
1899
|
+
light: "rgb(255, 249, 185)",
|
|
1900
|
+
dark: "rgb(89, 71, 0)",
|
|
1901
|
+
contrastRatio: 8.3
|
|
1902
|
+
},
|
|
1903
|
+
contrastGreen: {
|
|
1904
|
+
id: "contrastGreen",
|
|
1905
|
+
label: "Green",
|
|
1906
|
+
light: "rgb(193, 243, 179)",
|
|
1907
|
+
dark: "rgb(0, 74, 22)",
|
|
1908
|
+
contrastRatio: 8.4
|
|
1909
|
+
},
|
|
1910
|
+
contrastTeal: {
|
|
1911
|
+
id: "contrastTeal",
|
|
1912
|
+
label: "Teal",
|
|
1913
|
+
light: "rgb(176, 243, 240)",
|
|
1914
|
+
dark: "rgb(0, 68, 64)",
|
|
1915
|
+
contrastRatio: 8.8
|
|
1916
|
+
},
|
|
1917
|
+
contrastBlue: {
|
|
1918
|
+
id: "contrastBlue",
|
|
1919
|
+
label: "Blue",
|
|
1920
|
+
light: "rgb(208, 222, 255)",
|
|
1921
|
+
dark: "rgb(15, 42, 148)",
|
|
1922
|
+
contrastRatio: 8.7
|
|
1923
|
+
},
|
|
1924
|
+
contrastPurple: {
|
|
1925
|
+
id: "contrastPurple",
|
|
1926
|
+
label: "Purple",
|
|
1927
|
+
light: "rgb(232, 210, 255)",
|
|
1928
|
+
dark: "rgb(62, 0, 132)",
|
|
1929
|
+
contrastRatio: 9.8
|
|
1930
|
+
},
|
|
1931
|
+
contrastPink: {
|
|
1932
|
+
id: "contrastPink",
|
|
1933
|
+
label: "Pink",
|
|
1934
|
+
light: "rgb(255, 212, 228)",
|
|
1935
|
+
dark: "rgb(120, 0, 55)",
|
|
1936
|
+
contrastRatio: 8.5
|
|
1937
|
+
},
|
|
1938
|
+
contrastBrown: {
|
|
1939
|
+
id: "contrastBrown",
|
|
1940
|
+
label: "Brown",
|
|
1941
|
+
light: "rgb(242, 224, 200)",
|
|
1942
|
+
dark: "rgb(74, 33, 0)",
|
|
1943
|
+
contrastRatio: 10.7
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
var CONTRAST_PALETTE_LIST = [
|
|
1947
|
+
CONTRAST_PALETTE.contrastNeutral,
|
|
1948
|
+
CONTRAST_PALETTE.contrastGray,
|
|
1949
|
+
CONTRAST_PALETTE.contrastRed,
|
|
1950
|
+
CONTRAST_PALETTE.contrastOrange,
|
|
1951
|
+
CONTRAST_PALETTE.contrastYellow,
|
|
1952
|
+
CONTRAST_PALETTE.contrastGreen,
|
|
1953
|
+
CONTRAST_PALETTE.contrastTeal,
|
|
1954
|
+
CONTRAST_PALETTE.contrastBlue,
|
|
1955
|
+
CONTRAST_PALETTE.contrastPurple,
|
|
1956
|
+
CONTRAST_PALETTE.contrastPink,
|
|
1957
|
+
CONTRAST_PALETTE.contrastBrown
|
|
1958
|
+
];
|
|
1959
|
+
// src/Color/resolveColor.ts
|
|
1960
|
+
function resolveColor(value, theme, role) {
|
|
1961
|
+
if (typeof value === "string")
|
|
1962
|
+
return value;
|
|
1963
|
+
if (value.type === "fixed") {
|
|
1964
|
+
return value.value;
|
|
1965
|
+
}
|
|
1966
|
+
const pair = CONTRAST_PALETTE[value.id];
|
|
1967
|
+
const lightMode = theme === "light";
|
|
1968
|
+
if (role === "background") {
|
|
1969
|
+
return lightMode ? pair.light : pair.dark;
|
|
1970
|
+
} else {
|
|
1971
|
+
return lightMode ? pair.dark : pair.light;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
function resolvePairedForeground(background, theme) {
|
|
1975
|
+
if (background.type === "semantic") {
|
|
1976
|
+
return resolveColor(background, theme, "foreground");
|
|
1977
|
+
}
|
|
1978
|
+
return theme === "light" ? CONTRAST_PALETTE.contrastNeutral.dark : CONTRAST_PALETTE.contrastNeutral.light;
|
|
1979
|
+
}
|
|
1980
|
+
// src/Color/colorUtils.ts
|
|
1981
|
+
function srgbChannelToLinear(channel) {
|
|
1982
|
+
const c = channel / 255;
|
|
1983
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
1984
|
+
}
|
|
1985
|
+
function relativeLuminance(r, g, b) {
|
|
1986
|
+
return 0.2126 * srgbChannelToLinear(r) + 0.7152 * srgbChannelToLinear(g) + 0.0722 * srgbChannelToLinear(b);
|
|
1987
|
+
}
|
|
1988
|
+
function contrastRatio(lum1, lum2) {
|
|
1989
|
+
const lighter = Math.max(lum1, lum2);
|
|
1990
|
+
const darker = Math.min(lum1, lum2);
|
|
1991
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
1992
|
+
}
|
|
1993
|
+
function meetsWCAG_AA(ratio) {
|
|
1994
|
+
return ratio >= 4.5;
|
|
1995
|
+
}
|
|
1996
|
+
function meetsWCAG_AAA(ratio) {
|
|
1997
|
+
return ratio >= 7;
|
|
1998
|
+
}
|
|
1999
|
+
function parseCssRgb(css) {
|
|
2000
|
+
const m = css.match(/rgba?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)/);
|
|
2001
|
+
if (!m)
|
|
2002
|
+
return null;
|
|
2003
|
+
return [parseFloat(m[1]), parseFloat(m[2]), parseFloat(m[3])];
|
|
2004
|
+
}
|
|
2005
|
+
function cssContrastRatio(css1, css2) {
|
|
2006
|
+
const rgb1 = parseCssRgb(css1);
|
|
2007
|
+
const rgb2 = parseCssRgb(css2);
|
|
2008
|
+
if (!rgb1 || !rgb2)
|
|
2009
|
+
return null;
|
|
2010
|
+
return contrastRatio(relativeLuminance(...rgb1), relativeLuminance(...rgb2));
|
|
2011
|
+
}
|
|
1818
2012
|
// src/BoardCommand.ts
|
|
1819
2013
|
class BoardCommand {
|
|
1820
2014
|
board;
|
|
@@ -2408,12 +2602,14 @@ class Mbr {
|
|
|
2408
2602
|
}
|
|
2409
2603
|
render(context) {
|
|
2410
2604
|
const { ctx } = context;
|
|
2411
|
-
|
|
2412
|
-
|
|
2605
|
+
const resolvedBg = typeof this.backgroundColor === "string" ? this.backgroundColor : resolveColor(this.backgroundColor, "light", "background");
|
|
2606
|
+
const resolvedBorder = typeof this.borderColor === "string" ? this.borderColor : resolveColor(this.borderColor, "light", "foreground");
|
|
2607
|
+
if (resolvedBg !== "none") {
|
|
2608
|
+
ctx.fillStyle = resolvedBg;
|
|
2413
2609
|
ctx.fillRect(this.left, this.top, this.getWidth(), this.getHeight());
|
|
2414
2610
|
}
|
|
2415
2611
|
if (this.strokeWidth) {
|
|
2416
|
-
ctx.strokeStyle =
|
|
2612
|
+
ctx.strokeStyle = resolvedBorder;
|
|
2417
2613
|
ctx.lineWidth = this.strokeWidth;
|
|
2418
2614
|
ctx.setLineDash([]);
|
|
2419
2615
|
ctx.strokeRect(this.left, this.top, this.getWidth(), this.getHeight());
|
|
@@ -7972,6 +8168,7 @@ var conf = {
|
|
|
7972
8168
|
plus: "Plus",
|
|
7973
8169
|
plusAI: "PlusAI"
|
|
7974
8170
|
},
|
|
8171
|
+
theme: "light",
|
|
7975
8172
|
EVENTS_PUBLISH_INTERVAL: 100,
|
|
7976
8173
|
EVENTS_RESEND_INTERVAL: 1000,
|
|
7977
8174
|
SELECTION_COLOR: "rgb(71, 120, 245)",
|
|
@@ -39676,7 +39873,7 @@ class Connector2 extends BaseItem {
|
|
|
39676
39873
|
this.endPointerStyle = endPointerStyle;
|
|
39677
39874
|
this.transformation = new Transformation(this.id, this.board.events);
|
|
39678
39875
|
this.linkTo = new LinkTo(this.id, this.board.events);
|
|
39679
|
-
this.lineColor = lineColor ?? CONNECTOR_COLOR;
|
|
39876
|
+
this.lineColor = lineColor ?? fixedColor(CONNECTOR_COLOR);
|
|
39680
39877
|
this.lineWidth = lineWidth ?? CONNECTOR_LINE_WIDTH;
|
|
39681
39878
|
this.borderStyle = strokeStyle ?? CONNECTOR_BORDER_STYLE;
|
|
39682
39879
|
this.text = new RichText(board, this.getMbr(), this.id, new Transformation, this.linkTo, conf.i18n.t("connector.textPlaceholder", {
|
|
@@ -40183,7 +40380,7 @@ class Connector2 extends BaseItem {
|
|
|
40183
40380
|
div.style.transformOrigin = "left top";
|
|
40184
40381
|
div.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
40185
40382
|
div.style.position = "absolute";
|
|
40186
|
-
div.setAttribute("data-line-color", this.lineColor);
|
|
40383
|
+
div.setAttribute("data-line-color", resolveColor(this.lineColor, conf.theme, "foreground"));
|
|
40187
40384
|
div.setAttribute("data-line-width", this.lineWidth.toString());
|
|
40188
40385
|
div.setAttribute("data-line-style", this.lineStyle);
|
|
40189
40386
|
div.setAttribute("data-border-style", this.borderStyle);
|
|
@@ -40279,7 +40476,9 @@ class Connector2 extends BaseItem {
|
|
|
40279
40476
|
this.startPointerStyle = data.startPointerStyle ?? this.startPointerStyle;
|
|
40280
40477
|
this.endPointerStyle = data.endPointerStyle ?? this.endPointerStyle;
|
|
40281
40478
|
this.lineStyle = data.lineStyle ?? this.lineStyle;
|
|
40282
|
-
|
|
40479
|
+
if (data.lineColor != null) {
|
|
40480
|
+
this.lineColor = coerceColorValue(data.lineColor);
|
|
40481
|
+
}
|
|
40283
40482
|
this.lineWidth = data.lineWidth ?? this.lineWidth;
|
|
40284
40483
|
this.borderStyle = data.borderStyle ?? this.borderStyle;
|
|
40285
40484
|
if (data.transformation) {
|
|
@@ -40372,16 +40571,17 @@ class Connector2 extends BaseItem {
|
|
|
40372
40571
|
const endPoint = this.endPoint;
|
|
40373
40572
|
this.lines = getLine(this.lineStyle, startPoint, endPoint, this.middlePoint).addConnectedItemType(this.itemType);
|
|
40374
40573
|
this.startPointer = getStartPointer(startPoint, this.startPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.2);
|
|
40375
|
-
|
|
40574
|
+
const resolvedLineColor = resolveColor(this.lineColor, conf.theme, "foreground");
|
|
40575
|
+
this.startPointer.path.setBorderColor(resolvedLineColor);
|
|
40376
40576
|
this.startPointer.path.setBorderWidth(this.lineWidth);
|
|
40377
|
-
this.startPointer.path.setBackgroundColor(
|
|
40577
|
+
this.startPointer.path.setBackgroundColor(resolvedLineColor);
|
|
40378
40578
|
this.endPointer = getEndPointer(endPoint, this.endPointerStyle, this.lineStyle, this.lines, this.lineWidth * 0.1 + 0.2);
|
|
40379
|
-
this.endPointer.path.setBorderColor(
|
|
40579
|
+
this.endPointer.path.setBorderColor(resolvedLineColor);
|
|
40380
40580
|
this.endPointer.path.setBorderWidth(this.lineWidth);
|
|
40381
|
-
this.endPointer.path.setBackgroundColor(
|
|
40581
|
+
this.endPointer.path.setBackgroundColor(resolvedLineColor);
|
|
40382
40582
|
this.offsetLines();
|
|
40383
40583
|
this.lines.setBorderWidth(this.lineWidth);
|
|
40384
|
-
this.lines.setBorderColor(
|
|
40584
|
+
this.lines.setBorderColor(resolvedLineColor);
|
|
40385
40585
|
this.lines.setBorderStyle(this.borderStyle);
|
|
40386
40586
|
this.updateTitle();
|
|
40387
40587
|
}
|
|
@@ -40487,7 +40687,7 @@ class ConnectorData2 {
|
|
|
40487
40687
|
startPointerStyle = "None";
|
|
40488
40688
|
endPointerStyle = "ArrowThin";
|
|
40489
40689
|
lineStyle = "straight";
|
|
40490
|
-
lineColor =
|
|
40690
|
+
lineColor = fixedColor(CONNECTOR_COLOR);
|
|
40491
40691
|
linkTo;
|
|
40492
40692
|
lineWidth = 1;
|
|
40493
40693
|
borderStyle = "solid";
|
|
@@ -41180,7 +41380,7 @@ class DefaultShapeData {
|
|
|
41180
41380
|
text;
|
|
41181
41381
|
linkTo;
|
|
41182
41382
|
itemType = "Shape";
|
|
41183
|
-
constructor(shapeType = "Rectangle", backgroundColor = "none", backgroundOpacity = 1, borderColor = conf.SHAPE_DEFAULT_STROKE_COLOR, borderOpacity = 1, borderStyle = "solid", borderWidth = 1, transformation = new DefaultTransformationData, text5 = new DefaultRichTextData, linkTo) {
|
|
41383
|
+
constructor(shapeType = "Rectangle", backgroundColor = fixedColor("none"), backgroundOpacity = 1, borderColor = fixedColor(conf.SHAPE_DEFAULT_STROKE_COLOR), borderOpacity = 1, borderStyle = "solid", borderWidth = 1, transformation = new DefaultTransformationData, text5 = new DefaultRichTextData, linkTo) {
|
|
41184
41384
|
this.shapeType = shapeType;
|
|
41185
41385
|
this.backgroundColor = backgroundColor;
|
|
41186
41386
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -42048,9 +42248,13 @@ class Shape extends BaseItem {
|
|
|
42048
42248
|
if (data.linkTo) {
|
|
42049
42249
|
this.linkTo.deserialize(data.linkTo);
|
|
42050
42250
|
}
|
|
42051
|
-
|
|
42251
|
+
if (data.backgroundColor != null) {
|
|
42252
|
+
this.backgroundColor = coerceColorValue(data.backgroundColor);
|
|
42253
|
+
}
|
|
42052
42254
|
this.backgroundOpacity = data.backgroundOpacity ?? this.backgroundOpacity;
|
|
42053
|
-
|
|
42255
|
+
if (data.borderColor != null) {
|
|
42256
|
+
this.borderColor = coerceColorValue(data.borderColor);
|
|
42257
|
+
}
|
|
42054
42258
|
this.borderOpacity = data.borderOpacity ?? this.borderOpacity;
|
|
42055
42259
|
this.borderStyle = data.borderStyle ?? this.borderStyle;
|
|
42056
42260
|
this.borderWidth = data.borderWidth ?? this.borderWidth;
|
|
@@ -42157,7 +42361,7 @@ class Shape extends BaseItem {
|
|
|
42157
42361
|
}
|
|
42158
42362
|
applyBackgroundColor(backgroundColor) {
|
|
42159
42363
|
this.backgroundColor = backgroundColor;
|
|
42160
|
-
this.path.setBackgroundColor(backgroundColor);
|
|
42364
|
+
this.path.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
|
|
42161
42365
|
}
|
|
42162
42366
|
setBackgroundColor(backgroundColor) {
|
|
42163
42367
|
this.emit({
|
|
@@ -42193,7 +42397,7 @@ class Shape extends BaseItem {
|
|
|
42193
42397
|
}
|
|
42194
42398
|
applyBorderColor(borderColor) {
|
|
42195
42399
|
this.borderColor = borderColor;
|
|
42196
|
-
this.path.setBorderColor(borderColor);
|
|
42400
|
+
this.path.setBorderColor(resolveColor(borderColor, conf.theme, "foreground"));
|
|
42197
42401
|
}
|
|
42198
42402
|
setBorderColor(borderColor) {
|
|
42199
42403
|
this.emit({
|
|
@@ -42452,7 +42656,7 @@ class StickerData {
|
|
|
42452
42656
|
linkTo;
|
|
42453
42657
|
text;
|
|
42454
42658
|
itemType = "Sticker";
|
|
42455
|
-
constructor(backgroundColor = stickerColors["Sky Blue"], transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
|
|
42659
|
+
constructor(backgroundColor = fixedColor(stickerColors["Sky Blue"]), transformation = new DefaultTransformationData, linkTo, text5 = new DefaultRichTextData([], "center", undefined)) {
|
|
42456
42660
|
this.backgroundColor = backgroundColor;
|
|
42457
42661
|
this.transformation = transformation;
|
|
42458
42662
|
this.linkTo = linkTo;
|
|
@@ -42564,7 +42768,9 @@ class Sticker extends BaseItem {
|
|
|
42564
42768
|
};
|
|
42565
42769
|
}
|
|
42566
42770
|
deserialize(data) {
|
|
42567
|
-
|
|
42771
|
+
if (data.backgroundColor != null) {
|
|
42772
|
+
this.backgroundColor = coerceColorValue(data.backgroundColor);
|
|
42773
|
+
}
|
|
42568
42774
|
if (data.transformation) {
|
|
42569
42775
|
this.transformation.deserialize(data.transformation);
|
|
42570
42776
|
}
|
|
@@ -42588,7 +42794,7 @@ class Sticker extends BaseItem {
|
|
|
42588
42794
|
this.stickerPath.transform(this.transformation.toMatrix());
|
|
42589
42795
|
this.text.setContainer(this.textContainer.copy());
|
|
42590
42796
|
this.textContainer.transform(this.transformation.toMatrix());
|
|
42591
|
-
this.stickerPath.setBackgroundColor(this.backgroundColor);
|
|
42797
|
+
this.stickerPath.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
|
|
42592
42798
|
this.saveStickerData();
|
|
42593
42799
|
}
|
|
42594
42800
|
setId(id) {
|
|
@@ -42632,7 +42838,7 @@ class Sticker extends BaseItem {
|
|
|
42632
42838
|
}
|
|
42633
42839
|
applyBackgroundColor(backgroundColor) {
|
|
42634
42840
|
this.backgroundColor = backgroundColor;
|
|
42635
|
-
this.stickerPath.setBackgroundColor(backgroundColor);
|
|
42841
|
+
this.stickerPath.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
|
|
42636
42842
|
}
|
|
42637
42843
|
setBackgroundColor(backgroundColor) {
|
|
42638
42844
|
this.emit({
|
|
@@ -42695,7 +42901,7 @@ class Sticker extends BaseItem {
|
|
|
42695
42901
|
const unscaledWidth = itemMbr.getWidth() / scaleX;
|
|
42696
42902
|
const unscaledHeight = height2 / scaleY;
|
|
42697
42903
|
div.id = this.getId();
|
|
42698
|
-
div.style.backgroundColor = this.backgroundColor;
|
|
42904
|
+
div.style.backgroundColor = resolveColor(this.backgroundColor, conf.theme, "background");
|
|
42699
42905
|
div.style.width = `${unscaledWidth}px`;
|
|
42700
42906
|
div.style.height = `${unscaledHeight}px`;
|
|
42701
42907
|
div.style.transformOrigin = "top left";
|
|
@@ -42969,7 +43175,7 @@ class DefaultFrameData {
|
|
|
42969
43175
|
canChangeRatio;
|
|
42970
43176
|
linkTo;
|
|
42971
43177
|
itemType = "Frame";
|
|
42972
|
-
constructor(shapeType = "Custom", backgroundColor = FRAME_FILL_COLOR, backgroundOpacity = 1, borderColor = FRAME_BORDER_COLOR, borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
|
|
43178
|
+
constructor(shapeType = "Custom", backgroundColor = fixedColor(FRAME_FILL_COLOR), backgroundOpacity = 1, borderColor = fixedColor(FRAME_BORDER_COLOR), borderOpacity = 0.08, borderStyle = "solid", borderWidth = 0.2, transformation = new DefaultTransformationData, children = [], text5 = new DefaultRichTextData([], "top", 600), canChangeRatio = true, linkTo) {
|
|
42973
43179
|
this.shapeType = shapeType;
|
|
42974
43180
|
this.backgroundColor = backgroundColor;
|
|
42975
43181
|
this.backgroundOpacity = backgroundOpacity;
|
|
@@ -43177,9 +43383,13 @@ class Frame2 extends BaseItem {
|
|
|
43177
43383
|
this.initPath();
|
|
43178
43384
|
}
|
|
43179
43385
|
this.linkTo.deserialize(data.linkTo);
|
|
43180
|
-
|
|
43386
|
+
if (data.backgroundColor != null) {
|
|
43387
|
+
this.backgroundColor = coerceColorValue(data.backgroundColor);
|
|
43388
|
+
}
|
|
43181
43389
|
this.backgroundOpacity = data.backgroundOpacity ?? this.backgroundOpacity;
|
|
43182
|
-
|
|
43390
|
+
if (data.borderColor != null) {
|
|
43391
|
+
this.borderColor = coerceColorValue(data.borderColor);
|
|
43392
|
+
}
|
|
43183
43393
|
this.borderOpacity = data.borderOpacity ?? this.borderOpacity;
|
|
43184
43394
|
this.borderStyle = data.borderStyle ?? this.borderStyle;
|
|
43185
43395
|
this.borderWidth = data.borderWidth ?? this.borderWidth;
|
|
@@ -43217,9 +43427,9 @@ class Frame2 extends BaseItem {
|
|
|
43217
43427
|
this.path.transform(this.transformation.toMatrix());
|
|
43218
43428
|
this.textContainer.transform(this.transformation.toMatrix());
|
|
43219
43429
|
}
|
|
43220
|
-
this.path.setBackgroundColor(this.backgroundColor);
|
|
43430
|
+
this.path.setBackgroundColor(resolveColor(this.backgroundColor, conf.theme, "background"));
|
|
43221
43431
|
this.path.setBackgroundOpacity(this.backgroundOpacity);
|
|
43222
|
-
this.path.setBorderColor(this.borderColor);
|
|
43432
|
+
this.path.setBorderColor(resolveColor(this.borderColor, conf.theme, "foreground"));
|
|
43223
43433
|
this.path.setBorderWidth(this.borderWidth);
|
|
43224
43434
|
this.path.setBorderStyle(this.borderStyle);
|
|
43225
43435
|
this.path.setBorderOpacity(this.borderOpacity);
|
|
@@ -43370,7 +43580,7 @@ class Frame2 extends BaseItem {
|
|
|
43370
43580
|
}
|
|
43371
43581
|
applyBackgroundColor(backgroundColor) {
|
|
43372
43582
|
this.backgroundColor = backgroundColor;
|
|
43373
|
-
this.path.setBackgroundColor(backgroundColor);
|
|
43583
|
+
this.path.setBackgroundColor(resolveColor(backgroundColor, conf.theme, "background"));
|
|
43374
43584
|
}
|
|
43375
43585
|
setBackgroundColor(backgroundColor) {
|
|
43376
43586
|
this.emit({
|
|
@@ -43442,9 +43652,9 @@ class Frame2 extends BaseItem {
|
|
|
43442
43652
|
renderHTML(documentFactory) {
|
|
43443
43653
|
const div = documentFactory.createElement("frame-item");
|
|
43444
43654
|
div.id = this.getId();
|
|
43445
|
-
div.style.backgroundColor = this.backgroundColor;
|
|
43655
|
+
div.style.backgroundColor = resolveColor(this.backgroundColor, conf.theme, "background");
|
|
43446
43656
|
div.style.opacity = this.backgroundOpacity.toString();
|
|
43447
|
-
div.style.borderColor = this.borderColor;
|
|
43657
|
+
div.style.borderColor = resolveColor(this.borderColor, conf.theme, "foreground");
|
|
43448
43658
|
div.style.borderWidth = `${this.borderWidth}px`;
|
|
43449
43659
|
div.style.borderStyle = this.borderStyle;
|
|
43450
43660
|
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
@@ -45080,6 +45290,7 @@ class Drawing extends BaseItem {
|
|
|
45080
45290
|
lines = [];
|
|
45081
45291
|
linkTo;
|
|
45082
45292
|
strokeWidth = 1;
|
|
45293
|
+
borderColor = fixedColor(conf.PEN_DEFAULT_COLOR);
|
|
45083
45294
|
borderStyle = "solid";
|
|
45084
45295
|
linePattern = scalePatterns(this.strokeWidth)[this.borderStyle];
|
|
45085
45296
|
borderOpacity = 1;
|
|
@@ -45125,7 +45336,7 @@ class Drawing extends BaseItem {
|
|
|
45125
45336
|
this.linkTo.deserialize(data.linkTo);
|
|
45126
45337
|
this.optimizePoints();
|
|
45127
45338
|
this.transformation.deserialize(data.transformation);
|
|
45128
|
-
this.borderColor = data.strokeStyle;
|
|
45339
|
+
this.borderColor = coerceColorValue(data.strokeStyle);
|
|
45129
45340
|
this.strokeWidth = data.strokeWidth;
|
|
45130
45341
|
this.updateGeometry();
|
|
45131
45342
|
return this;
|
|
@@ -45233,7 +45444,7 @@ class Drawing extends BaseItem {
|
|
|
45233
45444
|
}
|
|
45234
45445
|
const ctx = context.ctx;
|
|
45235
45446
|
ctx.save();
|
|
45236
|
-
ctx.strokeStyle = this.borderColor;
|
|
45447
|
+
ctx.strokeStyle = resolveColor(this.borderColor, conf.theme, "foreground");
|
|
45237
45448
|
ctx.lineWidth = this.strokeWidth;
|
|
45238
45449
|
ctx.lineCap = "round";
|
|
45239
45450
|
ctx.setLineDash(this.linePattern);
|
|
@@ -45260,7 +45471,7 @@ class Drawing extends BaseItem {
|
|
|
45260
45471
|
svg3.setAttribute("style", "position: absolute; overflow: visible;");
|
|
45261
45472
|
const pathElement = documentFactory.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
45262
45473
|
pathElement.setAttribute("d", this.getPathData());
|
|
45263
|
-
pathElement.setAttribute("stroke", this.borderColor);
|
|
45474
|
+
pathElement.setAttribute("stroke", resolveColor(this.borderColor, conf.theme, "foreground"));
|
|
45264
45475
|
pathElement.setAttribute("stroke-width", `${this.strokeWidth}`);
|
|
45265
45476
|
pathElement.setAttribute("fill", "none");
|
|
45266
45477
|
svg3.appendChild(pathElement);
|
|
@@ -45353,7 +45564,7 @@ class Drawing extends BaseItem {
|
|
|
45353
45564
|
case "Drawing":
|
|
45354
45565
|
switch (op.method) {
|
|
45355
45566
|
case "setStrokeColor":
|
|
45356
|
-
this.borderColor = op.color;
|
|
45567
|
+
this.borderColor = coerceColorValue(op.color);
|
|
45357
45568
|
break;
|
|
45358
45569
|
case "setStrokeWidth":
|
|
45359
45570
|
this.strokeWidth = op.width;
|