mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
chore: release @excalidraw/excalidraw@18.0.0 🎉 (#9127)
This commit is contained in:
parent
392118bf26
commit
ecef5d12f4
232 changed files with 3412 additions and 2851 deletions
|
@ -3,8 +3,8 @@ import {
|
|||
vectorFromPoint,
|
||||
type GlobalPoint,
|
||||
type LocalPoint,
|
||||
} from "../math";
|
||||
import type { Bounds } from "../excalidraw/element/bounds";
|
||||
} from "@excalidraw/math";
|
||||
import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
|
||||
|
||||
export type LineSegment<P extends LocalPoint | GlobalPoint> = [P, P];
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { Curve, Degrees, GlobalPoint } from "../math";
|
||||
import type { Curve, Degrees, GlobalPoint } from "@excalidraw/math";
|
||||
import {
|
||||
curve,
|
||||
degreesToRadians,
|
||||
|
@ -6,7 +6,7 @@ import {
|
|||
lineSegmentRotate,
|
||||
pointFrom,
|
||||
pointRotateDegs,
|
||||
} from "../math";
|
||||
} from "@excalidraw/math";
|
||||
import { pointOnCurve, pointOnPolyline } from "./collision";
|
||||
import type { Polyline } from "./geometry/shape";
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
pointOnEllipse,
|
||||
type GeometricShape,
|
||||
} from "./geometry/shape";
|
||||
import type { Curve } from "../math";
|
||||
import type { Curve } from "@excalidraw/math";
|
||||
import {
|
||||
lineSegment,
|
||||
pointFrom,
|
||||
|
@ -15,7 +15,7 @@ import {
|
|||
type GlobalPoint,
|
||||
type LocalPoint,
|
||||
type Polygon,
|
||||
} from "../math";
|
||||
} from "@excalidraw/math";
|
||||
|
||||
// check if the given point is considered on the given shape's border
|
||||
export const isPointOnShape = <Point extends GlobalPoint | LocalPoint>(
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as utils from ".";
|
||||
import { diagramFactory } from "../excalidraw/tests/fixtures/diagramFixture";
|
||||
import { diagramFactory } from "@excalidraw/excalidraw/tests/fixtures/diagramFixture";
|
||||
import { vi } from "vitest";
|
||||
import * as mockedSceneExportUtils from "../excalidraw/scene/export";
|
||||
import * as mockedSceneExportUtils from "@excalidraw/excalidraw/scene/export";
|
||||
|
||||
import { MIME_TYPES } from "../excalidraw/constants";
|
||||
import { MIME_TYPES } from "@excalidraw/excalidraw/constants";
|
||||
|
||||
const exportToSvgSpy = vi.spyOn(mockedSceneExportUtils, "exportToSvg");
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
import {
|
||||
exportToCanvas as _exportToCanvas,
|
||||
exportToSvg as _exportToSvg,
|
||||
} from "../excalidraw/scene/export";
|
||||
import { getDefaultAppState } from "../excalidraw/appState";
|
||||
import type { AppState, BinaryFiles } from "../excalidraw/types";
|
||||
} from "@excalidraw/excalidraw/scene/export";
|
||||
import { getDefaultAppState } from "@excalidraw/excalidraw/appState";
|
||||
import type { AppState, BinaryFiles } from "@excalidraw/excalidraw/types";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
NonDeleted,
|
||||
} from "../excalidraw/element/types";
|
||||
import { restore } from "../excalidraw/data/restore";
|
||||
import { MIME_TYPES } from "../excalidraw/constants";
|
||||
import { encodePngMetadata } from "../excalidraw/data/image";
|
||||
import { serializeAsJSON } from "../excalidraw/data/json";
|
||||
} from "@excalidraw/excalidraw/element/types";
|
||||
import { restore } from "@excalidraw/excalidraw/data/restore";
|
||||
import { MIME_TYPES } from "@excalidraw/excalidraw/constants";
|
||||
import { encodePngMetadata } from "@excalidraw/excalidraw/data/image";
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
|
||||
import {
|
||||
copyBlobToClipboardAsPng,
|
||||
copyTextToSystemClipboard,
|
||||
copyToClipboard,
|
||||
} from "../excalidraw/clipboard";
|
||||
} from "@excalidraw/excalidraw/clipboard";
|
||||
|
||||
export { MIME_TYPES };
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
import type { GlobalPoint, LineSegment, Polygon, Radians } from "../../math";
|
||||
import type {
|
||||
GlobalPoint,
|
||||
LineSegment,
|
||||
Polygon,
|
||||
Radians,
|
||||
} from "@excalidraw/math";
|
||||
import {
|
||||
pointFrom,
|
||||
lineSegment,
|
||||
|
@ -7,7 +12,7 @@ import {
|
|||
pointOnPolygon,
|
||||
polygonIncludesPoint,
|
||||
segmentsIntersectAt,
|
||||
} from "../../math";
|
||||
} from "@excalidraw/math";
|
||||
import { pointInEllipse, pointOnEllipse, type Ellipse } from "./shape";
|
||||
|
||||
describe("point and line", () => {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* to pure shapes
|
||||
*/
|
||||
|
||||
import type { Curve, LineSegment, Polygon, Radians } from "../../math";
|
||||
import type { Curve, LineSegment, Polygon, Radians } from "@excalidraw/math";
|
||||
import {
|
||||
curve,
|
||||
lineSegment,
|
||||
|
@ -31,8 +31,8 @@ import {
|
|||
vectorScale,
|
||||
type GlobalPoint,
|
||||
type LocalPoint,
|
||||
} from "../../math";
|
||||
import { getElementAbsoluteCoords } from "../../excalidraw/element";
|
||||
} from "@excalidraw/math";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/excalidraw/element";
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawBindableElement,
|
||||
|
@ -48,10 +48,10 @@ import type {
|
|||
ExcalidrawRectangleElement,
|
||||
ExcalidrawSelectionElement,
|
||||
ExcalidrawTextElement,
|
||||
} from "../../excalidraw/element/types";
|
||||
} from "@excalidraw/excalidraw/element/types";
|
||||
import { pointsOnBezierCurves } from "points-on-curve";
|
||||
import type { Drawable, Op } from "roughjs/bin/core";
|
||||
import { invariant } from "../../excalidraw/utils";
|
||||
import { invariant } from "@excalidraw/excalidraw/utils";
|
||||
|
||||
// a polyline (made up term here) is a line consisting of other line segments
|
||||
// this corresponds to a straight line element in the editor but it could also
|
||||
|
|
4
packages/utils/global.d.ts
vendored
4
packages/utils/global.d.ts
vendored
|
@ -1,3 +1,3 @@
|
|||
/// <reference types="vite/client" />
|
||||
import "../excalidraw/global";
|
||||
import "../excalidraw/css";
|
||||
import "@excalidraw/excalidraw/global";
|
||||
import "@excalidraw/excalidraw/css";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export * from "./export";
|
||||
export * from "./withinBounds";
|
||||
export * from "./bbox";
|
||||
export { getCommonBounds } from "../excalidraw/element/bounds";
|
||||
export { getCommonBounds } from "@excalidraw/excalidraw/element/bounds";
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
{
|
||||
"name": "@excalidraw/utils",
|
||||
"version": "0.1.2",
|
||||
"main": "./dist/prod/index.js",
|
||||
"type": "module",
|
||||
"types": "./dist/types/utils/index.d.ts",
|
||||
"main": "./dist/prod/index.js",
|
||||
"module": "./dist/prod/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/types/utils/index.d.ts",
|
||||
"development": "./dist/dev/index.js",
|
||||
"production": "./dist/prod/index.js",
|
||||
"default": "./dist/prod/index.js"
|
||||
},
|
||||
"./*": {
|
||||
"types": "./../utils/dist/types/utils/*"
|
||||
}
|
||||
},
|
||||
"types": "./dist/utils/index.d.ts",
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"description": "Excalidraw utilities functions",
|
||||
"description": "Excalidraw utility functions",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
@ -47,7 +52,7 @@
|
|||
"@excalidraw/laser-pointer": "1.3.1",
|
||||
"browser-fs-access": "0.29.1",
|
||||
"open-color": "1.9.1",
|
||||
"pako": "1.0.11",
|
||||
"pako": "2.0.3",
|
||||
"perfect-freehand": "1.2.0",
|
||||
"png-chunk-text": "1.0.0",
|
||||
"png-chunks-encode": "1.0.0",
|
||||
|
@ -55,35 +60,16 @@
|
|||
"roughjs": "4.6.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.24.5",
|
||||
"@babel/plugin-transform-arrow-functions": "7.24.1",
|
||||
"@babel/plugin-transform-async-to-generator": "7.24.1",
|
||||
"@babel/plugin-transform-runtime": "7.24.3",
|
||||
"@babel/plugin-transform-typescript": "7.24.5",
|
||||
"@babel/preset-env": "7.24.5",
|
||||
"@babel/preset-typescript": "7.24.1",
|
||||
"babel-loader": "8.2.5",
|
||||
"babel-plugin-transform-class-properties": "6.24.1",
|
||||
"cross-env": "7.0.3",
|
||||
"css-loader": "6.7.1",
|
||||
"file-loader": "6.2.0",
|
||||
"fonteditor-core": "2.4.0",
|
||||
"sass-loader": "13.0.2",
|
||||
"ts-loader": "9.3.1",
|
||||
"typescript": "4.9.4",
|
||||
"wawoff2": "2.0.1",
|
||||
"webpack": "5.76.0",
|
||||
"webpack-bundle-analyzer": "4.5.0",
|
||||
"webpack-cli": "4.10.0",
|
||||
"which": "4.0.0"
|
||||
},
|
||||
"bugs": "https://github.com/excalidraw/excalidraw/issues",
|
||||
"repository": "https://github.com/excalidraw/excalidraw",
|
||||
"scripts": {
|
||||
"gen:types": "rm -rf types && tsc",
|
||||
"build:umd": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js",
|
||||
"build:esm": "rm -rf dist && node ../../scripts/buildUtils.js && yarn gen:types",
|
||||
"build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
|
||||
"pack": "yarn build:umd && yarn pack"
|
||||
"build:esm": "rm -rf dist && node ../../scripts/buildUtils.js && yarn gen:types"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/types",
|
||||
"target": "ESNext",
|
||||
"strict": true,
|
||||
"outDir": "dist",
|
||||
"skipLibCheck": true,
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
"jsx": "react-jsx"
|
||||
"jsx": "react-jsx",
|
||||
"emitDeclarationOnly": true,
|
||||
"paths": {
|
||||
"@excalidraw/excalidraw": ["../excalidraw/index.tsx"],
|
||||
"@excalidraw/utils": ["../utils/index.ts"],
|
||||
"@excalidraw/math": ["../math/index.ts"],
|
||||
"@excalidraw/excalidraw/*": ["../excalidraw/*"],
|
||||
"@excalidraw/utils/*": ["../utils/*"],
|
||||
"@excalidraw/math/*": ["../math/*"]
|
||||
}
|
||||
},
|
||||
"exclude": ["**/*.test.*", "**/tests/*", "types", "dist"]
|
||||
"exclude": ["**/*.test.*", "tests", "types", "examples", "dist"]
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import type { ImportedDataState } from "../excalidraw/data/types";
|
||||
import * as utils from "../utils";
|
||||
import { API } from "../excalidraw/tests/helpers/api";
|
||||
import { decodeSvgBase64Payload } from "../excalidraw/scene/export";
|
||||
import { decodePngMetadata } from "../excalidraw/data/image";
|
||||
import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
|
||||
import * as utils from "./index";
|
||||
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
||||
import { decodeSvgBase64Payload } from "@excalidraw/excalidraw/scene/export";
|
||||
import { decodePngMetadata } from "@excalidraw/excalidraw/data/image";
|
||||
|
||||
// NOTE this test file is using the actual API, unmocked. Hence splitting it
|
||||
// from the other test file, because I couldn't figure out how to test
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
const webpack = require("webpack");
|
||||
const path = require("path");
|
||||
const BundleAnalyzerPlugin =
|
||||
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
|
||||
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
entry: { "excalidraw-utils.min": "./index.js" },
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "[name].js",
|
||||
library: "ExcalidrawUtils",
|
||||
libraryTarget: "umd",
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".tsx", ".ts", ".js", ".css", ".scss"],
|
||||
},
|
||||
optimization: {
|
||||
runtimeChunk: false,
|
||||
},
|
||||
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"]],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.LimitChunkCountPlugin({
|
||||
maxChunks: 1,
|
||||
}),
|
||||
...(process.env.ANALYZER === "true" ? [new BundleAnalyzerPlugin()] : []),
|
||||
],
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
import type { Bounds } from "../excalidraw/element/bounds";
|
||||
import { API } from "../excalidraw/tests/helpers/api";
|
||||
import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
|
||||
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
||||
import {
|
||||
elementPartiallyOverlapsWithOrContainsBBox,
|
||||
elementsOverlappingBBox,
|
||||
|
|
|
@ -3,24 +3,24 @@ import type {
|
|||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../excalidraw/element/types";
|
||||
} from "@excalidraw/excalidraw/element/types";
|
||||
import {
|
||||
isArrowElement,
|
||||
isExcalidrawElement,
|
||||
isFreeDrawElement,
|
||||
isLinearElement,
|
||||
isTextElement,
|
||||
} from "../excalidraw/element/typeChecks";
|
||||
import type { Bounds } from "../excalidraw/element/bounds";
|
||||
import { getElementBounds } from "../excalidraw/element/bounds";
|
||||
import { arrayToMap } from "../excalidraw/utils";
|
||||
import type { LocalPoint } from "../math";
|
||||
} from "@excalidraw/excalidraw/element/typeChecks";
|
||||
import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
|
||||
import { getElementBounds } from "@excalidraw/excalidraw/element/bounds";
|
||||
import { arrayToMap } from "@excalidraw/excalidraw/utils";
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
import {
|
||||
rangeIncludesValue,
|
||||
pointFrom,
|
||||
pointRotateRads,
|
||||
rangeInclusive,
|
||||
} from "../math";
|
||||
} from "@excalidraw/math";
|
||||
|
||||
type Element = NonDeletedExcalidrawElement;
|
||||
type Elements = readonly NonDeletedExcalidrawElement[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue