@univerjs-pro/engine-shape 0.21.0 → 0.21.1-insiders.20260509-bf98cad
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -67
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -1,82 +1,34 @@
|
|
|
1
1
|
# @univerjs-pro/engine-shape
|
|
2
2
|
|
|
3
|
-
[](https://npmjs.
|
|
4
|
-
[](https://npmjs.com/package/@univerjs-pro/engine-shape)
|
|
4
|
+
[](https://npmjs.com/package/@univerjs-pro/engine-shape)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
`@univerjs-pro/engine-shape` provides preset shape model and rendering utilities for Univer Pro.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## Package Overview
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
| Package | UMD global | CSS | Locales | Facade entry |
|
|
11
|
+
| --- | --- | :---: | :---: | :---: |
|
|
12
|
+
| `@univerjs-pro/engine-shape` | `UniverProEngineShape` | No | No | No |
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
# Using npm
|
|
16
|
-
npm install @univerjs-pro/engine-shape
|
|
14
|
+
## Installation
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
```sh
|
|
19
17
|
pnpm add @univerjs-pro/engine-shape
|
|
18
|
+
# or
|
|
19
|
+
npm install @univerjs-pro/engine-shape
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### Preset Shapes
|
|
25
|
-
|
|
26
|
-
The library provides 180+ preset shape types organized into the following categories:
|
|
27
|
-
|
|
28
|
-
| Category | Examples |
|
|
29
|
-
|---|---|
|
|
30
|
-
| **Basic Shapes** | Rectangle, RoundRectangle, Ellipse, Diamond, Triangle, Hexagon, Octagon, Star, etc. |
|
|
31
|
-
| **Arrows** | RightArrow, LeftArrow, UpArrow, BentArrow, CurvedArrow, StripedRightArrow, Chevron, etc. |
|
|
32
|
-
| **Flowcharts** | Process, Decision, InputOutput, Document, Terminator, Preparation, ManualInput, etc. |
|
|
33
|
-
| **Callouts** | WedgeRectCallout, WedgeEllipseCallout, CloudCallout, BorderCallout, AccentCallout, etc. |
|
|
34
|
-
| **Stars & Ribbons** | Star4–Star32, Ribbon, EllipseRibbon, VerticalScroll, HorizontalScroll, Wave, etc. |
|
|
35
|
-
| **Math** | MathPlus, MathMinus, MathMultiply, MathDivide, MathEqual, MathNotEqual |
|
|
36
|
-
| **Connectors** | StraightConnector, BentConnector (2–5), CurvedConnector (2–5), Line |
|
|
37
|
-
| **Action Buttons** | Home, Help, Information, Return, BackPrevious, ForwardNext, etc. |
|
|
38
|
-
| **Others** | Cube, Can, Heart, Sun, Moon, SmileyFace, Cloud, Funnel, Gear, etc. |
|
|
39
|
-
|
|
40
|
-
### Fill & Stroke
|
|
41
|
-
|
|
42
|
-
All shapes support three fill modes:
|
|
43
|
-
|
|
44
|
-
- **No fill** — transparent background.
|
|
45
|
-
- **Solid fill** — a single solid color.
|
|
46
|
-
- **Gradient fill** — linear or radial gradients.
|
|
47
|
-
|
|
48
|
-
Stroke styling is fully configurable, including color, width, dash patterns (solid, dash, dot, etc.), and line join/cap styles.
|
|
22
|
+
Keep all `@univerjs/*` and `@univerjs-pro/*` packages on the same version.
|
|
49
23
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Most shapes support inline text editing via double-click. Rich text formatting is supported within shape text, including font size, color, bold, italic, and alignment.
|
|
53
|
-
|
|
54
|
-
### Adjust Points
|
|
55
|
-
|
|
56
|
-
Adjust points provide parameterized editing of shape geometry. Each shape may have zero or more adjust points, which fall into the following types:
|
|
57
|
-
|
|
58
|
-
- **XY adjust points** — control position offsets along the X/Y axes.
|
|
59
|
-
- **Angle adjust points** — control angular parameters.
|
|
60
|
-
- **Radius adjust points** — control radial dimensions.
|
|
61
|
-
|
|
62
|
-
Adjust points can be manipulated through the UI (drag handles) or programmatically via API. For example, the `SmileyFace` shape has an adjust point that controls the mouth curvature — dragging it can turn a smile into a frown.
|
|
63
|
-
|
|
64
|
-
### Connection Sites
|
|
65
|
-
|
|
66
|
-
Connection sites are predefined anchor points on a shape's boundary, used for snapping connectors. When a connector is attached to a connection site, moving the shape automatically updates the connector's path.
|
|
67
|
-
|
|
68
|
-
### Connectors
|
|
24
|
+
## Usage
|
|
69
25
|
|
|
70
|
-
|
|
26
|
+
```ts
|
|
27
|
+
import { ShapeModel, ShapeTypeEnum } from '@univerjs-pro/engine-shape';
|
|
28
|
+
```
|
|
71
29
|
|
|
72
|
-
|
|
73
|
-
- **Bent (elbow)** — an orthogonal polyline with right-angle bends.
|
|
74
|
-
- **Curved** — a smooth Bezier curve.
|
|
30
|
+
## Resources
|
|
75
31
|
|
|
76
|
-
|
|
32
|
+
- [Documentation](https://docs.univer.ai/guides/pro)
|
|
33
|
+
- [NPM package](https://npmjs.com/package/@univerjs-pro/engine-shape)
|
|
77
34
|
|
|
78
|
-
- **Auto-routing** — automatically computes the optimal path around obstacles, similar to Excel.
|
|
79
|
-
- **Shape binding** — attach connector endpoints to connection sites on shapes; moving the shape updates the connector path automatically. Dragging the connector itself detaches it from the bound shape.
|
|
80
|
-
- **Arrow heads** — configurable start and end arrow styles.
|
|
81
|
-
- **Dash styles** — solid, dashed, dotted, and other dash patterns.
|
|
82
|
-
- **Adjust points** — fine-tune the connector path by dragging intermediate control points.
|