abstract-image 11.2.13 → 11.2.14

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.
Files changed (43) hide show
  1. package/lib/abstract-image-xml/abstract-image-xml.d.ts +29 -0
  2. package/lib/abstract-image-xml/abstract-image-xml.d.ts.map +1 -0
  3. package/lib/abstract-image-xml/abstract-image-xml.js +186 -0
  4. package/lib/abstract-image-xml/abstract-image-xml.js.map +1 -0
  5. package/lib/abstract-image-xml/abstract-image-xsd.d.ts +2 -0
  6. package/lib/abstract-image-xml/abstract-image-xsd.d.ts.map +1 -0
  7. package/{src/dynamic-image/dynamic-image-xsd.ts → lib/abstract-image-xml/abstract-image-xsd.js} +5 -1
  8. package/lib/abstract-image-xml/abstract-image-xsd.js.map +1 -0
  9. package/lib/abstract-image-xml/index.d.ts +2 -0
  10. package/lib/abstract-image-xml/index.d.ts.map +1 -0
  11. package/lib/abstract-image-xml/index.js +18 -0
  12. package/lib/abstract-image-xml/index.js.map +1 -0
  13. package/lib/dynamic-image/components.d.ts +2 -0
  14. package/lib/dynamic-image/components.d.ts.map +1 -0
  15. package/lib/dynamic-image/components.js +88 -0
  16. package/lib/dynamic-image/components.js.map +1 -0
  17. package/lib/dynamic-image/dynamic-image.d.ts +2 -12
  18. package/lib/dynamic-image/dynamic-image.d.ts.map +1 -1
  19. package/lib/dynamic-image/dynamic-image.js +17 -172
  20. package/lib/dynamic-image/dynamic-image.js.map +1 -1
  21. package/lib/dynamic-image/index.d.ts +1 -0
  22. package/lib/dynamic-image/index.d.ts.map +1 -1
  23. package/lib/dynamic-image/index.js +3 -0
  24. package/lib/dynamic-image/index.js.map +1 -1
  25. package/lib/dynamic-image/schema.d.ts +236 -0
  26. package/lib/dynamic-image/schema.d.ts.map +1 -0
  27. package/lib/dynamic-image/schema.js +239 -0
  28. package/lib/dynamic-image/schema.js.map +1 -0
  29. package/lib/dynamic-image/utils.d.ts +2 -0
  30. package/lib/dynamic-image/utils.d.ts.map +1 -0
  31. package/lib/dynamic-image/utils.js +56 -0
  32. package/lib/dynamic-image/utils.js.map +1 -0
  33. package/lib/stringify-parse.d.ts +6 -0
  34. package/lib/stringify-parse.d.ts.map +1 -0
  35. package/lib/stringify-parse.js +91 -0
  36. package/lib/stringify-parse.js.map +1 -0
  37. package/package.json +5 -4
  38. package/src/dynamic-image/components.ts +163 -0
  39. package/src/dynamic-image/dynamic-image.ts +25 -201
  40. package/src/dynamic-image/index.ts +1 -0
  41. package/src/dynamic-image/schema.ts +245 -0
  42. package/src/dynamic-image/utils.ts +62 -0
  43. package/src/dynamic-image/dynamic-image-xsd.xml +0 -183
