ooxml-core 1.3.0 → 1.4.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/README.md +2 -0
- package/dist/automation/index.cjs +5785 -5295
- package/dist/automation/index.mjs +5785 -5295
- package/dist/teams/index.cjs +72 -23
- package/dist/teams/index.mjs +72 -23
- package/dist/visio/edit-commands.d.ts +11 -2
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-page-size.d.ts +5 -0
- package/dist/visio/edit-page-size.d.ts.map +1 -0
- package/dist/visio/edit-pages.d.ts.map +1 -1
- package/dist/visio/edit-text-range-commands.d.ts +21 -0
- package/dist/visio/edit-text-range-commands.d.ts.map +1 -0
- package/dist/visio/edit-text-range-plan.d.ts +7 -0
- package/dist/visio/edit-text-range-plan.d.ts.map +1 -0
- package/dist/visio/edit-text-ranges.d.ts +4 -0
- package/dist/visio/edit-text-ranges.d.ts.map +1 -0
- package/dist/visio/edit-text-target.d.ts +3 -0
- package/dist/visio/edit-text-target.d.ts.map +1 -0
- package/dist/visio/edit-text.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +395 -27
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +395 -27
- package/dist/visio/model.d.ts +3 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +134 -11
- package/dist/visio/ui/index.d.ts +1 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +130 -12
- package/dist/visio/ui/page-size.d.ts +31 -0
- package/dist/visio/ui/page-size.d.ts.map +1 -0
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/ui/text-replace-types.d.ts +6 -2
- package/dist/visio/ui/text-replace-types.d.ts.map +1 -1
- package/dist/visio/ui/text-replace.d.ts +3 -4
- package/dist/visio/ui/text-replace.d.ts.map +1 -1
- package/dist/visio/xml-validation.d.ts.map +1 -1
- package/dist/xlsx/collab/codec.d.ts +2 -0
- package/dist/xlsx/collab/codec.d.ts.map +1 -1
- package/dist/xlsx/collab/index.cjs +5 -0
- package/dist/xlsx/collab/index.mjs +5 -0
- package/dist/xlsx/display-text.d.ts +4 -0
- package/dist/xlsx/display-text.d.ts.map +1 -0
- package/dist/xlsx/edit/cell-values.d.ts +4 -3
- package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard.d.ts.map +1 -1
- package/dist/xlsx/edit/context.d.ts +7 -5
- package/dist/xlsx/edit/context.d.ts.map +1 -1
- package/dist/xlsx/edit/deps.d.ts +1 -1
- package/dist/xlsx/edit/deps.d.ts.map +1 -1
- package/dist/xlsx/edit/dimensions.d.ts.map +1 -1
- package/dist/xlsx/edit/fill.d.ts.map +1 -1
- package/dist/xlsx/edit/filter.d.ts.map +1 -1
- package/dist/xlsx/edit/find.d.ts.map +1 -1
- package/dist/xlsx/edit/paste-selection.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-formulas.d.ts +10 -4
- package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
- package/dist/xlsx/edit/table-header-names.d.ts +3 -0
- package/dist/xlsx/edit/table-header-names.d.ts.map +1 -0
- package/dist/xlsx/edit/tables.d.ts +1 -2
- package/dist/xlsx/edit/tables.d.ts.map +1 -1
- package/dist/xlsx/filter-rows.d.ts +8 -0
- package/dist/xlsx/filter-rows.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/math-sum.d.ts.map +1 -1
- package/dist/xlsx/formula/table-refs.d.ts +2 -0
- package/dist/xlsx/formula/table-refs.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +445 -323
- package/dist/xlsx/index.mjs +445 -323
- package/dist/xlsx/load/index.cjs +7621 -7585
- package/dist/xlsx/load/index.mjs +7621 -7585
- package/dist/xlsx/model.d.ts +4 -0
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +443 -323
- package/dist/xlsx/ui/index.mjs +443 -323
- package/dist/xlsx/ui/locales/de/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/shell.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/shell.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/visio/index.cjs
CHANGED
|
@@ -233,6 +233,19 @@ var attribute = new RegExp(
|
|
|
233
233
|
"uy"
|
|
234
234
|
);
|
|
235
235
|
var xmlWhitespace = (value) => /^[ \t\r\n]*$/.test(value);
|
|
236
|
+
var reservedNamespaces = /* @__PURE__ */ new Map([
|
|
237
|
+
["xml", "http://www.w3.org/XML/1998/namespace"],
|
|
238
|
+
["xmlns", "http://www.w3.org/2000/xmlns/"]
|
|
239
|
+
]);
|
|
240
|
+
function lookupNamespace(scope, prefix) {
|
|
241
|
+
const reserved = reservedNamespaces.get(prefix);
|
|
242
|
+
if (reserved !== void 0) return reserved;
|
|
243
|
+
for (; scope; scope = scope.parent) {
|
|
244
|
+
const uri = scope.bindings.get(prefix);
|
|
245
|
+
if (uri !== void 0) return uri;
|
|
246
|
+
}
|
|
247
|
+
return void 0;
|
|
248
|
+
}
|
|
236
249
|
function inspectXml(xml, limits, check, encoding = "utf-8") {
|
|
237
250
|
if (xml.length > limits.maxXmlChars) fail("LIMIT_XML", "XML character limit exceeded");
|
|
238
251
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml) || /[\u0000-\u0008\u000b\u000c\u000e-\u001f\ufffe\uffff]/.test(xml))
|
|
@@ -298,9 +311,7 @@ function inspectXml(xml, limits, check, encoding = "utf-8") {
|
|
|
298
311
|
fail("INVALID_XML", "Mismatched XML closing tag");
|
|
299
312
|
} else {
|
|
300
313
|
const attrs = /* @__PURE__ */ new Set();
|
|
301
|
-
const namespaces =
|
|
302
|
-
namespaces["xml"] = "http://www.w3.org/XML/1998/namespace";
|
|
303
|
-
namespaces["xmlns"] = "http://www.w3.org/2000/xmlns/";
|
|
314
|
+
const namespaces = { bindings: /* @__PURE__ */ new Map(), parent: stack.at(-1)?.namespaces };
|
|
304
315
|
while (!xmlWhitespace(body.slice(cursor))) {
|
|
305
316
|
attribute.lastIndex = cursor;
|
|
306
317
|
const match = attribute.exec(body);
|
|
@@ -310,14 +321,14 @@ function inspectXml(xml, limits, check, encoding = "utf-8") {
|
|
|
310
321
|
const value = match[2] ?? match[3] ?? "";
|
|
311
322
|
text(value);
|
|
312
323
|
if (match[1]?.startsWith("xmlns:"))
|
|
313
|
-
namespaces
|
|
324
|
+
namespaces.bindings.set(match[1].slice(6), decodeXmlAttribute(value));
|
|
314
325
|
node();
|
|
315
326
|
cursor = attribute.lastIndex;
|
|
316
327
|
}
|
|
317
328
|
const expanded = /* @__PURE__ */ new Set();
|
|
318
329
|
for (const attr2 of attrs) {
|
|
319
330
|
const colon = attr2.indexOf(":");
|
|
320
|
-
const uri = colon < 0 ? "" : namespaces
|
|
331
|
+
const uri = colon < 0 ? "" : lookupNamespace(namespaces, attr2.slice(0, colon));
|
|
321
332
|
if (uri === void 0) fail("INVALID_XML", "Unbound XML attribute prefix");
|
|
322
333
|
const key2 = `${uri}\0${attr2.slice(colon + 1)}`;
|
|
323
334
|
if (expanded.has(key2)) fail("INVALID_XML", "Duplicate expanded XML attribute name");
|
|
@@ -6601,11 +6612,23 @@ async function parseVsdx(input, options = {}) {
|
|
|
6601
6612
|
};
|
|
6602
6613
|
visit(shapes);
|
|
6603
6614
|
const connectors = connections(root2, localReport);
|
|
6615
|
+
const pageModes = {};
|
|
6616
|
+
for (const [name, key2] of [
|
|
6617
|
+
["DrawingSizeType", "drawingSizeType"],
|
|
6618
|
+
["DrawingResizeType", "drawingResizeType"]
|
|
6619
|
+
]) {
|
|
6620
|
+
const source = sheet.cells.get(name);
|
|
6621
|
+
if (!source || source.error !== void 0 || source.formula === "Inh" || source.unit !== void 0 && !["NUM", "BOOL"].includes(source.unit))
|
|
6622
|
+
continue;
|
|
6623
|
+
const value = number(sheet.cells, name, Number.NaN, localReport);
|
|
6624
|
+
if (Number.isSafeInteger(value) && value >= 0 && value <= 255) pageModes[key2] = value;
|
|
6625
|
+
}
|
|
6604
6626
|
for (const connection of connectors)
|
|
6605
6627
|
if (!seen.has(connection.fromShapeId) || !seen.has(connection.toShapeId))
|
|
6606
6628
|
localReport("dangling-connection", "A connection references a missing shape.");
|
|
6607
6629
|
pages.push({
|
|
6608
6630
|
id,
|
|
6631
|
+
...pageModes,
|
|
6609
6632
|
...drawingToPageScale === 1 ? {} : { drawingToPageScale },
|
|
6610
6633
|
name: metadata(
|
|
6611
6634
|
attribute2(page, "Name") ?? attribute2(page, "NameU") ?? `Page ${id}`,
|
|
@@ -17417,8 +17440,8 @@ function assertUnlayeredShape(shape, document) {
|
|
|
17417
17440
|
}
|
|
17418
17441
|
}
|
|
17419
17442
|
|
|
17420
|
-
// visio/edit-text.ts
|
|
17421
|
-
|
|
17443
|
+
// visio/edit-text-target.ts
|
|
17444
|
+
function localTextTarget(root2, document, shapeId, check) {
|
|
17422
17445
|
const shapeChildren = (parent) => {
|
|
17423
17446
|
const containers = children2(parent, "Shapes");
|
|
17424
17447
|
if (containers.length > 1)
|
|
@@ -17426,37 +17449,38 @@ async function replacePlainText(root2, document, shapeId, text, check, assertDep
|
|
|
17426
17449
|
return children2(containers[0], "Shape");
|
|
17427
17450
|
};
|
|
17428
17451
|
const shapes = /* @__PURE__ */ new Map();
|
|
17429
|
-
const pending = shapeChildren(root2).map((
|
|
17430
|
-
node: node2,
|
|
17431
|
-
inherited: false,
|
|
17432
|
-
deleted: false
|
|
17433
|
-
}));
|
|
17452
|
+
const pending = shapeChildren(root2).map((node) => ({ node, inherited: false, deleted: false }));
|
|
17434
17453
|
while (pending.length) {
|
|
17435
17454
|
check();
|
|
17436
|
-
const item = pending.pop();
|
|
17437
|
-
const id = attribute2(item.node, "ID");
|
|
17455
|
+
const item = pending.pop(), id = attribute2(item.node, "ID");
|
|
17438
17456
|
if (!id || shapes.has(id))
|
|
17439
17457
|
fail("INVALID_SHAPE_ID", "Local shape IDs must be present and unique.");
|
|
17440
17458
|
const inherited = item.inherited || item.node.hasAttribute("Master") || item.node.hasAttribute("MasterShape");
|
|
17441
17459
|
const deleted = item.deleted || ["1", "true"].includes(attribute2(item.node, "Del") ?? "");
|
|
17442
17460
|
shapes.set(id, { node: item.node, inherited, deleted });
|
|
17443
|
-
for (const
|
|
17461
|
+
for (const node of shapeChildren(item.node)) pending.push({ node, inherited, deleted });
|
|
17444
17462
|
}
|
|
17445
17463
|
const target = shapes.get(shapeId);
|
|
17446
17464
|
if (!target) fail("EDIT_TARGET_NOT_FOUND", "Local shape does not exist.");
|
|
17447
17465
|
if (target.inherited || target.deleted)
|
|
17448
17466
|
fail("UNSUPPORTED_TEXT_EDIT", "Master-linked or deleted shapes cannot be edited.");
|
|
17449
17467
|
assertShapeLocks(target.node, document, ["LockTextEdit"]);
|
|
17450
|
-
|
|
17468
|
+
return target.node;
|
|
17469
|
+
}
|
|
17470
|
+
|
|
17471
|
+
// visio/edit-text.ts
|
|
17472
|
+
async function replacePlainText(root2, document, shapeId, text, check, assertDependencies2) {
|
|
17473
|
+
const target = localTextTarget(root2, document, shapeId, check);
|
|
17474
|
+
const texts = children2(target, "Text");
|
|
17451
17475
|
if (texts.length !== 1)
|
|
17452
17476
|
fail("UNSUPPORTED_TEXT_EDIT", "Editing requires one existing local Text element.");
|
|
17453
17477
|
const node = texts[0];
|
|
17454
17478
|
if (Array.from(node.childNodes).some((item) => item.nodeType !== 3 && item.nodeType !== 4))
|
|
17455
17479
|
fail("UNSUPPORTED_TEXT_EDIT", "Rich text, fields and unknown text markup cannot be edited.");
|
|
17456
|
-
if (children2(target
|
|
17480
|
+
if (children2(target, "Section").some((section) => attribute2(section, "N") === "Field"))
|
|
17457
17481
|
fail("UNSUPPORTED_TEXT_EDIT", "Shapes with text fields cannot be edited.");
|
|
17458
17482
|
if (decodeVisioPlainText(node.textContent ?? "") === text) return false;
|
|
17459
|
-
await
|
|
17483
|
+
await assertDependencies2(target, node);
|
|
17460
17484
|
check();
|
|
17461
17485
|
while (node.firstChild) node.removeChild(node.firstChild);
|
|
17462
17486
|
node.appendChild(node.ownerDocument.createTextNode(encodeVisioPlainText(text)));
|
|
@@ -17550,6 +17574,197 @@ function replaceScopedPlainText(pkg, pagePaths, roots, document, edit, check) {
|
|
|
17550
17574
|
);
|
|
17551
17575
|
}
|
|
17552
17576
|
|
|
17577
|
+
// visio/edit-text-range-plan.ts
|
|
17578
|
+
function textRangeNodes(node, edit) {
|
|
17579
|
+
const tokens2 = [];
|
|
17580
|
+
let stored = "";
|
|
17581
|
+
for (const part of Array.from(node.childNodes)) {
|
|
17582
|
+
const start = stored.length;
|
|
17583
|
+
if (part.nodeType === 3 || part.nodeType === 4) stored += part.nodeValue ?? "";
|
|
17584
|
+
tokens2.push({ node: part, start, end: stored.length });
|
|
17585
|
+
}
|
|
17586
|
+
if (decodeVisioPlainText(stored) !== edit.expectedText)
|
|
17587
|
+
fail("EDIT_STALE_TEXT", "Original text no longer matches the range command.");
|
|
17588
|
+
const changed = edit.ranges.some(
|
|
17589
|
+
(range) => edit.expectedText.slice(range.start, range.end) !== range.text
|
|
17590
|
+
);
|
|
17591
|
+
if (!changed) return { changed: false, nodes: [] };
|
|
17592
|
+
const starts = [], deltas = [];
|
|
17593
|
+
let delta = 0;
|
|
17594
|
+
for (const range of edit.ranges) {
|
|
17595
|
+
starts.push(range.start + delta);
|
|
17596
|
+
delta += range.text.length - (range.end - range.start);
|
|
17597
|
+
deltas.push(delta);
|
|
17598
|
+
}
|
|
17599
|
+
const length = edit.expectedText.length + delta;
|
|
17600
|
+
if (!length && tokens2.some((token) => token.node.nodeType === 1))
|
|
17601
|
+
fail(
|
|
17602
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
17603
|
+
"Deleting all rich text has unproven native insertion-style behavior."
|
|
17604
|
+
);
|
|
17605
|
+
if (tokens2.some((token) => token.node.nodeType === 1)) {
|
|
17606
|
+
let start = 0, index = 0;
|
|
17607
|
+
while (start < edit.expectedText.length) {
|
|
17608
|
+
const newline = edit.expectedText.indexOf("\n", start), end = newline < 0 ? edit.expectedText.length : newline;
|
|
17609
|
+
let bodyLength = end - start;
|
|
17610
|
+
while (index < edit.ranges.length && edit.ranges[index].start < end) {
|
|
17611
|
+
const range = edit.ranges[index++];
|
|
17612
|
+
bodyLength += range.text.length - (range.end - range.start);
|
|
17613
|
+
}
|
|
17614
|
+
if (end > start && !bodyLength)
|
|
17615
|
+
fail(
|
|
17616
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
17617
|
+
"Deleting an entire rich paragraph body has unproven native insertion-style behavior."
|
|
17618
|
+
);
|
|
17619
|
+
start = end + 1;
|
|
17620
|
+
}
|
|
17621
|
+
}
|
|
17622
|
+
const position = (offset) => {
|
|
17623
|
+
let low = 0, high = edit.ranges.length;
|
|
17624
|
+
while (low < high) {
|
|
17625
|
+
const middle = low + high >>> 1;
|
|
17626
|
+
if (edit.ranges[middle].start < offset) low = middle + 1;
|
|
17627
|
+
else high = middle;
|
|
17628
|
+
}
|
|
17629
|
+
const index = low - 1;
|
|
17630
|
+
if (index < 0) return offset;
|
|
17631
|
+
const range = edit.ranges[index];
|
|
17632
|
+
return offset <= range.end ? starts[index] + range.text.length : offset + deltas[index];
|
|
17633
|
+
};
|
|
17634
|
+
const output = [];
|
|
17635
|
+
const append = (token, start, end) => {
|
|
17636
|
+
if (end <= start) return;
|
|
17637
|
+
const part = start === token.start && end === token.end ? token.node : token.node.cloneNode(false);
|
|
17638
|
+
if (part !== token.node)
|
|
17639
|
+
part.nodeValue = (token.node.nodeValue ?? "").slice(start - token.start, end - token.start);
|
|
17640
|
+
output.push({ position: position(start), priority: 2, node: part });
|
|
17641
|
+
};
|
|
17642
|
+
let first2 = 0;
|
|
17643
|
+
for (const token of tokens2) {
|
|
17644
|
+
if (token.node.nodeType === 1) {
|
|
17645
|
+
output.push({ position: position(token.start), priority: 0, node: token.node });
|
|
17646
|
+
continue;
|
|
17647
|
+
}
|
|
17648
|
+
const end = length ? token.end : Math.min(token.end, edit.expectedText.length);
|
|
17649
|
+
let cursor = token.start;
|
|
17650
|
+
while (first2 < edit.ranges.length && edit.ranges[first2].end <= cursor) first2++;
|
|
17651
|
+
for (let index = first2; index < edit.ranges.length && edit.ranges[index].start < end; index++) {
|
|
17652
|
+
const range = edit.ranges[index];
|
|
17653
|
+
append(token, cursor, Math.min(end, range.start));
|
|
17654
|
+
cursor = Math.max(cursor, Math.min(end, range.end));
|
|
17655
|
+
}
|
|
17656
|
+
append(token, cursor, end);
|
|
17657
|
+
}
|
|
17658
|
+
for (let index = 0; index < edit.ranges.length; index++) {
|
|
17659
|
+
const text = edit.ranges[index].text;
|
|
17660
|
+
if (text)
|
|
17661
|
+
output.push({
|
|
17662
|
+
position: starts[index],
|
|
17663
|
+
priority: 1,
|
|
17664
|
+
node: node.ownerDocument.createTextNode(text)
|
|
17665
|
+
});
|
|
17666
|
+
}
|
|
17667
|
+
output.sort((a, b) => a.position - b.position || a.priority - b.priority);
|
|
17668
|
+
let characterPosition = -1, characterRow = null;
|
|
17669
|
+
for (const item of output) {
|
|
17670
|
+
if (item.node.nodeType !== 1 || item.node.localName !== "cp") continue;
|
|
17671
|
+
const row = item.node.getAttribute("IX");
|
|
17672
|
+
if (item.position === characterPosition && row !== characterRow)
|
|
17673
|
+
fail(
|
|
17674
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
17675
|
+
"Consuming complete character runs creates ambiguous native marker boundaries."
|
|
17676
|
+
);
|
|
17677
|
+
characterPosition = item.position;
|
|
17678
|
+
characterRow = row;
|
|
17679
|
+
}
|
|
17680
|
+
return { changed: true, nodes: output.map((item) => item.node) };
|
|
17681
|
+
}
|
|
17682
|
+
|
|
17683
|
+
// visio/edit-text-ranges.ts
|
|
17684
|
+
async function replaceScopedTextRanges(pkg, pagePaths, roots, document, edit, check) {
|
|
17685
|
+
const shape = localTextTarget(roots.get(edit.pageId), document, edit.shapeId, check);
|
|
17686
|
+
if (children2(shape, "Section").some((section) => attribute2(section, "N") === "Field"))
|
|
17687
|
+
fail("UNSUPPORTED_TEXT_RANGE", "Text range editing of shapes with fields is unsupported.");
|
|
17688
|
+
const texts = children2(shape, "Text");
|
|
17689
|
+
if (texts.length !== 1)
|
|
17690
|
+
fail("UNSUPPORTED_TEXT_RANGE", "Range editing requires one existing local Text element.");
|
|
17691
|
+
const text = texts[0];
|
|
17692
|
+
if (Array.from(text.childNodes).some((node) => ![3, 4].includes(node.nodeType))) {
|
|
17693
|
+
const characters = effectiveFormattingRows(shape, document, "Character"), paragraphs = effectiveFormattingRows(shape, document, "Paragraph");
|
|
17694
|
+
assertFormattingText(shape, characters, paragraphs);
|
|
17695
|
+
}
|
|
17696
|
+
if (Array.from(text.childNodes).some(
|
|
17697
|
+
(node) => node.nodeType === 1 && node.localName === "fld"
|
|
17698
|
+
))
|
|
17699
|
+
fail("UNSUPPORTED_TEXT_RANGE", "Text range editing of fields is unsupported.");
|
|
17700
|
+
let preceding = "";
|
|
17701
|
+
for (const node of Array.from(text.childNodes)) {
|
|
17702
|
+
if (node.nodeType === 3 || node.nodeType === 4) preceding += node.nodeValue ?? "";
|
|
17703
|
+
else {
|
|
17704
|
+
const marker2 = node;
|
|
17705
|
+
if (marker2.localName === "pp" && preceding && !preceding.endsWith("\n") || marker2.localName === "tp" && attribute2(marker2, "IX") !== "0")
|
|
17706
|
+
fail(
|
|
17707
|
+
"UNSUPPORTED_TEXT_RANGE",
|
|
17708
|
+
"Noncanonical paragraph or tab marker placement cannot be edited."
|
|
17709
|
+
);
|
|
17710
|
+
}
|
|
17711
|
+
}
|
|
17712
|
+
const plan = textRangeNodes(text, edit);
|
|
17713
|
+
if (!plan.changed) return false;
|
|
17714
|
+
await assertFormattingDependencies(
|
|
17715
|
+
pkg,
|
|
17716
|
+
pagePaths,
|
|
17717
|
+
roots,
|
|
17718
|
+
edit.pageId,
|
|
17719
|
+
shape,
|
|
17720
|
+
/* @__PURE__ */ new Map([["TheText", text]]),
|
|
17721
|
+
check
|
|
17722
|
+
);
|
|
17723
|
+
check();
|
|
17724
|
+
while (text.firstChild) text.removeChild(text.firstChild);
|
|
17725
|
+
for (const node of plan.nodes) text.appendChild(node);
|
|
17726
|
+
return true;
|
|
17727
|
+
}
|
|
17728
|
+
|
|
17729
|
+
// visio/edit-text-range-commands.ts
|
|
17730
|
+
var invalidXmlText = /[\u0000-\u0008\u000b\u000c\u000d\u000e-\u001f\ufffe\uffff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/u;
|
|
17731
|
+
function textRangeBoundary(text, offset) {
|
|
17732
|
+
return !(offset > 0 && offset < text.length && /[\ud800-\udbff]/.test(text[offset - 1]) && /[\udc00-\udfff]/.test(text[offset]));
|
|
17733
|
+
}
|
|
17734
|
+
function snapshotTextRanges(edit, consume) {
|
|
17735
|
+
let characters = 0;
|
|
17736
|
+
const text = (value) => {
|
|
17737
|
+
if (typeof value !== "string" || invalidXmlText.test(value))
|
|
17738
|
+
fail("INVALID_EDIT_TEXT", "Range replacement requires valid XML text.");
|
|
17739
|
+
characters += value.length;
|
|
17740
|
+
if (characters > 1e6)
|
|
17741
|
+
fail("LIMIT_EDIT_TEXT", "Range replacement text exceeds input limits.");
|
|
17742
|
+
return consume ? consume(value) : value;
|
|
17743
|
+
};
|
|
17744
|
+
const pageId = edit.pageId, shapeId = edit.shapeId;
|
|
17745
|
+
if ([pageId, shapeId].some((id) => typeof id !== "string" || !id || id.length > 256))
|
|
17746
|
+
fail("INVALID_EDIT", "Invalid text range target.");
|
|
17747
|
+
const expectedText = text(edit.expectedText), original = edit.ranges;
|
|
17748
|
+
if (!Array.isArray(original)) fail("INVALID_EDIT", "Text ranges require an array.");
|
|
17749
|
+
const length = original.length;
|
|
17750
|
+
if (!Number.isSafeInteger(length) || length < 1 || length > 1e4)
|
|
17751
|
+
fail("LIMIT_EDITS", "Range replacement requires 1-10000 ranges.");
|
|
17752
|
+
const ranges = [];
|
|
17753
|
+
let end = 0, output = expectedText.length;
|
|
17754
|
+
for (let index = 0; index < length; index++) {
|
|
17755
|
+
const input = original[index], start = input.start, nextEnd = input.end, replacement = text(input.text);
|
|
17756
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(nextEnd) || start < end || nextEnd <= start || nextEnd > expectedText.length || !textRangeBoundary(expectedText, start) || !textRangeBoundary(expectedText, nextEnd))
|
|
17757
|
+
fail("INVALID_EDIT", "Text ranges require ascending nonoverlapping UTF16 scalar boundaries.");
|
|
17758
|
+
if (replacement.includes("\n") || expectedText.slice(start, nextEnd).includes("\n"))
|
|
17759
|
+
fail("UNSUPPORTED_TEXT_RANGE", "Range replacement across paragraph breaks is unsupported.");
|
|
17760
|
+
ranges.push({ start, end: nextEnd, text: replacement });
|
|
17761
|
+
end = nextEnd;
|
|
17762
|
+
output += replacement.length - (nextEnd - start);
|
|
17763
|
+
}
|
|
17764
|
+
if (output > 1e6) fail("LIMIT_EDIT_TEXT", "Range replacement output exceeds limits.");
|
|
17765
|
+
return { type: "replace-text-ranges", pageId, shapeId, expectedText, ranges };
|
|
17766
|
+
}
|
|
17767
|
+
|
|
17553
17768
|
// visio/resize-anchor.ts
|
|
17554
17769
|
function snapshotResizeAnchor(value) {
|
|
17555
17770
|
if (value === void 0) return void 0;
|
|
@@ -17782,7 +17997,7 @@ function snapshotFormatting(edit) {
|
|
|
17782
17997
|
}
|
|
17783
17998
|
|
|
17784
17999
|
// visio/edit-commands.ts
|
|
17785
|
-
var isVisioPageEdit = (edit) => edit.type === "insert-page" || edit.type === "reorder-page" || edit.type === "rename-page" || edit.type === "delete-page";
|
|
18000
|
+
var isVisioPageEdit = (edit) => edit.type === "insert-page" || edit.type === "reorder-page" || edit.type === "rename-page" || edit.type === "delete-page" || edit.type === "set-page-size";
|
|
17786
18001
|
function geometryChangedCells(edit) {
|
|
17787
18002
|
if (edit.type === "create-line")
|
|
17788
18003
|
return [
|
|
@@ -17840,6 +18055,13 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
17840
18055
|
if (edit.type === "duplicate-shapes") return snapshotDuplicateShapes(edit);
|
|
17841
18056
|
if (edit.type === "paste-shapes") return snapshotPasteShapes(edit);
|
|
17842
18057
|
if (edit.type === "delete-page") return { type: edit.type, pageId: edit.pageId };
|
|
18058
|
+
if (edit.type === "set-page-size")
|
|
18059
|
+
return {
|
|
18060
|
+
type: edit.type,
|
|
18061
|
+
pageId: edit.pageId,
|
|
18062
|
+
width: numeric5(edit.width, true),
|
|
18063
|
+
height: numeric5(edit.height, true)
|
|
18064
|
+
};
|
|
17843
18065
|
if (edit.type === "reorder-page") {
|
|
17844
18066
|
if (!Number.isSafeInteger(edit.index) || edit.index < 0 || edit.index > 1e6)
|
|
17845
18067
|
fail("INVALID_EDIT", "Page order requires a bounded zero-based integer index.");
|
|
@@ -17862,6 +18084,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
|
|
|
17862
18084
|
const target = { pageId: edit.pageId, shapeId: edit.shapeId };
|
|
17863
18085
|
if (edit.type === "replace-plain-text")
|
|
17864
18086
|
return { ...target, type: edit.type, text: text(edit.text) };
|
|
18087
|
+
if (edit.type === "replace-text-ranges") return snapshotTextRanges(edit, text);
|
|
17865
18088
|
if (isVisioFormatEdit(edit)) return snapshotFormatting(edit);
|
|
17866
18089
|
if (edit.type === "reorder-shape") {
|
|
17867
18090
|
if (!["front", "back", "forward", "backward"].includes(edit.order))
|
|
@@ -20560,6 +20783,145 @@ function addReplacementPage(pagesPart, pages, rels, types, pagePaths, parts, dir
|
|
|
20560
20783
|
);
|
|
20561
20784
|
}
|
|
20562
20785
|
|
|
20786
|
+
// visio/edit-page-size.ts
|
|
20787
|
+
function constant(node, length) {
|
|
20788
|
+
if (!node || node.hasAttribute("E") || attribute2(node, "F") === "Inh")
|
|
20789
|
+
fail("EDIT_UNSUPPORTED_PAGE_SIZE", "A valid explicit page size or mode cache is required.");
|
|
20790
|
+
const value = visioFormulaCachedValue(attribute2(node, "V") ?? "", attribute2(node, "U"));
|
|
20791
|
+
if (!Number.isFinite(value.value) || !["scalar", ...length ? ["length"] : []].includes(value.unit))
|
|
20792
|
+
fail("EDIT_UNSUPPORTED_PAGE_SIZE", "Page size or mode has incompatible units.");
|
|
20793
|
+
const formula = executableCellFormula(attribute2(node, "F"));
|
|
20794
|
+
if (formula) {
|
|
20795
|
+
const analysis = analyzeVisioFormula(formula);
|
|
20796
|
+
if (analysis.guarded || analysis.dynamic || analysis.references.length || analysis.unsupportedFunctions.length)
|
|
20797
|
+
fail("EDIT_PROTECTED_CELL", "Protected or dependent page settings cannot be overwritten.");
|
|
20798
|
+
const result = evaluateVisioFormula(
|
|
20799
|
+
formula,
|
|
20800
|
+
() => fail("EDIT_PROTECTED_CELL", "Unsupported page dependency.")
|
|
20801
|
+
);
|
|
20802
|
+
if (result.value !== value.value || !["scalar", ...length ? ["length"] : []].includes(result.unit))
|
|
20803
|
+
fail("EDIT_PROTECTED_CELL", "Page setting formula cache cannot be proven.");
|
|
20804
|
+
}
|
|
20805
|
+
return value.value;
|
|
20806
|
+
}
|
|
20807
|
+
var escape3 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
20808
|
+
function assertDependencies(roots, pagesPart, pages, pagePaths, pageId, changed, check) {
|
|
20809
|
+
const page = children2(pages, "Page").find((node) => attribute2(node, "ID") === pageId);
|
|
20810
|
+
const targetNames = new Set(
|
|
20811
|
+
["Name", "NameU"].map((name) => attribute2(page, name)?.toLowerCase())
|
|
20812
|
+
);
|
|
20813
|
+
const otherNames = children2(pages, "Page").filter((node) => node !== page).flatMap((node) => ["Name", "NameU"].map((name) => attribute2(node, name))).filter((name) => !!name && !targetNames.has(name.toLowerCase()));
|
|
20814
|
+
const cells4 = changed.map(escape3).join("|");
|
|
20815
|
+
const reference = new RegExp(`(?:^|[^a-z0-9_.])(?:${cells4})(?:$|[^a-z0-9_.])`, "i");
|
|
20816
|
+
const other = otherNames.length ? new RegExp(
|
|
20817
|
+
`Pages\\[(?:${otherNames.map(escape3).join("|")})\\]!(?:ThePage!)?(?:${cells4})(?![a-z0-9_.])`,
|
|
20818
|
+
"gi"
|
|
20819
|
+
) : void 0;
|
|
20820
|
+
const paths = new Map([...pagePaths].map(([id, path]) => [path, id]));
|
|
20821
|
+
for (const [path, root2] of roots)
|
|
20822
|
+
for (const node of [root2, ...Array.from(root2.getElementsByTagName("*"))]) {
|
|
20823
|
+
check();
|
|
20824
|
+
const formula = executableCellFormula(attribute2(node, "F"));
|
|
20825
|
+
if (!formula) continue;
|
|
20826
|
+
let code = unquotedVisioFormula(formula);
|
|
20827
|
+
const name = attribute2(node, "N") ?? "";
|
|
20828
|
+
if (inertDoubleClickFormula(name, formula)) continue;
|
|
20829
|
+
const owner = node.parentNode, container = owner?.parentNode;
|
|
20830
|
+
const ownerId = attribute2(owner ?? void 0, "ID");
|
|
20831
|
+
const connected = ownerId && /^[1-9]\d{0,9}$/.test(ownerId) && owner?.localName === "Shape" && owner.namespaceURI === root2.namespaceURI && (!attribute2(owner, "Type") || attribute2(owner, "Type") === "Shape") && !owner.hasAttribute("Master") && !owner.hasAttribute("MasterShape") && !children2(owner, "Shapes").length && ["BeginX", "BeginY", "EndX", "EndY"].every(
|
|
20832
|
+
(name2) => children2(owner, "Cell").filter((cell) => attribute2(cell, "N") === name2).length === 1
|
|
20833
|
+
) && container?.localName === "Shapes" && container.parentNode === root2 && children2(root2, "Connects").some(
|
|
20834
|
+
(connections2) => children2(connections2, "Connect").some(
|
|
20835
|
+
(connection) => attribute2(connection, "FromSheet") === ownerId
|
|
20836
|
+
)
|
|
20837
|
+
);
|
|
20838
|
+
const nativeGlue = paths.has(path) && connected && node.localName === "Cell" && node.namespaceURI === root2.namespaceURI && (/^(BeginX|BeginY|EndX|EndY)$/.test(name) && /^\s*_WALKGLUE\((?:BegTrigger,EndTrigger|EndTrigger,BegTrigger),WalkPreference\)\s*$/i.test(
|
|
20839
|
+
code
|
|
20840
|
+
) || /^(BegTrigger|EndTrigger)$/.test(name) && /^\s*_XFTRIGGER\(Sheet\.[1-9]\d*!EventXFMod\)\s*$/i.test(code));
|
|
20841
|
+
let dynamic2 = false;
|
|
20842
|
+
if (!nativeGlue) {
|
|
20843
|
+
try {
|
|
20844
|
+
dynamic2 = analyzeVisioFormula(
|
|
20845
|
+
mapVisioFormulaSyntax(
|
|
20846
|
+
formula,
|
|
20847
|
+
(part) => (other ? part.replace(other, "0") : part).replace(/Pages\[[^\]]+\]!/gi, "").replace(/ThePage!/gi, "")
|
|
20848
|
+
)
|
|
20849
|
+
).dynamic;
|
|
20850
|
+
} catch {
|
|
20851
|
+
dynamic2 = true;
|
|
20852
|
+
}
|
|
20853
|
+
}
|
|
20854
|
+
if (dynamic2)
|
|
20855
|
+
fail(
|
|
20856
|
+
"EDIT_UNSUPPORTED_PAGE_SIZE_DEPENDENCY",
|
|
20857
|
+
"Dynamic or unknown page-size dependencies cannot be safely refreshed."
|
|
20858
|
+
);
|
|
20859
|
+
let local = paths.get(path);
|
|
20860
|
+
if (path === pagesPart) {
|
|
20861
|
+
let ancestor = node;
|
|
20862
|
+
while (ancestor && ancestor.localName !== "Page")
|
|
20863
|
+
ancestor = ancestor.parentNode;
|
|
20864
|
+
local = ancestor ? attribute2(ancestor, "ID") : void 0;
|
|
20865
|
+
}
|
|
20866
|
+
if (other) code = code.replace(other, "0");
|
|
20867
|
+
if (!reference.test(code)) continue;
|
|
20868
|
+
if (local && local !== pageId && !/\bPages\[/i.test(code)) continue;
|
|
20869
|
+
fail(
|
|
20870
|
+
"EDIT_UNSUPPORTED_PAGE_SIZE_DEPENDENCY",
|
|
20871
|
+
"Page-size formula caches cannot be safely refreshed."
|
|
20872
|
+
);
|
|
20873
|
+
}
|
|
20874
|
+
}
|
|
20875
|
+
async function setVisioPageSize(pkg, pagesPart, pages, pagePaths, dirty, command2, check) {
|
|
20876
|
+
const page = children2(pages, "Page").find((node) => attribute2(node, "ID") === command2.pageId);
|
|
20877
|
+
if (!page) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
20878
|
+
if (children2(page, "PageSheet").length !== 1)
|
|
20879
|
+
fail("EDIT_UNSUPPORTED_PAGE_SIZE", "One explicit PageSheet is required.");
|
|
20880
|
+
const sheet = child(page, "PageSheet"), cells4 = uniqueFormattingCells(sheet);
|
|
20881
|
+
for (const name of [
|
|
20882
|
+
"PageWidth",
|
|
20883
|
+
"PageHeight",
|
|
20884
|
+
"PageScale",
|
|
20885
|
+
"DrawingScale",
|
|
20886
|
+
"DrawingSizeType",
|
|
20887
|
+
"DrawingResizeType"
|
|
20888
|
+
])
|
|
20889
|
+
if (!cells4.has(name) && [...cells4.keys()].some((key2) => key2.toLowerCase() === name.toLowerCase()))
|
|
20890
|
+
fail("EDIT_AMBIGUOUS_CELL", "Page settings require canonical cell names.");
|
|
20891
|
+
const pageScale = constant(cells4.get("PageScale"), true), drawingScale = constant(cells4.get("DrawingScale"), true);
|
|
20892
|
+
if (pageScale <= 0 || drawingScale <= 0)
|
|
20893
|
+
fail("EDIT_UNSUPPORTED_PAGE_SIZE", "Page and drawing scales must be positive.");
|
|
20894
|
+
const width = constant(cells4.get("PageWidth"), true), height = constant(cells4.get("PageHeight"), true);
|
|
20895
|
+
const size = constant(cells4.get("DrawingSizeType"), false);
|
|
20896
|
+
const resize = cells4.has("DrawingResizeType") ? constant(cells4.get("DrawingResizeType"), false) : void 0;
|
|
20897
|
+
if (width <= 0 || height <= 0 || ![0, 1, 2, 3, 4].includes(size) || resize !== void 0 && ![0, 1, 2].includes(resize))
|
|
20898
|
+
fail("EDIT_UNSUPPORTED_PAGE_SIZE", "Page dimensions or size modes are unsupported.");
|
|
20899
|
+
const targetWidth = command2.width === width * (pageScale / drawingScale) ? width : command2.width * drawingScale / pageScale, targetHeight = command2.height === height * (pageScale / drawingScale) ? height : command2.height * drawingScale / pageScale;
|
|
20900
|
+
if (![targetWidth, targetHeight].every(
|
|
20901
|
+
(value) => Number.isFinite(value) && value > 0 && value <= 1e6
|
|
20902
|
+
))
|
|
20903
|
+
fail("INVALID_PAGE_SIZE", "Converted drawing-page dimensions exceed limits.");
|
|
20904
|
+
const values = /* @__PURE__ */ new Map([
|
|
20905
|
+
["PageWidth", targetWidth],
|
|
20906
|
+
["PageHeight", targetHeight],
|
|
20907
|
+
["DrawingSizeType", 3],
|
|
20908
|
+
["DrawingResizeType", 0]
|
|
20909
|
+
]);
|
|
20910
|
+
const changed = [...values.keys()].filter(
|
|
20911
|
+
(name) => name === "PageWidth" ? width !== targetWidth : name === "PageHeight" ? height !== targetHeight : name === "DrawingSizeType" ? size !== 3 : resize !== 0
|
|
20912
|
+
);
|
|
20913
|
+
if (!changed.length) return;
|
|
20914
|
+
const roots = await editableVisioPageRoots(pkg, pagesPart, pages, pagePaths, dirty, check);
|
|
20915
|
+
for (const path of pkg.paths())
|
|
20916
|
+
if (/^visio\/.*\.xml$/i.test(path) && !roots.has(path)) {
|
|
20917
|
+
check();
|
|
20918
|
+
roots.set(path, dirty.get(path) ?? await pkg.readXml(path));
|
|
20919
|
+
}
|
|
20920
|
+
assertDependencies(roots, pagesPart, pages, pagePaths, command2.pageId, changed, check);
|
|
20921
|
+
for (const name of changed) setCell(sheet, name, values.get(name));
|
|
20922
|
+
dirty.set(pagesPart, pages);
|
|
20923
|
+
}
|
|
20924
|
+
|
|
20563
20925
|
// visio/edit-pages.ts
|
|
20564
20926
|
var officeRel2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
20565
20927
|
var pageType2 = "http://schemas.microsoft.com/visio/2010/relationships/page";
|
|
@@ -20595,6 +20957,10 @@ async function editVsdxPages(original, pkg, parts, commands, limits, maxOutput,
|
|
|
20595
20957
|
for (const command2 of commands) {
|
|
20596
20958
|
check();
|
|
20597
20959
|
const existing = children2(pages, "Page");
|
|
20960
|
+
if (command2.type === "set-page-size") {
|
|
20961
|
+
await setVisioPageSize(pkg, pagesPart, pages, pagePaths, dirty, command2, check);
|
|
20962
|
+
continue;
|
|
20963
|
+
}
|
|
20598
20964
|
if (command2.type === "delete-page") {
|
|
20599
20965
|
await deleteVisioPage(
|
|
20600
20966
|
pkg,
|
|
@@ -20698,8 +21064,10 @@ async function editVsdxPages(original, pkg, parts, commands, limits, maxOutput,
|
|
|
20698
21064
|
fail("LIMIT_EDIT_OUTPUT", "Saved package exceeds output limit.");
|
|
20699
21065
|
return { bytes: original, changedParts: [], diagnostics: [] };
|
|
20700
21066
|
}
|
|
20701
|
-
|
|
20702
|
-
|
|
21067
|
+
if (commands.some((command2) => command2.type !== "set-page-size")) {
|
|
21068
|
+
await updatePageAppProperties(pkg, pages, priorCount, dirty, limits, check);
|
|
21069
|
+
await recalculatePageFormulas(pkg, pagesPart, pages, pagePaths, dirty, check);
|
|
21070
|
+
}
|
|
20703
21071
|
if ((/* @__PURE__ */ new Set([...parts.keys(), ...dirty.keys()])).size > limits.maxEntries)
|
|
20704
21072
|
fail("LIMIT_ENTRIES", "Page insertion exceeds package entry limit.");
|
|
20705
21073
|
let total = [...parts.values()].reduce((sum, bytes2) => sum + bytes2.length, 0), nodes = 0;
|
|
@@ -20727,8 +21095,8 @@ async function editVsdxPages(original, pkg, parts, commands, limits, maxOutput,
|
|
|
20727
21095
|
changedParts: [.../* @__PURE__ */ new Set([...removed, ...dirty.keys()])],
|
|
20728
21096
|
diagnostics: [
|
|
20729
21097
|
{
|
|
20730
|
-
code: "edit-pages-experimental",
|
|
20731
|
-
message: "Page metadata and supported local numeric page-dependent caches were updated. Inherited, string and background-render-context formulas remain unsupported."
|
|
21098
|
+
code: commands.every((command2) => command2.type === "set-page-size") ? "edit-page-size-experimental" : "edit-pages-experimental",
|
|
21099
|
+
message: commands.every((command2) => command2.type === "set-page-size") ? "Fixed custom drawing-page dimensions were updated. Shape positions and printer settings were retained; affected page-size formula caches remain unsupported." : "Page metadata and supported local numeric page-dependent caches were updated. Inherited, string and background-render-context formulas remain unsupported."
|
|
20732
21100
|
}
|
|
20733
21101
|
]
|
|
20734
21102
|
};
|
|
@@ -21557,12 +21925,12 @@ async function editVsdx(input, edits, options = {}) {
|
|
|
21557
21925
|
const dirty = /* @__PURE__ */ new Map();
|
|
21558
21926
|
const roots = /* @__PURE__ */ new Map();
|
|
21559
21927
|
const geometryCommands = commands.filter(
|
|
21560
|
-
(command2) => command2.type !== "replace-plain-text" && command2.type !== "reorder-shape" && command2.type !== "duplicate-shapes" && command2.type !== "paste-shapes" && !isVisioFormatEdit(command2)
|
|
21928
|
+
(command2) => command2.type !== "replace-plain-text" && command2.type !== "replace-text-ranges" && command2.type !== "reorder-shape" && command2.type !== "duplicate-shapes" && command2.type !== "paste-shapes" && !isVisioFormatEdit(command2)
|
|
21561
21929
|
);
|
|
21562
21930
|
let document;
|
|
21563
21931
|
let masterMovePins = emptyMasterMoveProof();
|
|
21564
21932
|
if (geometryCommands.length || commands.some(
|
|
21565
|
-
(command2) => command2.type === "replace-plain-text" || isVisioFormatEdit(command2) || command2.type === "reorder-shape" || command2.type === "duplicate-shapes" || command2.type === "paste-shapes"
|
|
21933
|
+
(command2) => command2.type === "replace-plain-text" || command2.type === "replace-text-ranges" || isVisioFormatEdit(command2) || command2.type === "reorder-shape" || command2.type === "duplicate-shapes" || command2.type === "paste-shapes"
|
|
21566
21934
|
)) {
|
|
21567
21935
|
for (const [pageId, path2] of pages) {
|
|
21568
21936
|
const sourceRoot = await visioXml(pkg, path2, "PageContents");
|
|
@@ -21609,8 +21977,8 @@ async function editVsdx(input, edits, options = {}) {
|
|
|
21609
21977
|
root2 = sourceRoot.ownerDocument.cloneNode(true).documentElement;
|
|
21610
21978
|
roots.set(command2.pageId, root2);
|
|
21611
21979
|
}
|
|
21612
|
-
if (command2.type === "replace-plain-text") {
|
|
21613
|
-
if (await replaceScopedPlainText(pkg, new Set(pages.values()), roots, document, command2, check)) {
|
|
21980
|
+
if (command2.type === "replace-plain-text" || command2.type === "replace-text-ranges") {
|
|
21981
|
+
if (await (command2.type === "replace-plain-text" ? replaceScopedPlainText(pkg, new Set(pages.values()), roots, document, command2, check) : replaceScopedTextRanges(pkg, new Set(pages.values()), roots, document, command2, check))) {
|
|
21614
21982
|
dirty.set(path, root2);
|
|
21615
21983
|
textChanged = true;
|
|
21616
21984
|
}
|
package/dist/visio/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { inspectVisioRasterImage, VisioImageError, VISIO_RASTER_IMAGE_LIMITS, ty
|
|
|
10
10
|
export { inspectVisioEmfAdmission, VISIO_EMF_ADMISSION_LIMITS, type VisioEmfAdmissionOptions, type VisioEmfAdmissionResult, type VisioEmfAdmissionStatus, type VisioEmfAdmissionDiagnostic, type VisioEmfAdmissionMetrics, } from './emf-admission.js';
|
|
11
11
|
export { sanitizeVisioForeignVectorTree, validateVisioForeignVector, VisioForeignVectorError, VISIO_FOREIGN_VECTOR_LIMITS, type VisioForeignVector, type VisioForeignVectorLimits, type VisioForeignVectorCommand, type VisioForeignVectorClip, type VisioForeignVectorClipPath, type VisioForeignVectorNode, type VisioForeignVectorPath, type VisioForeignVectorPaint, type VisioForeignVectorMatrix, } from './foreign-vector.js';
|
|
12
12
|
export { convertVisioMetafile, type VisioMetafileTreeConverter, type VisioMetafileConversionResult, } from './convert-metafile.js';
|
|
13
|
-
export { editVsdx, type VisioEdit, type VisioGeometryEdit, type VisioTextEdit, type VisioPageInsert, type VisioPageReorder, type VisioPageRename, type VisioPageDelete, type VisioPageEdit, type VisioFormatEdit, type VisioTextFormatEdit, type VisioShapeFormatEdit, type VisioShapeOrderEdit, type VisioDuplicateShapesEdit, type VisioPasteShapesEdit, type VisioResizeAnchor, type EditVsdxOptions, type EditVsdxResult, } from './edit.js';
|
|
13
|
+
export { editVsdx, type VisioEdit, type VisioGeometryEdit, type VisioTextEdit, type VisioTextRange, type VisioTextRangesEdit, type VisioPageInsert, type VisioPageReorder, type VisioPageRename, type VisioPageDelete, type VisioPageSizeEdit, type VisioPageEdit, type VisioFormatEdit, type VisioTextFormatEdit, type VisioShapeFormatEdit, type VisioShapeOrderEdit, type VisioDuplicateShapesEdit, type VisioPasteShapesEdit, type VisioResizeAnchor, type EditVsdxOptions, type EditVsdxResult, } from './edit.js';
|
|
14
14
|
export { captureVisioClipboard, serializeVisioClipboard, deserializeVisioClipboard, VISIO_CLIPBOARD_MAGIC, VISIO_CLIPBOARD_MAX_CHARS, type VisioClipboardSnapshot, } from './clipboard.js';
|
|
15
15
|
export { createVsdx, type CreateVsdxOptions } from './create-document.js';
|
|
16
16
|
export { parseVisioFormula, analyzeVisioFormula, evaluateVisioFormula, visioFormulaCachedValue, VisioFormulaError, type VisioFormulaAst, type VisioFormulaLimits, type VisioFormulaValue, type VisioFormulaReference, type VisioFormulaUnit, } from './formula.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../visio/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,mBAAmB,SAAS,CAAC;AAC7B,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EACN,0BAA0B,EAC1B,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,GACj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