docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep keep keep keep replace keep keep keep keep keep
<mask> ); <mask> const handleOffset = 4 / appState.zoom; // XXX import constant <mask> const dashedLinePadding = 4 / appState.zoom; // XXX import constant <mask> const offsetPointer = handleOffset + dashedLinePadding; <mask> const minSize = handleOffset * 4; <mask> if (selectedElements.length === 1) { <mask> const [element] = selectedElements; <mask> if (resizeHandle === "rotation") { <mask> const [x1, y1, x2, y2] = getElementAbsoluteCoords(element); <mask> const cx = (x1 + x2) / 2; </s> Fix resize logic (partly) (#1475) </s> remove const [x1, y1] = getElementAbsoluteCoords(element); </s> add const [x1, y1, x2, y2] = getElementAbsoluteCoords(element); </s> remove const cx = x + width / 2; const cy = y + height / 2; </s> add const cx = (x1 + x2) / 2; const cy = (y1 + y2) / 2; </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove scaleY = (y + height - offsetPointer - rotatedY) / height; </s> add scaleY = adjustWithOffsetPointer(y2 - rotatedY) / (y2 - y1); </s> remove let nextWidth = width * scaleX; let nextHeight = height * scaleY; </s> add let nextWidth = elementWidth * scaleX; let nextHeight = elementHeight * scaleY; </s> add const deltaX = (elementWidth - nextWidth) / 2; const deltaY = (elementHeight - nextHeight) / 2;
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/element/resizeElements.ts
keep keep keep keep replace keep keep keep keep keep
<mask> lastX, <mask> lastY, <mask> ); <mask> } else if (resizeHandle) { <mask> const [x1, y1] = getElementAbsoluteCoords(element); <mask> const resized = resizeXYWidthHightWithRotation( <mask> resizeHandle, <mask> x1, <mask> y1, <mask> element.width, </s> Fix resize logic (partly) (#1475) </s> add x2, y2, </s> remove const minSize = handleOffset * 4; </s> add const minSize = 0; </s> remove x1 - element.x, y1 - element.y, </s> add element.x, element.y, </s> remove deltaX /= 2; deltaY /= 2; </s> add </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove let nextWidth = width * scaleX; let nextHeight = height * scaleY; </s> add let nextWidth = elementWidth * scaleX; let nextHeight = elementHeight * scaleY;
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/element/resizeElements.ts
keep keep keep add keep keep keep keep keep
<mask> const resized = resizeXYWidthHightWithRotation( <mask> resizeHandle, <mask> x1, <mask> y1, <mask> element.width, <mask> element.height, <mask> element.x, <mask> element.y, <mask> element.angle, </s> Fix resize logic (partly) (#1475) </s> remove x1 - element.x, y1 - element.y, </s> add element.x, element.y, </s> remove const [x1, y1] = getElementAbsoluteCoords(element); </s> add const [x1, y1, x2, y2] = getElementAbsoluteCoords(element); </s> remove const minSize = handleOffset * 4; </s> add const minSize = 0; </s> remove const cx = x + width / 2; const cy = y + height / 2; </s> add const cx = (x1 + x2) / 2; const cy = (y1 + y2) / 2; </s> add const deltaX = (elementWidth - nextWidth) / 2; const deltaY = (elementHeight - nextHeight) / 2; </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; };
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/element/resizeElements.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> x1, <mask> y1, <mask> element.width, <mask> element.height, <mask> x1 - element.x, <mask> y1 - element.y, <mask> element.angle, <mask> xPointer, <mask> yPointer, <mask> offsetPointer, <mask> getResizeWithSidesSameLengthKey(event), </s> Fix resize logic (partly) (#1475) </s> add x2, y2, </s> remove const [x1, y1] = getElementAbsoluteCoords(element); </s> add const [x1, y1, x2, y2] = getElementAbsoluteCoords(element); </s> remove if (resized.width !== 0 && resized.height !== 0) { </s> add if ( Math.abs(resized.width) > minSize && Math.abs(resized.height) > minSize ) { </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove width - nextWidth, height - nextHeight, </s> add deltaX, deltaY, </s> remove x - offsetX, y - offsetY, </s> add elementX, elementY,
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/element/resizeElements.ts
keep keep keep keep replace keep keep keep keep keep
<mask> offsetPointer, <mask> getResizeWithSidesSameLengthKey(event), <mask> getResizeCenterPointKey(event), <mask> ); <mask> if (resized.width !== 0 && resized.height !== 0) { <mask> mutateElement(element, { <mask> ...resized, <mask> ...(isLinearElement(element) <mask> ? { <mask> points: rescalePoints( </s> Fix resize logic (partly) (#1475) </s> remove x1 - element.x, y1 - element.y, </s> add element.x, element.y, </s> remove const [x1, y1] = getElementAbsoluteCoords(element); </s> add const [x1, y1, x2, y2] = getElementAbsoluteCoords(element); </s> remove const minSize = handleOffset * 4; </s> add const minSize = 0; </s> remove deltaX /= 2; deltaY /= 2; </s> add </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove scaleY = (rotatedY - offsetPointer - y) / height; </s> add scaleY = adjustWithOffsetPointer(rotatedY - y1) / (y2 - y1);
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/element/resizeElements.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> isResizeFromCenter: boolean, <mask> ) => { <mask> const cos = Math.cos(angle); <mask> const sin = Math.sin(angle); <mask> deltaX /= 2; <mask> deltaY /= 2; <mask> if (side === "e" || side === "ne" || side === "se") { <mask> if (isResizeFromCenter) { <mask> x += deltaX; <mask> } else { <mask> x += deltaX * (1 - cos); </s> Fix resize logic (partly) (#1475) </s> add const deltaX = (elementWidth - nextWidth) / 2; const deltaY = (elementHeight - nextHeight) / 2; </s> remove const cx = x + width / 2; const cy = y + height / 2; </s> add const cx = (x1 + x2) / 2; const cy = (y1 + y2) / 2; </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove scaleX = (rotatedX - offsetPointer - x) / width; </s> add scaleX = adjustWithOffsetPointer(rotatedX - x1) / (x2 - x1); </s> remove scaleY = (rotatedY - offsetPointer - y) / height; </s> add scaleY = adjustWithOffsetPointer(rotatedY - y1) / (y2 - y1); </s> remove scaleY = (y + height - offsetPointer - rotatedY) / height; </s> add scaleY = adjustWithOffsetPointer(y2 - rotatedY) / (y2 - y1);
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/math.ts
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
<mask> }; <mask> <mask> export const resizeXYWidthHightWithRotation = ( <mask> side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se", <mask> x: number, <mask> y: number, <mask> width: number, <mask> height: number, <mask> offsetX: number, <mask> offsetY: number, <mask> angle: number, <mask> xPointer: number, <mask> yPointer: number, <mask> offsetPointer: number, <mask> sidesWithSameLength: boolean, </s> Fix resize logic (partly) (#1475) </s> remove scaleY = (rotatedY - offsetPointer - y) / height; </s> add scaleY = adjustWithOffsetPointer(rotatedY - y1) / (y2 - y1); </s> remove scaleX = (rotatedX - offsetPointer - x) / width; </s> add scaleX = adjustWithOffsetPointer(rotatedX - x1) / (x2 - x1); </s> remove const cx = x + width / 2; const cy = y + height / 2; </s> add const cx = (x1 + x2) / 2; const cy = (y1 + y2) / 2; </s> add const deltaX = (elementWidth - nextWidth) / 2; const deltaY = (elementHeight - nextHeight) / 2; </s> remove scaleX = (x + width - offsetPointer - rotatedX) / width; </s> add scaleX = adjustWithOffsetPointer(x2 - rotatedX) / (x2 - x1); </s> remove deltaX /= 2; deltaY /= 2; </s> add
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/math.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> sidesWithSameLength: boolean, <mask> isResizeFromCenter: boolean, <mask> ) => { <mask> // center point for rotation <mask> const cx = x + width / 2; <mask> const cy = y + height / 2; <mask> <mask> // rotation with current angle <mask> const [rotatedX, rotatedY] = rotate(xPointer, yPointer, cx, cy, -angle); <mask> <mask> let scaleX = 1; </s> Fix resize logic (partly) (#1475) </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove deltaX /= 2; deltaY /= 2; </s> add </s> remove const minSize = handleOffset * 4; </s> add const minSize = 0; </s> add const deltaX = (elementWidth - nextWidth) / 2; const deltaY = (elementHeight - nextHeight) / 2; </s> remove scaleX = (rotatedX - offsetPointer - x) / width; </s> add scaleX = adjustWithOffsetPointer(rotatedX - x1) / (x2 - x1); </s> remove scaleY = (y + height - offsetPointer - rotatedY) / height; </s> add scaleY = adjustWithOffsetPointer(y2 - rotatedY) / (y2 - y1);
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/math.ts
keep keep add keep keep keep keep keep
<mask> // rotation with current angle <mask> const [rotatedX, rotatedY] = rotate(xPointer, yPointer, cx, cy, -angle); <mask> <mask> let scaleX = 1; <mask> let scaleY = 1; <mask> if (side === "e" || side === "ne" || side === "se") { <mask> scaleX = adjustWithOffsetPointer(rotatedX - x1) / (x2 - x1); <mask> } </s> Fix resize logic (partly) (#1475) </s> remove const cx = x + width / 2; const cy = y + height / 2; </s> add const cx = (x1 + x2) / 2; const cy = (y1 + y2) / 2; </s> remove scaleX = (rotatedX - offsetPointer - x) / width; </s> add scaleX = adjustWithOffsetPointer(rotatedX - x1) / (x2 - x1); </s> remove scaleX = (x + width - offsetPointer - rotatedX) / width; </s> add scaleX = adjustWithOffsetPointer(x2 - rotatedX) / (x2 - x1); </s> remove scaleY = (rotatedY - offsetPointer - y) / height; </s> add scaleY = adjustWithOffsetPointer(rotatedY - y1) / (y2 - y1); </s> remove scaleY = (y + height - offsetPointer - rotatedY) / height; </s> add scaleY = adjustWithOffsetPointer(y2 - rotatedY) / (y2 - y1); </s> remove let nextWidth = width * scaleX; let nextHeight = height * scaleY; </s> add let nextWidth = elementWidth * scaleX; let nextHeight = elementHeight * scaleY;
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/math.ts
keep keep keep keep replace keep keep replace keep keep keep
<mask> <mask> let scaleX = 1; <mask> let scaleY = 1; <mask> if (side === "e" || side === "ne" || side === "se") { <mask> scaleX = (rotatedX - offsetPointer - x) / width; <mask> } <mask> if (side === "s" || side === "sw" || side === "se") { <mask> scaleY = (rotatedY - offsetPointer - y) / height; <mask> } <mask> if (side === "w" || side === "nw" || side === "sw") { <mask> scaleX = (x + width - offsetPointer - rotatedX) / width; </s> Fix resize logic (partly) (#1475) </s> remove scaleX = (x + width - offsetPointer - rotatedX) / width; </s> add scaleX = adjustWithOffsetPointer(x2 - rotatedX) / (x2 - x1); </s> remove scaleY = (y + height - offsetPointer - rotatedY) / height; </s> add scaleY = adjustWithOffsetPointer(y2 - rotatedY) / (y2 - y1); </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove let nextWidth = width * scaleX; let nextHeight = height * scaleY; </s> add let nextWidth = elementWidth * scaleX; let nextHeight = elementHeight * scaleY; </s> remove deltaX /= 2; deltaY /= 2; </s> add
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/math.ts
keep replace keep keep replace keep keep keep keep
<mask> if (side === "w" || side === "nw" || side === "sw") { <mask> scaleX = (x + width - offsetPointer - rotatedX) / width; <mask> } <mask> if (side === "n" || side === "nw" || side === "ne") { <mask> scaleY = (y + height - offsetPointer - rotatedY) / height; <mask> } <mask> <mask> let nextWidth = width * scaleX; <mask> let nextHeight = height * scaleY; </s> Fix resize logic (partly) (#1475) </s> remove let nextWidth = width * scaleX; let nextHeight = height * scaleY; </s> add let nextWidth = elementWidth * scaleX; let nextHeight = elementHeight * scaleY; </s> remove scaleY = (rotatedY - offsetPointer - y) / height; </s> add scaleY = adjustWithOffsetPointer(rotatedY - y1) / (y2 - y1); </s> remove scaleX = (rotatedX - offsetPointer - x) / width; </s> add scaleX = adjustWithOffsetPointer(rotatedX - x1) / (x2 - x1); </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove deltaX /= 2; deltaY /= 2; </s> add
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/math.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> if (side === "n" || side === "nw" || side === "ne") { <mask> scaleY = (y + height - offsetPointer - rotatedY) / height; <mask> } <mask> <mask> let nextWidth = width * scaleX; <mask> let nextHeight = height * scaleY; <mask> if (sidesWithSameLength) { <mask> nextWidth = nextHeight = Math.max(nextWidth, nextHeight); <mask> } <mask> <mask> return { </s> Fix resize logic (partly) (#1475) </s> remove scaleY = (y + height - offsetPointer - rotatedY) / height; </s> add scaleY = adjustWithOffsetPointer(y2 - rotatedY) / (y2 - y1); </s> remove scaleX = (x + width - offsetPointer - rotatedX) / width; </s> add scaleX = adjustWithOffsetPointer(x2 - rotatedX) / (x2 - x1); </s> add const deltaX = (elementWidth - nextWidth) / 2; const deltaY = (elementHeight - nextHeight) / 2; </s> remove scaleX = (rotatedX - offsetPointer - x) / width; </s> add scaleX = adjustWithOffsetPointer(rotatedX - x1) / (x2 - x1); </s> remove scaleY = (rotatedY - offsetPointer - y) / height; </s> add scaleY = adjustWithOffsetPointer(rotatedY - y1) / (y2 - y1); </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; };
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/math.ts
keep keep add keep keep keep keep
<mask> nextWidth = nextHeight = Math.max(nextWidth, nextHeight); <mask> } <mask> <mask> return { <mask> width: nextWidth, <mask> height: nextHeight, <mask> ...adjustXYWithRotation( </s> Fix resize logic (partly) (#1475) </s> remove let nextWidth = width * scaleX; let nextHeight = height * scaleY; </s> add let nextWidth = elementWidth * scaleX; let nextHeight = elementHeight * scaleY; </s> remove x - offsetX, y - offsetY, </s> add elementX, elementY, </s> remove scaleY = (y + height - offsetPointer - rotatedY) / height; </s> add scaleY = adjustWithOffsetPointer(y2 - rotatedY) / (y2 - y1); </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove width - nextWidth, height - nextHeight, </s> add deltaX, deltaY, </s> remove x: number, y: number, width: number, height: number, offsetX: number, offsetY: number, </s> add x1: number, y1: number, x2: number, y2: number, elementWidth: number, elementHeight: number, elementX: number, elementY: number,
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/math.ts
keep keep keep keep replace replace keep replace replace keep keep keep keep
<mask> width: nextWidth, <mask> height: nextHeight, <mask> ...adjustXYWithRotation( <mask> side, <mask> x - offsetX, <mask> y - offsetY, <mask> angle, <mask> width - nextWidth, <mask> height - nextHeight, <mask> isResizeFromCenter, <mask> ), <mask> }; <mask> }; </s> Fix resize logic (partly) (#1475) </s> add const deltaX = (elementWidth - nextWidth) / 2; const deltaY = (elementHeight - nextHeight) / 2; </s> remove x: number, y: number, width: number, height: number, offsetX: number, offsetY: number, </s> add x1: number, y1: number, x2: number, y2: number, elementWidth: number, elementHeight: number, elementX: number, elementY: number, </s> add // XXX this might be slow with closure const adjustWithOffsetPointer = (w: number) => { if (w > offsetPointer) { return w - offsetPointer; } else if (w < -offsetPointer) { return w + offsetPointer; } return 0; }; </s> remove scaleY = (y + height - offsetPointer - rotatedY) / height; </s> add scaleY = adjustWithOffsetPointer(y2 - rotatedY) / (y2 - y1); </s> remove scaleX = (x + width - offsetPointer - rotatedX) / width; </s> add scaleX = adjustWithOffsetPointer(x2 - rotatedX) / (x2 - x1);
https://github.com/excalidraw/excalidraw/commit/da1031aeb43735279ea47a6016b28d00fbaa892e
src/math.ts
keep replace replace replace keep keep replace replace replace keep keep keep keep
<mask> const path = require("path"); <mask> const webpack = require("webpack"); <mask> const autoprefixer = require("autoprefixer"); <mask> const { parseEnvVariables } = require("./env"); <mask> <mask> const outputDir = process.env.EXAMPLE === "true" ? "example/public" : "dist"; <mask> module.exports = { <mask> mode: "development", <mask> devtool: false, <mask> entry: { <mask> "excalidraw.development": "./entry.js", <mask> }, <mask> output: { </s> chore: Dedupe webpack configs. (#5449) * chore: Dedupe package dependencies and webpack configs. * Fully dedupe `src/packages` via symlinks * Merge https://github.com/excalidraw/excalidraw into dedupe-package-deps-configs * fix: Link `tsc` so `build:example` works in @excalidraw/excalidraw * @excalidraw/plugins: Revert the `yarn.lock` deduping. * Drop yarn commands from the root `package.json`. * Remove more unneeded `package.json` additions. * One more change to drop in `package.json` files. * Deduping: Move even more into common webpack configs. * renaming Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const TerserPlugin = require("terser-webpack-plugin"); const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; const autoprefixer = require("autoprefixer"); const webpack = require("webpack"); const { parseEnvVariables } = require("./env"); </s> add const { merge } = require("webpack-merge"); const commonConfig = require("../common.webpack.prod.config"); </s> remove module.exports = { mode: "production", </s> add const config = { </s> remove const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; </s> add const { merge } = require("webpack-merge"); const commonConfig = require("../common.webpack.prod.config"); </s> remove module.exports = { mode: "production", </s> add const config = { </s> remove module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: ["style-loader", { loader: "css-loader" }, "sass-loader"], }, { test: /\.(ts|tsx|js)$/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.prod.json"), }, }, { loader: "babel-loader", options: { presets: [ "@babel/preset-env", ["@babel/preset-react", { runtime: "automatic" }], "@babel/preset-typescript", ], plugins: [["@babel/plugin-transform-runtime"]], }, }, ], }, ], }, </s> add
https://github.com/excalidraw/excalidraw/commit/da4fa91ffc2bf9b1b74c9fec8164348273a9cad2
src/packages/excalidraw/webpack.dev.config.js
keep replace replace keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace
<mask> library: "ExcalidrawLib", <mask> libraryTarget: "umd", <mask> filename: "[name].js", <mask> chunkFilename: "excalidraw-assets-dev/[name]-[contenthash].js", <mask> assetModuleFilename: "excalidraw-assets-dev/[name][ext]", <mask> <mask> publicPath: "", <mask> }, <mask> resolve: { <mask> extensions: [".js", ".ts", ".tsx", ".css", ".scss"], <mask> }, <mask> module: { <mask> rules: [ <mask> { <mask> test: /\.(sa|sc|c)ss$/, <mask> exclude: /node_modules/, <mask> use: [ <mask> "style-loader", <mask> { loader: "css-loader" }, <mask> { <mask> loader: "postcss-loader", <mask> options: { <mask> postcssOptions: { <mask> plugins: [autoprefixer()], <mask> }, <mask> }, <mask> }, <mask> "sass-loader", <mask> ], <mask> }, <mask> { <mask> test: /\.(ts|tsx|js|jsx|mjs)$/, <mask> exclude: /node_modules\/(?!browser-fs-access)/, <mask> use: [ <mask> { <mask> loader: "ts-loader", <mask> options: { <mask> transpileOnly: true, <mask> configFile: path.resolve(__dirname, "../tsconfig.dev.json"), <mask> }, <mask> }, <mask> ], <mask> }, <mask> { <mask> test: /\.(woff|woff2|eot|ttf|otf)$/, <mask> type: "asset/resource", <mask> }, <mask> ], <mask> }, <mask> optimization: { <mask> splitChunks: { <mask> chunks: "async", <mask> cacheGroups: { <mask> vendors: { <mask> test: /[\\/]node_modules[\\/]/, <mask> name: "vendor", <mask> }, <mask> }, <mask> }, <mask> }, <mask> plugins: [ <mask> new webpack.EvalSourceMapDevToolPlugin({ exclude: /vendor/ }), <mask> new webpack.DefinePlugin({ <mask> "process.env": parseEnvVariables( <mask> path.resolve(__dirname, "../../../.env.development"), <mask> ), <mask> }), <mask> ], <mask> externals: { <mask> react: { <mask> root: "React", <mask> commonjs2: "react", <mask> commonjs: "react", <mask> amd: "react", <mask> }, <mask> "react-dom": { <mask> root: "ReactDOM", <mask> commonjs2: "react-dom", <mask> commonjs: "react-dom", <mask> amd: "react-dom", <mask> }, </s> chore: Dedupe webpack configs. (#5449) * chore: Dedupe package dependencies and webpack configs. * Fully dedupe `src/packages` via symlinks * Merge https://github.com/excalidraw/excalidraw into dedupe-package-deps-configs * fix: Link `tsc` so `build:example` works in @excalidraw/excalidraw * @excalidraw/plugins: Revert the `yarn.lock` deduping. * Drop yarn commands from the root `package.json`. * Remove more unneeded `package.json` additions. * One more change to drop in `package.json` files. * Deduping: Move even more into common webpack configs. * renaming Co-authored-by: Aakansha Doshi <[email protected]> </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader", }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.prod.json"), }, }, { loader: "babel-loader", options: { presets: [ "@babel/preset-env", ["@babel/preset-react", { runtime: "automatic" }], "@babel/preset-typescript", ], plugins: [ "transform-class-properties", "@babel/plugin-transform-runtime", ], }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { minimize: true, minimizer: [ new TerserPlugin({ test: /\.js($|\?)/i, }), ], splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.production"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: ["style-loader", { loader: "css-loader" }, "sass-loader"], }, { test: /\.(ts|tsx|js)$/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.prod.json"), }, }, { loader: "babel-loader", options: { presets: [ "@babel/preset-env", ["@babel/preset-react", { runtime: "automatic" }], "@babel/preset-typescript", ], plugins: [["@babel/plugin-transform-runtime"]], }, }, ], }, ], }, </s> add </s> remove libraryTarget: "umd", }, resolve: { extensions: [".tsx", ".ts", ".js", ".css", ".scss"], </s> add </s> remove libraryTarget: "umd", filename: "[name].js", </s> add </s> remove filename: "[name].js", </s> add
https://github.com/excalidraw/excalidraw/commit/da4fa91ffc2bf9b1b74c9fec8164348273a9cad2
src/packages/excalidraw/webpack.dev.config.js
keep keep keep add
<mask> chunkFilename: "excalidraw-assets-dev/[name]-[contenthash].js", <mask> assetModuleFilename: "excalidraw-assets-dev/[name][ext]", <mask> }, <mask> }; </s> chore: Dedupe webpack configs. (#5449) * chore: Dedupe package dependencies and webpack configs. * Fully dedupe `src/packages` via symlinks * Merge https://github.com/excalidraw/excalidraw into dedupe-package-deps-configs * fix: Link `tsc` so `build:example` works in @excalidraw/excalidraw * @excalidraw/plugins: Revert the `yarn.lock` deduping. * Drop yarn commands from the root `package.json`. * Remove more unneeded `package.json` additions. * One more change to drop in `package.json` files. * Deduping: Move even more into common webpack configs. * renaming Co-authored-by: Aakansha Doshi <[email protected]> </s> remove libraryTarget: "umd", filename: "[name].js", </s> add </s> add module.exports = merge(commonConfig, config); </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader" }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.dev.json"), }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ new webpack.EvalSourceMapDevToolPlugin({ exclude: /vendor/ }), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.development"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove libraryTarget: "umd", filename: "[name].js", </s> add </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader", }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.prod.json"), }, }, { loader: "babel-loader", options: { presets: [ "@babel/preset-env", ["@babel/preset-react", { runtime: "automatic" }], "@babel/preset-typescript", ], plugins: [ "transform-class-properties", "@babel/plugin-transform-runtime", ], }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { minimize: true, minimizer: [ new TerserPlugin({ test: /\.js($|\?)/i, }), ], splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.production"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), </s> add
https://github.com/excalidraw/excalidraw/commit/da4fa91ffc2bf9b1b74c9fec8164348273a9cad2
src/packages/excalidraw/webpack.dev.config.js
keep replace replace replace replace replace replace keep replace replace keep keep
<mask> const path = require("path"); <mask> const TerserPlugin = require("terser-webpack-plugin"); <mask> const BundleAnalyzerPlugin = <mask> require("webpack-bundle-analyzer").BundleAnalyzerPlugin; <mask> const autoprefixer = require("autoprefixer"); <mask> const webpack = require("webpack"); <mask> const { parseEnvVariables } = require("./env"); <mask> <mask> module.exports = { <mask> mode: "production", <mask> entry: { <mask> "excalidraw.production.min": "./entry.js", </s> chore: Dedupe webpack configs. (#5449) * chore: Dedupe package dependencies and webpack configs. * Fully dedupe `src/packages` via symlinks * Merge https://github.com/excalidraw/excalidraw into dedupe-package-deps-configs * fix: Link `tsc` so `build:example` works in @excalidraw/excalidraw * @excalidraw/plugins: Revert the `yarn.lock` deduping. * Drop yarn commands from the root `package.json`. * Remove more unneeded `package.json` additions. * One more change to drop in `package.json` files. * Deduping: Move even more into common webpack configs. * renaming Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; </s> add const { merge } = require("webpack-merge"); const commonConfig = require("../common.webpack.prod.config"); </s> remove const webpack = require("webpack"); const autoprefixer = require("autoprefixer"); const { parseEnvVariables } = require("./env"); </s> add const { merge } = require("webpack-merge"); const commonConfig = require("../common.webpack.dev.config"); </s> remove module.exports = { mode: "development", devtool: false, </s> add const config = { </s> remove module.exports = { mode: "production", </s> add const config = { </s> remove filename: "[name].js", </s> add
https://github.com/excalidraw/excalidraw/commit/da4fa91ffc2bf9b1b74c9fec8164348273a9cad2
src/packages/excalidraw/webpack.prod.config.js
keep keep keep keep replace replace keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace
<mask> }, <mask> output: { <mask> path: path.resolve(__dirname, "dist"), <mask> library: "ExcalidrawLib", <mask> libraryTarget: "umd", <mask> filename: "[name].js", <mask> chunkFilename: "excalidraw-assets/[name]-[contenthash].js", <mask> assetModuleFilename: "excalidraw-assets/[name][ext]", <mask> publicPath: "", <mask> }, <mask> resolve: { <mask> extensions: [".js", ".ts", ".tsx", ".css", ".scss"], <mask> }, <mask> module: { <mask> rules: [ <mask> { <mask> test: /\.(sa|sc|c)ss$/, <mask> exclude: /node_modules/, <mask> use: [ <mask> "style-loader", <mask> { <mask> loader: "css-loader", <mask> }, <mask> { <mask> loader: "postcss-loader", <mask> options: { <mask> postcssOptions: { <mask> plugins: [autoprefixer()], <mask> }, <mask> }, <mask> }, <mask> "sass-loader", <mask> ], <mask> }, <mask> { <mask> test: /\.(ts|tsx|js|jsx|mjs)$/, <mask> exclude: /node_modules\/(?!browser-fs-access)/, <mask> use: [ <mask> { <mask> loader: "ts-loader", <mask> options: { <mask> transpileOnly: true, <mask> configFile: path.resolve(__dirname, "../tsconfig.prod.json"), <mask> }, <mask> }, <mask> { <mask> loader: "babel-loader", <mask> options: { <mask> presets: [ <mask> "@babel/preset-env", <mask> ["@babel/preset-react", { runtime: "automatic" }], <mask> "@babel/preset-typescript", <mask> ], <mask> plugins: [ <mask> "transform-class-properties", <mask> "@babel/plugin-transform-runtime", <mask> ], <mask> }, <mask> }, <mask> ], <mask> }, <mask> { <mask> test: /\.(woff|woff2|eot|ttf|otf)$/, <mask> type: "asset/resource", <mask> }, <mask> ], <mask> }, <mask> optimization: { <mask> minimize: true, <mask> minimizer: [ <mask> new TerserPlugin({ <mask> test: /\.js($|\?)/i, <mask> }), <mask> ], <mask> splitChunks: { <mask> chunks: "async", <mask> cacheGroups: { <mask> vendors: { <mask> test: /[\\/]node_modules[\\/]/, <mask> name: "vendor", <mask> }, <mask> }, <mask> }, <mask> }, <mask> plugins: [ <mask> ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), <mask> new webpack.DefinePlugin({ <mask> "process.env": parseEnvVariables( <mask> path.resolve(__dirname, "../../../.env.production"), <mask> ), <mask> }), <mask> ], <mask> externals: { <mask> react: { <mask> root: "React", <mask> commonjs2: "react", <mask> commonjs: "react", <mask> amd: "react", <mask> }, <mask> "react-dom": { <mask> root: "ReactDOM", <mask> commonjs2: "react-dom", <mask> commonjs: "react-dom", <mask> amd: "react-dom", <mask> }, </s> chore: Dedupe webpack configs. (#5449) * chore: Dedupe package dependencies and webpack configs. * Fully dedupe `src/packages` via symlinks * Merge https://github.com/excalidraw/excalidraw into dedupe-package-deps-configs * fix: Link `tsc` so `build:example` works in @excalidraw/excalidraw * @excalidraw/plugins: Revert the `yarn.lock` deduping. * Drop yarn commands from the root `package.json`. * Remove more unneeded `package.json` additions. * One more change to drop in `package.json` files. * Deduping: Move even more into common webpack configs. * renaming Co-authored-by: Aakansha Doshi <[email protected]> </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader" }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.dev.json"), }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ new webpack.EvalSourceMapDevToolPlugin({ exclude: /vendor/ }), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.development"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: ["style-loader", { loader: "css-loader" }, "sass-loader"], }, { test: /\.(ts|tsx|js)$/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.prod.json"), }, }, { loader: "babel-loader", options: { presets: [ "@babel/preset-env", ["@babel/preset-react", { runtime: "automatic" }], "@babel/preset-typescript", ], plugins: [["@babel/plugin-transform-runtime"]], }, }, ], }, ], }, </s> add </s> remove libraryTarget: "umd", }, resolve: { extensions: [".tsx", ".ts", ".js", ".css", ".scss"], </s> add </s> remove ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), </s> add </s> remove filename: "[name].js", </s> add
https://github.com/excalidraw/excalidraw/commit/da4fa91ffc2bf9b1b74c9fec8164348273a9cad2
src/packages/excalidraw/webpack.prod.config.js
keep keep keep add
<mask> chunkFilename: "excalidraw-assets/[name]-[contenthash].js", <mask> assetModuleFilename: "excalidraw-assets/[name][ext]", <mask> }, <mask> }; </s> chore: Dedupe webpack configs. (#5449) * chore: Dedupe package dependencies and webpack configs. * Fully dedupe `src/packages` via symlinks * Merge https://github.com/excalidraw/excalidraw into dedupe-package-deps-configs * fix: Link `tsc` so `build:example` works in @excalidraw/excalidraw * @excalidraw/plugins: Revert the `yarn.lock` deduping. * Drop yarn commands from the root `package.json`. * Remove more unneeded `package.json` additions. * One more change to drop in `package.json` files. * Deduping: Move even more into common webpack configs. * renaming Co-authored-by: Aakansha Doshi <[email protected]> </s> remove libraryTarget: "umd", filename: "[name].js", </s> add </s> add module.exports = merge(commonConfig, config); </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader", }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.prod.json"), }, }, { loader: "babel-loader", options: { presets: [ "@babel/preset-env", ["@babel/preset-react", { runtime: "automatic" }], "@babel/preset-typescript", ], plugins: [ "transform-class-properties", "@babel/plugin-transform-runtime", ], }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { minimize: true, minimizer: [ new TerserPlugin({ test: /\.js($|\?)/i, }), ], splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.production"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove libraryTarget: "umd", filename: "[name].js", </s> add </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader" }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.dev.json"), }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ new webpack.EvalSourceMapDevToolPlugin({ exclude: /vendor/ }), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.development"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), </s> add
https://github.com/excalidraw/excalidraw/commit/da4fa91ffc2bf9b1b74c9fec8164348273a9cad2
src/packages/excalidraw/webpack.prod.config.js
keep keep replace replace keep replace replace keep keep
<mask> const webpack = require("webpack"); <mask> const path = require("path"); <mask> const BundleAnalyzerPlugin = <mask> require("webpack-bundle-analyzer").BundleAnalyzerPlugin; <mask> <mask> module.exports = { <mask> mode: "production", <mask> entry: { "excalidraw-utils.min": "./index.js" }, <mask> output: { </s> chore: Dedupe webpack configs. (#5449) * chore: Dedupe package dependencies and webpack configs. * Fully dedupe `src/packages` via symlinks * Merge https://github.com/excalidraw/excalidraw into dedupe-package-deps-configs * fix: Link `tsc` so `build:example` works in @excalidraw/excalidraw * @excalidraw/plugins: Revert the `yarn.lock` deduping. * Drop yarn commands from the root `package.json`. * Remove more unneeded `package.json` additions. * One more change to drop in `package.json` files. * Deduping: Move even more into common webpack configs. * renaming Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const TerserPlugin = require("terser-webpack-plugin"); const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; const autoprefixer = require("autoprefixer"); const webpack = require("webpack"); const { parseEnvVariables } = require("./env"); </s> add const { merge } = require("webpack-merge"); const commonConfig = require("../common.webpack.prod.config"); </s> remove module.exports = { mode: "production", </s> add const config = { </s> remove const webpack = require("webpack"); const autoprefixer = require("autoprefixer"); const { parseEnvVariables } = require("./env"); </s> add const { merge } = require("webpack-merge"); const commonConfig = require("../common.webpack.dev.config"); </s> remove filename: "[name].js", </s> add </s> remove module.exports = { mode: "development", devtool: false, </s> add const config = {
https://github.com/excalidraw/excalidraw/commit/da4fa91ffc2bf9b1b74c9fec8164348273a9cad2
src/packages/utils/webpack.prod.config.js
keep keep keep replace keep replace replace replace replace keep keep
<mask> entry: { "excalidraw-utils.min": "./index.js" }, <mask> output: { <mask> path: path.resolve(__dirname, "dist"), <mask> filename: "[name].js", <mask> library: "ExcalidrawUtils", <mask> libraryTarget: "umd", <mask> }, <mask> resolve: { <mask> extensions: [".tsx", ".ts", ".js", ".css", ".scss"], <mask> }, <mask> optimization: { </s> chore: Dedupe webpack configs. (#5449) * chore: Dedupe package dependencies and webpack configs. * Fully dedupe `src/packages` via symlinks * Merge https://github.com/excalidraw/excalidraw into dedupe-package-deps-configs * fix: Link `tsc` so `build:example` works in @excalidraw/excalidraw * @excalidraw/plugins: Revert the `yarn.lock` deduping. * Drop yarn commands from the root `package.json`. * Remove more unneeded `package.json` additions. * One more change to drop in `package.json` files. * Deduping: Move even more into common webpack configs. * renaming Co-authored-by: Aakansha Doshi <[email protected]> </s> remove module.exports = { mode: "production", </s> add const config = { </s> remove libraryTarget: "umd", filename: "[name].js", </s> add </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader" }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.dev.json"), }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ new webpack.EvalSourceMapDevToolPlugin({ exclude: /vendor/ }), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.development"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader", }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.prod.json"), }, }, { loader: "babel-loader", options: { presets: [ "@babel/preset-env", ["@babel/preset-react", { runtime: "automatic" }], "@babel/preset-typescript", ], plugins: [ "transform-class-properties", "@babel/plugin-transform-runtime", ], }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { minimize: true, minimizer: [ new TerserPlugin({ test: /\.js($|\?)/i, }), ], splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.production"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove libraryTarget: "umd", filename: "[name].js", </s> add
https://github.com/excalidraw/excalidraw/commit/da4fa91ffc2bf9b1b74c9fec8164348273a9cad2
src/packages/utils/webpack.prod.config.js
keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep replace
<mask> optimization: { <mask> runtimeChunk: false, <mask> }, <mask> module: { <mask> rules: [ <mask> { <mask> test: /\.(sa|sc|c)ss$/, <mask> exclude: /node_modules/, <mask> use: ["style-loader", { loader: "css-loader" }, "sass-loader"], <mask> }, <mask> { <mask> test: /\.(ts|tsx|js)$/, <mask> use: [ <mask> { <mask> loader: "ts-loader", <mask> options: { <mask> transpileOnly: true, <mask> configFile: path.resolve(__dirname, "../tsconfig.prod.json"), <mask> }, <mask> }, <mask> { <mask> loader: "babel-loader", <mask> <mask> options: { <mask> presets: [ <mask> "@babel/preset-env", <mask> ["@babel/preset-react", { runtime: "automatic" }], <mask> "@babel/preset-typescript", <mask> ], <mask> plugins: [["@babel/plugin-transform-runtime"]], <mask> }, <mask> }, <mask> ], <mask> }, <mask> ], <mask> }, <mask> plugins: [ <mask> new webpack.optimize.LimitChunkCountPlugin({ <mask> maxChunks: 1, <mask> }), <mask> ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), </s> chore: Dedupe webpack configs. (#5449) * chore: Dedupe package dependencies and webpack configs. * Fully dedupe `src/packages` via symlinks * Merge https://github.com/excalidraw/excalidraw into dedupe-package-deps-configs * fix: Link `tsc` so `build:example` works in @excalidraw/excalidraw * @excalidraw/plugins: Revert the `yarn.lock` deduping. * Drop yarn commands from the root `package.json`. * Remove more unneeded `package.json` additions. * One more change to drop in `package.json` files. * Deduping: Move even more into common webpack configs. * renaming Co-authored-by: Aakansha Doshi <[email protected]> </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader", }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.prod.json"), }, }, { loader: "babel-loader", options: { presets: [ "@babel/preset-env", ["@babel/preset-react", { runtime: "automatic" }], "@babel/preset-typescript", ], plugins: [ "transform-class-properties", "@babel/plugin-transform-runtime", ], }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { minimize: true, minimizer: [ new TerserPlugin({ test: /\.js($|\?)/i, }), ], splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ ...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.production"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove publicPath: "", }, resolve: { extensions: [".js", ".ts", ".tsx", ".css", ".scss"], }, module: { rules: [ { test: /\.(sa|sc|c)ss$/, exclude: /node_modules/, use: [ "style-loader", { loader: "css-loader" }, { loader: "postcss-loader", options: { postcssOptions: { plugins: [autoprefixer()], }, }, }, "sass-loader", ], }, { test: /\.(ts|tsx|js|jsx|mjs)$/, exclude: /node_modules\/(?!browser-fs-access)/, use: [ { loader: "ts-loader", options: { transpileOnly: true, configFile: path.resolve(__dirname, "../tsconfig.dev.json"), }, }, ], }, { test: /\.(woff|woff2|eot|ttf|otf)$/, type: "asset/resource", }, ], }, optimization: { splitChunks: { chunks: "async", cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/, name: "vendor", }, }, }, }, plugins: [ new webpack.EvalSourceMapDevToolPlugin({ exclude: /vendor/ }), new webpack.DefinePlugin({ "process.env": parseEnvVariables( path.resolve(__dirname, "../../../.env.development"), ), }), ], externals: { react: { root: "React", commonjs2: "react", commonjs: "react", amd: "react", }, "react-dom": { root: "ReactDOM", commonjs2: "react-dom", commonjs: "react-dom", amd: "react-dom", }, </s> add </s> remove libraryTarget: "umd", }, resolve: { extensions: [".tsx", ".ts", ".js", ".css", ".scss"], </s> add </s> remove module.exports = { mode: "development", devtool: false, </s> add const config = { </s> remove filename: "[name].js", </s> add
https://github.com/excalidraw/excalidraw/commit/da4fa91ffc2bf9b1b74c9fec8164348273a9cad2
src/packages/utils/webpack.prod.config.js
keep keep keep keep replace keep keep keep keep keep
<mask> getContainerElement, <mask> measureText, <mask> normalizeText, <mask> wrapText, <mask> getMaxContainerWidth, <mask> getDefaultLineHeight, <mask> } from "./textElement"; <mask> import { <mask> DEFAULT_ELEMENT_PROPS, <mask> DEFAULT_FONT_FAMILY, </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerHeight, getMaxContainerWidth, </s> add getBoundTextMaxHeight, getBoundTextMaxWidth, </s> remove getMaxContainerWidth, getMaxContainerHeight, </s> add getBoundTextMaxWidth, getBoundTextMaxHeight, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove import { FontString } from "./types"; </s> add import { ExcalidrawTextElementWithContainer, FontString } from "./types"; </s> remove getMaxContainerHeight, </s> add getBoundTextMaxHeight,
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/newElement.ts
keep keep keep keep replace keep keep keep keep keep
<mask> if (container) { <mask> text = wrapText( <mask> text, <mask> getFontString(textElement), <mask> getMaxContainerWidth(container), <mask> ); <mask> } <mask> const dimensions = getAdjustedDimensions(textElement, text); <mask> return { text, ...dimensions }; <mask> }; </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove getMaxContainerWidth(updatedElement), getMaxContainerHeight(updatedElement), </s> add getBoundTextMaxWidth(updatedElement), getBoundTextMaxHeight(updatedElement, boundTextElement), </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove maxWidth = getMaxContainerWidth(container); maxHeight = getMaxContainerHeight(container); </s> add maxWidth = getBoundTextMaxWidth(container); maxHeight = getBoundTextMaxHeight( container, updatedTextElement as ExcalidrawTextElementWithContainer, ); </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/newElement.ts
keep replace keep keep replace keep
<mask> handleBindTextResize, <mask> getMaxContainerWidth, <mask> getApproxMinLineHeight, <mask> measureText, <mask> getMaxContainerHeight, <mask> } from "./textElement"; </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerHeight, getMaxContainerWidth, </s> add getBoundTextMaxHeight, getBoundTextMaxWidth, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove getMaxContainerWidth, getMaxContainerHeight, </s> add getBoundTextMaxWidth, getBoundTextMaxHeight, </s> remove getMaxContainerHeight, getMaxContainerWidth, </s> add getBoundTextMaxHeight, getBoundTextMaxWidth, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth,
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/resizeElements.ts
keep keep keep keep replace keep keep keep keep keep
<mask> const hasContainer = isBoundToContainer(element); <mask> if (hasContainer) { <mask> const container = getContainerElement(element); <mask> if (container) { <mask> width = getMaxContainerWidth(container); <mask> } <mask> } <mask> const nextFontSize = element.fontSize * (nextWidth / width); <mask> if (nextFontSize < MIN_FONT_SIZE) { <mask> return null; </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove const containerWidth = width - BOUND_TEXT_PADDING * 8 * 2; if (containerWidth <= 0) { const boundText = getBoundTextElement(container); if (boundText) { return boundText.width; } return BOUND_TEXT_PADDING * 8 * 2; } return containerWidth; </s> add return width - BOUND_TEXT_PADDING * 8 * 2; </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove const boundText = getBoundTextElement(container); if (boundText) { return boundText.height; } return BOUND_TEXT_PADDING * 8 * 2; </s> add return boundTextElement.height; </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!), </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/resizeElements.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> }; <mask> <mask> const nextFont = measureFontSizeFromWidth( <mask> boundTextElement, <mask> getMaxContainerWidth(updatedElement), <mask> getMaxContainerHeight(updatedElement), <mask> ); <mask> if (nextFont === null) { <mask> return; <mask> } <mask> boundTextFont = { </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove const boundText = getBoundTextElement(container); if (boundText) { return boundText.height; } return BOUND_TEXT_PADDING * 8 * 2; </s> add return boundTextElement.height; </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove const containerWidth = width - BOUND_TEXT_PADDING * 8 * 2; if (containerWidth <= 0) { const boundText = getBoundTextElement(container); if (boundText) { return boundText.width; } return BOUND_TEXT_PADDING * 8 * 2; } return containerWidth; </s> add return width - BOUND_TEXT_PADDING * 8 * 2;
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/resizeElements.ts
keep keep keep keep replace keep keep keep keep keep
<mask> }; <mask> const metrics = measureFontSizeFromWidth( <mask> boundTextElement ?? (element.orig as ExcalidrawTextElement), <mask> boundTextElement <mask> ? getMaxContainerWidth(updatedElement) <mask> : updatedElement.width, <mask> boundTextElement <mask> ? getMaxContainerHeight(updatedElement) <mask> : updatedElement.height, <mask> ); </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove ? getMaxContainerHeight(updatedElement) </s> add ? getBoundTextMaxHeight(updatedElement, boundTextElement) </s> remove getMaxContainerWidth(updatedElement), getMaxContainerHeight(updatedElement), </s> add getBoundTextMaxWidth(updatedElement), getBoundTextMaxHeight(updatedElement, boundTextElement), </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> add const textElement = getBoundTextElement( element, ) as ExcalidrawTextElementWithContainer; </s> remove maxWidth = getMaxContainerWidth(container); maxHeight = getMaxContainerHeight(container); </s> add maxWidth = getBoundTextMaxWidth(container); maxHeight = getBoundTextMaxHeight( container, updatedTextElement as ExcalidrawTextElementWithContainer, );
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/resizeElements.ts
keep keep keep keep replace keep keep keep keep keep
<mask> boundTextElement <mask> ? getMaxContainerWidth(updatedElement) <mask> : updatedElement.width, <mask> boundTextElement <mask> ? getMaxContainerHeight(updatedElement) <mask> : updatedElement.height, <mask> ); <mask> <mask> if (!metrics) { <mask> return; </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove ? getMaxContainerWidth(updatedElement) </s> add ? getBoundTextMaxWidth(updatedElement) </s> remove getMaxContainerWidth(updatedElement), getMaxContainerHeight(updatedElement), </s> add getBoundTextMaxWidth(updatedElement), getBoundTextMaxHeight(updatedElement, boundTextElement), </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove const boundText = getBoundTextElement(container); if (boundText) { return boundText.height; } return BOUND_TEXT_PADDING * 8 * 2; </s> add return boundTextElement.height; </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/resizeElements.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> import { API } from "../tests/helpers/api"; <mask> import { <mask> computeContainerDimensionForBoundText, <mask> getContainerCoords, <mask> getMaxContainerWidth, <mask> getMaxContainerHeight, <mask> wrapText, <mask> detectLineHeight, <mask> getLineHeightInPx, <mask> getDefaultLineHeight, <mask> parseTokens, </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerHeight, getMaxContainerWidth, </s> add getBoundTextMaxHeight, getBoundTextMaxWidth, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove import { FontString } from "./types"; </s> add import { ExcalidrawTextElementWithContainer, FontString } from "./types"; </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove getMaxContainerHeight, getMaxContainerWidth, </s> add getBoundTextMaxHeight, getBoundTextMaxWidth, </s> remove getMaxContainerHeight, </s> add getBoundTextMaxHeight,
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textElement.test.ts
keep keep keep keep replace keep keep keep keep keep
<mask> getLineHeightInPx, <mask> getDefaultLineHeight, <mask> parseTokens, <mask> } from "./textElement"; <mask> import { FontString } from "./types"; <mask> <mask> describe("Test wrapText", () => { <mask> const font = "20px Cascadia, width: Segoe UI Emoji" as FontString; <mask> <mask> it("shouldn't add new lines for trailing spaces", () => { </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove describe("Test getMaxContainerWidth", () => { </s> add describe("Test getBoundTextMaxWidth", () => { </s> remove getMaxContainerWidth, getMaxContainerHeight, </s> add getBoundTextMaxWidth, getBoundTextMaxHeight, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove expect(getMaxContainerWidth(container)).toBe(168); </s> add expect(getBoundTextMaxWidth(container)).toBe(168); </s> remove getMaxContainerHeight, </s> add getBoundTextMaxHeight,
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textElement.test.ts
keep keep keep keep replace keep keep keep keep keep
<mask> ); <mask> }); <mask> }); <mask> <mask> describe("Test getMaxContainerWidth", () => { <mask> const params = { <mask> width: 178, <mask> height: 194, <mask> }; <mask> </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove expect(getMaxContainerHeight(container)).toBe(87); </s> add expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(87); }); it("should return max height when container is arrow", () => { const container = API.createElement({ type: "arrow", ...params, }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(194); }); it("should return max height when container is arrow and height is less than threshold", () => { const container = API.createElement({ type: "arrow", ...params, height: 70, boundElements: [{ type: "text", id: "text-id" }], }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe( boundTextElement.height, ); </s> remove expect(getMaxContainerWidth(container)).toBe(168); </s> add expect(getBoundTextMaxWidth(container)).toBe(168); </s> remove import { FontString } from "./types"; </s> add import { ExcalidrawTextElementWithContainer, FontString } from "./types"; </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove text: wrapText(text, font, getMaxContainerWidth(container)), </s> add text: wrapText(text, font, getBoundTextMaxWidth(container)),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textElement.test.ts
keep keep keep keep replace keep keep keep keep keep
<mask> }; <mask> <mask> it("should return max width when container is rectangle", () => { <mask> const container = API.createElement({ type: "rectangle", ...params }); <mask> expect(getMaxContainerWidth(container)).toBe(168); <mask> }); <mask> <mask> it("should return max width when container is ellipse", () => { <mask> const container = API.createElement({ type: "ellipse", ...params }); <mask> expect(getMaxContainerWidth(container)).toBe(116); </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove expect(getMaxContainerHeight(container)).toBe(87); </s> add expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(87); }); it("should return max height when container is arrow", () => { const container = API.createElement({ type: "arrow", ...params, }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(194); }); it("should return max height when container is arrow and height is less than threshold", () => { const container = API.createElement({ type: "arrow", ...params, height: 70, boundElements: [{ type: "text", id: "text-id" }], }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe( boundTextElement.height, ); </s> remove describe("Test getMaxContainerWidth", () => { </s> add describe("Test getBoundTextMaxWidth", () => { </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove const containerWidth = width - BOUND_TEXT_PADDING * 8 * 2; if (containerWidth <= 0) { const boundText = getBoundTextElement(container); if (boundText) { return boundText.width; } return BOUND_TEXT_PADDING * 8 * 2; } return containerWidth; </s> add return width - BOUND_TEXT_PADDING * 8 * 2; </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textElement.test.ts
keep keep keep keep replace keep keep keep keep keep
<mask> }); <mask> <mask> it("should return max height when container is diamond", () => { <mask> const container = API.createElement({ type: "diamond", ...params }); <mask> expect(getMaxContainerHeight(container)).toBe(87); <mask> }); <mask> }); <mask> }); <mask> <mask> const textElement = API.createElement({ </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove expect(getMaxContainerWidth(container)).toBe(168); </s> add expect(getBoundTextMaxWidth(container)).toBe(168); </s> remove describe("Test getMaxContainerWidth", () => { </s> add describe("Test getBoundTextMaxWidth", () => { </s> remove text: wrapText(text, font, getMaxContainerWidth(container)), </s> add text: wrapText(text, font, getBoundTextMaxWidth(container)), </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!), </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => {
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textElement.test.ts
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> export const getMaxContainerWidth = (container: ExcalidrawElement) => { <mask> const width = getContainerDims(container).width; <mask> if (isArrowElement(container)) { <mask> const containerWidth = width - BOUND_TEXT_PADDING * 8 * 2; <mask> if (containerWidth <= 0) { <mask> const boundText = getBoundTextElement(container); <mask> if (boundText) { <mask> return boundText.width; <mask> } <mask> return BOUND_TEXT_PADDING * 8 * 2; <mask> } <mask> return containerWidth; <mask> } <mask> <mask> if (container.type === "ellipse") { <mask> // The width of the largest rectangle inscribed inside an ellipse is <mask> // Math.round((ellipse.width / 2) * Math.sqrt(2)) which is derived from </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove const boundText = getBoundTextElement(container); if (boundText) { return boundText.height; } return BOUND_TEXT_PADDING * 8 * 2; </s> add return boundTextElement.height; </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove getMaxContainerHeight, </s> add getBoundTextMaxHeight, </s> remove expect(getMaxContainerWidth(container)).toBe(168); </s> add expect(getBoundTextMaxWidth(container)).toBe(168); </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textElement.ts
keep replace keep keep keep keep replace replace replace replace replace
<mask> <mask> export const getMaxContainerHeight = (container: ExcalidrawElement) => { <mask> const height = getContainerDims(container).height; <mask> if (isArrowElement(container)) { <mask> const containerHeight = height - BOUND_TEXT_PADDING * 8 * 2; <mask> if (containerHeight <= 0) { <mask> const boundText = getBoundTextElement(container); <mask> if (boundText) { <mask> return boundText.height; <mask> } <mask> return BOUND_TEXT_PADDING * 8 * 2; </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove const containerWidth = width - BOUND_TEXT_PADDING * 8 * 2; if (containerWidth <= 0) { const boundText = getBoundTextElement(container); if (boundText) { return boundText.width; } return BOUND_TEXT_PADDING * 8 * 2; } return containerWidth; </s> add return width - BOUND_TEXT_PADDING * 8 * 2; </s> remove getMaxContainerHeight, </s> add getBoundTextMaxHeight, </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove expect(getMaxContainerHeight(container)).toBe(87); </s> add expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(87); }); it("should return max height when container is arrow", () => { const container = API.createElement({ type: "arrow", ...params, }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(194); }); it("should return max height when container is arrow and height is less than threshold", () => { const container = API.createElement({ type: "arrow", ...params, height: 70, boundElements: [{ type: "text", id: "text-id" }], }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe( boundTextElement.height, ); </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textElement.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> measureText, <mask> normalizeText, <mask> redrawTextBoundingBox, <mask> wrapText, <mask> getMaxContainerHeight, <mask> getMaxContainerWidth, <mask> computeContainerDimensionForBoundText, <mask> detectLineHeight, <mask> } from "./textElement"; <mask> import { <mask> actionDecreaseFontSize, </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerWidth, getMaxContainerHeight, </s> add getBoundTextMaxWidth, getBoundTextMaxHeight, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove getMaxContainerHeight, </s> add getBoundTextMaxHeight, </s> remove import { FontString } from "./types"; </s> add import { ExcalidrawTextElementWithContainer, FontString } from "./types";
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textWysiwyg.tsx
keep keep keep keep replace replace keep keep keep keep keep
<mask> ); <mask> } <mask> } <mask> <mask> maxWidth = getMaxContainerWidth(container); <mask> maxHeight = getMaxContainerHeight(container); <mask> <mask> // autogrow container height if text exceeds <mask> if (!isArrowElement(container) && textElementHeight > maxHeight) { <mask> const targetContainerHeight = computeContainerDimensionForBoundText( <mask> textElementHeight, </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove const boundText = getBoundTextElement(container); if (boundText) { return boundText.height; } return BOUND_TEXT_PADDING * 8 * 2; </s> add return boundTextElement.height; </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!), </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove const containerWidth = width - BOUND_TEXT_PADDING * 8 * 2; if (containerWidth <= 0) { const boundText = getBoundTextElement(container); if (boundText) { return boundText.width; } return BOUND_TEXT_PADDING * 8 * 2; } return containerWidth; </s> add return width - BOUND_TEXT_PADDING * 8 * 2;
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textWysiwyg.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> if (container) { <mask> const wrappedText = wrapText( <mask> `${editable.value}${data}`, <mask> font, <mask> getMaxContainerWidth(container), <mask> ); <mask> const width = getTextWidth(wrappedText, font); <mask> editable.style.width = `${width}px`; <mask> } <mask> }; </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!), </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove const containerWidth = width - BOUND_TEXT_PADDING * 8 * 2; if (containerWidth <= 0) { const boundText = getBoundTextElement(container); if (boundText) { return boundText.width; } return BOUND_TEXT_PADDING * 8 * 2; } return containerWidth; </s> add return width - BOUND_TEXT_PADDING * 8 * 2; </s> remove getMaxContainerWidth(updatedElement), getMaxContainerHeight(updatedElement), </s> add getBoundTextMaxWidth(updatedElement), getBoundTextMaxHeight(updatedElement, boundTextElement),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textWysiwyg.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> const container = getContainerElement(element); <mask> const wrappedText = wrapText( <mask> normalizeText(editable.value), <mask> font, <mask> getMaxContainerWidth(container!), <mask> ); <mask> const { width, height } = measureText( <mask> wrappedText, <mask> font, <mask> updatedTextElement.lineHeight, </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove expect(getMaxContainerHeight(container)).toBe(87); </s> add expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(87); }); it("should return max height when container is arrow", () => { const container = API.createElement({ type: "arrow", ...params, }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(194); }); it("should return max height when container is arrow and height is less than threshold", () => { const container = API.createElement({ type: "arrow", ...params, height: 70, boundElements: [{ type: "text", id: "text-id" }], }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe( boundTextElement.height, ); </s> remove maxWidth = getMaxContainerWidth(container); maxHeight = getMaxContainerHeight(container); </s> add maxWidth = getBoundTextMaxWidth(container); maxHeight = getBoundTextMaxHeight( container, updatedTextElement as ExcalidrawTextElementWithContainer, ); </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/element/textWysiwyg.tsx
keep keep keep keep replace replace keep keep keep keep keep
<mask> getBoundTextElement, <mask> getContainerCoords, <mask> getContainerElement, <mask> getLineHeightInPx, <mask> getMaxContainerHeight, <mask> getMaxContainerWidth, <mask> } from "../element/textElement"; <mask> import { LinearElementEditor } from "../element/linearElementEditor"; <mask> <mask> // using a stronger invert (100% vs our regular 93%) and saturate <mask> // as a temp hack to make images in dark theme look closer to original </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerWidth, getMaxContainerHeight, </s> add getBoundTextMaxWidth, getBoundTextMaxHeight, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove import { FontString } from "./types"; </s> add import { ExcalidrawTextElementWithContainer, FontString } from "./types"; </s> remove getMaxContainerHeight, getMaxContainerWidth, </s> add getBoundTextMaxHeight, getBoundTextMaxWidth,
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/renderer/renderElement.ts
keep add keep keep keep keep
<mask> hasBoundTextElement(element) <mask> ) { <mask> const coords = getContainerCoords(element); <mask> context.strokeStyle = "#c92a2a"; <mask> context.lineWidth = 3; <mask> context.strokeRect( </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerWidth(element) * window.devicePixelRatio, getMaxContainerHeight(element) * window.devicePixelRatio, </s> add getBoundTextMaxWidth(element) * window.devicePixelRatio, getBoundTextMaxHeight(element, textElement) * window.devicePixelRatio, </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container); </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!), </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove getMaxContainerWidth(updatedElement), getMaxContainerHeight(updatedElement), </s> add getBoundTextMaxWidth(updatedElement), getBoundTextMaxHeight(updatedElement, boundTextElement),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/renderer/renderElement.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> context.lineWidth = 3; <mask> context.strokeRect( <mask> (coords.x + renderConfig.scrollX) * window.devicePixelRatio, <mask> (coords.y + renderConfig.scrollY) * window.devicePixelRatio, <mask> getMaxContainerWidth(element) * window.devicePixelRatio, <mask> getMaxContainerHeight(element) * window.devicePixelRatio, <mask> ); <mask> } <mask> } <mask> context.restore(); <mask> </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> add const textElement = getBoundTextElement( element, ) as ExcalidrawTextElementWithContainer; </s> remove const containerWidth = width - BOUND_TEXT_PADDING * 8 * 2; if (containerWidth <= 0) { const boundText = getBoundTextElement(container); if (boundText) { return boundText.width; } return BOUND_TEXT_PADDING * 8 * 2; } return containerWidth; </s> add return width - BOUND_TEXT_PADDING * 8 * 2; </s> remove const boundText = getBoundTextElement(container); if (boundText) { return boundText.height; } return BOUND_TEXT_PADDING * 8 * 2; </s> add return boundTextElement.height; </s> remove export const getMaxContainerHeight = (container: ExcalidrawElement) => { </s> add export const getBoundTextMaxHeight = ( container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, ) => { </s> remove getMaxContainerHeight, </s> add getBoundTextMaxHeight, </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container);
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/renderer/renderElement.ts
keep keep keep keep replace keep keep keep keep keep
<mask> import { resize, rotate } from "./utils"; <mask> import { <mask> getBoundTextElementPosition, <mask> wrapText, <mask> getMaxContainerWidth, <mask> } from "../element/textElement"; <mask> import * as textElementUtils from "../element/textElement"; <mask> import { ROUNDNESS, VERTICAL_ALIGN } from "../constants"; <mask> <mask> const renderScene = jest.spyOn(Renderer, "renderScene"); </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove getMaxContainerWidth, getMaxContainerHeight, </s> add getBoundTextMaxWidth, getBoundTextMaxHeight, </s> remove getMaxContainerWidth, </s> add getBoundTextMaxWidth, </s> remove import { FontString } from "./types"; </s> add import { ExcalidrawTextElementWithContainer, FontString } from "./types"; </s> remove getMaxContainerHeight, getMaxContainerWidth, </s> add getBoundTextMaxHeight, getBoundTextMaxWidth, </s> remove getMaxContainerHeight, getMaxContainerWidth, </s> add getBoundTextMaxHeight, getBoundTextMaxWidth, </s> remove getMaxContainerHeight, </s> add getBoundTextMaxHeight,
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/tests/linearElementEditor.test.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> const textElement = API.createElement({ <mask> type: "text", <mask> x: 0, <mask> y: 0, <mask> text: wrapText(text, font, getMaxContainerWidth(container)), <mask> containerId: container.id, <mask> width: 30, <mask> height: 20, <mask> }) as ExcalidrawTextElementWithContainer; <mask> </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove expect(getMaxContainerHeight(container)).toBe(87); </s> add expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(87); }); it("should return max height when container is arrow", () => { const container = API.createElement({ type: "arrow", ...params, }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe(194); }); it("should return max height when container is arrow and height is less than threshold", () => { const container = API.createElement({ type: "arrow", ...params, height: 70, boundElements: [{ type: "text", id: "text-id" }], }); expect(getBoundTextMaxHeight(container, boundTextElement)).toBe( boundTextElement.height, ); </s> add const textElement = getBoundTextElement( element, ) as ExcalidrawTextElementWithContainer; </s> remove expect(getMaxContainerWidth(container)).toBe(168); </s> add expect(getBoundTextMaxWidth(container)).toBe(168); </s> remove describe("Test getMaxContainerWidth", () => { </s> add describe("Test getBoundTextMaxWidth", () => { </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!), </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container),
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/tests/linearElementEditor.test.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> expect(arrow.width).toBe(400); <mask> expect(rect.x).toBe(400); <mask> expect(rect.y).toBe(0); <mask> expect( <mask> wrapText(textElement.originalText, font, getMaxContainerWidth(arrow)), <mask> ).toMatchInlineSnapshot(` <mask> "Online whiteboard collaboration <mask> made easy" <mask> `); <mask> const handleBindTextResizeSpy = jest.spyOn( </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove wrapText(textElement.originalText, font, getMaxContainerWidth(arrow)), </s> add wrapText(textElement.originalText, font, getBoundTextMaxWidth(arrow)), </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!), </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove text: wrapText(text, font, getMaxContainerWidth(container)), </s> add text: wrapText(text, font, getBoundTextMaxWidth(container)), </s> add const textElement = getBoundTextElement( element, ) as ExcalidrawTextElementWithContainer; </s> remove width = getMaxContainerWidth(container); </s> add width = getBoundTextMaxWidth(container);
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/tests/linearElementEditor.test.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> h.elements[1], <mask> false, <mask> ); <mask> expect( <mask> wrapText(textElement.originalText, font, getMaxContainerWidth(arrow)), <mask> ).toMatchInlineSnapshot(` <mask> "Online whiteboard <mask> collaboration made <mask> easy" <mask> `); </s> fix: cleanup getMaxContainerHeight and getMaxContainerWidth (#6519) * fix: cleanup getMaxContainerHeight and getMaxContainerWidth * rename getMaxContainerWidth -> getBoundTextMaxMaxWidth and getMaxContainerHeight -> getBoundTextMaxHeight * add specs </s> remove wrapText(textElement.originalText, font, getMaxContainerWidth(arrow)), </s> add wrapText(textElement.originalText, font, getBoundTextMaxWidth(arrow)), </s> remove getMaxContainerWidth(container!), </s> add getBoundTextMaxWidth(container!), </s> remove text: wrapText(text, font, getMaxContainerWidth(container)), </s> add text: wrapText(text, font, getBoundTextMaxWidth(container)), </s> remove getMaxContainerWidth(container), </s> add getBoundTextMaxWidth(container), </s> remove maxWidth = getMaxContainerWidth(container); maxHeight = getMaxContainerHeight(container); </s> add maxWidth = getBoundTextMaxWidth(container); maxHeight = getBoundTextMaxHeight( container, updatedTextElement as ExcalidrawTextElementWithContainer, ); </s> remove ? getMaxContainerHeight(updatedElement) </s> add ? getBoundTextMaxHeight(updatedElement, boundTextElement)
https://github.com/excalidraw/excalidraw/commit/da8dd389a9dd7e6528fbd6bf85b12e8ec052f325
src/tests/linearElementEditor.test.tsx
keep replace keep keep keep keep replace replace replace replace replace replace keep keep
<mask> describe("getElementAbsoluteCoords", () => { <mask> it("test x1 coordinate if width is positive or zero", () => { <mask> const [x1] = getElementAbsoluteCoords(_ce({ x: 10, y: 0, w: 10, h: 0 })); <mask> expect(x1).toEqual(10); <mask> }); <mask> <mask> it("test x1 coordinate if width is negative", () => { <mask> const [x1] = getElementAbsoluteCoords(_ce({ x: 20, y: 0, w: -10, h: 0 })); <mask> expect(x1).toEqual(10); <mask> }); <mask> <mask> it("test x2 coordinate if width is positive or zero", () => { <mask> const [, , x2] = getElementAbsoluteCoords( <mask> _ce({ x: 10, y: 0, w: 10, h: 0 }), </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove it("test x2 coordinate if width is negative", () => { const [, , x2] = getElementAbsoluteCoords( _ce({ x: 10, y: 0, w: -10, h: 0 }), ); expect(x2).toEqual(10); }); it("test y1 coordinate if height is positive or zero", () => { </s> add it("test y1 coordinate", () => { </s> remove it("test y1 coordinate if height is negative", () => { const [, y1] = getElementAbsoluteCoords(_ce({ x: 0, y: 20, w: 0, h: -10 })); expect(y1).toEqual(10); }); it("test y2 coordinate if height is positive or zero", () => { </s> add it("test y2 coordinate", () => { </s> remove it("test y2 coordinate if height is negative", () => { const [, , , y2] = getElementAbsoluteCoords( _ce({ x: 0, y: 10, w: 0, h: -10 }), ); expect(y2).toEqual(10); }); </s> add </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove const ops = shape[1].sets[0].ops; </s> add // first element is always the curve const ops = shape[0].sets[0].ops;
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/bounds.test.ts
keep replace replace replace replace replace replace replace replace keep keep keep keep replace replace replace replace replace replace keep
<mask> <mask> it("test x2 coordinate if width is negative", () => { <mask> const [, , x2] = getElementAbsoluteCoords( <mask> _ce({ x: 10, y: 0, w: -10, h: 0 }), <mask> ); <mask> expect(x2).toEqual(10); <mask> }); <mask> <mask> it("test y1 coordinate if height is positive or zero", () => { <mask> const [, y1] = getElementAbsoluteCoords(_ce({ x: 0, y: 10, w: 0, h: 10 })); <mask> expect(y1).toEqual(10); <mask> }); <mask> <mask> it("test y1 coordinate if height is negative", () => { <mask> const [, y1] = getElementAbsoluteCoords(_ce({ x: 0, y: 20, w: 0, h: -10 })); <mask> expect(y1).toEqual(10); <mask> }); <mask> <mask> it("test y2 coordinate if height is positive or zero", () => { <mask> const [, , , y2] = getElementAbsoluteCoords( </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove it("test x1 coordinate if width is negative", () => { const [x1] = getElementAbsoluteCoords(_ce({ x: 20, y: 0, w: -10, h: 0 })); expect(x1).toEqual(10); }); it("test x2 coordinate if width is positive or zero", () => { </s> add it("test x2 coordinate", () => { </s> remove it("test y2 coordinate if height is negative", () => { const [, , , y2] = getElementAbsoluteCoords( _ce({ x: 0, y: 10, w: 0, h: -10 }), ); expect(y2).toEqual(10); }); </s> add </s> remove it("test x1 coordinate if width is positive or zero", () => { </s> add it("test x1 coordinate", () => { </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove "arrow", </s> add element.type,
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/bounds.test.ts
keep keep keep keep replace replace replace replace replace replace replace keep
<mask> _ce({ x: 0, y: 10, w: 0, h: 10 }), <mask> ); <mask> expect(y2).toEqual(20); <mask> }); <mask> <mask> it("test y2 coordinate if height is negative", () => { <mask> const [, , , y2] = getElementAbsoluteCoords( <mask> _ce({ x: 0, y: 10, w: 0, h: -10 }), <mask> ); <mask> expect(y2).toEqual(10); <mask> }); <mask> }); </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove it("test y1 coordinate if height is negative", () => { const [, y1] = getElementAbsoluteCoords(_ce({ x: 0, y: 20, w: 0, h: -10 })); expect(y1).toEqual(10); }); it("test y2 coordinate if height is positive or zero", () => { </s> add it("test y2 coordinate", () => { </s> remove it("test x2 coordinate if width is negative", () => { const [, , x2] = getElementAbsoluteCoords( _ce({ x: 10, y: 0, w: -10, h: 0 }), ); expect(x2).toEqual(10); }); it("test y1 coordinate if height is positive or zero", () => { </s> add it("test y1 coordinate", () => { </s> remove it("test x1 coordinate if width is negative", () => { const [x1] = getElementAbsoluteCoords(_ce({ x: 20, y: 0, w: -10, h: 0 })); expect(x1).toEqual(10); }); it("test x2 coordinate if width is positive or zero", () => { </s> add it("test x2 coordinate", () => { </s> remove it("test x1 coordinate if width is positive or zero", () => { </s> add it("test x1 coordinate", () => { </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); </s> add const [x1, y1, x2, y2] = getLinearElementAbsoluteBounds(element);
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/bounds.test.ts
keep keep keep keep replace replace keep replace replace keep keep
<mask> import { Point } from "roughjs/bin/geometry"; <mask> <mask> // If the element is created from right to left, the width is going to be negative <mask> // This set of functions retrieves the absolute position of the 4 points. <mask> // We can't just always normalize it since we need to remember the fact that an arrow <mask> // is pointing left or right. <mask> export function getElementAbsoluteCoords(element: ExcalidrawElement) { <mask> if (element.type === "arrow") { <mask> return getArrowAbsoluteBounds(element); <mask> } <mask> return [ </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove // hit test curve and lien segments for arrow return ( hitTestRoughShape(shape[0].sets, relX, relY) || hitTestRoughShape(shape[1].sets, relX, relY) || hitTestRoughShape(shape[2].sets, relX, relY) ); } else if (element.type === "line") { const [x1, y1, x2, y2] = getLinePoints(element); // The computation is done at the origin, we need to add a translation x -= element.x; y -= element.y; return distanceBetweenPointAndSegment(x, y, x1, y1, x2, y2) < lineThreshold; </s> add // hit thest all "subshapes" of the linear element return shape.some(s => hitTestRoughShape(s.sets, relX, relY)); </s> remove element.width >= 0 ? element.x : element.x + element.width, // x1 element.height >= 0 ? element.y : element.y + element.height, // y1 element.width >= 0 ? element.x + element.width : element.x, // x2 element.height >= 0 ? element.y + element.height : element.y, // y2 </s> add element.x, element.y, element.x + element.width, element.y + element.height, </s> remove const ops = shape[1].sets[0].ops; </s> add // first element is always the curve const ops = shape[0].sets[0].ops; </s> remove if (element.type === "line") { return { nw: handlers.nw, se: handlers.se, } as typeof handlers; } else if (element.type === "arrow") { </s> add if (element.type === "arrow" || element.type === "line") { </s> remove if (!draggingOccurred && this.state.elementType === "arrow") { </s> add if ( !draggingOccurred && (this.state.elementType === "arrow" || this.state.elementType === "line") ) {
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/bounds.ts
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> if (element.type === "arrow") { <mask> return getArrowAbsoluteBounds(element); <mask> } <mask> return [ <mask> element.width >= 0 ? element.x : element.x + element.width, // x1 <mask> element.height >= 0 ? element.y : element.y + element.height, // y1 <mask> element.width >= 0 ? element.x + element.width : element.x, // x2 <mask> element.height >= 0 ? element.y + element.height : element.y, // y2 <mask> ]; <mask> } <mask> <mask> export function getDiamondPoints(element: ExcalidrawElement) { <mask> // Here we add +1 to avoid these numbers to be 0 </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if (element.type === "arrow") { return getArrowAbsoluteBounds(element); </s> add if (element.type === "arrow" || element.type === "line") { return getLinearElementAbsoluteBounds(element); </s> remove if (isLinear) { resizePerfectLineForNWHandler(element, x, y); } else { element.y += element.height - element.width; element.height = element.width; } </s> add element.y += element.height - element.width; element.height = element.width; </s> remove // We can't just always normalize it since we need to remember the fact that an arrow // is pointing left or right. </s> add </s> add if (element.type === "arrow" || element.type === "line") { return element.points.length === 0; } </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width; </s> remove // hit test curve and lien segments for arrow return ( hitTestRoughShape(shape[0].sets, relX, relY) || hitTestRoughShape(shape[1].sets, relX, relY) || hitTestRoughShape(shape[2].sets, relX, relY) ); } else if (element.type === "line") { const [x1, y1, x2, y2] = getLinePoints(element); // The computation is done at the origin, we need to add a translation x -= element.x; y -= element.y; return distanceBetweenPointAndSegment(x, y, x1, y1, x2, y2) < lineThreshold; </s> add // hit thest all "subshapes" of the linear element return shape.some(s => hitTestRoughShape(s.sets, relX, relY));
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/bounds.ts
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY]; <mask> } <mask> <mask> export function getArrowAbsoluteBounds(element: ExcalidrawElement) { <mask> if (element.points.length < 2 || !element.shape) { <mask> const { minX, minY, maxX, maxY } = element.points.reduce( <mask> (limits, [x, y]) => { <mask> limits.minY = Math.min(limits.minY, y); <mask> limits.minX = Math.min(limits.minX, x); </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove const ops = shape[1].sets[0].ops; </s> add // first element is always the curve const ops = shape[0].sets[0].ops; </s> remove export function getLinePoints(element: ExcalidrawElement) { const x1 = 0; const y1 = 0; const x2 = element.width; const y2 = element.height; return [x1, y1, x2, y2]; } </s> add </s> remove } else if (element.type === "arrow") { </s> add } else if (element.type === "arrow" || element.type === "line") { </s> remove const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); </s> add const [x1, y1, x2, y2] = getLinearElementAbsoluteBounds(element); </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) {
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/bounds.ts
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> const shape = element.shape as Drawable[]; <mask> <mask> const ops = shape[1].sets[0].ops; <mask> <mask> let currentP: Point = [0, 0]; <mask> <mask> const { minX, minY, maxX, maxY } = ops.reduce( <mask> (limits, { op, data }) => { </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove export function getArrowAbsoluteBounds(element: ExcalidrawElement) { </s> add export function getLinearElementAbsoluteBounds(element: ExcalidrawElement) { </s> remove export function getLinePoints(element: ExcalidrawElement) { const x1 = 0; const y1 = 0; const x2 = element.width; const y2 = element.height; return [x1, y1, x2, y2]; } </s> add </s> remove // If shape does not consist of curve and two line segments // for arrow shape, return false if (shape.length < 3) { return false; } </s> add </s> remove } else if (element.type === "arrow") { </s> add } else if (element.type === "arrow" || element.type === "line") { </s> remove if (element.type === "arrow") { [elementX1, elementY1, elementX2, elementY2] = getArrowAbsoluteBounds( element, ); </s> add if (element.type === "arrow" || element.type === "line") { [ elementX1, elementY1, elementX2, elementY2, ] = getLinearElementAbsoluteBounds(element); </s> remove "arrow", </s> add element.type,
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/bounds.ts
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> return [x2, y2, x3, y3, x4, y4]; <mask> } <mask> <mask> export function getLinePoints(element: ExcalidrawElement) { <mask> const x1 = 0; <mask> const y1 = 0; <mask> const x2 = element.width; <mask> const y2 = element.height; <mask> <mask> return [x1, y1, x2, y2]; <mask> } <mask> <mask> export function getCommonBounds(elements: readonly ExcalidrawElement[]) { <mask> let minX = Infinity; <mask> let maxX = -Infinity; <mask> let minY = Infinity; <mask> let maxY = -Infinity; </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if (element.type === "arrow") { [elementX1, elementY1, elementX2, elementY2] = getArrowAbsoluteBounds( element, ); </s> add if (element.type === "arrow" || element.type === "line") { [ elementX1, elementY1, elementX2, elementY2, ] = getLinearElementAbsoluteBounds(element); </s> remove const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); </s> add const [x1, y1, x2, y2] = getLinearElementAbsoluteBounds(element); </s> remove const ops = shape[1].sets[0].ops; </s> add // first element is always the curve const ops = shape[0].sets[0].ops; </s> remove export function getArrowAbsoluteBounds(element: ExcalidrawElement) { </s> add export function getLinearElementAbsoluteBounds(element: ExcalidrawElement) { </s> remove // If shape does not consist of curve and two line segments // for arrow shape, return false if (shape.length < 3) { return false; } </s> add </s> remove // hit test curve and lien segments for arrow return ( hitTestRoughShape(shape[0].sets, relX, relY) || hitTestRoughShape(shape[1].sets, relX, relY) || hitTestRoughShape(shape[2].sets, relX, relY) ); } else if (element.type === "line") { const [x1, y1, x2, y2] = getLinePoints(element); // The computation is done at the origin, we need to add a translation x -= element.x; y -= element.y; return distanceBetweenPointAndSegment(x, y, x1, y1, x2, y2) < lineThreshold; </s> add // hit thest all "subshapes" of the linear element return shape.some(s => hitTestRoughShape(s.sets, relX, relY));
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/bounds.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> import { ExcalidrawElement } from "./types"; <mask> import { <mask> getDiamondPoints, <mask> getElementAbsoluteCoords, <mask> getLinePoints, <mask> getArrowAbsoluteBounds, <mask> } from "./bounds"; <mask> import { Point } from "roughjs/bin/geometry"; <mask> import { Drawable, OpSet } from "roughjs/bin/core"; <mask> <mask> function isElementDraggableFromInside(element: ExcalidrawElement): boolean { </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove import { getArrowAbsoluteBounds } from "./bounds"; </s> add import { getLinearElementAbsoluteBounds } from "./bounds"; </s> remove getLinePoints, getArrowAbsoluteBounds, </s> add getLinearElementAbsoluteBounds, </s> add if (element.type === "arrow" || element.type === "line") { return element.points.length === 0; } </s> remove resizePerfectLineForNWHandler, </s> add </s> remove // We can't just always normalize it since we need to remember the fact that an arrow // is pointing left or right. </s> add </s> remove const ops = shape[1].sets[0].ops; </s> add // first element is always the curve const ops = shape[0].sets[0].ops;
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/collision.ts
keep keep replace keep keep keep keep replace replace replace replace replace keep keep keep keep
<mask> lineThreshold <mask> ); <mask> } else if (element.type === "arrow") { <mask> if (!element.shape) { <mask> return false; <mask> } <mask> const shape = element.shape as Drawable[]; <mask> // If shape does not consist of curve and two line segments <mask> // for arrow shape, return false <mask> if (shape.length < 3) { <mask> return false; <mask> } <mask> <mask> const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); <mask> if (x < x1 || y < y1 - 10 || x > x2 || y > y2 + 10) { <mask> return false; </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); </s> add const [x1, y1, x2, y2] = getLinearElementAbsoluteBounds(element); </s> remove // hit test curve and lien segments for arrow return ( hitTestRoughShape(shape[0].sets, relX, relY) || hitTestRoughShape(shape[1].sets, relX, relY) || hitTestRoughShape(shape[2].sets, relX, relY) ); } else if (element.type === "line") { const [x1, y1, x2, y2] = getLinePoints(element); // The computation is done at the origin, we need to add a translation x -= element.x; y -= element.y; return distanceBetweenPointAndSegment(x, y, x1, y1, x2, y2) < lineThreshold; </s> add // hit thest all "subshapes" of the linear element return shape.some(s => hitTestRoughShape(s.sets, relX, relY)); </s> remove const ops = shape[1].sets[0].ops; </s> add // first element is always the curve const ops = shape[0].sets[0].ops; </s> remove if (!draggingOccurred && this.state.elementType === "arrow") { </s> add if ( !draggingOccurred && (this.state.elementType === "arrow" || this.state.elementType === "line") ) { </s> remove if (element.type === "arrow") { return getArrowAbsoluteBounds(element); </s> add if (element.type === "arrow" || element.type === "line") { return getLinearElementAbsoluteBounds(element);
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/collision.ts
keep keep keep keep replace keep keep keep keep keep
<mask> if (shape.length < 3) { <mask> return false; <mask> } <mask> <mask> const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); <mask> if (x < x1 || y < y1 - 10 || x > x2 || y > y2 + 10) { <mask> return false; <mask> } <mask> <mask> const relX = x - element.x; </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove // If shape does not consist of curve and two line segments // for arrow shape, return false if (shape.length < 3) { return false; } </s> add </s> remove // hit test curve and lien segments for arrow return ( hitTestRoughShape(shape[0].sets, relX, relY) || hitTestRoughShape(shape[1].sets, relX, relY) || hitTestRoughShape(shape[2].sets, relX, relY) ); } else if (element.type === "line") { const [x1, y1, x2, y2] = getLinePoints(element); // The computation is done at the origin, we need to add a translation x -= element.x; y -= element.y; return distanceBetweenPointAndSegment(x, y, x1, y1, x2, y2) < lineThreshold; </s> add // hit thest all "subshapes" of the linear element return shape.some(s => hitTestRoughShape(s.sets, relX, relY)); </s> remove export function getLinePoints(element: ExcalidrawElement) { const x1 = 0; const y1 = 0; const x2 = element.width; const y2 = element.height; return [x1, y1, x2, y2]; } </s> add </s> remove } else if (element.type === "arrow") { </s> add } else if (element.type === "arrow" || element.type === "line") { </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width; </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) {
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/collision.ts
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> const relX = x - element.x; <mask> const relY = y - element.y; <mask> <mask> // hit test curve and lien segments for arrow <mask> return ( <mask> hitTestRoughShape(shape[0].sets, relX, relY) || <mask> hitTestRoughShape(shape[1].sets, relX, relY) || <mask> hitTestRoughShape(shape[2].sets, relX, relY) <mask> ); <mask> } else if (element.type === "line") { <mask> const [x1, y1, x2, y2] = getLinePoints(element); <mask> // The computation is done at the origin, we need to add a translation <mask> x -= element.x; <mask> y -= element.y; <mask> <mask> return distanceBetweenPointAndSegment(x, y, x1, y1, x2, y2) < lineThreshold; <mask> } else if (element.type === "text") { <mask> const [x1, y1, x2, y2] = getElementAbsoluteCoords(element); <mask> <mask> return x >= x1 && x <= x2 && y >= y1 && y <= y2; <mask> } else if (element.type === "selection") { </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); </s> add const [x1, y1, x2, y2] = getLinearElementAbsoluteBounds(element); </s> remove // If shape does not consist of curve and two line segments // for arrow shape, return false if (shape.length < 3) { return false; } </s> add </s> remove } else if (element.type === "arrow") { </s> add } else if (element.type === "arrow" || element.type === "line") { </s> remove if (!draggingOccurred && this.state.elementType === "arrow") { </s> add if ( !draggingOccurred && (this.state.elementType === "arrow" || this.state.elementType === "line") ) { </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width; </s> remove export function getLinePoints(element: ExcalidrawElement) { const x1 = 0; const y1 = 0; const x2 = element.width; const y2 = element.height; return [x1, y1, x2, y2]; } </s> add
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/collision.ts
keep keep replace keep keep keep keep keep
<mask> import { ExcalidrawElement } from "./types"; <mask> import { SceneScroll } from "../scene/types"; <mask> import { getArrowAbsoluteBounds } from "./bounds"; <mask> <mask> type Sides = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se"; <mask> <mask> export function handlerRectangles( <mask> element: ExcalidrawElement, </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove getLinePoints, getArrowAbsoluteBounds, </s> add getLinearElementAbsoluteBounds, </s> add if (element.type === "arrow" || element.type === "line") { return element.points.length === 0; } </s> remove getLinePoints, getArrowAbsoluteBounds, </s> add getLinearElementAbsoluteBounds, </s> remove resizePerfectLineForNWHandler, </s> add </s> remove // We can't just always normalize it since we need to remember the fact that an arrow // is pointing left or right. </s> add </s> remove export function getArrowAbsoluteBounds(element: ExcalidrawElement) { </s> add export function getLinearElementAbsoluteBounds(element: ExcalidrawElement) {
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/handlerRectangles.ts
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> let marginX = -8; <mask> let marginY = -8; <mask> <mask> const minimumSize = 40; <mask> if (element.type === "arrow") { <mask> [elementX1, elementY1, elementX2, elementY2] = getArrowAbsoluteBounds( <mask> element, <mask> ); <mask> } else { <mask> elementX1 = element.x; <mask> elementX2 = element.x + element.width; <mask> elementY1 = element.y; <mask> elementY2 = element.y + element.height; </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove "arrow", </s> add element.type, </s> remove export function getLinePoints(element: ExcalidrawElement) { const x1 = 0; const y1 = 0; const x2 = element.width; const y2 = element.height; return [x1, y1, x2, y2]; } </s> add </s> remove if (isLinear) { resizePerfectLineForNWHandler(element, x, y); } else { element.y += element.height - element.width; element.height = element.width; } </s> add element.y += element.height - element.width; element.height = element.width; </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width; </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove const ops = shape[1].sets[0].ops; </s> add // first element is always the curve const ops = shape[0].sets[0].ops;
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/handlerRectangles.ts
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
<mask> 8, <mask> 8, <mask> ]; // se <mask> <mask> if (element.type === "line") { <mask> return { <mask> nw: handlers.nw, <mask> se: handlers.se, <mask> } as typeof handlers; <mask> } else if (element.type === "arrow") { <mask> if (element.points.length === 2) { <mask> // only check the last point because starting point is always (0,0) <mask> const [, p1] = element.points; <mask> <mask> if (p1[0] === 0 || p1[1] === 0) { </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove } else if (element.type === "arrow") { </s> add } else if (element.type === "arrow" || element.type === "line") { </s> remove if (element.type === "arrow") { return getArrowAbsoluteBounds(element); </s> add if (element.type === "arrow" || element.type === "line") { return getLinearElementAbsoluteBounds(element);
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/handlerRectangles.ts
keep keep keep keep replace replace keep keep keep keep keep
<mask> getElementAbsoluteCoords, <mask> getCommonBounds, <mask> getDiamondPoints, <mask> getArrowPoints, <mask> getLinePoints, <mask> getArrowAbsoluteBounds, <mask> } from "./bounds"; <mask> <mask> export { handlerRectangles } from "./handlerRectangles"; <mask> export { hitTest } from "./collision"; <mask> export { </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove getLinePoints, getArrowAbsoluteBounds, </s> add getLinearElementAbsoluteBounds, </s> remove import { getArrowAbsoluteBounds } from "./bounds"; </s> add import { getLinearElementAbsoluteBounds } from "./bounds"; </s> remove resizePerfectLineForNWHandler, </s> add </s> add if (element.type === "arrow" || element.type === "line") { return element.points.length === 0; } </s> remove // We can't just always normalize it since we need to remember the fact that an arrow // is pointing left or right. </s> add </s> remove export function getArrowAbsoluteBounds(element: ExcalidrawElement) { </s> add export function getLinearElementAbsoluteBounds(element: ExcalidrawElement) {
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/index.ts
keep keep add keep keep keep keep
<mask> import { ExcalidrawElement } from "./types"; <mask> <mask> export function isInvisiblySmallElement(element: ExcalidrawElement): boolean { <mask> return element.width === 0 && element.height === 0; <mask> } <mask> <mask> /** </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove getLinePoints, getArrowAbsoluteBounds, </s> add getLinearElementAbsoluteBounds, </s> remove import { getArrowAbsoluteBounds } from "./bounds"; </s> add import { getLinearElementAbsoluteBounds } from "./bounds"; </s> remove element.width >= 0 ? element.x : element.x + element.width, // x1 element.height >= 0 ? element.y : element.y + element.height, // y1 element.width >= 0 ? element.x + element.width : element.x, // x2 element.height >= 0 ? element.y + element.height : element.y, // y2 </s> add element.x, element.y, element.x + element.width, element.y + element.height, </s> remove export function getLinePoints(element: ExcalidrawElement) { const x1 = 0; const y1 = 0; const x2 = element.width; const y2 = element.height; return [x1, y1, x2, y2]; } </s> add </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width; </s> remove if (element.type === "arrow") { return getArrowAbsoluteBounds(element); </s> add if (element.type === "arrow" || element.type === "line") { return getLinearElementAbsoluteBounds(element);
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/element/sizeHelpers.ts
keep keep keep keep replace keep keep keep keep keep
<mask> textWysiwyg, <mask> getCommonBounds, <mask> getCursorForResizingElement, <mask> getPerfectElementSize, <mask> resizePerfectLineForNWHandler, <mask> normalizeDimensions, <mask> } from "./element"; <mask> import { <mask> clearSelection, <mask> deleteSelectedElements, </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove getLinePoints, getArrowAbsoluteBounds, </s> add getLinearElementAbsoluteBounds, </s> remove getLinePoints, getArrowAbsoluteBounds, </s> add getLinearElementAbsoluteBounds, </s> remove import { getArrowAbsoluteBounds } from "./bounds"; </s> add import { getLinearElementAbsoluteBounds } from "./bounds"; </s> add if (element.type === "arrow" || element.type === "line") { return element.points.length === 0; } </s> remove // We can't just always normalize it since we need to remember the fact that an arrow // is pointing left or right. </s> add </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width;
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> elementType: "selection", <mask> editingElement: element, <mask> }); <mask> return; <mask> } else if (this.state.elementType === "arrow") { <mask> if (this.state.multiElement) { <mask> const { multiElement } = this.state; <mask> const { x: rx, y: ry } = multiElement; <mask> multiElement.isSelected = true; <mask> multiElement.points.push([x - rx, y - ry]); </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width; </s> remove const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); </s> add const [x1, y1, x2, y2] = getLinearElementAbsoluteBounds(element); </s> remove if (!draggingOccurred && this.state.elementType === "arrow") { </s> add if ( !draggingOccurred && (this.state.elementType === "arrow" || this.state.elementType === "line") ) { </s> remove if (isLinear) { resizePerfectLineForNWHandler(element, x, y); } else { element.y += element.height - element.width; element.height = element.width; } </s> add element.y += element.height - element.width; element.height = element.width; </s> remove if (element.type === "arrow") { [elementX1, elementY1, elementX2, elementY2] = getArrowAbsoluteBounds( element, ); </s> add if (element.type === "arrow" || element.type === "line") { [ elementX1, elementY1, elementX2, elementY2, ] = getLinearElementAbsoluteBounds(element); </s> remove "arrow", </s> add element.type,
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> const absPx = p1[0] + element.x; <mask> const absPy = p1[1] + element.y; <mask> <mask> const { width, height } = getPerfectElementSize( <mask> "arrow", <mask> mouseX - element.x - p1[0], <mask> mouseY - element.y - p1[1], <mask> ); <mask> <mask> const dx = element.x + width + p1[0]; </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove "arrow", </s> add element.type, </s> remove if (element.type === "arrow") { [elementX1, elementY1, elementX2, elementY2] = getArrowAbsoluteBounds( element, ); </s> add if (element.type === "arrow" || element.type === "line") { [ elementX1, elementY1, elementX2, elementY2, ] = getLinearElementAbsoluteBounds(element); </s> remove const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); </s> add const [x1, y1, x2, y2] = getLinearElementAbsoluteBounds(element); </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width; </s> remove element.width >= 0 ? element.x : element.x + element.width, // x1 element.height >= 0 ? element.y : element.y + element.height, // y1 element.width >= 0 ? element.x + element.width : element.x, // x2 element.height >= 0 ? element.y + element.height : element.y, // y2 </s> add element.x, element.y, element.x + element.width, element.y + element.height, </s> remove if (isLinear) { resizePerfectLineForNWHandler(element, x, y); } else { element.y += element.height - element.width; element.height = element.width; } </s> add element.y += element.height - element.width; element.height = element.width;
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> perfect: boolean, <mask> ) => { <mask> if (perfect) { <mask> const { width, height } = getPerfectElementSize( <mask> "arrow", <mask> mouseX - element.x, <mask> mouseY - element.y, <mask> ); <mask> p1[0] = width; <mask> p1[1] = height; </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove "arrow", </s> add element.type, </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width; </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); </s> add const [x1, y1, x2, y2] = getLinearElementAbsoluteBounds(element); </s> remove if (isLinear) { resizePerfectLineForNWHandler(element, x, y); } else { element.y += element.height - element.width; element.height = element.width; } </s> add element.y += element.height - element.width; element.height = element.width;
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> // for arrows, don't start dragging until a given threshold <mask> // to ensure we don't create a 2-point arrow by mistake when <mask> // user clicks mouse in a way that it moves a tiny bit (thus <mask> // triggering mousemove) <mask> if (!draggingOccurred && this.state.elementType === "arrow") { <mask> const { x, y } = viewportCoordsToSceneCoords(e, this.state); <mask> if (distance2d(x, y, originX, originY) < DRAGGING_THRESHOLD) { <mask> return; <mask> } <mask> } </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove // hit test curve and lien segments for arrow return ( hitTestRoughShape(shape[0].sets, relX, relY) || hitTestRoughShape(shape[1].sets, relX, relY) || hitTestRoughShape(shape[2].sets, relX, relY) ); } else if (element.type === "line") { const [x1, y1, x2, y2] = getLinePoints(element); // The computation is done at the origin, we need to add a translation x -= element.x; y -= element.y; return distanceBetweenPointAndSegment(x, y, x1, y1, x2, y2) < lineThreshold; </s> add // hit thest all "subshapes" of the linear element return shape.some(s => hitTestRoughShape(s.sets, relX, relY)); </s> remove // We can't just always normalize it since we need to remember the fact that an arrow // is pointing left or right. </s> add </s> remove // If shape does not consist of curve and two line segments // for arrow shape, return false if (shape.length < 3) { return false; } </s> add </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove if (element.type === "arrow") { return getArrowAbsoluteBounds(element); </s> add if (element.type === "arrow" || element.type === "line") { return getLinearElementAbsoluteBounds(element); </s> remove } else if (element.type === "arrow") { </s> add } else if (element.type === "arrow" || element.type === "line") {
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> const isLinear = <mask> element.type === "line" || element.type === "arrow"; <mask> switch (resizeHandle) { <mask> case "nw": <mask> if ( <mask> element.type === "arrow" && <mask> element.points.length === 2 <mask> ) { <mask> const [, p1] = element.points; <mask> <mask> if (!resizeArrowFn) { <mask> if (p1[0] < 0 || p1[1] < 0) { <mask> resizeArrowFn = arrowResizeEnd; </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if (element.type === "line") { return { nw: handlers.nw, se: handlers.se, } as typeof handlers; } else if (element.type === "arrow") { </s> add if (element.type === "arrow" || element.type === "line") { </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove } else if (element.type === "arrow") { </s> add } else if (element.type === "arrow" || element.type === "line") {
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
<mask> element.width -= deltaX; <mask> element.x += deltaX; <mask> <mask> if (e.shiftKey) { <mask> if (isLinear) { <mask> resizePerfectLineForNWHandler(element, x, y); <mask> } else { <mask> element.y += element.height - element.width; <mask> element.height = element.width; <mask> } <mask> } else { <mask> element.height -= deltaY; <mask> element.y += deltaY; <mask> } <mask> } </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if (isLinear) { const { width, height } = getPerfectElementSize( element.type, x - element.x, y - element.y, ); element.width = width; element.height = height; } else { element.width += deltaX; element.height = element.width; } </s> add element.width += deltaX; element.height = element.width; </s> remove element.width >= 0 ? element.x : element.x + element.width, // x1 element.height >= 0 ? element.y : element.y + element.height, // y1 element.width >= 0 ? element.x + element.width : element.x, // x2 element.height >= 0 ? element.y + element.height : element.y, // y2 </s> add element.x, element.y, element.x + element.width, element.y + element.height, </s> remove if (element.type === "arrow") { [elementX1, elementY1, elementX2, elementY2] = getArrowAbsoluteBounds( element, ); </s> add if (element.type === "arrow" || element.type === "line") { [ elementX1, elementY1, elementX2, elementY2, ] = getLinearElementAbsoluteBounds(element); </s> add if (element.type === "arrow" || element.type === "line") { return element.points.length === 0; } </s> remove if (element.type === "arrow") { return getArrowAbsoluteBounds(element); </s> add if (element.type === "arrow" || element.type === "line") { return getLinearElementAbsoluteBounds(element); </s> remove // hit test curve and lien segments for arrow return ( hitTestRoughShape(shape[0].sets, relX, relY) || hitTestRoughShape(shape[1].sets, relX, relY) || hitTestRoughShape(shape[2].sets, relX, relY) ); } else if (element.type === "line") { const [x1, y1, x2, y2] = getLinePoints(element); // The computation is done at the origin, we need to add a translation x -= element.x; y -= element.y; return distanceBetweenPointAndSegment(x, y, x1, y1, x2, y2) < lineThreshold; </s> add // hit thest all "subshapes" of the linear element return shape.some(s => hitTestRoughShape(s.sets, relX, relY));
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> } <mask> } <mask> break; <mask> case "ne": <mask> if ( <mask> element.type === "arrow" && <mask> element.points.length === 2 <mask> ) { <mask> const [, p1] = element.points; <mask> if (!resizeArrowFn) { <mask> if (p1[0] >= 0) { <mask> resizeArrowFn = arrowResizeEnd; <mask> } else { </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if (element.type === "line") { return { nw: handlers.nw, se: handlers.se, } as typeof handlers; } else if (element.type === "arrow") { </s> add if (element.type === "arrow" || element.type === "line") { </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> add if (element.type === "arrow" || element.type === "line") { return element.points.length === 0; }
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> } <mask> } <mask> break; <mask> case "sw": <mask> if ( <mask> element.type === "arrow" && <mask> element.points.length === 2 <mask> ) { <mask> const [, p1] = element.points; <mask> if (!resizeArrowFn) { <mask> if (p1[0] <= 0) { <mask> resizeArrowFn = arrowResizeEnd; <mask> } else { </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if (element.type === "line") { return { nw: handlers.nw, se: handlers.se, } as typeof handlers; } else if (element.type === "arrow") { </s> add if (element.type === "arrow" || element.type === "line") { </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove // hit test curve and lien segments for arrow return ( hitTestRoughShape(shape[0].sets, relX, relY) || hitTestRoughShape(shape[1].sets, relX, relY) || hitTestRoughShape(shape[2].sets, relX, relY) ); } else if (element.type === "line") { const [x1, y1, x2, y2] = getLinePoints(element); // The computation is done at the origin, we need to add a translation x -= element.x; y -= element.y; return distanceBetweenPointAndSegment(x, y, x1, y1, x2, y2) < lineThreshold; </s> add // hit thest all "subshapes" of the linear element return shape.some(s => hitTestRoughShape(s.sets, relX, relY));
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> } <mask> } <mask> break; <mask> case "se": <mask> if ( <mask> element.type === "arrow" && <mask> element.points.length === 2 <mask> ) { <mask> const [, p1] = element.points; <mask> if (!resizeArrowFn) { <mask> if (p1[0] > 0 || p1[1] > 0) { <mask> resizeArrowFn = arrowResizeEnd; <mask> } else { </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if ( element.type === "arrow" && element.points.length === 2 ) { </s> add if (isLinear && element.points.length === 2) { </s> remove if (element.type === "line") { return { nw: handlers.nw, se: handlers.se, } as typeof handlers; } else if (element.type === "arrow") { </s> add if (element.type === "arrow" || element.type === "line") { </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove const [x1, y1, x2, y2] = getArrowAbsoluteBounds(element); </s> add const [x1, y1, x2, y2] = getLinearElementAbsoluteBounds(element);
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> e.shiftKey, <mask> ); <mask> } else { <mask> if (e.shiftKey) { <mask> if (isLinear) { <mask> const { width, height } = getPerfectElementSize( <mask> element.type, <mask> x - element.x, <mask> y - element.y, <mask> ); <mask> element.width = width; <mask> element.height = height; <mask> } else { <mask> element.width += deltaX; <mask> element.height = element.width; <mask> } <mask> } else { <mask> element.width += deltaX; <mask> element.height += deltaY; <mask> } <mask> } </s> Multi Point Lines (based on Multi Point Arrows) (#660) * Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues </s> remove if (isLinear) { resizePerfectLineForNWHandler(element, x, y); } else { element.y += element.height - element.width; element.height = element.width; } </s> add element.y += element.height - element.width; element.height = element.width; </s> remove "arrow", </s> add element.type, </s> remove element.width >= 0 ? element.x : element.x + element.width, // x1 element.height >= 0 ? element.y : element.y + element.height, // y1 element.width >= 0 ? element.x + element.width : element.x, // x2 element.height >= 0 ? element.y + element.height : element.y, // y2 </s> add element.x, element.y, element.x + element.width, element.y + element.height, </s> remove } else if (this.state.elementType === "arrow") { </s> add } else if ( this.state.elementType === "arrow" || this.state.elementType === "line" ) { </s> remove "arrow", </s> add element.type, </s> add if (element.type === "arrow" || element.type === "line") { return element.points.length === 0; }
https://github.com/excalidraw/excalidraw/commit/dab35c9033f6c14769ae7bbf5979c2fdd8d983c3
src/index.tsx
keep keep keep replace replace replace keep keep replace keep keep
<mask> }, <mask> "dependencies": { <mask> "ansi-styles": { <mask> "version": "4.2.1", <mask> "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", <mask> "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", <mask> "dev": true, <mask> "requires": { <mask> "@types/color-name": "^1.1.1", <mask> "color-convert": "^2.0.1" <mask> } </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "@types/color-name": "^1.1.1", </s> add </s> remove "version": "1.15.4", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.4.tgz", "integrity": "sha512-7w3K+Daq/JjbX/dz5voMt7B9wlprVBQnMiypyCojAZ99kcAL+3LiJ5uBoX/u47l8eFTVq3Wj+V0pmvU+CT8tOg==", </s> add "version": "1.15.6", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.6.tgz", "integrity": "sha512-SsxGuKiizqOPBwm2YkMfh+Wsj+02sqP9y8xydC9KbZqHuY2qdjEyoJAfBapKSTK130gZMXVE6Qm+GTlOfjwqJw==", </s> remove "version": "2.0.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==", </s> add "version": "2.0.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==", </s> remove "version": "6.12.5", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", </s> add "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> "semver": "^7.0.0" <mask> }, <mask> "dependencies": { <mask> "ajv": { <mask> "version": "6.12.5", <mask> "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", <mask> "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", <mask> "dev": true, <mask> "requires": { <mask> "fast-deep-equal": "^3.1.1", <mask> "fast-json-stable-stringify": "^2.0.0", <mask> "json-schema-traverse": "^0.4.1", </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "install-artifact-from-github": "^1.0.2", </s> add "install-artifact-from-github": "^1.1.1", </s> remove "node-gyp": "^7.0.0" </s> add "node-gyp": "^7.1.0" </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "@types/color-name": "^1.1.1", </s> add </s> remove "@types/color-name": "^1.1.1", </s> add
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> "@firebase/util": "0.3.2" <mask> } <mask> }, <mask> "firebase-tools": { <mask> "version": "8.11.2", <mask> "resolved": "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.11.2.tgz", <mask> "integrity": "sha512-aKxWDwrWhziPsPphwITVTpBUBl5wC08yZIFNosQc4/I9qXbnLmkIBYd06YvQkm0uwNlCMlJ5zE/UUAemEPUm+A==", <mask> "dev": true, <mask> "requires": { <mask> "@google-cloud/pubsub": "^1.7.0", <mask> "JSONStream": "^1.2.1", <mask> "archiver": "^3.0.0", </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "version": "4.1.1", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.1.tgz", "integrity": "sha512-9y+Kds0+LoLG6yN802wVXoIfxYEwh3FlZwzMwpCZp62S2i1/Jzeqb9Eeeju3NSHccGGasfGlK5/vEHbAifYRDg==", </s> add "version": "4.1.3", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", "integrity": "sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A==", </s> remove "version": "1.15.4", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.4.tgz", "integrity": "sha512-7w3K+Daq/JjbX/dz5voMt7B9wlprVBQnMiypyCojAZ99kcAL+3LiJ5uBoX/u47l8eFTVq3Wj+V0pmvU+CT8tOg==", </s> add "version": "1.15.6", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.6.tgz", "integrity": "sha512-SsxGuKiizqOPBwm2YkMfh+Wsj+02sqP9y8xydC9KbZqHuY2qdjEyoJAfBapKSTK130gZMXVE6Qm+GTlOfjwqJw==", </s> remove "@types/color-name": "^1.1.1", </s> add </s> remove "@types/color-name": "^1.1.1", </s> add </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> "through": "^2.3.6" <mask> } <mask> }, <mask> "install-artifact-from-github": { <mask> "version": "1.0.2", <mask> "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.0.2.tgz", <mask> "integrity": "sha512-yuMFBSVIP3vD0SDBGUqeIpgOAIlFx8eQFknQObpkYEM5gsl9hy6R9Ms3aV+Vw9MMyYsoPMeex0XDnfgY7uzc+Q==", <mask> "dev": true, <mask> "optional": true <mask> }, <mask> "internal-ip": { <mask> "version": "4.3.0", </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "version": "1.15.4", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.4.tgz", "integrity": "sha512-7w3K+Daq/JjbX/dz5voMt7B9wlprVBQnMiypyCojAZ99kcAL+3LiJ5uBoX/u47l8eFTVq3Wj+V0pmvU+CT8tOg==", </s> add "version": "1.15.6", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.6.tgz", "integrity": "sha512-SsxGuKiizqOPBwm2YkMfh+Wsj+02sqP9y8xydC9KbZqHuY2qdjEyoJAfBapKSTK130gZMXVE6Qm+GTlOfjwqJw==", </s> remove "version": "1.2.7", "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.7.tgz", "integrity": "sha512-3dFMg9hmI9LdHag/BRIhMefCfbq1hicvYMy8YhZQorAdzOzWz7NjniSpn39yjpzUAMIWtGyyZuH2KNBloH7ZLw==", </s> add "version": "1.2.11", "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.11.tgz", "integrity": "sha512-XNZHs3N1IOa3lPKm//npxMhOdaoPw+MvEV0NIgxcER83GTJcG13rehtWmpBCfEt8DrtYwIkMTs8bdXoYs4fvnQ==", </s> remove "version": "2.0.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==", </s> add "version": "2.0.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "install-artifact-from-github": "^1.0.2", </s> add "install-artifact-from-github": "^1.1.1",
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> "tslib": "^2.0.0" <mask> }, <mask> "dependencies": { <mask> "tslib": { <mask> "version": "2.0.1", <mask> "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", <mask> "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==", <mask> "dev": true <mask> } <mask> } <mask> }, <mask> "json-schema": { </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "version": "1.0.2", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.0.2.tgz", "integrity": "sha512-yuMFBSVIP3vD0SDBGUqeIpgOAIlFx8eQFknQObpkYEM5gsl9hy6R9Ms3aV+Vw9MMyYsoPMeex0XDnfgY7uzc+Q==", </s> add "version": "1.1.1", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.1.1.tgz", "integrity": "sha512-ZA4d8ABVKdGoWjYK+EyHrOfMRpOLyrBX/9dVts2ULDBRuFWObQ/I3o4f80Ca8klbYQAa5oIRG7XbU22r74A+Ew==", </s> remove "version": "1.2.7", "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.7.tgz", "integrity": "sha512-3dFMg9hmI9LdHag/BRIhMefCfbq1hicvYMy8YhZQorAdzOzWz7NjniSpn39yjpzUAMIWtGyyZuH2KNBloH7ZLw==", </s> add "version": "1.2.11", "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.11.tgz", "integrity": "sha512-XNZHs3N1IOa3lPKm//npxMhOdaoPw+MvEV0NIgxcER83GTJcG13rehtWmpBCfEt8DrtYwIkMTs8bdXoYs4fvnQ==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "1.15.4", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.4.tgz", "integrity": "sha512-7w3K+Daq/JjbX/dz5voMt7B9wlprVBQnMiypyCojAZ99kcAL+3LiJ5uBoX/u47l8eFTVq3Wj+V0pmvU+CT8tOg==", </s> add "version": "1.15.6", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.6.tgz", "integrity": "sha512-SsxGuKiizqOPBwm2YkMfh+Wsj+02sqP9y8xydC9KbZqHuY2qdjEyoJAfBapKSTK130gZMXVE6Qm+GTlOfjwqJw==", </s> remove "@types/color-name": "^1.1.1", </s> add
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", <mask> "dev": true <mask> }, <mask> "jsonschema": { <mask> "version": "1.2.7", <mask> "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.7.tgz", <mask> "integrity": "sha512-3dFMg9hmI9LdHag/BRIhMefCfbq1hicvYMy8YhZQorAdzOzWz7NjniSpn39yjpzUAMIWtGyyZuH2KNBloH7ZLw==", <mask> "dev": true <mask> }, <mask> "jsonwebtoken": { <mask> "version": "8.5.1", <mask> "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "version": "2.0.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==", </s> add "version": "2.0.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==", </s> remove "version": "1.0.2", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.0.2.tgz", "integrity": "sha512-yuMFBSVIP3vD0SDBGUqeIpgOAIlFx8eQFknQObpkYEM5gsl9hy6R9Ms3aV+Vw9MMyYsoPMeex0XDnfgY7uzc+Q==", </s> add "version": "1.1.1", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.1.1.tgz", "integrity": "sha512-ZA4d8ABVKdGoWjYK+EyHrOfMRpOLyrBX/9dVts2ULDBRuFWObQ/I3o4f80Ca8klbYQAa5oIRG7XbU22r74A+Ew==", </s> remove "version": "4.1.1", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.1.tgz", "integrity": "sha512-9y+Kds0+LoLG6yN802wVXoIfxYEwh3FlZwzMwpCZp62S2i1/Jzeqb9Eeeju3NSHccGGasfGlK5/vEHbAifYRDg==", </s> add "version": "4.1.3", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", "integrity": "sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "6.12.5", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", </s> add "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep replace replace replace keep keep keep replace
<mask> }, <mask> "re2": { <mask> "version": "1.15.4", <mask> "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.4.tgz", <mask> "integrity": "sha512-7w3K+Daq/JjbX/dz5voMt7B9wlprVBQnMiypyCojAZ99kcAL+3LiJ5uBoX/u47l8eFTVq3Wj+V0pmvU+CT8tOg==", <mask> "dev": true, <mask> "optional": true, <mask> "requires": { <mask> "install-artifact-from-github": "^1.0.2", </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "node-gyp": "^7.0.0" </s> add "node-gyp": "^7.1.0" </s> remove "version": "1.0.2", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.0.2.tgz", "integrity": "sha512-yuMFBSVIP3vD0SDBGUqeIpgOAIlFx8eQFknQObpkYEM5gsl9hy6R9Ms3aV+Vw9MMyYsoPMeex0XDnfgY7uzc+Q==", </s> add "version": "1.1.1", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.1.1.tgz", "integrity": "sha512-ZA4d8ABVKdGoWjYK+EyHrOfMRpOLyrBX/9dVts2ULDBRuFWObQ/I3o4f80Ca8klbYQAa5oIRG7XbU22r74A+Ew==", </s> remove "@types/color-name": "^1.1.1", </s> add </s> remove "@types/color-name": "^1.1.1", </s> add </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep keep keep replace keep keep keep keep keep
<mask> "optional": true, <mask> "requires": { <mask> "install-artifact-from-github": "^1.0.2", <mask> "nan": "^2.14.1", <mask> "node-gyp": "^7.0.0" <mask> }, <mask> "dependencies": { <mask> "chownr": { <mask> "version": "2.0.0", <mask> "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "install-artifact-from-github": "^1.0.2", </s> add "install-artifact-from-github": "^1.1.1", </s> remove "version": "1.15.4", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.4.tgz", "integrity": "sha512-7w3K+Daq/JjbX/dz5voMt7B9wlprVBQnMiypyCojAZ99kcAL+3LiJ5uBoX/u47l8eFTVq3Wj+V0pmvU+CT8tOg==", </s> add "version": "1.15.6", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.6.tgz", "integrity": "sha512-SsxGuKiizqOPBwm2YkMfh+Wsj+02sqP9y8xydC9KbZqHuY2qdjEyoJAfBapKSTK130gZMXVE6Qm+GTlOfjwqJw==", </s> remove "version": "6.12.5", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", </s> add "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", </s> remove "version": "1.0.2", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.0.2.tgz", "integrity": "sha512-yuMFBSVIP3vD0SDBGUqeIpgOAIlFx8eQFknQObpkYEM5gsl9hy6R9Ms3aV+Vw9MMyYsoPMeex0XDnfgY7uzc+Q==", </s> add "version": "1.1.1", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.1.1.tgz", "integrity": "sha512-ZA4d8ABVKdGoWjYK+EyHrOfMRpOLyrBX/9dVts2ULDBRuFWObQ/I3o4f80Ca8klbYQAa5oIRG7XbU22r74A+Ew==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", <mask> "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==" <mask> }, <mask> "update-notifier": { <mask> "version": "4.1.1", <mask> "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.1.tgz", <mask> "integrity": "sha512-9y+Kds0+LoLG6yN802wVXoIfxYEwh3FlZwzMwpCZp62S2i1/Jzeqb9Eeeju3NSHccGGasfGlK5/vEHbAifYRDg==", <mask> "dev": true, <mask> "requires": { <mask> "boxen": "^4.2.0", <mask> "chalk": "^3.0.0", <mask> "configstore": "^5.0.1", </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "version": "8.11.2", "resolved": "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.11.2.tgz", "integrity": "sha512-aKxWDwrWhziPsPphwITVTpBUBl5wC08yZIFNosQc4/I9qXbnLmkIBYd06YvQkm0uwNlCMlJ5zE/UUAemEPUm+A==", </s> add "version": "8.12.1", "resolved": "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.12.1.tgz", "integrity": "sha512-nNXtLdlVTjBz5PEMMmInhEp23mBD5NRJ791j2BONTFwd+KH8dXBopAhLuSkRtGp8XNDSNcRwjaNPCoLYE5RoZg==", </s> remove "@types/color-name": "^1.1.1", </s> add </s> remove "@types/color-name": "^1.1.1", </s> add </s> remove "version": "1.15.4", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.4.tgz", "integrity": "sha512-7w3K+Daq/JjbX/dz5voMt7B9wlprVBQnMiypyCojAZ99kcAL+3LiJ5uBoX/u47l8eFTVq3Wj+V0pmvU+CT8tOg==", </s> add "version": "1.15.6", "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.6.tgz", "integrity": "sha512-SsxGuKiizqOPBwm2YkMfh+Wsj+02sqP9y8xydC9KbZqHuY2qdjEyoJAfBapKSTK130gZMXVE6Qm+GTlOfjwqJw==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep keep replace replace replace keep keep replace keep keep keep
<mask> }, <mask> "dependencies": { <mask> "ansi-styles": { <mask> "version": "4.2.1", <mask> "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", <mask> "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", <mask> "dev": true, <mask> "requires": { <mask> "@types/color-name": "^1.1.1", <mask> "color-convert": "^2.0.1" <mask> } <mask> }, </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package-lock.json
keep keep keep keep replace keep keep keep keep keep
<mask> "asar": "3.0.3", <mask> "eslint": "6.8.0", <mask> "eslint-config-prettier": "6.12.0", <mask> "eslint-plugin-prettier": "3.1.4", <mask> "firebase-tools": "8.11.2", <mask> "husky": "4.3.0", <mask> "jest-canvas-mock": "2.3.0", <mask> "lint-staged": "10.4.0", <mask> "pepjs": "0.5.2", <mask> "prettier": "2.1.2", </s> Bump firebase-tools from 8.11.2 to 8.12.1 (#2229) Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 8.11.2 to 8.12.1. - [Release notes](https://github.com/firebase/firebase-tools/releases) - [Commits](https://github.com/firebase/firebase-tools/compare/v8.11.2...v8.12.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> </s> remove "version": "8.11.2", "resolved": "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.11.2.tgz", "integrity": "sha512-aKxWDwrWhziPsPphwITVTpBUBl5wC08yZIFNosQc4/I9qXbnLmkIBYd06YvQkm0uwNlCMlJ5zE/UUAemEPUm+A==", </s> add "version": "8.12.1", "resolved": "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.12.1.tgz", "integrity": "sha512-nNXtLdlVTjBz5PEMMmInhEp23mBD5NRJ791j2BONTFwd+KH8dXBopAhLuSkRtGp8XNDSNcRwjaNPCoLYE5RoZg==", </s> remove "version": "1.0.2", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.0.2.tgz", "integrity": "sha512-yuMFBSVIP3vD0SDBGUqeIpgOAIlFx8eQFknQObpkYEM5gsl9hy6R9Ms3aV+Vw9MMyYsoPMeex0XDnfgY7uzc+Q==", </s> add "version": "1.1.1", "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.1.1.tgz", "integrity": "sha512-ZA4d8ABVKdGoWjYK+EyHrOfMRpOLyrBX/9dVts2ULDBRuFWObQ/I3o4f80Ca8klbYQAa5oIRG7XbU22r74A+Ew==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", </s> add "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", </s> remove "@types/color-name": "^1.1.1", </s> add </s> remove "version": "4.1.1", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.1.tgz", "integrity": "sha512-9y+Kds0+LoLG6yN802wVXoIfxYEwh3FlZwzMwpCZp62S2i1/Jzeqb9Eeeju3NSHccGGasfGlK5/vEHbAifYRDg==", </s> add "version": "4.1.3", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", "integrity": "sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A==",
https://github.com/excalidraw/excalidraw/commit/dab9659590cd1ba45b182ecdf724535b127f761e
package.json
keep add keep keep keep keep keep keep
<mask> } <mask> min-width: 1em; <mask> position: absolute; <mask> bottom: -5px; <mask> padding: 3px; <mask> border-radius: 50%; <mask> background-color: $oc-green-6; <mask> color: $oc-white; </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove font-size: 0.7em; font-family: var(--ui-font); </s> add font-size: 0.6em; font-family: "Cascadia"; </s> remove import { restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { restore, restoreAppState, RestoredDataState } from "../data/restore"; </s> remove import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; </s> add import { exportToBackend, getCollaborationLinkData, isCollaborationLink, loadScene, } from "./data"; </s> remove CollabContext, CollabContextConsumer, } from "./collab/CollabWrapper"; </s> add collabAPIAtom, collabDialogShownAtom, isCollaboratingAtom, } from "./collab/Collab"; </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react"; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/components/CollabButton.scss
keep keep keep keep replace replace keep keep
<mask> padding: 3px; <mask> border-radius: 50%; <mask> background-color: $oc-green-6; <mask> color: $oc-white; <mask> font-size: 0.7em; <mask> font-family: var(--ui-font); <mask> } <mask> } </s> feat: collab component state handling rewrite & fixes (#5046) </s> add min-height: 1em; line-height: 1; </s> remove import { restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { restore, restoreAppState, RestoredDataState } from "../data/restore"; </s> remove import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; </s> add import { exportToBackend, getCollaborationLinkData, isCollaborationLink, loadScene, } from "./data"; </s> remove CollabContext, CollabContextConsumer, } from "./collab/CollabWrapper"; </s> add collabAPIAtom, collabDialogShownAtom, isCollaboratingAtom, } from "./collab/Collab"; </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react"; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/components/CollabButton.scss
keep keep keep keep replace keep keep keep keep keep
<mask> title={t("labels.liveCollaboration")} <mask> aria-label={t("labels.liveCollaboration")} <mask> showAriaLabel={useDevice().isMobile} <mask> > <mask> {collaboratorCount > 0 && ( <mask> <div className="CollabButton-collaborators">{collaboratorCount}</div> <mask> )} <mask> </ToolButton> <mask> </> <mask> ); </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove "is-collaborating": collabAPI?.isCollaborating(), </s> add "is-collaborating": isCollaborating, </s> remove onClick={onRoomCreate} </s> add onClick={() => { trackEvent("share", "room creation", `ui (${getFrame()})`); onRoomCreate(); }} </s> remove {excalidrawAPI && ( <CollabWrapper excalidrawAPI={excalidrawAPI} onRoomClose={onRoomClose} /> )} </s> add {excalidrawAPI && <Collab excalidrawAPI={excalidrawAPI} />} </s> remove onClick={onRoomDestroy} </s> add onClick={() => { trackEvent("share", "room closed"); onRoomDestroy(); }} </s> remove </CollabContextConsumer> </s> add </Provider> </s> remove <CollabContextConsumer> </s> add <Provider unstable_createStore={() => jotaiStore}>
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/components/CollabButton.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> SocketUpdateData, <mask> SocketUpdateDataSource, <mask> } from "../data"; <mask> <mask> import CollabWrapper from "./CollabWrapper"; <mask> <mask> import { ExcalidrawElement } from "../../element/types"; <mask> import { <mask> WS_EVENTS, <mask> FILE_UPLOAD_TIMEOUT, </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react"; </s> remove import { restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { restore, restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation"; </s> remove import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; </s> add import { exportToBackend, getCollaborationLinkData, isCollaborationLink, loadScene, } from "./data"; </s> remove CollabContext, CollabContextConsumer, } from "./collab/CollabWrapper"; </s> add collabAPIAtom, collabDialogShownAtom, isCollaboratingAtom, } from "./collab/Collab"; </s> remove import CollabWrapper, { </s> add import Collab, {
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/collab/Portal.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> import { BroadcastedExcalidrawElement } from "./reconciliation"; <mask> import { encryptData } from "../../data/encryption"; <mask> <mask> class Portal { <mask> collab: CollabWrapper; <mask> socket: SocketIOClient.Socket | null = null; <mask> socketInitialized: boolean = false; // we don't want the socket to emit any updates until it is fully initialized <mask> roomId: string | null = null; <mask> roomKey: string | null = null; <mask> broadcastedElementVersions: Map<string, number> = new Map(); </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove constructor(collab: CollabWrapper) { </s> add constructor(collab: TCollabClass) { </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> add import { trackEvent } from "../../analytics"; import { getFrame } from "../../utils"; </s> remove import { unstable_createStore } from "jotai"; </s> add import { unstable_createStore, useAtom, WritableAtom } from "jotai"; import { useLayoutEffect } from "react"; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation"; </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); };
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/collab/Portal.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> roomId: string | null = null; <mask> roomKey: string | null = null; <mask> broadcastedElementVersions: Map<string, number> = new Map(); <mask> <mask> constructor(collab: CollabWrapper) { <mask> this.collab = collab; <mask> } <mask> <mask> open(socket: SocketIOClient.Socket, id: string, key: string) { <mask> this.socket = socket; </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove collab: CollabWrapper; </s> add collab: TCollabClass; </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); }; </s> remove scene: await opts.collabAPI.initializeSocketClient(roomLinkData), </s> add scene: await opts.collabAPI.startCollaboration(roomLinkData), </s> add import { trackEvent } from "../../analytics"; import { getFrame } from "../../utils"; </s> remove import { unstable_createStore } from "jotai"; </s> add import { unstable_createStore, useAtom, WritableAtom } from "jotai"; import { useLayoutEffect } from "react";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/collab/Portal.tsx
keep add keep keep keep keep keep keep
<mask> import Stack from "../../components/Stack"; <mask> import { AppState } from "../../types"; <mask> <mask> const getShareIcon = () => { <mask> const navigator = window.navigator as any; <mask> const isAppleBrowser = /Apple/.test(navigator.vendor); <mask> const isWindowsBrowser = navigator.appVersion.indexOf("Win") !== -1; <mask> </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove import { unstable_createStore } from "jotai"; </s> add import { unstable_createStore, useAtom, WritableAtom } from "jotai"; import { useLayoutEffect } from "react"; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation"; </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); }; </s> remove const collabAPI = useContext(CollabContext)?.api; </s> add const [collabAPI] = useAtom(collabAPIAtom); const [, setCollabDialogShown] = useAtom(collabDialogShownAtom); const [isCollaborating] = useAtomWithInitialValue(isCollaboratingAtom, () => { return isCollaborationLink(window.location.href); }); </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/collab/RoomDialog.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> icon={start} <mask> title={t("roomDialog.button_startSession")} <mask> aria-label={t("roomDialog.button_startSession")} <mask> showAriaLabel={true} <mask> onClick={onRoomCreate} <mask> /> <mask> </div> <mask> </> <mask> )} <mask> {activeRoomLink && ( </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove onClick={onRoomDestroy} </s> add onClick={() => { trackEvent("share", "room closed"); onRoomDestroy(); }} </s> remove {collaboratorCount > 0 && ( </s> add {isCollaborating && ( </s> remove {excalidrawAPI && ( <CollabWrapper excalidrawAPI={excalidrawAPI} onRoomClose={onRoomClose} /> )} </s> add {excalidrawAPI && <Collab excalidrawAPI={excalidrawAPI} />} </s> remove </CollabContextConsumer> </s> add </Provider> </s> remove <CollabContextConsumer> </s> add <Provider unstable_createStore={() => jotaiStore}> </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } });
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/collab/RoomDialog.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> icon={stop} <mask> title={t("roomDialog.button_stopSession")} <mask> aria-label={t("roomDialog.button_stopSession")} <mask> showAriaLabel={true} <mask> onClick={onRoomDestroy} <mask> /> <mask> </div> <mask> </> <mask> )} <mask> </div> </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove onClick={onRoomCreate} </s> add onClick={() => { trackEvent("share", "room creation", `ui (${getFrame()})`); onRoomCreate(); }} </s> remove {collaboratorCount > 0 && ( </s> add {isCollaborating && ( </s> remove {excalidrawAPI && ( <CollabWrapper excalidrawAPI={excalidrawAPI} onRoomClose={onRoomClose} /> )} </s> add {excalidrawAPI && <Collab excalidrawAPI={excalidrawAPI} />} </s> remove </CollabContextConsumer> </s> add </Provider> </s> remove <CollabContextConsumer> </s> add <Provider unstable_createStore={() => jotaiStore}> </s> remove window.collab.openPortal(); </s> add window.collab.startCollaboration(null);
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/collab/RoomDialog.tsx
keep keep add keep keep keep keep keep keep
<mask> _brand: "socketUpdateData"; <mask> }; <mask> <mask> export const getCollaborationLinkData = (link: string) => { <mask> const hash = new URL(link).hash; <mask> const match = hash.match(RE_COLLAB_LINK); <mask> if (match && match[2].length !== 22) { <mask> window.alert(t("alerts.invalidEncryptionKey")); <mask> return null; </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> remove constructor(collab: CollabWrapper) { </s> add constructor(collab: TCollabClass) { </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } }); </s> remove import { unstable_createStore } from "jotai"; </s> add import { unstable_createStore, useAtom, WritableAtom } from "jotai"; import { useLayoutEffect } from "react"; </s> add import { trackEvent } from "../../analytics"; import { getFrame } from "../../utils"; </s> remove const onRoomClose = useCallback(() => { LocalData.fileStorage.reset(); }, []); </s> add
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/data/index.ts
keep keep keep keep replace keep keep keep keep keep
<mask> }; <mask> <mask> export const getCollaborationLinkData = (link: string) => { <mask> const hash = new URL(link).hash; <mask> const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); <mask> if (match && match[2].length !== 22) { <mask> window.alert(t("alerts.invalidEncryptionKey")); <mask> return null; <mask> } <mask> return match ? { roomId: match[1], roomKey: match[2] } : null; </s> feat: collab component state handling rewrite & fixes (#5046) </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); }; </s> remove constructor(collab: CollabWrapper) { </s> add constructor(collab: TCollabClass) { </s> remove collab: CollabWrapper; </s> add collab: TCollabClass; </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } }); </s> remove import { unstable_createStore } from "jotai"; </s> add import { unstable_createStore, useAtom, WritableAtom } from "jotai"; import { useLayoutEffect } from "react"; </s> add import { trackEvent } from "../../analytics"; import { getFrame } from "../../utils";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/data/index.ts
keep replace keep keep keep keep keep
<mask> import LanguageDetector from "i18next-browser-languagedetector"; <mask> import { useCallback, useContext, useEffect, useRef, useState } from "react"; <mask> import { trackEvent } from "../analytics"; <mask> import { getDefaultAppState } from "../appState"; <mask> import { ErrorDialog } from "../components/ErrorDialog"; <mask> import { TopErrorBoundary } from "../components/TopErrorBoundary"; <mask> import { </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove import { restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { restore, restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation"; </s> remove import { unstable_createStore } from "jotai"; </s> add import { unstable_createStore, useAtom, WritableAtom } from "jotai"; import { useLayoutEffect } from "react"; </s> remove import CollabWrapper from "./CollabWrapper"; </s> add import { TCollabClass } from "./Collab"; </s> remove import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; </s> add import { exportToBackend, getCollaborationLinkData, isCollaborationLink, loadScene, } from "./data"; </s> remove CollabContext, CollabContextConsumer, } from "./collab/CollabWrapper"; </s> add collabAPIAtom, collabDialogShownAtom, isCollaboratingAtom, } from "./collab/Collab";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep keep keep replace keep replace replace replace keep keep keep keep
<mask> STORAGE_KEYS, <mask> SYNC_BROWSER_TABS_TIMEOUT, <mask> } from "./app_constants"; <mask> import CollabWrapper, { <mask> CollabAPI, <mask> CollabContext, <mask> CollabContextConsumer, <mask> } from "./collab/CollabWrapper"; <mask> import { LanguageList } from "./components/LanguageList"; <mask> import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; <mask> import { <mask> getLibraryItemsFromStorage, </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; </s> add import { exportToBackend, getCollaborationLinkData, isCollaborationLink, loadScene, } from "./data"; </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react"; </s> remove import { restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { restore, restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation"; </s> remove import CollabWrapper from "./CollabWrapper"; </s> add import { TCollabClass } from "./Collab";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx