abstract-image 11.2.13 → 11.2.17
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/lib/dynamic-image/components.d.ts +2 -0
- package/lib/dynamic-image/components.d.ts.map +1 -0
- package/lib/dynamic-image/components.js +88 -0
- package/lib/dynamic-image/components.js.map +1 -0
- package/lib/dynamic-image/dynamic-image.d.ts +2 -12
- package/lib/dynamic-image/dynamic-image.d.ts.map +1 -1
- package/lib/dynamic-image/dynamic-image.js +17 -172
- package/lib/dynamic-image/dynamic-image.js.map +1 -1
- package/lib/dynamic-image/index.d.ts +1 -0
- package/lib/dynamic-image/index.d.ts.map +1 -1
- package/lib/dynamic-image/index.js +3 -0
- package/lib/dynamic-image/index.js.map +1 -1
- package/lib/dynamic-image/schema.d.ts +236 -0
- package/lib/dynamic-image/schema.d.ts.map +1 -0
- package/lib/dynamic-image/schema.js +239 -0
- package/lib/dynamic-image/schema.js.map +1 -0
- package/lib/dynamic-image/utils.d.ts +2 -0
- package/lib/dynamic-image/utils.d.ts.map +1 -0
- package/lib/dynamic-image/utils.js +56 -0
- package/lib/dynamic-image/utils.js.map +1 -0
- package/package.json +5 -3
- package/src/dynamic-image/components.ts +163 -0
- package/src/dynamic-image/dynamic-image.ts +25 -201
- package/src/dynamic-image/index.ts +1 -0
- package/src/dynamic-image/schema.ts +245 -0
- package/src/dynamic-image/utils.ts +62 -0
- package/lib/dynamic-image/dynamic-image-xsd.d.ts +0 -2
- package/lib/dynamic-image/dynamic-image-xsd.d.ts.map +0 -1
- package/lib/dynamic-image/dynamic-image-xsd.js +0 -188
- package/lib/dynamic-image/dynamic-image-xsd.js.map +0 -1
- package/src/dynamic-image/dynamic-image-xsd.ts +0 -184
- package/src/dynamic-image/dynamic-image-xsd.xml +0 -183
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/dynamic-image/components.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,gBAAgB,GAAI,kBAAkB,KAAK,CAAC,MAAM,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CA4GvG,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createComponents = void 0;
|
|
4
|
+
const model_1 = require("../model");
|
|
5
|
+
const createComponents = (mutableImageUrls) => ({
|
|
6
|
+
AbstractImage: (props) => ({
|
|
7
|
+
topLeft: { x: 0, y: 0 },
|
|
8
|
+
size: { width: props.width ?? 800, height: props.height ?? 600 },
|
|
9
|
+
backgroundColor: model_1.transparent,
|
|
10
|
+
components: (props.children ?? []).flat().filter(Boolean),
|
|
11
|
+
}),
|
|
12
|
+
Group: (props) => {
|
|
13
|
+
return (0, model_1.createGroup)("", (props.children ?? []).flat().filter(Boolean));
|
|
14
|
+
},
|
|
15
|
+
Image: (props) => {
|
|
16
|
+
mutableImageUrls.push(props.src);
|
|
17
|
+
const x = props.x ?? 0;
|
|
18
|
+
const y = props.y ?? 0;
|
|
19
|
+
const width = props.width ?? 100;
|
|
20
|
+
const height = props.height ?? 100;
|
|
21
|
+
return (0, model_1.createBinaryImage)({ x, y }, { x: x + width, y: y + height }, "png", { type: "url", url: props.src }, undefined);
|
|
22
|
+
},
|
|
23
|
+
Rectangle: (props) => {
|
|
24
|
+
const x = props.x ?? 0;
|
|
25
|
+
const y = props.y ?? 0;
|
|
26
|
+
const width = props.width ?? 100;
|
|
27
|
+
const height = props.height ?? 100;
|
|
28
|
+
return (0, model_1.createRectangle)({ x, y }, { x: x + width, y: y + height }, (0, model_1.fromString2)(props.stroke ?? "#000", model_1.black), props.strokeWidth ?? 1, (0, model_1.fromString2)(props.fill ?? "#fff", model_1.white), undefined, model_1.solidLine, props.radius ? { x: props.radius, y: props.radius } : undefined);
|
|
29
|
+
},
|
|
30
|
+
Ellipse: (props) => {
|
|
31
|
+
const x = props.x ?? 0;
|
|
32
|
+
const y = props.y ?? 0;
|
|
33
|
+
const width = props.width ?? 100;
|
|
34
|
+
const height = props.height ?? 100;
|
|
35
|
+
return (0, model_1.createEllipse)({ x, y }, { x: x + width, y: y + height }, (0, model_1.fromString2)(props.stroke ?? "#000", model_1.black), props.strokeWidth ?? 1, (0, model_1.fromString2)(props.fill ?? "#fff", model_1.white), undefined, model_1.solidLine);
|
|
36
|
+
},
|
|
37
|
+
Line: (props) => {
|
|
38
|
+
return (0, model_1.createLine)({ x: props.x1 ?? 0, y: props.y1 ?? 0 }, { x: props.x2 ?? 100, y: props.y2 ?? 0 }, (0, model_1.fromString2)(props.stroke ?? "#000", model_1.black), props.strokeWidth ?? 1, undefined, model_1.solidLine);
|
|
39
|
+
},
|
|
40
|
+
Polyline: (props) => {
|
|
41
|
+
return (0, model_1.createPolyLine)(parsePointsString(props.points), (0, model_1.fromString2)(props.stroke ?? "#000", model_1.black), props.strokeWidth ?? 1, undefined, model_1.solidLine);
|
|
42
|
+
},
|
|
43
|
+
Polygon: (props) => {
|
|
44
|
+
return (0, model_1.createPolygon)(parsePointsString(props.points), (0, model_1.fromString2)(props.stroke ?? "#000", model_1.black), props.strokeWidth ?? 1, (0, model_1.fromString2)(props.fill ?? "#fff", model_1.white), undefined, model_1.solidLine);
|
|
45
|
+
},
|
|
46
|
+
Text: (props) => {
|
|
47
|
+
const fontWeight = mapFontWeight(props.fontWeight);
|
|
48
|
+
const children = props.children ?? [];
|
|
49
|
+
const filteredChildren = Array.isArray(children)
|
|
50
|
+
? children.flat().filter((c) => c !== null && c !== undefined)
|
|
51
|
+
: [];
|
|
52
|
+
const text = filteredChildren.length > 0 ? String(filteredChildren[0]) : "";
|
|
53
|
+
return (0, model_1.createText)({ x: props.x ?? 0, y: props.y ?? 0 }, text, props.fontFamily ?? "", props.fontSize ?? 12, (0, model_1.fromString2)(props.fill ?? "#000", model_1.black), fontWeight, 0, // clockwiseRotationDegrees
|
|
54
|
+
"left", // textAlignment
|
|
55
|
+
"right", // horizontalGrowthDirection
|
|
56
|
+
"down", // verticalGrowthDirection
|
|
57
|
+
0, // strokeThickness
|
|
58
|
+
model_1.transparent, // strokeColor
|
|
59
|
+
false, // italic
|
|
60
|
+
undefined // id
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
exports.createComponents = createComponents;
|
|
65
|
+
function mapFontWeight(weight) {
|
|
66
|
+
if (weight === undefined) {
|
|
67
|
+
return "normal";
|
|
68
|
+
}
|
|
69
|
+
if (typeof weight === "string") {
|
|
70
|
+
switch (weight.toLowerCase()) {
|
|
71
|
+
case "bold":
|
|
72
|
+
case "bolder":
|
|
73
|
+
return "bold";
|
|
74
|
+
case "lighter":
|
|
75
|
+
case "normal":
|
|
76
|
+
default:
|
|
77
|
+
return "normal";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return weight >= 600 ? "bold" : "normal";
|
|
81
|
+
}
|
|
82
|
+
function parsePointsString(pointsString) {
|
|
83
|
+
return pointsString.split(" ").map((tuple) => {
|
|
84
|
+
const [xString, yString] = tuple.split(",");
|
|
85
|
+
return { x: Number(xString ?? 0), y: Number(yString ?? 0) };
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/dynamic-image/components.ts"],"names":[],"mappings":";;;AAAA,oCAyBkB;AAEX,MAAM,gBAAgB,GAAG,CAAC,gBAA+B,EAA2C,EAAE,CAAC,CAAC;IAC7G,aAAa,EAAE,CAAC,KAAK,EAAiB,EAAE,CAAC,CAAC;QACxC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QACvB,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,GAAG,EAAE,MAAM,EAAE,K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C;YAChB,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ,CAAC;YACd;gBACE,OAAO,QAAQ,CAAC;QACpB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC3C,CAAC;AAED,SAAS,iBAAiB,CAAC,YAAoB;IAC7C,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAS,EAAE;QAClD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AbstractImage } from "../model/abstract-image.js";
|
|
2
|
-
import { XmlElement } from "handlebars-xml";
|
|
3
2
|
export type DynamicImageResult = {
|
|
4
3
|
readonly type: "Ok";
|
|
5
4
|
readonly image: AbstractImage;
|
|
@@ -9,18 +8,9 @@ export type DynamicImageResult = {
|
|
|
9
8
|
readonly error: DynamicImageError;
|
|
10
9
|
};
|
|
11
10
|
export type DynamicImageError = {
|
|
12
|
-
type: "
|
|
13
|
-
message: string;
|
|
14
|
-
cause?: unknown;
|
|
15
|
-
} | {
|
|
16
|
-
type: "XML_PARSE_ERROR";
|
|
17
|
-
message: string;
|
|
18
|
-
cause?: unknown;
|
|
19
|
-
} | {
|
|
20
|
-
type: "UNKNOWN_ERROR";
|
|
11
|
+
type: "RENDER_ERROR";
|
|
21
12
|
message: string;
|
|
22
13
|
cause?: unknown;
|
|
23
14
|
};
|
|
24
|
-
export declare function dynamicImage(
|
|
25
|
-
export declare const parsedXsd: readonly XmlElement[];
|
|
15
|
+
export declare function dynamicImage(source: string, data: Record<string, unknown>): DynamicImageResult;
|
|
26
16
|
//# sourceMappingURL=dynamic-image.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-image.d.ts","sourceRoot":"","sources":["../../src/dynamic-image/dynamic-image.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-image.d.ts","sourceRoot":"","sources":["../../src/dynamic-image/dynamic-image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAM3D,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,GACjG;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB,CAyB9F"}
|
|
@@ -1,187 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parsedXsd = void 0;
|
|
4
3
|
exports.dynamicImage = dynamicImage;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
4
|
+
const jsxpression_1 = require("jsxpression");
|
|
5
|
+
const utils_js_1 = require("./utils.js");
|
|
6
|
+
const components_js_1 = require("./components.js");
|
|
7
|
+
const schema_js_1 = require("./schema.js");
|
|
8
|
+
function dynamicImage(source, data) {
|
|
9
9
|
try {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type: "XML_PARSE_ERROR",
|
|
21
|
-
message: errorMessage(error),
|
|
22
|
-
cause: error,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
}
|
|
10
|
+
const imageUrls = Array();
|
|
11
|
+
const schema = {
|
|
12
|
+
...schema_js_1.baseSchema,
|
|
13
|
+
data: (0, utils_js_1.generateDataSchema)(data),
|
|
14
|
+
};
|
|
15
|
+
const image = (0, jsxpression_1.render)(source, schema, {
|
|
16
|
+
data,
|
|
17
|
+
components: (0, components_js_1.createComponents)(imageUrls),
|
|
18
|
+
});
|
|
19
|
+
return { type: "Ok", image, imageUrls };
|
|
26
20
|
}
|
|
27
21
|
catch (error) {
|
|
28
22
|
return {
|
|
29
23
|
type: "Err",
|
|
30
24
|
error: {
|
|
31
|
-
type: "
|
|
32
|
-
message:
|
|
25
|
+
type: "RENDER_ERROR",
|
|
26
|
+
message: error instanceof Error ? error.message : String(error),
|
|
33
27
|
cause: error,
|
|
34
28
|
},
|
|
35
29
|
};
|
|
36
30
|
}
|
|
37
31
|
}
|
|
38
|
-
function errorMessage(error) {
|
|
39
|
-
return error instanceof Error ? error.message : String(error);
|
|
40
|
-
}
|
|
41
|
-
function dynamicImageRecursive(el, mutableImageUrls) {
|
|
42
|
-
const children = Array();
|
|
43
|
-
for (const child of el.children ?? []) {
|
|
44
|
-
if (child.tagName !== undefined) {
|
|
45
|
-
children.push(dynamicImageRecursive(child, mutableImageUrls));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
switch (el.tagName) {
|
|
49
|
-
case "AbstractImage":
|
|
50
|
-
const size = parsePoint(el.attributes.size);
|
|
51
|
-
return {
|
|
52
|
-
topLeft: parsePoint(el.attributes.topLeft),
|
|
53
|
-
size: { width: size.x, height: size.y },
|
|
54
|
-
backgroundColor: (0, color_js_1.fromString2)(el.attributes.backgroundColor ?? "", color_js_1.transparent),
|
|
55
|
-
components: children,
|
|
56
|
-
};
|
|
57
|
-
case "Group":
|
|
58
|
-
return {
|
|
59
|
-
type: "group",
|
|
60
|
-
name: el.attributes.name ?? "",
|
|
61
|
-
children: children,
|
|
62
|
-
};
|
|
63
|
-
case "Image":
|
|
64
|
-
if (typeof el.attributes.url === "string") {
|
|
65
|
-
mutableImageUrls.push(el.attributes.url);
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
type: "binaryimage",
|
|
69
|
-
topLeft: parsePoint(el.attributes.topLeft),
|
|
70
|
-
bottomRight: parsePoint(el.attributes.bottomRight),
|
|
71
|
-
data: { type: "url", url: el.attributes.url },
|
|
72
|
-
id: el.attributes.id,
|
|
73
|
-
format: "png",
|
|
74
|
-
};
|
|
75
|
-
case "Ellipse":
|
|
76
|
-
return {
|
|
77
|
-
type: "ellipse",
|
|
78
|
-
topLeft: parsePoint(el.attributes.topLeft),
|
|
79
|
-
bottomRight: parsePoint(el.attributes.bottomRight),
|
|
80
|
-
fillColor: (0, color_js_1.fromString2)(el.attributes.fillColor ?? "", color_js_1.white),
|
|
81
|
-
strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
|
|
82
|
-
id: el.attributes.id,
|
|
83
|
-
strokeDashStyle: {
|
|
84
|
-
dashes: parseNumberArrayString(el.attributes.strokeDashArray),
|
|
85
|
-
offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
|
|
86
|
-
},
|
|
87
|
-
strokeThickness: Number(el.attributes.strokeThickness ?? 1),
|
|
88
|
-
};
|
|
89
|
-
case "Line":
|
|
90
|
-
return {
|
|
91
|
-
type: "line",
|
|
92
|
-
start: parsePoint(el.attributes.start),
|
|
93
|
-
end: parsePoint(el.attributes.end),
|
|
94
|
-
strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
|
|
95
|
-
id: el.attributes.id,
|
|
96
|
-
strokeDashStyle: {
|
|
97
|
-
dashes: parseNumberArrayString(el.attributes.strokeDashArray),
|
|
98
|
-
offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
|
|
99
|
-
},
|
|
100
|
-
strokeThickness: Number(el.attributes.strokeThickness ?? 1),
|
|
101
|
-
};
|
|
102
|
-
case "PolyLine":
|
|
103
|
-
return {
|
|
104
|
-
type: "polyline",
|
|
105
|
-
points: parsePointsString(el.attributes.points),
|
|
106
|
-
strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
|
|
107
|
-
id: el.attributes.id,
|
|
108
|
-
strokeDashStyle: {
|
|
109
|
-
dashes: parseNumberArrayString(el.attributes.strokeDashArray),
|
|
110
|
-
offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
|
|
111
|
-
},
|
|
112
|
-
strokeThickness: Number(el.attributes.strokeThickness ?? 1),
|
|
113
|
-
};
|
|
114
|
-
case "Polygon":
|
|
115
|
-
return {
|
|
116
|
-
type: "polygon",
|
|
117
|
-
points: parsePointsString(el.attributes.points),
|
|
118
|
-
fillColor: (0, color_js_1.fromString2)(el.attributes.fillColor ?? "", color_js_1.white),
|
|
119
|
-
strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
|
|
120
|
-
id: el.attributes.id,
|
|
121
|
-
strokeDashStyle: {
|
|
122
|
-
dashes: parseNumberArrayString(el.attributes.strokeDashArray),
|
|
123
|
-
offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
|
|
124
|
-
},
|
|
125
|
-
strokeThickness: Number(el.attributes.strokeThickness ?? 1),
|
|
126
|
-
};
|
|
127
|
-
case "Rectangle":
|
|
128
|
-
return {
|
|
129
|
-
type: "rectangle",
|
|
130
|
-
topLeft: parsePoint(el.attributes.topLeft),
|
|
131
|
-
bottomRight: parsePoint(el.attributes.bottomRight),
|
|
132
|
-
fillColor: (0, color_js_1.fromString2)(el.attributes.fillColor ?? "", color_js_1.white),
|
|
133
|
-
radius: el.attributes.radius ? parsePoint(el.attributes.radius) : undefined,
|
|
134
|
-
strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
|
|
135
|
-
id: el.attributes.id,
|
|
136
|
-
strokeDashStyle: {
|
|
137
|
-
dashes: parseNumberArrayString(el.attributes.strokeDashArray),
|
|
138
|
-
offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
|
|
139
|
-
},
|
|
140
|
-
strokeThickness: Number(el.attributes.strokeThickness ?? 1),
|
|
141
|
-
};
|
|
142
|
-
case "Text":
|
|
143
|
-
return {
|
|
144
|
-
type: "text",
|
|
145
|
-
position: parsePoint(el.attributes.position),
|
|
146
|
-
clockwiseRotationDegrees: el.attributes.clockwiseRotationDegrees
|
|
147
|
-
? Number(el.attributes.clockwiseRotationDegrees)
|
|
148
|
-
: 0,
|
|
149
|
-
textColor: (0, color_js_1.fromString2)(el.attributes.textColor ?? "", color_js_1.black),
|
|
150
|
-
strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.transparent),
|
|
151
|
-
text: el.attributes.text?.toString() ?? "",
|
|
152
|
-
id: el.attributes.id,
|
|
153
|
-
fontFamily: el.attributes.fontFamily ?? "",
|
|
154
|
-
fontSize: el.attributes.fontSize ? Number(el.attributes.fontSize ?? 1) : 12,
|
|
155
|
-
strokeThickness: el.attributes.strokeThickness ? Number(el.attributes.strokeThickness) : 2,
|
|
156
|
-
textAlignment: el.attributes.textAlignment ?? "center",
|
|
157
|
-
verticalGrowthDirection: el.attributes.verticalGrowthDirection ?? "down",
|
|
158
|
-
fontWeight: el.attributes.fontWeight ?? "normal",
|
|
159
|
-
horizontalGrowthDirection: el.attributes.horizontalGrowthDirection ?? "right",
|
|
160
|
-
italic: Boolean(el.attributes.italic ?? false),
|
|
161
|
-
};
|
|
162
|
-
default:
|
|
163
|
-
throw new Error(`Could not find creator for element with name ${el.tagName}`);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
exports.parsedXsd = (0, handlebars_xml_1.parseXsd)(dynamic_image_xsd_js_1.xsd);
|
|
167
|
-
function parsePoint(pointString) {
|
|
168
|
-
const [xString, yString] = (typeof pointString === "number" ? pointString.toString() : pointString)?.split(" ") ?? [
|
|
169
|
-
0, 0,
|
|
170
|
-
];
|
|
171
|
-
const [x, y] = [Number(xString ?? 0), Number(yString ?? 0)];
|
|
172
|
-
return { x: Number.isFinite(x) ? x : 0, y: Number.isFinite(y) ? y : 0 };
|
|
173
|
-
}
|
|
174
|
-
function parsePointsString(numberArrayString) {
|
|
175
|
-
return ((typeof numberArrayString === "number" ? numberArrayString.toString() : numberArrayString)
|
|
176
|
-
?.split(" ")
|
|
177
|
-
.map((tuple) => {
|
|
178
|
-
const [xString, yString] = tuple.split(",");
|
|
179
|
-
return { x: Number(xString ?? 0), y: Number(yString ?? 0) };
|
|
180
|
-
}) ?? []);
|
|
181
|
-
}
|
|
182
|
-
function parseNumberArrayString(numberArrayString) {
|
|
183
|
-
return ((typeof numberArrayString === "number" ? numberArrayString.toString() : numberArrayString)
|
|
184
|
-
?.split(",")
|
|
185
|
-
.map(Number) ?? []);
|
|
186
|
-
}
|
|
187
32
|
//# sourceMappingURL=dynamic-image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-image.js","sourceRoot":"","sources":["../../src/dynamic-image/dynamic-image.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-image.js","sourceRoot":"","sources":["../../src/dynamic-image/dynamic-image.ts"],"names":[],"mappings":";;AAiBA,oCAyBC;AA1CD,6CAA6C;AAG7C,yCAAgD;AAChD,mDAAmD;AACnD,2CAAyC;AAYzC,SAAgB,YAAY,CAAC,MAAc,EAAE,IAA6B;IACxE,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,KAAK,EAAU,CAAC;QAElC,MAAM,MAAM,GAAW;YACrB,GAAG,sBAAU;YACb,IAAI,EAAE,IAAA,6BAAkB,EAAC,IAAI,CAAC;SAC/B,CAAC;QAEF,MAAM,KAAK,GAAG,IAAA,oBAAM,EAAgB,MAAM,EAAE,MAAM,EAAE;YAClD,IAAI;YACJ,UAAU,EAAE,IAAA,gCAAgB,EAAC,SAAS,CAAC;SACxC,CAAC,CAAC;QAEH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,IAAI,EAAE,KAAK;YACX,KAAK,EAAE;gBACL,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC/D,KAAK,EAAE,KAAK;aACb;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dynamic-image/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dynamic-image/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,UAAU,IAAI,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -14,5 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.dynamicImageBaseSchema = void 0;
|
|
17
18
|
__exportStar(require("./dynamic-image.js"), exports);
|
|
19
|
+
var schema_js_1 = require("./schema.js");
|
|
20
|
+
Object.defineProperty(exports, "dynamicImageBaseSchema", { enumerable: true, get: function () { return schema_js_1.baseSchema; } });
|
|
18
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dynamic-image/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dynamic-image/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,yCAAmE;AAA1D,mHAAA,UAAU,OAA0B"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
export declare const baseSchema: {
|
|
2
|
+
readonly elements: {
|
|
3
|
+
readonly AbstractImage: {
|
|
4
|
+
readonly description: "Root container — defines the image canvas and its coordinate system.";
|
|
5
|
+
readonly props: {
|
|
6
|
+
readonly width: {
|
|
7
|
+
readonly type: "number";
|
|
8
|
+
readonly required: true;
|
|
9
|
+
readonly description: "Total width of the image canvas (in px).";
|
|
10
|
+
};
|
|
11
|
+
readonly height: {
|
|
12
|
+
readonly type: "number";
|
|
13
|
+
readonly required: true;
|
|
14
|
+
readonly description: "Total height of the image canvas (in px).";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
readonly allowedChildren: ["Image", "Text", "Rectangle", "Ellipse", "Line", "Polyline", "Polygon", "Group"];
|
|
18
|
+
};
|
|
19
|
+
readonly Group: {
|
|
20
|
+
readonly description: "Groups elements together.";
|
|
21
|
+
readonly props: {};
|
|
22
|
+
readonly allowedChildren: ["Image", "Text", "Rectangle", "Ellipse", "Line", "Polyline", "Polygon", "Group"];
|
|
23
|
+
};
|
|
24
|
+
readonly Image: {
|
|
25
|
+
readonly description: "Displays a raster image.";
|
|
26
|
+
readonly props: {
|
|
27
|
+
readonly src: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly required: true;
|
|
30
|
+
readonly description: "Source of the image (URL or asset ID).";
|
|
31
|
+
};
|
|
32
|
+
readonly x: {
|
|
33
|
+
readonly type: "number";
|
|
34
|
+
readonly description: "X position in pixels.";
|
|
35
|
+
};
|
|
36
|
+
readonly y: {
|
|
37
|
+
readonly type: "number";
|
|
38
|
+
readonly description: "Y position in pixels.";
|
|
39
|
+
};
|
|
40
|
+
readonly width: {
|
|
41
|
+
readonly type: "number";
|
|
42
|
+
readonly description: "Display width in pixels.";
|
|
43
|
+
};
|
|
44
|
+
readonly height: {
|
|
45
|
+
readonly type: "number";
|
|
46
|
+
readonly description: "Display height in pixels.";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly allowedChildren: [];
|
|
50
|
+
};
|
|
51
|
+
readonly Ellipse: {
|
|
52
|
+
readonly description: "Draws an ellipse using x, y, width, and height.";
|
|
53
|
+
readonly props: {
|
|
54
|
+
readonly x: {
|
|
55
|
+
readonly type: "number";
|
|
56
|
+
readonly description: "X coordinate of the top-left of the ellipse box.";
|
|
57
|
+
};
|
|
58
|
+
readonly y: {
|
|
59
|
+
readonly type: "number";
|
|
60
|
+
readonly description: "Y coordinate of the top-left of the ellipse box.";
|
|
61
|
+
};
|
|
62
|
+
readonly width: {
|
|
63
|
+
readonly type: "number";
|
|
64
|
+
readonly description: "Box width.";
|
|
65
|
+
};
|
|
66
|
+
readonly height: {
|
|
67
|
+
readonly type: "number";
|
|
68
|
+
readonly description: "Box height.";
|
|
69
|
+
};
|
|
70
|
+
readonly stroke: {
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
readonly format: "color";
|
|
73
|
+
readonly description: "Stroke color (CSS color string).";
|
|
74
|
+
};
|
|
75
|
+
readonly strokeWidth: {
|
|
76
|
+
readonly type: "number";
|
|
77
|
+
readonly description: "Stroke width in pixels.";
|
|
78
|
+
};
|
|
79
|
+
readonly fill: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly format: "color";
|
|
82
|
+
readonly description: "Fill color (inside the ellipse).";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
readonly allowedChildren: [];
|
|
86
|
+
};
|
|
87
|
+
readonly Line: {
|
|
88
|
+
readonly description: "Draws a straight line between two points.";
|
|
89
|
+
readonly props: {
|
|
90
|
+
readonly x1: {
|
|
91
|
+
readonly type: "number";
|
|
92
|
+
readonly description: "X coordinate of the start point.";
|
|
93
|
+
};
|
|
94
|
+
readonly y1: {
|
|
95
|
+
readonly type: "number";
|
|
96
|
+
readonly description: "Y coordinate of the start point.";
|
|
97
|
+
};
|
|
98
|
+
readonly x2: {
|
|
99
|
+
readonly type: "number";
|
|
100
|
+
readonly description: "X coordinate of the end point.";
|
|
101
|
+
};
|
|
102
|
+
readonly y2: {
|
|
103
|
+
readonly type: "number";
|
|
104
|
+
readonly description: "Y coordinate of the end point.";
|
|
105
|
+
};
|
|
106
|
+
readonly stroke: {
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
readonly format: "color";
|
|
109
|
+
readonly description: "Stroke color of the line.";
|
|
110
|
+
};
|
|
111
|
+
readonly strokeWidth: {
|
|
112
|
+
readonly type: "number";
|
|
113
|
+
readonly description: "Width of the stroke in px.";
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
readonly allowedChildren: [];
|
|
117
|
+
};
|
|
118
|
+
readonly Polyline: {
|
|
119
|
+
readonly description: "A connected set of line segments (open shape).";
|
|
120
|
+
readonly props: {
|
|
121
|
+
readonly points: {
|
|
122
|
+
readonly type: "string";
|
|
123
|
+
readonly required: true;
|
|
124
|
+
readonly description: "List of points: 'x0,y0 x1,y1 x2,y2'.";
|
|
125
|
+
};
|
|
126
|
+
readonly stroke: {
|
|
127
|
+
readonly type: "string";
|
|
128
|
+
readonly format: "color";
|
|
129
|
+
readonly description: "Stroke color.";
|
|
130
|
+
};
|
|
131
|
+
readonly strokeWidth: {
|
|
132
|
+
readonly type: "number";
|
|
133
|
+
readonly description: "Stroke width in px.";
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
readonly allowedChildren: [];
|
|
137
|
+
};
|
|
138
|
+
readonly Polygon: {
|
|
139
|
+
readonly description: "A closed polygon shape.";
|
|
140
|
+
readonly props: {
|
|
141
|
+
readonly points: {
|
|
142
|
+
readonly type: "string";
|
|
143
|
+
readonly required: true;
|
|
144
|
+
readonly description: "List of vertex points: 'x0,y0 x1,y1 ...'.";
|
|
145
|
+
};
|
|
146
|
+
readonly stroke: {
|
|
147
|
+
readonly type: "string";
|
|
148
|
+
readonly format: "color";
|
|
149
|
+
readonly description: "Stroke color.";
|
|
150
|
+
};
|
|
151
|
+
readonly strokeWidth: {
|
|
152
|
+
readonly type: "number";
|
|
153
|
+
readonly description: "Stroke width in px.";
|
|
154
|
+
};
|
|
155
|
+
readonly fill: {
|
|
156
|
+
readonly type: "string";
|
|
157
|
+
readonly format: "color";
|
|
158
|
+
readonly description: "Fill color of the polygon.";
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
readonly allowedChildren: [];
|
|
162
|
+
};
|
|
163
|
+
readonly Rectangle: {
|
|
164
|
+
readonly description: "Draws a rectangle, optionally with rounded corners.";
|
|
165
|
+
readonly props: {
|
|
166
|
+
readonly x: {
|
|
167
|
+
readonly type: "number";
|
|
168
|
+
readonly description: "X position of the rectangle (top-left).";
|
|
169
|
+
};
|
|
170
|
+
readonly y: {
|
|
171
|
+
readonly type: "number";
|
|
172
|
+
readonly description: "Y position of the rectangle (top-left).";
|
|
173
|
+
};
|
|
174
|
+
readonly width: {
|
|
175
|
+
readonly type: "number";
|
|
176
|
+
readonly description: "Rectangle width in px.";
|
|
177
|
+
};
|
|
178
|
+
readonly height: {
|
|
179
|
+
readonly type: "number";
|
|
180
|
+
readonly description: "Rectangle height in px.";
|
|
181
|
+
};
|
|
182
|
+
readonly stroke: {
|
|
183
|
+
readonly type: "string";
|
|
184
|
+
readonly format: "color";
|
|
185
|
+
readonly description: "Stroke color.";
|
|
186
|
+
};
|
|
187
|
+
readonly strokeWidth: {
|
|
188
|
+
readonly type: "number";
|
|
189
|
+
readonly description: "Stroke width in px.";
|
|
190
|
+
};
|
|
191
|
+
readonly fill: {
|
|
192
|
+
readonly type: "string";
|
|
193
|
+
readonly format: "color";
|
|
194
|
+
readonly description: "Fill color of the rectangle.";
|
|
195
|
+
};
|
|
196
|
+
readonly radius: {
|
|
197
|
+
readonly type: "number";
|
|
198
|
+
readonly description: "Corner radius in px (uniform).";
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
readonly allowedChildren: [];
|
|
202
|
+
};
|
|
203
|
+
readonly Text: {
|
|
204
|
+
readonly description: "Renders a text element.";
|
|
205
|
+
readonly props: {
|
|
206
|
+
readonly x: {
|
|
207
|
+
readonly type: "number";
|
|
208
|
+
readonly description: "X position of the text anchor.";
|
|
209
|
+
};
|
|
210
|
+
readonly y: {
|
|
211
|
+
readonly type: "number";
|
|
212
|
+
readonly description: "Y position of the text baseline.";
|
|
213
|
+
};
|
|
214
|
+
readonly fontFamily: {
|
|
215
|
+
readonly type: "string";
|
|
216
|
+
readonly description: "Font family, e.g. 'Inter, system-ui'.";
|
|
217
|
+
};
|
|
218
|
+
readonly fontSize: {
|
|
219
|
+
readonly type: "number";
|
|
220
|
+
readonly description: "Font size in pixels.";
|
|
221
|
+
};
|
|
222
|
+
readonly fontWeight: {
|
|
223
|
+
readonly type: "string";
|
|
224
|
+
readonly description: "Font weight, e.g. 'bold', '700'.";
|
|
225
|
+
};
|
|
226
|
+
readonly fill: {
|
|
227
|
+
readonly type: "string";
|
|
228
|
+
readonly format: "color";
|
|
229
|
+
readonly description: "Fill color (text color).";
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
readonly allowedChildren: [];
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/dynamic-image/schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkPI,CAAC"}
|