ooxml-core 0.10.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/docx.d.ts +13 -0
- package/dist/automation/docx.d.ts.map +1 -0
- package/dist/automation/index.cjs +36953 -0
- package/dist/automation/index.d.ts +6 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.mjs +36939 -0
- package/dist/automation/node.cjs +103 -0
- package/dist/automation/node.d.ts +16 -0
- package/dist/automation/node.d.ts.map +1 -0
- package/dist/automation/node.mjs +101 -0
- package/dist/automation/visio.d.ts +30 -0
- package/dist/automation/visio.d.ts.map +1 -0
- package/dist/automation/xlsx.d.ts +25 -0
- package/dist/automation/xlsx.d.ts.map +1 -0
- package/dist/pptx/automation/index.cjs +149047 -0
- package/dist/pptx/automation/index.d.ts +1474 -0
- package/dist/pptx/automation/index.d.ts.map +1 -0
- package/dist/pptx/automation/index.mjs +148926 -0
- package/dist/pptx/chunks/{index-BWUBPGgv.d.ts → index-BWRd8p4y.d.ts} +2 -2
- package/dist/pptx/chunks/{index-BWUBPGgv.d.ts.map → index-BWRd8p4y.d.ts.map} +1 -1
- package/dist/pptx/chunks/index-LoCVDu8Z.d.ts +9644 -0
- package/dist/pptx/chunks/index-LoCVDu8Z.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-IlJiffp7.d.ts → text-operations-2tKzrY5o.d.ts} +7381 -7381
- package/dist/pptx/chunks/text-operations-2tKzrY5o.d.ts.map +1 -0
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/index.d.ts +4 -9644
- 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 +20 -0
- package/dist/visio/edit-master-move.d.ts.map +1 -0
- 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-recalculate-index.d.ts +2 -0
- package/dist/visio/edit-recalculate-index.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 +250 -36
- package/dist/visio/index.mjs +250 -36
- 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 +21 -3
- package/dist/pptx/chunks/text-operations-IlJiffp7.d.ts.map +0 -1
- package/dist/pptx/index.d.ts.map +0 -1
package/dist/visio/index.mjs
CHANGED
|
@@ -6177,7 +6177,7 @@ function recalculateVisioCells(roots, changed, options = {}) {
|
|
|
6177
6177
|
if (active.size >= maxDepth)
|
|
6178
6178
|
fail("LIMIT_FORMULA_DEPTH", "ShapeSheet dependency depth limit exceeded.");
|
|
6179
6179
|
const item = cells3.get(id);
|
|
6180
|
-
if (!item || item.unsafe)
|
|
6180
|
+
if (!item || item.unsafe && (!item.node || !options.masterMovePins?.has(item.node)))
|
|
6181
6181
|
fail(
|
|
6182
6182
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
6183
6183
|
"Affected formula references missing, inherited or grouped cells."
|
|
@@ -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) {
|
|
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.");
|
|
@@ -6340,7 +6340,10 @@ function admitted(root, shapeId) {
|
|
|
6340
6340
|
if (candidates.length !== 1)
|
|
6341
6341
|
fail("EDIT_TARGET_NOT_FOUND", "A unique top-level local shape is required.");
|
|
6342
6342
|
const shape = candidates[0];
|
|
6343
|
-
if (shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")
|
|
6343
|
+
if ((shape.hasAttribute("Master") || shape.hasAttribute("MasterShape")) && !["PinX", "PinY"].every((name) => {
|
|
6344
|
+
const cell = cells(shape).get(name);
|
|
6345
|
+
return cell && masterMovePins.has(cell);
|
|
6346
|
+
}) || ["1", "true"].includes(attribute2(shape, "Del") ?? "") || children(shape, "Shapes").length || children(shape, "ForeignData").length || children(shape, "Rel").length || attribute2(shape, "Type") && attribute2(shape, "Type") !== "Shape")
|
|
6344
6347
|
fail(
|
|
6345
6348
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
6346
6349
|
"Master, group, foreign, deleted and non-shape operations are unsupported."
|
|
@@ -6356,12 +6359,17 @@ function admitted(root, shapeId) {
|
|
|
6356
6359
|
"UNSUPPORTED_GEOMETRY_EDIT",
|
|
6357
6360
|
"Only local 2D shapes are admitted; line routing and glue are unsupported."
|
|
6358
6361
|
);
|
|
6359
|
-
|
|
6360
|
-
|
|
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.");
|
|
6361
6365
|
return shape;
|
|
6362
6366
|
}
|
|
6363
|
-
function protectedShape(shape, document) {
|
|
6367
|
+
function protectedShape(shape, document, masterMovePins = /* @__PURE__ */ new Set()) {
|
|
6364
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
|
+
});
|
|
6365
6373
|
const styles = /* @__PURE__ */ new Map();
|
|
6366
6374
|
for (const container of children(document, "StyleSheets"))
|
|
6367
6375
|
for (const node of children(container, "StyleSheet")) {
|
|
@@ -6369,9 +6377,13 @@ function protectedShape(shape, document) {
|
|
|
6369
6377
|
if (!id || styles.has(id)) fail("EDIT_PROTECTED_CELL", "Ambiguous protection style IDs.");
|
|
6370
6378
|
styles.set(id, node);
|
|
6371
6379
|
}
|
|
6372
|
-
const
|
|
6380
|
+
const validateProtection = (cell) => {
|
|
6373
6381
|
try {
|
|
6374
|
-
|
|
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))
|
|
6375
6387
|
fail("EDIT_PROTECTED_CELL", "Inherited protection is active or invalid.");
|
|
6376
6388
|
const source = executableCellFormula(attribute2(cell, "F"));
|
|
6377
6389
|
if (!source) return;
|
|
@@ -6382,12 +6394,12 @@ function protectedShape(shape, document) {
|
|
|
6382
6394
|
source,
|
|
6383
6395
|
() => fail("EDIT_PROTECTED_CELL", "Inherited protection has dependencies.")
|
|
6384
6396
|
);
|
|
6385
|
-
if (result.unit !== "scalar" || result.value !==
|
|
6386
|
-
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.");
|
|
6387
6399
|
} catch (error) {
|
|
6388
6400
|
fail(
|
|
6389
6401
|
"EDIT_PROTECTED_CELL",
|
|
6390
|
-
`Inherited protection cannot be proven
|
|
6402
|
+
`Inherited protection cannot be proven safe for this operation: ${error instanceof Error ? error.message : "invalid cache"}`
|
|
6391
6403
|
);
|
|
6392
6404
|
}
|
|
6393
6405
|
};
|
|
@@ -6399,16 +6411,18 @@ function protectedShape(shape, document) {
|
|
|
6399
6411
|
if (!style) fail("EDIT_PROTECTED_CELL", "Protection style ancestry cannot be resolved.");
|
|
6400
6412
|
const cell = cells(style).get(lock), parent = attribute2(style, category);
|
|
6401
6413
|
if (cell && attribute2(cell, "F") !== "Inh") {
|
|
6402
|
-
|
|
6414
|
+
validateProtection(cell);
|
|
6403
6415
|
return cell;
|
|
6404
6416
|
}
|
|
6405
6417
|
if (cell) {
|
|
6406
|
-
|
|
6418
|
+
validateProtection(cell);
|
|
6407
6419
|
if (parent === void 0 || parent === id)
|
|
6408
6420
|
fail("EDIT_PROTECTED_CELL", "Inherited protection has no provable parent.");
|
|
6409
6421
|
const inherited = resolve(parent, category, lock, seen);
|
|
6410
6422
|
if (!inherited)
|
|
6411
|
-
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.");
|
|
6412
6426
|
return inherited;
|
|
6413
6427
|
}
|
|
6414
6428
|
return parent !== void 0 && parent !== id ? resolve(parent, category, lock, seen) : void 0;
|
|
@@ -6485,6 +6499,130 @@ function resizeGeometry(shape, roots, edit, check) {
|
|
|
6485
6499
|
}
|
|
6486
6500
|
}
|
|
6487
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
|
+
|
|
6488
6626
|
// src/visio/edit-geometry.ts
|
|
6489
6627
|
function createRectangle(root, edit) {
|
|
6490
6628
|
const doc = root.ownerDocument;
|
|
@@ -6547,7 +6685,8 @@ function createRectangle(root, edit) {
|
|
|
6547
6685
|
container.appendChild(shape);
|
|
6548
6686
|
return shape;
|
|
6549
6687
|
}
|
|
6550
|
-
function applyGeometryEdit(roots, document, edit, check) {
|
|
6688
|
+
function applyGeometryEdit(roots, document, edit, check, masterMoveProof = emptyMasterMoveProof()) {
|
|
6689
|
+
const masterMovePins = masterMoveProof.pins, masterDimensions = masterMoveProof.dimensions;
|
|
6551
6690
|
check();
|
|
6552
6691
|
const root = roots.get(edit.pageId);
|
|
6553
6692
|
if (!root) fail("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
|
|
@@ -6559,8 +6698,13 @@ function applyGeometryEdit(roots, document, edit, check) {
|
|
|
6559
6698
|
expected = { width: edit.width, height: edit.height, x: edit.x, y: edit.y };
|
|
6560
6699
|
for (const name of ["Width", "Height", "PinX", "PinY"]) add(name);
|
|
6561
6700
|
} else {
|
|
6562
|
-
const shape = admitted(
|
|
6563
|
-
|
|
6701
|
+
const shape = admitted(
|
|
6702
|
+
root,
|
|
6703
|
+
edit.shapeId,
|
|
6704
|
+
edit.type === "move-shape" ? masterMovePins : /* @__PURE__ */ new Set(),
|
|
6705
|
+
edit.type === "move-shape" ? masterDimensions : /* @__PURE__ */ new Map()
|
|
6706
|
+
);
|
|
6707
|
+
protectedShape(shape, document, edit.type === "move-shape" ? masterMovePins : /* @__PURE__ */ new Set());
|
|
6564
6708
|
if (edit.type !== "delete-shape") {
|
|
6565
6709
|
for (const connections2 of children(root, "Connects"))
|
|
6566
6710
|
for (const connection of children(connections2, "Connect"))
|
|
@@ -6582,9 +6726,10 @@ function applyGeometryEdit(roots, document, edit, check) {
|
|
|
6582
6726
|
return [edit.pageId];
|
|
6583
6727
|
}
|
|
6584
6728
|
if (edit.type === "move-shape") {
|
|
6729
|
+
const proven = masterDimensions.get(shape);
|
|
6585
6730
|
expected = {
|
|
6586
|
-
width: numeric3(local.get("Width")),
|
|
6587
|
-
height: numeric3(local.get("Height")),
|
|
6731
|
+
width: numeric3(local.get("Width"), proven?.width),
|
|
6732
|
+
height: numeric3(local.get("Height"), proven?.height),
|
|
6588
6733
|
x: edit.x,
|
|
6589
6734
|
y: edit.y
|
|
6590
6735
|
};
|
|
@@ -6592,10 +6737,7 @@ function applyGeometryEdit(roots, document, edit, check) {
|
|
|
6592
6737
|
["PinX", edit.x, "LockMoveX"],
|
|
6593
6738
|
["PinY", edit.y, "LockMoveY"]
|
|
6594
6739
|
]) {
|
|
6595
|
-
if (numeric3(
|
|
6596
|
-
local.get(name),
|
|
6597
|
-
name === "PinX" ? numeric3(local.get("Width")) / 2 : numeric3(local.get("Height")) / 2
|
|
6598
|
-
) === value)
|
|
6740
|
+
if (numeric3(local.get(name), name === "PinX" ? expected.width / 2 : expected.height / 2) === value)
|
|
6599
6741
|
continue;
|
|
6600
6742
|
unlocked(lock);
|
|
6601
6743
|
editableCell(local.get(name));
|
|
@@ -6637,9 +6779,15 @@ function applyGeometryEdit(roots, document, edit, check) {
|
|
|
6637
6779
|
}
|
|
6638
6780
|
}
|
|
6639
6781
|
if (!changed.length) return [];
|
|
6640
|
-
const affectedPages = recalculateVisioCells(roots, changed, { check });
|
|
6641
|
-
const
|
|
6642
|
-
|
|
6782
|
+
const affectedPages = recalculateVisioCells(roots, changed, { check, masterMovePins });
|
|
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()
|
|
6788
|
+
);
|
|
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))
|
|
6643
6791
|
fail(
|
|
6644
6792
|
"EDIT_UNSUPPORTED_DEPENDENCY",
|
|
6645
6793
|
"Dependent formulas would violate the requested geometry or fixed rotation pin."
|
|
@@ -6687,6 +6835,28 @@ function analyzeVisioMasterFormula(source, options) {
|
|
|
6687
6835
|
}
|
|
6688
6836
|
|
|
6689
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"}`
|
|
6857
|
+
);
|
|
6858
|
+
}
|
|
6859
|
+
}
|
|
6690
6860
|
function masterCells(sheet, charge = () => {
|
|
6691
6861
|
}) {
|
|
6692
6862
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -6744,7 +6914,7 @@ function assertMasterMarkup(root, known, check) {
|
|
|
6744
6914
|
}
|
|
6745
6915
|
}
|
|
6746
6916
|
function masterStyleCells(document, template, instance, check, charge = () => {
|
|
6747
|
-
}) {
|
|
6917
|
+
}, verifyMovementProtection = false) {
|
|
6748
6918
|
const styles = /* @__PURE__ */ new Map();
|
|
6749
6919
|
for (const container of children(document, "StyleSheets"))
|
|
6750
6920
|
for (const style of children(container, "StyleSheet")) {
|
|
@@ -6769,6 +6939,10 @@ function masterStyleCells(document, template, instance, check, charge = () => {
|
|
|
6769
6939
|
for (const [name, node] of own) {
|
|
6770
6940
|
charge();
|
|
6771
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
|
+
}
|
|
6772
6946
|
}
|
|
6773
6947
|
return result2;
|
|
6774
6948
|
};
|
|
@@ -6840,12 +7014,20 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
6840
7014
|
const instances = [...roots].flatMap(
|
|
6841
7015
|
([pageId, root]) => masterShapes(root).filter((shape) => shape.hasAttribute("Master")).map((instance) => ({ pageId, instance }))
|
|
6842
7016
|
);
|
|
6843
|
-
if (!instances.length) return;
|
|
7017
|
+
if (!instances.length) return emptyMasterMoveProof();
|
|
6844
7018
|
const documentPart = await related(pkg, "", "document");
|
|
6845
7019
|
if (!documentPart) problem("Missing master document relationship.");
|
|
6846
7020
|
const document = await visioXml(pkg, documentPart, "VisioDocument");
|
|
6847
7021
|
const mastersPart = await related(pkg, documentPart, "masters", false);
|
|
6848
|
-
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
|
+
}
|
|
6849
7031
|
const definitions = /* @__PURE__ */ new Map();
|
|
6850
7032
|
for (const node of children(await visioXml(pkg, mastersPart, "Masters"), "Master")) {
|
|
6851
7033
|
const id = attribute2(node, "ID");
|
|
@@ -6860,6 +7042,12 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
6860
7042
|
if (--buildWork < 0) problem("Master effective-cell construction budget exceeded.");
|
|
6861
7043
|
};
|
|
6862
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
|
+
}
|
|
6863
7051
|
const pageShapes = /* @__PURE__ */ new Map();
|
|
6864
7052
|
for (const [pageId, root] of roots)
|
|
6865
7053
|
for (const shape of masterShapes(root)) {
|
|
@@ -6919,15 +7107,25 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
6919
7107
|
const templateId = attribute2(template, "ID");
|
|
6920
7108
|
if (!templateId || context.has(templateId)) problem("Master-local sheet IDs are ambiguous.");
|
|
6921
7109
|
const local = byTemplate.get(templateId), cells3 = /* @__PURE__ */ new Map();
|
|
6922
|
-
|
|
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
|
+
))
|
|
6923
7119
|
cells3.set(name, { node, kind: "style" });
|
|
6924
7120
|
overlay(cells3, masterCells(template, charge), "template", charge);
|
|
7121
|
+
const inheritedCells = new Map(cells3);
|
|
6925
7122
|
overlay(cells3, masterCells(local, charge), "instance", charge);
|
|
6926
7123
|
const binding = {
|
|
6927
7124
|
id: `${pageId}:${attribute2(instance, "ID")}:${templateId}`,
|
|
6928
7125
|
pageId,
|
|
6929
7126
|
template,
|
|
6930
7127
|
cells: cells3,
|
|
7128
|
+
inheritedCells,
|
|
6931
7129
|
context,
|
|
6932
7130
|
...local ? { instance: local } : {}
|
|
6933
7131
|
};
|
|
@@ -6938,6 +7136,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
6938
7136
|
for (const id of byTemplate.keys())
|
|
6939
7137
|
if (!context.has(id)) problem("MasterShape refers to a missing template.");
|
|
6940
7138
|
}
|
|
7139
|
+
const movePins = prepareMasterMovePins(roots, commands, bindings, check);
|
|
6941
7140
|
const changed = commands.flatMap(
|
|
6942
7141
|
(command2) => command2.type === "delete-shape" ? [] : (command2.type === "move-shape" ? ["PinX", "PinY"] : command2.type === "resize-shape" ? ["Width", "Height"] : ["Width", "Height", "PinX", "PinY"]).map((cell) => ({ pageId: command2.pageId, shapeId: command2.shapeId, cell }))
|
|
6943
7142
|
);
|
|
@@ -6965,6 +7164,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
6965
7164
|
template: shape,
|
|
6966
7165
|
instance: shape,
|
|
6967
7166
|
cells: cells3,
|
|
7167
|
+
inheritedCells: /* @__PURE__ */ new Map(),
|
|
6968
7168
|
context: /* @__PURE__ */ new Map()
|
|
6969
7169
|
};
|
|
6970
7170
|
pageInputs.set(id, result);
|
|
@@ -7042,7 +7242,14 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
|
|
|
7042
7242
|
active.delete(id);
|
|
7043
7243
|
done.add(id);
|
|
7044
7244
|
};
|
|
7045
|
-
for (const binding of bindings)
|
|
7245
|
+
for (const binding of bindings)
|
|
7246
|
+
for (const name of binding.cells.keys()) {
|
|
7247
|
+
const source = binding.cells.get(name);
|
|
7248
|
+
if (["pinx", "piny"].includes(name) && source?.kind === "instance" && movePins.pins.has(source.node))
|
|
7249
|
+
continue;
|
|
7250
|
+
inspect2(binding, name);
|
|
7251
|
+
}
|
|
7252
|
+
return movePins;
|
|
7046
7253
|
}
|
|
7047
7254
|
|
|
7048
7255
|
// src/visio/edit-scope.ts
|
|
@@ -7162,6 +7369,7 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
7162
7369
|
});
|
|
7163
7370
|
}
|
|
7164
7371
|
}
|
|
7372
|
+
let movePins = emptyMasterMoveProof();
|
|
7165
7373
|
if (hasMasterInstances) {
|
|
7166
7374
|
for (const command2 of commands) {
|
|
7167
7375
|
const root = roots.get(command2.pageId);
|
|
@@ -7169,12 +7377,16 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
7169
7377
|
const target = Array.from(root.getElementsByTagNameNS(root.namespaceURI, "Shape")).find(
|
|
7170
7378
|
(shape) => attribute2(shape, "ID") === command2.shapeId
|
|
7171
7379
|
);
|
|
7172
|
-
if (target?.hasAttribute("
|
|
7380
|
+
if (target?.hasAttribute("MasterShape") && !target.hasAttribute("Master"))
|
|
7173
7381
|
fail("UNSUPPORTED_GEOMETRY_EDIT", "Editing master-linked shapes is unsupported.");
|
|
7382
|
+
if (target?.hasAttribute("Master") && (command2.type !== "move-shape" || !["PinX", "PinY"].every(
|
|
7383
|
+
(name) => children(target, "Cell").some((node) => attribute2(node, "N") === name)
|
|
7384
|
+
)))
|
|
7385
|
+
fail("UNSUPPORTED_GEOMETRY_EDIT", "Master moves require explicit local rotation pins.");
|
|
7174
7386
|
}
|
|
7175
|
-
await assertVisioMasterIndependence(pkg, roots, commands, check);
|
|
7387
|
+
movePins = await assertVisioMasterIndependence(pkg, roots, commands, check);
|
|
7176
7388
|
}
|
|
7177
|
-
if (!documentRoot) return;
|
|
7389
|
+
if (!documentRoot) return movePins;
|
|
7178
7390
|
const styles = /* @__PURE__ */ new Map();
|
|
7179
7391
|
for (const container of children(documentRoot, "StyleSheets"))
|
|
7180
7392
|
for (const style of children(container, "StyleSheet")) {
|
|
@@ -7239,6 +7451,7 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
7239
7451
|
}
|
|
7240
7452
|
}
|
|
7241
7453
|
}
|
|
7454
|
+
return movePins;
|
|
7242
7455
|
}
|
|
7243
7456
|
|
|
7244
7457
|
// src/visio/edit.ts
|
|
@@ -7266,12 +7479,13 @@ async function editVsdx(input, edits, options = {}) {
|
|
|
7266
7479
|
const roots = /* @__PURE__ */ new Map();
|
|
7267
7480
|
const geometry = commands.some((command2) => command2.type !== "replace-plain-text");
|
|
7268
7481
|
let document;
|
|
7482
|
+
let masterMovePins = emptyMasterMoveProof();
|
|
7269
7483
|
if (geometry) {
|
|
7270
7484
|
for (const [pageId, path2] of pages) {
|
|
7271
7485
|
const sourceRoot = await visioXml(pkg, path2, "PageContents");
|
|
7272
7486
|
roots.set(pageId, sourceRoot.ownerDocument.cloneNode(true).documentElement);
|
|
7273
7487
|
}
|
|
7274
|
-
await assertGeometryPackageScope(
|
|
7488
|
+
masterMovePins = await assertGeometryPackageScope(
|
|
7275
7489
|
pkg,
|
|
7276
7490
|
new Set(pages.values()),
|
|
7277
7491
|
commands.filter((command2) => command2.type !== "replace-plain-text"),
|
|
@@ -7298,7 +7512,7 @@ async function editVsdx(input, edits, options = {}) {
|
|
|
7298
7512
|
textChanged = true;
|
|
7299
7513
|
}
|
|
7300
7514
|
} else {
|
|
7301
|
-
for (const pageId of applyGeometryEdit(roots, document, command2, check))
|
|
7515
|
+
for (const pageId of applyGeometryEdit(roots, document, command2, check, masterMovePins))
|
|
7302
7516
|
dirty.set(pages.get(pageId), roots.get(pageId));
|
|
7303
7517
|
}
|
|
7304
7518
|
}
|
|
@@ -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":"A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AE,SAAS,GAAG,SAAS,GAClC,IAAI;IAsBP,SAAS,CAAC,QAAQ,CACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,MAAM,UAAQ,GACZ,KAAK;IAIR,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM;CAiB7D"}
|
|
@@ -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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WAAW;IA6Bd,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI;IAU9D,SAAS,CAAC,YAAY,IAAI,IAAI;IAO9B,4FAA4F;IAC5F,SAAS,CAAC,YAAY,IAAI,SAAS,CAAC,WAAW,CAAC;IAahD,SAAS,CAAC,QAAQ,IAAI,WAAW,EAAE;IAMnC,SAAS,CAAC,OAAO,IAAI,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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GAAG,SAAS,GAAG,SAAS,CAIvF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,GAC5D,OAAO,CAoBT;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAoBtF;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAUlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/xlsx/formula/store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/xlsx/formula/store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAQ9C,OAAO,EAAO,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAEvD;;;GAGG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,GAChE,IAAI,CAqCN"}
|