@vanduo-oss/vd3-cbun 1.3.1 → 1.3.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.
- package/CHANGELOG.md +13 -0
- package/README.md +3 -2
- package/dist/draw/core.d.ts +3 -0
- package/dist/draw/index.cjs +44 -5
- package/dist/draw/index.cjs.map +3 -3
- package/dist/draw/index.js +44 -5
- package/dist/draw/index.js.map +3 -3
- package/dist/draw/vue.d.ts +12 -0
- package/dist/meta.json +13 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ All notable changes to `@vanduo-oss/vd3-cbun` are documented here. This file
|
|
|
4
4
|
tracks the PACKAGE only — never docs-site content. Per-component VERSION
|
|
5
5
|
constants are listed alongside each bundle release.
|
|
6
6
|
|
|
7
|
+
## 1.3.2 — 2026-08-13
|
|
8
|
+
|
|
9
|
+
**draw** — line shapes accept an optional `smooth` boolean; when true and there
|
|
10
|
+
are 3+ points, `pointsToPath` emits Catmull-Rom cubics so dense AI polylines
|
|
11
|
+
read as real curves. Interactive two-point lines stay sharp (`smooth` defaults
|
|
12
|
+
false). The `VdDraw` template ref now exposes `addShape`, `updateShape`,
|
|
13
|
+
`removeShape`, `getShape`, `getShapes`, `clear`, `load`, and `toJSON` (the core
|
|
14
|
+
already had these; the wrapper previously omitted them). Additive and
|
|
15
|
+
backward-compatible — a missing `smooth` loads as false — so `VD_DRAW_VERSION`
|
|
16
|
+
stays `1.1.0`. Also non-runtime: pnpm audit overrides (`postcss`,
|
|
17
|
+
`brace-expansion`, `nanoid`, `undici`) kept on the Node 20 engines major, and
|
|
18
|
+
jsdom 30 so the undici override stays compatible.
|
|
19
|
+
|
|
7
20
|
## 1.3.1 — 2026-08-02
|
|
8
21
|
|
|
9
22
|
**flowchart** — CSS token mixes no longer blend toward fixed light cream/white
|
package/README.md
CHANGED
|
@@ -8,11 +8,12 @@ tree-shakeable subpath exports. It replaces the four per-repo publishes
|
|
|
8
8
|
(`@vanduo-oss/charts`, `@vanduo-oss/flowchart`, `@vanduo-oss/hex-grid`,
|
|
9
9
|
`@vanduo-oss/music-player`) of the old line.
|
|
10
10
|
|
|
11
|
-
**Status: 1.3.
|
|
11
|
+
**Status: 1.3.2.** Six Vue3-only component families — charts, code-editor, draw,
|
|
12
12
|
flowchart, hex-grid, music-player — each on its own tree-shakeable subpath, with
|
|
13
13
|
the esbuild metafile isolation guard in place. (1.3.0 adds chart mark-click
|
|
14
14
|
emits + bounded draw/flowchart deserialization; 1.3.1 dark-aware flowchart
|
|
15
|
-
chrome, icon toolbar, and short-parent sizing;
|
|
15
|
+
chrome, icon toolbar, and short-parent sizing; 1.3.2 Catmull-Rom smooth lines
|
|
16
|
+
and Vue shape CRUD on `VdDraw`; see the
|
|
16
17
|
[changelog](./CHANGELOG.md).)
|
|
17
18
|
|
|
18
19
|
## Install
|
package/dist/draw/core.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export interface DrawShape {
|
|
|
60
60
|
text?: string;
|
|
61
61
|
arrowStart?: boolean;
|
|
62
62
|
arrowEnd?: boolean;
|
|
63
|
+
/** When true, line.points render as a Catmull-Rom cubic path instead of a polyline. */
|
|
64
|
+
smooth?: boolean;
|
|
63
65
|
groupId?: string;
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -175,6 +177,7 @@ export class VdDraw {
|
|
|
175
177
|
|
|
176
178
|
// Shapes
|
|
177
179
|
getShape(id: string): DrawShape | null;
|
|
180
|
+
getShapes(): DrawShape[];
|
|
178
181
|
addShape(partial?: Partial<DrawShape>): DrawShape;
|
|
179
182
|
updateShape(
|
|
180
183
|
id: string,
|
package/dist/draw/index.cjs
CHANGED
|
@@ -247,8 +247,31 @@ function resizeHandlePositions(bounds) {
|
|
|
247
247
|
{ key: "w", x, y: my }
|
|
248
248
|
];
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function pointsToCatmullRomPath(points) {
|
|
251
|
+
const pts = points.map((p) => [Number(p[0]), Number(p[1])]);
|
|
252
|
+
if (pts.length < 3) {
|
|
253
|
+
const [first, ...rest] = pts;
|
|
254
|
+
let d2 = `M ${round(first[0])} ${round(first[1])}`;
|
|
255
|
+
for (const [px, py] of rest) d2 += ` L ${round(px)} ${round(py)}`;
|
|
256
|
+
return d2;
|
|
257
|
+
}
|
|
258
|
+
let d = `M ${round(pts[0][0])} ${round(pts[0][1])}`;
|
|
259
|
+
for (let i = 0; i < pts.length - 1; i += 1) {
|
|
260
|
+
const p0 = pts[i === 0 ? i : i - 1];
|
|
261
|
+
const p1 = pts[i];
|
|
262
|
+
const p2 = pts[i + 1];
|
|
263
|
+
const p3 = pts[i + 2 < pts.length ? i + 2 : i + 1];
|
|
264
|
+
const c1x = p1[0] + (p2[0] - p0[0]) / 6;
|
|
265
|
+
const c1y = p1[1] + (p2[1] - p0[1]) / 6;
|
|
266
|
+
const c2x = p2[0] - (p3[0] - p1[0]) / 6;
|
|
267
|
+
const c2y = p2[1] - (p3[1] - p1[1]) / 6;
|
|
268
|
+
d += ` C ${round(c1x)} ${round(c1y)} ${round(c2x)} ${round(c2y)} ${round(p2[0])} ${round(p2[1])}`;
|
|
269
|
+
}
|
|
270
|
+
return d;
|
|
271
|
+
}
|
|
272
|
+
function pointsToPath(points, options = {}) {
|
|
251
273
|
if (!points || !points.length) return "";
|
|
274
|
+
if (options.smooth && points.length >= 3) return pointsToCatmullRomPath(points);
|
|
252
275
|
const [first, ...rest] = points;
|
|
253
276
|
let d = `M ${round(first[0])} ${round(first[1])}`;
|
|
254
277
|
for (const [px, py] of rest) d += ` L ${round(px)} ${round(py)}`;
|
|
@@ -427,7 +450,8 @@ function normalizeShape(raw, usedIds) {
|
|
|
427
450
|
...base,
|
|
428
451
|
points,
|
|
429
452
|
arrowStart: Boolean(raw.arrowStart),
|
|
430
|
-
arrowEnd: raw.arrowEnd == null ? true : Boolean(raw.arrowEnd)
|
|
453
|
+
arrowEnd: raw.arrowEnd == null ? true : Boolean(raw.arrowEnd),
|
|
454
|
+
smooth: Boolean(raw.smooth)
|
|
431
455
|
};
|
|
432
456
|
}
|
|
433
457
|
const shape = {
|
|
@@ -1052,6 +1076,9 @@ var VdDraw = class {
|
|
|
1052
1076
|
getShape(id) {
|
|
1053
1077
|
return this.documentData.shapes.find((s) => s.id === id) || null;
|
|
1054
1078
|
}
|
|
1079
|
+
getShapes() {
|
|
1080
|
+
return this.documentData.shapes.map((s) => deepClone(s));
|
|
1081
|
+
}
|
|
1055
1082
|
addShape(partial = {}) {
|
|
1056
1083
|
const type = DRAW_SHAPE_TYPES.includes(partial.type) ? partial.type : "rectangle";
|
|
1057
1084
|
const s = this.style;
|
|
@@ -1077,7 +1104,9 @@ var VdDraw = class {
|
|
|
1077
1104
|
strokeWidth: partial.strokeWidth == null ? this._shapeStrokeWidth() : partial.strokeWidth,
|
|
1078
1105
|
opacity: partial.opacity == null ? s.opacity : partial.opacity,
|
|
1079
1106
|
arrowStart: Boolean(partial.arrowStart),
|
|
1080
|
-
arrowEnd: partial.arrowEnd == null ? true : Boolean(partial.arrowEnd)
|
|
1107
|
+
arrowEnd: partial.arrowEnd == null ? true : Boolean(partial.arrowEnd),
|
|
1108
|
+
// AI-authored multi-point curves set smooth:true; interactive 2-pt lines stay sharp.
|
|
1109
|
+
smooth: partial.smooth == null ? false : Boolean(partial.smooth)
|
|
1081
1110
|
};
|
|
1082
1111
|
} else {
|
|
1083
1112
|
shape = {
|
|
@@ -2030,7 +2059,9 @@ var VdDraw = class {
|
|
|
2030
2059
|
this._applyShapeStroke(el, shape, standalone, colors);
|
|
2031
2060
|
setOpacity(el);
|
|
2032
2061
|
} else if (shape.type === "line") {
|
|
2033
|
-
el = createSvgEl("path", {
|
|
2062
|
+
el = createSvgEl("path", {
|
|
2063
|
+
d: pointsToPath(shape.points, { smooth: Boolean(shape.smooth) })
|
|
2064
|
+
});
|
|
2034
2065
|
el.classList.add("vd-draw-shape");
|
|
2035
2066
|
this._applyShapeStroke(el, shape, standalone, colors);
|
|
2036
2067
|
setOpacity(el);
|
|
@@ -2240,7 +2271,15 @@ var VdDraw2 = (0, import_vue.defineComponent)({
|
|
|
2240
2271
|
canUndo: () => Boolean(instance?.canUndo()),
|
|
2241
2272
|
canRedo: () => Boolean(instance?.canRedo()),
|
|
2242
2273
|
toSVG: () => instance?.toSVG(),
|
|
2243
|
-
toPNG: (options) => instance?.toPNG(options)
|
|
2274
|
+
toPNG: (options) => instance?.toPNG(options),
|
|
2275
|
+
addShape: (partial) => instance?.addShape(partial),
|
|
2276
|
+
updateShape: (id, patch, options) => instance?.updateShape(id, patch, options),
|
|
2277
|
+
removeShape: (id) => instance?.removeShape(id),
|
|
2278
|
+
getShape: (id) => instance?.getShape(id),
|
|
2279
|
+
getShapes: () => instance?.getShapes(),
|
|
2280
|
+
clear: () => instance?.clear(),
|
|
2281
|
+
load: (data) => instance?.load(data),
|
|
2282
|
+
toJSON: () => instance?.toJSON()
|
|
2244
2283
|
});
|
|
2245
2284
|
return () => (0, import_vue.h)("div", { ref: el, class: "vd-draw" });
|
|
2246
2285
|
}
|