ooxml-core 1.23.0 → 1.24.1
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 -2
- package/dist/{PptxHandler-FSKKPZZC.mjs → PptxHandler-5TWAQWPK.mjs} +2 -2
- package/dist/{PptxHandler-H7MEWJJJ.mjs → PptxHandler-KBJ4TN3T.mjs} +1 -1
- package/dist/{PptxHandler-DNSXWTQV.cjs → PptxHandler-KFEE7O7W.cjs} +2 -2
- package/dist/{PresentationBuilder-7TSENZTX.mjs → PresentationBuilder-SCT5AQBP.mjs} +1 -1
- package/dist/{PresentationBuilder-RIJWQSEU.mjs → PresentationBuilder-SVHIKT4C.mjs} +2 -2
- package/dist/{PresentationBuilder-A5NI35VN.cjs → PresentationBuilder-SXLRXYDI.cjs} +4 -4
- 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/{chunk-4QPOJCJG.mjs → chunk-7N7C5BNM.mjs} +1 -1
- package/dist/{chunk-DLFMCZZT.mjs → chunk-CWCDFPKN.mjs} +1 -1
- package/dist/{chunk-LF5E5ZOH.mjs → chunk-GVP262WE.mjs} +25 -62
- package/dist/{chunk-VQF6HQEE.mjs → chunk-KVKTHGIY.mjs} +1 -1
- package/dist/{chunk-BA7Z6ATM.mjs → chunk-NE7626A4.mjs} +4 -4
- package/dist/{chunk-Q5PKBQXH.mjs → chunk-ON7XVRHQ.mjs} +26 -63
- package/dist/{chunk-HL3FBJ6X.cjs → chunk-XK55DEUD.cjs} +25 -62
- 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/pptx/automation/index.cjs +25 -67
- package/dist/pptx/automation/index.d.ts +3 -2
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-Q5mM8kIR.d.ts → index-4FmgJajb.d.ts} +3 -2
- package/dist/pptx/chunks/index-4FmgJajb.d.ts.map +1 -0
- package/dist/pptx/chunks/index-C3xhAMSa.d.ts +837 -0
- package/dist/pptx/chunks/index-C3xhAMSa.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CPhsd7Df.d.ts → index-nKQ4s7FA.d.ts} +24 -834
- package/dist/pptx/chunks/index-nKQ4s7FA.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +25 -67
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.d.ts +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/index.cjs +25 -67
- package/dist/pptx/index.d.ts +4 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.cjs +40 -0
- package/dist/pptx/node/index.d.ts +13 -0
- package/dist/pptx/node/index.d.ts.map +1 -0
- package/dist/pptx/node/index.mjs +40 -0
- 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 +11 -1
- package/dist/pptx/chunks/index-CPhsd7Df.d.ts.map +0 -1
- package/dist/pptx/chunks/index-Q5mM8kIR.d.ts.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Word's half of the shared customization contract (`ooxml-core/embedding`): the capabilities
|
|
3
|
+
* `<docx-editor>` honours and what each one removes. DOM-free, so a host or a binding can read
|
|
4
|
+
* it without loading the editor.
|
|
5
|
+
*/
|
|
6
|
+
import type { CapabilityActionMap, EditorCapabilities, EditorCapabilityId } from '../../embedding/index.js';
|
|
7
|
+
import type { RibbonActionId } from './ribbon-action-ids.js';
|
|
8
|
+
/** The capabilities Word honours. */
|
|
9
|
+
export type WordCapabilityId = Extract<EditorCapabilityId, 'edit' | 'export' | 'print' | 'share' | 'copy' | 'comment' | 'review' | 'find' | 'open' | 'save' | 'settings'>;
|
|
10
|
+
/** Every Word capability, for hosts that build a policy screen. */
|
|
11
|
+
export declare const WORD_CAPABILITY_IDS: readonly ["edit", "export", "print", "share", "copy", "comment", "review", "find", "open", "save", "settings"];
|
|
12
|
+
/** Per-capability switches of `<docx-editor>`. */
|
|
13
|
+
export type WordCapabilities = EditorCapabilities<WordCapabilityId>;
|
|
14
|
+
/** The ribbon controls (`hiddenActions` ids) each disabled capability removes. */
|
|
15
|
+
export declare const WORD_CAPABILITY_ACTIONS: CapabilityActionMap<WordCapabilityId, RibbonActionId>;
|
|
16
|
+
/** A File command (title bar, File tab, shortcut) that a capability can remove. */
|
|
17
|
+
export type WordFileCommandId = 'new' | 'open' | 'save' | 'saveAs' | 'export' | 'exportText' | 'print' | 'share';
|
|
18
|
+
/** The File commands each disabled capability removes (and refuses to run). */
|
|
19
|
+
export declare const WORD_CAPABILITY_FILE_COMMANDS: CapabilityActionMap<WordCapabilityId, WordFileCommandId>;
|
|
20
|
+
/** A File tab navigation entry a capability can remove. */
|
|
21
|
+
export type WordBackstagePageId = 'new' | 'open' | 'save' | 'saveAs' | 'print' | 'export' | 'options';
|
|
22
|
+
/** The File tab entries each disabled capability removes. */
|
|
23
|
+
export declare const WORD_CAPABILITY_BACKSTAGE_PAGES: CapabilityActionMap<WordCapabilityId, WordBackstagePageId>;
|
|
24
|
+
/** A built-in keyboard shortcut a capability can turn off. */
|
|
25
|
+
export type WordShortcutId = 'find' | 'replace' | 'save' | 'print';
|
|
26
|
+
/** The shortcuts each disabled capability turns off. */
|
|
27
|
+
export declare const WORD_CAPABILITY_SHORTCUTS: CapabilityActionMap<WordCapabilityId, WordShortcutId>;
|
|
28
|
+
/** The built-in context-menu entries each disabled capability removes. */
|
|
29
|
+
export declare const WORD_CAPABILITY_MENU_ITEMS: CapabilityActionMap<WordCapabilityId, string>;
|
|
30
|
+
//# sourceMappingURL=customization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customization.d.ts","sourceRoot":"","sources":["../../../docx/ui/customization.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACX,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CA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 -15259,6 +15259,51 @@ function createToggleFormat(schema, getModel = () => void 0) {
|
|
|
15259
15259
|
};
|
|
15260
15260
|
}
|
|
15261
15261
|
|
|
15262
|
+
// docx/ui/customization.ts
|
|
15263
|
+
var WORD_CAPABILITY_IDS = [
|
|
15264
|
+
"edit",
|
|
15265
|
+
"export",
|
|
15266
|
+
"print",
|
|
15267
|
+
"share",
|
|
15268
|
+
"copy",
|
|
15269
|
+
"comment",
|
|
15270
|
+
"review",
|
|
15271
|
+
"find",
|
|
15272
|
+
"open",
|
|
15273
|
+
"save",
|
|
15274
|
+
"settings"
|
|
15275
|
+
];
|
|
15276
|
+
var WORD_CAPABILITY_ACTIONS = {
|
|
15277
|
+
print: ["print"],
|
|
15278
|
+
copy: ["cut", "copy"],
|
|
15279
|
+
comment: ["add-comment", "delete-comment", "previous-comment", "next-comment", "comments"],
|
|
15280
|
+
review: ["track-changes", "tracking-options", "accept", "reject", "accept-all", "reject-all"],
|
|
15281
|
+
find: ["find-and-replace", "replace", "find-options"]
|
|
15282
|
+
};
|
|
15283
|
+
var WORD_CAPABILITY_FILE_COMMANDS = {
|
|
15284
|
+
open: ["new", "open"],
|
|
15285
|
+
save: ["save"],
|
|
15286
|
+
export: ["saveAs", "export", "exportText"],
|
|
15287
|
+
print: ["print"],
|
|
15288
|
+
share: ["share"]
|
|
15289
|
+
};
|
|
15290
|
+
var WORD_CAPABILITY_BACKSTAGE_PAGES = {
|
|
15291
|
+
open: ["new", "open"],
|
|
15292
|
+
save: ["save"],
|
|
15293
|
+
export: ["saveAs", "export"],
|
|
15294
|
+
print: ["print"],
|
|
15295
|
+
settings: ["options"]
|
|
15296
|
+
};
|
|
15297
|
+
var WORD_CAPABILITY_SHORTCUTS = {
|
|
15298
|
+
find: ["find", "replace"],
|
|
15299
|
+
save: ["save"],
|
|
15300
|
+
print: ["print"]
|
|
15301
|
+
};
|
|
15302
|
+
var WORD_CAPABILITY_MENU_ITEMS = {
|
|
15303
|
+
copy: ["cut", "copy"],
|
|
15304
|
+
comment: ["comment-add"]
|
|
15305
|
+
};
|
|
15306
|
+
|
|
15262
15307
|
// docx/ui/ribbon-action-ids.ts
|
|
15263
15308
|
var RIBBON_ACTION_IDS = [
|
|
15264
15309
|
"paste",
|
|
@@ -16514,6 +16559,12 @@ exports.RIBBON_ACTION_IDS = RIBBON_ACTION_IDS;
|
|
|
16514
16559
|
exports.RIBBON_ACTION_LABELS = RIBBON_ACTION_LABELS;
|
|
16515
16560
|
exports.SectionPartsStep = SectionPartsStep;
|
|
16516
16561
|
exports.THEME_KEYS = THEME_KEYS;
|
|
16562
|
+
exports.WORD_CAPABILITY_ACTIONS = WORD_CAPABILITY_ACTIONS;
|
|
16563
|
+
exports.WORD_CAPABILITY_BACKSTAGE_PAGES = WORD_CAPABILITY_BACKSTAGE_PAGES;
|
|
16564
|
+
exports.WORD_CAPABILITY_FILE_COMMANDS = WORD_CAPABILITY_FILE_COMMANDS;
|
|
16565
|
+
exports.WORD_CAPABILITY_IDS = WORD_CAPABILITY_IDS;
|
|
16566
|
+
exports.WORD_CAPABILITY_MENU_ITEMS = WORD_CAPABILITY_MENU_ITEMS;
|
|
16567
|
+
exports.WORD_CAPABILITY_SHORTCUTS = WORD_CAPABILITY_SHORTCUTS;
|
|
16517
16568
|
exports.WordYjsCollaboration = WordYjsCollaboration;
|
|
16518
16569
|
exports.WordYjsComments = WordYjsComments;
|
|
16519
16570
|
exports.WordYjsMedia = WordYjsMedia;
|
package/dist/docx/ui/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export { formattingRevision } from './review-formatting.js';
|
|
|
35
35
|
export { paragraphFormattingRevision } from './review-paragraph-formatting.js';
|
|
36
36
|
export * from './track-changes-mode.js';
|
|
37
37
|
export * from './toggle-format.js';
|
|
38
|
+
export * from './customization.js';
|
|
38
39
|
export * from './ribbon-action-ids.js';
|
|
39
40
|
export * from './ribbon-colors.js';
|
|
40
41
|
export * from './ribbon-legacy-labels.js';
|
|
@@ -1 +1 @@
|
|
|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AoB,CAAC"}
|
package/dist/docx/ui/index.mjs
CHANGED
|
@@ -15237,6 +15237,51 @@ function createToggleFormat(schema, getModel = () => void 0) {
|
|
|
15237
15237
|
};
|
|
15238
15238
|
}
|
|
15239
15239
|
|
|
15240
|
+
// docx/ui/customization.ts
|
|
15241
|
+
var WORD_CAPABILITY_IDS = [
|
|
15242
|
+
"edit",
|
|
15243
|
+
"export",
|
|
15244
|
+
"print",
|
|
15245
|
+
"share",
|
|
15246
|
+
"copy",
|
|
15247
|
+
"comment",
|
|
15248
|
+
"review",
|
|
15249
|
+
"find",
|
|
15250
|
+
"open",
|
|
15251
|
+
"save",
|
|
15252
|
+
"settings"
|
|
15253
|
+
];
|
|
15254
|
+
var WORD_CAPABILITY_ACTIONS = {
|
|
15255
|
+
print: ["print"],
|
|
15256
|
+
copy: ["cut", "copy"],
|
|
15257
|
+
comment: ["add-comment", "delete-comment", "previous-comment", "next-comment", "comments"],
|
|
15258
|
+
review: ["track-changes", "tracking-options", "accept", "reject", "accept-all", "reject-all"],
|
|
15259
|
+
find: ["find-and-replace", "replace", "find-options"]
|
|
15260
|
+
};
|
|
15261
|
+
var WORD_CAPABILITY_FILE_COMMANDS = {
|
|
15262
|
+
open: ["new", "open"],
|
|
15263
|
+
save: ["save"],
|
|
15264
|
+
export: ["saveAs", "export", "exportText"],
|
|
15265
|
+
print: ["print"],
|
|
15266
|
+
share: ["share"]
|
|
15267
|
+
};
|
|
15268
|
+
var WORD_CAPABILITY_BACKSTAGE_PAGES = {
|
|
15269
|
+
open: ["new", "open"],
|
|
15270
|
+
save: ["save"],
|
|
15271
|
+
export: ["saveAs", "export"],
|
|
15272
|
+
print: ["print"],
|
|
15273
|
+
settings: ["options"]
|
|
15274
|
+
};
|
|
15275
|
+
var WORD_CAPABILITY_SHORTCUTS = {
|
|
15276
|
+
find: ["find", "replace"],
|
|
15277
|
+
save: ["save"],
|
|
15278
|
+
print: ["print"]
|
|
15279
|
+
};
|
|
15280
|
+
var WORD_CAPABILITY_MENU_ITEMS = {
|
|
15281
|
+
copy: ["cut", "copy"],
|
|
15282
|
+
comment: ["comment-add"]
|
|
15283
|
+
};
|
|
15284
|
+
|
|
15240
15285
|
// docx/ui/ribbon-action-ids.ts
|
|
15241
15286
|
var RIBBON_ACTION_IDS = [
|
|
15242
15287
|
"paste",
|
|
@@ -16476,4 +16521,4 @@ function formFieldGuardPlugin(protection) {
|
|
|
16476
16521
|
});
|
|
16477
16522
|
}
|
|
16478
16523
|
|
|
16479
|
-
export { CONTROL_EDIT_META, CollaborationAuthority, CollaborationClient, DirtyState, EDITOR_THEME_MODES, FIELD_RESULT_REPAIR_META, FORM_FIELD_EDIT_META, HEADER_FOOTER_INPUT, NotePartsStep, PAGE_GAP, PARAGRAPH_KEEP_KEYS, REMOTE_TRANSACTION_META, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, SectionPartsStep, THEME_KEYS, WordYjsCollaboration, WordYjsComments, WordYjsMedia, acceptAllChanges, acceptChangeAtCursor, acceptRevisionRange, addComment, appendInlineNode, applyMarkFormatting, applyRunFormattingPatch, applyThemeColors, applyWordLink, authorColor, backstageFocus, chartNodeSpec, chooseDate, chooseListItem, clearDirectRunFormatting, collectRevisionRanges, commentAnchors, commentHistoryAttributes, commentIdsAtSelection, commentIdsFromMarks, commentIdsFromNode, commentThreadsFromDoc, contentControlPlugin, controlAt, controlAtSelection, controlFromData, controlFromValue, controlOfMark, controlSpans, countWords, createCollaborationIdGenerator, createToggleFormat, cssBorderSide, darkTheme, deleteAroundMarkers, deleteComment, deleteFieldSelection, deleteToPlaceholder, dispatchIsolatedCommand, documentWordCount, emptySimpleFieldResult, everyControlSpan, exceedsFormTextLength, expectDefined, explicitOffFields, extraRunFields, extraRunProperties, fieldGuardPlugin, fieldMarkerNodeSpec, fieldResultRanges, fieldsBalanced, fitZoomPercent, formFieldBeside, formFieldGuardPlugin, formFieldLocked, formFieldNodeDisplay, formFieldOfNode, formTextResults, formattingRevision, freezeBatch, goToComment, goToNextChange, goToPreviousChange, hardBreakNodeSpec, hasAnyChange, hasChangeAtCursor, hasNoteRevisions, imageNodeSpec, inlineNodeRun, insertContentControl, insertWordHardBreak, insertedTextMarks, isFormsProtected, isNavigableHref, isRibbonActionId, isWordYjsRemoteTransaction, ligatureCss, ligatureStyle, lightTheme, linkFromMarks, linkMarkSpec, markSpecs, marksForRun, moveName, newControlId, nodeChart, nodeNumbering, normalizeRibbonActions, normalizeThemeMode, notePartsJson, noteReferenceNodeSpec, operatesFormField, pageBreakNodeSpec, paragraphAttrs, paragraphBoxCss, paragraphFormattingRevision, paragraphFromAttrs, parseBatch, parseBordersJson, pasteInCell, placementClass, positionalTabInputPlugin, refreshWordYjsPresence, rejectAllChanges, rejectChangeAtCursor, rejectRevisionRange, removeCommentAnchor, removeCommentThread, removeWordLink, repairCollaborativeDocumentIds, repairCollaborativeParagraphIds, replaceAroundMarkers, replaceControlContent, replyToComment, resolveCellVisuals, resolveComment, resolveNoteRevisions, restoreNoteParts, restoreSectionParts, reviewMarks, ribbonActionIdForLabel, runPropertiesMark, runToInlineNodes, sameJson2 as sameJson, sameRuns, sectionPartsJson, selectFormDropDownAt, setCommentThreads, setReviewRecordingPreferences, staysInFormFields, svgMarkupSpec, swatchColor, symbolFontPlugin, tableCellStyle, tableControlSpans, tableStructureGuardPlugin, tableStyle, themeDrawing, themeToCssVars, toggleCheckboxControl, toggleFormCheckboxAt, toggleTrackChanges, toggleTrackFormatting, toggleTrackMoves, trackChangesPlugin, trackChangesPluginKey, typeOverPlaceholder, updateCommentThreads, updateControlProperties, violatesControlLock, wordHighlightColors, wordLinkRangeAt, wordYjsPluginKey, wordYjsPresencePlugin, wordYjsRedo, wordYjsUndo };
|
|
16524
|
+
export { CONTROL_EDIT_META, CollaborationAuthority, CollaborationClient, DirtyState, EDITOR_THEME_MODES, FIELD_RESULT_REPAIR_META, FORM_FIELD_EDIT_META, HEADER_FOOTER_INPUT, NotePartsStep, PAGE_GAP, PARAGRAPH_KEEP_KEYS, REMOTE_TRANSACTION_META, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, SectionPartsStep, THEME_KEYS, WORD_CAPABILITY_ACTIONS, WORD_CAPABILITY_BACKSTAGE_PAGES, WORD_CAPABILITY_FILE_COMMANDS, WORD_CAPABILITY_IDS, WORD_CAPABILITY_MENU_ITEMS, WORD_CAPABILITY_SHORTCUTS, WordYjsCollaboration, WordYjsComments, WordYjsMedia, acceptAllChanges, acceptChangeAtCursor, acceptRevisionRange, addComment, appendInlineNode, applyMarkFormatting, applyRunFormattingPatch, applyThemeColors, applyWordLink, authorColor, backstageFocus, chartNodeSpec, chooseDate, chooseListItem, clearDirectRunFormatting, collectRevisionRanges, commentAnchors, commentHistoryAttributes, commentIdsAtSelection, commentIdsFromMarks, commentIdsFromNode, commentThreadsFromDoc, contentControlPlugin, controlAt, controlAtSelection, controlFromData, controlFromValue, controlOfMark, controlSpans, countWords, createCollaborationIdGenerator, createToggleFormat, cssBorderSide, darkTheme, deleteAroundMarkers, deleteComment, deleteFieldSelection, deleteToPlaceholder, dispatchIsolatedCommand, documentWordCount, emptySimpleFieldResult, everyControlSpan, exceedsFormTextLength, expectDefined, explicitOffFields, extraRunFields, extraRunProperties, fieldGuardPlugin, fieldMarkerNodeSpec, fieldResultRanges, fieldsBalanced, fitZoomPercent, formFieldBeside, formFieldGuardPlugin, formFieldLocked, formFieldNodeDisplay, formFieldOfNode, formTextResults, formattingRevision, freezeBatch, goToComment, goToNextChange, goToPreviousChange, hardBreakNodeSpec, hasAnyChange, hasChangeAtCursor, hasNoteRevisions, imageNodeSpec, inlineNodeRun, insertContentControl, insertWordHardBreak, insertedTextMarks, isFormsProtected, isNavigableHref, isRibbonActionId, isWordYjsRemoteTransaction, ligatureCss, ligatureStyle, lightTheme, linkFromMarks, linkMarkSpec, markSpecs, marksForRun, moveName, newControlId, nodeChart, nodeNumbering, normalizeRibbonActions, normalizeThemeMode, notePartsJson, noteReferenceNodeSpec, operatesFormField, pageBreakNodeSpec, paragraphAttrs, paragraphBoxCss, paragraphFormattingRevision, paragraphFromAttrs, parseBatch, parseBordersJson, pasteInCell, placementClass, positionalTabInputPlugin, refreshWordYjsPresence, rejectAllChanges, rejectChangeAtCursor, rejectRevisionRange, removeCommentAnchor, removeCommentThread, removeWordLink, repairCollaborativeDocumentIds, repairCollaborativeParagraphIds, replaceAroundMarkers, replaceControlContent, replyToComment, resolveCellVisuals, resolveComment, resolveNoteRevisions, restoreNoteParts, restoreSectionParts, reviewMarks, ribbonActionIdForLabel, runPropertiesMark, runToInlineNodes, sameJson2 as sameJson, sameRuns, sectionPartsJson, selectFormDropDownAt, setCommentThreads, setReviewRecordingPreferences, staysInFormFields, svgMarkupSpec, swatchColor, symbolFontPlugin, tableCellStyle, tableControlSpans, tableStructureGuardPlugin, tableStyle, themeDrawing, themeToCssVars, toggleCheckboxControl, toggleFormCheckboxAt, toggleTrackChanges, toggleTrackFormatting, toggleTrackMoves, trackChangesPlugin, trackChangesPluginKey, typeOverPlaceholder, updateCommentThreads, updateControlProperties, violatesControlLock, wordHighlightColors, wordLinkRangeAt, wordYjsPluginKey, wordYjsPresencePlugin, wordYjsRedo, wordYjsUndo };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host File tab (Backstage) pages: pages a host adds to an editor's File tab, after the
|
|
3
|
+
* built-in pages of their group. The page body is a host region (`backstage.host.<id>`), so it
|
|
4
|
+
* takes any renderer form of `HostRegionRenderer`; the navigation entry is plain data.
|
|
5
|
+
*/
|
|
6
|
+
/** Where a page's navigation entry sits: with the main pages, or next to Account and Options. */
|
|
7
|
+
export type HostBackstageGroup = 'main' | 'footer';
|
|
8
|
+
/**
|
|
9
|
+
* One host page of the File tab. `Renderer` is the product's region renderer type (a mount
|
|
10
|
+
* function over an `HTMLElement`, or a custom element), bound by each product.
|
|
11
|
+
*/
|
|
12
|
+
export interface HostBackstagePage<Renderer = unknown> {
|
|
13
|
+
/** Unique among host pages; the region id is `backstage.host.<id>`. A repeat is ignored. */
|
|
14
|
+
id: string;
|
|
15
|
+
/** The navigation label. The host localises it; the editor shows it as given. */
|
|
16
|
+
label: string;
|
|
17
|
+
/** `footer` places it next to Account and Options; default `main`. */
|
|
18
|
+
group?: HostBackstageGroup;
|
|
19
|
+
/**
|
|
20
|
+
* Sort key among the host pages of the same group (ascending, default 0). Host pages always
|
|
21
|
+
* come after the built-in pages of their group; equal keys keep the order they were given.
|
|
22
|
+
*/
|
|
23
|
+
order?: number;
|
|
24
|
+
/** The page body. */
|
|
25
|
+
render: Renderer;
|
|
26
|
+
}
|
|
27
|
+
/** The nav id of host page `id`, kept apart from every built-in page id. */
|
|
28
|
+
export declare function hostBackstageItemId(id: string): `host.${string}`;
|
|
29
|
+
/** The host page id of a nav id made by `hostBackstageItemId`, or undefined for a built-in. */
|
|
30
|
+
export declare function hostBackstagePageId(itemId: string): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The host pages an editor shows, in display order: pages with an empty or repeated id are left
|
|
33
|
+
* out (the first one wins), then the rest sort by `order` (stable, so equal keys keep the host's
|
|
34
|
+
* order).
|
|
35
|
+
*/
|
|
36
|
+
export declare function acceptedHostBackstagePages<P extends HostBackstagePage<unknown>>(pages: readonly P[] | null | undefined): P[];
|
|
37
|
+
/** A nav entry with an optional group: what `placeHostBackstagePages` interleaves. */
|
|
38
|
+
export interface BackstageNavSlot {
|
|
39
|
+
id: string;
|
|
40
|
+
group?: HostBackstageGroup | undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The File tab navigation with host pages placed: each host entry goes after the last built-in
|
|
44
|
+
* entry of its group (at the end when its group has none). `toEntry` makes the product's nav
|
|
45
|
+
* entry for a page; `items` is not changed.
|
|
46
|
+
*/
|
|
47
|
+
export declare function placeHostBackstagePages<T extends BackstageNavSlot, P extends HostBackstagePage<unknown>>(items: readonly T[], pages: readonly P[] | null | undefined, toEntry: (page: P) => T): T[];
|
|
48
|
+
//# sourceMappingURL=backstage.d.ts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K,CAAC,GAAG,CAAC,EAAE,CAS3F"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capabilities: what a host lets its users do in an embedded editor, one switch per capability.
|
|
3
|
+
*
|
|
4
|
+
* Each product supports a subset of the shared ids below (and may add its own, such as
|
|
5
|
+
* PowerPoint's `present`), so a product's capability type is a narrow union and a host that
|
|
6
|
+
* names an id the product does not honour gets a compile error rather than a silent no-op.
|
|
7
|
+
* `false` removes every UI path to the capability (ribbon controls, Backstage pages, menu
|
|
8
|
+
* entries, shortcuts); `true` or an omitted key leaves the editor's own rules in charge.
|
|
9
|
+
*
|
|
10
|
+
* Capabilities are UI policy, not document protection: a host that must prevent copying or
|
|
11
|
+
* export should not hand the bytes to the browser.
|
|
12
|
+
*/
|
|
13
|
+
/** Capability ids every editor understands the same way. A product honours a subset. */
|
|
14
|
+
export declare const EDITOR_CAPABILITY_IDS: readonly [
|
|
15
|
+
/** Changing the document. `false` opens it read-only, whatever the edit prop says. */
|
|
16
|
+
'edit',
|
|
17
|
+
/** Saving a copy in another format (File > Export, Save As, Download). */
|
|
18
|
+
'export',
|
|
19
|
+
/** Printing (File > Print, the Print commands and Ctrl+P). */
|
|
20
|
+
'print',
|
|
21
|
+
/** Sharing the document with other people (File > Share, Share buttons). */
|
|
22
|
+
'share',
|
|
23
|
+
/** Copying content out (Copy, Cut and their shortcuts). */
|
|
24
|
+
'copy',
|
|
25
|
+
/** Adding and editing comments. */
|
|
26
|
+
'comment',
|
|
27
|
+
/** Tracked changes: turning tracking on, accepting and rejecting. */
|
|
28
|
+
'review',
|
|
29
|
+
/** Find and Replace. */
|
|
30
|
+
'find',
|
|
31
|
+
/** File > New and File > Open. */
|
|
32
|
+
'open',
|
|
33
|
+
/** File > Save. */
|
|
34
|
+
'save',
|
|
35
|
+
/** File > Options and Customize Ribbon. */
|
|
36
|
+
'settings'];
|
|
37
|
+
/** One shared capability id. */
|
|
38
|
+
export type EditorCapabilityId = (typeof EDITOR_CAPABILITY_IDS)[number];
|
|
39
|
+
/**
|
|
40
|
+
* Per-capability switches for a product whose capability ids are `Id` (a subset of
|
|
41
|
+
* `EditorCapabilityId`, optionally widened with product ids).
|
|
42
|
+
*/
|
|
43
|
+
export type EditorCapabilities<Id extends string = EditorCapabilityId> = Partial<Record<Id, boolean>>;
|
|
44
|
+
/** True unless the host switched `id` off (`false`); an omitted key is enabled. */
|
|
45
|
+
export declare function isCapabilityEnabled<Id extends string>(capabilities: EditorCapabilities<Id> | null | undefined, id: NoInfer<Id>): boolean;
|
|
46
|
+
/** The ids the host switched off, in the order they were given. */
|
|
47
|
+
export declare function disabledCapabilities<Id extends string>(capabilities: EditorCapabilities<Id> | null | undefined): Id[];
|
|
48
|
+
/**
|
|
49
|
+
* What each capability removes in one product: the product's own action ids (ribbon controls,
|
|
50
|
+
* menu entries, Backstage pages, shortcuts), keyed by capability.
|
|
51
|
+
*/
|
|
52
|
+
export type CapabilityActionMap<Id extends string, Action extends string> = Readonly<Partial<Record<Id, readonly Action[]>>>;
|
|
53
|
+
/** Every action a disabled capability removes, deduplicated, in map order. */
|
|
54
|
+
export declare function capabilityHiddenActions<Id extends string, Action extends string>(capabilities: EditorCapabilities<Id> | null | undefined, map: CapabilityActionMap<Id, Action>): Action[];
|
|
55
|
+
/**
|
|
56
|
+
* The union of several hidden-action lists (the legacy `hiddenActions` prop, the ids disabled
|
|
57
|
+
* capabilities remove, the user's own Customize Ribbon choices), deduplicated in first-seen order.
|
|
58
|
+
*/
|
|
59
|
+
export declare function mergeHiddenActions<Action extends string>(...lists: ReadonlyArray<readonly Action[] | null | undefined>): Action[];
|
|
60
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../embedding/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,wFAAwF;AACxF,eAAO,MAAM,qBAAqB;AACjC,sFAAsF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mB,CAAC,EAAE,EAAE,MAAM,CAAC,GAClC,MAAM,EAAE,CAKV;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,SAAS,MAAM,EACvD,GAAG,KAAK,EAAE,aAAa,CAAC,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC,GAC3D,MAAM,EAAE,CAIV"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared shape of an editor's `customization` object. A host describes what its users see
|
|
3
|
+
* and may do in ONE plain object; every product (Word, Excel, PowerPoint, Visio) accepts the
|
|
4
|
+
* same sections through its element property and every framework binding forwards it as one
|
|
5
|
+
* prop. Every field is optional and every list defaults to "hide nothing", so an empty object
|
|
6
|
+
* (or none) is exactly the editor's default behaviour.
|
|
7
|
+
*
|
|
8
|
+
* Products bind the type parameters: `Capability` to the ids they honour, `Renderer` to their
|
|
9
|
+
* region renderer, `MenuContext` to the snapshot their context menu passes to host commands.
|
|
10
|
+
* PowerPoint's `ViewerCustomization` is a superset of this shape.
|
|
11
|
+
*/
|
|
12
|
+
import type { HostBackstagePage } from './backstage.js';
|
|
13
|
+
import type { EditorCapabilities } from './capabilities.js';
|
|
14
|
+
import type { HostMenuCommand } from './menu-commands.js';
|
|
15
|
+
/** File tab (Backstage) customisation every product supports. */
|
|
16
|
+
export interface EditorBackstageCustomization<Renderer> {
|
|
17
|
+
/** Host pages added after the built-in pages of their group. */
|
|
18
|
+
extraPages?: readonly HostBackstagePage<Renderer>[];
|
|
19
|
+
}
|
|
20
|
+
/** Right-click menu customisation every product supports. */
|
|
21
|
+
export interface EditorContextMenuCustomization<MenuContext> {
|
|
22
|
+
/** Host commands added to the document (cell, shape) context menu. */
|
|
23
|
+
extraCommands?: readonly HostMenuCommand<MenuContext>[];
|
|
24
|
+
}
|
|
25
|
+
/** The customisation sections every editor shares. */
|
|
26
|
+
export interface EditorCustomization<Capability extends string, Renderer, MenuContext> {
|
|
27
|
+
/** What the user may do; `false` removes every UI path to the capability. */
|
|
28
|
+
capabilities?: EditorCapabilities<Capability>;
|
|
29
|
+
backstage?: EditorBackstageCustomization<Renderer>;
|
|
30
|
+
contextMenu?: EditorContextMenuCustomization<MenuContext>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=customization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customization.d.ts","sourceRoot":"","sources":["../../embedding/customization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,iEAAiE;AACjE,MAAM,WAAW,4BAA4B,CAAC,QAAQ;IACrD,gEAAgE;IAChE,UAAU,CAAC,EAAE,SAAS,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;CACpD;AAED,6DAA6D;AAC7D,MAAM,WAAW,8BAA8B,CAAC,WAAW;IAC1D,sEAAsE;IACtE,aAAa,CAAC,EAAE,SAAS,eAAe,CAAC,WAAW,CAAC,EAAE,CAAC;CACxD;AAED,sDAAsD;AACtD,MAAM,WAAW,mBAAmB,CAAC,UAAU,SAAS,MAAM,EAAE,QAAQ,EAAE,WAAW;IACpF,6EAA6E;IAC7E,YAAY,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC9C,SAAS,CAAC,EAAE,4BAA4B,CAAC,QAAQ,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,8BAA8B,CAAC,WAAW,CAAC,CAAC;CAC1D"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// embedding/storage.ts
|
|
4
|
+
var FILE_COMMAND_EVENT = "file-command";
|
|
5
|
+
function fileCommandDetail(command, fileName) {
|
|
6
|
+
return fileName === void 0 ? { command } : { command, fileName };
|
|
7
|
+
}
|
|
8
|
+
function recoveryStoreOf(storage) {
|
|
9
|
+
if (!storage?.readRecovery || !storage.writeRecovery || !storage.clearRecovery) return void 0;
|
|
10
|
+
return storage;
|
|
11
|
+
}
|
|
12
|
+
function isDocumentStorage(value) {
|
|
13
|
+
return typeof value === "object" && value !== null && typeof value.save === "function";
|
|
14
|
+
}
|
|
15
|
+
var MIME_TYPES = {
|
|
16
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
17
|
+
docm: "application/vnd.ms-word.document.macroEnabled.12",
|
|
18
|
+
dotx: "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
|
19
|
+
doc: "application/msword",
|
|
20
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
21
|
+
xlsm: "application/vnd.ms-excel.sheet.macroEnabled.12",
|
|
22
|
+
xltx: "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
|
23
|
+
xls: "application/vnd.ms-excel",
|
|
24
|
+
csv: "text/csv",
|
|
25
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
26
|
+
pptm: "application/vnd.ms-powerpoint.presentation.macroEnabled.12",
|
|
27
|
+
ppsx: "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
|
28
|
+
potx: "application/vnd.openxmlformats-officedocument.presentationml.template",
|
|
29
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
30
|
+
vsdx: "application/vnd.ms-visio.drawing",
|
|
31
|
+
vsdm: "application/vnd.ms-visio.drawing.macroEnabled.12",
|
|
32
|
+
vsd: "application/vnd.visio",
|
|
33
|
+
txt: "text/plain",
|
|
34
|
+
json: "application/json"
|
|
35
|
+
};
|
|
36
|
+
function documentMimeType(fileName) {
|
|
37
|
+
const extension = /\.([^./\\]+)$/.exec(fileName)?.[1]?.toLowerCase() ?? "";
|
|
38
|
+
return MIME_TYPES[extension] ?? "application/octet-stream";
|
|
39
|
+
}
|
|
40
|
+
function documentSaveMeta(fileName, reason = "save", mimeType = documentMimeType(fileName)) {
|
|
41
|
+
return { fileName, mimeType, reason };
|
|
42
|
+
}
|
|
43
|
+
async function saveToStorage(storage, bytes, meta) {
|
|
44
|
+
const result = await storage.save(bytes, meta);
|
|
45
|
+
const name = result?.fileName?.trim();
|
|
46
|
+
return name ? name : meta.fileName;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// embedding/backstage.ts
|
|
50
|
+
function hostBackstageItemId(id) {
|
|
51
|
+
return `host.${id}`;
|
|
52
|
+
}
|
|
53
|
+
function hostBackstagePageId(itemId) {
|
|
54
|
+
return itemId.startsWith("host.") ? itemId.slice(5) : void 0;
|
|
55
|
+
}
|
|
56
|
+
function acceptedHostBackstagePages(pages) {
|
|
57
|
+
const seen = /* @__PURE__ */ new Set();
|
|
58
|
+
const accepted = [];
|
|
59
|
+
for (const page of pages ?? []) {
|
|
60
|
+
if (!page || typeof page.id !== "string" || !page.id || seen.has(page.id)) continue;
|
|
61
|
+
seen.add(page.id);
|
|
62
|
+
accepted.push({ page, index: accepted.length });
|
|
63
|
+
}
|
|
64
|
+
return accepted.sort((a, b) => (a.page.order ?? 0) - (b.page.order ?? 0) || a.index - b.index).map(({ page }) => page);
|
|
65
|
+
}
|
|
66
|
+
function placeHostBackstagePages(items, pages, toEntry) {
|
|
67
|
+
const entries = [...items];
|
|
68
|
+
for (const page of acceptedHostBackstagePages(pages)) {
|
|
69
|
+
const group = page.group ?? "main";
|
|
70
|
+
let at = entries.length;
|
|
71
|
+
while (at > 0 && (entries[at - 1]?.group ?? "main") !== group) at--;
|
|
72
|
+
entries.splice(at === 0 ? entries.length : at, 0, toEntry(page));
|
|
73
|
+
}
|
|
74
|
+
return entries;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// embedding/capabilities.ts
|
|
78
|
+
var EDITOR_CAPABILITY_IDS = [
|
|
79
|
+
/** Changing the document. `false` opens it read-only, whatever the edit prop says. */
|
|
80
|
+
"edit",
|
|
81
|
+
/** Saving a copy in another format (File > Export, Save As, Download). */
|
|
82
|
+
"export",
|
|
83
|
+
/** Printing (File > Print, the Print commands and Ctrl+P). */
|
|
84
|
+
"print",
|
|
85
|
+
/** Sharing the document with other people (File > Share, Share buttons). */
|
|
86
|
+
"share",
|
|
87
|
+
/** Copying content out (Copy, Cut and their shortcuts). */
|
|
88
|
+
"copy",
|
|
89
|
+
/** Adding and editing comments. */
|
|
90
|
+
"comment",
|
|
91
|
+
/** Tracked changes: turning tracking on, accepting and rejecting. */
|
|
92
|
+
"review",
|
|
93
|
+
/** Find and Replace. */
|
|
94
|
+
"find",
|
|
95
|
+
/** File > New and File > Open. */
|
|
96
|
+
"open",
|
|
97
|
+
/** File > Save. */
|
|
98
|
+
"save",
|
|
99
|
+
/** File > Options and Customize Ribbon. */
|
|
100
|
+
"settings"
|
|
101
|
+
];
|
|
102
|
+
function isCapabilityEnabled(capabilities, id) {
|
|
103
|
+
return capabilities?.[id] !== false;
|
|
104
|
+
}
|
|
105
|
+
function disabledCapabilities(capabilities) {
|
|
106
|
+
if (!capabilities) return [];
|
|
107
|
+
return Object.keys(capabilities).filter((id) => capabilities[id] === false);
|
|
108
|
+
}
|
|
109
|
+
function capabilityHiddenActions(capabilities, map) {
|
|
110
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
111
|
+
for (const id of disabledCapabilities(capabilities))
|
|
112
|
+
for (const action of map[id] ?? []) hidden.add(action);
|
|
113
|
+
return [...hidden];
|
|
114
|
+
}
|
|
115
|
+
function mergeHiddenActions(...lists) {
|
|
116
|
+
const merged = /* @__PURE__ */ new Set();
|
|
117
|
+
for (const list of lists) for (const action of list ?? []) merged.add(action);
|
|
118
|
+
return [...merged];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// embedding/menu-commands.ts
|
|
122
|
+
function hostMenuEntryId(id) {
|
|
123
|
+
return `host:${id}`;
|
|
124
|
+
}
|
|
125
|
+
function isHostMenuEntry(entry) {
|
|
126
|
+
return typeof entry === "object" && entry !== null && entry.host === true;
|
|
127
|
+
}
|
|
128
|
+
function resolveHostMenuCommands(commands, context) {
|
|
129
|
+
const top = [];
|
|
130
|
+
const bottom = [];
|
|
131
|
+
const seen = /* @__PURE__ */ new Set();
|
|
132
|
+
for (const command of commands ?? []) {
|
|
133
|
+
if (!command?.id || seen.has(command.id)) continue;
|
|
134
|
+
seen.add(command.id);
|
|
135
|
+
if (command.when && !command.when(context)) continue;
|
|
136
|
+
const disabled = typeof command.disabled === "function" ? command.disabled(context) : command.disabled === true;
|
|
137
|
+
const entry = {
|
|
138
|
+
id: hostMenuEntryId(command.id),
|
|
139
|
+
host: true,
|
|
140
|
+
label: command.label,
|
|
141
|
+
labelKey: "",
|
|
142
|
+
disabled,
|
|
143
|
+
onSelect: () => {
|
|
144
|
+
if (!disabled) command.onSelect(context);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
if (command.icon) entry.icon = command.icon;
|
|
148
|
+
(command.group === "bottom" ? bottom : top).push(entry);
|
|
149
|
+
}
|
|
150
|
+
return { top, bottom };
|
|
151
|
+
}
|
|
152
|
+
function withHostMenuCommands(entries, commands, context) {
|
|
153
|
+
const { top, bottom } = resolveHostMenuCommands(commands, context);
|
|
154
|
+
const middle = entries.map(
|
|
155
|
+
(entry, index) => index === 0 ? { ...entry, separatorBefore: top.length > 0 } : entry
|
|
156
|
+
);
|
|
157
|
+
const first = bottom[0];
|
|
158
|
+
if (first && top.length + middle.length > 0) first.separatorBefore = true;
|
|
159
|
+
return [...top, ...middle, ...bottom];
|
|
160
|
+
}
|
|
161
|
+
function withoutHiddenEntries(entries, hidden) {
|
|
162
|
+
const kept = [];
|
|
163
|
+
let separator = false;
|
|
164
|
+
for (const entry of entries) {
|
|
165
|
+
separator ||= entry.separatorBefore === true;
|
|
166
|
+
if (hidden(entry)) continue;
|
|
167
|
+
const starts = separator && kept.length > 0;
|
|
168
|
+
kept.push(
|
|
169
|
+
entry.separatorBefore === true === starts ? entry : { ...entry, separatorBefore: starts }
|
|
170
|
+
);
|
|
171
|
+
separator = false;
|
|
172
|
+
}
|
|
173
|
+
return kept;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// embedding/regions.ts
|
|
177
|
+
function hostBackstageRegionId(id) {
|
|
178
|
+
return `backstage.host.${id}`;
|
|
179
|
+
}
|
|
180
|
+
function sameRenderer(a, b) {
|
|
181
|
+
if (a === b) return true;
|
|
182
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object" || a.element !== b.element)
|
|
183
|
+
return false;
|
|
184
|
+
const left = a.properties ?? {};
|
|
185
|
+
const right = b.properties ?? {};
|
|
186
|
+
const keys = Object.keys(left);
|
|
187
|
+
return keys.length === Object.keys(right).length && keys.every((key) => Object.is(left[key], right[key]));
|
|
188
|
+
}
|
|
189
|
+
function sameRegionContext(a, b, callbackKeys = /* @__PURE__ */ new Set(["close"])) {
|
|
190
|
+
const left = a;
|
|
191
|
+
const right = b;
|
|
192
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])) {
|
|
193
|
+
if (callbackKeys.has(key)) continue;
|
|
194
|
+
const x = left[key];
|
|
195
|
+
const y = right[key];
|
|
196
|
+
if (Array.isArray(x) && Array.isArray(y)) {
|
|
197
|
+
if (!sameItems(x, y)) return false;
|
|
198
|
+
} else if (!Object.is(x, y)) return false;
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
function sameItems(a, b) {
|
|
203
|
+
return a === b || a.length === b.length && a.every((item, index) => Object.is(item, b[index]));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
exports.EDITOR_CAPABILITY_IDS = EDITOR_CAPABILITY_IDS;
|
|
207
|
+
exports.FILE_COMMAND_EVENT = FILE_COMMAND_EVENT;
|
|
208
|
+
exports.acceptedHostBackstagePages = acceptedHostBackstagePages;
|
|
209
|
+
exports.capabilityHiddenActions = capabilityHiddenActions;
|
|
210
|
+
exports.disabledCapabilities = disabledCapabilities;
|
|
211
|
+
exports.documentMimeType = documentMimeType;
|
|
212
|
+
exports.documentSaveMeta = documentSaveMeta;
|
|
213
|
+
exports.fileCommandDetail = fileCommandDetail;
|
|
214
|
+
exports.hostBackstageItemId = hostBackstageItemId;
|
|
215
|
+
exports.hostBackstagePageId = hostBackstagePageId;
|
|
216
|
+
exports.hostBackstageRegionId = hostBackstageRegionId;
|
|
217
|
+
exports.hostMenuEntryId = hostMenuEntryId;
|
|
218
|
+
exports.isCapabilityEnabled = isCapabilityEnabled;
|
|
219
|
+
exports.isDocumentStorage = isDocumentStorage;
|
|
220
|
+
exports.isHostMenuEntry = isHostMenuEntry;
|
|
221
|
+
exports.mergeHiddenActions = mergeHiddenActions;
|
|
222
|
+
exports.placeHostBackstagePages = placeHostBackstagePages;
|
|
223
|
+
exports.recoveryStoreOf = recoveryStoreOf;
|
|
224
|
+
exports.resolveHostMenuCommands = resolveHostMenuCommands;
|
|
225
|
+
exports.sameRegionContext = sameRegionContext;
|
|
226
|
+
exports.sameRenderer = sameRenderer;
|
|
227
|
+
exports.saveToStorage = saveToStorage;
|
|
228
|
+
exports.withHostMenuCommands = withHostMenuCommands;
|
|
229
|
+
exports.withoutHiddenEntries = withoutHiddenEntries;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../embedding/index.ts"],"names":[],"mappings":"AAEA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|