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/ui/index.cjs
CHANGED
|
@@ -578,6 +578,45 @@ function visioAnchoredResizeGeometry(current, size, anchor) {
|
|
|
578
578
|
return [pinX, pinY, locPinX, locPinY, ...matrix2].every(Number.isFinite) ? { pinX, pinY, locPinX, locPinY, transform: matrix2 } : void 0;
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
+
// visio/edit-text-range-commands.ts
|
|
582
|
+
var invalidXmlText = /[\u0000-\u0008\u000b\u000c\u000d\u000e-\u001f\ufffe\uffff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/u;
|
|
583
|
+
function textRangeBoundary(text, offset) {
|
|
584
|
+
return !(offset > 0 && offset < text.length && /[\ud800-\udbff]/.test(text[offset - 1]) && /[\udc00-\udfff]/.test(text[offset]));
|
|
585
|
+
}
|
|
586
|
+
function snapshotTextRanges(edit, consume) {
|
|
587
|
+
let characters = 0;
|
|
588
|
+
const text = (value) => {
|
|
589
|
+
if (typeof value !== "string" || invalidXmlText.test(value))
|
|
590
|
+
fail("INVALID_EDIT_TEXT", "Range replacement requires valid XML text.");
|
|
591
|
+
characters += value.length;
|
|
592
|
+
if (characters > 1e6)
|
|
593
|
+
fail("LIMIT_EDIT_TEXT", "Range replacement text exceeds input limits.");
|
|
594
|
+
return consume ? consume(value) : value;
|
|
595
|
+
};
|
|
596
|
+
const pageId = edit.pageId, shapeId = edit.shapeId;
|
|
597
|
+
if ([pageId, shapeId].some((id) => typeof id !== "string" || !id || id.length > 256))
|
|
598
|
+
fail("INVALID_EDIT", "Invalid text range target.");
|
|
599
|
+
const expectedText = text(edit.expectedText), original = edit.ranges;
|
|
600
|
+
if (!Array.isArray(original)) fail("INVALID_EDIT", "Text ranges require an array.");
|
|
601
|
+
const length = original.length;
|
|
602
|
+
if (!Number.isSafeInteger(length) || length < 1 || length > 1e4)
|
|
603
|
+
fail("LIMIT_EDITS", "Range replacement requires 1-10000 ranges.");
|
|
604
|
+
const ranges = [];
|
|
605
|
+
let end = 0, output = expectedText.length;
|
|
606
|
+
for (let index = 0; index < length; index++) {
|
|
607
|
+
const input = original[index], start = input.start, nextEnd = input.end, replacement = text(input.text);
|
|
608
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(nextEnd) || start < end || nextEnd <= start || nextEnd > expectedText.length || !textRangeBoundary(expectedText, start) || !textRangeBoundary(expectedText, nextEnd))
|
|
609
|
+
fail("INVALID_EDIT", "Text ranges require ascending nonoverlapping UTF16 scalar boundaries.");
|
|
610
|
+
if (replacement.includes("\n") || expectedText.slice(start, nextEnd).includes("\n"))
|
|
611
|
+
fail("UNSUPPORTED_TEXT_RANGE", "Range replacement across paragraph breaks is unsupported.");
|
|
612
|
+
ranges.push({ start, end: nextEnd, text: replacement });
|
|
613
|
+
end = nextEnd;
|
|
614
|
+
output += replacement.length - (nextEnd - start);
|
|
615
|
+
}
|
|
616
|
+
if (output > 1e6) fail("LIMIT_EDIT_TEXT", "Range replacement output exceeds limits.");
|
|
617
|
+
return { type: "replace-text-ranges", pageId, shapeId, expectedText, ranges };
|
|
618
|
+
}
|
|
619
|
+
|
|
581
620
|
// visio/ui/edit-commands.ts
|
|
582
621
|
function snapshotEdits(edits) {
|
|
583
622
|
if (!Array.isArray(edits) || edits.length > 1e3)
|
|
@@ -594,6 +633,18 @@ function snapshotEdits(edits) {
|
|
|
594
633
|
return { type: command.type, pageId: command.pageId, index: command.index };
|
|
595
634
|
}
|
|
596
635
|
if (command.type === "delete-page") return { type: command.type, pageId: command.pageId };
|
|
636
|
+
if (command.type === "set-page-size") {
|
|
637
|
+
if (![command.width, command.height].every(
|
|
638
|
+
(value) => typeof value === "number" && Number.isFinite(value) && value > 0 && value <= 1e6
|
|
639
|
+
))
|
|
640
|
+
throw new Error("Invalid physical page dimensions.");
|
|
641
|
+
return {
|
|
642
|
+
type: command.type,
|
|
643
|
+
pageId: command.pageId,
|
|
644
|
+
width: command.width,
|
|
645
|
+
height: command.height
|
|
646
|
+
};
|
|
647
|
+
}
|
|
597
648
|
const text = (value) => {
|
|
598
649
|
if (typeof value !== "string") throw new Error("Invalid edit text.");
|
|
599
650
|
characters += value.length;
|
|
@@ -649,6 +700,8 @@ function snapshotEdits(edits) {
|
|
|
649
700
|
};
|
|
650
701
|
case "replace-plain-text":
|
|
651
702
|
return { type: command.type, ...target, text: text(command.text) };
|
|
703
|
+
case "replace-text-ranges":
|
|
704
|
+
return snapshotTextRanges(command, text);
|
|
652
705
|
case "delete-shape":
|
|
653
706
|
return { type: command.type, ...target };
|
|
654
707
|
case "rotate-shape":
|
|
@@ -1900,6 +1953,9 @@ function assertViewableDocument(model) {
|
|
|
1900
1953
|
finite2(page.height, "page height", 1e-3);
|
|
1901
1954
|
if (page.drawingToPageScale !== void 0)
|
|
1902
1955
|
finite2(page.drawingToPageScale, "drawing scale", Number.MIN_VALUE, Number.MAX_VALUE);
|
|
1956
|
+
for (const mode of [page.drawingSizeType, page.drawingResizeType])
|
|
1957
|
+
if (mode !== void 0 && (!Number.isSafeInteger(mode) || mode < 0 || mode > 255))
|
|
1958
|
+
throw new Error("The scene has an invalid drawing page-size mode.");
|
|
1903
1959
|
if (!Array.isArray(page.shapes) || stack.length + page.shapes.length > MAX_SHAPES)
|
|
1904
1960
|
throw new Error("The scene exceeds safe shape count limits or has an invalid shape list.");
|
|
1905
1961
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -2348,7 +2404,9 @@ function copySnapshotScene(model) {
|
|
|
2348
2404
|
"height",
|
|
2349
2405
|
"isBackground",
|
|
2350
2406
|
"backgroundPageId",
|
|
2351
|
-
"drawingToPageScale"
|
|
2407
|
+
"drawingToPageScale",
|
|
2408
|
+
"drawingSizeType",
|
|
2409
|
+
"drawingResizeType"
|
|
2352
2410
|
]),
|
|
2353
2411
|
shapes: shapes(page.shapes),
|
|
2354
2412
|
connectors: []
|
|
@@ -3341,7 +3399,7 @@ function visioTextReplacePlan(model, input) {
|
|
|
3341
3399
|
}
|
|
3342
3400
|
if (targets.size > VISIO_TEXT_REPLACE_LIMITS.commands) textReplaceError("Replace command count exceeds limits.");
|
|
3343
3401
|
const edits = [], updated = [];
|
|
3344
|
-
let outputCharacters = 0;
|
|
3402
|
+
let outputCharacters = 0, commandCharacters = 0;
|
|
3345
3403
|
for (const entry of entries) {
|
|
3346
3404
|
const matches = targets.get(JSON.stringify([entry.pageId, entry.shapeId]));
|
|
3347
3405
|
let text = entry.text;
|
|
@@ -3358,14 +3416,27 @@ function visioTextReplacePlan(model, input) {
|
|
|
3358
3416
|
}
|
|
3359
3417
|
parts.push(text.slice(from));
|
|
3360
3418
|
text = parts.join("");
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3419
|
+
const target = { pageId: entry.pageId, shapeId: entry.shapeId };
|
|
3420
|
+
if (replacement.includes("\n") || scope.query.includes("\n")) {
|
|
3421
|
+
commandCharacters += text.length;
|
|
3422
|
+
edits.push(Object.freeze({ type: "replace-plain-text", ...target, text }));
|
|
3423
|
+
} else {
|
|
3424
|
+
commandCharacters += entry.text.length + matches.length * replacement.length;
|
|
3425
|
+
edits.push(
|
|
3426
|
+
Object.freeze({
|
|
3427
|
+
type: "replace-text-ranges",
|
|
3428
|
+
...target,
|
|
3429
|
+
expectedText: entry.text,
|
|
3430
|
+
ranges: Object.freeze(
|
|
3431
|
+
matches.map(
|
|
3432
|
+
(match) => Object.freeze({ start: match.start, end: match.end, text: replacement })
|
|
3433
|
+
)
|
|
3434
|
+
)
|
|
3435
|
+
})
|
|
3436
|
+
);
|
|
3437
|
+
}
|
|
3438
|
+
if (commandCharacters > VISIO_TEXT_REPLACE_LIMITS.output)
|
|
3439
|
+
textReplaceError("Replace input exceeds aggregate command text limits.");
|
|
3369
3440
|
}
|
|
3370
3441
|
updated.push({ ...entry, text });
|
|
3371
3442
|
}
|
|
@@ -3396,7 +3467,9 @@ function visioTextReplaceCommands(model, plan) {
|
|
|
3396
3467
|
return entry.pageId !== saved.pageId || entry.shapeId !== saved.shapeId || entry.text !== saved.text;
|
|
3397
3468
|
}))
|
|
3398
3469
|
textReplaceError("Replace plan is stale. Search the current drawing again.");
|
|
3399
|
-
return plan.edits.map(
|
|
3470
|
+
return plan.edits.map(
|
|
3471
|
+
(edit) => edit.type === "replace-text-ranges" ? { ...edit, ranges: edit.ranges.map((range) => ({ ...range })) } : { ...edit }
|
|
3472
|
+
);
|
|
3400
3473
|
}
|
|
3401
3474
|
|
|
3402
3475
|
// visio/ui/svg-stroke.ts
|
|
@@ -3404,6 +3477,51 @@ function visioSvgStrokeStyle(style) {
|
|
|
3404
3477
|
return style.lineWidth === 0 ? { ...style, lineWidth: 0.75 / 72 } : style;
|
|
3405
3478
|
}
|
|
3406
3479
|
|
|
3480
|
+
// visio/ui/page-size.ts
|
|
3481
|
+
var VISIO_PAGE_SIZE_PRESETS = Object.freeze([
|
|
3482
|
+
Object.freeze({ id: "letter", label: "Letter", width: 8.5, height: 11 }),
|
|
3483
|
+
Object.freeze({ id: "a4", label: "A4", width: 210 / 25.4, height: 297 / 25.4 })
|
|
3484
|
+
]);
|
|
3485
|
+
var dimension = (value) => Number.isFinite(value) && value > 0 && value <= 1e6;
|
|
3486
|
+
function visioPageSizeState(page) {
|
|
3487
|
+
const { id: pageId, width, height, drawingSizeType, drawingResizeType } = page;
|
|
3488
|
+
if (!dimension(width) || !dimension(height) || !pageId || pageId.length > 256) return void 0;
|
|
3489
|
+
return Object.freeze({
|
|
3490
|
+
pageId,
|
|
3491
|
+
width,
|
|
3492
|
+
height,
|
|
3493
|
+
orientation: width === height ? "square" : width > height ? "landscape" : "portrait",
|
|
3494
|
+
...drawingSizeType === void 0 ? {} : { drawingSizeType },
|
|
3495
|
+
...drawingResizeType === void 0 ? {} : { drawingResizeType }
|
|
3496
|
+
});
|
|
3497
|
+
}
|
|
3498
|
+
function visioPageSizeCommand(page, width, height) {
|
|
3499
|
+
const state = visioPageSizeState(page);
|
|
3500
|
+
if (!state || !dimension(width) || !dimension(height)) return void 0;
|
|
3501
|
+
if (width === state.width && height === state.height && state.drawingSizeType === 3 && state.drawingResizeType === 0)
|
|
3502
|
+
return [];
|
|
3503
|
+
return [{ type: "set-page-size", pageId: state.pageId, width, height }];
|
|
3504
|
+
}
|
|
3505
|
+
function visioPageOrientationCommand(page, orientation) {
|
|
3506
|
+
const state = visioPageSizeState(page);
|
|
3507
|
+
if (!state || !["portrait", "landscape"].includes(orientation)) return void 0;
|
|
3508
|
+
const short = Math.min(state.width, state.height), long = Math.max(state.width, state.height);
|
|
3509
|
+
return visioPageSizeCommand(
|
|
3510
|
+
page,
|
|
3511
|
+
orientation === "portrait" ? short : long,
|
|
3512
|
+
orientation === "portrait" ? long : short
|
|
3513
|
+
);
|
|
3514
|
+
}
|
|
3515
|
+
function visioPageSizePresetCommand(page, id) {
|
|
3516
|
+
const state = visioPageSizeState(page), preset = VISIO_PAGE_SIZE_PRESETS.find((item) => item.id === id);
|
|
3517
|
+
if (!state || !preset) return void 0;
|
|
3518
|
+
return visioPageSizeCommand(
|
|
3519
|
+
page,
|
|
3520
|
+
state.orientation === "landscape" ? preset.height : preset.width,
|
|
3521
|
+
state.orientation === "landscape" ? preset.width : preset.height
|
|
3522
|
+
);
|
|
3523
|
+
}
|
|
3524
|
+
|
|
3407
3525
|
exports.DocumentHistory = DocumentHistory;
|
|
3408
3526
|
exports.EDIT_HISTORY_LIMITS = EDIT_HISTORY_LIMITS;
|
|
3409
3527
|
exports.EMPTY_EDIT_STATE = EMPTY_EDIT_STATE;
|
|
@@ -3414,6 +3532,7 @@ exports.ForeignVectorBudget = ForeignVectorBudget;
|
|
|
3414
3532
|
exports.MAX_INPUT_BYTES = MAX_INPUT_BYTES;
|
|
3415
3533
|
exports.TEXT_SEARCH_LIMITS = TEXT_SEARCH_LIMITS;
|
|
3416
3534
|
exports.VISIO_IDENTITY_TRANSFORM = IDENTITY_AFFINE;
|
|
3535
|
+
exports.VISIO_PAGE_SIZE_PRESETS = VISIO_PAGE_SIZE_PRESETS;
|
|
3417
3536
|
exports.VISIO_RESIZE_HANDLES = VISIO_RESIZE_HANDLES;
|
|
3418
3537
|
exports.VISIO_TEXT_REPLACE_LIMITS = VISIO_TEXT_REPLACE_LIMITS;
|
|
3419
3538
|
exports.assertShapeDetails = assertShapeDetails;
|
|
@@ -3462,6 +3581,10 @@ exports.visioOrderingShape = visioOrderingShape;
|
|
|
3462
3581
|
exports.visioPageDragDelta = visioPageDragDelta;
|
|
3463
3582
|
exports.visioPageEditToDrawing = visioPageEditToDrawing;
|
|
3464
3583
|
exports.visioPageInsertCommand = visioPageInsertCommand;
|
|
3584
|
+
exports.visioPageOrientationCommand = visioPageOrientationCommand;
|
|
3585
|
+
exports.visioPageSizeCommand = visioPageSizeCommand;
|
|
3586
|
+
exports.visioPageSizePresetCommand = visioPageSizePresetCommand;
|
|
3587
|
+
exports.visioPageSizeState = visioPageSizeState;
|
|
3465
3588
|
exports.visioPasteCommand = visioPasteCommand;
|
|
3466
3589
|
exports.visioQuarterTurnCommand = visioQuarterTurnCommand;
|
|
3467
3590
|
exports.visioRenderedGradientStopCount = visioRenderedGradientStopCount;
|
package/dist/visio/ui/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../visio/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACN,0BAA0B,EAC1B,mBAAmB,EACnB,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAElC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../visio/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACN,0BAA0B,EAC1B,mBAAmB,EACnB,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAElC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
|
package/dist/visio/ui/index.mjs
CHANGED
|
@@ -576,6 +576,45 @@ function visioAnchoredResizeGeometry(current, size, anchor) {
|
|
|
576
576
|
return [pinX, pinY, locPinX, locPinY, ...matrix2].every(Number.isFinite) ? { pinX, pinY, locPinX, locPinY, transform: matrix2 } : void 0;
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
+
// visio/edit-text-range-commands.ts
|
|
580
|
+
var invalidXmlText = /[\u0000-\u0008\u000b\u000c\u000d\u000e-\u001f\ufffe\uffff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/u;
|
|
581
|
+
function textRangeBoundary(text, offset) {
|
|
582
|
+
return !(offset > 0 && offset < text.length && /[\ud800-\udbff]/.test(text[offset - 1]) && /[\udc00-\udfff]/.test(text[offset]));
|
|
583
|
+
}
|
|
584
|
+
function snapshotTextRanges(edit, consume) {
|
|
585
|
+
let characters = 0;
|
|
586
|
+
const text = (value) => {
|
|
587
|
+
if (typeof value !== "string" || invalidXmlText.test(value))
|
|
588
|
+
fail("INVALID_EDIT_TEXT", "Range replacement requires valid XML text.");
|
|
589
|
+
characters += value.length;
|
|
590
|
+
if (characters > 1e6)
|
|
591
|
+
fail("LIMIT_EDIT_TEXT", "Range replacement text exceeds input limits.");
|
|
592
|
+
return consume ? consume(value) : value;
|
|
593
|
+
};
|
|
594
|
+
const pageId = edit.pageId, shapeId = edit.shapeId;
|
|
595
|
+
if ([pageId, shapeId].some((id) => typeof id !== "string" || !id || id.length > 256))
|
|
596
|
+
fail("INVALID_EDIT", "Invalid text range target.");
|
|
597
|
+
const expectedText = text(edit.expectedText), original = edit.ranges;
|
|
598
|
+
if (!Array.isArray(original)) fail("INVALID_EDIT", "Text ranges require an array.");
|
|
599
|
+
const length = original.length;
|
|
600
|
+
if (!Number.isSafeInteger(length) || length < 1 || length > 1e4)
|
|
601
|
+
fail("LIMIT_EDITS", "Range replacement requires 1-10000 ranges.");
|
|
602
|
+
const ranges = [];
|
|
603
|
+
let end = 0, output = expectedText.length;
|
|
604
|
+
for (let index = 0; index < length; index++) {
|
|
605
|
+
const input = original[index], start = input.start, nextEnd = input.end, replacement = text(input.text);
|
|
606
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(nextEnd) || start < end || nextEnd <= start || nextEnd > expectedText.length || !textRangeBoundary(expectedText, start) || !textRangeBoundary(expectedText, nextEnd))
|
|
607
|
+
fail("INVALID_EDIT", "Text ranges require ascending nonoverlapping UTF16 scalar boundaries.");
|
|
608
|
+
if (replacement.includes("\n") || expectedText.slice(start, nextEnd).includes("\n"))
|
|
609
|
+
fail("UNSUPPORTED_TEXT_RANGE", "Range replacement across paragraph breaks is unsupported.");
|
|
610
|
+
ranges.push({ start, end: nextEnd, text: replacement });
|
|
611
|
+
end = nextEnd;
|
|
612
|
+
output += replacement.length - (nextEnd - start);
|
|
613
|
+
}
|
|
614
|
+
if (output > 1e6) fail("LIMIT_EDIT_TEXT", "Range replacement output exceeds limits.");
|
|
615
|
+
return { type: "replace-text-ranges", pageId, shapeId, expectedText, ranges };
|
|
616
|
+
}
|
|
617
|
+
|
|
579
618
|
// visio/ui/edit-commands.ts
|
|
580
619
|
function snapshotEdits(edits) {
|
|
581
620
|
if (!Array.isArray(edits) || edits.length > 1e3)
|
|
@@ -592,6 +631,18 @@ function snapshotEdits(edits) {
|
|
|
592
631
|
return { type: command.type, pageId: command.pageId, index: command.index };
|
|
593
632
|
}
|
|
594
633
|
if (command.type === "delete-page") return { type: command.type, pageId: command.pageId };
|
|
634
|
+
if (command.type === "set-page-size") {
|
|
635
|
+
if (![command.width, command.height].every(
|
|
636
|
+
(value) => typeof value === "number" && Number.isFinite(value) && value > 0 && value <= 1e6
|
|
637
|
+
))
|
|
638
|
+
throw new Error("Invalid physical page dimensions.");
|
|
639
|
+
return {
|
|
640
|
+
type: command.type,
|
|
641
|
+
pageId: command.pageId,
|
|
642
|
+
width: command.width,
|
|
643
|
+
height: command.height
|
|
644
|
+
};
|
|
645
|
+
}
|
|
595
646
|
const text = (value) => {
|
|
596
647
|
if (typeof value !== "string") throw new Error("Invalid edit text.");
|
|
597
648
|
characters += value.length;
|
|
@@ -647,6 +698,8 @@ function snapshotEdits(edits) {
|
|
|
647
698
|
};
|
|
648
699
|
case "replace-plain-text":
|
|
649
700
|
return { type: command.type, ...target, text: text(command.text) };
|
|
701
|
+
case "replace-text-ranges":
|
|
702
|
+
return snapshotTextRanges(command, text);
|
|
650
703
|
case "delete-shape":
|
|
651
704
|
return { type: command.type, ...target };
|
|
652
705
|
case "rotate-shape":
|
|
@@ -1898,6 +1951,9 @@ function assertViewableDocument(model) {
|
|
|
1898
1951
|
finite2(page.height, "page height", 1e-3);
|
|
1899
1952
|
if (page.drawingToPageScale !== void 0)
|
|
1900
1953
|
finite2(page.drawingToPageScale, "drawing scale", Number.MIN_VALUE, Number.MAX_VALUE);
|
|
1954
|
+
for (const mode of [page.drawingSizeType, page.drawingResizeType])
|
|
1955
|
+
if (mode !== void 0 && (!Number.isSafeInteger(mode) || mode < 0 || mode > 255))
|
|
1956
|
+
throw new Error("The scene has an invalid drawing page-size mode.");
|
|
1901
1957
|
if (!Array.isArray(page.shapes) || stack.length + page.shapes.length > MAX_SHAPES)
|
|
1902
1958
|
throw new Error("The scene exceeds safe shape count limits or has an invalid shape list.");
|
|
1903
1959
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -2346,7 +2402,9 @@ function copySnapshotScene(model) {
|
|
|
2346
2402
|
"height",
|
|
2347
2403
|
"isBackground",
|
|
2348
2404
|
"backgroundPageId",
|
|
2349
|
-
"drawingToPageScale"
|
|
2405
|
+
"drawingToPageScale",
|
|
2406
|
+
"drawingSizeType",
|
|
2407
|
+
"drawingResizeType"
|
|
2350
2408
|
]),
|
|
2351
2409
|
shapes: shapes(page.shapes),
|
|
2352
2410
|
connectors: []
|
|
@@ -3339,7 +3397,7 @@ function visioTextReplacePlan(model, input) {
|
|
|
3339
3397
|
}
|
|
3340
3398
|
if (targets.size > VISIO_TEXT_REPLACE_LIMITS.commands) textReplaceError("Replace command count exceeds limits.");
|
|
3341
3399
|
const edits = [], updated = [];
|
|
3342
|
-
let outputCharacters = 0;
|
|
3400
|
+
let outputCharacters = 0, commandCharacters = 0;
|
|
3343
3401
|
for (const entry of entries) {
|
|
3344
3402
|
const matches = targets.get(JSON.stringify([entry.pageId, entry.shapeId]));
|
|
3345
3403
|
let text = entry.text;
|
|
@@ -3356,14 +3414,27 @@ function visioTextReplacePlan(model, input) {
|
|
|
3356
3414
|
}
|
|
3357
3415
|
parts.push(text.slice(from));
|
|
3358
3416
|
text = parts.join("");
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3417
|
+
const target = { pageId: entry.pageId, shapeId: entry.shapeId };
|
|
3418
|
+
if (replacement.includes("\n") || scope.query.includes("\n")) {
|
|
3419
|
+
commandCharacters += text.length;
|
|
3420
|
+
edits.push(Object.freeze({ type: "replace-plain-text", ...target, text }));
|
|
3421
|
+
} else {
|
|
3422
|
+
commandCharacters += entry.text.length + matches.length * replacement.length;
|
|
3423
|
+
edits.push(
|
|
3424
|
+
Object.freeze({
|
|
3425
|
+
type: "replace-text-ranges",
|
|
3426
|
+
...target,
|
|
3427
|
+
expectedText: entry.text,
|
|
3428
|
+
ranges: Object.freeze(
|
|
3429
|
+
matches.map(
|
|
3430
|
+
(match) => Object.freeze({ start: match.start, end: match.end, text: replacement })
|
|
3431
|
+
)
|
|
3432
|
+
)
|
|
3433
|
+
})
|
|
3434
|
+
);
|
|
3435
|
+
}
|
|
3436
|
+
if (commandCharacters > VISIO_TEXT_REPLACE_LIMITS.output)
|
|
3437
|
+
textReplaceError("Replace input exceeds aggregate command text limits.");
|
|
3367
3438
|
}
|
|
3368
3439
|
updated.push({ ...entry, text });
|
|
3369
3440
|
}
|
|
@@ -3394,7 +3465,9 @@ function visioTextReplaceCommands(model, plan) {
|
|
|
3394
3465
|
return entry.pageId !== saved.pageId || entry.shapeId !== saved.shapeId || entry.text !== saved.text;
|
|
3395
3466
|
}))
|
|
3396
3467
|
textReplaceError("Replace plan is stale. Search the current drawing again.");
|
|
3397
|
-
return plan.edits.map(
|
|
3468
|
+
return plan.edits.map(
|
|
3469
|
+
(edit) => edit.type === "replace-text-ranges" ? { ...edit, ranges: edit.ranges.map((range) => ({ ...range })) } : { ...edit }
|
|
3470
|
+
);
|
|
3398
3471
|
}
|
|
3399
3472
|
|
|
3400
3473
|
// visio/ui/svg-stroke.ts
|
|
@@ -3402,4 +3475,49 @@ function visioSvgStrokeStyle(style) {
|
|
|
3402
3475
|
return style.lineWidth === 0 ? { ...style, lineWidth: 0.75 / 72 } : style;
|
|
3403
3476
|
}
|
|
3404
3477
|
|
|
3405
|
-
|
|
3478
|
+
// visio/ui/page-size.ts
|
|
3479
|
+
var VISIO_PAGE_SIZE_PRESETS = Object.freeze([
|
|
3480
|
+
Object.freeze({ id: "letter", label: "Letter", width: 8.5, height: 11 }),
|
|
3481
|
+
Object.freeze({ id: "a4", label: "A4", width: 210 / 25.4, height: 297 / 25.4 })
|
|
3482
|
+
]);
|
|
3483
|
+
var dimension = (value) => Number.isFinite(value) && value > 0 && value <= 1e6;
|
|
3484
|
+
function visioPageSizeState(page) {
|
|
3485
|
+
const { id: pageId, width, height, drawingSizeType, drawingResizeType } = page;
|
|
3486
|
+
if (!dimension(width) || !dimension(height) || !pageId || pageId.length > 256) return void 0;
|
|
3487
|
+
return Object.freeze({
|
|
3488
|
+
pageId,
|
|
3489
|
+
width,
|
|
3490
|
+
height,
|
|
3491
|
+
orientation: width === height ? "square" : width > height ? "landscape" : "portrait",
|
|
3492
|
+
...drawingSizeType === void 0 ? {} : { drawingSizeType },
|
|
3493
|
+
...drawingResizeType === void 0 ? {} : { drawingResizeType }
|
|
3494
|
+
});
|
|
3495
|
+
}
|
|
3496
|
+
function visioPageSizeCommand(page, width, height) {
|
|
3497
|
+
const state = visioPageSizeState(page);
|
|
3498
|
+
if (!state || !dimension(width) || !dimension(height)) return void 0;
|
|
3499
|
+
if (width === state.width && height === state.height && state.drawingSizeType === 3 && state.drawingResizeType === 0)
|
|
3500
|
+
return [];
|
|
3501
|
+
return [{ type: "set-page-size", pageId: state.pageId, width, height }];
|
|
3502
|
+
}
|
|
3503
|
+
function visioPageOrientationCommand(page, orientation) {
|
|
3504
|
+
const state = visioPageSizeState(page);
|
|
3505
|
+
if (!state || !["portrait", "landscape"].includes(orientation)) return void 0;
|
|
3506
|
+
const short = Math.min(state.width, state.height), long = Math.max(state.width, state.height);
|
|
3507
|
+
return visioPageSizeCommand(
|
|
3508
|
+
page,
|
|
3509
|
+
orientation === "portrait" ? short : long,
|
|
3510
|
+
orientation === "portrait" ? long : short
|
|
3511
|
+
);
|
|
3512
|
+
}
|
|
3513
|
+
function visioPageSizePresetCommand(page, id) {
|
|
3514
|
+
const state = visioPageSizeState(page), preset = VISIO_PAGE_SIZE_PRESETS.find((item) => item.id === id);
|
|
3515
|
+
if (!state || !preset) return void 0;
|
|
3516
|
+
return visioPageSizeCommand(
|
|
3517
|
+
page,
|
|
3518
|
+
state.orientation === "landscape" ? preset.height : preset.width,
|
|
3519
|
+
state.orientation === "landscape" ? preset.width : preset.height
|
|
3520
|
+
);
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
export { DocumentHistory, EDIT_HISTORY_LIMITS, EMPTY_EDIT_STATE, EMPTY_SELECTION, EMPTY_TEXT_SEARCH, FOREIGN_VECTOR_SCENE_LIMITS, ForeignVectorBudget, MAX_INPUT_BYTES, TEXT_SEARCH_LIMITS, IDENTITY_AFFINE as VISIO_IDENTITY_TRANSFORM, VISIO_PAGE_SIZE_PRESETS, VISIO_RESIZE_HANDLES, VISIO_TEXT_REPLACE_LIMITS, assertShapeDetails, assertViewableDocument, compatibilityNotes, compatibilityText, composeAffine as composeVisioTransform, copySnapshotScene, demoDocument, editErrorMessage, eventKeys, hasVisibleShapeContent, indexDocumentText, inspectForeignVectorResource, isEditCancellation, propertyKeys, sameSelection, searchDocumentText, selectionKey, snapshotEdits, snapshotSelection, textSearchStatus, validateSearchQuery, visioArrangeCommands, visioBoxCreationCommand, visioClipboardShape, visioDrawBounds, visioDrawIsLargeEnough, visioDrawPlan, visioDrawingPoint, visioDuplicateCommand, visioFillPatternTransform, visioFontFamilies, visioFormattingShape, visioGradientInstances, visioLineCreationCommand, visioLineDashLengths, visioLocalRotationShape, visioMarqueeBox, visioMarqueeSelection, visioMoveCommands, visioMovePreviewTransform, visioMovementShape, visioNextShapeId, visioOrderingShape, visioPageDragDelta, visioPageEditToDrawing, visioPageInsertCommand, visioPageOrientationCommand, visioPageSizeCommand, visioPageSizePresetCommand, visioPageSizeState, visioPasteCommand, visioQuarterTurnCommand, visioRenderedGradientStopCount, visioRenderedGradientStops, visioResizeDrag, visioResizeFrame, visioResizeShape, visioRotationPreviewTransform, visioSelectionIsOnPage, visioShapeFormattingState, visioShapePageBox, visioSizePositionCommand, visioSizePositionState, visioStraightLineHandles, visioStrokeGradient, visioStyleFormattingShape, visioSvgStrokeStyle, visioTextFontStepCommand, visioTextFormattingState, visioTextIndentCommand, visioTextOccurrenceSelection, visioTextReplaceCommands, visioTextReplaceFindNext, visioTextReplaceOccurrences, visioTextReplacePlan };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { VisioPageSizeEdit } from '../edit-commands.js';
|
|
2
|
+
import type { VisioPage } from '../model.js';
|
|
3
|
+
export type VisioPageOrientation = 'portrait' | 'landscape';
|
|
4
|
+
export interface VisioPageSizeState {
|
|
5
|
+
readonly pageId: string;
|
|
6
|
+
/** Physical page inches, independent of the drawing scale and printer paper. */
|
|
7
|
+
readonly width: number;
|
|
8
|
+
readonly height: number;
|
|
9
|
+
readonly orientation: VisioPageOrientation | 'square';
|
|
10
|
+
readonly drawingSizeType?: number;
|
|
11
|
+
readonly drawingResizeType?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const VISIO_PAGE_SIZE_PRESETS: readonly (Readonly<{
|
|
14
|
+
id: "letter";
|
|
15
|
+
label: "Letter";
|
|
16
|
+
width: 8.5;
|
|
17
|
+
height: 11;
|
|
18
|
+
}> | Readonly<{
|
|
19
|
+
id: "a4";
|
|
20
|
+
label: "A4";
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
}>)[];
|
|
24
|
+
/** Coarse scene state. Source formulas and mode protection remain authoritative. */
|
|
25
|
+
export declare function visioPageSizeState(page: VisioPage): VisioPageSizeState | undefined;
|
|
26
|
+
/** Set fixed custom drawing dimensions. An absent mode never becomes an assumed no-op. */
|
|
27
|
+
export declare function visioPageSizeCommand(page: VisioPage, width: number, height: number): VisioPageSizeEdit[] | undefined;
|
|
28
|
+
export declare function visioPageOrientationCommand(page: VisioPage, orientation: VisioPageOrientation): VisioPageSizeEdit[] | undefined;
|
|
29
|
+
/** Viewer policy: a preset preserves the current landscape orientation; square uses portrait. */
|
|
30
|
+
export declare function visioPageSizePresetCommand(page: VisioPage, id: string): VisioPageSizeEdit[] | undefined;
|
|
31
|
+
//# sourceMappingURL=page-size.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-size.d.ts","sourceRoot":"","sources":["../../../visio/ui/page-size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,WAAW,CAAC;AAC5D,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,oBAAoB,GAAG,QAAQ,CAAC;IACtD,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACpC;AACD,eAAO,MAAM,uBAAuB;;;;;;;;;;KAGlC,CAAC;AAGH,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG,kBAAkB,GAAG,SAAS,CAWlF;AAED,0FAA0F;AAC1F,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACZ,iBAAiB,EAAE,GAAG,SAAS,CAWjC;AAED,wBAAgB,2BAA2B,CAC1C,IAAI,EAAE,SAAS,EACf,WAAW,EAAE,oBAAoB,GAC/B,iBAAiB,EAAE,GAAG,SAAS,CAUjC;AAED,iGAAiG;AACjG,wBAAgB,0BAA0B,CACzC,IAAI,EAAE,SAAS,EACf,EAAE,EAAE,MAAM,GACR,iBAAiB,EAAE,GAAG,SAAS,CASjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene-validation.d.ts","sourceRoot":"","sources":["../../../visio/ui/scene-validation.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,KAAK,aAAa,EAGlB,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,eAAe,QAAmB,CAAC;AAUhD,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"scene-validation.d.ts","sourceRoot":"","sources":["../../../visio/ui/scene-validation.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,KAAK,aAAa,EAGlB,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,eAAe,QAAmB,CAAC;AAUhD,sFAAsF;AACtF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAiUjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot-scene.d.ts","sourceRoot":"","sources":["../../../visio/ui/snapshot-scene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EAOb,MAAM,UAAU,CAAC;AAwBlB;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"snapshot-scene.d.ts","sourceRoot":"","sources":["../../../visio/ui/snapshot-scene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EAOb,MAAM,UAAU,CAAC;AAwBlB;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAyOrE"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type { VisioTextEdit } from '../edit-commands.js';
|
|
1
|
+
import type { VisioTextEdit, VisioTextRange, VisioTextRangesEdit } from '../edit-commands.js';
|
|
2
|
+
export type VisioTextReplaceEdit = VisioTextEdit | VisioTextRangesEdit;
|
|
3
|
+
export type VisioTextReplacePlanEdit = Readonly<VisioTextEdit> | (Readonly<Omit<VisioTextRangesEdit, 'ranges'>> & {
|
|
4
|
+
readonly ranges: readonly Readonly<VisioTextRange>[];
|
|
5
|
+
});
|
|
2
6
|
/** UTF-16 bounds; oversized inputs fail instead of producing partial replacements. */
|
|
3
7
|
export declare const VISIO_TEXT_REPLACE_LIMITS: Readonly<{
|
|
4
8
|
query: 256;
|
|
@@ -39,7 +43,7 @@ export interface VisioTextReplaceRequest extends VisioTextReplaceScope {
|
|
|
39
43
|
export interface VisioTextReplacePlan {
|
|
40
44
|
readonly occurrences: readonly VisioTextOccurrence[];
|
|
41
45
|
readonly replacementCount: number;
|
|
42
|
-
readonly edits: readonly
|
|
46
|
+
readonly edits: readonly VisioTextReplacePlanEdit[];
|
|
43
47
|
readonly nextOccurrence: VisioTextOccurrence | undefined;
|
|
44
48
|
}
|
|
45
49
|
export declare const textReplaceError: (message: string) => never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-replace-types.d.ts","sourceRoot":"","sources":["../../../visio/ui/text-replace-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"text-replace-types.d.ts","sourceRoot":"","sources":["../../../visio/ui/text-replace-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE3F,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,mBAAmB,CAAC;AACvE,MAAM,MAAM,wBAAwB,GACjC,QAAQ,CAAC,aAAa,CAAC,GACvB,CAAC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC,GAAG;IACjD,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;CACpD,CAAC,CAAC;AAEN,sFAAsF;AACtF,eAAO,MAAM,yBAAyB;;;;;;;;;;;EAWpC,CAAC;AACH,MAAM,WAAW,qBAAqB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,WAAW,GAAG,cAAc,GAAG,WAAW,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACvD;AACD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,SAAS,GAAG,KAAK,CAAC;IACxB,sFAAsF;IACtF,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AACD,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACrD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACpD,QAAQ,CAAC,cAAc,EAAE,mBAAmB,GAAG,SAAS,CAAC;CACzD;AACD,eAAO,MAAM,gBAAgB,YAAa,MAAM,KAAG,KAElD,CAAC;AACF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpF;AACD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAItD"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { VisioDocument } from '../model.js';
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
export type { VisioTextOccurrence, VisioTextReplacePlan, VisioTextReplaceRequest, VisioTextReplaceScope, } from './text-replace-types.js';
|
|
2
|
+
import { type VisioTextOccurrence, type VisioTextReplacePlan, type VisioTextReplaceRequest, type VisioTextReplaceScope, type VisioTextReplaceEdit } from './text-replace-types.js';
|
|
3
|
+
export type { VisioTextOccurrence, VisioTextReplacePlan, VisioTextReplaceRequest, VisioTextReplaceScope, VisioTextReplaceEdit, VisioTextReplacePlanEdit, } from './text-replace-types.js';
|
|
5
4
|
export { VISIO_TEXT_REPLACE_LIMITS } from './text-replace-types.js';
|
|
6
5
|
export { visioTextOccurrenceSelection } from './text-replace-selection.js';
|
|
7
6
|
/** Full literal occurrences, independent of the bounded preview-oriented Find index. */
|
|
@@ -14,5 +13,5 @@ export declare function visioTextReplaceFindNext(model: VisioDocument, input: Vi
|
|
|
14
13
|
*/
|
|
15
14
|
export declare function visioTextReplacePlan(model: VisioDocument, input: VisioTextReplaceRequest): VisioTextReplacePlan;
|
|
16
15
|
/** Reject forged and stale scene plans before returning independently owned atomic commands. */
|
|
17
|
-
export declare function visioTextReplaceCommands(model: VisioDocument, plan: VisioTextReplacePlan):
|
|
16
|
+
export declare function visioTextReplaceCommands(model: VisioDocument, plan: VisioTextReplacePlan): VisioTextReplaceEdit[];
|
|
18
17
|
//# sourceMappingURL=text-replace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-replace.d.ts","sourceRoot":"","sources":["../../../visio/ui/text-replace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"text-replace.d.ts","sourceRoot":"","sources":["../../../visio/ui/text-replace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAKN,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACX,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAyBxE,wFAAwF;AACxF,wBAAgB,2BAA2B,CAC1C,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,qBAAqB,GAC1B,SAAS,mBAAmB,EAAE,CAGhC;AAED,mFAAmF;AACnF,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,qBAAqB,EAC5B,OAAO,CAAC,EAAE,mBAAmB,GAC3B,mBAAmB,GAAG,SAAS,CAOjC;AAgCD;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,uBAAuB,GAC5B,oBAAoB,CA8FtB;AAED,gGAAgG;AAChG,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,oBAAoB,GACxB,oBAAoB,EAAE,CAqBxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml-validation.d.ts","sourceRoot":"","sources":["../../visio/xml-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"xml-validation.d.ts","sourceRoot":"","sources":["../../visio/xml-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAwBjE,oGAAoG;AACpG,wBAAgB,UAAU,CACzB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,MAAM,IAAI,EACjB,QAAQ,SAAU,GAChB,MAAM,CA0HR;AAuCD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAyBxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../xlsx/collab/codec.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,OAAO,EAIZ,MAAM,UAAU,CAAC;AAGlB,yFAAyF;AACzF,MAAM,WAAW,SAAS;IACzB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9B,2EAA2E;IAC3E,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC1B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;IAClB,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC,CAAC;CACN;AAED,0FAA0F;AAC1F,MAAM,WAAW,SAAS;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,EAAE,CAAC,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../xlsx/collab/codec.ts"],"names":[],"mappings":"AAIA,OAAO,EACN,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,OAAO,EAIZ,MAAM,UAAU,CAAC;AAGlB,yFAAyF;AACzF,MAAM,WAAW,SAAS;IACzB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9B,2EAA2E;IAC3E,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC1B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;IAClB,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,CAAC,CAAC,EAAE,CAAC,CAAC;CACN;AAED,0FAA0F;AAC1F,MAAM,WAAW,SAAS;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,EAAE,CAAC,EAAE,CAAC,CAAC;IACP,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,CAAC;CACX;AAED,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,GAAG,SAAS,CAAC;AACjE,KAAK,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,GAAG,SAAS,CAAC;AAO5D,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,CAyB1E;AAcD,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAmCrE;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,UAAQ,GAAG,SAAS,CAgB9F;AAUD,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,GAAG,SAAS,CAcvE;AAED,wBAAgB,YAAY,CAC3B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,IAAI,GACR,UAAU,GAAG,SAAS,CAaxB"}
|
|
@@ -364,6 +364,9 @@ function encodeLine(info, keyOf, column = false) {
|
|
|
364
364
|
if (size !== void 0) entry.size = size;
|
|
365
365
|
if (custom) entry.custom = 1;
|
|
366
366
|
if (info.hidden) entry.hidden = 1;
|
|
367
|
+
if (!column && info.filteredOut !== void 0)
|
|
368
|
+
entry.filtered = info.filteredOut ? 1 : 0;
|
|
369
|
+
if (!column && info.manuallyHidden) entry.manual = 1;
|
|
367
370
|
const s = info.styleId ? keyOf(info.styleId) : void 0;
|
|
368
371
|
if (s) entry.s = s;
|
|
369
372
|
if (info.outlineLevel) entry.ol = info.outlineLevel;
|
|
@@ -385,6 +388,8 @@ function decodeRow(raw, idOf) {
|
|
|
385
388
|
if (entry.size !== void 0) info.height = entry.size;
|
|
386
389
|
if (entry.custom === 1) info.customHeight = true;
|
|
387
390
|
if (entry.hidden === 1) info.hidden = true;
|
|
391
|
+
if (entry.filtered === 0 || entry.filtered === 1) info.filteredOut = entry.filtered === 1;
|
|
392
|
+
if (entry.manual === 1) info.manuallyHidden = true;
|
|
388
393
|
const styleId = entry.s ? idOf(entry.s) : void 0;
|
|
389
394
|
if (styleId) info.styleId = styleId;
|
|
390
395
|
if (entry.ol) info.outlineLevel = entry.ol;
|
|
@@ -342,6 +342,9 @@ function encodeLine(info, keyOf, column = false) {
|
|
|
342
342
|
if (size !== void 0) entry.size = size;
|
|
343
343
|
if (custom) entry.custom = 1;
|
|
344
344
|
if (info.hidden) entry.hidden = 1;
|
|
345
|
+
if (!column && info.filteredOut !== void 0)
|
|
346
|
+
entry.filtered = info.filteredOut ? 1 : 0;
|
|
347
|
+
if (!column && info.manuallyHidden) entry.manual = 1;
|
|
345
348
|
const s = info.styleId ? keyOf(info.styleId) : void 0;
|
|
346
349
|
if (s) entry.s = s;
|
|
347
350
|
if (info.outlineLevel) entry.ol = info.outlineLevel;
|
|
@@ -363,6 +366,8 @@ function decodeRow(raw, idOf) {
|
|
|
363
366
|
if (entry.size !== void 0) info.height = entry.size;
|
|
364
367
|
if (entry.custom === 1) info.customHeight = true;
|
|
365
368
|
if (entry.hidden === 1) info.hidden = true;
|
|
369
|
+
if (entry.filtered === 0 || entry.filtered === 1) info.filteredOut = entry.filtered === 1;
|
|
370
|
+
if (entry.manual === 1) info.manuallyHidden = true;
|
|
366
371
|
const styleId = entry.s ? idOf(entry.s) : void 0;
|
|
367
372
|
if (styleId) info.styleId = styleId;
|
|
368
373
|
if (entry.ol) info.outlineLevel = entry.ol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display-text.d.ts","sourceRoot":"","sources":["../../xlsx/display-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIhE,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,MAAM,CAS9E"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type CellAddress, type CellRange } from '../address.js';
|
|
2
2
|
import type { Cell, CellValue, Worksheet } from '../model.js';
|
|
3
3
|
import { type EditContext } from './context.js';
|
|
4
|
+
import { type CellPosition } from './deps.js';
|
|
4
5
|
import type { EditScope, SheetPart } from './history.js';
|
|
5
6
|
import type { ClearWhat } from './types.js';
|
|
6
7
|
/** Keeps a table's column name in step with its header cell. */
|
|
7
|
-
export declare function syncTableHeader(ctx: EditContext, sheet: Worksheet, row: number, col: number): void;
|
|
8
|
+
export declare function syncTableHeader(ctx: EditContext, sheet: Worksheet, row: number, col: number, formulaCells?: readonly CellPosition[]): void;
|
|
8
9
|
/**
|
|
9
|
-
* Undo scopes for writing to cells
|
|
10
|
-
*
|
|
10
|
+
* Undo scopes for writing to cells, including workbook references when a table header changes.
|
|
11
|
+
* `parts` adds other sheet properties the edit changes.
|
|
11
12
|
*/
|
|
12
13
|
export declare function writeScopes(sheet: Worksheet, index: number, range: CellRange, parts?: SheetPart[]): EditScope[];
|
|
13
14
|
/** The single undo scope of {@link writeScopes}, kept for callers that want one. */
|