@vanduo-oss/vd3-cbun 1.1.0 → 1.3.0
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 +78 -0
- package/README.md +26 -18
- package/SKILL.md +36 -8
- package/dist/charts/index.cjs +18 -8
- package/dist/charts/index.cjs.map +2 -2
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.js +18 -8
- package/dist/charts/index.js.map +2 -2
- package/dist/charts/vue.d.ts +78 -7
- package/dist/code-editor/index.cjs +5 -3
- package/dist/code-editor/index.cjs.map +2 -2
- package/dist/code-editor/index.js +5 -3
- package/dist/code-editor/index.js.map +2 -2
- package/dist/draw/core.d.ts +246 -0
- package/dist/draw/index.cjs +2248 -0
- package/dist/draw/index.cjs.map +7 -0
- package/dist/draw/index.d.ts +34 -0
- package/dist/draw/index.js +2225 -0
- package/dist/draw/index.js.map +7 -0
- package/dist/draw/shapes.d.ts +12 -0
- package/dist/draw/vd3-draw.css +301 -0
- package/dist/draw/vue.d.ts +68 -0
- package/dist/flowchart/index.cjs +4 -4
- package/dist/flowchart/index.cjs.map +2 -2
- package/dist/flowchart/index.js +4 -4
- package/dist/flowchart/index.js.map +2 -2
- package/dist/hex-grid/index.cjs +90 -62
- package/dist/hex-grid/index.cjs.map +3 -3
- package/dist/hex-grid/index.d.ts +1 -1
- package/dist/hex-grid/index.js +90 -62
- package/dist/hex-grid/index.js.map +3 -3
- package/dist/hex-grid/vue.d.ts +25 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +2 -2
- package/dist/meta.json +169 -45
- package/dist/music-player/index.cjs +3 -4
- package/dist/music-player/index.cjs.map +2 -2
- package/dist/music-player/index.d.ts +9 -1
- package/dist/music-player/index.js +3 -4
- package/dist/music-player/index.js.map +2 -2
- package/dist/music-player/vue.d.ts +49 -1
- package/package.json +9 -2
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// Type definitions for the framework-agnostic draw tool core (src/draw/core.js).
|
|
2
|
+
// core.js exports only `class VdDraw`; the shared draw types are hand-authored
|
|
3
|
+
// here for the whole component to consume. The four public constants
|
|
4
|
+
// (VD_DRAW_VERSION, DRAW_TOOLS, DRAW_SHAPE_TYPES, BRUSH_PRESETS) live in
|
|
5
|
+
// shapes.js and are declared in the sibling ./shapes.d.ts, matching the runtime
|
|
6
|
+
// module boundary (index.js re-exports them from './shapes.js').
|
|
7
|
+
|
|
8
|
+
export type DrawTool =
|
|
9
|
+
'select' | 'hand' | 'draw' | 'eraser' | 'rectangle' | 'ellipse' | 'line' | 'text' | 'sticky';
|
|
10
|
+
|
|
11
|
+
export type DrawShapeType = 'rectangle' | 'ellipse' | 'line' | 'freehand' | 'text' | 'sticky';
|
|
12
|
+
|
|
13
|
+
export type BrushName = 'pen' | 'pencil' | 'marker' | 'highlighter' | 'calligraphy';
|
|
14
|
+
|
|
15
|
+
export interface BrushPreset {
|
|
16
|
+
size: number;
|
|
17
|
+
thinning: number;
|
|
18
|
+
smoothing: number;
|
|
19
|
+
streamline: number;
|
|
20
|
+
taperStart: number;
|
|
21
|
+
taperEnd: number;
|
|
22
|
+
opacity: number;
|
|
23
|
+
blend: string;
|
|
24
|
+
nibAngle?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface DrawViewport {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
scale: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A world-space point `[x, y]` with an optional third `pressure` (0–1) slot. */
|
|
34
|
+
export type DrawPoint = [number, number] | [number, number, number];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A shape in the document. Box shapes (rectangle/ellipse/text/sticky) use
|
|
38
|
+
* x/y/w/h; line/freehand use `points`. `color` is the stroke color for shapes /
|
|
39
|
+
* lines and the fill color for freehand brush strokes.
|
|
40
|
+
*/
|
|
41
|
+
export interface DrawShape {
|
|
42
|
+
id: string;
|
|
43
|
+
type: DrawShapeType;
|
|
44
|
+
x?: number;
|
|
45
|
+
y?: number;
|
|
46
|
+
w?: number;
|
|
47
|
+
h?: number;
|
|
48
|
+
rotation?: number;
|
|
49
|
+
points?: DrawPoint[];
|
|
50
|
+
/** freehand: the brush preset. */
|
|
51
|
+
brush?: BrushName;
|
|
52
|
+
/** stroke color (shapes/line) or fill color (freehand). */
|
|
53
|
+
color?: string;
|
|
54
|
+
fill?: string;
|
|
55
|
+
/** freehand brush size. */
|
|
56
|
+
size?: number;
|
|
57
|
+
/** shapes/line stroke width. */
|
|
58
|
+
strokeWidth?: number;
|
|
59
|
+
opacity?: number;
|
|
60
|
+
text?: string;
|
|
61
|
+
arrowStart?: boolean;
|
|
62
|
+
arrowEnd?: boolean;
|
|
63
|
+
groupId?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface DrawDocument {
|
|
67
|
+
version: string;
|
|
68
|
+
viewport: DrawViewport;
|
|
69
|
+
shapes: DrawShape[];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface DrawBounds {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
w: number;
|
|
76
|
+
h: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface DrawChangeEvent {
|
|
80
|
+
reason: string;
|
|
81
|
+
document: DrawDocument;
|
|
82
|
+
shape?: DrawShape;
|
|
83
|
+
shapeId?: string;
|
|
84
|
+
shapeIds?: string[];
|
|
85
|
+
groupId?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface DrawSelectEvent {
|
|
89
|
+
ids: string[];
|
|
90
|
+
shapes: DrawShape[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface DrawViewportEvent {
|
|
94
|
+
reason: string;
|
|
95
|
+
viewport: DrawViewport;
|
|
96
|
+
document: DrawDocument;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface DrawHistoryEvent {
|
|
100
|
+
reason: string;
|
|
101
|
+
canUndo: boolean;
|
|
102
|
+
canRedo: boolean;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface DrawEventMap {
|
|
106
|
+
change: DrawChangeEvent;
|
|
107
|
+
select: DrawSelectEvent;
|
|
108
|
+
viewport: DrawViewportEvent;
|
|
109
|
+
history: DrawHistoryEvent;
|
|
110
|
+
ready: VdDraw;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface VdDrawOptions {
|
|
114
|
+
element?: Element | string;
|
|
115
|
+
/** Alias for `element`. */
|
|
116
|
+
target?: Element | string;
|
|
117
|
+
data?: Partial<DrawDocument> | string;
|
|
118
|
+
readonly?: boolean;
|
|
119
|
+
tool?: DrawTool;
|
|
120
|
+
gridSize?: number;
|
|
121
|
+
/** Show the background grid (default true). */
|
|
122
|
+
showGrid?: boolean;
|
|
123
|
+
/** Snap to nearby edges/centres while moving/resizing (default true). */
|
|
124
|
+
snap?: boolean;
|
|
125
|
+
/** Fit to content once the canvas reports a measurable size. */
|
|
126
|
+
autoFit?: boolean;
|
|
127
|
+
/** Enable built-in undo/redo (default true). */
|
|
128
|
+
history?: boolean;
|
|
129
|
+
/** Maximum retained history entries (default 100). */
|
|
130
|
+
historyLimit?: number;
|
|
131
|
+
/** Initial current-style color / opacity / brush size / brush preset. */
|
|
132
|
+
color?: string;
|
|
133
|
+
opacity?: number;
|
|
134
|
+
brushSize?: number;
|
|
135
|
+
brush?: BrushName;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface StylePatch {
|
|
139
|
+
color?: string;
|
|
140
|
+
fill?: string;
|
|
141
|
+
strokeWidth?: number;
|
|
142
|
+
opacity?: number;
|
|
143
|
+
size?: number;
|
|
144
|
+
brush?: BrushName;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export class VdDraw {
|
|
148
|
+
constructor(options?: VdDrawOptions);
|
|
149
|
+
|
|
150
|
+
readonly element: Element;
|
|
151
|
+
readonly readonly: boolean;
|
|
152
|
+
gridSize: number;
|
|
153
|
+
tool: DrawTool;
|
|
154
|
+
snap: boolean;
|
|
155
|
+
showGrid: boolean;
|
|
156
|
+
destroyed: boolean;
|
|
157
|
+
/** The current drawing style new marks adopt. */
|
|
158
|
+
style: { color: string; opacity: number; size: number; brush: BrushName };
|
|
159
|
+
|
|
160
|
+
// Events
|
|
161
|
+
on<K extends keyof DrawEventMap>(event: K, callback: (payload: DrawEventMap[K]) => void): this;
|
|
162
|
+
off<K extends keyof DrawEventMap>(event: K, callback: (payload: DrawEventMap[K]) => void): this;
|
|
163
|
+
|
|
164
|
+
// Tool + current style
|
|
165
|
+
setTool(tool: DrawTool): this;
|
|
166
|
+
setColor(color: string): this;
|
|
167
|
+
setOpacity(opacity: number): this;
|
|
168
|
+
setBrushSize(size: number): this;
|
|
169
|
+
setBrush(brush: BrushName): this;
|
|
170
|
+
|
|
171
|
+
// Grid
|
|
172
|
+
setGridSize(size: number): this;
|
|
173
|
+
setGridVisible(visible: boolean): this;
|
|
174
|
+
toggleGrid(): this;
|
|
175
|
+
|
|
176
|
+
// Shapes
|
|
177
|
+
getShape(id: string): DrawShape | null;
|
|
178
|
+
addShape(partial?: Partial<DrawShape>): DrawShape;
|
|
179
|
+
updateShape(
|
|
180
|
+
id: string,
|
|
181
|
+
patch?: Partial<DrawShape>,
|
|
182
|
+
options?: { reason?: string },
|
|
183
|
+
): DrawShape | null;
|
|
184
|
+
removeShape(id: string): boolean;
|
|
185
|
+
|
|
186
|
+
// Selection
|
|
187
|
+
getSelectedShapes(): DrawShape[];
|
|
188
|
+
select(ids: string | string[] | null, options?: { additive?: boolean }): this;
|
|
189
|
+
selectAll(): this;
|
|
190
|
+
deselect(): this;
|
|
191
|
+
selectInBounds(box: DrawBounds, options?: { additive?: boolean }): this;
|
|
192
|
+
|
|
193
|
+
// Manipulation
|
|
194
|
+
nudge(dx: number, dy: number): this;
|
|
195
|
+
setSelectionBounds(target: DrawBounds): this;
|
|
196
|
+
deleteSelection(): boolean;
|
|
197
|
+
setStyle(patch: StylePatch): this;
|
|
198
|
+
|
|
199
|
+
// Z-order
|
|
200
|
+
bringForward(): this;
|
|
201
|
+
sendBackward(): this;
|
|
202
|
+
bringToFront(): this;
|
|
203
|
+
sendToBack(): this;
|
|
204
|
+
|
|
205
|
+
// Grouping
|
|
206
|
+
group(): this;
|
|
207
|
+
ungroup(): this;
|
|
208
|
+
|
|
209
|
+
// Clipboard
|
|
210
|
+
copy(): this;
|
|
211
|
+
cut(): this;
|
|
212
|
+
paste(options?: { offset?: number }): this;
|
|
213
|
+
duplicate(): this;
|
|
214
|
+
|
|
215
|
+
// Export
|
|
216
|
+
toSVG(): string;
|
|
217
|
+
toPNG(options?: { scale?: number }): Promise<string>;
|
|
218
|
+
|
|
219
|
+
// Viewport
|
|
220
|
+
setViewport(patch: Partial<DrawViewport>): this;
|
|
221
|
+
scaleAround(factor: number, localX: number, localY: number): this;
|
|
222
|
+
zoomIn(): this;
|
|
223
|
+
zoomOut(): this;
|
|
224
|
+
resetView(): this;
|
|
225
|
+
fitView(): this;
|
|
226
|
+
|
|
227
|
+
// History
|
|
228
|
+
undo(): this;
|
|
229
|
+
redo(): this;
|
|
230
|
+
canUndo(): boolean;
|
|
231
|
+
canRedo(): boolean;
|
|
232
|
+
clearHistory(): this;
|
|
233
|
+
|
|
234
|
+
// Document
|
|
235
|
+
clear(): this;
|
|
236
|
+
load(data: Partial<DrawDocument> | string): this;
|
|
237
|
+
toJSON(): DrawDocument;
|
|
238
|
+
|
|
239
|
+
// Text editing
|
|
240
|
+
startTextEdit(id: string): boolean;
|
|
241
|
+
stopTextEdit(options?: { commit?: boolean }): void;
|
|
242
|
+
|
|
243
|
+
// Rendering + lifecycle
|
|
244
|
+
render(flags?: { scene?: boolean; overlay?: boolean }): void;
|
|
245
|
+
destroy(): void;
|
|
246
|
+
}
|