@deckflow/deckuse 1.2.1 → 1.3.1
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/README.es.md +342 -0
- package/README.fr.md +342 -0
- package/README.ja.md +342 -0
- package/README.ko.md +342 -0
- package/README.md +60 -8
- package/README.pt-BR.md +342 -0
- package/README.ru.md +342 -0
- package/README.zh-CN.md +367 -0
- package/assets/default.docx +0 -0
- package/assets/default.pptx +0 -0
- package/dist/bin.js +188 -21
- package/dist/bin.js.map +1 -1
- package/dist/core/adapter.d.ts +24 -0
- package/dist/core/adapter.d.ts.map +1 -0
- package/dist/core/adapter.js +20 -0
- package/dist/core/adapter.js.map +1 -0
- package/dist/core/executor.d.ts +24 -0
- package/dist/core/executor.d.ts.map +1 -0
- package/dist/core/executor.js +65 -0
- package/dist/core/executor.js.map +1 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +7 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/length.d.ts +27 -0
- package/dist/core/length.d.ts.map +1 -0
- package/dist/core/length.js +63 -0
- package/dist/core/length.js.map +1 -0
- package/dist/core/measure.d.ts +24 -0
- package/dist/core/measure.d.ts.map +1 -0
- package/dist/core/measure.js +79 -0
- package/dist/core/measure.js.map +1 -0
- package/dist/core/not-implemented.d.ts +3 -0
- package/dist/core/not-implemented.d.ts.map +1 -0
- package/dist/core/not-implemented.js +12 -0
- package/dist/core/not-implemented.js.map +1 -0
- package/dist/core/schema.d.ts +3065 -0
- package/dist/core/schema.d.ts.map +1 -0
- package/dist/core/schema.js +799 -0
- package/dist/core/schema.js.map +1 -0
- package/dist/default-template.d.ts +8 -0
- package/dist/default-template.d.ts.map +1 -0
- package/dist/default-template.js +29 -0
- package/dist/default-template.js.map +1 -0
- package/dist/docx/adapter.d.ts +29 -0
- package/dist/docx/adapter.d.ts.map +1 -0
- package/dist/docx/adapter.js +442 -0
- package/dist/docx/adapter.js.map +1 -0
- package/dist/docx/addressing.d.ts +18 -0
- package/dist/docx/addressing.d.ts.map +1 -0
- package/dist/docx/addressing.js +111 -0
- package/dist/docx/addressing.js.map +1 -0
- package/dist/docx/blank.d.ts +4 -0
- package/dist/docx/blank.d.ts.map +1 -0
- package/dist/docx/blank.js +75 -0
- package/dist/docx/blank.js.map +1 -0
- package/dist/docx/index-sync.d.ts +7 -0
- package/dist/docx/index-sync.d.ts.map +1 -0
- package/dist/docx/index-sync.js +24 -0
- package/dist/docx/index-sync.js.map +1 -0
- package/dist/docx/index.d.ts +5 -0
- package/dist/docx/index.d.ts.map +1 -0
- package/dist/docx/index.js +4 -0
- package/dist/docx/index.js.map +1 -0
- package/dist/docx/indexer.d.ts +41 -0
- package/dist/docx/indexer.d.ts.map +1 -0
- package/dist/docx/indexer.js +353 -0
- package/dist/docx/indexer.js.map +1 -0
- package/dist/docx/mutations.d.ts +5 -0
- package/dist/docx/mutations.d.ts.map +1 -0
- package/dist/docx/mutations.js +311 -0
- package/dist/docx/mutations.js.map +1 -0
- package/dist/docx/paragraphs.d.ts +26 -0
- package/dist/docx/paragraphs.d.ts.map +1 -0
- package/dist/docx/paragraphs.js +314 -0
- package/dist/docx/paragraphs.js.map +1 -0
- package/dist/docx/properties.d.ts +23 -0
- package/dist/docx/properties.d.ts.map +1 -0
- package/dist/docx/properties.js +414 -0
- package/dist/docx/properties.js.map +1 -0
- package/dist/docx/tables.d.ts +4 -0
- package/dist/docx/tables.d.ts.map +1 -0
- package/dist/docx/tables.js +64 -0
- package/dist/docx/tables.js.map +1 -0
- package/dist/docx/text-spans.d.ts +25 -0
- package/dist/docx/text-spans.d.ts.map +1 -0
- package/dist/docx/text-spans.js +142 -0
- package/dist/docx/text-spans.js.map +1 -0
- package/dist/docx/types.d.ts +27 -0
- package/dist/docx/types.d.ts.map +1 -0
- package/dist/docx/types.js +2 -0
- package/dist/docx/types.js.map +1 -0
- package/dist/docx/workspace.d.ts +20 -0
- package/dist/docx/workspace.d.ts.map +1 -0
- package/dist/docx/workspace.js +145 -0
- package/dist/docx/workspace.js.map +1 -0
- package/dist/docx/xml.d.ts +18 -0
- package/dist/docx/xml.d.ts.map +1 -0
- package/dist/docx/xml.js +87 -0
- package/dist/docx/xml.js.map +1 -0
- package/dist/edition-config/index.d.ts +25 -0
- package/dist/edition-config/index.d.ts.map +1 -0
- package/dist/edition-config/index.js +22 -0
- package/dist/edition-config/index.js.map +1 -0
- package/dist/edition.d.ts +2 -2
- package/dist/edition.d.ts.map +1 -1
- package/dist/edition.js +1 -1
- package/dist/edition.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +124 -32
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/key/index.d.ts +2 -0
- package/dist/key/index.d.ts.map +1 -0
- package/dist/key/index.js +3 -0
- package/dist/key/index.js.map +1 -0
- package/dist/monitor-daemon.d.ts +21 -8
- package/dist/monitor-daemon.d.ts.map +1 -1
- package/dist/monitor-daemon.js +189 -51
- package/dist/monitor-daemon.js.map +1 -1
- package/dist/monitor-registry.d.ts +34 -0
- package/dist/monitor-registry.d.ts.map +1 -0
- package/dist/monitor-registry.js +191 -0
- package/dist/monitor-registry.js.map +1 -0
- package/dist/monitor.d.ts.map +1 -1
- package/dist/monitor.js +2 -12
- package/dist/monitor.js.map +1 -1
- package/dist/numbers/index.d.ts +2 -0
- package/dist/numbers/index.d.ts.map +1 -0
- package/dist/numbers/index.js +3 -0
- package/dist/numbers/index.js.map +1 -0
- package/dist/opc/index.d.ts +96 -0
- package/dist/opc/index.d.ts.map +1 -0
- package/dist/opc/index.js +596 -0
- package/dist/opc/index.js.map +1 -0
- package/dist/pptx/adapter.d.ts +167 -0
- package/dist/pptx/adapter.d.ts.map +1 -0
- package/dist/pptx/adapter.js +841 -0
- package/dist/pptx/adapter.js.map +1 -0
- package/dist/pptx/addressing.d.ts +47 -0
- package/dist/pptx/addressing.d.ts.map +1 -0
- package/dist/pptx/addressing.js +481 -0
- package/dist/pptx/addressing.js.map +1 -0
- package/dist/pptx/align.d.ts +24 -0
- package/dist/pptx/align.d.ts.map +1 -0
- package/dist/pptx/align.js +112 -0
- package/dist/pptx/align.js.map +1 -0
- package/dist/pptx/chart-classify.d.ts +10 -0
- package/dist/pptx/chart-classify.d.ts.map +1 -0
- package/dist/pptx/chart-classify.js +58 -0
- package/dist/pptx/chart-classify.js.map +1 -0
- package/dist/pptx/chart.d.ts +42 -0
- package/dist/pptx/chart.d.ts.map +1 -0
- package/dist/pptx/chart.js +614 -0
- package/dist/pptx/chart.js.map +1 -0
- package/dist/pptx/edition-extension.d.ts +25 -0
- package/dist/pptx/edition-extension.d.ts.map +1 -0
- package/dist/pptx/edition-extension.js +10 -0
- package/dist/pptx/edition-extension.js.map +1 -0
- package/dist/pptx/edition.d.ts +20 -0
- package/dist/pptx/edition.d.ts.map +1 -0
- package/dist/pptx/edition.js +69 -0
- package/dist/pptx/edition.js.map +1 -0
- package/dist/pptx/elements.d.ts +12 -0
- package/dist/pptx/elements.d.ts.map +1 -0
- package/dist/pptx/elements.js +224 -0
- package/dist/pptx/elements.js.map +1 -0
- package/dist/pptx/hyperlink.d.ts +7 -0
- package/dist/pptx/hyperlink.d.ts.map +1 -0
- package/dist/pptx/hyperlink.js +81 -0
- package/dist/pptx/hyperlink.js.map +1 -0
- package/dist/pptx/index-sync.d.ts +7 -0
- package/dist/pptx/index-sync.d.ts.map +1 -0
- package/dist/pptx/index-sync.js +24 -0
- package/dist/pptx/index-sync.js.map +1 -0
- package/dist/pptx/index.d.ts +10 -0
- package/dist/pptx/index.d.ts.map +1 -0
- package/dist/pptx/index.js +7 -0
- package/dist/pptx/index.js.map +1 -0
- package/dist/pptx/indexer.d.ts +19 -0
- package/dist/pptx/indexer.d.ts.map +1 -0
- package/dist/pptx/indexer.js +320 -0
- package/dist/pptx/indexer.js.map +1 -0
- package/dist/pptx/layout-ref.d.ts +41 -0
- package/dist/pptx/layout-ref.d.ts.map +1 -0
- package/dist/pptx/layout-ref.js +145 -0
- package/dist/pptx/layout-ref.js.map +1 -0
- package/dist/pptx/media.d.ts +15 -0
- package/dist/pptx/media.d.ts.map +1 -0
- package/dist/pptx/media.js +145 -0
- package/dist/pptx/media.js.map +1 -0
- package/dist/pptx/mutations.d.ts +11 -0
- package/dist/pptx/mutations.d.ts.map +1 -0
- package/dist/pptx/mutations.js +1114 -0
- package/dist/pptx/mutations.js.map +1 -0
- package/dist/pptx/picture.d.ts +25 -0
- package/dist/pptx/picture.d.ts.map +1 -0
- package/dist/pptx/picture.js +118 -0
- package/dist/pptx/picture.js.map +1 -0
- package/dist/pptx/placeholder-role.d.ts +19 -0
- package/dist/pptx/placeholder-role.d.ts.map +1 -0
- package/dist/pptx/placeholder-role.js +71 -0
- package/dist/pptx/placeholder-role.js.map +1 -0
- package/dist/pptx/properties.d.ts +13 -0
- package/dist/pptx/properties.d.ts.map +1 -0
- package/dist/pptx/properties.js +587 -0
- package/dist/pptx/properties.js.map +1 -0
- package/dist/pptx/resolve-properties.d.ts +17 -0
- package/dist/pptx/resolve-properties.d.ts.map +1 -0
- package/dist/pptx/resolve-properties.js +623 -0
- package/dist/pptx/resolve-properties.js.map +1 -0
- package/dist/pptx/slide-size.d.ts +9 -0
- package/dist/pptx/slide-size.d.ts.map +1 -0
- package/dist/pptx/slide-size.js +29 -0
- package/dist/pptx/slide-size.js.map +1 -0
- package/dist/pptx/slides.d.ts +15 -0
- package/dist/pptx/slides.d.ts.map +1 -0
- package/dist/pptx/slides.js +247 -0
- package/dist/pptx/slides.js.map +1 -0
- package/dist/pptx/table-measure.d.ts +43 -0
- package/dist/pptx/table-measure.d.ts.map +1 -0
- package/dist/pptx/table-measure.js +70 -0
- package/dist/pptx/table-measure.js.map +1 -0
- package/dist/pptx/table.d.ts +26 -0
- package/dist/pptx/table.d.ts.map +1 -0
- package/dist/pptx/table.js +638 -0
- package/dist/pptx/table.js.map +1 -0
- package/dist/pptx/types.d.ts +27 -0
- package/dist/pptx/types.d.ts.map +1 -0
- package/dist/pptx/types.js +2 -0
- package/dist/pptx/types.js.map +1 -0
- package/dist/pptx/workspace.d.ts +23 -0
- package/dist/pptx/workspace.d.ts.map +1 -0
- package/dist/pptx/workspace.js +148 -0
- package/dist/pptx/workspace.js.map +1 -0
- package/dist/pptx/xml.d.ts +75 -0
- package/dist/pptx/xml.d.ts.map +1 -0
- package/dist/pptx/xml.js +390 -0
- package/dist/pptx/xml.js.map +1 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +14 -2
- package/dist/render.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workspace/git.d.ts +7 -0
- package/dist/workspace/git.d.ts.map +1 -0
- package/dist/workspace/git.js +119 -0
- package/dist/workspace/git.js.map +1 -0
- package/dist/workspace/index.d.ts +7 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +7 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/lock.d.ts +5 -0
- package/dist/workspace/lock.d.ts.map +1 -0
- package/dist/workspace/lock.js +104 -0
- package/dist/workspace/lock.js.map +1 -0
- package/dist/workspace/metadata.d.ts +4 -0
- package/dist/workspace/metadata.d.ts.map +1 -0
- package/dist/workspace/metadata.js +21 -0
- package/dist/workspace/metadata.js.map +1 -0
- package/dist/workspace/operations.d.ts +14 -0
- package/dist/workspace/operations.d.ts.map +1 -0
- package/dist/workspace/operations.js +35 -0
- package/dist/workspace/operations.js.map +1 -0
- package/dist/workspace/paths.d.ts +11 -0
- package/dist/workspace/paths.d.ts.map +1 -0
- package/dist/workspace/paths.js +12 -0
- package/dist/workspace/paths.js.map +1 -0
- package/dist/workspace/revision.d.ts +6 -0
- package/dist/workspace/revision.d.ts.map +1 -0
- package/dist/workspace/revision.js +15 -0
- package/dist/workspace/revision.js.map +1 -0
- package/dist/xlsx/index.d.ts +2 -0
- package/dist/xlsx/index.d.ts.map +1 -0
- package/dist/xlsx/index.js +3 -0
- package/dist/xlsx/index.js.map +1 -0
- package/package.json +51 -27
- package/schema/command.schema.json +2405 -0
- package/dist/.tsbuildinfo +0 -1
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
import { cNvPrIdOf } from './addressing.js';
|
|
2
|
+
import { NS, REL, attr, children, cNvPr, descendants, first, notesBodyShape, notesBodyText, root, textOf, } from './xml.js';
|
|
3
|
+
const EMU_PER_PT = 12700;
|
|
4
|
+
const SHAPE_LOCAL_NAMES = new Set(['sp', 'pic', 'graphicFrame', 'cxnSp', 'grpSp']);
|
|
5
|
+
const directChild = (node, localName) => children(node).find((child) => child.localName === localName);
|
|
6
|
+
const shapeByCNvPrId = (doc, id) => descendants(doc).find((node) => node.localName != null &&
|
|
7
|
+
SHAPE_LOCAL_NAMES.has(node.localName) &&
|
|
8
|
+
attr(cNvPr(node), 'id') === id);
|
|
9
|
+
const nodeForItem = (doc, item) => {
|
|
10
|
+
if (item.kind === 'notes')
|
|
11
|
+
return notesBodyShape(doc) ?? undefined;
|
|
12
|
+
if (['slide', 'master', 'layout', 'theme'].includes(item.kind))
|
|
13
|
+
return root(doc);
|
|
14
|
+
const id = cNvPrIdOf(item);
|
|
15
|
+
return id ? shapeByCNvPrId(doc, id) : undefined;
|
|
16
|
+
};
|
|
17
|
+
const prop = (effective, direct, source, unit) => {
|
|
18
|
+
const inherited = direct === null || direct === undefined;
|
|
19
|
+
return {
|
|
20
|
+
effective: effective ?? null,
|
|
21
|
+
direct: direct ?? null,
|
|
22
|
+
inherited,
|
|
23
|
+
...(source ? { source } : inherited ? { source: { scope: 'default' } } : {}),
|
|
24
|
+
...(unit ? { unit } : {}),
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const readSrgb = (node) => {
|
|
28
|
+
if (!node)
|
|
29
|
+
return undefined;
|
|
30
|
+
const srgb = first(node, 'srgbClr');
|
|
31
|
+
const val = attr(srgb, 'val');
|
|
32
|
+
if (val)
|
|
33
|
+
return `#${val.toUpperCase()}`;
|
|
34
|
+
return undefined;
|
|
35
|
+
};
|
|
36
|
+
const readSchemeColor = (node, themeColors) => {
|
|
37
|
+
if (!node)
|
|
38
|
+
return undefined;
|
|
39
|
+
const scheme = first(node, 'schemeClr');
|
|
40
|
+
const name = attr(scheme, 'val');
|
|
41
|
+
if (!name)
|
|
42
|
+
return undefined;
|
|
43
|
+
const mapped = themeColors.get(name) ?? themeColors.get(name.toLowerCase());
|
|
44
|
+
return mapped ? `#${mapped.replace(/^#/, '').toUpperCase()}` : undefined;
|
|
45
|
+
};
|
|
46
|
+
const readFillColor = (container, themeColors) => {
|
|
47
|
+
if (!container)
|
|
48
|
+
return undefined;
|
|
49
|
+
if (directChild(container, 'noFill'))
|
|
50
|
+
return { kind: 'none', color: null, transparency: null };
|
|
51
|
+
const solid = directChild(container, 'solidFill');
|
|
52
|
+
if (solid) {
|
|
53
|
+
const color = readSrgb(solid) ?? readSchemeColor(solid, themeColors) ?? null;
|
|
54
|
+
const alpha = attr(first(solid, 'alpha') ?? first(solid, 'srgbClr'), 'val');
|
|
55
|
+
// alpha on srgbClr child
|
|
56
|
+
const alphaNode = descendants(solid, 'alpha')[0];
|
|
57
|
+
const alphaVal = attr(alphaNode, 'val');
|
|
58
|
+
let transparency = null;
|
|
59
|
+
if (alphaVal !== undefined) {
|
|
60
|
+
const n = Number(alphaVal);
|
|
61
|
+
if (Number.isFinite(n))
|
|
62
|
+
transparency = Math.round((1 - n / 100000) * 100);
|
|
63
|
+
}
|
|
64
|
+
void alpha;
|
|
65
|
+
return { kind: 'solid', color, transparency };
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
};
|
|
69
|
+
const loadThemeColors = (archive, themePart) => {
|
|
70
|
+
const map = new Map();
|
|
71
|
+
if (!themePart || !archive.getPart(themePart))
|
|
72
|
+
return map;
|
|
73
|
+
const doc = archive.readXml(themePart);
|
|
74
|
+
const scheme = first(doc, 'clrScheme');
|
|
75
|
+
if (!scheme)
|
|
76
|
+
return map;
|
|
77
|
+
for (const child of children(scheme)) {
|
|
78
|
+
const name = child.localName;
|
|
79
|
+
if (!name)
|
|
80
|
+
continue;
|
|
81
|
+
const srgb = attr(first(child, 'srgbClr'), 'val');
|
|
82
|
+
const sys = attr(first(child, 'sysClr'), 'lastClr');
|
|
83
|
+
const val = srgb ?? sys;
|
|
84
|
+
if (val) {
|
|
85
|
+
map.set(name, val.toUpperCase());
|
|
86
|
+
map.set(name.toLowerCase(), val.toUpperCase());
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return map;
|
|
90
|
+
};
|
|
91
|
+
const loadThemeFonts = (archive, themePart) => {
|
|
92
|
+
if (!themePart || !archive.getPart(themePart))
|
|
93
|
+
return {};
|
|
94
|
+
const doc = archive.readXml(themePart);
|
|
95
|
+
const major = attr(first(first(doc, 'majorFont') ?? doc, 'latin'), 'typeface');
|
|
96
|
+
const minor = attr(first(first(doc, 'minorFont') ?? doc, 'latin'), 'typeface');
|
|
97
|
+
return { ...(major ? { major } : {}), ...(minor ? { minor } : {}) };
|
|
98
|
+
};
|
|
99
|
+
const resolveStyleChain = (archive, slidePart) => {
|
|
100
|
+
const slideRels = archive.getRelationships(slidePart);
|
|
101
|
+
const layoutRel = slideRels.find((r) => r.type === REL.layout);
|
|
102
|
+
const layoutPart = layoutRel?.resolvedTarget;
|
|
103
|
+
let masterPart;
|
|
104
|
+
let themePart;
|
|
105
|
+
if (layoutPart) {
|
|
106
|
+
const layoutRels = archive.getRelationships(layoutPart);
|
|
107
|
+
const masterRel = layoutRels.find((r) => r.type === REL.slideMaster);
|
|
108
|
+
masterPart = masterRel?.resolvedTarget;
|
|
109
|
+
}
|
|
110
|
+
if (masterPart) {
|
|
111
|
+
const masterRels = archive.getRelationships(masterPart);
|
|
112
|
+
const themeRel = masterRels.find((r) => r.type === REL.theme);
|
|
113
|
+
themePart = themeRel?.resolvedTarget;
|
|
114
|
+
}
|
|
115
|
+
if (!themePart) {
|
|
116
|
+
const theme = [...archive.parts.keys()].find((name) => name.startsWith('/ppt/theme/') && name.endsWith('.xml'));
|
|
117
|
+
themePart = theme;
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
...(layoutPart
|
|
121
|
+
? {
|
|
122
|
+
layoutPart,
|
|
123
|
+
layoutTarget: `layout:${layoutPart
|
|
124
|
+
.split('/')
|
|
125
|
+
.pop()
|
|
126
|
+
?.replace(/\.xml$/, '') ?? layoutPart}`,
|
|
127
|
+
}
|
|
128
|
+
: {}),
|
|
129
|
+
...(masterPart
|
|
130
|
+
? {
|
|
131
|
+
masterPart,
|
|
132
|
+
masterTarget: `master:${masterPart
|
|
133
|
+
.split('/')
|
|
134
|
+
.pop()
|
|
135
|
+
?.replace(/\.xml$/, '') ?? masterPart}`,
|
|
136
|
+
}
|
|
137
|
+
: {}),
|
|
138
|
+
...(themePart ? { themePart } : {}),
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
const placeholderOf = (node) => {
|
|
142
|
+
const ph = first(node, 'ph');
|
|
143
|
+
if (!ph)
|
|
144
|
+
return undefined;
|
|
145
|
+
const type = attr(ph, 'type') ?? 'body';
|
|
146
|
+
const idx = attr(ph, 'idx');
|
|
147
|
+
return { type, ...(idx !== undefined ? { idx } : {}) };
|
|
148
|
+
};
|
|
149
|
+
const findPlaceholderShape = (doc, type, idx) => {
|
|
150
|
+
for (const node of descendants(doc)) {
|
|
151
|
+
if (!node.localName || !SHAPE_LOCAL_NAMES.has(node.localName))
|
|
152
|
+
continue;
|
|
153
|
+
const ph = placeholderOf(node);
|
|
154
|
+
if (!ph)
|
|
155
|
+
continue;
|
|
156
|
+
if (idx !== undefined && ph.idx === idx)
|
|
157
|
+
return node;
|
|
158
|
+
if (type && ph.type === type && (idx === undefined || ph.idx === undefined))
|
|
159
|
+
return node;
|
|
160
|
+
}
|
|
161
|
+
return undefined;
|
|
162
|
+
};
|
|
163
|
+
const txStyleLevel = (masterDoc, styleKind, level) => {
|
|
164
|
+
const styles = first(masterDoc, 'txStyles');
|
|
165
|
+
if (!styles)
|
|
166
|
+
return undefined;
|
|
167
|
+
const blockName = styleKind === 'title' ? 'titleStyle' : styleKind === 'body' ? 'bodyStyle' : 'otherStyle';
|
|
168
|
+
const block = directChild(styles, blockName) ?? first(styles, blockName);
|
|
169
|
+
if (!block)
|
|
170
|
+
return undefined;
|
|
171
|
+
if (level === 0)
|
|
172
|
+
return (directChild(block, 'defPPr') ??
|
|
173
|
+
first(block, 'defPPr') ??
|
|
174
|
+
directChild(block, 'lvl1pPr') ??
|
|
175
|
+
first(block, 'lvl1pPr'));
|
|
176
|
+
const name = `lvl${level + 1}pPr`;
|
|
177
|
+
return directChild(block, name) ?? first(block, name);
|
|
178
|
+
};
|
|
179
|
+
const styleKindForPlaceholder = (type) => {
|
|
180
|
+
if (!type)
|
|
181
|
+
return 'body';
|
|
182
|
+
if (type === 'title' || type === 'ctrTitle')
|
|
183
|
+
return 'title';
|
|
184
|
+
if (type === 'body' || type === 'obj' || type === 'subTitle')
|
|
185
|
+
return 'body';
|
|
186
|
+
return 'other';
|
|
187
|
+
};
|
|
188
|
+
const readFontFromRPr = (rPr, themeFonts, themeColors) => {
|
|
189
|
+
if (!rPr)
|
|
190
|
+
return {};
|
|
191
|
+
const sz = attr(rPr, 'sz');
|
|
192
|
+
const size = sz !== undefined ? Number(sz) / 100 : undefined;
|
|
193
|
+
const latin = attr(directChild(rPr, 'latin'), 'typeface');
|
|
194
|
+
let family = latin;
|
|
195
|
+
if (family?.startsWith('+mj-'))
|
|
196
|
+
family = themeFonts.major;
|
|
197
|
+
if (family?.startsWith('+mn-'))
|
|
198
|
+
family = themeFonts.minor;
|
|
199
|
+
const bold = attr(rPr, 'b');
|
|
200
|
+
const italic = attr(rPr, 'i');
|
|
201
|
+
const underline = attr(rPr, 'u');
|
|
202
|
+
const solid = directChild(rPr, 'solidFill');
|
|
203
|
+
const color = solid ? (readSrgb(solid) ?? readSchemeColor(solid, themeColors)) : undefined;
|
|
204
|
+
return {
|
|
205
|
+
...(family ? { family } : {}),
|
|
206
|
+
...(size !== undefined && Number.isFinite(size) ? { size } : {}),
|
|
207
|
+
...(bold === '1' || bold === 'true'
|
|
208
|
+
? { weight: 'bold' }
|
|
209
|
+
: bold === '0'
|
|
210
|
+
? { weight: 'regular' }
|
|
211
|
+
: {}),
|
|
212
|
+
...(italic === '1' || italic === 'true'
|
|
213
|
+
? { italic: true }
|
|
214
|
+
: italic === '0'
|
|
215
|
+
? { italic: false }
|
|
216
|
+
: {}),
|
|
217
|
+
...(underline && underline !== 'none' ? { underline: true } : {}),
|
|
218
|
+
...(color ? { color } : {}),
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
const firstRunRPr = (node) => {
|
|
222
|
+
const run = descendants(node, 'r')[0];
|
|
223
|
+
return run ? directChild(run, 'rPr') : undefined;
|
|
224
|
+
};
|
|
225
|
+
const defRPrFromLevel = (level) => {
|
|
226
|
+
if (!level)
|
|
227
|
+
return undefined;
|
|
228
|
+
return directChild(level, 'defRPr') ?? first(level, 'defRPr');
|
|
229
|
+
};
|
|
230
|
+
const readTransform = (node) => {
|
|
231
|
+
const xfrm = first(node, 'xfrm');
|
|
232
|
+
const off = xfrm ? first(xfrm, 'off') : undefined;
|
|
233
|
+
const ext = xfrm ? first(xfrm, 'ext') : undefined;
|
|
234
|
+
const rot = attr(xfrm, 'rot');
|
|
235
|
+
return {
|
|
236
|
+
x: attr(off, 'x') !== undefined ? Number(attr(off, 'x')) : null,
|
|
237
|
+
y: attr(off, 'y') !== undefined ? Number(attr(off, 'y')) : null,
|
|
238
|
+
width: attr(ext, 'cx') !== undefined ? Number(attr(ext, 'cx')) : null,
|
|
239
|
+
height: attr(ext, 'cy') !== undefined ? Number(attr(ext, 'cy')) : null,
|
|
240
|
+
rotation: rot !== undefined ? Number(rot) / 60000 : null,
|
|
241
|
+
'flip.x': attr(xfrm, 'flipH') === '1',
|
|
242
|
+
'flip.y': attr(xfrm, 'flipV') === '1',
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
const filterProps = (all, props, mode, includeProvenance) => {
|
|
246
|
+
const keys = props?.length ? props : Object.keys(all);
|
|
247
|
+
const out = {};
|
|
248
|
+
for (const key of keys) {
|
|
249
|
+
const value = all[key];
|
|
250
|
+
if (!value)
|
|
251
|
+
continue;
|
|
252
|
+
if (mode === 'effective') {
|
|
253
|
+
out[key] = includeProvenance
|
|
254
|
+
? {
|
|
255
|
+
effective: value.effective,
|
|
256
|
+
inherited: value.inherited,
|
|
257
|
+
...(value.source ? { source: value.source } : {}),
|
|
258
|
+
...(value.unit ? { unit: value.unit } : {}),
|
|
259
|
+
}
|
|
260
|
+
: value.effective;
|
|
261
|
+
}
|
|
262
|
+
else if (mode === 'direct') {
|
|
263
|
+
out[key] = includeProvenance
|
|
264
|
+
? {
|
|
265
|
+
direct: value.direct,
|
|
266
|
+
inherited: value.inherited,
|
|
267
|
+
...(value.unit ? { unit: value.unit } : {}),
|
|
268
|
+
}
|
|
269
|
+
: value.direct;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
out[key] = includeProvenance
|
|
273
|
+
? value
|
|
274
|
+
: { effective: value.effective, direct: value.direct, inherited: value.inherited };
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return out;
|
|
278
|
+
};
|
|
279
|
+
export function resolveProperties(archive, resolved, options = {}) {
|
|
280
|
+
const mode = options.resolve ?? 'both';
|
|
281
|
+
const includeProvenance = options.provenance !== false;
|
|
282
|
+
const warnings = [];
|
|
283
|
+
const item = resolved.item;
|
|
284
|
+
// Synthetic notes (no part yet): return empty text without reading an empty path.
|
|
285
|
+
if (item.kind === 'notes' && (!item.partUri || !archive.getPart(item.partUri))) {
|
|
286
|
+
const properties = {
|
|
287
|
+
'text.value': prop(null, null, {
|
|
288
|
+
scope: 'default',
|
|
289
|
+
target: resolved.target,
|
|
290
|
+
path: 'text.value',
|
|
291
|
+
}),
|
|
292
|
+
};
|
|
293
|
+
return {
|
|
294
|
+
target: resolved.target,
|
|
295
|
+
uid: resolved.uid,
|
|
296
|
+
...(item.name ? { name: item.name } : {}),
|
|
297
|
+
properties: filterProps(properties, options.props, mode, includeProvenance),
|
|
298
|
+
warnings,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
const doc = archive.readXml(item.partUri);
|
|
302
|
+
const node = nodeForItem(doc, item);
|
|
303
|
+
if (!node) {
|
|
304
|
+
if (item.kind === 'notes') {
|
|
305
|
+
const properties = {
|
|
306
|
+
'text.value': prop(null, null, {
|
|
307
|
+
scope: 'default',
|
|
308
|
+
target: resolved.target,
|
|
309
|
+
path: 'text.value',
|
|
310
|
+
}),
|
|
311
|
+
};
|
|
312
|
+
return {
|
|
313
|
+
target: resolved.target,
|
|
314
|
+
uid: resolved.uid,
|
|
315
|
+
...(item.name ? { name: item.name } : {}),
|
|
316
|
+
properties: filterProps(properties, options.props, mode, includeProvenance),
|
|
317
|
+
warnings,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
warnings.push('Element XML node was not found; returning empty properties');
|
|
321
|
+
return {
|
|
322
|
+
target: resolved.target,
|
|
323
|
+
uid: resolved.uid,
|
|
324
|
+
...(item.name ? { name: item.name } : {}),
|
|
325
|
+
properties: {},
|
|
326
|
+
warnings,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
if (item.kind === 'slide' ||
|
|
330
|
+
item.kind === 'master' ||
|
|
331
|
+
item.kind === 'layout' ||
|
|
332
|
+
item.kind === 'theme') {
|
|
333
|
+
const properties = {
|
|
334
|
+
name: prop(item.name ?? null, item.name ?? null, { scope: 'local', target: resolved.target }),
|
|
335
|
+
};
|
|
336
|
+
return {
|
|
337
|
+
target: resolved.target,
|
|
338
|
+
uid: resolved.uid,
|
|
339
|
+
...(item.name ? { name: item.name } : {}),
|
|
340
|
+
properties: filterProps(properties, options.props, mode, includeProvenance),
|
|
341
|
+
warnings,
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
if (item.kind === 'notes') {
|
|
345
|
+
const text = notesBodyText(doc).replace(/\s+/g, ' ').trim();
|
|
346
|
+
const properties = {
|
|
347
|
+
'text.value': prop(text || null, text || null, {
|
|
348
|
+
scope: 'local',
|
|
349
|
+
target: resolved.target,
|
|
350
|
+
path: 'text.value',
|
|
351
|
+
}),
|
|
352
|
+
};
|
|
353
|
+
return {
|
|
354
|
+
target: resolved.target,
|
|
355
|
+
uid: resolved.uid,
|
|
356
|
+
...(item.name ? { name: item.name } : {}),
|
|
357
|
+
properties: filterProps(properties, options.props, mode, includeProvenance),
|
|
358
|
+
warnings,
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
const chain = resolveStyleChain(archive, item.partUri);
|
|
362
|
+
const themeColors = loadThemeColors(archive, chain.themePart);
|
|
363
|
+
const themeFonts = loadThemeFonts(archive, chain.themePart);
|
|
364
|
+
const all = {};
|
|
365
|
+
const name = attr(cNvPr(node), 'name') ?? null;
|
|
366
|
+
all['name'] = prop(name, name, { scope: 'local', target: resolved.target, path: 'name' });
|
|
367
|
+
const nvPr = first(node, 'nvPr');
|
|
368
|
+
const hidden = attr(nvPr, 'hidden') === '1';
|
|
369
|
+
all['visible'] = prop(!hidden, !hidden, {
|
|
370
|
+
scope: 'local',
|
|
371
|
+
target: resolved.target,
|
|
372
|
+
path: 'visible',
|
|
373
|
+
});
|
|
374
|
+
const xfrm = readTransform(node);
|
|
375
|
+
for (const [key, value] of Object.entries(xfrm)) {
|
|
376
|
+
const unit = ['x', 'y', 'width', 'height'].includes(key)
|
|
377
|
+
? 'emu'
|
|
378
|
+
: key === 'rotation'
|
|
379
|
+
? 'deg'
|
|
380
|
+
: undefined;
|
|
381
|
+
all[key] = prop(value, value, { scope: 'local', target: resolved.target, path: key }, unit);
|
|
382
|
+
}
|
|
383
|
+
const spPr = directChild(node, 'spPr') ?? first(node, 'spPr');
|
|
384
|
+
const directFill = readFillColor(spPr, themeColors);
|
|
385
|
+
all['fill.kind'] = prop(directFill?.kind ?? null, directFill?.kind ?? null, directFill
|
|
386
|
+
? { scope: 'local', target: resolved.target, path: 'fill.kind' }
|
|
387
|
+
: { scope: 'default' });
|
|
388
|
+
all['fill.color'] = prop(directFill?.color ?? null, directFill?.color ?? null, directFill?.color
|
|
389
|
+
? { scope: 'local', target: resolved.target, path: 'fill.color' }
|
|
390
|
+
: { scope: 'default' });
|
|
391
|
+
all['fill.transparency'] = prop(directFill?.transparency ?? null, directFill?.transparency ?? null, directFill?.transparency !== null && directFill?.transparency !== undefined
|
|
392
|
+
? { scope: 'local', target: resolved.target, path: 'fill.transparency' }
|
|
393
|
+
: { scope: 'default' });
|
|
394
|
+
const ln = spPr ? directChild(spPr, 'ln') : undefined;
|
|
395
|
+
if (ln && directChild(ln, 'noFill')) {
|
|
396
|
+
all['line.kind'] = prop('none', 'none', {
|
|
397
|
+
scope: 'local',
|
|
398
|
+
target: resolved.target,
|
|
399
|
+
path: 'line.kind',
|
|
400
|
+
});
|
|
401
|
+
all['line.color'] = prop(null, null, {
|
|
402
|
+
scope: 'local',
|
|
403
|
+
target: resolved.target,
|
|
404
|
+
path: 'line.color',
|
|
405
|
+
});
|
|
406
|
+
all['line.width'] = prop(null, null, { scope: 'local', target: resolved.target, path: 'line.width' }, 'pt');
|
|
407
|
+
}
|
|
408
|
+
else if (ln) {
|
|
409
|
+
const lineFill = readFillColor(ln, themeColors);
|
|
410
|
+
const w = attr(ln, 'w');
|
|
411
|
+
all['line.kind'] = prop('solid', 'solid', {
|
|
412
|
+
scope: 'local',
|
|
413
|
+
target: resolved.target,
|
|
414
|
+
path: 'line.kind',
|
|
415
|
+
});
|
|
416
|
+
all['line.color'] = prop(lineFill?.color ?? null, lineFill?.color ?? null, {
|
|
417
|
+
scope: 'local',
|
|
418
|
+
target: resolved.target,
|
|
419
|
+
path: 'line.color',
|
|
420
|
+
});
|
|
421
|
+
all['line.width'] = prop(w !== undefined ? Number(w) / EMU_PER_PT : null, w !== undefined ? Number(w) / EMU_PER_PT : null, { scope: 'local', target: resolved.target, path: 'line.width' }, 'pt');
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
all['line.kind'] = prop(null, null, { scope: 'default' });
|
|
425
|
+
all['line.color'] = prop(null, null, { scope: 'default' });
|
|
426
|
+
all['line.width'] = prop(null, null, { scope: 'default' }, 'pt');
|
|
427
|
+
}
|
|
428
|
+
const text = textOf(node).replace(/\s+/g, ' ').trim();
|
|
429
|
+
all['text.value'] = prop(text || null, text || null, {
|
|
430
|
+
scope: 'local',
|
|
431
|
+
target: resolved.target,
|
|
432
|
+
path: 'text.value',
|
|
433
|
+
});
|
|
434
|
+
const directRPr = firstRunRPr(node);
|
|
435
|
+
const directFont = readFontFromRPr(directRPr, themeFonts, themeColors);
|
|
436
|
+
const ph = placeholderOf(node);
|
|
437
|
+
let inheritedFont = {};
|
|
438
|
+
let inheritedSource;
|
|
439
|
+
if (!directFont.size || !directFont.family || !directFont.color) {
|
|
440
|
+
// Try layout placeholder shape defRPr / list style, then master txStyles.
|
|
441
|
+
if (ph && chain.layoutPart && archive.getPart(chain.layoutPart)) {
|
|
442
|
+
const layoutDoc = archive.readXml(chain.layoutPart);
|
|
443
|
+
const layoutShape = findPlaceholderShape(layoutDoc, ph.type, ph.idx);
|
|
444
|
+
if (layoutShape) {
|
|
445
|
+
const layoutRPr = firstRunRPr(layoutShape) ??
|
|
446
|
+
defRPrFromLevel(first(layoutShape, 'lstStyle')
|
|
447
|
+
? first(first(layoutShape, 'lstStyle'), 'defPPr')
|
|
448
|
+
: undefined);
|
|
449
|
+
const fromLayout = readFontFromRPr(layoutRPr, themeFonts, themeColors);
|
|
450
|
+
inheritedFont = { ...fromLayout, ...inheritedFont };
|
|
451
|
+
if (fromLayout.size || fromLayout.family || fromLayout.color) {
|
|
452
|
+
inheritedSource = {
|
|
453
|
+
scope: 'layout',
|
|
454
|
+
target: chain.layoutTarget,
|
|
455
|
+
path: 'placeholder.font',
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (chain.masterPart && archive.getPart(chain.masterPart)) {
|
|
461
|
+
const masterDoc = archive.readXml(chain.masterPart);
|
|
462
|
+
const styleKind = styleKindForPlaceholder(ph?.type);
|
|
463
|
+
const level = txStyleLevel(masterDoc, styleKind, 0);
|
|
464
|
+
const fromMaster = readFontFromRPr(defRPrFromLevel(level), themeFonts, themeColors);
|
|
465
|
+
inheritedFont = { ...fromMaster, ...inheritedFont };
|
|
466
|
+
if (!inheritedSource && (fromMaster.size || fromMaster.family || fromMaster.color)) {
|
|
467
|
+
inheritedSource = {
|
|
468
|
+
scope: 'master',
|
|
469
|
+
target: chain.masterTarget,
|
|
470
|
+
path: `textStyles.${styleKind}.level.0.font`,
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
// Also match placeholder shape on master.
|
|
474
|
+
if (ph) {
|
|
475
|
+
const masterShape = findPlaceholderShape(masterDoc, ph.type, ph.idx);
|
|
476
|
+
if (masterShape) {
|
|
477
|
+
const masterRPr = firstRunRPr(masterShape);
|
|
478
|
+
const fromMasterShape = readFontFromRPr(masterRPr, themeFonts, themeColors);
|
|
479
|
+
inheritedFont = { ...fromMasterShape, ...inheritedFont };
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (!inheritedFont.family && themeFonts.minor) {
|
|
484
|
+
inheritedFont = { ...inheritedFont, family: themeFonts.minor };
|
|
485
|
+
if (!inheritedSource)
|
|
486
|
+
inheritedSource = { scope: 'theme', target: 'theme', path: 'fontScheme.minorFont' };
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
const mergeFont = (key, propName, unit) => {
|
|
490
|
+
const direct = directFont[key] ?? null;
|
|
491
|
+
const effective = (directFont[key] ?? inheritedFont[key] ?? null);
|
|
492
|
+
const source = direct !== null && direct !== undefined
|
|
493
|
+
? { scope: 'local', target: resolved.target, path: propName }
|
|
494
|
+
: inheritedFont[key] !== undefined
|
|
495
|
+
? (inheritedSource ?? { scope: 'default' })
|
|
496
|
+
: { scope: 'default' };
|
|
497
|
+
// Refine path for master font.size
|
|
498
|
+
const refined = source?.scope === 'master' && propName.startsWith('font.')
|
|
499
|
+
? {
|
|
500
|
+
...source,
|
|
501
|
+
path: `${source.path?.replace(/\.font$/, '') ?? 'textStyles.body.level.0'}.${propName}`,
|
|
502
|
+
}
|
|
503
|
+
: source;
|
|
504
|
+
all[propName] = prop(effective, direct, refined, unit);
|
|
505
|
+
};
|
|
506
|
+
mergeFont('family', 'font.family');
|
|
507
|
+
mergeFont('size', 'font.size', 'pt');
|
|
508
|
+
mergeFont('weight', 'font.weight');
|
|
509
|
+
mergeFont('italic', 'font.italic');
|
|
510
|
+
mergeFont('underline', 'font.underline');
|
|
511
|
+
mergeFont('color', 'font.color');
|
|
512
|
+
const pPr = first(descendants(node, 'p')[0] ?? node, 'pPr');
|
|
513
|
+
const align = attr(pPr, 'algn');
|
|
514
|
+
const lvl = attr(pPr, 'lvl');
|
|
515
|
+
all['paragraph.align'] = prop(align ?? null, align ?? null, align
|
|
516
|
+
? { scope: 'local', target: resolved.target, path: 'paragraph.align' }
|
|
517
|
+
: { scope: 'default' });
|
|
518
|
+
all['paragraph.level'] = prop(lvl !== undefined ? Number(lvl) : 0, lvl !== undefined ? Number(lvl) : null, lvl !== undefined
|
|
519
|
+
? { scope: 'local', target: resolved.target, path: 'paragraph.level' }
|
|
520
|
+
: { scope: 'default' });
|
|
521
|
+
const hlink = typeof item.payload?.['hyperlink'] === 'string' ? item.payload['hyperlink'] : null;
|
|
522
|
+
all['hyperlink'] = prop(hlink, hlink, hlink ? { scope: 'local', target: resolved.target, path: 'hyperlink' } : { scope: 'default' });
|
|
523
|
+
const phType = typeof item.payload?.['placeholder'] === 'string' ? item.payload['placeholder'] : null;
|
|
524
|
+
all['placeholder'] = prop(phType, phType, phType
|
|
525
|
+
? { scope: 'local', target: resolved.target, path: 'placeholder' }
|
|
526
|
+
: { scope: 'default' });
|
|
527
|
+
return {
|
|
528
|
+
target: resolved.target,
|
|
529
|
+
uid: resolved.uid,
|
|
530
|
+
...(name ? { name } : {}),
|
|
531
|
+
properties: filterProps(all, options.props, mode, includeProvenance),
|
|
532
|
+
warnings,
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
/** Map Phase-1 dotted property names to legacy setProperties keys. */
|
|
536
|
+
export const mapDottedProperties = (properties) => {
|
|
537
|
+
const out = {};
|
|
538
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
539
|
+
switch (key) {
|
|
540
|
+
case 'font.family':
|
|
541
|
+
out['fontFamily'] = value;
|
|
542
|
+
break;
|
|
543
|
+
case 'font.size':
|
|
544
|
+
out['fontSize'] = value;
|
|
545
|
+
break;
|
|
546
|
+
case 'font.weight':
|
|
547
|
+
out['bold'] = value === 'bold' || value === true;
|
|
548
|
+
break;
|
|
549
|
+
case 'font.italic':
|
|
550
|
+
out['italic'] = value;
|
|
551
|
+
break;
|
|
552
|
+
case 'font.underline':
|
|
553
|
+
out['underline'] = value;
|
|
554
|
+
break;
|
|
555
|
+
case 'font.color':
|
|
556
|
+
out['textColor'] = typeof value === 'string' ? value.replace(/^#/, '') : value;
|
|
557
|
+
break;
|
|
558
|
+
case 'fill.color':
|
|
559
|
+
out['fill'] = typeof value === 'string' ? value.replace(/^#/, '') : value;
|
|
560
|
+
break;
|
|
561
|
+
case 'fill.kind':
|
|
562
|
+
if (value === 'none')
|
|
563
|
+
out['fill'] = 'none';
|
|
564
|
+
break;
|
|
565
|
+
case 'fill.transparency':
|
|
566
|
+
// Stored via fill object when combined; ignore alone for now.
|
|
567
|
+
break;
|
|
568
|
+
case 'line.color':
|
|
569
|
+
case 'line.kind':
|
|
570
|
+
case 'line.width':
|
|
571
|
+
case 'line.dash': {
|
|
572
|
+
const line = out['line'] ?? {};
|
|
573
|
+
if (key === 'line.color' && typeof value === 'string')
|
|
574
|
+
line['color'] = value.replace(/^#/, '');
|
|
575
|
+
else if (key === 'line.kind' && value === 'none')
|
|
576
|
+
out['line'] = 'none';
|
|
577
|
+
else if (key === 'line.width')
|
|
578
|
+
line['width'] = value;
|
|
579
|
+
else if (key === 'line.dash')
|
|
580
|
+
line['dash'] = value;
|
|
581
|
+
if (out['line'] !== 'none')
|
|
582
|
+
out['line'] = { ...line };
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
case 'text.value':
|
|
586
|
+
out['text'] = value;
|
|
587
|
+
break;
|
|
588
|
+
case 'name':
|
|
589
|
+
out['name'] = value;
|
|
590
|
+
break;
|
|
591
|
+
case 'visible':
|
|
592
|
+
out['hidden'] = value === false;
|
|
593
|
+
break;
|
|
594
|
+
case 'paragraph.align':
|
|
595
|
+
out['paragraph.align'] = value;
|
|
596
|
+
break;
|
|
597
|
+
case 'paragraph.level':
|
|
598
|
+
out['paragraph.level'] = typeof value === 'string' ? Number(value) : value;
|
|
599
|
+
break;
|
|
600
|
+
case 'bullet':
|
|
601
|
+
out['bullet'] = value;
|
|
602
|
+
break;
|
|
603
|
+
case 'hyperlink':
|
|
604
|
+
out['hyperlink'] = value === '' ? null : value;
|
|
605
|
+
break;
|
|
606
|
+
default:
|
|
607
|
+
out[key] = value;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
// Combine fill.color + transparency
|
|
611
|
+
if ('fill.color' in properties || 'fill.transparency' in properties) {
|
|
612
|
+
const color = properties['fill.color'];
|
|
613
|
+
const transparency = properties['fill.transparency'];
|
|
614
|
+
if (typeof color === 'string') {
|
|
615
|
+
out['fill'] =
|
|
616
|
+
transparency !== undefined
|
|
617
|
+
? { type: 'solid', color: color.replace(/^#/, ''), transparency }
|
|
618
|
+
: color.replace(/^#/, '');
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return out;
|
|
622
|
+
};
|
|
623
|
+
//# sourceMappingURL=resolve-properties.js.map
|