@segnavia/idml 0.30.0 → 0.32.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/fonts.d.ts +10 -0
- package/dist/fonts.js +105 -0
- package/dist/import.d.ts +2 -2
- package/dist/import.js +2 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +2 -1
- package/dist/map-book.js +15 -6
- package/dist/masters.js +22 -7
- package/dist/model.d.ts +2 -1
- package/dist/model.js +21 -135
- package/dist/openers.js +134 -0
- package/dist/placement-report.js +15 -0
- package/dist/placements.js +300 -0
- package/dist/positioned-box.js +14 -0
- package/dist/report.d.ts +7 -0
- package/dist/report.js +42 -5
- package/dist/stories.js +1 -1
- package/dist/styles.js +17 -20
- package/dist/svg-path.js +33 -0
- package/dist/swatch-color.js +25 -0
- package/dist/types.d.ts +59 -0
- package/dist/unsupported-elements.js +17 -1
- package/dist/xml.js +19 -1
- package/package.json +3 -3
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { localName } from "./xml.js";
|
|
2
2
|
//#region src/unsupported-elements.ts
|
|
3
|
+
const SHAPE_ELEMENTS = [
|
|
4
|
+
"Polygon",
|
|
5
|
+
"Rectangle",
|
|
6
|
+
"Oval",
|
|
7
|
+
"GraphicLine"
|
|
8
|
+
];
|
|
9
|
+
const GRAPHIC_ELEMENTS = [
|
|
10
|
+
"Image",
|
|
11
|
+
"PDF",
|
|
12
|
+
"EPS",
|
|
13
|
+
"ImportedPage",
|
|
14
|
+
"SVG"
|
|
15
|
+
];
|
|
3
16
|
const MAPPED_ELEMENTS = /* @__PURE__ */ new Set([
|
|
4
17
|
"Document",
|
|
5
18
|
"DocumentPreference",
|
|
@@ -10,6 +23,9 @@ const MAPPED_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
10
23
|
"Story",
|
|
11
24
|
"TextFrame",
|
|
12
25
|
"Group",
|
|
26
|
+
...SHAPE_ELEMENTS,
|
|
27
|
+
...GRAPHIC_ELEMENTS,
|
|
28
|
+
"Link",
|
|
13
29
|
"TextFramePreference",
|
|
14
30
|
"PathGeometry",
|
|
15
31
|
"GeometryPathType",
|
|
@@ -48,4 +64,4 @@ function collectUnsupportedElements(parts, report) {
|
|
|
48
64
|
return report.unsupportedElements;
|
|
49
65
|
}
|
|
50
66
|
//#endregion
|
|
51
|
-
export { collectUnsupportedElements };
|
|
67
|
+
export { GRAPHIC_ELEMENTS, SHAPE_ELEMENTS, collectUnsupportedElements };
|
package/dist/xml.js
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import { refusal } from "./refusal.js";
|
|
2
|
+
import { isTag } from "domhandler";
|
|
2
3
|
//#region src/xml.ts
|
|
3
4
|
function localName(name) {
|
|
4
5
|
return name.includes(":") ? name.split(":").at(-1) ?? name : name;
|
|
5
6
|
}
|
|
7
|
+
function elements(root, name) {
|
|
8
|
+
const found = [];
|
|
9
|
+
const pending = [root];
|
|
10
|
+
while (pending.length > 0) {
|
|
11
|
+
const node = pending.pop();
|
|
12
|
+
if (!node) continue;
|
|
13
|
+
if (isTag(node) && (!name || localName(node.name) === name)) found.push(node);
|
|
14
|
+
if ("children" in node) for (let index = node.children.length - 1; index >= 0; index -= 1) pending.push(node.children[index]);
|
|
15
|
+
}
|
|
16
|
+
return found;
|
|
17
|
+
}
|
|
18
|
+
function attribute(element, ...names) {
|
|
19
|
+
for (const name of names) {
|
|
20
|
+
const value = element.attribs[name];
|
|
21
|
+
if (value !== void 0) return value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
6
24
|
function numberAttribute(element, name, fallback) {
|
|
7
25
|
const raw = element?.attribs[name];
|
|
8
26
|
const value = raw === void 0 ? fallback : Number(raw);
|
|
@@ -15,4 +33,4 @@ function idmlDirection(value) {
|
|
|
15
33
|
if (normalized?.includes("lefttoright")) return "ltr";
|
|
16
34
|
}
|
|
17
35
|
//#endregion
|
|
18
|
-
export { idmlDirection, localName, numberAttribute };
|
|
36
|
+
export { attribute, elements, idmlDirection, localName, numberAttribute };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segnavia/idml",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@segnavia/format": "0.
|
|
30
|
-
"@segnavia/html": "0.
|
|
29
|
+
"@segnavia/format": "0.32.0",
|
|
30
|
+
"@segnavia/html": "0.32.0",
|
|
31
31
|
"dom-serializer": "^2.0.0",
|
|
32
32
|
"domhandler": "^5.0.3",
|
|
33
33
|
"htmlparser2": "^10.0.0"
|