@fulate/share 2.0.11 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +11 -15
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,26 +1,22 @@
1
1
  # `@fulate/share`
2
2
 
3
- `@fulate/share` 是 Fulate 最底层的无场景工具包,提供点、矩形、矩阵、颜色、渐变和相交计算。
3
+ 提供点、矩形、矩阵、颜色、渐变和相交计算。
4
4
 
5
- - 点:`PointView`、`MutablePointView`、`createPointView()`、`transformPoint()`、距离判断;
6
- - 矩形:`Rect`、`BoundingBox`、可变 `Bound` 及 points/rects 边界计算;
7
- - 矩阵和数学:Fulate 唯一的 2D 仿射矩阵 `Matrix2D` / `ReadonlyMatrix2D`、`qrDecompose()`、
8
- 角度/弧度换算、矩形边缘位置;
9
- - 几何:`Intersection`、`clipPolygonToRect()`;
10
- - 颜色和渐变:颜色解析/格式化、alpha 合成、混色和 Canvas gradient 创建。
5
+ | 用途 | 常用 API |
6
+ | --- | --- |
7
+ | 点 | `PointView`、`createPointView()`、`transformPoint()` |
8
+ | 边界 | `Rect`、`BoundingBox`、`Bound` |
9
+ | 矩阵 | `Matrix2D`、`ReadonlyMatrix2D`、`qrDecompose()` |
10
+ | 几何 | `Intersection`、`clipPolygonToRect()` |
11
+ | 颜色 | 颜色解析、格式化、混色、alpha 合成和 Canvas gradient |
11
12
 
12
13
  ```ts
13
- import {
14
- Bound,
15
- createPointView,
16
- transformPoint,
17
- colorWithAlpha
18
- } from "@fulate/share";
14
+ import { Bound, Matrix2D, createPointView, transformPoint, colorWithAlpha } from "@fulate/share";
19
15
 
16
+ const matrix = new Matrix2D().translateSelf(20, 10);
20
17
  const point = transformPoint(matrix, createPointView(10, 20));
21
18
  const bounds = Bound.fromPoints([point]);
22
19
  const overlay = colorWithAlpha("#6750a4", 0.12);
23
20
  ```
24
21
 
25
- 函数直接消费声明类型,不为 Core/UI 建立 DTO、registry 或缓存。返回可变 `Bound` 的方法按普通对象
26
- 语义工作;调用方需要独立结果时使用明确的 `copy()` 或在自身 owner 内创建新值。
22
+ `Bound` 可修改;需要独立边界时调用 `copy()`。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fulate/share",
3
- "version": "2.0.11",
3
+ "version": "3.0.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",