@@ -0,0 +1,29 @@
1
+ import { AbstractImage } from "../model/abstract-image.js";
2
+ import { XmlElement } from "handlebars-xml";
3
+ type Result<TError, TValue> = Ok<TValue> | Err<TError>;
4
+ type Ok<TValue> = {
5
+ readonly type: "Ok";
6
+ readonly value: TValue;
7
+ };
8
+ type Err<TError> = {
9
+ readonly type: "Err";
10
+ readonly error: TError;
11
+ };
12
+ export type AbstractImageXmlError = {
13
+ type: "HANDLEBARS_PARSE_ERROR";
14
+ message: string;
15
+ cause?: unknown;
16
+ } | {
17
+ type: "XML_PARSE_ERROR";
18
+ message: string;
19
+ cause?: unknown;
20
+ } | {
21
+ type: "UNKNOWN_ERROR";
22
+ message: string;
23
+ cause?: unknown;
24
+ };
25
+ export declare function abstractImageXml(template: string, data: unknown): Result<AbstractImageXmlError, AbstractImage>;
26
+ export declare function abstractImageOfXml(el: XmlElement): unknown;
27
+ export declare const parsedXsd: readonly XmlElement[];
28
+ export {};
29
+ //# sourceMappingURL=abstract-image-xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-image-xml.d.ts","sourceRoot":"","sources":["../../src/abstract-image-xml/abstract-image-xml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAgC,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAmB1E,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AACvD,KAAK,EAAE,CAAC,MAAM,IAAI;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAClE,KAAK,GAAG,CAAC,MAAM,IAAI;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAMhE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC,CA2B9G;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CA6H1D;AAED,eAAO,MAAM,SAAS,uBAAgB,CAAC"}
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parsedXsd = void 0;
4
+ exports.abstractImageXml = abstractImageXml;
5
+ exports.abstractImageOfXml = abstractImageOfXml;
6
+ const handlebars_xml_1 = require("handlebars-xml");
7
+ const color_js_1 = require("../model/color.js");
8
+ const abstract_image_xsd_js_1 = require("./abstract-image-xsd.js");
9
+ function errorMessage(error) {
10
+ return error instanceof Error ? error.message : String(error);
11
+ }
12
+ function abstractImageXml(template, data) {
13
+ try {
14
+ const [parsedXml] = (0, handlebars_xml_1.parseHandlebarsXml)(template, data, {});
15
+ try {
16
+ const abstractImage = abstractImageOfXml(parsedXml);
17
+ return { type: "Ok", value: abstractImage };
18
+ }
19
+ catch (error) {
20
+ return {
21
+ type: "Err",
22
+ error: {
23
+ type: "XML_PARSE_ERROR",
24
+ message: errorMessage(error),
25
+ cause: error,
26
+ },
27
+ };
28
+ }
29
+ }
30
+ catch (error) {
31
+ return {
32
+ type: "Err",
33
+ error: {
34
+ type: "HANDLEBARS_PARSE_ERROR",
35
+ message: errorMessage(error),
36
+ cause: error,
37
+ },
38
+ };
39
+ }
40
+ }
41
+ function abstractImageOfXml(el) {
42
+ const children = Array();
43
+ const childElements = Array();
44
+ for (const child of el.children ?? []) {
45
+ if (child.tagName !== undefined) {
46
+ children.push(abstractImageOfXml(child));
47
+ childElements.push(child);
48
+ }
49
+ }
50
+ switch (el.tagName) {
51
+ case "AbstractImage":
52
+ const size = parsePoint(el.attributes.size);
53
+ return {
54
+ topLeft: parsePoint(el.attributes.topLeft),
55
+ size: { width: size.x, height: size.y },
56
+ backgroundColor: (0, color_js_1.fromString2)(el.attributes.backgroundColor ?? "", color_js_1.transparent),
57
+ components: children,
58
+ };
59
+ case "Group":
60
+ return {
61
+ type: "group",
62
+ name: el.attributes.name ?? "",
63
+ children: children,
64
+ };
65
+ case "Image":
66
+ return {
67
+ type: "binaryimage",
68
+ topLeft: parsePoint(el.attributes.topLeft),
69
+ bottomRight: parsePoint(el.attributes.bottomRight),
70
+ data: { type: "url", url: el.attributes.url },
71
+ id: el.attributes.id,
72
+ format: "png",
73
+ };
74
+ case "Ellipse":
75
+ return {
76
+ type: "ellipse",
77
+ topLeft: parsePoint(el.attributes.topLeft),
78
+ bottomRight: parsePoint(el.attributes.bottomRight),
79
+ fillColor: (0, color_js_1.fromString2)(el.attributes.fillColor ?? "", color_js_1.white),
80
+ strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
81
+ id: el.attributes.id,
82
+ strokeDashStyle: {
83
+ dashes: parseNumberArrayString(el.attributes.strokeDashArray),
84
+ offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
85
+ },
86
+ strokeThickness: Number(el.attributes.strokeThickness ?? 1),
87
+ };
88
+ case "Line":
89
+ return {
90
+ type: "line",
91
+ start: parsePoint(el.attributes.start),
92
+ end: parsePoint(el.attributes.end),
93
+ strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
94
+ id: el.attributes.id,
95
+ strokeDashStyle: {
96
+ dashes: parseNumberArrayString(el.attributes.strokeDashArray),
97
+ offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
98
+ },
99
+ strokeThickness: Number(el.attributes.strokeThickness ?? 1),
100
+ };
101
+ case "PolyLine":
102
+ return {
103
+ type: "polyline",
104
+ points: parsePointsString(el.attributes.points),
105
+ strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
106
+ id: el.attributes.id,
107
+ strokeDashStyle: {
108
+ dashes: parseNumberArrayString(el.attributes.strokeDashArray),
109
+ offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
110
+ },
111
+ strokeThickness: Number(el.attributes.strokeThickness ?? 1),
112
+ };
113
+ case "Polygon":
114
+ return {
115
+ type: "polygon",
116
+ points: parsePointsString(el.attributes.points),
117
+ fillColor: (0, color_js_1.fromString2)(el.attributes.fillColor ?? "", color_js_1.white),
118
+ strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
119
+ id: el.attributes.id,
120
+ strokeDashStyle: {
121
+ dashes: parseNumberArrayString(el.attributes.strokeDashArray),
122
+ offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
123
+ },
124
+ strokeThickness: Number(el.attributes.strokeThickness ?? 1),
125
+ };
126
+ case "Rectangle":
127
+ return {
128
+ type: "rectangle",
129
+ topLeft: parsePoint(el.attributes.topLeft),
130
+ bottomRight: parsePoint(el.attributes.bottomRight),
131
+ fillColor: (0, color_js_1.fromString2)(el.attributes.fillColor ?? "", color_js_1.white),
132
+ radius: el.attributes.radius ? parsePoint(el.attributes.radius) : undefined,
133
+ strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.black),
134
+ id: el.attributes.id,
135
+ strokeDashStyle: {
136
+ dashes: parseNumberArrayString(el.attributes.strokeDashArray),
137
+ offset: el.attributes.strokeDashOffset ? Number(el.attributes.strokeDashOffset) : 0,
138
+ },
139
+ strokeThickness: Number(el.attributes.strokeThickness ?? 1),
140
+ };
141
+ case "Text":
142
+ return {
143
+ type: "text",
144
+ position: parsePoint(el.attributes.position),
145
+ clockwiseRotationDegrees: el.attributes.clockwiseRotationDegrees
146
+ ? Number(el.attributes.clockwiseRotationDegrees)
147
+ : 0,
148
+ textColor: (0, color_js_1.fromString2)(el.attributes.textColor ?? "", color_js_1.black),
149
+ strokeColor: (0, color_js_1.fromString2)(el.attributes.strokeColor ?? "", color_js_1.transparent),
150
+ text: el.attributes.text?.toString() ?? "",
151
+ id: el.attributes.id,
152
+ fontFamily: el.attributes.fontFamily ?? "",
153
+ fontSize: el.attributes.fontSize ? Number(el.attributes.fontSize ?? 1) : 12,
154
+ strokeThickness: el.attributes.strokeThickness ? Number(el.attributes.strokeThickness) : 2,
155
+ textAlignment: el.attributes.textAlignment ?? "center",
156
+ verticalGrowthDirection: el.attributes.verticalGrowthDirection ?? "down",
157
+ fontWeight: el.attributes.fontWeight ?? "normal",
158
+ horizontalGrowthDirection: el.attributes.horizontalGrowthDirection ?? "right",
159
+ italic: Boolean(el.attributes.italic ?? false),
160
+ };
161
+ default:
162
+ throw new Error(`Could not find creator for element with name ${el.tagName}`);
163
+ }
164
+ }
165
+ exports.parsedXsd = (0, handlebars_xml_1.parseXsd)(abstract_image_xsd_js_1.xsd);
166
+ function parsePoint(pointString) {
167
+ const [xString, yString] = (typeof pointString === "number" ? pointString.toString() : pointString)?.split(" ") ?? [
168
+ 0, 0,
169
+ ];
170
+ const [x, y] = [Number(xString ?? 0), Number(yString ?? 0)];
171
+ return { x: Number.isFinite(x) ? x : 0, y: Number.isFinite(y) ? y : 0 };
172
+ }
173
+ function parsePointsString(numberArrayString) {
174
+ return ((typeof numberArrayString === "number" ? numberArrayString.toString() : numberArrayString)
175
+ ?.split(" ")
176
+ .map((tuple) => {
177
+ const [xString, yString] = tuple.split(",");
178
+ return { x: Number(xString ?? 0), y: Number(yString ?? 0) };
179
+ }) ?? []);
180
+ }
181
+ function parseNumberArrayString(numberArrayString) {
182
+ return ((typeof numberArrayString === "number" ? numberArrayString.toString() : numberArrayString)
183
+ ?.split(",")
184
+ .map(Number) ?? []);
185
+ }
186
+ //# sourceMappingURL=abstract-image-xml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-image-xml.js","sourceRoot":"","sources":["../../src/abstract-image-xml/abstract-image-xml.ts"],"names":[],"mappings":";;;AAiCA,4CA2BC;AAED,gDA6HC;AA1LD,mDAA0E;AAC1E,gDAA2E;AAgB3E,mEAA8C;AAW9C,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,SAAgB,gBAAgB,CAAC,QAAgB,EAAE,IAAa;IAC9D,IAAI,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,GAAG,IAAA,mCAAkB,EAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QAE3D,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,kBAAkB,CAAC,SAAS,CAAkB,CAAC;YACrE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK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AC;IAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,SAAS,iBAAiB,CAAC,iBAA8C;IACvE,OAAO,CACL,CAAC,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACxF,EAAE,KAAK,CAAC,GAAG,CAAC;SACX,GAAG,CAAC,CAAC,KAAK,EAAS,EAAE;QACpB,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,IAAI,EAAE,CACX,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,iBAA8C;IAC5E,OAAO,CACL,CAAC,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACxF,EAAE,KAAK,CAAC,GAAG,CAAC;SACX,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CACrB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const xsd = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n targetNamespace=\"urn:adml\"\n xmlns=\"urn:adml\"\n elementFormDefault=\"qualified\"\n attributeFormDefault=\"unqualified\">\n\n <!-- ========= Root ========= -->\n <xs:element name=\"abstractImage\" type=\"AbstractImage\"/>\n\n <xs:group name=\"Component\">\n <xs:choice>\n <xs:element name=\"image\" type=\"Image\"/>\n <xs:element name=\"ellipse\" type=\"Ellipse\"/>\n <xs:element name=\"line\" type=\"Line\"/>\n <xs:element name=\"polyline\" type=\"PolyLine\"/>\n <xs:element name=\"polygon\" type=\"Polygon\"/>\n <xs:element name=\"rectangle\" type=\"Rectangle\"/>\n <xs:element name=\"text\" type=\"Text\"/>\n <xs:element name=\"group\" type=\"Group\"/>\n </xs:choice>\n </xs:group>\n\n <xs:complexType name=\"AbstractImage\">\n <xs:sequence>\n <xs:element name=\"components\">\n <xs:complexType>\n <xs:sequence>\n <xs:group ref=\"Component\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n </xs:sequence>\n </xs:complexType>\n </xs:element>\n </xs:sequence>\n <xs:attribute name=\"topLeft\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"size\" type=\"SizeString\" use=\"required\"/>\n <xs:attribute name=\"backgroundColor\" type=\"ColorString\" use=\"optional\"/>\n </xs:complexType>\n\n <xs:simpleType name=\"PointString\"><xs:restriction base=\"xs:string\"/></xs:simpleType>\n <xs:simpleType name=\"SizeString\"><xs:restriction base=\"xs:string\"/></xs:simpleType>\n <xs:simpleType name=\"ColorString\"><xs:restriction base=\"xs:string\"/></xs:simpleType>\n <xs:simpleType name=\"PointsString\"><xs:restriction base=\"xs:string\"/></xs:simpleType>\n <xs:simpleType name=\"DashArray\"><xs:restriction base=\"xs:string\"/></xs:simpleType>\n <xs:simpleType name=\"DashOffset\"><xs:restriction base=\"xs:string\"/></xs:simpleType>\n\n <!-- ========= Components ========= -->\n\n <!-- Group -->\n <xs:complexType name=\"Group\">\n <xs:sequence>\n <xs:element name=\"children\">\n <xs:complexType>\n <xs:sequence>\n <xs:group ref=\"Component\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n </xs:sequence>\n </xs:complexType>\n </xs:element>\n </xs:sequence>\n <xs:attribute name=\"name\" type=\"xs:string\" use=\"optional\"/>\n </xs:complexType>\n\n <!-- Image -->\n <xs:complexType name=\"Image\">\n <xs:attribute name=\"url\" type=\"xs:anyURI\" use=\"required\"/>\n <xs:attribute name=\"topLeft\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"bottomRight\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"id\" type=\"xs:string\" use=\"optional\"/>\n </xs:complexType>\n\n <!-- Ellipse -->\n <xs:complexType name=\"Ellipse\">\n <xs:attribute name=\"topLeft\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"bottomRight\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"strokeColor\" type=\"ColorString\" use=\"optional\"/>\n <xs:attribute name=\"strokeThickness\" type=\"xs:double\" use=\"optional\"/>\n <xs:attribute name=\"strokeDashArray\" type=\"DashArray\" use=\"optional\"/> \n <xs:attribute name=\"strokeDashOffset\" type=\"DashOffset\" use=\"optional\"/>\n <xs:attribute name=\"fillColor\" type=\"ColorString\" use=\"optional\"/>\n <xs:attribute name=\"id\" type=\"xs:string\" use=\"optional\"/>\n </xs:complexType>\n\n <!-- Line -->\n <xs:complexType name=\"Line\">\n <xs:attribute name=\"start\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"end\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"strokeColor\" type=\"ColorString\" use=\"optional\"/>\n <xs:attribute name=\"strokeThickness\" type=\"xs:double\" use=\"optional\"/>\n <xs:attribute name=\"strokeDashArray\" type=\"DashArray\" use=\"optional\"/> \n <xs:attribute name=\"strokeDashOffset\" type=\"DashOffset\" use=\"optional\"/>\n <xs:attribute name=\"id\" type=\"xs:string\" use=\"optional\"/>\n </xs:complexType>\n\n <!-- PolyLine -->\n <xs:complexType name=\"PolyLine\">\n <xs:attribute name=\"points\" type=\"PointsString\" use=\"required\"/>\n <xs:attribute name=\"strokeColor\" type=\"ColorString\" use=\"optional\"/>\n <xs:attribute name=\"strokeThickness\" type=\"xs:double\" use=\"optional\"/>\n <xs:attribute name=\"strokeDashArray\" type=\"DashArray\" use=\"optional\"/> \n <xs:attribute name=\"strokeDashOffset\" type=\"DashOffset\" use=\"optional\"/>\n <xs:attribute name=\"id\" type=\"xs:string\" use=\"optional\"/>\n </xs:complexType>\n\n <!-- Polygon -->\n <xs:complexType name=\"Polygon\">\n <xs:attribute name=\"points\" type=\"PointsString\" use=\"required\"/>\n <xs:attribute name=\"strokeColor\" type=\"ColorString\" use=\"optional\"/>\n <xs:attribute name=\"strokeThickness\" type=\"xs:double\" use=\"optional\"/>\n <xs:attribute name=\"strokeDashArray\" type=\"DashArray\" use=\"optional\"/> \n <xs:attribute name=\"strokeDashOffset\" type=\"DashOffset\" use=\"optional\"/>\n <xs:attribute name=\"fillColor\" type=\"ColorString\" use=\"optional\"/>\n <xs:attribute name=\"id\" type=\"xs:string\" use=\"optional\"/>\n </xs:complexType>\n\n <!-- Rectangle -->\n <xs:complexType name=\"Rectangle\">\n <xs:attribute name=\"topLeft\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"bottomRight\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"strokeColor\" type=\"ColorString\" use=\"optional\"/>\n <xs:attribute name=\"strokeThickness\" type=\"xs:double\" use=\"optional\"/>\n <xs:attribute name=\"strokeDashArray\" type=\"DashArray\" use=\"optional\"/> \n <xs:attribute name=\"strokeDashOffset\" type=\"DashOffset\" use=\"optional\"/>\n <xs:attribute name=\"fillColor\" type=\"ColorString\" use=\"optional\"/>\n <xs:attribute name=\"id\" type=\"xs:string\" use=\"optional\"/>\n <xs:attribute name=\"radius\" type=\"PointString\" use=\"optional\"/>\n </xs:complexType>\n\n <!-- Text -->\n <xs:complexType name=\"Text\">\n <xs:attribute name=\"position\" type=\"PointString\" use=\"required\"/>\n <xs:attribute name=\"text\" type=\"xs:string\" use=\"required\"/>\n <xs:attribute name=\"fontFamily\" type=\"xs:string\" use=\"optional\"/>\n <xs:attribute name=\"fontSize\" type=\"xs:double\" use=\"optional\"/>\n <xs:attribute name=\"textColor\" type=\"ColorString\" use=\"optional\"/>\n\t<xs:attribute name=\"fontWeight\" use=\"optional\">\n\t\t<xs:simpleType>\n\t\t<xs:restriction base=\"xs:string\">\n\t\t\t<xs:enumeration value=\"light\"/>\n\t\t\t<xs:enumeration value=\"normal\"/>\n\t\t\t<xs:enumeration value=\"mediumBold\"/>\n\t\t\t<xs:enumeration value=\"bold\"/>\n\t\t\t<xs:enumeration value=\"extraBold\"/>\n\t\t</xs:restriction>\n\t\t</xs:simpleType>\n\t</xs:attribute>\n\t<xs:attribute name=\"clockwiseRotationDegrees\" type=\"xs:double\" use=\"optional\"/>\n\t<xs:attribute name=\"textAlignment\" use=\"optional\">\n\t\t<xs:simpleType>\n\t\t<xs:restriction base=\"xs:string\">\n\t\t\t<xs:enumeration value=\"left\"/>\n\t\t\t<xs:enumeration value=\"center\"/>\n\t\t\t<xs:enumeration value=\"right\"/>\n\t\t</xs:restriction>\n\t\t</xs:simpleType>\n\t</xs:attribute>\n\t<xs:attribute name=\"horizontalGrowthDirection\" use=\"optional\">\n\t\t<xs:simpleType>\n\t\t<xs:restriction base=\"xs:string\">\n\t\t\t<xs:enumeration value=\"up\"/>\n\t\t\t<xs:enumeration value=\"down\"/>\n\t\t\t<xs:enumeration value=\"uniform\"/>\n\t\t\t<xs:enumeration value=\"left\"/>\n\t\t\t<xs:enumeration value=\"right\"/>\n\t\t</xs:restriction>\n\t\t</xs:simpleType>\n\t</xs:attribute>\n\t<xs:attribute name=\"verticalGrowthDirection\" use=\"optional\">\n\t\t<xs:simpleType>\n\t\t<xs:restriction base=\"xs:string\">\n\t\t\t<xs:enumeration value=\"up\"/>\n\t\t\t<xs:enumeration value=\"down\"/>\n\t\t\t<xs:enumeration value=\"uniform\"/>\n\t\t\t<xs:enumeration value=\"left\"/>\n\t\t\t<xs:enumeration value=\"right\"/>\n\t\t</xs:restriction>\n\t\t</xs:simpleType>\n\t</xs:attribute>\n <xs:attribute name=\"strokeThickness\" type=\"xs:double\" use=\"optional\"/>\n <xs:attribute name=\"strokeColor\" type=\"ColorString\" use=\"optional\"/>\n <xs:attribute name=\"italic\" type=\"xs:boolean\" use=\"optional\"/>\n <xs:attribute name=\"id\" type=\"xs:string\" use=\"optional\"/>\n </xs:complexType>\n\n</xs:schema>\n";
2
+ //# sourceMappingURL=abstract-image-xsd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-image-xsd.d.ts","sourceRoot":"","sources":["../../src/abstract-image-xml/abstract-image-xsd.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,w2QAuLf,CAAA"}
@@ -1,4 +1,7 @@
1
- export const xsd = `<?xml version="1.0" encoding="UTF-8"?>
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.xsd = void 0;
4
+ exports.xsd = `<?xml version="1.0" encoding="UTF-8"?>
2
5
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3
6
  targetNamespace="urn:adml"
