ooxml-core 0.11.0 → 0.12.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 +10 -6
- package/dist/automation/index.cjs +320 -205
- package/dist/automation/index.mjs +320 -205
- package/dist/visio/edit-geometry-admission.d.ts +6 -3
- package/dist/visio/edit-geometry-admission.d.ts.map +1 -1
- package/dist/visio/edit-geometry.d.ts +2 -1
- package/dist/visio/edit-geometry.d.ts.map +1 -1
- package/dist/visio/edit-master-index.d.ts +1 -1
- package/dist/visio/edit-master-index.d.ts.map +1 -1
- package/dist/visio/edit-master-move.d.ts +9 -1
- package/dist/visio/edit-master-move.d.ts.map +1 -1
- package/dist/visio/edit-master-scope.d.ts +2 -1
- package/dist/visio/edit-master-scope.d.ts.map +1 -1
- package/dist/visio/edit-scope.d.ts +2 -1
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +218 -141
- package/dist/visio/index.mjs +218 -141
- package/dist/xlsx/formula/area-index.d.ts +3 -3
- package/dist/xlsx/formula/area-index.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-core.d.ts +4 -1
- package/dist/xlsx/formula/engine-core.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-host.d.ts +2 -0
- package/dist/xlsx/formula/engine-host.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-order.d.ts +11 -0
- package/dist/xlsx/formula/engine-order.d.ts.map +1 -0
- package/dist/xlsx/formula/spill.d.ts.map +1 -1
- package/dist/xlsx/formula/store.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +102 -64
- package/dist/xlsx/index.mjs +102 -64
- package/package.json +1 -1
package/dist/visio/index.mjs
CHANGED
|
@@ -6330,7 +6330,7 @@ function setCell(shape, name, value, formula) {
|
|
|
6330
6330
|
if (formula) node.setAttribute("F", formula);
|
|
6331
6331
|
else if (attribute2(node, "F") !== "No Formula") node.removeAttribute("F");
|
|
6332
6332
|
}
|
|
6333
|
-
function admitted(root, shapeId, masterMovePins = /* @__PURE__ */ new Set()) {
|
|
6333
|
+
function admitted(root, shapeId, masterMovePins = /* @__PURE__ */ new Set(), masterDimensions = /* @__PURE__ */ new Map()) {
|
|
6334
6334
|
const containers = children(root, "Shapes");
|
|
6335
6335
|
if (containers.length !== 1)
|
|
6336
6336
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "One local Shapes container is required.");
|
|
@@ -6359,12 +6359,17 @@ function admitted(root, shapeId, masterMovePins = /* @__PURE__ */ new Set()) {
|
|
|
6359
6359
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
6360
6360
|
"Only local 2D shapes are admitted; line routing and glue are unsupported."
|
|
6361
6361
|
);
|
|
6362
|
-
|
|
6363
|
-
|
|
6362
|
+
const proven = masterDimensions.get(shape);
|
|
6363
|
+
if (!(numeric3(local.get("Width"), proven?.width) > 0) || !(numeric3(local.get("Height"), proven?.height) > 0))
|
|
6364
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Positive proven Width and Height caches are required.");
|
|
6364
6365
|
return shape;
|
|
6365
6366
|
}
|
|
6366
|
-
function protectedShape(shape, document) {
|
|
6367
|
+
function protectedShape(shape, document, masterMovePins = /* @__PURE__ */ new Set()) {
|
|
6367
6368
|
const local = cells(shape);
|
|
6369
|
+
const certifiedMove = shape.hasAttribute("Master") && ["PinX", "PinY"].every((name) => {
|
|
6370
|
+
const node = local.get(name);
|
|
6371
|
+
return node !== void 0 && masterMovePins.has(node);
|
|
6372
|
+
});
|
|
6368
6373
|
const styles = /* @__PURE__ */ new Map();
|
|
6369
6374
|
for (const container of children(document, "StyleSheets"))
|
|
6370
6375
|
for (const node of children(container, "StyleSheet")) {
|
|
@@ -6372,9 +6377,13 @@ function protectedShape(shape, document) {
|
|
|
6372
6377
|
if (!id || styles.has(id)) fail("EDIT_PROTECTED_CELL", "Ambiguous protection style IDs.");
|
|
6373
6378
|
styles.set(id, node);
|
|
6374
6379
|
}
|
|
6375
|
-
const
|
|
6380
|
+
const validateProtection = (cell) => {
|
|
6376
6381
|
try {
|
|
6377
|
-
|
|
6382
|
+
const cached2 = numeric3(cell);
|
|
6383
|
+
const operationIndependent = certifiedMove && ["LockWidth", "LockHeight", "LockAspect", "LockDelete"].includes(
|
|
6384
|
+
attribute2(cell, "N") ?? ""
|
|
6385
|
+
);
|
|
6386
|
+
if (cell.hasAttribute("E") || visioFormulaCachedValue(attribute2(cell, "V") ?? "", attribute2(cell, "U")).unit !== "scalar" || !(cached2 === 0 || operationIndependent && cached2 === 1))
|
|
6378
6387
|
fail("EDIT_PROTECTED_CELL", "Inherited protection is active or invalid.");
|
|
6379
6388
|
const source = executableCellFormula(attribute2(cell, "F"));
|
|
6380
6389
|
if (!source) return;
|
|
@@ -6385,12 +6394,12 @@ function protectedShape(shape, document) {
|
|
|
6385
6394
|
source,
|
|
6386
6395
|
() => fail("EDIT_PROTECTED_CELL", "Inherited protection has dependencies.")
|
|
6387
6396
|
);
|
|
6388
|
-
if (result.unit !== "scalar" || result.value !==
|
|
6389
|
-
fail("EDIT_PROTECTED_CELL", "Inherited protection formula is
|
|
6397
|
+
if (result.unit !== "scalar" || result.value !== cached2)
|
|
6398
|
+
fail("EDIT_PROTECTED_CELL", "Inherited protection formula cache is stale.");
|
|
6390
6399
|
} catch (error) {
|
|
6391
6400
|
fail(
|
|
6392
6401
|
"EDIT_PROTECTED_CELL",
|
|
6393
|
-
`Inherited protection cannot be proven
|
|
6402
|
+
`Inherited protection cannot be proven safe for this operation: ${error instanceof Error ? error.message : "invalid cache"}`
|
|
6394
6403
|
);
|
|
6395
6404
|
}
|
|
6396
6405
|
};
|
|
@@ -6402,16 +6411,18 @@ function protectedShape(shape, document) {
|
|
|
6402
6411
|
if (!style) fail("EDIT_PROTECTED_CELL", "Protection style ancestry cannot be resolved.");
|
|
6403
6412
|
const cell = cells(style).get(lock), parent = attribute2(style, category);
|
|
6404
6413
|
if (cell && attribute2(cell, "F") !== "Inh") {
|
|
6405
|
-
|
|
6414
|
+
validateProtection(cell);
|
|
6406
6415
|
return cell;
|
|
6407
6416
|
}
|
|
6408
6417
|
if (cell) {
|
|
6409
|
-
|
|
6418
|
+
validateProtection(cell);
|
|
6410
6419
|
if (parent === void 0 || parent === id)
|
|
6411
6420
|
fail("EDIT_PROTECTED_CELL", "Inherited protection has no provable parent.");
|
|
6412
6421
|
const inherited = resolve(parent, category, lock, seen);
|
|
6413
6422
|
if (!inherited)
|
|
6414
|
-
fail("EDIT_PROTECTED_CELL", "Inherited protection has no explicit
|
|
6423
|
+
fail("EDIT_PROTECTED_CELL", "Inherited protection has no explicit provable ancestor.");
|
|
6424
|
+
if (numeric3(cell) !== numeric3(inherited))
|
|
6425
|
+
fail("EDIT_PROTECTED_CELL", "Delegated protection cache disagrees with its ancestor.");
|
|
6415
6426
|
return inherited;
|
|
6416
6427
|
}
|
|
6417
6428
|
return parent !== void 0 && parent !== id ? resolve(parent, category, lock, seen) : void 0;
|
|
@@ -6488,6 +6499,130 @@ function resizeGeometry(shape, roots, edit, check) {
|
|
|
6488
6499
|
}
|
|
6489
6500
|
}
|
|
6490
6501
|
|
|
6502
|
+
// src/visio/edit-master-move.ts
|
|
6503
|
+
var protection = [
|
|
6504
|
+
"LockMoveX",
|
|
6505
|
+
"LockMoveY",
|
|
6506
|
+
"LockWidth",
|
|
6507
|
+
"LockHeight",
|
|
6508
|
+
"LockAspect",
|
|
6509
|
+
"LockDelete"
|
|
6510
|
+
];
|
|
6511
|
+
var dimensions2 = ["PinX", "PinY", "Width", "Height", "LocPinX", "LocPinY"];
|
|
6512
|
+
var emptyMasterMoveProof = () => ({
|
|
6513
|
+
pins: /* @__PURE__ */ new Set(),
|
|
6514
|
+
dimensions: /* @__PURE__ */ new Map()
|
|
6515
|
+
});
|
|
6516
|
+
function prepareMasterMovePins(roots, commands, bindings, check) {
|
|
6517
|
+
const result = /* @__PURE__ */ new Set();
|
|
6518
|
+
const provenDimensions = /* @__PURE__ */ new Map();
|
|
6519
|
+
let work = 1e5;
|
|
6520
|
+
const charge = (amount = 1) => {
|
|
6521
|
+
check();
|
|
6522
|
+
work -= amount;
|
|
6523
|
+
if (work < 0)
|
|
6524
|
+
fail("EDIT_UNSUPPORTED_PACKAGE_DEPENDENCY", "Master move preparation budget exceeded.");
|
|
6525
|
+
};
|
|
6526
|
+
const analyze = (formula) => {
|
|
6527
|
+
charge(formula.length);
|
|
6528
|
+
return analyzeVisioFormula(formula);
|
|
6529
|
+
};
|
|
6530
|
+
for (const command2 of commands) {
|
|
6531
|
+
charge();
|
|
6532
|
+
const root = roots.get(command2.pageId);
|
|
6533
|
+
const instance = children(children(root, "Shapes")[0], "Shape").find(
|
|
6534
|
+
(shape) => attribute2(shape, "ID") === command2.shapeId
|
|
6535
|
+
);
|
|
6536
|
+
if (!instance?.hasAttribute("Master")) continue;
|
|
6537
|
+
if (command2.type !== "move-shape")
|
|
6538
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Master-linked resizing and deletion remain unsupported.");
|
|
6539
|
+
const binding = bindings.find((candidate) => candidate.instance === instance);
|
|
6540
|
+
if (!binding) fail("UNSUPPORTED_GEOMETRY_EDIT", "A unique effective master root is required.");
|
|
6541
|
+
for (const node of [instance, binding.template]) {
|
|
6542
|
+
charge();
|
|
6543
|
+
if (attribute2(node, "Type") !== "Shape" || children(node, "Shapes").length || children(node, "ForeignData").length || children(node, "Rel").length || ["1", "true"].includes(attribute2(node, "Del") ?? ""))
|
|
6544
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Master moves require top-level local 2D shape roots.");
|
|
6545
|
+
}
|
|
6546
|
+
for (const name of ["BeginX", "BeginY", "EndX", "EndY"])
|
|
6547
|
+
if (binding.cells.has(name.toLowerCase()))
|
|
6548
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Master lines and endpoint routing remain unsupported.");
|
|
6549
|
+
const oneD = binding.cells.get("oned")?.node;
|
|
6550
|
+
charge();
|
|
6551
|
+
if (oneD && (numeric3(oneD) !== 0 || visioFormulaCachedValue(attribute2(oneD, "V") ?? "", attribute2(oneD, "U")).unit !== "scalar" || executableCellFormula(attribute2(oneD, "F"))))
|
|
6552
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "A static effective 2D master is required.");
|
|
6553
|
+
const local = cells(instance);
|
|
6554
|
+
for (const name of dimensions2) {
|
|
6555
|
+
const effective = binding.cells.get(name.toLowerCase())?.node;
|
|
6556
|
+
for (const node of /* @__PURE__ */ new Set([effective, ...local.has(name) ? [local.get(name)] : []])) {
|
|
6557
|
+
charge();
|
|
6558
|
+
numeric3(node);
|
|
6559
|
+
if (visioFormulaCachedValue("0", attribute2(node, "U") ?? "DL").unit !== "length")
|
|
6560
|
+
fail("EDIT_FORMULA_UNIT", "Master transform caches require length units.");
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
const dimension = (name) => numeric3(local.get(name) ?? binding.cells.get(name.toLowerCase())?.node);
|
|
6564
|
+
const width = dimension("Width"), height = dimension("Height");
|
|
6565
|
+
if (width <= 0 || height <= 0)
|
|
6566
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Positive proven effective dimensions are required.");
|
|
6567
|
+
provenDimensions.set(instance, { width, height });
|
|
6568
|
+
for (const name of protection) {
|
|
6569
|
+
charge();
|
|
6570
|
+
const node = binding.cells.get(name.toLowerCase())?.node;
|
|
6571
|
+
const cached2 = node ? numeric3(node) : NaN;
|
|
6572
|
+
const moving = name === "LockMoveX" || name === "LockMoveY";
|
|
6573
|
+
if (!node || visioFormulaCachedValue(attribute2(node, "V") ?? "", attribute2(node, "U")).unit !== "scalar" || ![0, 1].includes(cached2) || moving && cached2 !== 0)
|
|
6574
|
+
fail(
|
|
6575
|
+
"EDIT_PROTECTED_CELL",
|
|
6576
|
+
"Effective master protection must be proven boolean with inactive movement locks."
|
|
6577
|
+
);
|
|
6578
|
+
const formula = executableCellFormula(attribute2(node, "F"));
|
|
6579
|
+
if (formula) {
|
|
6580
|
+
const analysis = analyze(formula);
|
|
6581
|
+
if (analysis.dynamic || analysis.references.length || analysis.unsupportedFunctions.length)
|
|
6582
|
+
fail("EDIT_PROTECTED_CELL", "Effective master protection dependencies are unsupported.");
|
|
6583
|
+
const value = evaluateVisioFormula(
|
|
6584
|
+
formula,
|
|
6585
|
+
() => fail("EDIT_PROTECTED_CELL", "Unexpected protection dependency."),
|
|
6586
|
+
{ onStep: () => charge() }
|
|
6587
|
+
);
|
|
6588
|
+
if (value.unit !== "scalar" || value.value !== cached2)
|
|
6589
|
+
fail("EDIT_PROTECTED_CELL", "Effective master protection cache is stale.");
|
|
6590
|
+
}
|
|
6591
|
+
}
|
|
6592
|
+
for (const name of ["PinX", "PinY"]) {
|
|
6593
|
+
charge();
|
|
6594
|
+
const node = local.get(name);
|
|
6595
|
+
if (!node)
|
|
6596
|
+
fail("EDIT_PROTECTED_CELL", "The rotation pin must be an explicit local override.");
|
|
6597
|
+
if (binding.cells.get(name.toLowerCase())?.node !== node)
|
|
6598
|
+
fail("EDIT_PROTECTED_CELL", "The rotation pin must be an explicit local override.");
|
|
6599
|
+
charge(executableCellFormula(attribute2(node, "F"))?.length ?? 0);
|
|
6600
|
+
editableCell(node);
|
|
6601
|
+
const inherited = binding.inheritedCells.get(name.toLowerCase())?.node;
|
|
6602
|
+
numeric3(inherited);
|
|
6603
|
+
if (visioFormulaCachedValue("0", attribute2(inherited, "U") ?? "DL").unit !== "length")
|
|
6604
|
+
fail("EDIT_FORMULA_UNIT", "Inherited rotation pins require length units.");
|
|
6605
|
+
const formula = executableCellFormula(attribute2(inherited, "F"));
|
|
6606
|
+
if (formula) {
|
|
6607
|
+
const analysis = analyze(formula);
|
|
6608
|
+
if (analysis.guarded || analysis.dynamic || analysis.unsupportedFunctions.length)
|
|
6609
|
+
fail("EDIT_PROTECTED_CELL", "Protected or redirected master pins cannot be overridden.");
|
|
6610
|
+
}
|
|
6611
|
+
result.add(node);
|
|
6612
|
+
}
|
|
6613
|
+
}
|
|
6614
|
+
if (result.size) {
|
|
6615
|
+
const indexed = indexCells(roots, { check });
|
|
6616
|
+
const pins = new Set(
|
|
6617
|
+
[...indexed.values()].filter((cell) => cell.node && result.has(cell.node)).map(key)
|
|
6618
|
+
);
|
|
6619
|
+
for (const cell of indexed.values())
|
|
6620
|
+
if (charge(), cell.dependencies.some((dependency) => pins.has(dependency)))
|
|
6621
|
+
fail("EDIT_UNSUPPORTED_DEPENDENCY", "A page cache depends on a master rotation pin.");
|
|
6622
|
+
}
|
|
6623
|
+
return { pins: result, dimensions: provenDimensions };
|
|
6624
|
+
}
|
|
6625
|
+
|
|
6491
6626
|
// src/visio/edit-geometry.ts
|
|
6492
6627
|
function createRectangle(root, edit) {
|
|
6493
6628
|
const doc = root.ownerDocument;
|
|
@@ -6550,7 +6685,8 @@ function createRectangle(root, edit) {
|
|
|
6550
6685
|
container.appendChild(shape);
|
|
6551
6686
|
return shape;
|
|
6552
6687
|
}
|
|
6553
|
-
function applyGeometryEdit(roots, document, edit, check,
|
|
6688
|
+
function applyGeometryEdit(roots, document, edit, check, masterMoveProof = emptyMasterMoveProof()) {
|
|
6689
|
+
const masterMovePins = masterMoveProof.pins, masterDimensions = masterMoveProof.dimensions;
|
|
6554
6690
|
check();
|
|
6555
6691
|
const root = roots.get(edit.pageId);
|
|
6556
6692
|
if (!root) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
@@ -6565,9 +6701,10 @@ function applyGeometryEdit(roots, document, edit, check, masterMovePins = /* @__
|
|
|
6565
6701
|
const shape = admitted(
|
|
6566
6702
|
root,
|
|
6567
6703
|
edit.shapeId,
|
|
6568
|
-
edit.type === "move-shape" ? masterMovePins : /* @__PURE__ */ new Set()
|
|
6704
|
+
edit.type === "move-shape" ? masterMovePins : /* @__PURE__ */ new Set(),
|
|
6705
|
+
edit.type === "move-shape" ? masterDimensions : /* @__PURE__ */ new Map()
|
|
6569
6706
|
);
|
|
6570
|
-
protectedShape(shape, document);
|
|
6707
|
+
protectedShape(shape, document, edit.type === "move-shape" ? masterMovePins : /* @__PURE__ */ new Set());
|
|
6571
6708
|
if (edit.type !== "delete-shape") {
|
|
6572
6709
|
for (const connections2 of children(root, "Connects"))
|
|
6573
6710
|
for (const connection of children(connections2, "Connect"))
|
|
@@ -6589,9 +6726,10 @@ function applyGeometryEdit(roots, document, edit, check, masterMovePins = /* @__
|
|
|
6589
6726
|
return [edit.pageId];
|
|
6590
6727
|
}
|
|
6591
6728
|
if (edit.type === "move-shape") {
|
|
6729
|
+
const proven = masterDimensions.get(shape);
|
|
6592
6730
|
expected = {
|
|
6593
|
-
width: numeric3(local.get("Width")),
|
|
6594
|
-
height: numeric3(local.get("Height")),
|
|
6731
|
+
width: numeric3(local.get("Width"), proven?.width),
|
|
6732
|
+
height: numeric3(local.get("Height"), proven?.height),
|
|
6595
6733
|
x: edit.x,
|
|
6596
6734
|
y: edit.y
|
|
6597
6735
|
};
|
|
@@ -6599,10 +6737,7 @@ function applyGeometryEdit(roots, document, edit, check, masterMovePins = /* @__
|
|
|
6599
6737
|
["PinX", edit.x, "LockMoveX"],
|
|
6600
6738
|
["PinY", edit.y, "LockMoveY"]
|
|
6601
6739
|
]) {
|
|
6602
|
-
if (numeric3(
|
|
6603
|
-
local.get(name),
|
|
6604
|
-
name === "PinX" ? numeric3(local.get("Width")) / 2 : numeric3(local.get("Height")) / 2
|
|
6605
|
-
) === value)
|
|
6740
|
+
if (numeric3(local.get(name), name === "PinX" ? expected.width / 2 : expected.height / 2) === value)
|
|
6606
6741
|
continue;
|
|
6607
6742
|
unlocked(lock);
|
|
6608
6743
|
editableCell(local.get(name));
|
|
@@ -6645,10 +6780,14 @@ function applyGeometryEdit(roots, document, edit, check, masterMovePins = /* @__
|
|
|
6645
6780
|
}
|
|
6646
6781
|
if (!changed.length) return [];
|
|
6647
6782
|
const affectedPages = recalculateVisioCells(roots, changed, { check, masterMovePins });
|
|
6648
|
-
const
|
|
6649
|
-
|
|
6783
|
+
const resultShape = admitted(
|
|
6784
|
+
root,
|
|
6785
|
+
edit.shapeId,
|
|
6786
|
+
edit.type === "move-shape" ? masterMovePins : /* @__PURE__ */ new Set(),
|
|
6787
|
+
edit.type === "move-shape" ? masterDimensions : /* @__PURE__ */ new Map()
|
|
6650
6788
|
);
|
|
6651
|
-
|
|
6789
|
+
const result = cells(resultShape), provenResult = masterDimensions.get(resultShape);
|
|
6790
|
+
if (expected && (numeric3(result.get("Width"), provenResult?.width) !== expected.width || numeric3(result.get("Height"), provenResult?.height) !== expected.height || numeric3(result.get("PinX"), expected.width / 2) !== expected.x || numeric3(result.get("PinY"), expected.height / 2) !== expected.y))
|
|
6652
6791
|
fail(
|
|
6653
6792
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
6654
6793
|
"Dependent formulas would violate the requested geometry or fixed rotation pin."
|
|
@@ -6695,117 +6834,29 @@ function analyzeVisioMasterFormula(source, options) {
|
|
|
6695
6834
|
return { ...analysis, references: [...references.values()], dynamic: dynamic2, readsText, readsTheme };
|
|
6696
6835
|
}
|
|
6697
6836
|
|
|
6698
|
-
// src/visio/edit-master-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
charge(formula.length);
|
|
6719
|
-
return analyzeVisioFormula(formula);
|
|
6720
|
-
};
|
|
6721
|
-
for (const command2 of commands) {
|
|
6722
|
-
charge();
|
|
6723
|
-
const root = roots.get(command2.pageId);
|
|
6724
|
-
const instance = children(children(root, "Shapes")[0], "Shape").find(
|
|
6725
|
-
(shape) => attribute2(shape, "ID") === command2.shapeId
|
|
6726
|
-
);
|
|
6727
|
-
if (!instance?.hasAttribute("Master")) continue;
|
|
6728
|
-
if (command2.type !== "move-shape")
|
|
6729
|
-
fail("UNSUPPORTED_GEOMETRY_EDIT", "Master-linked resizing and deletion remain unsupported.");
|
|
6730
|
-
const binding = bindings.find((candidate) => candidate.instance === instance);
|
|
6731
|
-
if (!binding) fail("UNSUPPORTED_GEOMETRY_EDIT", "A unique effective master root is required.");
|
|
6732
|
-
for (const node of [instance, binding.template]) {
|
|
6733
|
-
charge();
|
|
6734
|
-
if (attribute2(node, "Type") !== "Shape" || children(node, "Shapes").length || children(node, "ForeignData").length || children(node, "Rel").length || ["1", "true"].includes(attribute2(node, "Del") ?? ""))
|
|
6735
|
-
fail("UNSUPPORTED_GEOMETRY_EDIT", "Master moves require top-level local 2D shape roots.");
|
|
6736
|
-
}
|
|
6737
|
-
for (const name of ["BeginX", "BeginY", "EndX", "EndY"])
|
|
6738
|
-
if (binding.cells.has(name.toLowerCase()))
|
|
6739
|
-
fail("UNSUPPORTED_GEOMETRY_EDIT", "Master lines and endpoint routing remain unsupported.");
|
|
6740
|
-
const oneD = binding.cells.get("oned")?.node;
|
|
6741
|
-
charge();
|
|
6742
|
-
if (oneD && (numeric3(oneD) !== 0 || visioFormulaCachedValue(attribute2(oneD, "V") ?? "", attribute2(oneD, "U")).unit !== "scalar" || executableCellFormula(attribute2(oneD, "F"))))
|
|
6743
|
-
fail("UNSUPPORTED_GEOMETRY_EDIT", "A static effective 2D master is required.");
|
|
6744
|
-
const local = cells(instance);
|
|
6745
|
-
for (const name of dimensions2) {
|
|
6746
|
-
charge();
|
|
6747
|
-
const node = local.get(name);
|
|
6748
|
-
numeric3(node);
|
|
6749
|
-
if (visioFormulaCachedValue("0", attribute2(node, "U") ?? "DL").unit !== "length")
|
|
6750
|
-
fail("EDIT_FORMULA_UNIT", "Master transform caches require length units.");
|
|
6751
|
-
}
|
|
6752
|
-
if (numeric3(local.get("Width")) <= 0 || numeric3(local.get("Height")) <= 0)
|
|
6753
|
-
fail("UNSUPPORTED_GEOMETRY_EDIT", "Positive explicit local dimensions are required.");
|
|
6754
|
-
for (const name of protection) {
|
|
6755
|
-
charge();
|
|
6756
|
-
const node = binding.cells.get(name.toLowerCase())?.node;
|
|
6757
|
-
if (!node || visioFormulaCachedValue(attribute2(node, "V") ?? "", attribute2(node, "U")).unit !== "scalar" || numeric3(node) !== 0)
|
|
6758
|
-
fail(
|
|
6759
|
-
"EDIT_PROTECTED_CELL",
|
|
6760
|
-
"Effective master protection must be explicitly proven inactive."
|
|
6761
|
-
);
|
|
6762
|
-
const formula = executableCellFormula(attribute2(node, "F"));
|
|
6763
|
-
if (formula) {
|
|
6764
|
-
const analysis = analyze(formula);
|
|
6765
|
-
if (analysis.dynamic || analysis.references.length || analysis.unsupportedFunctions.length)
|
|
6766
|
-
fail("EDIT_PROTECTED_CELL", "Effective master protection dependencies are unsupported.");
|
|
6767
|
-
const value = evaluateVisioFormula(
|
|
6768
|
-
formula,
|
|
6769
|
-
() => fail("EDIT_PROTECTED_CELL", "Unexpected protection dependency."),
|
|
6770
|
-
{ onStep: () => charge() }
|
|
6771
|
-
);
|
|
6772
|
-
if (value.unit !== "scalar" || value.value !== 0)
|
|
6773
|
-
fail("EDIT_PROTECTED_CELL", "Effective master protection is active or stale.");
|
|
6774
|
-
}
|
|
6775
|
-
}
|
|
6776
|
-
for (const name of ["PinX", "PinY"]) {
|
|
6777
|
-
charge();
|
|
6778
|
-
const node = local.get(name);
|
|
6779
|
-
if (binding.cells.get(name.toLowerCase())?.node !== node)
|
|
6780
|
-
fail("EDIT_PROTECTED_CELL", "The rotation pin must be an explicit local override.");
|
|
6781
|
-
charge(executableCellFormula(attribute2(node, "F"))?.length ?? 0);
|
|
6782
|
-
editableCell(node);
|
|
6783
|
-
const inherited = binding.inheritedCells.get(name.toLowerCase())?.node;
|
|
6784
|
-
numeric3(inherited);
|
|
6785
|
-
if (visioFormulaCachedValue("0", attribute2(inherited, "U") ?? "DL").unit !== "length")
|
|
6786
|
-
fail("EDIT_FORMULA_UNIT", "Inherited rotation pins require length units.");
|
|
6787
|
-
const formula = executableCellFormula(attribute2(inherited, "F"));
|
|
6788
|
-
if (formula) {
|
|
6789
|
-
const analysis = analyze(formula);
|
|
6790
|
-
if (analysis.guarded || analysis.dynamic || analysis.unsupportedFunctions.length)
|
|
6791
|
-
fail("EDIT_PROTECTED_CELL", "Protected or redirected master pins cannot be overridden.");
|
|
6792
|
-
}
|
|
6793
|
-
result.add(node);
|
|
6794
|
-
}
|
|
6795
|
-
}
|
|
6796
|
-
if (result.size) {
|
|
6797
|
-
const indexed = indexCells(roots, { check });
|
|
6798
|
-
const pins = new Set(
|
|
6799
|
-
[...indexed.values()].filter((cell) => cell.node && result.has(cell.node)).map(key)
|
|
6837
|
+
// src/visio/edit-master-index.ts
|
|
6838
|
+
function inheritedProtection(node, ancestor) {
|
|
6839
|
+
try {
|
|
6840
|
+
const boolean2 = (cell) => {
|
|
6841
|
+
if (!cell || cell.hasAttribute("E"))
|
|
6842
|
+
fail("EDIT_PROTECTED_CELL", "Inherited protection has an unresolved or error cache.");
|
|
6843
|
+
const value = visioFormulaCachedValue(attribute2(cell, "V") ?? "", attribute2(cell, "U"));
|
|
6844
|
+
if (value.unit !== "scalar" || ![0, 1].includes(value.value))
|
|
6845
|
+
fail("EDIT_PROTECTED_CELL", "Inherited protection requires scalar boolean caches.");
|
|
6846
|
+
return value.value;
|
|
6847
|
+
};
|
|
6848
|
+
if (boolean2(node) !== boolean2(ancestor))
|
|
6849
|
+
fail(
|
|
6850
|
+
"EDIT_PROTECTED_CELL",
|
|
6851
|
+
"Delegated master style protection cache disagrees with its ancestor."
|
|
6852
|
+
);
|
|
6853
|
+
} catch (error) {
|
|
6854
|
+
fail(
|
|
6855
|
+
"EDIT_PROTECTED_CELL",
|
|
6856
|
+
`Inherited master style protection cannot be proven: ${error instanceof Error ? error.message : "invalid cache"}`
|
|
6800
6857
|
);
|
|
6801
|
-
for (const cell of indexed.values())
|
|
6802
|
-
if (charge(), cell.dependencies.some((dependency) => pins.has(dependency)))
|
|
6803
|
-
fail("EDIT_UNSUPPORTED_DEPENDENCY", "A page cache depends on a master rotation pin.");
|
|
6804
6858
|
}
|
|
6805
|
-
return result;
|
|
6806
6859
|
}
|
|
6807
|
-
|
|
6808
|
-
// src/visio/edit-master-index.ts
|
|
6809
6860
|
function masterCells(sheet, charge = () => {
|
|
6810
6861
|
}) {
|
|
6811
6862
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -6863,7 +6914,7 @@ function assertMasterMarkup(root, known, check) {
|
|
|
6863
6914
|
}
|
|
6864
6915
|
}
|
|
6865
6916
|
function masterStyleCells(document, template, instance, check, charge = () => {
|
|
6866
|
-
}) {
|
|
6917
|
+
}, verifyMovementProtection = false) {
|
|
6867
6918
|
const styles = /* @__PURE__ */ new Map();
|
|
6868
6919
|
for (const container of children(document, "StyleSheets"))
|
|
6869
6920
|
for (const style of children(container, "StyleSheet")) {
|
|
@@ -6888,6 +6939,10 @@ function masterStyleCells(document, template, instance, check, charge = () => {
|
|
|
6888
6939
|
for (const [name, node] of own) {
|
|
6889
6940
|
charge();
|
|
6890
6941
|
if (attribute2(node, "F") !== "Inh") result2.set(name, node);
|
|
6942
|
+
else if (verifyMovementProtection && /^lock(move[xy]|width|height|aspect|delete)$/.test(name)) {
|
|
6943
|
+
charge();
|
|
6944
|
+
inheritedProtection(node, result2.get(name));
|
|
6945
|
+
}
|
|
6891
6946
|
}
|
|
6892
6947
|
return result2;
|
|
6893
6948
|
};
|
|
@@ -6959,12 +7014,20 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
6959
7014
|
const instances = [...roots].flatMap(
|
|
6960
7015
|
([pageId, root]) => masterShapes(root).filter((shape) => shape.hasAttribute("Master")).map((instance) => ({ pageId, instance }))
|
|
6961
7016
|
);
|
|
6962
|
-
if (!instances.length) return
|
|
7017
|
+
if (!instances.length) return emptyMasterMoveProof();
|
|
6963
7018
|
const documentPart = await related(pkg, "", "document");
|
|
6964
7019
|
if (!documentPart) problem("Missing master document relationship.");
|
|
6965
7020
|
const document = await visioXml(pkg, documentPart, "VisioDocument");
|
|
6966
7021
|
const mastersPart = await related(pkg, documentPart, "masters", false);
|
|
6967
|
-
if (!mastersPart)
|
|
7022
|
+
if (!mastersPart) {
|
|
7023
|
+
if (commands.some(
|
|
7024
|
+
(command2) => instances.some(
|
|
7025
|
+
(item) => item.pageId === command2.pageId && attribute2(item.instance, "ID") === command2.shapeId
|
|
7026
|
+
)
|
|
7027
|
+
))
|
|
7028
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Active master definitions are missing.");
|
|
7029
|
+
problem("Active master definitions are missing.");
|
|
7030
|
+
}
|
|
6968
7031
|
const definitions = /* @__PURE__ */ new Map();
|
|
6969
7032
|
for (const node of children(await visioXml(pkg, mastersPart, "Masters"), "Master")) {
|
|
6970
7033
|
const id = attribute2(node, "ID");
|
|
@@ -6979,6 +7042,12 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
6979
7042
|
if (--buildWork < 0) problem("Master effective-cell construction budget exceeded.");
|
|
6980
7043
|
};
|
|
6981
7044
|
const pageBindings = /* @__PURE__ */ new Map();
|
|
7045
|
+
const movingTargets = /* @__PURE__ */ new Set();
|
|
7046
|
+
for (const command2 of commands) {
|
|
7047
|
+
charge();
|
|
7048
|
+
if (command2.type === "move-shape")
|
|
7049
|
+
movingTargets.add(JSON.stringify([command2.pageId, command2.shapeId]));
|
|
7050
|
+
}
|
|
6982
7051
|
const pageShapes = /* @__PURE__ */ new Map();
|
|
6983
7052
|
for (const [pageId, root] of roots)
|
|
6984
7053
|
for (const shape of masterShapes(root)) {
|
|
@@ -7038,7 +7107,15 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
7038
7107
|
const templateId = attribute2(template, "ID");
|
|
7039
7108
|
if (!templateId || context.has(templateId)) problem("Master-local sheet IDs are ambiguous.");
|
|
7040
7109
|
const local = byTemplate.get(templateId), cells3 = /* @__PURE__ */ new Map();
|
|
7041
|
-
|
|
7110
|
+
const movedInstance = local === instance && movingTargets.has(JSON.stringify([pageId, attribute2(local, "ID")]));
|
|
7111
|
+
for (const [name, node] of masterStyleCells(
|
|
7112
|
+
document,
|
|
7113
|
+
template,
|
|
7114
|
+
local,
|
|
7115
|
+
check,
|
|
7116
|
+
charge,
|
|
7117
|
+
movedInstance
|
|
7118
|
+
))
|
|
7042
7119
|
cells3.set(name, { node, kind: "style" });
|
|
7043
7120
|
overlay(cells3, masterCells(template, charge), "template", charge);
|
|
7044
7121
|
const inheritedCells = new Map(cells3);
|
|
@@ -7168,7 +7245,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
7168
7245
|
for (const binding of bindings)
|
|
7169
7246
|
for (const name of binding.cells.keys()) {
|
|
7170
7247
|
const source = binding.cells.get(name);
|
|
7171
|
-
if (["pinx", "piny"].includes(name) && source?.kind === "instance" && movePins.has(source.node))
|
|
7248
|
+
if (["pinx", "piny"].includes(name) && source?.kind === "instance" && movePins.pins.has(source.node))
|
|
7172
7249
|
continue;
|
|
7173
7250
|
inspect2(binding, name);
|
|
7174
7251
|
}
|
|
@@ -7292,7 +7369,7 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
7292
7369
|
});
|
|
7293
7370
|
}
|
|
7294
7371
|
}
|
|
7295
|
-
let movePins =
|
|
7372
|
+
let movePins = emptyMasterMoveProof();
|
|
7296
7373
|
if (hasMasterInstances) {
|
|
7297
7374
|
for (const command2 of commands) {
|
|
7298
7375
|
const root = roots.get(command2.pageId);
|
|
@@ -7302,10 +7379,10 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
7302
7379
|
);
|
|
7303
7380
|
if (target?.hasAttribute("MasterShape") && !target.hasAttribute("Master"))
|
|
7304
7381
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Editing master-linked shapes is unsupported.");
|
|
7305
|
-
if (target?.hasAttribute("Master") && (command2.type !== "move-shape" || !["PinX", "PinY"
|
|
7382
|
+
if (target?.hasAttribute("Master") && (command2.type !== "move-shape" || !["PinX", "PinY"].every(
|
|
7306
7383
|
(name) => children(target, "Cell").some((node) => attribute2(node, "N") === name)
|
|
7307
7384
|
)))
|
|
7308
|
-
fail("UNSUPPORTED_GEOMETRY_EDIT", "Master moves require
|
|
7385
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Master moves require explicit local rotation pins.");
|
|
7309
7386
|
}
|
|
7310
7387
|
movePins = await assertVisioMasterIndependence(pkg, roots, commands, check);
|
|
7311
7388
|
}
|
|
@@ -7402,7 +7479,7 @@ async function editVsdx(input, edits, options = {}) {
|
|
|
7402
7479
|
const roots = /* @__PURE__ */ new Map();
|
|
7403
7480
|
const geometry = commands.some((command2) => command2.type !== "replace-plain-text");
|
|
7404
7481
|
let document;
|
|
7405
|
-
let masterMovePins =
|
|
7482
|
+
let masterMovePins = emptyMasterMoveProof();
|
|
7406
7483
|
if (geometry) {
|
|
7407
7484
|
for (const [pageId, path2] of pages) {
|
|
7408
7485
|
const sourceRoot = await visioXml(pkg, path2, "PageContents");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type CellRange } from '../address.js';
|
|
2
2
|
import type { Area } from './values.js';
|
|
3
3
|
/**
|
|
4
|
-
* Items keyed by the areas they cover.
|
|
5
|
-
* per-column row chunks
|
|
6
|
-
*
|
|
4
|
+
* Items keyed by the areas they cover. Short single-row ranges are found by cell key; other
|
|
5
|
+
* narrow ranges sit in per-column row chunks, tall ranges in per-column lists and very wide
|
|
6
|
+
* ranges in one list per sheet.
|
|
7
7
|
*/
|
|
8
8
|
export declare class AreaIndex<T> {
|
|
9
9
|
private readonly cells;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"area-index.d.ts","sourceRoot":"","sources":["../../../src/xlsx/formula/area-index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,SAAS,EAAiC,MAAM,eAAe,CAAC;AACvF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAyBxC;;;;GAIG;AACH,qBAAa,SAAS,CAAC,CAAC;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;IAC7D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2D;IACnF,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8C;IACnE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiC;IAEtD,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"area-index.d.ts","sourceRoot":"","sources":["../../../src/xlsx/formula/area-index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,SAAS,EAAiC,MAAM,eAAe,CAAC;AACvF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAyBxC;;;;GAIG;AACH,qBAAa,SAAS,CAAC,CAAC;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;IAC7D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2D;IACnF,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8C;IACnE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiC;IAEtD,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IA6B9B,kEAAkE;IAClE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI;IAMpE,OAAO,CAAC,OAAO;CA2Cf"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CellRange } from '../address.js';
|
|
1
2
|
import type { Cell } from '../model.js';
|
|
2
3
|
import type { FormulaAst } from './ast.js';
|
|
3
4
|
import type { Frame } from './context.js';
|
|
@@ -9,7 +10,7 @@ export declare abstract class EngineCore extends EngineHost {
|
|
|
9
10
|
protected run(seeds: Set<FormulaNode>, everything: boolean): void;
|
|
10
11
|
/** Seeds plus every formula that (transitively) reads their cells or spill ranges. */
|
|
11
12
|
protected closure(seeds: Set<FormulaNode>): Set<FormulaNode>;
|
|
12
|
-
protected evaluateSet(dirty: Set<FormulaNode
|
|
13
|
+
protected evaluateSet(dirty: Set<FormulaNode>, full: boolean): void;
|
|
13
14
|
/**
|
|
14
15
|
* Computes a formula at the top level. Formulas it reads on demand nest inside it; past a depth
|
|
15
16
|
* limit they unwind with `Deferred` and are computed here first (an explicit stack), so long
|
|
@@ -19,6 +20,8 @@ export declare abstract class EngineCore extends EngineHost {
|
|
|
19
20
|
protected markCycle(node: FormulaNode): void;
|
|
20
21
|
protected compute(node: FormulaNode): void;
|
|
21
22
|
protected store(node: FormulaNode, cell: Cell, result: Scalar | Matrix): void;
|
|
23
|
+
/** New spill edges may reuse the order only when every reader already follows its anchor. */
|
|
24
|
+
protected updateOrder(node: FormulaNode, before: CellRange | undefined, blockedBefore: CellRange | undefined): void;
|
|
22
25
|
protected frameFor(sheet: number, row: number, col: number, root: FormulaAst | undefined, legacy?: boolean): Frame;
|
|
23
26
|
protected evaluateFormula(node: FormulaNode): Scalar | Matrix;
|
|
24
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-core.d.ts","sourceRoot":"","sources":["../../../src/xlsx/formula/engine-core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine-core.d.ts","sourceRoot":"","sources":["../../../src/xlsx/formula/engine-core.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAY,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKxD,OAAO,K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
|
@@ -3,6 +3,7 @@ import type { Cell, Workbook } from '../model.js';
|
|
|
3
3
|
import { FormulaError, type FormulaAst } from './ast.js';
|
|
4
4
|
import type { EvalHost } from './context.js';
|
|
5
5
|
import type { CalcEngineOptions } from './engine-types.js';
|
|
6
|
+
import type { FormulaOrder } from './engine-order.js';
|
|
6
7
|
import { type FormulaNode } from './graph.js';
|
|
7
8
|
import { AreaIndex, ColumnIndex, ReverseIndex } from './graph-index.js';
|
|
8
9
|
import { type Area, Matrix, type Scalar } from './values.js';
|
|
@@ -32,6 +33,7 @@ export declare abstract class EngineHost implements EvalHost {
|
|
|
32
33
|
protected columnIndex: ColumnIndex | undefined;
|
|
33
34
|
protected reverseIndex: ReverseIndex | undefined;
|
|
34
35
|
protected footprintIndex: AreaIndex<FormulaNode> | undefined;
|
|
36
|
+
protected fullOrder: FormulaOrder | undefined;
|
|
35
37
|
/** Range reads cached for one evaluation pass (see `readBlock`). */
|
|
36
38
|
protected readonly blockCache: Map<string, Matrix>;
|
|
37
39
|
/** Counts reads that hit a formula still being evaluated (a circular reference). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-host.d.ts","sourceRoot":"","sources":["../../../src/xlsx/formula/engine-host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,SAAS,EAAkB,MAAM,eAAe,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIxE,OAAO,EAA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WAAW;IAIhC,SAAS,CAAC,OAAO,IAAI,YAAY;IAIjC,oEAAoE;IACpE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;CACnD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FormulaNode } from './graph.js';
|
|
2
|
+
/** A validated dependency order; formula results are still evaluated on every pass. */
|
|
3
|
+
export interface FormulaOrder {
|
|
4
|
+
components: {
|
|
5
|
+
nodes: FormulaNode[];
|
|
6
|
+
cyclic: boolean;
|
|
7
|
+
}[];
|
|
8
|
+
ranks: Map<FormulaNode, number>;
|
|
9
|
+
}
|
|
10
|
+
export declare function formulaOrder(nodes: Iterable<FormulaNode>, successors: (node: FormulaNode) => FormulaNode[]): FormulaOrder;
|
|
11
|
+
//# sourceMappingURL=engine-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-order.d.ts","sourceRoot":"","sources":["../../../src/xlsx/formula/engine-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,uFAAuF;AACvF,MAAM,WAAW,YAAY;IAC5B,UAAU,EAAE;QAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IACxD,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,wBAAgB,YAAY,CAC3B,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,EAC5B,UAAU,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,WAAW,EAAE,GAC9C,YAAY,CAQd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spill.d.ts","sourceRoot":"","sources":["../../../src/xlsx/formula/spill.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAqC,MAAM,eAAe,CA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