@alphacharts/drawings 0.1.0 → 0.1.1
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/dist/index.js +707 -667
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugin.d.ts +6 -0
- package/dist/types/shapes.d.ts +10 -0
- package/dist/types/types.d.ts +5 -0
- package/package.json +3 -3
package/dist/types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { TemplateStore } from "./templates.js";
|
|
|
8
8
|
export type { DrawingTemplate } from "./templates.js";
|
|
9
9
|
export { DEFAULT_STYLE, SCHEMA_VERSION } from "./types.js";
|
|
10
10
|
export type { Anchor, Dash, Drawing, DrawingStyle, DrawingsState, Gesture, Shape, Stroke, ToolCtx, ToolDef } from "./types.js";
|
|
11
|
-
export { drawShapes, shapeDistance, shapeInRect, withAlpha } from "./shapes.js";
|
|
11
|
+
export { declutter, drawShapes, shapeDistance, shapeInRect, withAlpha } from "./shapes.js";
|
|
12
12
|
export * as geometry from "./geometry.js";
|
|
13
13
|
export { allTools } from "./tools/all.js";
|
|
14
14
|
export { lineTools, trendLine, ray, infoLine, extendedLine, horizontalLine, horizontalRay, verticalLine, crossLine } from "./tools/lines.js";
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ export interface DrawingsOptions {
|
|
|
15
15
|
magnet?: MagnetMode;
|
|
16
16
|
/** Stay in the tool after a drawing is finished. */
|
|
17
17
|
continuous?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Display only, for drawings the host places by code: the plugin never takes a pointer press, key or cursor, so
|
|
20
|
+
* nothing it draws can be hit, selected, moved or deleted, and the chart (pan, zoom, its own handles above it)
|
|
21
|
+
* gets every event as if no drawing were there. `setTool` throws. `add`, `update`, `remove` and `fromJSON` still work.
|
|
22
|
+
*/
|
|
23
|
+
readOnly?: boolean;
|
|
18
24
|
/** Templates and favourites storage. */
|
|
19
25
|
store?: LayoutStore;
|
|
20
26
|
/** A tool failed to draw or a gesture produced an invalid drawing. Default: console.error. */
|
package/dist/types/shapes.d.ts
CHANGED
|
@@ -13,6 +13,16 @@ export interface TextBox {
|
|
|
13
13
|
export declare function textBox(s: Extract<Shape, {
|
|
14
14
|
k: "text";
|
|
15
15
|
}>, style: DrawingStyle, measure: (text: string, font: string) => number): TextBox;
|
|
16
|
+
/**
|
|
17
|
+
* Moves the `stack` labels of one pane apart: in order from the top, a label that overlaps one already placed is
|
|
18
|
+
* moved down until it clears it. Mutates the shapes (they are made anew for each frame); nothing else is touched.
|
|
19
|
+
*/
|
|
20
|
+
export declare function declutter(items: readonly {
|
|
21
|
+
s: Extract<Shape, {
|
|
22
|
+
k: "text";
|
|
23
|
+
}>;
|
|
24
|
+
style: DrawingStyle;
|
|
25
|
+
}[], measure: (text: string, font: string) => number): void;
|
|
16
26
|
export declare function drawShapes(ctx: CanvasRenderingContext2D, shapes: readonly Shape[], style: DrawingStyle, W: number, H: number, opts?: {
|
|
17
27
|
widthBoost?: number;
|
|
18
28
|
}): void;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -85,6 +85,11 @@ export type Shape = (Stroke & {
|
|
|
85
85
|
/** Border of the background box. */
|
|
86
86
|
border?: string | null;
|
|
87
87
|
pad?: number;
|
|
88
|
+
/**
|
|
89
|
+
* A label that gives way: when the pane draws it over another stacking label it is moved down just clear of it
|
|
90
|
+
* (the price labels of several levels close in price do not print over one another).
|
|
91
|
+
*/
|
|
92
|
+
stack?: boolean;
|
|
88
93
|
});
|
|
89
94
|
export interface ToolCtx {
|
|
90
95
|
/** Pane size in CSS px. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alphacharts/drawings",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Chart drawing tools for
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Chart drawing tools for alphacharts: 82 tools, undo/redo, magnet and templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"drawings",
|
|
7
7
|
"trendline",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typescript": "5.9.3",
|
|
45
45
|
"vite": "8.3.1",
|
|
46
46
|
"vitest": "5.0.2",
|
|
47
|
-
"@alphacharts/core": "0.1.
|
|
47
|
+
"@alphacharts/core": "0.1.1"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "vite build && tsc -p tsconfig.build.json",
|