@doki-land/davinci 0.0.0-stage → 0.0.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/dist/chart.d.ts +583 -0
- package/dist/chart.js +6328 -0
- package/dist/diagram.d.ts +413 -0
- package/dist/diagram.js +415 -0
- package/dist/index.d.ts +1203 -0
- package/dist/index.js +7561 -0
- package/dist/motion.d.ts +214 -0
- package/dist/motion.js +72 -0
- package/dist/runtime.d.ts +129 -0
- package/dist/runtime.js +101 -0
- package/dist/scene-svg.d.ts +180 -0
- package/dist/scene-svg.js +164 -0
- package/dist/scene.d.ts +406 -0
- package/dist/scene.js +697 -0
- package/dist/types.d.ts +181 -0
- package/dist/types.js +153 -0
- package/package.json +74 -4
- package/README.md +0 -3
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
/** 2D point / vector (x, y). */
|
|
4
|
+
export interface Point2D {
|
|
5
|
+
readonly x: number;
|
|
6
|
+
readonly y: number;
|
|
7
|
+
}
|
|
8
|
+
/** 3D point / vector (x, y, z). */
|
|
9
|
+
export interface Point3D {
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
readonly z: number;
|
|
13
|
+
}
|
|
14
|
+
/** Affine 2D transform matrix (3x3, column-major compact form).
|
|
15
|
+
*
|
|
16
|
+
* ```text
|
|
17
|
+
* | a c tx |
|
|
18
|
+
* | b d ty |
|
|
19
|
+
* | 0 0 1 |
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Standard affine transforms (translate, scale, rotate, skew) compose via
|
|
23
|
+
* {@link multiplyTransform}.
|
|
24
|
+
*/
|
|
25
|
+
export interface Affine2D {
|
|
26
|
+
readonly a: number;
|
|
27
|
+
readonly b: number;
|
|
28
|
+
readonly c: number;
|
|
29
|
+
readonly d: number;
|
|
30
|
+
readonly tx: number;
|
|
31
|
+
readonly ty: number;
|
|
32
|
+
}
|
|
33
|
+
/** Identity affine (no-op). */
|
|
34
|
+
export declare const IDENTITY_AFFINE: Affine2D;
|
|
35
|
+
/** Compose two affine transforms: result = b ∘ a (apply a, then b). */
|
|
36
|
+
export declare function multiplyTransform(a: Affine2D, b: Affine2D): Affine2D;
|
|
37
|
+
/** Translate by (dx, dy). */
|
|
38
|
+
export declare function translate(dx: number, dy: number): Affine2D;
|
|
39
|
+
/** Scale by (sx, sy) around origin. */
|
|
40
|
+
export declare function scale(sx: number, sy: number): Affine2D;
|
|
41
|
+
/** Rotate by radians around origin. */
|
|
42
|
+
export declare function rotate(angle: number): Affine2D;
|
|
43
|
+
/** Apply affine transform to a point. */
|
|
44
|
+
export declare function applyTransform(p: Point2D, t: Affine2D): Point2D;
|
|
45
|
+
/** A segment of a path — one of the SVG/Cubic-like command primitives. */
|
|
46
|
+
export type PathCommand = {
|
|
47
|
+
readonly kind: "move";
|
|
48
|
+
readonly to: Point2D;
|
|
49
|
+
} | {
|
|
50
|
+
readonly kind: "line";
|
|
51
|
+
readonly to: Point2D;
|
|
52
|
+
} | {
|
|
53
|
+
readonly kind: "cubic";
|
|
54
|
+
readonly cp1: Point2D;
|
|
55
|
+
readonly cp2: Point2D;
|
|
56
|
+
readonly to: Point2D;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: "quadratic";
|
|
59
|
+
readonly cp: Point2D;
|
|
60
|
+
readonly to: Point2D;
|
|
61
|
+
} | {
|
|
62
|
+
readonly kind: "arc";
|
|
63
|
+
readonly rx: number;
|
|
64
|
+
readonly ry: number;
|
|
65
|
+
readonly xRot: number;
|
|
66
|
+
readonly largeArc: boolean;
|
|
67
|
+
readonly sweep: boolean;
|
|
68
|
+
readonly to: Point2D;
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: "close";
|
|
71
|
+
};
|
|
72
|
+
/** A simple path = sequence of commands, optionally closed. */
|
|
73
|
+
export interface Path {
|
|
74
|
+
readonly commands: ReadonlyArray<PathCommand>;
|
|
75
|
+
}
|
|
76
|
+
declare function moveTo$1(x: number, y: number): PathCommand;
|
|
77
|
+
export declare function lineTo(x: number, y: number): PathCommand;
|
|
78
|
+
export declare function closePath(): PathCommand;
|
|
79
|
+
/** Canonical sRGB color with alpha (0–1 each). */
|
|
80
|
+
export interface RGBA {
|
|
81
|
+
readonly r: number;
|
|
82
|
+
readonly g: number;
|
|
83
|
+
readonly b: number;
|
|
84
|
+
readonly a: number;
|
|
85
|
+
}
|
|
86
|
+
/** Construct from 0–255 integer channels. */
|
|
87
|
+
export declare function rgba8(r: number, g: number, b: number, a?: number): RGBA;
|
|
88
|
+
/** Construct opaque from 0–255 integer channels. */
|
|
89
|
+
export declare function rgb8(r: number, g: number, b: number): RGBA;
|
|
90
|
+
/** Parse `#rgb`, `#rrggbb`, `#rrggbbaa` hex strings. */
|
|
91
|
+
export declare function fromHex(hex: string): RGBA;
|
|
92
|
+
/** Serialize to `#rrggbb` (alpha 1) or `#rrggbbaa`. */
|
|
93
|
+
export declare function toHex(c: RGBA): string;
|
|
94
|
+
/** Opaque black. */
|
|
95
|
+
export declare const BLACK: RGBA;
|
|
96
|
+
/** Opaque white. */
|
|
97
|
+
export declare const WHITE: RGBA;
|
|
98
|
+
/** Fully transparent. */
|
|
99
|
+
export declare const TRANSPARENT: RGBA;
|
|
100
|
+
/** A font family + size + weight/style descriptor (platform-neutral). */
|
|
101
|
+
export interface FontSpec {
|
|
102
|
+
readonly family: string;
|
|
103
|
+
readonly sizePx: number;
|
|
104
|
+
readonly weight?: number;
|
|
105
|
+
readonly italic?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/** Measured text metrics from a text layout engine (platform-provided). */
|
|
108
|
+
interface TextMetrics$1 {
|
|
109
|
+
/** Line box width in CSS pixels. */
|
|
110
|
+
readonly width: number;
|
|
111
|
+
/** Line box height (includes line-gap). */
|
|
112
|
+
readonly height: number;
|
|
113
|
+
/** Distance from baseline to top of em-square. */
|
|
114
|
+
readonly ascent: number;
|
|
115
|
+
/** Distance from baseline to bottom of em-square. */
|
|
116
|
+
readonly descent: number;
|
|
117
|
+
/** Line gap between lines. */
|
|
118
|
+
readonly lineGap: number;
|
|
119
|
+
}
|
|
120
|
+
/** A text node content — display text + font + alignment. */
|
|
121
|
+
export interface TextRun {
|
|
122
|
+
readonly text: string;
|
|
123
|
+
readonly font: FontSpec;
|
|
124
|
+
/** Horizontal anchor on the anchor point. Default "start". */
|
|
125
|
+
readonly hAlign?: "start" | "center" | "end";
|
|
126
|
+
/** Vertical anchor on the anchor point. Default "alphabetic". */
|
|
127
|
+
readonly vAlign?: "alphabetic" | "top" | "middle" | "bottom";
|
|
128
|
+
}
|
|
129
|
+
/** Axis-aligned rectangle (x, y is top-left, w/h non-negative). */
|
|
130
|
+
export interface Rect {
|
|
131
|
+
readonly x: number;
|
|
132
|
+
readonly y: number;
|
|
133
|
+
readonly w: number;
|
|
134
|
+
readonly h: number;
|
|
135
|
+
}
|
|
136
|
+
/** Semantic alias — used by Scene packages for clarity. */
|
|
137
|
+
export type BoundsRect = Rect;
|
|
138
|
+
/** Rect from two corner points. */
|
|
139
|
+
export declare function rectFromPoints(a: {
|
|
140
|
+
readonly x: number;
|
|
141
|
+
readonly y: number;
|
|
142
|
+
}, b: {
|
|
143
|
+
readonly x: number;
|
|
144
|
+
readonly y: number;
|
|
145
|
+
}): Rect;
|
|
146
|
+
/** Rect with explicit center and size. */
|
|
147
|
+
export declare function rectFromCenter(cx: number, cy: number, w: number, h: number): Rect;
|
|
148
|
+
/** Union of two rects (minimal rect containing both). Empty rects are skipped. */
|
|
149
|
+
export declare function union(a: Rect, b: Rect): Rect;
|
|
150
|
+
/** True if point (px, py) is inside rect. */
|
|
151
|
+
export declare function contains(r: Rect, px: number, py: number): boolean;
|
|
152
|
+
/** True if two rects intersect (touching edges counts as intersecting). */
|
|
153
|
+
export declare function intersects(a: Rect, b: Rect): boolean;
|
|
154
|
+
/** Apply a translate offset to a rect. */
|
|
155
|
+
export declare function offset(r: Rect, dx: number, dy: number): Rect;
|
|
156
|
+
export type DiagnosticSeverity = "info" | "warning" | "error";
|
|
157
|
+
/** A single diagnostic item. No reliance on VMZ protocol types. */
|
|
158
|
+
export interface Diagnostic {
|
|
159
|
+
readonly severity: DiagnosticSeverity;
|
|
160
|
+
/** Stable identifier like `davinci.diagram.unsupported`. */
|
|
161
|
+
readonly code: string;
|
|
162
|
+
/** Human-readable message in English. Localization is host-scope. */
|
|
163
|
+
readonly message: string;
|
|
164
|
+
/** Optional source reference (domain, node id, field path, etc.). */
|
|
165
|
+
readonly source?: string;
|
|
166
|
+
}
|
|
167
|
+
/** Immutable diagnostic set — used as output of compile/layout. */
|
|
168
|
+
export interface DiagnosticSet {
|
|
169
|
+
readonly items: ReadonlyArray<Diagnostic>;
|
|
170
|
+
}
|
|
171
|
+
/** Empty diagnostic set. */
|
|
172
|
+
export declare const EMPTY_DIAGNOSTICS: DiagnosticSet;
|
|
173
|
+
/** Convenience factory. */
|
|
174
|
+
export declare function diag(severity: DiagnosticSeverity, code: string, message: string, source?: string): Diagnostic;
|
|
175
|
+
|
|
176
|
+
export {
|
|
177
|
+
TextMetrics$1 as TextMetrics,
|
|
178
|
+
moveTo$1 as moveTo,
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export {};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// ../davinci-types/dist/geometry.js
|
|
2
|
+
var IDENTITY_AFFINE = {
|
|
3
|
+
a: 1,
|
|
4
|
+
b: 0,
|
|
5
|
+
c: 0,
|
|
6
|
+
d: 1,
|
|
7
|
+
tx: 0,
|
|
8
|
+
ty: 0
|
|
9
|
+
};
|
|
10
|
+
function multiplyTransform(a, b) {
|
|
11
|
+
return {
|
|
12
|
+
a: a.a * b.a + a.c * b.b,
|
|
13
|
+
b: a.b * b.a + a.d * b.b,
|
|
14
|
+
c: a.a * b.c + a.c * b.d,
|
|
15
|
+
d: a.b * b.c + a.d * b.d,
|
|
16
|
+
tx: a.a * b.tx + a.c * b.ty + a.tx,
|
|
17
|
+
ty: a.b * b.tx + a.d * b.ty + a.ty
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function translate(dx, dy) {
|
|
21
|
+
return { ...IDENTITY_AFFINE, tx: dx, ty: dy };
|
|
22
|
+
}
|
|
23
|
+
function scale(sx, sy) {
|
|
24
|
+
return { a: sx, d: sy, b: 0, c: 0, tx: 0, ty: 0 };
|
|
25
|
+
}
|
|
26
|
+
function rotate(angle) {
|
|
27
|
+
const cos = Math.cos(angle);
|
|
28
|
+
const sin = Math.sin(angle);
|
|
29
|
+
return { a: cos, b: sin, c: -sin, d: cos, tx: 0, ty: 0 };
|
|
30
|
+
}
|
|
31
|
+
function applyTransform(p, t) {
|
|
32
|
+
return {
|
|
33
|
+
x: t.a * p.x + t.c * p.y + t.tx,
|
|
34
|
+
y: t.b * p.x + t.d * p.y + t.ty
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function moveTo(x, y) {
|
|
38
|
+
return { kind: "move", to: { x, y } };
|
|
39
|
+
}
|
|
40
|
+
function lineTo(x, y) {
|
|
41
|
+
return { kind: "line", to: { x, y } };
|
|
42
|
+
}
|
|
43
|
+
function closePath() {
|
|
44
|
+
return { kind: "close" };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ../davinci-types/dist/color.js
|
|
48
|
+
function rgba8(r, g, b, a = 255) {
|
|
49
|
+
return { r: clamp01(r / 255), g: clamp01(g / 255), b: clamp01(b / 255), a: clamp01(a / 255) };
|
|
50
|
+
}
|
|
51
|
+
function rgb8(r, g, b) {
|
|
52
|
+
return rgba8(r, g, b, 255);
|
|
53
|
+
}
|
|
54
|
+
function fromHex(hex) {
|
|
55
|
+
const h = hex.trim().replace(/^#/, "");
|
|
56
|
+
if (h.length === 3) {
|
|
57
|
+
const r = parseInt(h[0] + h[0], 16);
|
|
58
|
+
const g = parseInt(h[1] + h[1], 16);
|
|
59
|
+
const b = parseInt(h[2] + h[2], 16);
|
|
60
|
+
return rgba8(r, g, b);
|
|
61
|
+
}
|
|
62
|
+
if (h.length === 6) {
|
|
63
|
+
return rgba8(parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16));
|
|
64
|
+
}
|
|
65
|
+
if (h.length === 8) {
|
|
66
|
+
return rgba8(parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16), parseInt(h.slice(6, 8), 16));
|
|
67
|
+
}
|
|
68
|
+
throw new RangeError(`Invalid hex color: ${hex}`);
|
|
69
|
+
}
|
|
70
|
+
function toHex(c) {
|
|
71
|
+
const r = Math.round(c.r * 255).toString(16).padStart(2, "0");
|
|
72
|
+
const g = Math.round(c.g * 255).toString(16).padStart(2, "0");
|
|
73
|
+
const b = Math.round(c.b * 255).toString(16).padStart(2, "0");
|
|
74
|
+
if (c.a >= 1)
|
|
75
|
+
return `#${r}${g}${b}`;
|
|
76
|
+
const a = Math.round(c.a * 255).toString(16).padStart(2, "0");
|
|
77
|
+
return `#${r}${g}${b}${a}`;
|
|
78
|
+
}
|
|
79
|
+
var BLACK = { r: 0, g: 0, b: 0, a: 1 };
|
|
80
|
+
var WHITE = { r: 1, g: 1, b: 1, a: 1 };
|
|
81
|
+
var TRANSPARENT = { r: 0, g: 0, b: 0, a: 0 };
|
|
82
|
+
function clamp01(v) {
|
|
83
|
+
if (v <= 0)
|
|
84
|
+
return 0;
|
|
85
|
+
if (v >= 1)
|
|
86
|
+
return 1;
|
|
87
|
+
return v;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ../davinci-types/dist/bounds.js
|
|
91
|
+
function rectFromPoints(a, b) {
|
|
92
|
+
const x = Math.min(a.x, b.x);
|
|
93
|
+
const y = Math.min(a.y, b.y);
|
|
94
|
+
return { x, y, w: Math.abs(b.x - a.x), h: Math.abs(b.y - a.y) };
|
|
95
|
+
}
|
|
96
|
+
function rectFromCenter(cx, cy, w, h) {
|
|
97
|
+
return { x: cx - w / 2, y: cy - h / 2, w, h };
|
|
98
|
+
}
|
|
99
|
+
function union(a, b) {
|
|
100
|
+
if (a.w <= 0 || a.h <= 0)
|
|
101
|
+
return b;
|
|
102
|
+
if (b.w <= 0 || b.h <= 0)
|
|
103
|
+
return a;
|
|
104
|
+
const x = Math.min(a.x, b.x);
|
|
105
|
+
const y = Math.min(a.y, b.y);
|
|
106
|
+
return {
|
|
107
|
+
x,
|
|
108
|
+
y,
|
|
109
|
+
w: Math.max(a.x + a.w, b.x + b.w) - x,
|
|
110
|
+
h: Math.max(a.y + a.h, b.y + b.h) - y
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function contains(r, px, py) {
|
|
114
|
+
return px >= r.x && px <= r.x + r.w && py >= r.y && py <= r.y + r.h;
|
|
115
|
+
}
|
|
116
|
+
function intersects(a, b) {
|
|
117
|
+
return a.x <= b.x + b.w && a.x + a.w >= b.x && a.y <= b.y + b.h && a.y + a.h >= b.y;
|
|
118
|
+
}
|
|
119
|
+
function offset(r, dx, dy) {
|
|
120
|
+
return { ...r, x: r.x + dx, y: r.y + dy };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ../davinci-types/dist/diagnostics.js
|
|
124
|
+
var EMPTY_DIAGNOSTICS = { items: [] };
|
|
125
|
+
function diag(severity, code, message, source) {
|
|
126
|
+
return { severity, code, message, source };
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
BLACK,
|
|
130
|
+
EMPTY_DIAGNOSTICS,
|
|
131
|
+
IDENTITY_AFFINE,
|
|
132
|
+
TRANSPARENT,
|
|
133
|
+
WHITE,
|
|
134
|
+
applyTransform,
|
|
135
|
+
closePath,
|
|
136
|
+
contains,
|
|
137
|
+
diag,
|
|
138
|
+
fromHex,
|
|
139
|
+
intersects,
|
|
140
|
+
lineTo,
|
|
141
|
+
moveTo,
|
|
142
|
+
multiplyTransform,
|
|
143
|
+
offset,
|
|
144
|
+
rectFromCenter,
|
|
145
|
+
rectFromPoints,
|
|
146
|
+
rgb8,
|
|
147
|
+
rgba8,
|
|
148
|
+
rotate,
|
|
149
|
+
scale,
|
|
150
|
+
toHex,
|
|
151
|
+
translate,
|
|
152
|
+
union
|
|
153
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
{
|
|
2
|
+
"description": "DaVinci engine facade — single public entry for chart/diagram/scene/types/runtime/motion. Tree-shakeable ESM.",
|
|
3
|
+
"devDependencies": {
|
|
4
|
+
"@doki-land/davinci-chart": "0.0.0",
|
|
5
|
+
"@doki-land/davinci-diagram": "0.0.0",
|
|
6
|
+
"@doki-land/davinci-motion": "0.0.0",
|
|
7
|
+
"@doki-land/davinci-runtime": "0.0.0",
|
|
8
|
+
"@doki-land/davinci-scene": "0.0.0",
|
|
9
|
+
"@doki-land/davinci-types": "0.0.0",
|
|
10
|
+
"dts-bundle-generator": "^9.5.1",
|
|
11
|
+
"esbuild": "0.28.1",
|
|
12
|
+
"typescript": "^5.8.3"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"default": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./chart": {
|
|
20
|
+
"default": "./dist/chart.js",
|
|
21
|
+
"types": "./dist/chart.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./diagram": {
|
|
24
|
+
"default": "./dist/diagram.js",
|
|
25
|
+
"types": "./dist/diagram.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./motion": {
|
|
28
|
+
"default": "./dist/motion.js",
|
|
29
|
+
"types": "./dist/motion.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./runtime": {
|
|
32
|
+
"default": "./dist/runtime.js",
|
|
33
|
+
"types": "./dist/runtime.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./scene": {
|
|
36
|
+
"default": "./dist/scene.js",
|
|
37
|
+
"types": "./dist/scene.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./scene/svg": {
|
|
40
|
+
"default": "./dist/scene-svg.js",
|
|
41
|
+
"types": "./dist/scene-svg.d.ts"
|
|
42
|
+
},
|
|
43
|
+
"./types": {
|
|
44
|
+
"default": "./dist/types.js",
|
|
45
|
+
"types": "./dist/types.d.ts"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist"
|
|
50
|
+
],
|
|
51
|
+
"keywords": [
|
|
52
|
+
"vmz",
|
|
53
|
+
"davinci",
|
|
54
|
+
"facade",
|
|
55
|
+
"chart",
|
|
56
|
+
"diagram",
|
|
57
|
+
"scene",
|
|
58
|
+
"visualization"
|
|
59
|
+
],
|
|
60
|
+
"license": "MIT",
|
|
2
61
|
"name": "@doki-land/davinci",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
},
|
|
65
|
+
"repository": {
|
|
66
|
+
"directory": "packages/davinci/davinci",
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "git+https://github.com/doki-land/vmz-framework.git"
|
|
69
|
+
},
|
|
70
|
+
"scripts": {
|
|
71
|
+
"build": "node scripts/build.mjs"
|
|
72
|
+
},
|
|
73
|
+
"sideEffects": false,
|
|
74
|
+
"type": "module",
|
|
75
|
+
"version": "0.0.0"
|
|
76
|
+
}
|
package/README.md
DELETED