4
7
  xmlns="urn:adml"
@@ -182,3 +185,4 @@ export const xsd = `<?xml version="1.0" encoding="UTF-8"?>
182
185
 
183
186
  </xs:schema>
184
187
  `;
188
+ //# sourceMappingURL=abstract-image-xsd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-image-xsd.js","sourceRoot":"","sources":["../../src/abstract-image-xml/abstract-image-xsd.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuLlB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./abstract-image-xml.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/abstract-image-xml/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./abstract-image-xml.js"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/abstract-image-xml/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
@@ -0,0 +1,2 @@
1
+ export declare const createComponents: (mutableImageUrls: Array<string>) => Record<string, (...args: any[]) => any>;
2
+ //# sourceMappingURL=components.d.ts.map
@@ -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,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SAAS;QAChB,SAAS,CAAC,KAAK;SAChB,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AA5GU,QAAA,gBAAgB,oBA4G1B;AAEH,SAAS,aAAa,CAAC,MAAwB;IAC7C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,QAAQ,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;YAC7B,KAAK,MAAM,CAAC;YACZ,KAAK,QAAQ;gBACX,OAAO,MAAM,CAAC;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: "HANDLEBARS_PARSE_ERROR";
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(template: string, data: unknown): DynamicImageResult;
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":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAgC,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAmB1E,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,GACzB;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAA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