@usejunior/docx-core 0.23.0 → 0.24.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/.tsbuildinfo +1 -1
- package/dist/generation/emit/document-part.d.ts +7 -5
- package/dist/generation/emit/document-part.d.ts.map +1 -1
- package/dist/generation/emit/document-part.js +23 -5
- package/dist/generation/emit/document-part.js.map +1 -1
- package/dist/generation/emit/font-table-part.d.ts +3 -2
- package/dist/generation/emit/font-table-part.d.ts.map +1 -1
- package/dist/generation/emit/font-table-part.js +7 -6
- package/dist/generation/emit/font-table-part.js.map +1 -1
- package/dist/generation/emit/properties.d.ts +2 -2
- package/dist/generation/emit/properties.d.ts.map +1 -1
- package/dist/generation/emit/properties.js +11 -10
- package/dist/generation/emit/properties.js.map +1 -1
- package/dist/generation/emit/styles-part.d.ts +2 -0
- package/dist/generation/emit/styles-part.d.ts.map +1 -1
- package/dist/generation/emit/styles-part.js +28 -13
- package/dist/generation/emit/styles-part.js.map +1 -1
- package/dist/generation/index.d.ts +1 -1
- package/dist/generation/index.d.ts.map +1 -1
- package/dist/generation/types.d.ts +23 -1
- package/dist/generation/types.d.ts.map +1 -1
- package/dist/generation/types.js.map +1 -1
- package/dist/generation/validate-spec.d.ts.map +1 -1
- package/dist/generation/validate-spec.js +25 -0
- package/dist/generation/validate-spec.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +1 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/structural_validation.d.ts +54 -0
- package/dist/primitives/structural_validation.d.ts.map +1 -0
- package/dist/primitives/structural_validation.js +301 -0
- package/dist/primitives/structural_validation.js.map +1 -0
- package/dist/primitives/styles.d.ts +39 -17
- package/dist/primitives/styles.d.ts.map +1 -1
- package/dist/primitives/styles.js +412 -89
- package/dist/primitives/styles.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { getParagraphBookmarkId } from './bookmarks.js';
|
|
2
|
+
import { getDirectChildrenByName } from './dom-helpers.js';
|
|
3
|
+
function hierarchyLevel(node) {
|
|
4
|
+
if (!node)
|
|
5
|
+
return null;
|
|
6
|
+
if (node.heading?.level != null && (node.heading.source === 'word_style'
|
|
7
|
+
|| node.heading.source === 'list_metadata'
|
|
8
|
+
|| node.heading.source === 'outline_level'))
|
|
9
|
+
return node.heading.level;
|
|
10
|
+
if (node.numbering.is_auto_numbered && node.numbering.ilvl != null)
|
|
11
|
+
return node.numbering.ilvl + 1;
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
function structuralStyle(node) {
|
|
15
|
+
return node?.paragraph_style_id ?? node?.style ?? '';
|
|
16
|
+
}
|
|
17
|
+
const parentChildSlicing = (nodes, context) => {
|
|
18
|
+
const anchorIndex = nodes.findIndex((node) => node.id === context.anchorId);
|
|
19
|
+
const source = nodes.find((node) => node.id === (context.styleSourceId ?? context.anchorId));
|
|
20
|
+
if (anchorIndex < 0 || !source)
|
|
21
|
+
return [];
|
|
22
|
+
const intendedLevel = hierarchyLevel(source);
|
|
23
|
+
if (intendedLevel == null)
|
|
24
|
+
return [];
|
|
25
|
+
// The insertion lands in the gap between `gapIndex` and `gapIndex + 1`.
|
|
26
|
+
const gapIndex = context.position === 'AFTER' ? anchorIndex : anchorIndex - 1;
|
|
27
|
+
// The run the new paragraph would capture: every following paragraph until
|
|
28
|
+
// one at or above the intended level.
|
|
29
|
+
let firstCaptured;
|
|
30
|
+
let lastCapturedId;
|
|
31
|
+
for (let index = gapIndex + 1; index < nodes.length; index += 1) {
|
|
32
|
+
const level = hierarchyLevel(nodes[index]);
|
|
33
|
+
if (level != null && level <= intendedLevel)
|
|
34
|
+
break;
|
|
35
|
+
if (level != null && !firstCaptured)
|
|
36
|
+
firstCaptured = { id: nodes[index].id, level };
|
|
37
|
+
lastCapturedId = nodes[index].id;
|
|
38
|
+
}
|
|
39
|
+
if (!firstCaptured)
|
|
40
|
+
return [];
|
|
41
|
+
// Slicing only happens when the captured paragraph already has a parent
|
|
42
|
+
// before the gap: the insertion would steal it from that parent.
|
|
43
|
+
let hasExistingParent = false;
|
|
44
|
+
for (let index = gapIndex; index >= 0; index -= 1) {
|
|
45
|
+
const level = hierarchyLevel(nodes[index]);
|
|
46
|
+
if (level != null && level < firstCaptured.level) {
|
|
47
|
+
hasExistingParent = true;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!hasExistingParent)
|
|
52
|
+
return [];
|
|
53
|
+
const suggestedAnchorId = lastCapturedId;
|
|
54
|
+
return [{
|
|
55
|
+
code: 'PARENT_CHILD_SLICE',
|
|
56
|
+
severity: 'error',
|
|
57
|
+
operation_id: context.operationId,
|
|
58
|
+
anchor_id: context.anchorId,
|
|
59
|
+
message: `Insertion ${context.operationId} would separate ${firstCaptured.id} from its existing parent; insert after ${suggestedAnchorId} instead.`,
|
|
60
|
+
evidence: {
|
|
61
|
+
anchor_level: hierarchyLevel(nodes[anchorIndex]),
|
|
62
|
+
intended_level: intendedLevel,
|
|
63
|
+
first_descendant_id: firstCaptured.id,
|
|
64
|
+
first_descendant_level: firstCaptured.level,
|
|
65
|
+
style_source_id: context.styleSourceId,
|
|
66
|
+
},
|
|
67
|
+
suggested_anchor_id: suggestedAnchorId,
|
|
68
|
+
suggested_position: 'AFTER',
|
|
69
|
+
}];
|
|
70
|
+
};
|
|
71
|
+
const listLevelMismatch = (nodes, context) => {
|
|
72
|
+
const anchor = nodes.find((node) => node.id === context.anchorId);
|
|
73
|
+
const source = nodes.find((node) => node.id === (context.styleSourceId ?? context.anchorId));
|
|
74
|
+
if (!anchor?.numbering.is_auto_numbered || !source?.numbering.is_auto_numbered)
|
|
75
|
+
return [];
|
|
76
|
+
if (anchor.numbering.ilvl == null || source.numbering.ilvl == null || anchor.numbering.ilvl === source.numbering.ilvl)
|
|
77
|
+
return [];
|
|
78
|
+
return [{
|
|
79
|
+
code: 'LIST_LEVEL_MISMATCH',
|
|
80
|
+
severity: 'warning',
|
|
81
|
+
operation_id: context.operationId,
|
|
82
|
+
anchor_id: context.anchorId,
|
|
83
|
+
message: `Insertion ${context.operationId} uses list level ${source.numbering.ilvl} beside level ${anchor.numbering.ilvl}; confirm that nesting is intentional.`,
|
|
84
|
+
evidence: {
|
|
85
|
+
anchor_level: anchor.numbering.ilvl + 1,
|
|
86
|
+
intended_level: source.numbering.ilvl + 1,
|
|
87
|
+
style_source_id: context.styleSourceId,
|
|
88
|
+
anchor_num_id: anchor.numbering.num_id ?? undefined,
|
|
89
|
+
style_source_num_id: source.numbering.num_id ?? undefined,
|
|
90
|
+
},
|
|
91
|
+
}];
|
|
92
|
+
};
|
|
93
|
+
const midListRenumbering = (nodes, context) => {
|
|
94
|
+
const anchorIndex = nodes.findIndex((node) => node.id === context.anchorId);
|
|
95
|
+
const source = nodes.find((node) => node.id === (context.styleSourceId ?? context.anchorId));
|
|
96
|
+
if (anchorIndex < 0 || !source?.numbering.is_auto_numbered)
|
|
97
|
+
return [];
|
|
98
|
+
const anchor = nodes[anchorIndex];
|
|
99
|
+
const neighbor = context.position === 'AFTER' ? nodes[anchorIndex + 1] : nodes[anchorIndex - 1];
|
|
100
|
+
if (!anchor.numbering.is_auto_numbered || !neighbor?.numbering.is_auto_numbered)
|
|
101
|
+
return [];
|
|
102
|
+
const sameListWindow = anchor.numbering.num_id != null
|
|
103
|
+
&& anchor.numbering.num_id === neighbor.numbering.num_id
|
|
104
|
+
&& anchor.numbering.ilvl === neighbor.numbering.ilvl;
|
|
105
|
+
if (!sameListWindow || source.numbering.num_id == null || source.numbering.num_id === anchor.numbering.num_id)
|
|
106
|
+
return [];
|
|
107
|
+
return [{
|
|
108
|
+
code: 'MID_LIST_RENUMBERING',
|
|
109
|
+
severity: 'error',
|
|
110
|
+
operation_id: context.operationId,
|
|
111
|
+
anchor_id: context.anchorId,
|
|
112
|
+
message: `Insertion ${context.operationId} would introduce numbering ${source.numbering.num_id} inside list ${anchor.numbering.num_id}; use a peer from the surrounding list.`,
|
|
113
|
+
evidence: {
|
|
114
|
+
anchor_level: hierarchyLevel(anchor),
|
|
115
|
+
intended_level: hierarchyLevel(source),
|
|
116
|
+
style_source_id: context.styleSourceId,
|
|
117
|
+
anchor_num_id: anchor.numbering.num_id ?? undefined,
|
|
118
|
+
style_source_num_id: source.numbering.num_id ?? undefined,
|
|
119
|
+
},
|
|
120
|
+
suggested_anchor_id: anchor.id,
|
|
121
|
+
}];
|
|
122
|
+
};
|
|
123
|
+
export const structuralValidators = [
|
|
124
|
+
parentChildSlicing,
|
|
125
|
+
listLevelMismatch,
|
|
126
|
+
midListRenumbering,
|
|
127
|
+
];
|
|
128
|
+
export function validateStructuralInsertion(nodes, context) {
|
|
129
|
+
return structuralValidators.flatMap((validator) => validator(nodes, context));
|
|
130
|
+
}
|
|
131
|
+
export function validateStructuralInsertions(nodes, contexts, options = {}) {
|
|
132
|
+
const diagnostics = contexts.flatMap((context) => validateStructuralInsertion(nodes, context));
|
|
133
|
+
diagnostics.push(...validateBondedPairs(nodes, contexts, options));
|
|
134
|
+
return diagnostics;
|
|
135
|
+
}
|
|
136
|
+
function sourceNode(nodes, context) {
|
|
137
|
+
return nodes.find((node) => node.id === (context.styleSourceId ?? context.anchorId));
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* A heading style is bonded to a follower style only when the source shows the
|
|
141
|
+
* Word run-in construction (a style-separator paragraph mark on the heading)
|
|
142
|
+
* followed by the same follower style at the same indent, at least twice.
|
|
143
|
+
* Title casing and punctuation are not structural authorities.
|
|
144
|
+
*/
|
|
145
|
+
function bondedTransitions(nodes, options) {
|
|
146
|
+
const runInHeadingIds = options.runInHeadingIds;
|
|
147
|
+
if (!runInHeadingIds || runInHeadingIds.size === 0)
|
|
148
|
+
return [];
|
|
149
|
+
const transitions = new Map();
|
|
150
|
+
for (let index = 0; index < nodes.length - 1; index += 1) {
|
|
151
|
+
const heading = nodes[index];
|
|
152
|
+
const body = nodes[index + 1];
|
|
153
|
+
if (!runInHeadingIds.has(heading.id))
|
|
154
|
+
continue;
|
|
155
|
+
if (hierarchyLevel(heading) == null || hierarchyLevel(body) != null)
|
|
156
|
+
continue;
|
|
157
|
+
if (Math.abs(heading.paragraph_indents_pt.left - body.paragraph_indents_pt.left) > 0.5)
|
|
158
|
+
continue;
|
|
159
|
+
const headingStyle = structuralStyle(heading);
|
|
160
|
+
const bodyStyle = structuralStyle(body);
|
|
161
|
+
if (!headingStyle || !bodyStyle || headingStyle === bodyStyle)
|
|
162
|
+
continue;
|
|
163
|
+
const key = `${headingStyle}\u0000${bodyStyle}`;
|
|
164
|
+
const current = transitions.get(key);
|
|
165
|
+
transitions.set(key, { headingStyle, bodyStyle, count: (current?.count ?? 0) + 1 });
|
|
166
|
+
}
|
|
167
|
+
return [...transitions.values()].filter((transition) => transition.count >= 2);
|
|
168
|
+
}
|
|
169
|
+
function validateBondedPairs(nodes, contexts, options) {
|
|
170
|
+
const bonded = bondedTransitions(nodes, options);
|
|
171
|
+
if (bonded.length === 0)
|
|
172
|
+
return [];
|
|
173
|
+
const diagnostics = [];
|
|
174
|
+
// Group operations by insertion slot. Repeated AFTER insertion lands each
|
|
175
|
+
// new paragraph directly after the anchor, so the slot's document order is
|
|
176
|
+
// the reverse of operation order; repeated BEFORE preserves operation order.
|
|
177
|
+
const slots = new Map();
|
|
178
|
+
contexts.forEach((context, index) => {
|
|
179
|
+
const key = `${context.anchorId}\u0000${context.position}`;
|
|
180
|
+
slots.set(key, [...(slots.get(key) ?? []), index]);
|
|
181
|
+
});
|
|
182
|
+
for (const operationIndexes of slots.values()) {
|
|
183
|
+
const position = contexts[operationIndexes[0]].position;
|
|
184
|
+
const documentOrder = position === 'AFTER' ? [...operationIndexes].reverse() : operationIndexes;
|
|
185
|
+
const styleOf = (operationIndex) => structuralStyle(sourceNode(nodes, contexts[operationIndex]));
|
|
186
|
+
const consumedBodies = new Set();
|
|
187
|
+
const unpaired = [];
|
|
188
|
+
documentOrder.forEach((operationIndex, slotIndex) => {
|
|
189
|
+
// Only a run-in heading source binds a body; an ordinary paragraph that
|
|
190
|
+
// happens to share the run-in style (e.g. a Heading2 with Heading3
|
|
191
|
+
// children) does not.
|
|
192
|
+
const headingSource = sourceNode(nodes, contexts[operationIndex]);
|
|
193
|
+
if (!headingSource || !options.runInHeadingIds?.has(headingSource.id))
|
|
194
|
+
return;
|
|
195
|
+
const candidatePairs = bonded.filter((transition) => transition.headingStyle === styleOf(operationIndex));
|
|
196
|
+
if (candidatePairs.length === 0)
|
|
197
|
+
return;
|
|
198
|
+
const next = documentOrder[slotIndex + 1];
|
|
199
|
+
const nextStyle = next == null ? undefined : styleOf(next);
|
|
200
|
+
const adjacentPair = candidatePairs.find((pair) => pair.bodyStyle === nextStyle);
|
|
201
|
+
if (next != null && adjacentPair && !consumedBodies.has(next)) {
|
|
202
|
+
consumedBodies.add(next);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
unpaired.push({ operationIndex, candidatePairs });
|
|
206
|
+
});
|
|
207
|
+
for (const { operationIndex, candidatePairs } of unpaired) {
|
|
208
|
+
const context = contexts[operationIndex];
|
|
209
|
+
const source = sourceNode(nodes, context);
|
|
210
|
+
const availableBodyStyles = new Set(operationIndexes
|
|
211
|
+
.filter((index) => !consumedBodies.has(index))
|
|
212
|
+
.map(styleOf));
|
|
213
|
+
const matchingPairs = candidatePairs.filter((pair) => availableBodyStyles.has(pair.bodyStyle));
|
|
214
|
+
const baseEvidence = {
|
|
215
|
+
anchor_level: hierarchyLevel(nodes.find((node) => node.id === context.anchorId)),
|
|
216
|
+
intended_level: hierarchyLevel(source),
|
|
217
|
+
style_source_id: context.styleSourceId,
|
|
218
|
+
};
|
|
219
|
+
if (candidatePairs.length > 1 && matchingPairs.length !== 1) {
|
|
220
|
+
const candidates = candidatePairs.map((pair) => pair.bodyStyle).sort();
|
|
221
|
+
diagnostics.push({
|
|
222
|
+
code: 'BONDED_PARAGRAPH_PAIR_AMBIGUOUS', severity: 'error', operation_id: context.operationId,
|
|
223
|
+
anchor_id: context.anchorId,
|
|
224
|
+
message: `Style ${structuralStyle(source)} has multiple repeated run-in body followers (${candidates.join(', ')}); supply exactly one matching body peer immediately after the heading in this insertion slot.`,
|
|
225
|
+
evidence: { ...baseEvidence, bonded_heading_style: structuralStyle(source), bonded_body_style_candidates: candidates },
|
|
226
|
+
});
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
const pair = matchingPairs[0] ?? candidatePairs[0];
|
|
230
|
+
const evidence = { ...baseEvidence, bonded_heading_style: pair.headingStyle, bonded_body_style: pair.bodyStyle };
|
|
231
|
+
if (matchingPairs.length === 0) {
|
|
232
|
+
diagnostics.push({
|
|
233
|
+
code: 'BONDED_PARAGRAPH_PAIR_REQUIRED', severity: 'error', operation_id: context.operationId,
|
|
234
|
+
anchor_id: context.anchorId,
|
|
235
|
+
message: `Style ${pair.headingStyle} is a run-in heading repeatedly followed by ${pair.bodyStyle}; insert both paragraphs with distinct structural peers.`,
|
|
236
|
+
evidence,
|
|
237
|
+
});
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
const requiredOrder = position === 'AFTER'
|
|
241
|
+
? `${pair.bodyStyle} immediately before ${pair.headingStyle}`
|
|
242
|
+
: `${pair.headingStyle} immediately before ${pair.bodyStyle}`;
|
|
243
|
+
diagnostics.push({
|
|
244
|
+
code: 'RUN_IN_PAIR_ORDER', severity: 'error', operation_id: context.operationId,
|
|
245
|
+
anchor_id: context.anchorId,
|
|
246
|
+
message: `For repeated ${position} insertion, order operations ${requiredOrder} so the document yields each heading directly followed by its body.`,
|
|
247
|
+
evidence,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return diagnostics;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Paragraph ids whose paragraph mark carries `w:specVanish` (Word's style
|
|
255
|
+
* separator), i.e. headings that render run-in with the next paragraph.
|
|
256
|
+
*/
|
|
257
|
+
export function collectRunInHeadingIds(paragraphs) {
|
|
258
|
+
const ids = new Set();
|
|
259
|
+
for (const paragraph of paragraphs) {
|
|
260
|
+
if (!isRunInHeadingParagraph(paragraph))
|
|
261
|
+
continue;
|
|
262
|
+
const id = getParagraphBookmarkId(paragraph);
|
|
263
|
+
if (id)
|
|
264
|
+
ids.add(id);
|
|
265
|
+
}
|
|
266
|
+
return ids;
|
|
267
|
+
}
|
|
268
|
+
export function isRunInHeadingParagraph(paragraph) {
|
|
269
|
+
const pPr = getDirectChildrenByName(paragraph, 'pPr')[0];
|
|
270
|
+
const markRPr = pPr ? getDirectChildrenByName(pPr, 'rPr')[0] : undefined;
|
|
271
|
+
const specVanish = markRPr ? getDirectChildrenByName(markRPr, 'specVanish')[0] : undefined;
|
|
272
|
+
if (!specVanish)
|
|
273
|
+
return false;
|
|
274
|
+
const value = (specVanish.getAttribute('w:val') ?? '').trim().toLowerCase();
|
|
275
|
+
return value !== '0' && value !== 'false' && value !== 'off';
|
|
276
|
+
}
|
|
277
|
+
/** True only for the explicit two-operation form of a source-proven bonded pair. */
|
|
278
|
+
export function isRecognizedBondedInsertionPair(nodes, contexts, options = {}) {
|
|
279
|
+
if (contexts.length !== 2)
|
|
280
|
+
return false;
|
|
281
|
+
const [first, second] = contexts;
|
|
282
|
+
if (!first || !second || first.anchorId !== second.anchorId || first.position !== second.position)
|
|
283
|
+
return false;
|
|
284
|
+
const sources = contexts.map((context) => sourceNode(nodes, context));
|
|
285
|
+
if (!sources[0] || !sources[1] || structuralStyle(sources[0]) === structuralStyle(sources[1]))
|
|
286
|
+
return false;
|
|
287
|
+
const headingIndex = sources.findIndex((source) => hierarchyLevel(source) != null);
|
|
288
|
+
const bodyIndex = sources.findIndex((source) => hierarchyLevel(source) == null);
|
|
289
|
+
if (headingIndex < 0 || bodyIndex < 0)
|
|
290
|
+
return false;
|
|
291
|
+
if (!options.runInHeadingIds?.has(sources[headingIndex].id))
|
|
292
|
+
return false;
|
|
293
|
+
const headingStyle = structuralStyle(sources[headingIndex]);
|
|
294
|
+
const bodyStyle = structuralStyle(sources[bodyIndex]);
|
|
295
|
+
const proven = bondedTransitions(nodes, options)
|
|
296
|
+
.some((transition) => transition.headingStyle === headingStyle && transition.bodyStyle === bodyStyle);
|
|
297
|
+
if (!proven)
|
|
298
|
+
return false;
|
|
299
|
+
return !validateBondedPairs(nodes, contexts, options).length;
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=structural_validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural_validation.js","sourceRoot":"","sources":["../../src/primitives/structural_validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAsD3D,SAAS,cAAc,CAAC,IAAkC;IACxD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,IAAI,IAAI,CACjC,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,YAAY;WACjC,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,eAAe;WACvC,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,eAAe,CAC3C;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IAC7B,IAAI,IAAI,CAAC,SAAS,CAAC,gBAAgB,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC;IACnG,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CAAC,IAAkC;IACzD,OAAO,IAAI,EAAE,kBAAkB,IAAI,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,kBA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G,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC;SAC7C,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,YAAY,KAAK,YAAY,IAAI,UAAU,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;IACxG,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC;AAC/D,CAAC"}
|
|
@@ -5,6 +5,14 @@ export type StyleDef = {
|
|
|
5
5
|
basedOn: string | null;
|
|
6
6
|
pPr: Element | null;
|
|
7
7
|
rPr: Element | null;
|
|
8
|
+
/**
|
|
9
|
+
* Table styles only: the style's own `w:tblPr` (read for
|
|
10
|
+
* `w:tblStyleRowBandSize` / `w:tblStyleColBandSize`), and the `w:rPr` of
|
|
11
|
+
* each conditional `w:tblStylePr`, keyed by its `w:type`. Optional so
|
|
12
|
+
* hand-built models remain source-compatible.
|
|
13
|
+
*/
|
|
14
|
+
tblPr?: Element | null;
|
|
15
|
+
conditionalRPrs?: Map<string, Element>;
|
|
8
16
|
};
|
|
9
17
|
export type StylesModel = {
|
|
10
18
|
byId: Map<string, StyleDef>;
|
|
@@ -16,11 +24,18 @@ export type StylesModel = {
|
|
|
16
24
|
* defaults.
|
|
17
25
|
*/
|
|
18
26
|
docDefaultsRPr?: Element | null;
|
|
27
|
+
/**
|
|
28
|
+
* The `w:styleId` of the default table style (`w:type="table"` with
|
|
29
|
+
* `w:default="1"`), which applies to a table that names no `w:tblStyle`.
|
|
30
|
+
*/
|
|
31
|
+
defaultTableStyleId?: string | null;
|
|
19
32
|
/**
|
|
20
33
|
* Every `w:rPr` carried by a table style, including the conditional
|
|
21
|
-
* `w:tblStylePr/w:rPr` blocks.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
34
|
+
* `w:tblStylePr/w:rPr` blocks.
|
|
35
|
+
*
|
|
36
|
+
* @deprecated No longer read: {@link extractEffectiveRunFormatting} resolves
|
|
37
|
+
* table styles from the run's table context since #1159. Still populated so
|
|
38
|
+
* existing readers keep compiling.
|
|
24
39
|
*/
|
|
25
40
|
tableStyleRPrs?: Element[];
|
|
26
41
|
};
|
|
@@ -52,10 +67,6 @@ export declare function extractParagraphFormatting(pPr: Element | null, styles:
|
|
|
52
67
|
/**
|
|
53
68
|
* Effective run formatting. `null` means the resolver could not establish the
|
|
54
69
|
* property, and never stands in for a rendered default. That happens when:
|
|
55
|
-
* - no layer the resolver reads above `w:docDefaults` declares the property,
|
|
56
|
-
* the run is inside a table, and a table style's run properties declare a
|
|
57
|
-
* value that differs from what `w:docDefaults` (or the OOXML default) gives
|
|
58
|
-
* — table styles sit above document defaults and are not read;
|
|
59
70
|
* - the nearest layer that declares it does so through a theme colour or
|
|
60
71
|
* theme font reference that cannot be resolved (no theme, or no matching
|
|
61
72
|
* theme entry, and no explicit fallback value); or
|
|
@@ -109,8 +120,9 @@ export declare function extractStyleRunFormatting(styles: StylesModel, styleId:
|
|
|
109
120
|
* the run declares. Ordinary properties are taken from the first layer that
|
|
110
121
|
* specifies them: direct `w:rPr` on the run, then the `w:rStyle`
|
|
111
122
|
* character-style `basedOn` chain, then the paragraph mark's `w:rPr` inside
|
|
112
|
-
* `pPr`, then the paragraph style's `basedOn` chain,
|
|
113
|
-
* document defaults
|
|
123
|
+
* `pPr`, then the paragraph style's `basedOn` chain, then — for a run inside
|
|
124
|
+
* a table — the table style, and finally the document defaults
|
|
125
|
+
* (`w:docDefaults/w:rPrDefault/w:rPr`).
|
|
114
126
|
*
|
|
115
127
|
* Each property is resolved independently down the chain — a style that
|
|
116
128
|
* specifies only color does not mask an ancestor's bold.
|
|
@@ -125,14 +137,21 @@ export declare function extractStyleRunFormatting(styles: StylesModel, styleId:
|
|
|
125
137
|
* Document defaults seed toggle evaluation as an absolute base value rather
|
|
126
138
|
* than acting as another parity level (see {@link resolveToggleProperty}).
|
|
127
139
|
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
140
|
+
* Table styles (#1159): the table context is read from the run's ancestors —
|
|
141
|
+
* the innermost `w:tbl`, its `w:tblStyle` (or the default table style), the
|
|
142
|
+
* `basedOn` chain, `w:tblLook`, and the cell's row and column. The style's
|
|
143
|
+
* `w:rPr` and every conditional `w:tblStylePr/w:rPr` that applies to the
|
|
144
|
+
* cell merge into one layer between the document defaults and the paragraph
|
|
145
|
+
* style (see {@link tableStyleLayers} for the order). For toggles the
|
|
146
|
+
* merged layer's nearest declaration resets the value rather than toggling
|
|
147
|
+
* it: the standard says a table style toggles like any other style, but Word
|
|
148
|
+
* assigns the declared value (MS-OI29500 note on § 17.7.6), and this follows
|
|
149
|
+
* Word.
|
|
150
|
+
*
|
|
151
|
+
* @see https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/14452bbe-be4d-4dbb-90e6-3d23ae9361bc
|
|
152
|
+
*
|
|
153
|
+
* Numbering-level `rPr` formats only the list label (`w:lvlText`), never the
|
|
154
|
+
* paragraph's runs, so it is out of scope.
|
|
136
155
|
*
|
|
137
156
|
* Part of docx-core's public surface (see `src/index.ts`) so external
|
|
138
157
|
* diagnostics — `scripts/check_docx_formatting_loss.mjs` today, the planned
|
|
@@ -147,11 +166,14 @@ export declare function extractStyleRunFormatting(styles: StylesModel, styleId:
|
|
|
147
166
|
* @param params.theme the model produced by {@link parseThemeXml}; when
|
|
148
167
|
* omitted, direct font/color fallbacks retain their previous behavior
|
|
149
168
|
*
|
|
169
|
+
* @conformance ECMA-376 edition 5, Part 1 § 17.7.2
|
|
150
170
|
* @conformance ECMA-376 edition 5, Part 1 § 17.7.3
|
|
151
171
|
* @conformance ECMA-376 edition 5, Part 1 § 17.7.5.1
|
|
172
|
+
* @conformance ECMA-376 edition 5, Part 1 § 17.7.6
|
|
152
173
|
* @see https://github.com/UseJunior/safe-docx/issues/737
|
|
153
174
|
* @see https://github.com/UseJunior/safe-docx/issues/752
|
|
154
175
|
* @see https://github.com/UseJunior/safe-docx/issues/753
|
|
176
|
+
* @see https://github.com/UseJunior/safe-docx/issues/1159
|
|
155
177
|
*/
|
|
156
178
|
export declare function extractEffectiveRunFormatting(params: {
|
|
157
179
|
run: Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/primitives/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/primitives/styles.ts"],"names":[],"mappings":"AAkDA,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IACpB,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IACpB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC5B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,GAAG,CAAC,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