@tioniq/sceniq 0.0.0-stage → 0.1.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.
@@ -0,0 +1,213 @@
1
+ import { S as Size, b as ViewOptions, V as View, P as Point, g as DrawableContent, c as ViewBox, R as RectBounds, D as DrawState } from '../rect-bounds-Bd7-7ERA.cjs';
2
+ import { VarOrVal } from '@tioniq/eventiq';
3
+ import { C as Color } from '../color-IY199Sua.cjs';
4
+ import '@tioniq/disposiq';
5
+
6
+ interface SvgStyleAttrs {
7
+ fill?: string | null;
8
+ fillRule?: "evenodd" | "nonzero" | null;
9
+ fillOpacity?: number | null;
10
+ stroke?: string | null;
11
+ strokeWidth?: number | null;
12
+ strokeLinecap?: CanvasLineCap | null;
13
+ strokeLinejoin?: CanvasLineJoin | null;
14
+ strokeDasharray?: number[] | null;
15
+ strokeDashoffset?: number | null;
16
+ strokeOpacity?: number | null;
17
+ clipRule?: "evenodd" | "nonzero" | null;
18
+ opacity?: number | null;
19
+ mask?: string | null;
20
+ clipPath?: string | null;
21
+ }
22
+ interface SvgPath extends SvgStyleAttrs {
23
+ type: "path";
24
+ d: string;
25
+ }
26
+ interface SvgMask {
27
+ type: "mask";
28
+ id: string;
29
+ children: SvgItem[];
30
+ }
31
+ interface SvgClipPath {
32
+ type: "clipPath";
33
+ id: string;
34
+ children: SvgItem[];
35
+ }
36
+ interface SvgCircle extends SvgStyleAttrs {
37
+ type: "circle";
38
+ cx: number;
39
+ cy: number;
40
+ r: number;
41
+ }
42
+ interface SvgEllipse extends SvgStyleAttrs {
43
+ type: "ellipse";
44
+ cx: number;
45
+ cy: number;
46
+ rx: number;
47
+ ry: number;
48
+ }
49
+ interface SvgRect extends SvgStyleAttrs {
50
+ type: "rect";
51
+ x: number;
52
+ y: number;
53
+ width: number;
54
+ height: number;
55
+ rx?: number | null;
56
+ ry?: number | null;
57
+ }
58
+ interface SvgLine extends SvgStyleAttrs {
59
+ type: "line";
60
+ x1: number;
61
+ y1: number;
62
+ x2: number;
63
+ y2: number;
64
+ }
65
+ interface SvgPolyline extends SvgStyleAttrs {
66
+ type: "polyline";
67
+ points: string;
68
+ }
69
+ interface SvgPolygon extends SvgStyleAttrs {
70
+ type: "polygon";
71
+ points: string;
72
+ }
73
+ interface SvgText extends SvgStyleAttrs {
74
+ type: "text";
75
+ x: number;
76
+ y: number;
77
+ content: string;
78
+ fontSize?: number | null;
79
+ fontFamily?: string | null;
80
+ fontWeight?: string | null;
81
+ fontStyle?: string | null;
82
+ textAnchor?: "start" | "middle" | "end" | null;
83
+ dominantBaseline?: string | null;
84
+ }
85
+ interface SvgGroup {
86
+ type: "g";
87
+ children: SvgItem[];
88
+ transform?: SvgTransform | null;
89
+ opacity?: number | null;
90
+ mask?: string | null;
91
+ clipPath?: string | null;
92
+ fill?: string | null;
93
+ stroke?: string | null;
94
+ }
95
+ interface SvgDefs {
96
+ type: "defs";
97
+ children: SvgItem[];
98
+ }
99
+ interface SvgUse {
100
+ type: "use";
101
+ href: string;
102
+ x?: number | null;
103
+ y?: number | null;
104
+ width?: number | null;
105
+ height?: number | null;
106
+ }
107
+ type SvgTransformOp = {
108
+ kind: "translate";
109
+ tx: number;
110
+ ty: number;
111
+ } | {
112
+ kind: "scale";
113
+ sx: number;
114
+ sy: number;
115
+ } | {
116
+ kind: "rotate";
117
+ angle: number;
118
+ cx: number;
119
+ cy: number;
120
+ } | {
121
+ kind: "skewX";
122
+ angle: number;
123
+ } | {
124
+ kind: "skewY";
125
+ angle: number;
126
+ } | {
127
+ kind: "matrix";
128
+ a: number;
129
+ b: number;
130
+ c: number;
131
+ d: number;
132
+ e: number;
133
+ f: number;
134
+ };
135
+ interface SvgTransform {
136
+ ops: SvgTransformOp[];
137
+ }
138
+ type SvgItem = SvgPath | SvgMask | SvgClipPath | SvgCircle | SvgEllipse | SvgRect | SvgLine | SvgPolyline | SvgPolygon | SvgText | SvgGroup | SvgDefs | SvgUse;
139
+
140
+ interface SvgCreateViewOptions extends ViewOptions {
141
+ originalSize?: Size;
142
+ fill?: VarOrVal<string | Color | null>;
143
+ }
144
+ interface Svg {
145
+ size: Size;
146
+ items: SvgItem[];
147
+ fill?: string | null;
148
+ createView(options?: SvgCreateViewOptions): View;
149
+ createDrawableContent(location?: Point, scale?: Point): DrawableContent;
150
+ with(overrides?: {
151
+ size?: Size;
152
+ paths?: SvgPath[];
153
+ fill?: string | null;
154
+ lineWidth?: number | null;
155
+ lineCap?: CanvasLineCap | null;
156
+ lineJoin?: CanvasLineJoin | null;
157
+ }): Svg;
158
+ copy(): Svg;
159
+ toRawSvg(): string;
160
+ }
161
+ declare function parseSvg(str: string): Svg;
162
+
163
+ /**
164
+ * Immutable draw context passed through the render tree.
165
+ * Built once per Svg instance (not per frame) and reused.
166
+ */
167
+ interface DrawContext {
168
+ readonly masks: ReadonlyMap<string, SvgMask>;
169
+ readonly clipPaths: ReadonlyMap<string, SvgClipPath>;
170
+ readonly defs: ReadonlyMap<string, SvgItem>;
171
+ readonly globalFill: string | null;
172
+ readonly customFill: string | Color | null;
173
+ readonly defaultLineWidth: number;
174
+ readonly defaultLineCap: CanvasLineCap;
175
+ readonly defaultLineJoin: CanvasLineJoin;
176
+ }
177
+ /**
178
+ * Build a DrawContext from an item list.
179
+ * This should be called once per Svg instance, not per frame.
180
+ */
181
+ declare function buildDrawContext(items: SvgItem[], globalFill: string | null, defaultLineWidth: number, defaultLineCap: CanvasLineCap, defaultLineJoin: CanvasLineJoin): DrawContext;
182
+
183
+ declare function drawItems(ctx: CanvasRenderingContext2D, items: SvgItem[], dc: DrawContext): void;
184
+ declare function drawItem(ctx: CanvasRenderingContext2D, item: SvgItem, dc: DrawContext): void;
185
+
186
+ declare function parseXml(str: string): Element;
187
+
188
+ declare function escapeXml(s: string): string;
189
+ declare function itemToRawSvg(item: SvgItem): string;
190
+
191
+ interface SvgContainerParams {
192
+ size?: number;
193
+ x?: number;
194
+ y?: number;
195
+ color?: string;
196
+ }
197
+ interface SvgContainerDefaultData {
198
+ lineWidth?: number;
199
+ lineCap?: CanvasLineCap;
200
+ lineJoin?: CanvasLineJoin;
201
+ size: number;
202
+ }
203
+ declare class SvgContainerView extends View {
204
+ private readonly _defaultData;
205
+ private readonly _renderer;
206
+ private readonly _svgScale;
207
+ private readonly _color;
208
+ constructor(defaultData: SvgContainerDefaultData, renderer: (context: CanvasRenderingContext2D) => void, params?: SvgContainerParams);
209
+ protected doGetDrawBounds(measuredBox: ViewBox): RectBounds;
210
+ protected doDraw(context: CanvasRenderingContext2D, _state: DrawState): void;
211
+ }
212
+
213
+ export { type Svg, type SvgCircle, type SvgClipPath, type SvgContainerDefaultData, type SvgContainerParams, SvgContainerView, type SvgCreateViewOptions, type SvgDefs, type DrawContext as SvgDrawContext, type SvgEllipse, type SvgGroup, type SvgItem, type SvgLine, type SvgMask, type SvgPath, type SvgPolygon, type SvgPolyline, type SvgRect, type SvgStyleAttrs, type SvgText, type SvgTransform, type SvgTransformOp, type SvgUse, buildDrawContext, drawItem, drawItems, escapeXml, itemToRawSvg, parseSvg, parseXml };
@@ -0,0 +1,213 @@
1
+ import { S as Size, b as ViewOptions, V as View, P as Point, g as DrawableContent, c as ViewBox, R as RectBounds, D as DrawState } from '../rect-bounds-Bd7-7ERA.js';
2
+ import { VarOrVal } from '@tioniq/eventiq';
3
+ import { C as Color } from '../color-IY199Sua.js';
4
+ import '@tioniq/disposiq';
5
+
6
+ interface SvgStyleAttrs {
7
+ fill?: string | null;
8
+ fillRule?: "evenodd" | "nonzero" | null;
9
+ fillOpacity?: number | null;
10
+ stroke?: string | null;
11
+ strokeWidth?: number | null;
12
+ strokeLinecap?: CanvasLineCap | null;
13
+ strokeLinejoin?: CanvasLineJoin | null;
14
+ strokeDasharray?: number[] | null;
15
+ strokeDashoffset?: number | null;
16
+ strokeOpacity?: number | null;
17
+ clipRule?: "evenodd" | "nonzero" | null;
18
+ opacity?: number | null;
19
+ mask?: string | null;
20
+ clipPath?: string | null;
21
+ }
22
+ interface SvgPath extends SvgStyleAttrs {
23
+ type: "path";
24
+ d: string;
25
+ }
26
+ interface SvgMask {
27
+ type: "mask";
28
+ id: string;
29
+ children: SvgItem[];
30
+ }
31
+ interface SvgClipPath {
32
+ type: "clipPath";
33
+ id: string;
34
+ children: SvgItem[];
35
+ }
36
+ interface SvgCircle extends SvgStyleAttrs {
37
+ type: "circle";
38
+ cx: number;
39
+ cy: number;
40
+ r: number;
41
+ }
42
+ interface SvgEllipse extends SvgStyleAttrs {
43
+ type: "ellipse";
44
+ cx: number;
45
+ cy: number;
46
+ rx: number;
47
+ ry: number;
48
+ }
49
+ interface SvgRect extends SvgStyleAttrs {
50
+ type: "rect";
51
+ x: number;
52
+ y: number;
53
+ width: number;
54
+ height: number;
55
+ rx?: number | null;
56
+ ry?: number | null;
57
+ }
58
+ interface SvgLine extends SvgStyleAttrs {
59
+ type: "line";
60
+ x1: number;
61
+ y1: number;
62
+ x2: number;
63
+ y2: number;
64
+ }
65
+ interface SvgPolyline extends SvgStyleAttrs {
66
+ type: "polyline";
67
+ points: string;
68
+ }
69
+ interface SvgPolygon extends SvgStyleAttrs {
70
+ type: "polygon";
71
+ points: string;
72
+ }
73
+ interface SvgText extends SvgStyleAttrs {
74
+ type: "text";
75
+ x: number;
76
+ y: number;
77
+ content: string;
78
+ fontSize?: number | null;
79
+ fontFamily?: string | null;
80
+ fontWeight?: string | null;
81
+ fontStyle?: string | null;
82
+ textAnchor?: "start" | "middle" | "end" | null;
83
+ dominantBaseline?: string | null;
84
+ }
85
+ interface SvgGroup {
86
+ type: "g";
87
+ children: SvgItem[];
88
+ transform?: SvgTransform | null;
89
+ opacity?: number | null;
90
+ mask?: string | null;
91
+ clipPath?: string | null;
92
+ fill?: string | null;
93
+ stroke?: string | null;
94
+ }
95
+ interface SvgDefs {
96
+ type: "defs";
97
+ children: SvgItem[];
98
+ }
99
+ interface SvgUse {
100
+ type: "use";
101
+ href: string;
102
+ x?: number | null;
103
+ y?: number | null;
104
+ width?: number | null;
105
+ height?: number | null;
106
+ }
107
+ type SvgTransformOp = {
108
+ kind: "translate";
109
+ tx: number;
110
+ ty: number;
111
+ } | {
112
+ kind: "scale";
113
+ sx: number;
114
+ sy: number;
115
+ } | {
116
+ kind: "rotate";
117
+ angle: number;
118
+ cx: number;
119
+ cy: number;
120
+ } | {
121
+ kind: "skewX";
122
+ angle: number;
123
+ } | {
124
+ kind: "skewY";
125
+ angle: number;
126
+ } | {
127
+ kind: "matrix";
128
+ a: number;
129
+ b: number;
130
+ c: number;
131
+ d: number;
132
+ e: number;
133
+ f: number;
134
+ };
135
+ interface SvgTransform {
136
+ ops: SvgTransformOp[];
137
+ }
138
+ type SvgItem = SvgPath | SvgMask | SvgClipPath | SvgCircle | SvgEllipse | SvgRect | SvgLine | SvgPolyline | SvgPolygon | SvgText | SvgGroup | SvgDefs | SvgUse;
139
+
140
+ interface SvgCreateViewOptions extends ViewOptions {
141
+ originalSize?: Size;
142
+ fill?: VarOrVal<string | Color | null>;
143
+ }
144
+ interface Svg {
145
+ size: Size;
146
+ items: SvgItem[];
147
+ fill?: string | null;
148
+ createView(options?: SvgCreateViewOptions): View;
149
+ createDrawableContent(location?: Point, scale?: Point): DrawableContent;
150
+ with(overrides?: {
151
+ size?: Size;
152
+ paths?: SvgPath[];
153
+ fill?: string | null;
154
+ lineWidth?: number | null;
155
+ lineCap?: CanvasLineCap | null;
156
+ lineJoin?: CanvasLineJoin | null;
157
+ }): Svg;
158
+ copy(): Svg;
159
+ toRawSvg(): string;
160
+ }
161
+ declare function parseSvg(str: string): Svg;
162
+
163
+ /**
164
+ * Immutable draw context passed through the render tree.
165
+ * Built once per Svg instance (not per frame) and reused.
166
+ */
167
+ interface DrawContext {
168
+ readonly masks: ReadonlyMap<string, SvgMask>;
169
+ readonly clipPaths: ReadonlyMap<string, SvgClipPath>;
170
+ readonly defs: ReadonlyMap<string, SvgItem>;
171
+ readonly globalFill: string | null;
172
+ readonly customFill: string | Color | null;
173
+ readonly defaultLineWidth: number;
174
+ readonly defaultLineCap: CanvasLineCap;
175
+ readonly defaultLineJoin: CanvasLineJoin;
176
+ }
177
+ /**
178
+ * Build a DrawContext from an item list.
179
+ * This should be called once per Svg instance, not per frame.
180
+ */
181
+ declare function buildDrawContext(items: SvgItem[], globalFill: string | null, defaultLineWidth: number, defaultLineCap: CanvasLineCap, defaultLineJoin: CanvasLineJoin): DrawContext;
182
+
183
+ declare function drawItems(ctx: CanvasRenderingContext2D, items: SvgItem[], dc: DrawContext): void;
184
+ declare function drawItem(ctx: CanvasRenderingContext2D, item: SvgItem, dc: DrawContext): void;
185
+
186
+ declare function parseXml(str: string): Element;
187
+
188
+ declare function escapeXml(s: string): string;
189
+ declare function itemToRawSvg(item: SvgItem): string;
190
+
191
+ interface SvgContainerParams {
192
+ size?: number;
193
+ x?: number;
194
+ y?: number;
195
+ color?: string;
196
+ }
197
+ interface SvgContainerDefaultData {
198
+ lineWidth?: number;
199
+ lineCap?: CanvasLineCap;
200
+ lineJoin?: CanvasLineJoin;
201
+ size: number;
202
+ }
203
+ declare class SvgContainerView extends View {
204
+ private readonly _defaultData;
205
+ private readonly _renderer;
206
+ private readonly _svgScale;
207
+ private readonly _color;
208
+ constructor(defaultData: SvgContainerDefaultData, renderer: (context: CanvasRenderingContext2D) => void, params?: SvgContainerParams);
209
+ protected doGetDrawBounds(measuredBox: ViewBox): RectBounds;
210
+ protected doDraw(context: CanvasRenderingContext2D, _state: DrawState): void;
211
+ }
212
+
213
+ export { type Svg, type SvgCircle, type SvgClipPath, type SvgContainerDefaultData, type SvgContainerParams, SvgContainerView, type SvgCreateViewOptions, type SvgDefs, type DrawContext as SvgDrawContext, type SvgEllipse, type SvgGroup, type SvgItem, type SvgLine, type SvgMask, type SvgPath, type SvgPolygon, type SvgPolyline, type SvgRect, type SvgStyleAttrs, type SvgText, type SvgTransform, type SvgTransformOp, type SvgUse, buildDrawContext, drawItem, drawItems, escapeXml, itemToRawSvg, parseSvg, parseXml };