ooxml-core 1.23.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/dist/automation/index.cjs +553 -335
- package/dist/automation/index.d.ts +1 -0
- package/dist/automation/index.d.ts.map +1 -1
- package/dist/automation/index.mjs +552 -336
- package/dist/automation/live.d.ts +89 -0
- package/dist/automation/live.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/compose.d.ts.map +1 -1
- package/dist/visio/collab/fixups.d.ts.map +1 -1
- package/dist/visio/collab/index.cjs +167 -62
- package/dist/visio/collab/index.mjs +167 -62
- package/dist/visio/collab/keys.d.ts +2 -0
- package/dist/visio/collab/keys.d.ts.map +1 -1
- package/dist/visio/collab/pieces.d.ts +7 -0
- package/dist/visio/collab/pieces.d.ts.map +1 -1
- package/dist/visio/collab/read-ids.d.ts +7 -1
- package/dist/visio/collab/read-ids.d.ts.map +1 -1
- package/dist/visio/collab/read-parts.d.ts.map +1 -1
- package/dist/visio/collab/read-shapes.d.ts +0 -1
- package/dist/visio/collab/read-shapes.d.ts.map +1 -1
- package/dist/visio/collab/read.d.ts.map +1 -1
- package/dist/visio/collab/schema.d.ts +1 -1
- package/dist/visio/collab/schema.d.ts.map +1 -1
- package/dist/visio/collab/snapshot-contents.d.ts.map +1 -1
- package/dist/visio/collab/write-shapes.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 +543 -444
- package/dist/visio/index.d.ts +1 -0
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +543 -444
- 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/parser.d.ts +7 -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/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 +454 -316
- 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 +452 -317
- 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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-owned storage: the contract a host application implements to take over where an embedded
|
|
3
|
+
* editor reads, saves and keeps recovery copies of its document.
|
|
4
|
+
*
|
|
5
|
+
* Every product element (`<docx-editor>`, `<xlsx-editor>`, `<visio-viewer>` and the PowerPoint
|
|
6
|
+
* viewer of each binding) accepts a {@link DocumentStorage} as its `storage` property. When it is
|
|
7
|
+
* set, File > Save hands the saved bytes to {@link DocumentStorage.save} instead of downloading
|
|
8
|
+
* them, File > Open asks {@link DocumentStorage.open} instead of showing the browser's file picker,
|
|
9
|
+
* and an editor with AutoRecover (PowerPoint, Visio) keeps its recovery copies through the
|
|
10
|
+
* recovery methods instead of the library's own IndexedDB database. The cancelable
|
|
11
|
+
* `file-command` event still fires first: a host that prevents it handles the command itself and
|
|
12
|
+
* the storage is not called.
|
|
13
|
+
*
|
|
14
|
+
* DOM-free and format-neutral: the editors only pass bytes, a file name and a reason.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* A command of the File backstage, title bar or a shortcut, announced as the cancelable
|
|
18
|
+
* `file-command` event before the editor runs its default. Each product raises the subset it has
|
|
19
|
+
* (see {@link WordFileCommand}, {@link ExcelFileCommand}, {@link VisioFileCommand}).
|
|
20
|
+
*/
|
|
21
|
+
export type FileCommand = 'new' | 'open' | 'save' | 'saveAs' | 'export' | 'exportText' | 'exportCsv' | 'print' | 'share';
|
|
22
|
+
/** The File commands `<docx-editor>` announces. */
|
|
23
|
+
export type WordFileCommand = Exclude<FileCommand, 'exportCsv'>;
|
|
24
|
+
/** The File commands `<xlsx-editor>` announces. */
|
|
25
|
+
export type ExcelFileCommand = Exclude<FileCommand, 'exportText' | 'share'>;
|
|
26
|
+
/** The File commands `<visio-viewer>` announces. */
|
|
27
|
+
export type VisioFileCommand = Extract<FileCommand, 'new' | 'open' | 'save'>;
|
|
28
|
+
/** The detail of a `file-command` event. */
|
|
29
|
+
export interface FileCommandDetail<C extends string = FileCommand> {
|
|
30
|
+
command: C;
|
|
31
|
+
/** Save As and the exports: the name the user chose, when there is one. */
|
|
32
|
+
fileName?: string;
|
|
33
|
+
}
|
|
34
|
+
/** The event name every editor uses for {@link FileCommandDetail}. */
|
|
35
|
+
export declare const FILE_COMMAND_EVENT = "file-command";
|
|
36
|
+
/** Builds a {@link FileCommandDetail}, leaving `fileName` out rather than undefined. */
|
|
37
|
+
export declare function fileCommandDetail<C extends string>(command: C, fileName?: string): FileCommandDetail<C>;
|
|
38
|
+
/** Why an editor is saving: File > Save (or the Quick Access button, or Ctrl+S) or Save As. */
|
|
39
|
+
export type DocumentSaveReason = 'save' | 'saveAs';
|
|
40
|
+
/** What an editor tells the host about the bytes it hands to {@link DocumentStorage.save}. */
|
|
41
|
+
export interface DocumentSaveMeta {
|
|
42
|
+
/** The file name the editor would download as, extension included (`Report.docx`). */
|
|
43
|
+
fileName: string;
|
|
44
|
+
/** The MIME type of the bytes. */
|
|
45
|
+
mimeType: string;
|
|
46
|
+
reason: DocumentSaveReason;
|
|
47
|
+
}
|
|
48
|
+
/** What {@link DocumentStorage.save} may report back. */
|
|
49
|
+
export interface DocumentSaveResult {
|
|
50
|
+
/** The name the document now has, when the host chose another (a Save As dialog of its own). */
|
|
51
|
+
fileName?: string;
|
|
52
|
+
}
|
|
53
|
+
/** A document the host opened for the editor. */
|
|
54
|
+
export interface DocumentOpenResult {
|
|
55
|
+
bytes: Uint8Array;
|
|
56
|
+
fileName: string;
|
|
57
|
+
}
|
|
58
|
+
/** A recovery copy of a document with unsaved changes. */
|
|
59
|
+
export interface DocumentRecoveryEntry {
|
|
60
|
+
/** The document id it is kept under (the editors use the file name or the host's file path). */
|
|
61
|
+
id: string;
|
|
62
|
+
/** When it was written, in milliseconds since the epoch. */
|
|
63
|
+
savedAt: number;
|
|
64
|
+
bytes: Uint8Array;
|
|
65
|
+
}
|
|
66
|
+
/** A recovery copy without its bytes, as {@link DocumentStorage.listRecovery} returns it. */
|
|
67
|
+
export interface DocumentRecoveryInfo {
|
|
68
|
+
id: string;
|
|
69
|
+
savedAt: number;
|
|
70
|
+
/** Size of the copy in bytes. */
|
|
71
|
+
size: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Storage a host supplies to an editor. Only {@link save} is required; each optional method the
|
|
75
|
+
* host leaves out keeps the editor's own behaviour for it (the browser file picker for Open, the
|
|
76
|
+
* library's IndexedDB for recovery copies). The recovery methods are used together: a host
|
|
77
|
+
* provides `readRecovery`, `writeRecovery` and `clearRecovery`, or none of them.
|
|
78
|
+
*
|
|
79
|
+
* Every method may reject; the editor reports a failed save as an error and treats a failed
|
|
80
|
+
* recovery read or write as "no copy kept".
|
|
81
|
+
*/
|
|
82
|
+
export interface DocumentStorage {
|
|
83
|
+
/** Store the saved document. Resolve once it is stored; reject to report the save as failed. */
|
|
84
|
+
save(bytes: Uint8Array, meta: DocumentSaveMeta): Promise<DocumentSaveResult | void>;
|
|
85
|
+
/** File > Open: resolve with the document to open, or undefined when the user canceled. */
|
|
86
|
+
open?(): Promise<DocumentOpenResult | undefined>;
|
|
87
|
+
/** The recovery copy kept under `id`, if any. */
|
|
88
|
+
readRecovery?(id: string): Promise<DocumentRecoveryEntry | undefined>;
|
|
89
|
+
/** Keep `entry` as the recovery copy of its id, replacing an earlier one. */
|
|
90
|
+
writeRecovery?(entry: DocumentRecoveryEntry): Promise<void>;
|
|
91
|
+
/** Remove the recovery copy kept under `id` (the document was saved or the copy discarded). */
|
|
92
|
+
clearRecovery?(id: string): Promise<void>;
|
|
93
|
+
/** Every kept recovery copy, for a version-history or recovery list. Optional even then. */
|
|
94
|
+
listRecovery?(): Promise<DocumentRecoveryInfo[]>;
|
|
95
|
+
}
|
|
96
|
+
/** The recovery methods of a storage that provides all three of them. */
|
|
97
|
+
export type DocumentRecoveryStore = Required<Pick<DocumentStorage, 'readRecovery' | 'writeRecovery' | 'clearRecovery'>> & Pick<DocumentStorage, 'listRecovery'>;
|
|
98
|
+
/** The storage's recovery store, or undefined when it does not provide one (use the default). */
|
|
99
|
+
export declare function recoveryStoreOf(storage: DocumentStorage | null | undefined): DocumentRecoveryStore | undefined;
|
|
100
|
+
/** True when `value` has the shape of a {@link DocumentStorage} (a `save` function). */
|
|
101
|
+
export declare function isDocumentStorage(value: unknown): value is DocumentStorage;
|
|
102
|
+
/** The MIME type of an Office file name by its extension; `application/octet-stream` otherwise. */
|
|
103
|
+
export declare function documentMimeType(fileName: string): string;
|
|
104
|
+
/** The {@link DocumentSaveMeta} for saving `fileName`, its MIME type taken from the extension. */
|
|
105
|
+
export declare function documentSaveMeta(fileName: string, reason?: DocumentSaveReason, mimeType?: string): DocumentSaveMeta;
|
|
106
|
+
/**
|
|
107
|
+
* Hands `bytes` to the storage and returns the file name the document has afterwards: the one the
|
|
108
|
+
* host reported, else `meta.fileName`. Rejects when the storage does.
|
|
109
|
+
*/
|
|
110
|
+
export declare function saveToStorage(storage: DocumentStorage, bytes: Uint8Array, meta: DocumentSaveMeta): Promise<string>;
|
|
111
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../embedding/storage.ts"],"names":[],"mappings":"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"}
|
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 };
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixups.d.ts","sourceRoot":"","sources":["../../../visio/collab/fixups.ts"],"names":[],"mappings":"
|
|
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"}
|