ooxml-core 1.22.0 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/dist/automation/index.cjs +559 -339
- package/dist/automation/index.d.ts +1 -0
- package/dist/automation/index.d.ts.map +1 -1
- package/dist/automation/index.mjs +558 -340
- package/dist/automation/live.d.ts +89 -0
- package/dist/automation/live.d.ts.map +1 -0
- package/dist/collab/embedding.d.ts +7 -0
- package/dist/collab/embedding.d.ts.map +1 -1
- package/dist/collab/index.cjs +189 -0
- package/dist/collab/index.d.ts +2 -0
- package/dist/collab/index.d.ts.map +1 -1
- package/dist/collab/index.mjs +186 -1
- package/dist/collab/write-back-lifecycle.d.ts +33 -0
- package/dist/collab/write-back-lifecycle.d.ts.map +1 -0
- package/dist/collab/write-back.d.ts +75 -0
- package/dist/collab/write-back.d.ts.map +1 -0
- package/dist/docx/ui/customization.d.ts +30 -0
- package/dist/docx/ui/customization.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +51 -0
- package/dist/docx/ui/index.d.ts +1 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +46 -1
- package/dist/embedding/backstage.d.ts +48 -0
- package/dist/embedding/backstage.d.ts.map +1 -0
- package/dist/embedding/capabilities.d.ts +60 -0
- package/dist/embedding/capabilities.d.ts.map +1 -0
- package/dist/embedding/customization.d.ts +32 -0
- package/dist/embedding/customization.d.ts.map +1 -0
- package/dist/embedding/index.cjs +229 -0
- package/dist/embedding/index.d.ts +7 -0
- package/dist/embedding/index.d.ts.map +1 -0
- package/dist/embedding/index.mjs +204 -0
- package/dist/embedding/menu-commands.d.ts +66 -0
- package/dist/embedding/menu-commands.d.ts.map +1 -0
- package/dist/embedding/regions.d.ts +58 -0
- package/dist/embedding/regions.d.ts.map +1 -0
- package/dist/embedding/storage.d.ts +111 -0
- package/dist/embedding/storage.d.ts.map +1 -0
- package/dist/index.cjs +233 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +233 -1
- package/dist/visio/collab/baseline.d.ts +36 -0
- package/dist/visio/collab/baseline.d.ts.map +1 -0
- package/dist/visio/collab/bind.d.ts +20 -2
- package/dist/visio/collab/bind.d.ts.map +1 -1
- package/dist/visio/collab/compose-lists.d.ts +27 -0
- package/dist/visio/collab/compose-lists.d.ts.map +1 -0
- package/dist/visio/collab/compose.d.ts +6 -2
- package/dist/visio/collab/compose.d.ts.map +1 -1
- package/dist/visio/collab/fixups.d.ts +5 -0
- package/dist/visio/collab/fixups.d.ts.map +1 -0
- package/dist/visio/collab/index.cjs +1603 -361
- package/dist/visio/collab/index.d.ts +3 -2
- package/dist/visio/collab/index.d.ts.map +1 -1
- package/dist/visio/collab/index.mjs +1596 -362
- package/dist/visio/collab/keys.d.ts +32 -1
- package/dist/visio/collab/keys.d.ts.map +1 -1
- package/dist/visio/collab/package.d.ts +22 -1
- package/dist/visio/collab/package.d.ts.map +1 -1
- package/dist/visio/collab/pieces.d.ts +41 -0
- package/dist/visio/collab/pieces.d.ts.map +1 -0
- package/dist/visio/collab/read-ids.d.ts +35 -0
- package/dist/visio/collab/read-ids.d.ts.map +1 -0
- package/dist/visio/collab/read-parts.d.ts +34 -0
- package/dist/visio/collab/read-parts.d.ts.map +1 -0
- package/dist/visio/collab/read-shapes.d.ts +34 -0
- package/dist/visio/collab/read-shapes.d.ts.map +1 -0
- package/dist/visio/collab/read-util.d.ts +20 -0
- package/dist/visio/collab/read-util.d.ts.map +1 -0
- package/dist/visio/collab/read.d.ts +40 -19
- package/dist/visio/collab/read.d.ts.map +1 -1
- package/dist/visio/collab/schema.d.ts +55 -1
- package/dist/visio/collab/schema.d.ts.map +1 -1
- package/dist/visio/collab/snapshot-contents.d.ts +9 -0
- package/dist/visio/collab/snapshot-contents.d.ts.map +1 -0
- package/dist/visio/collab/snapshot-io.d.ts +26 -0
- package/dist/visio/collab/snapshot-io.d.ts.map +1 -0
- package/dist/visio/collab/snapshot-parts.d.ts +14 -0
- package/dist/visio/collab/snapshot-parts.d.ts.map +1 -0
- package/dist/visio/collab/snapshot.d.ts +31 -24
- package/dist/visio/collab/snapshot.d.ts.map +1 -1
- package/dist/visio/collab/write-parts.d.ts +8 -0
- package/dist/visio/collab/write-parts.d.ts.map +1 -0
- package/dist/visio/collab/write-shapes.d.ts +30 -0
- package/dist/visio/collab/write-shapes.d.ts.map +1 -0
- package/dist/visio/collab/write.d.ts +4 -16
- package/dist/visio/collab/write.d.ts.map +1 -1
- package/dist/visio/collab/zip-store.d.ts +4 -0
- package/dist/visio/collab/zip-store.d.ts.map +1 -0
- package/dist/visio/document-level.d.ts +57 -0
- package/dist/visio/document-level.d.ts.map +1 -0
- package/dist/visio/index.cjs +485 -333
- package/dist/visio/index.d.ts +2 -0
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +484 -334
- package/dist/visio/layers.d.ts +3 -0
- package/dist/visio/layers.d.ts.map +1 -1
- package/dist/visio/package.d.ts +9 -0
- package/dist/visio/package.d.ts.map +1 -1
- package/dist/visio/parse-incremental.d.ts +16 -0
- package/dist/visio/parse-incremental.d.ts.map +1 -0
- package/dist/visio/parser.d.ts +14 -0
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/shape-metadata.d.ts +3 -0
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/ui/collab-options.d.ts +10 -5
- package/dist/visio/ui/collab-options.d.ts.map +1 -1
- package/dist/visio/ui/contract.d.ts +27 -2
- package/dist/visio/ui/contract.d.ts.map +1 -1
- package/dist/visio/ui/customization.d.ts +46 -0
- package/dist/visio/ui/customization.d.ts.map +1 -0
- package/dist/visio/ui/index.cjs +460 -320
- 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 +458 -321
- package/dist/xlsx/ui/commands.d.ts +2 -0
- package/dist/xlsx/ui/commands.d.ts.map +1 -1
- package/dist/xlsx/ui/customization.d.ts +49 -0
- package/dist/xlsx/ui/customization.d.ts.map +1 -0
- package/dist/xlsx/ui/index.cjs +39 -1
- package/dist/xlsx/ui/index.d.ts +1 -0
- package/dist/xlsx/ui/index.d.ts.map +1 -1
- package/dist/xlsx/ui/index.mjs +37 -2
- package/package.json +6 -1
package/dist/index.cjs
CHANGED
|
@@ -9613,6 +9613,238 @@ function findRibbonAddInCommand(tab, id) {
|
|
|
9613
9613
|
return command && !command.disabled ? command : void 0;
|
|
9614
9614
|
}
|
|
9615
9615
|
|
|
9616
|
+
// embedding/index.ts
|
|
9617
|
+
var embedding_exports = {};
|
|
9618
|
+
__export(embedding_exports, {
|
|
9619
|
+
EDITOR_CAPABILITY_IDS: () => EDITOR_CAPABILITY_IDS,
|
|
9620
|
+
FILE_COMMAND_EVENT: () => FILE_COMMAND_EVENT,
|
|
9621
|
+
acceptedHostBackstagePages: () => acceptedHostBackstagePages,
|
|
9622
|
+
capabilityHiddenActions: () => capabilityHiddenActions,
|
|
9623
|
+
disabledCapabilities: () => disabledCapabilities,
|
|
9624
|
+
documentMimeType: () => documentMimeType,
|
|
9625
|
+
documentSaveMeta: () => documentSaveMeta,
|
|
9626
|
+
fileCommandDetail: () => fileCommandDetail,
|
|
9627
|
+
hostBackstageItemId: () => hostBackstageItemId,
|
|
9628
|
+
hostBackstagePageId: () => hostBackstagePageId,
|
|
9629
|
+
hostBackstageRegionId: () => hostBackstageRegionId,
|
|
9630
|
+
hostMenuEntryId: () => hostMenuEntryId,
|
|
9631
|
+
isCapabilityEnabled: () => isCapabilityEnabled,
|
|
9632
|
+
isDocumentStorage: () => isDocumentStorage,
|
|
9633
|
+
isHostMenuEntry: () => isHostMenuEntry,
|
|
9634
|
+
mergeHiddenActions: () => mergeHiddenActions,
|
|
9635
|
+
placeHostBackstagePages: () => placeHostBackstagePages,
|
|
9636
|
+
recoveryStoreOf: () => recoveryStoreOf,
|
|
9637
|
+
resolveHostMenuCommands: () => resolveHostMenuCommands,
|
|
9638
|
+
sameRegionContext: () => sameRegionContext,
|
|
9639
|
+
sameRenderer: () => sameRenderer,
|
|
9640
|
+
saveToStorage: () => saveToStorage,
|
|
9641
|
+
withHostMenuCommands: () => withHostMenuCommands,
|
|
9642
|
+
withoutHiddenEntries: () => withoutHiddenEntries
|
|
9643
|
+
});
|
|
9644
|
+
|
|
9645
|
+
// embedding/storage.ts
|
|
9646
|
+
var FILE_COMMAND_EVENT = "file-command";
|
|
9647
|
+
function fileCommandDetail(command, fileName) {
|
|
9648
|
+
return fileName === void 0 ? { command } : { command, fileName };
|
|
9649
|
+
}
|
|
9650
|
+
function recoveryStoreOf(storage) {
|
|
9651
|
+
if (!storage?.readRecovery || !storage.writeRecovery || !storage.clearRecovery) return void 0;
|
|
9652
|
+
return storage;
|
|
9653
|
+
}
|
|
9654
|
+
function isDocumentStorage(value) {
|
|
9655
|
+
return typeof value === "object" && value !== null && typeof value.save === "function";
|
|
9656
|
+
}
|
|
9657
|
+
var MIME_TYPES = {
|
|
9658
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
9659
|
+
docm: "application/vnd.ms-word.document.macroEnabled.12",
|
|
9660
|
+
dotx: "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
|
9661
|
+
doc: "application/msword",
|
|
9662
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
9663
|
+
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.12",
|
|
9664
|
+
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
|
9665
|
+
xls: "application/vnd.ms-excel",
|
|
9666
|
+
csv: "text/csv",
|
|
9667
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
9668
|
+
pptm: "application/vnd.ms-powerpoint.presentation.macroEnabled.12",
|
|
9669
|
+
ppsx: "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
9670
|
+
potx: "application/vnd.openxmlformats-officedocument.presentationml.template",
|
|
9671
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
9672
|
+
vsdx: "application/vnd.ms-visio.drawing",
|
|
9673
|
+
vsdm: "application/vnd.ms-visio.drawing.macroEnabled.12",
|
|
9674
|
+
vsd: "application/vnd.visio",
|
|
9675
|
+
txt: "text/plain",
|
|
9676
|
+
json: "application/json"
|
|
9677
|
+
};
|
|
9678
|
+
function documentMimeType(fileName) {
|
|
9679
|
+
const extension = /\.([^./\\]+)$/.exec(fileName)?.[1]?.toLowerCase() ?? "";
|
|
9680
|
+
return MIME_TYPES[extension] ?? "application/octet-stream";
|
|
9681
|
+
}
|
|
9682
|
+
function documentSaveMeta(fileName, reason = "save", mimeType = documentMimeType(fileName)) {
|
|
9683
|
+
return { fileName, mimeType, reason };
|
|
9684
|
+
}
|
|
9685
|
+
async function saveToStorage(storage, bytes, meta) {
|
|
9686
|
+
const result = await storage.save(bytes, meta);
|
|
9687
|
+
const name = result?.fileName?.trim();
|
|
9688
|
+
return name ? name : meta.fileName;
|
|
9689
|
+
}
|
|
9690
|
+
|
|
9691
|
+
// embedding/backstage.ts
|
|
9692
|
+
function hostBackstageItemId(id) {
|
|
9693
|
+
return `host.${id}`;
|
|
9694
|
+
}
|
|
9695
|
+
function hostBackstagePageId(itemId) {
|
|
9696
|
+
return itemId.startsWith("host.") ? itemId.slice(5) : void 0;
|
|
9697
|
+
}
|
|
9698
|
+
function acceptedHostBackstagePages(pages) {
|
|
9699
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9700
|
+
const accepted = [];
|
|
9701
|
+
for (const page of pages ?? []) {
|
|
9702
|
+
if (!page || typeof page.id !== "string" || !page.id || seen.has(page.id)) continue;
|
|
9703
|
+
seen.add(page.id);
|
|
9704
|
+
accepted.push({ page, index: accepted.length });
|
|
9705
|
+
}
|
|
9706
|
+
return accepted.sort((a2, b) => (a2.page.order ?? 0) - (b.page.order ?? 0) || a2.index - b.index).map(({ page }) => page);
|
|
9707
|
+
}
|
|
9708
|
+
function placeHostBackstagePages(items, pages, toEntry) {
|
|
9709
|
+
const entries = [...items];
|
|
9710
|
+
for (const page of acceptedHostBackstagePages(pages)) {
|
|
9711
|
+
const group2 = page.group ?? "main";
|
|
9712
|
+
let at2 = entries.length;
|
|
9713
|
+
while (at2 > 0 && (entries[at2 - 1]?.group ?? "main") !== group2) at2--;
|
|
9714
|
+
entries.splice(at2 === 0 ? entries.length : at2, 0, toEntry(page));
|
|
9715
|
+
}
|
|
9716
|
+
return entries;
|
|
9717
|
+
}
|
|
9718
|
+
|
|
9719
|
+
// embedding/capabilities.ts
|
|
9720
|
+
var EDITOR_CAPABILITY_IDS = [
|
|
9721
|
+
/** Changing the document. `false` opens it read-only, whatever the edit prop says. */
|
|
9722
|
+
"edit",
|
|
9723
|
+
/** Saving a copy in another format (File > Export, Save As, Download). */
|
|
9724
|
+
"export",
|
|
9725
|
+
/** Printing (File > Print, the Print commands and Ctrl+P). */
|
|
9726
|
+
"print",
|
|
9727
|
+
/** Sharing the document with other people (File > Share, Share buttons). */
|
|
9728
|
+
"share",
|
|
9729
|
+
/** Copying content out (Copy, Cut and their shortcuts). */
|
|
9730
|
+
"copy",
|
|
9731
|
+
/** Adding and editing comments. */
|
|
9732
|
+
"comment",
|
|
9733
|
+
/** Tracked changes: turning tracking on, accepting and rejecting. */
|
|
9734
|
+
"review",
|
|
9735
|
+
/** Find and Replace. */
|
|
9736
|
+
"find",
|
|
9737
|
+
/** File > New and File > Open. */
|
|
9738
|
+
"open",
|
|
9739
|
+
/** File > Save. */
|
|
9740
|
+
"save",
|
|
9741
|
+
/** File > Options and Customize Ribbon. */
|
|
9742
|
+
"settings"
|
|
9743
|
+
];
|
|
9744
|
+
function isCapabilityEnabled(capabilities, id) {
|
|
9745
|
+
return capabilities?.[id] !== false;
|
|
9746
|
+
}
|
|
9747
|
+
function disabledCapabilities(capabilities) {
|
|
9748
|
+
if (!capabilities) return [];
|
|
9749
|
+
return Object.keys(capabilities).filter((id) => capabilities[id] === false);
|
|
9750
|
+
}
|
|
9751
|
+
function capabilityHiddenActions(capabilities, map) {
|
|
9752
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
9753
|
+
for (const id of disabledCapabilities(capabilities))
|
|
9754
|
+
for (const action of map[id] ?? []) hidden.add(action);
|
|
9755
|
+
return [...hidden];
|
|
9756
|
+
}
|
|
9757
|
+
function mergeHiddenActions(...lists) {
|
|
9758
|
+
const merged = /* @__PURE__ */ new Set();
|
|
9759
|
+
for (const list2 of lists) for (const action of list2 ?? []) merged.add(action);
|
|
9760
|
+
return [...merged];
|
|
9761
|
+
}
|
|
9762
|
+
|
|
9763
|
+
// embedding/menu-commands.ts
|
|
9764
|
+
function hostMenuEntryId(id) {
|
|
9765
|
+
return `host:${id}`;
|
|
9766
|
+
}
|
|
9767
|
+
function isHostMenuEntry(entry3) {
|
|
9768
|
+
return typeof entry3 === "object" && entry3 !== null && entry3.host === true;
|
|
9769
|
+
}
|
|
9770
|
+
function resolveHostMenuCommands(commands, context) {
|
|
9771
|
+
const top = [];
|
|
9772
|
+
const bottom = [];
|
|
9773
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9774
|
+
for (const command of commands ?? []) {
|
|
9775
|
+
if (!command?.id || seen.has(command.id)) continue;
|
|
9776
|
+
seen.add(command.id);
|
|
9777
|
+
if (command.when && !command.when(context)) continue;
|
|
9778
|
+
const disabled = typeof command.disabled === "function" ? command.disabled(context) : command.disabled === true;
|
|
9779
|
+
const entry3 = {
|
|
9780
|
+
id: hostMenuEntryId(command.id),
|
|
9781
|
+
host: true,
|
|
9782
|
+
label: command.label,
|
|
9783
|
+
labelKey: "",
|
|
9784
|
+
disabled,
|
|
9785
|
+
onSelect: () => {
|
|
9786
|
+
if (!disabled) command.onSelect(context);
|
|
9787
|
+
}
|
|
9788
|
+
};
|
|
9789
|
+
if (command.icon) entry3.icon = command.icon;
|
|
9790
|
+
(command.group === "bottom" ? bottom : top).push(entry3);
|
|
9791
|
+
}
|
|
9792
|
+
return { top, bottom };
|
|
9793
|
+
}
|
|
9794
|
+
function withHostMenuCommands(entries, commands, context) {
|
|
9795
|
+
const { top, bottom } = resolveHostMenuCommands(commands, context);
|
|
9796
|
+
const middle = entries.map(
|
|
9797
|
+
(entry3, index) => index === 0 ? { ...entry3, separatorBefore: top.length > 0 } : entry3
|
|
9798
|
+
);
|
|
9799
|
+
const first2 = bottom[0];
|
|
9800
|
+
if (first2 && top.length + middle.length > 0) first2.separatorBefore = true;
|
|
9801
|
+
return [...top, ...middle, ...bottom];
|
|
9802
|
+
}
|
|
9803
|
+
function withoutHiddenEntries(entries, hidden) {
|
|
9804
|
+
const kept = [];
|
|
9805
|
+
let separator = false;
|
|
9806
|
+
for (const entry3 of entries) {
|
|
9807
|
+
separator ||= entry3.separatorBefore === true;
|
|
9808
|
+
if (hidden(entry3)) continue;
|
|
9809
|
+
const starts = separator && kept.length > 0;
|
|
9810
|
+
kept.push(
|
|
9811
|
+
entry3.separatorBefore === true === starts ? entry3 : { ...entry3, separatorBefore: starts }
|
|
9812
|
+
);
|
|
9813
|
+
separator = false;
|
|
9814
|
+
}
|
|
9815
|
+
return kept;
|
|
9816
|
+
}
|
|
9817
|
+
|
|
9818
|
+
// embedding/regions.ts
|
|
9819
|
+
function hostBackstageRegionId(id) {
|
|
9820
|
+
return `backstage.host.${id}`;
|
|
9821
|
+
}
|
|
9822
|
+
function sameRenderer(a2, b) {
|
|
9823
|
+
if (a2 === b) return true;
|
|
9824
|
+
if (!a2 || !b || typeof a2 !== "object" || typeof b !== "object" || a2.element !== b.element)
|
|
9825
|
+
return false;
|
|
9826
|
+
const left = a2.properties ?? {};
|
|
9827
|
+
const right = b.properties ?? {};
|
|
9828
|
+
const keys = Object.keys(left);
|
|
9829
|
+
return keys.length === Object.keys(right).length && keys.every((key) => Object.is(left[key], right[key]));
|
|
9830
|
+
}
|
|
9831
|
+
function sameRegionContext(a2, b, callbackKeys = /* @__PURE__ */ new Set(["close"])) {
|
|
9832
|
+
const left = a2;
|
|
9833
|
+
const right = b;
|
|
9834
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])) {
|
|
9835
|
+
if (callbackKeys.has(key)) continue;
|
|
9836
|
+
const x = left[key];
|
|
9837
|
+
const y = right[key];
|
|
9838
|
+
if (Array.isArray(x) && Array.isArray(y)) {
|
|
9839
|
+
if (!sameItems(x, y)) return false;
|
|
9840
|
+
} else if (!Object.is(x, y)) return false;
|
|
9841
|
+
}
|
|
9842
|
+
return true;
|
|
9843
|
+
}
|
|
9844
|
+
function sameItems(a2, b) {
|
|
9845
|
+
return a2 === b || a2.length === b.length && a2.every((item, index) => Object.is(item, b[index]));
|
|
9846
|
+
}
|
|
9847
|
+
|
|
9616
9848
|
// drawingml/index.ts
|
|
9617
9849
|
var drawingml_exports = {};
|
|
9618
9850
|
__export(drawingml_exports, {
|
|
@@ -46824,6 +47056,7 @@ exports.color = color_exports;
|
|
|
46824
47056
|
exports.diagram = diagram_exports;
|
|
46825
47057
|
exports.digest = digest_exports;
|
|
46826
47058
|
exports.drawingml = drawingml_exports;
|
|
47059
|
+
exports.embedding = embedding_exports;
|
|
46827
47060
|
exports.geometry = geometry_exports;
|
|
46828
47061
|
exports.i18n = i18n_exports;
|
|
46829
47062
|
exports.math = math_exports;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * as chart from './chart/index.js';
|
|
|
3
3
|
export * as text from './text/index.js';
|
|
4
4
|
export * as i18n from './i18n/index.js';
|
|
5
5
|
export * as ribbon from './ribbon/index.js';
|
|
6
|
+
export * as embedding from './embedding/index.js';
|
|
6
7
|
export * as drawingml from './drawingml/index.js';
|
|
7
8
|
export * as diagram from './diagram/index.js';
|
|
8
9
|
export * as digest from './digest/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,cAAc,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -9607,6 +9607,238 @@ function findRibbonAddInCommand(tab, id) {
|
|
|
9607
9607
|
return command && !command.disabled ? command : void 0;
|
|
9608
9608
|
}
|
|
9609
9609
|
|
|
9610
|
+
// embedding/index.ts
|
|
9611
|
+
var embedding_exports = {};
|
|
9612
|
+
__export(embedding_exports, {
|
|
9613
|
+
EDITOR_CAPABILITY_IDS: () => EDITOR_CAPABILITY_IDS,
|
|
9614
|
+
FILE_COMMAND_EVENT: () => FILE_COMMAND_EVENT,
|
|
9615
|
+
acceptedHostBackstagePages: () => acceptedHostBackstagePages,
|
|
9616
|
+
capabilityHiddenActions: () => capabilityHiddenActions,
|
|
9617
|
+
disabledCapabilities: () => disabledCapabilities,
|
|
9618
|
+
documentMimeType: () => documentMimeType,
|
|
9619
|
+
documentSaveMeta: () => documentSaveMeta,
|
|
9620
|
+
fileCommandDetail: () => fileCommandDetail,
|
|
9621
|
+
hostBackstageItemId: () => hostBackstageItemId,
|
|
9622
|
+
hostBackstagePageId: () => hostBackstagePageId,
|
|
9623
|
+
hostBackstageRegionId: () => hostBackstageRegionId,
|
|
9624
|
+
hostMenuEntryId: () => hostMenuEntryId,
|
|
9625
|
+
isCapabilityEnabled: () => isCapabilityEnabled,
|
|
9626
|
+
isDocumentStorage: () => isDocumentStorage,
|
|
9627
|
+
isHostMenuEntry: () => isHostMenuEntry,
|
|
9628
|
+
mergeHiddenActions: () => mergeHiddenActions,
|
|
9629
|
+
placeHostBackstagePages: () => placeHostBackstagePages,
|
|
9630
|
+
recoveryStoreOf: () => recoveryStoreOf,
|
|
9631
|
+
resolveHostMenuCommands: () => resolveHostMenuCommands,
|
|
9632
|
+
sameRegionContext: () => sameRegionContext,
|
|
9633
|
+
sameRenderer: () => sameRenderer,
|
|
9634
|
+
saveToStorage: () => saveToStorage,
|
|
9635
|
+
withHostMenuCommands: () => withHostMenuCommands,
|
|
9636
|
+
withoutHiddenEntries: () => withoutHiddenEntries
|
|
9637
|
+
});
|
|
9638
|
+
|
|
9639
|
+
// embedding/storage.ts
|
|
9640
|
+
var FILE_COMMAND_EVENT = "file-command";
|
|
9641
|
+
function fileCommandDetail(command, fileName) {
|
|
9642
|
+
return fileName === void 0 ? { command } : { command, fileName };
|
|
9643
|
+
}
|
|
9644
|
+
function recoveryStoreOf(storage) {
|
|
9645
|
+
if (!storage?.readRecovery || !storage.writeRecovery || !storage.clearRecovery) return void 0;
|
|
9646
|
+
return storage;
|
|
9647
|
+
}
|
|
9648
|
+
function isDocumentStorage(value) {
|
|
9649
|
+
return typeof value === "object" && value !== null && typeof value.save === "function";
|
|
9650
|
+
}
|
|
9651
|
+
var MIME_TYPES = {
|
|
9652
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
9653
|
+
docm: "application/vnd.ms-word.document.macroEnabled.12",
|
|
9654
|
+
dotx: "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
|
9655
|
+
doc: "application/msword",
|
|
9656
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
9657
|
+
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.12",
|
|
9658
|
+
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
|
9659
|
+
xls: "application/vnd.ms-excel",
|
|
9660
|
+
csv: "text/csv",
|
|
9661
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
9662
|
+
pptm: "application/vnd.ms-powerpoint.presentation.macroEnabled.12",
|
|
9663
|
+
ppsx: "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
9664
|
+
potx: "application/vnd.openxmlformats-officedocument.presentationml.template",
|
|
9665
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
9666
|
+
vsdx: "application/vnd.ms-visio.drawing",
|
|
9667
|
+
vsdm: "application/vnd.ms-visio.drawing.macroEnabled.12",
|
|
9668
|
+
vsd: "application/vnd.visio",
|
|
9669
|
+
txt: "text/plain",
|
|
9670
|
+
json: "application/json"
|
|
9671
|
+
};
|
|
9672
|
+
function documentMimeType(fileName) {
|
|
9673
|
+
const extension = /\.([^./\\]+)$/.exec(fileName)?.[1]?.toLowerCase() ?? "";
|
|
9674
|
+
return MIME_TYPES[extension] ?? "application/octet-stream";
|
|
9675
|
+
}
|
|
9676
|
+
function documentSaveMeta(fileName, reason = "save", mimeType = documentMimeType(fileName)) {
|
|
9677
|
+
return { fileName, mimeType, reason };
|
|
9678
|
+
}
|
|
9679
|
+
async function saveToStorage(storage, bytes, meta) {
|
|
9680
|
+
const result = await storage.save(bytes, meta);
|
|
9681
|
+
const name = result?.fileName?.trim();
|
|
9682
|
+
return name ? name : meta.fileName;
|
|
9683
|
+
}
|
|
9684
|
+
|
|
9685
|
+
// embedding/backstage.ts
|
|
9686
|
+
function hostBackstageItemId(id) {
|
|
9687
|
+
return `host.${id}`;
|
|
9688
|
+
}
|
|
9689
|
+
function hostBackstagePageId(itemId) {
|
|
9690
|
+
return itemId.startsWith("host.") ? itemId.slice(5) : void 0;
|
|
9691
|
+
}
|
|
9692
|
+
function acceptedHostBackstagePages(pages) {
|
|
9693
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9694
|
+
const accepted = [];
|
|
9695
|
+
for (const page of pages ?? []) {
|
|
9696
|
+
if (!page || typeof page.id !== "string" || !page.id || seen.has(page.id)) continue;
|
|
9697
|
+
seen.add(page.id);
|
|
9698
|
+
accepted.push({ page, index: accepted.length });
|
|
9699
|
+
}
|
|
9700
|
+
return accepted.sort((a2, b) => (a2.page.order ?? 0) - (b.page.order ?? 0) || a2.index - b.index).map(({ page }) => page);
|
|
9701
|
+
}
|
|
9702
|
+
function placeHostBackstagePages(items, pages, toEntry) {
|
|
9703
|
+
const entries = [...items];
|
|
9704
|
+
for (const page of acceptedHostBackstagePages(pages)) {
|
|
9705
|
+
const group2 = page.group ?? "main";
|
|
9706
|
+
let at2 = entries.length;
|
|
9707
|
+
while (at2 > 0 && (entries[at2 - 1]?.group ?? "main") !== group2) at2--;
|
|
9708
|
+
entries.splice(at2 === 0 ? entries.length : at2, 0, toEntry(page));
|
|
9709
|
+
}
|
|
9710
|
+
return entries;
|
|
9711
|
+
}
|
|
9712
|
+
|
|
9713
|
+
// embedding/capabilities.ts
|
|
9714
|
+
var EDITOR_CAPABILITY_IDS = [
|
|
9715
|
+
/** Changing the document. `false` opens it read-only, whatever the edit prop says. */
|
|
9716
|
+
"edit",
|
|
9717
|
+
/** Saving a copy in another format (File > Export, Save As, Download). */
|
|
9718
|
+
"export",
|
|
9719
|
+
/** Printing (File > Print, the Print commands and Ctrl+P). */
|
|
9720
|
+
"print",
|
|
9721
|
+
/** Sharing the document with other people (File > Share, Share buttons). */
|
|
9722
|
+
"share",
|
|
9723
|
+
/** Copying content out (Copy, Cut and their shortcuts). */
|
|
9724
|
+
"copy",
|
|
9725
|
+
/** Adding and editing comments. */
|
|
9726
|
+
"comment",
|
|
9727
|
+
/** Tracked changes: turning tracking on, accepting and rejecting. */
|
|
9728
|
+
"review",
|
|
9729
|
+
/** Find and Replace. */
|
|
9730
|
+
"find",
|
|
9731
|
+
/** File > New and File > Open. */
|
|
9732
|
+
"open",
|
|
9733
|
+
/** File > Save. */
|
|
9734
|
+
"save",
|
|
9735
|
+
/** File > Options and Customize Ribbon. */
|
|
9736
|
+
"settings"
|
|
9737
|
+
];
|
|
9738
|
+
function isCapabilityEnabled(capabilities, id) {
|
|
9739
|
+
return capabilities?.[id] !== false;
|
|
9740
|
+
}
|
|
9741
|
+
function disabledCapabilities(capabilities) {
|
|
9742
|
+
if (!capabilities) return [];
|
|
9743
|
+
return Object.keys(capabilities).filter((id) => capabilities[id] === false);
|
|
9744
|
+
}
|
|
9745
|
+
function capabilityHiddenActions(capabilities, map) {
|
|
9746
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
9747
|
+
for (const id of disabledCapabilities(capabilities))
|
|
9748
|
+
for (const action of map[id] ?? []) hidden.add(action);
|
|
9749
|
+
return [...hidden];
|
|
9750
|
+
}
|
|
9751
|
+
function mergeHiddenActions(...lists) {
|
|
9752
|
+
const merged = /* @__PURE__ */ new Set();
|
|
9753
|
+
for (const list2 of lists) for (const action of list2 ?? []) merged.add(action);
|
|
9754
|
+
return [...merged];
|
|
9755
|
+
}
|
|
9756
|
+
|
|
9757
|
+
// embedding/menu-commands.ts
|
|
9758
|
+
function hostMenuEntryId(id) {
|
|
9759
|
+
return `host:${id}`;
|
|
9760
|
+
}
|
|
9761
|
+
function isHostMenuEntry(entry3) {
|
|
9762
|
+
return typeof entry3 === "object" && entry3 !== null && entry3.host === true;
|
|
9763
|
+
}
|
|
9764
|
+
function resolveHostMenuCommands(commands, context) {
|
|
9765
|
+
const top = [];
|
|
9766
|
+
const bottom = [];
|
|
9767
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9768
|
+
for (const command of commands ?? []) {
|
|
9769
|
+
if (!command?.id || seen.has(command.id)) continue;
|
|
9770
|
+
seen.add(command.id);
|
|
9771
|
+
if (command.when && !command.when(context)) continue;
|
|
9772
|
+
const disabled = typeof command.disabled === "function" ? command.disabled(context) : command.disabled === true;
|
|
9773
|
+
const entry3 = {
|
|
9774
|
+
id: hostMenuEntryId(command.id),
|
|
9775
|
+
host: true,
|
|
9776
|
+
label: command.label,
|
|
9777
|
+
labelKey: "",
|
|
9778
|
+
disabled,
|
|
9779
|
+
onSelect: () => {
|
|
9780
|
+
if (!disabled) command.onSelect(context);
|
|
9781
|
+
}
|
|
9782
|
+
};
|
|
9783
|
+
if (command.icon) entry3.icon = command.icon;
|
|
9784
|
+
(command.group === "bottom" ? bottom : top).push(entry3);
|
|
9785
|
+
}
|
|
9786
|
+
return { top, bottom };
|
|
9787
|
+
}
|
|
9788
|
+
function withHostMenuCommands(entries, commands, context) {
|
|
9789
|
+
const { top, bottom } = resolveHostMenuCommands(commands, context);
|
|
9790
|
+
const middle = entries.map(
|
|
9791
|
+
(entry3, index) => index === 0 ? { ...entry3, separatorBefore: top.length > 0 } : entry3
|
|
9792
|
+
);
|
|
9793
|
+
const first2 = bottom[0];
|
|
9794
|
+
if (first2 && top.length + middle.length > 0) first2.separatorBefore = true;
|
|
9795
|
+
return [...top, ...middle, ...bottom];
|
|
9796
|
+
}
|
|
9797
|
+
function withoutHiddenEntries(entries, hidden) {
|
|
9798
|
+
const kept = [];
|
|
9799
|
+
let separator = false;
|
|
9800
|
+
for (const entry3 of entries) {
|
|
9801
|
+
separator ||= entry3.separatorBefore === true;
|
|
9802
|
+
if (hidden(entry3)) continue;
|
|
9803
|
+
const starts = separator && kept.length > 0;
|
|
9804
|
+
kept.push(
|
|
9805
|
+
entry3.separatorBefore === true === starts ? entry3 : { ...entry3, separatorBefore: starts }
|
|
9806
|
+
);
|
|
9807
|
+
separator = false;
|
|
9808
|
+
}
|
|
9809
|
+
return kept;
|
|
9810
|
+
}
|
|
9811
|
+
|
|
9812
|
+
// embedding/regions.ts
|
|
9813
|
+
function hostBackstageRegionId(id) {
|
|
9814
|
+
return `backstage.host.${id}`;
|
|
9815
|
+
}
|
|
9816
|
+
function sameRenderer(a2, b) {
|
|
9817
|
+
if (a2 === b) return true;
|
|
9818
|
+
if (!a2 || !b || typeof a2 !== "object" || typeof b !== "object" || a2.element !== b.element)
|
|
9819
|
+
return false;
|
|
9820
|
+
const left = a2.properties ?? {};
|
|
9821
|
+
const right = b.properties ?? {};
|
|
9822
|
+
const keys = Object.keys(left);
|
|
9823
|
+
return keys.length === Object.keys(right).length && keys.every((key) => Object.is(left[key], right[key]));
|
|
9824
|
+
}
|
|
9825
|
+
function sameRegionContext(a2, b, callbackKeys = /* @__PURE__ */ new Set(["close"])) {
|
|
9826
|
+
const left = a2;
|
|
9827
|
+
const right = b;
|
|
9828
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])) {
|
|
9829
|
+
if (callbackKeys.has(key)) continue;
|
|
9830
|
+
const x = left[key];
|
|
9831
|
+
const y = right[key];
|
|
9832
|
+
if (Array.isArray(x) && Array.isArray(y)) {
|
|
9833
|
+
if (!sameItems(x, y)) return false;
|
|
9834
|
+
} else if (!Object.is(x, y)) return false;
|
|
9835
|
+
}
|
|
9836
|
+
return true;
|
|
9837
|
+
}
|
|
9838
|
+
function sameItems(a2, b) {
|
|
9839
|
+
return a2 === b || a2.length === b.length && a2.every((item, index) => Object.is(item, b[index]));
|
|
9840
|
+
}
|
|
9841
|
+
|
|
9610
9842
|
// drawingml/index.ts
|
|
9611
9843
|
var drawingml_exports = {};
|
|
9612
9844
|
__export(drawingml_exports, {
|
|
@@ -46813,4 +47045,4 @@ var EQUATION_GALLERY = [
|
|
|
46813
47045
|
}
|
|
46814
47046
|
];
|
|
46815
47047
|
|
|
46816
|
-
export { chart_exports as chart, color_exports as color, diagram_exports as diagram, digest_exports as digest, drawingml_exports as drawingml, geometry_exports as geometry, i18n_exports as i18n, math_exports as math, opc_exports as opc, ribbon_exports as ribbon, text_exports as text, units_exports as units, xml_exports as xml };
|
|
47048
|
+
export { chart_exports as chart, color_exports as color, diagram_exports as diagram, digest_exports as digest, drawingml_exports as drawingml, embedding_exports as embedding, geometry_exports as geometry, i18n_exports as i18n, math_exports as math, opc_exports as opc, ribbon_exports as ribbon, text_exports as text, units_exports as units, xml_exports as xml };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** The scope (the role a page key plays) of the shapes inside master `key`'s content. */
|
|
2
|
+
export declare const masterScope: (key: string) => string;
|
|
3
|
+
export declare const pageId: (key: string) => string;
|
|
4
|
+
export declare const bodyId: (key: string) => string;
|
|
5
|
+
export declare const shapeId: (page: string, key: string) => string;
|
|
6
|
+
export declare const cellId: (page: string, shape: string, path: string) => string;
|
|
7
|
+
export declare const connectId: (key: string) => string;
|
|
8
|
+
export declare const masterId: (key: string) => string;
|
|
9
|
+
export declare const mediaId: (key: string) => string;
|
|
10
|
+
/** Baseline text of a page entry (its position excluded) and of a body. */
|
|
11
|
+
export declare const pageContent: (e: {
|
|
12
|
+
id: string;
|
|
13
|
+
back?: string | undefined;
|
|
14
|
+
xml: string;
|
|
15
|
+
}) => string;
|
|
16
|
+
export declare const bodyContent: (e: {
|
|
17
|
+
shell: string;
|
|
18
|
+
rels?: string | undefined;
|
|
19
|
+
}) => string;
|
|
20
|
+
/** A shape entry: its parent and attributes. */
|
|
21
|
+
export declare const shellContent: (e: {
|
|
22
|
+
parent?: string | undefined;
|
|
23
|
+
open: string;
|
|
24
|
+
}) => string;
|
|
25
|
+
export declare const entryContent: (e: {
|
|
26
|
+
xml?: string | undefined;
|
|
27
|
+
open?: string | undefined;
|
|
28
|
+
}) => string;
|
|
29
|
+
/** A master: id, list element, relationships and a print of its part. */
|
|
30
|
+
export declare const masterContent: (e: {
|
|
31
|
+
id: string;
|
|
32
|
+
xml: string;
|
|
33
|
+
rels?: string | undefined;
|
|
34
|
+
print: string;
|
|
35
|
+
}) => string;
|
|
36
|
+
//# sourceMappingURL=baseline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../visio/collab/baseline.ts"],"names":[],"mappings":"AAMA,yFAAyF;AACzF,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MAAoB,CAAC;AAC/D,eAAO,MAAM,MAAM,QAAS,MAAM,KAAG,MAAoB,CAAC;AAC1D,eAAO,MAAM,MAAM,QAAS,MAAM,KAAG,MAAoB,CAAC;AAC1D,eAAO,MAAM,OAAO,SAAU,MAAM,OAAO,MAAM,KAAG,MAA4B,CAAC;AACjF,eAAO,MAAM,MAAM,SAAU,MAAM,SAAS,MAAM,QAAQ,MAAM,KAAG,MACtC,CAAC;AAC9B,eAAO,MAAM,SAAS,QAAS,MAAM,KAAG,MAAoB,CAAC;AAC7D,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAG,MAAoB,CAAC;AAC5D,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,MAAoB,CAAC;AAE3D,2EAA2E;AAC3E,eAAO,MAAM,WAAW,MAAO;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,KAAG,MACnC,CAAC;AACtD,eAAO,MAAM,WAAW,MAAO;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,KAAG,MAC7B,CAAC;AAClD,gDAAgD;AAChD,eAAO,MAAM,YAAY,MAAO;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KAAG,MACf,CAAC;AAClE,eAAO,MAAM,YAAY,MAAO;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,KAAG,MACH,CAAC;AACxF,yEAAyE;AACzE,eAAO,MAAM,aAAa,MAAO;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACd,KAAG,MAAuE,CAAC"}
|
|
@@ -3,12 +3,24 @@ import type { CollabSession } from '../../collab/session.js';
|
|
|
3
3
|
export declare const VISIO_EDIT_ORIGIN: unique symbol;
|
|
4
4
|
/** Origin of seeding writes, which are not undoable. */
|
|
5
5
|
export declare const VISIO_SYNC_ORIGIN: unique symbol;
|
|
6
|
+
/** Origin of the fix-ups that persist renumbered ids: not a local edit, so never in an undo history. */
|
|
7
|
+
export declare const VISIO_FIXUP_ORIGIN: unique symbol;
|
|
8
|
+
/** What differs between the drawing last applied and the next one, when only page content does. */
|
|
9
|
+
export interface DrawingChange {
|
|
10
|
+
/** Ids (`Page/@ID` in the package handed over) of the pages whose content changed. */
|
|
11
|
+
pages: string[];
|
|
12
|
+
}
|
|
6
13
|
/** What the binding needs from the editor that shows the drawing. DOM-free. */
|
|
7
14
|
export interface DrawingEditor {
|
|
8
15
|
/** The package of the open drawing, or undefined when none can be read now. */
|
|
9
16
|
exportBytes(): Uint8Array | undefined;
|
|
10
|
-
/**
|
|
11
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Replaces the open drawing with `bytes` as a step outside the local undo history. `change`
|
|
19
|
+
* is given only when the open drawing is exactly the one last applied and just the content of
|
|
20
|
+
* these pages differs (same page list, masters, styles, theme, media and other parts): the
|
|
21
|
+
* editor may then read only those pages. Without it, read the whole package.
|
|
22
|
+
*/
|
|
23
|
+
applyRemote(bytes: Uint8Array, change?: DrawingChange): Promise<void>;
|
|
12
24
|
/** Called after the person edited or loaded a drawing (never for `applyRemote`). */
|
|
13
25
|
onLocalChange(listener: () => void): () => void;
|
|
14
26
|
/** Called whenever the editor may have stopped being busy. */
|
|
@@ -27,6 +39,12 @@ export interface DrawingBindingOptions {
|
|
|
27
39
|
onError?: (error: unknown) => void;
|
|
28
40
|
/** Part of every key this peer mints; defaults to the Yjs client id. */
|
|
29
41
|
keyTag?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Runs `run` once after the current burst of remote transactions (default: a zero-delay timer).
|
|
44
|
+
* Remote changes that arrive before it runs share one rebuild. `idle()` waits for it, so a test
|
|
45
|
+
* that injects a manual scheduler must call `run` before awaiting `idle()`.
|
|
46
|
+
*/
|
|
47
|
+
schedule?: (run: () => void) => void;
|
|
30
48
|
}
|
|
31
49
|
export interface DrawingBinding {
|
|
32
50
|
/** Undoes the last local edit (never a collaborator's); resolves false when there is none. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../../visio/collab/bind.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../../visio/collab/bind.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAS1D,wFAAwF;AACxF,eAAO,MAAM,iBAAiB,EAAE,OAAO,MAAwC,CAAC;AAChF,wDAAwD;AACxD,eAAO,MAAM,iBAAiB,EAAE,OAAO,MAAwC,CAAC;AAChF,wGAAwG;AACxG,eAAO,MAAM,kBAAkB,EAAE,OAAO,MAAyC,CAAC;AAElF,mGAAmG;AACnG,MAAM,WAAW,aAAa;IAC7B,sFAAsF;IACtF,KAAK,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,+EAA+E;AAC/E,MAAM,WAAW,aAAa;IAC7B,+EAA+E;IAC/E,WAAW,IAAI,UAAU,GAAG,SAAS,CAAC;IACtC;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,oFAAoF;IACpF,aAAa,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAChD,8DAA8D;IAC9D,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IACzC,+DAA+D;IAC/D,IAAI,IAAI,OAAO,CAAC;IAChB,8CAA8C;IAC9C,OAAO,IAAI,MAAM,CAAC;CAClB;AAED,oDAAoD;AACpD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC,CAAC;AAElG,MAAM,WAAW,qBAAqB;IACrC,2FAA2F;IAC3F,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC9B,8FAA8F;IAC9F,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,sDAAsD;IACtD,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IACtD,iGAAiG;IACjG,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,aAAa,EACrB,OAAO,GAAE,qBAA0B,GACjC,cAAc,CAsNhB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type JSZip from 'jszip';
|
|
2
|
+
export interface ListItem {
|
|
3
|
+
key: string;
|
|
4
|
+
/** The list element with {@link REL_MARK} where its `Rel` goes. */
|
|
5
|
+
xml: string;
|
|
6
|
+
part: Uint8Array;
|
|
7
|
+
/** Relationships of the item part, verbatim. */
|
|
8
|
+
rels?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ListOptions {
|
|
11
|
+
listPath: string;
|
|
12
|
+
open: string;
|
|
13
|
+
close: string;
|
|
14
|
+
relType: string;
|
|
15
|
+
/** File name stem of new parts: `page` gives `page1.xml`. */
|
|
16
|
+
stem: string;
|
|
17
|
+
items: readonly ListItem[];
|
|
18
|
+
/** Part names these keys had in the local package. */
|
|
19
|
+
known: Map<string, string>;
|
|
20
|
+
files: Map<string, Uint8Array | string>;
|
|
21
|
+
/** Names in use; extended with the ones placed. */
|
|
22
|
+
taken: Set<string>;
|
|
23
|
+
localZip: JSZip | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** Writes the list, its relationships and the item parts; returns each item's part name. */
|
|
26
|
+
export declare function placeList(options: ListOptions): Promise<Map<string, string>>;
|
|
27
|
+
//# sourceMappingURL=compose-lists.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-lists.d.ts","sourceRoot":"","sources":["../../../visio/collab/compose-lists.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,QAAQ;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC3B,sDAAsD;IACtD,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC;IACxC,mDAAmD;IACnD,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAC;CAC5B;AAKD,4FAA4F;AAC5F,wBAAsB,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA2DlF"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { DrawingKeys } from './keys.js';
|
|
2
|
-
import type { ResolvedDrawing, ResolvedPage } from './read.js';
|
|
2
|
+
import type { ResolvedDrawing, ResolvedMaster, ResolvedPage } from './read.js';
|
|
3
3
|
export interface ComposeOptions {
|
|
4
4
|
/** Refuse shared parts that decode to more than this many bytes in total. */
|
|
5
5
|
maxPartBytes?: number;
|
|
6
6
|
}
|
|
7
7
|
/** The page part with its shapes and connects filled in. */
|
|
8
|
-
export declare
|
|
8
|
+
export declare const pagePartXml: (page: ResolvedPage) => string;
|
|
9
|
+
/** The master part with its shapes and connects filled in. */
|
|
10
|
+
export declare const masterPartXml: (master: ResolvedMaster) => string;
|
|
9
11
|
export interface ComposedDrawing {
|
|
10
12
|
bytes: Uint8Array;
|
|
13
|
+
/** The resolved drawing's signature: equal signatures build equal packages. */
|
|
14
|
+
signature: string;
|
|
11
15
|
/** Records what the room held as this peer's baseline; call it once the editor adopted `bytes`. */
|
|
12
16
|
commit: () => void;
|
|
13
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../../visio/collab/compose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../../visio/collab/compose.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAiB1C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAiB,MAAM,QAAQ,CAAC;AAM3F,MAAM,WAAW,cAAc;IAC9B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AA6CD,4DAA4D;AAC5D,eAAO,MAAM,WAAW,SAAU,YAAY,KAAG,MAO/C,CAAC;AAEH,8DAA8D;AAC9D,eAAO,MAAM,aAAa,WAAY,cAAc,KAAG,MAOrD,CAAC;AAEH,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,UAAU,CAAC;IAClB,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,MAAM,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,wBAAsB,cAAc,CACnC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,UAAU,GAAG,SAAS,EAC7B,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE,cAAmB,GAC1B,OAAO,CAAC,eAAe,CAAC,CAyK1B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Fixup } from './read-ids.js';
|
|
2
|
+
import { type SharedDrawing } from './schema.js';
|
|
3
|
+
/** Writes `fixups` into the room; returns how many entries changed. Run it inside one transaction. */
|
|
4
|
+
export declare function applyFixups(shared: SharedDrawing, fixups: readonly Fixup[]): number;
|
|
5
|
+
//# sourceMappingURL=fixups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixups.d.ts","sourceRoot":"","sources":["../../../visio/collab/fixups.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,UAAU,CAAC;AAE5D,sGAAsG;AACtG,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,MAAM,CAMnF"}
|