ooxml-ui 1.21.0 → 1.22.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 +18 -9
- package/dist/{chunk-ZUDY7TXD.js → chunk-REJECZGV.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/parse-worker.js +5 -1
- package/dist/pptx/{chunk-F4IP3UEX.cjs → chunk-72NIN6QF.cjs} +95 -57
- package/dist/pptx/{chunk-L4HCXIRC.mjs → chunk-VGOIAVPA.mjs} +95 -58
- package/dist/pptx/dom/index.cjs +209 -209
- package/dist/pptx/dom/index.mjs +2 -2
- package/dist/pptx/index.cjs +2899 -2895
- package/dist/pptx/index.mjs +1 -1
- package/dist/pptx/render/collaboration-state.d.ts +11 -1
- package/dist/pptx/render/collaboration-state.d.ts.map +1 -1
- package/dist/pptx/render/collaboration-writeback.d.ts +28 -1
- package/dist/pptx/render/collaboration-writeback.d.ts.map +1 -1
- package/dist/pptx/types.d.ts +11 -2
- package/dist/pptx/types.d.ts.map +1 -1
- package/dist/pptx/web-components/office-aliases.d.ts +1 -1
- package/dist/teams.js +1 -1
- package/dist/visio/building-blocks-toolbar.d.ts +2 -2
- package/dist/visio/building-blocks.d.ts +1 -1
- package/dist/visio/canvas-editing.d.ts +12 -3
- package/dist/visio/controller.d.ts +6 -1
- package/dist/visio/diagram-tool.d.ts +7 -2
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/viewer-share-sync.d.ts +3 -2
- package/dist/visio/viewer-write-back.d.ts +14 -9
- package/dist/visio/worker-parser.d.ts +11 -1
- package/dist/visio.js +322 -262
- package/dist/xlsx/building-blocks.d.ts +2 -0
- package/dist/xlsx/grid/alert-route.d.ts +21 -0
- package/dist/xlsx/index.d.ts +1 -1
- package/dist/xlsx/surface-actions.d.ts +48 -1
- package/dist/xlsx.js +56 -7
- package/package.json +2 -2
- /package/dist/{chunk-VWN37QJI.js → chunk-DRBAJ5UO.js} +0 -0
package/README.md
CHANGED
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
Part of [ooxml](https://github.com/ChristopherVR/ooxml#readme): **[Office](https://github.com/ChristopherVR/ooxml#ooxml-office-the-whole-suite-in-one-app)** · [Word](https://github.com/ChristopherVR/ooxml/tree/main/viewers/docx#readme) · [Excel](https://github.com/ChristopherVR/ooxml/tree/main/viewers/xlsx#readme) · [PowerPoint](https://github.com/ChristopherVR/ooxml/tree/main/viewers/pptx#readme) · [Visio](https://github.com/ChristopherVR/ooxml/tree/main/viewers/visio#readme) · [OpenTeams](https://github.com/ChristopherVR/ooxml/tree/main/viewers/teams#readme) · [Core](https://github.com/ChristopherVR/ooxml/tree/main/src/core#readme)
|
|
12
12
|
|
|
13
|
-
Shared, format-neutral web components and styles for the Office
|
|
14
|
-
|
|
13
|
+
Shared, format-neutral web components and styles for the Office products (Word, Excel, PowerPoint,
|
|
14
|
+
Visio and Teams), and the product editors themselves as `ooxml-ui/<product>` subpaths. Custom
|
|
15
|
+
elements with shadow-root controls and typed events, no framework. The runtime
|
|
15
16
|
dependencies are `ooxml-core` (types and a few pure helpers) and `lit`, which every element is built on
|
|
16
17
|
(see "How the elements are built").
|
|
17
18
|
|
|
18
19
|
> **You do not install this package.** It is a regular `dependency` of every published editor
|
|
19
|
-
> package (`docx-*-viewer`, `pptx-*-viewer
|
|
20
|
+
> package (`docx-*-viewer`, `xlsx-*-viewer`, `pptx-*-viewer`, `visio-*-viewer` and
|
|
21
|
+
> `openteams-*-viewer`), so installing the editor of your framework pulls it
|
|
20
22
|
> in. It is published separately only so that the editors share one copy of the controls. Do not
|
|
21
23
|
> add it to your own install instructions or `package.json`; import controls through the editor
|
|
22
24
|
> package, which registers them for you. Importing `ooxml-ui` directly is for
|
|
@@ -45,7 +47,7 @@ strip, task pane, backstage, account, find bar, print preview, ruler), `comments
|
|
|
45
47
|
- **Updates are synchronous.** Setting a property or attribute redraws the shadow DOM before the call
|
|
46
48
|
returns (the contract the earlier hand-built elements had and every test relies on). The team
|
|
47
49
|
elements keep Lit's batched updates (`static syncUpdates = false`).
|
|
48
|
-
- **Products subclass these elements** (pptx
|
|
50
|
+
- **Products subclass these elements** (`ooxml-ui/pptx` registers `pptx-ui-*` aliases that keep their own
|
|
49
51
|
event names and ids), so the base class keeps what those subclasses lean on: the shadow root exists
|
|
50
52
|
when the constructor returns, a connected element renders on first `shadowRoot` read or in a
|
|
51
53
|
microtask even if a subclass skips `super.connectedCallback()`, and a property that a product hook
|
|
@@ -64,7 +66,7 @@ strip, task pane, backstage, account, find bar, print preview, ruler), `comments
|
|
|
64
66
|
## Team workspace elements (`ooxml-ui/teams`)
|
|
65
67
|
|
|
66
68
|
The chat and meeting pieces of the open-source Teams-style workspace (logic in `ooxml-core/teams`,
|
|
67
|
-
app in the `teams
|
|
69
|
+
app in `viewers/teams`, the editor element in `ooxml-ui/teams`): `office-ui-avatar`, `-app-rail`, `-channel-list`, `-chat-list`,
|
|
68
70
|
`-chat-composer`, `-prejoin`, `-call-grid` and `-call-controls`. Properties in, bubbling `office-*`
|
|
69
71
|
events out, no data fetching; message text is always rendered as text.
|
|
70
72
|
|
|
@@ -122,6 +124,12 @@ applies at once.
|
|
|
122
124
|
| `ooxml-ui/controls` | button, checkbox, switch, select, ribbon group, toolbar, dialog, status bar and item, zoom slider, tab strip |
|
|
123
125
|
| `ooxml-ui/presence` | `<office-ui-presence>` avatar stack for collaboration awareness |
|
|
124
126
|
| `ooxml-ui/smartart` | `<office-ui-smartart>`: draws a core `DiagramDrawing` as SVG |
|
|
127
|
+
| `ooxml-ui/teams` | the Teams elements and `<teams-app>` |
|
|
128
|
+
| `ooxml-ui/suite` | browser document persistence the Office suite uses |
|
|
129
|
+
| `ooxml-ui/docx` | the Word editor and viewer elements (`<docx-editor>`) |
|
|
130
|
+
| `ooxml-ui/xlsx` | the Excel editor and viewer elements (`<xlsx-editor>`) |
|
|
131
|
+
| `ooxml-ui/visio` | the Visio editor and viewer elements (`<visio-viewer>`) |
|
|
132
|
+
| `ooxml-ui/pptx` | the PowerPoint renderer, editor and web components; also `/pptx/theme`, `/loader`, `/i18n`, `/ai`, `/dom` |
|
|
125
133
|
|
|
126
134
|
Every entry declares an `import` and a `default` export condition, so CommonJS consumers on Node 20.19+ or 22.12+ load it through `require(esm)`.
|
|
127
135
|
|
|
@@ -344,9 +352,10 @@ event detail (`approximatedGeometries`, `approximatedFills`, `flattened3d`); not
|
|
|
344
352
|
## Scope
|
|
345
353
|
|
|
346
354
|
Only what every Office product needs lives here. Product-specific ribbon content (PowerPoint
|
|
347
|
-
slides, transitions, animations; Word styles and review)
|
|
348
|
-
`
|
|
349
|
-
|
|
355
|
+
slides, transitions, animations; Word styles and review) lives in the product's own subpath (`src/ui/src/<product>/`), not in the shared entries. The
|
|
356
|
+
`pptx-ui-*` tags are thin subclasses of the `office-ui-*` elements; `docs/ooxml-ui-plan.md` in the
|
|
357
|
+
repository keeps the decisions that still apply (layout, style rules, the tag aliases and the
|
|
358
|
+
token map).
|
|
350
359
|
|
|
351
360
|
## Development
|
|
352
361
|
|
|
@@ -387,7 +396,7 @@ expansion budget. Set `reading: true` on a slide stage for accessible reading
|
|
|
387
396
|
content and native media controls without editing overlays.
|
|
388
397
|
|
|
389
398
|
[Core and UI source](https://github.com/ChristopherVR/ooxml) |
|
|
390
|
-
[Shared UI
|
|
399
|
+
[Shared UI decisions](https://github.com/ChristopherVR/ooxml/blob/main/docs/ooxml-ui-plan.md)
|
|
391
400
|
|
|
392
401
|
## License
|
|
393
402
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineSmartArt } from './chunk-QBXYGKPB.js';
|
|
2
|
-
import { TEAMS_TAGS, registerTeams } from './chunk-
|
|
2
|
+
import { TEAMS_TAGS, registerTeams } from './chunk-DRBAJ5UO.js';
|
|
3
3
|
import { installOfficeUiTheme } from './chunk-T5ARELU2.js';
|
|
4
4
|
import { registerControls } from './chunk-TJ245GDD.js';
|
|
5
5
|
import { definePresence } from './chunk-YZH2QS7J.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { OFFICE_UI_TAGS, registerOfficeUi } from './chunk-
|
|
1
|
+
export { OFFICE_UI_TAGS, registerOfficeUi } from './chunk-REJECZGV.js';
|
|
2
2
|
export { RIBBON_ADD_IN_EVENT, defineRibbonAddInElements, syncRibbonAddIns } from './chunk-C7B7TJ2J.js';
|
|
3
3
|
export { OfficeUiSmartArt, defineSmartArt, renderDiagramDrawing } from './chunk-QBXYGKPB.js';
|
|
4
|
-
export { EMOJI, OfficeUiActivityFeed, OfficeUiAppRail, OfficeUiAvatar, OfficeUiCalendarAgenda, OfficeUiCalendarView, OfficeUiCallControls, OfficeUiCallGrid, OfficeUiChannelList, OfficeUiChatComposer, OfficeUiChatList, OfficeUiChatSidebar, OfficeUiPeoplePicker, OfficeUiPrejoin, QUICK_REACTIONS, TEAMS_TAGS, TeamsApp, TeamsChannelTab, TeamsContentPreview, TeamsController, TeamsElement, TeamsFilesPanel, TeamsSettings, activityTime, applyTeamsProps, colorFor, createTeams, dayKind, dayLabel, defineActivityFeed, defineAppRail, defineAvatar, defineCalendarAgenda, defineCalendarView, defineCallControls, defineCallGrid, defineChannelList, defineChatComposer, defineChatList, defineChatSidebar, definePeoplePicker, definePrejoin, defineTeamsApp, defineTeamsChannelTab, defineTeamsContentPreview, defineTeamsFilesPanel, defineTeamsSettings, formatElapsed, formatSize, formatTime, formatWhen, icon, listenTeamsEvents, loadConfig, loadIdentity, parseIceLines, registerTeams, safeStorage, saveConfig, saveIdentity, withStyles } from './chunk-
|
|
4
|
+
export { EMOJI, OfficeUiActivityFeed, OfficeUiAppRail, OfficeUiAvatar, OfficeUiCalendarAgenda, OfficeUiCalendarView, OfficeUiCallControls, OfficeUiCallGrid, OfficeUiChannelList, OfficeUiChatComposer, OfficeUiChatList, OfficeUiChatSidebar, OfficeUiPeoplePicker, OfficeUiPrejoin, QUICK_REACTIONS, TEAMS_TAGS, TeamsApp, TeamsChannelTab, TeamsContentPreview, TeamsController, TeamsElement, TeamsFilesPanel, TeamsSettings, activityTime, applyTeamsProps, colorFor, createTeams, dayKind, dayLabel, defineActivityFeed, defineAppRail, defineAvatar, defineCalendarAgenda, defineCalendarView, defineCallControls, defineCallGrid, defineChannelList, defineChatComposer, defineChatList, defineChatSidebar, definePeoplePicker, definePrejoin, defineTeamsApp, defineTeamsChannelTab, defineTeamsContentPreview, defineTeamsFilesPanel, defineTeamsSettings, formatElapsed, formatSize, formatTime, formatWhen, icon, listenTeamsEvents, loadConfig, loadIdentity, parseIceLines, registerTeams, safeStorage, saveConfig, saveIdentity, withStyles } from './chunk-DRBAJ5UO.js';
|
|
5
5
|
export { TeamsPresentationPreview, defineTeamsPresentationPreview } from './chunk-FHO7TEWA.js';
|
|
6
6
|
export { BUILDING_BLOCKS_CSS, LEGACY_OFFICE_THEME_TOKENS, THEME_CSS, THEME_STYLE_ID, installOfficeUiTheme, installOfficeUiThemeFor, legacyThemeAliases, legacyThemeBridge, prepareOfficeUiBlock, shadcnBridge, themeBridge } from './chunk-T5ARELU2.js';
|
|
7
7
|
export { CONTROL_DEFINERS, DEFAULT_COMMENTS_LABELS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_COLOR_SWATCHES, OFFICE_COLOR_SWATCH_HEXES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_SYMBOLS, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, assignKeyTips, attachKeyTips, attachRibbonGroupOverflow, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, commentInitials, createRibbonOverflow, defineAccount, defineBackstage, defineButton, defineChartPicker, defineCheckbox, defineColorCustom, defineColorGrid, defineCommandSearch, defineCommentsPane, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineGallery, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonActions, defineRibbonGroup, defineRibbonSection, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineSymbolPicker, defineTabStrip, defineTaskPane, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, fitRibbonGroups, formatCommentTime, glyph, nextEnabledIndex, optionText, optionsLabels, parseOfficeSymbolCode, parseSvgPreview, personalizeSection, profileInitials, readOfficeProfile, registerControls, rulerDivisions, runKeyTips, sanitizeOfficeProfile, typeAheadIndex, unavailableCategory, unavailableControl, userInterfaceSection, writeOfficeProfile } from './chunk-TJ245GDD.js';
|
package/dist/parse-worker.js
CHANGED
|
@@ -6,7 +6,11 @@ var worker = self;
|
|
|
6
6
|
worker.onmessage = async (event) => {
|
|
7
7
|
if (event.origin && event.origin !== self.location.origin) return;
|
|
8
8
|
try {
|
|
9
|
-
const
|
|
9
|
+
const request = event.data;
|
|
10
|
+
const document = request instanceof ArrayBuffer ? await loadVisio(request, { metafileConverter: convertMetafileToSvgTree }) : await loadVisio(request.bytes, {
|
|
11
|
+
metafileConverter: convertMetafileToSvgTree,
|
|
12
|
+
pages: request.pages
|
|
13
|
+
});
|
|
10
14
|
worker.postMessage({ ok: true, document });
|
|
11
15
|
} catch (cause) {
|
|
12
16
|
worker.postMessage({
|
|
@@ -81,6 +81,7 @@ var collaborationTextNativeEdit = require('ooxml-core/pptx/editor/render/collabo
|
|
|
81
81
|
var collaborationTextSnapshotPositions = require('ooxml-core/pptx/editor/render/collaboration-text-snapshot-positions');
|
|
82
82
|
var collaborationLoadOrigin = require('ooxml-core/pptx/editor/render/collaboration-load-origin');
|
|
83
83
|
var collaborationDeparture = require('ooxml-core/pptx/editor/render/collaboration-departure');
|
|
84
|
+
var collab = require('ooxml-core/collab');
|
|
84
85
|
var slideTransitionEdits = require('ooxml-core/pptx/editor/render/slide-transition-edits');
|
|
85
86
|
var diagram = require('ooxml-core/diagram');
|
|
86
87
|
var slideSearch = require('ooxml-core/pptx/editor/render/slide-search');
|
|
@@ -3575,6 +3576,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
|
|
|
3575
3576
|
wrapNotesText: () => wrapNotesText,
|
|
3576
3577
|
wrapTextByEstimatedWidth: () => chunkG3UVZ5FO_cjs.wrapTextByEstimatedWidth,
|
|
3577
3578
|
writeAssetFields: () => collaborationSync.writeAssetFields,
|
|
3579
|
+
writeBackReport: () => writeBackReport,
|
|
3578
3580
|
writeElementParagraphs: () => writeElementParagraphs,
|
|
3579
3581
|
writeElementToYMap: () => collaborationSync.writeElementToYMap,
|
|
3580
3582
|
writeSlideToYMap: () => collaborationSync.writeSlideToYMap,
|
|
@@ -7032,6 +7034,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
|
|
|
7032
7034
|
wrapForeignObjectSvg: () => wrapForeignObjectSvg,
|
|
7033
7035
|
wrapTextByEstimatedWidth: () => chunkG3UVZ5FO_cjs.wrapTextByEstimatedWidth,
|
|
7034
7036
|
writeAssetFields: () => collaborationSync.writeAssetFields,
|
|
7037
|
+
writeBackReport: () => writeBackReport,
|
|
7035
7038
|
writeElementParagraphs: () => writeElementParagraphs,
|
|
7036
7039
|
writeElementToYMap: () => collaborationSync.writeElementToYMap,
|
|
7037
7040
|
writeSlideToYMap: () => collaborationSync.writeSlideToYMap,
|
|
@@ -42103,83 +42106,112 @@ function registerCollaborationTeardown(options) {
|
|
|
42103
42106
|
function clearLocalAwareness(awareness) {
|
|
42104
42107
|
awareness?.setLocalState?.(null);
|
|
42105
42108
|
}
|
|
42106
|
-
var DEFAULT_DEBOUNCE_MS = 5e3;
|
|
42107
42109
|
function createWriteBackScheduler(deps) {
|
|
42108
|
-
let
|
|
42109
|
-
let
|
|
42110
|
+
let core = null;
|
|
42111
|
+
let coreKey = "";
|
|
42112
|
+
let current = null;
|
|
42110
42113
|
let unsubscribe = null;
|
|
42111
|
-
|
|
42112
|
-
|
|
42114
|
+
let detachPageClose = null;
|
|
42115
|
+
const isReady = () => current?.externalSession?.getSnapshot().synced ?? true;
|
|
42116
|
+
const detachSession = () => {
|
|
42113
42117
|
unsubscribe?.();
|
|
42114
42118
|
unsubscribe = null;
|
|
42115
|
-
|
|
42116
|
-
|
|
42117
|
-
|
|
42119
|
+
};
|
|
42120
|
+
function serialize(isCurrentWrite) {
|
|
42121
|
+
const ydoc = deps.getYDoc();
|
|
42122
|
+
const isCurrent = () => isCurrentWrite() && isReady() && deps.getYDoc() === ydoc;
|
|
42123
|
+
if (!ydoc || !current?.onWriteBack || !isReady()) return Promise.resolve(null);
|
|
42124
|
+
return serializeDoc(ydoc, isCurrent);
|
|
42125
|
+
}
|
|
42126
|
+
async function serializeDoc(ydoc, isCurrent) {
|
|
42127
|
+
if (deps.serialize) {
|
|
42128
|
+
try {
|
|
42129
|
+
const bytes2 = await deps.serialize(isCurrent);
|
|
42130
|
+
return bytes2 && isCurrent() ? bytes2 : null;
|
|
42131
|
+
} catch (error) {
|
|
42132
|
+
if (!isCurrent()) return null;
|
|
42133
|
+
throw error;
|
|
42134
|
+
}
|
|
42135
|
+
}
|
|
42136
|
+
const sourceBytes = deps.getSourceBytes?.();
|
|
42137
|
+
if (!sourceBytes) return null;
|
|
42138
|
+
const handler = new pptx.PptxHandler();
|
|
42139
|
+
await handler.load(sourceBytes.buffer);
|
|
42140
|
+
if (!isCurrent()) return null;
|
|
42141
|
+
const slides = collaborationSync.readSlidesFromYDoc(ydoc);
|
|
42142
|
+
const merged = deps.mergeTemplateElements ? deps.mergeTemplateElements(slides, deps.getTemplateElements?.() ?? {}) : slides;
|
|
42143
|
+
const bytes = await handler.save(merged, deps.getSaveOptions?.());
|
|
42144
|
+
return isCurrent() ? bytes : null;
|
|
42145
|
+
}
|
|
42146
|
+
function coreFor(config) {
|
|
42147
|
+
const retry = config.writeBackRetry;
|
|
42148
|
+
const key = [
|
|
42149
|
+
config.writeBackDebounceMs,
|
|
42150
|
+
retry?.attempts,
|
|
42151
|
+
retry?.baseDelayMs,
|
|
42152
|
+
retry?.maxDelayMs
|
|
42153
|
+
].join("|");
|
|
42154
|
+
if (core && key === coreKey) return core;
|
|
42155
|
+
core?.dispose();
|
|
42156
|
+
coreKey = key;
|
|
42157
|
+
core = collab.createWriteBackScheduler({
|
|
42158
|
+
debounceMs: config.writeBackDebounceMs ?? collab.DEFAULT_WRITE_BACK_DEBOUNCE_MS,
|
|
42159
|
+
...retry ? { retry } : {},
|
|
42160
|
+
serialize: ({ isCurrent }) => serialize(isCurrent),
|
|
42161
|
+
// Read at write time, so a host callback changed meanwhile is the one called.
|
|
42162
|
+
write: (bytes) => current?.onWriteBack?.(bytes),
|
|
42163
|
+
onStatus: (state) => {
|
|
42164
|
+
if (state.status === "saved" || state.status === "failed" || state.status === "idle") {
|
|
42165
|
+
detachSession();
|
|
42166
|
+
}
|
|
42167
|
+
deps.onWriteBackStatus?.();
|
|
42168
|
+
}
|
|
42169
|
+
});
|
|
42170
|
+
return core;
|
|
42171
|
+
}
|
|
42172
|
+
function cancel() {
|
|
42173
|
+
const config = current;
|
|
42174
|
+
const ydoc = deps.getYDoc();
|
|
42175
|
+
const final = core?.dirty && ydoc && config?.onWriteBack && config.role === "owner" && isReady() ? { ydoc, onWriteBack: config.onWriteBack } : null;
|
|
42176
|
+
if (final) {
|
|
42177
|
+
void serializeDoc(final.ydoc, () => true).then((bytes) => bytes ? final.onWriteBack(bytes) : void 0).catch(() => {
|
|
42178
|
+
});
|
|
42118
42179
|
}
|
|
42180
|
+
core?.cancel();
|
|
42181
|
+
detachSession();
|
|
42182
|
+
detachPageClose?.();
|
|
42183
|
+
detachPageClose = null;
|
|
42119
42184
|
}
|
|
42120
42185
|
function schedule(config) {
|
|
42121
|
-
const isReady = () => config.externalSession?.getSnapshot().synced ?? true;
|
|
42122
42186
|
if (!config.onWriteBack || config.role !== "owner" || !deps.getYDoc()) {
|
|
42123
42187
|
return;
|
|
42124
42188
|
}
|
|
42125
|
-
|
|
42189
|
+
current = config;
|
|
42190
|
+
const scheduler = coreFor(config);
|
|
42191
|
+
detachSession();
|
|
42126
42192
|
if (!isReady()) {
|
|
42193
|
+
scheduler.cancel();
|
|
42127
42194
|
return;
|
|
42128
42195
|
}
|
|
42129
|
-
const token = generation;
|
|
42130
42196
|
if (config.externalSession) {
|
|
42131
42197
|
const detach = config.externalSession.subscribe(() => {
|
|
42132
|
-
if (!isReady())
|
|
42133
|
-
cancel();
|
|
42134
|
-
}
|
|
42198
|
+
if (!isReady()) scheduler.cancel();
|
|
42135
42199
|
});
|
|
42136
|
-
if (
|
|
42200
|
+
if (!isReady()) {
|
|
42137
42201
|
detach();
|
|
42138
42202
|
return;
|
|
42139
42203
|
}
|
|
42140
42204
|
unsubscribe = detach;
|
|
42141
42205
|
}
|
|
42142
|
-
|
|
42143
|
-
|
|
42144
|
-
timer = null;
|
|
42145
|
-
const ydoc = deps.getYDoc();
|
|
42146
|
-
const isCurrent = () => token === generation && isReady() && deps.getYDoc() === ydoc;
|
|
42147
|
-
try {
|
|
42148
|
-
if (!ydoc || !config.onWriteBack || !isReady()) {
|
|
42149
|
-
return;
|
|
42150
|
-
}
|
|
42151
|
-
if (deps.serialize) {
|
|
42152
|
-
const bytes2 = await deps.serialize(isCurrent);
|
|
42153
|
-
if (bytes2 && isCurrent()) {
|
|
42154
|
-
await config.onWriteBack(bytes2);
|
|
42155
|
-
}
|
|
42156
|
-
return;
|
|
42157
|
-
}
|
|
42158
|
-
const sourceBytes = deps.getSourceBytes?.();
|
|
42159
|
-
if (!sourceBytes) {
|
|
42160
|
-
return;
|
|
42161
|
-
}
|
|
42162
|
-
const handler = new pptx.PptxHandler();
|
|
42163
|
-
await handler.load(sourceBytes.buffer);
|
|
42164
|
-
if (!isCurrent()) {
|
|
42165
|
-
return;
|
|
42166
|
-
}
|
|
42167
|
-
const slides = collaborationSync.readSlidesFromYDoc(ydoc);
|
|
42168
|
-
const merged = deps.mergeTemplateElements ? deps.mergeTemplateElements(slides, deps.getTemplateElements?.() ?? {}) : slides;
|
|
42169
|
-
const bytes = await handler.save(merged, deps.getSaveOptions?.());
|
|
42170
|
-
if (isCurrent()) {
|
|
42171
|
-
await config.onWriteBack(bytes);
|
|
42172
|
-
}
|
|
42173
|
-
} catch {
|
|
42174
|
-
} finally {
|
|
42175
|
-
if (token === generation) {
|
|
42176
|
-
unsubscribe?.();
|
|
42177
|
-
unsubscribe = null;
|
|
42178
|
-
}
|
|
42179
|
-
}
|
|
42180
|
-
}, debounceMs);
|
|
42206
|
+
detachPageClose ??= collab.flushWriteBackOnPageClose(scheduler);
|
|
42207
|
+
scheduler.schedule();
|
|
42181
42208
|
}
|
|
42182
|
-
return {
|
|
42209
|
+
return {
|
|
42210
|
+
schedule,
|
|
42211
|
+
cancel,
|
|
42212
|
+
flush: () => core?.flush() ?? Promise.resolve(),
|
|
42213
|
+
getState: () => core ? collab.writeBackStateOf(core.state) : void 0
|
|
42214
|
+
};
|
|
42183
42215
|
}
|
|
42184
42216
|
var POSITION_THRESHOLD = 2;
|
|
42185
42217
|
var SIZE_THRESHOLD = 2;
|
|
@@ -77363,6 +77395,10 @@ function createSlidePackageClipboard(initialHost) {
|
|
|
77363
77395
|
}
|
|
77364
77396
|
|
|
77365
77397
|
// src/pptx/render/collaboration-state.ts
|
|
77398
|
+
function writeBackReport(config, state) {
|
|
77399
|
+
if (!config?.onWriteBack || config.role !== "owner") return void 0;
|
|
77400
|
+
return state ?? { status: "idle" };
|
|
77401
|
+
}
|
|
77366
77402
|
var COLLABORATION_OFF = Object.freeze({
|
|
77367
77403
|
active: false,
|
|
77368
77404
|
roomId: void 0,
|
|
@@ -77395,12 +77431,13 @@ function buildCollaborationState(input) {
|
|
|
77395
77431
|
roomId: input.roomId || void 0,
|
|
77396
77432
|
status: input.status,
|
|
77397
77433
|
synced: input.synced,
|
|
77398
|
-
people
|
|
77434
|
+
people,
|
|
77435
|
+
...input.writeBack ? { writeBack: input.writeBack } : {}
|
|
77399
77436
|
};
|
|
77400
77437
|
}
|
|
77401
77438
|
function collaborationStatesEqual(a, b) {
|
|
77402
77439
|
if (a === b) return true;
|
|
77403
|
-
if (a.active !== b.active || a.roomId !== b.roomId || a.status !== b.status || a.synced !== b.synced || a.people.length !== b.people.length) {
|
|
77440
|
+
if (a.active !== b.active || a.roomId !== b.roomId || a.status !== b.status || a.synced !== b.synced || a.people.length !== b.people.length || a.writeBack?.status !== b.writeBack?.status || a.writeBack?.lastSavedAt !== b.writeBack?.lastSavedAt || a.writeBack?.error !== b.writeBack?.error) {
|
|
77404
77441
|
return false;
|
|
77405
77442
|
}
|
|
77406
77443
|
return a.people.every((person, index) => {
|
|
@@ -94855,6 +94892,7 @@ exports.withRecordEntry = withRecordEntry;
|
|
|
94855
94892
|
exports.withSlideSizeOrientation = withSlideSizeOrientation;
|
|
94856
94893
|
exports.wrapForeignObjectSvg = wrapForeignObjectSvg;
|
|
94857
94894
|
exports.wrapNotesText = wrapNotesText;
|
|
94895
|
+
exports.writeBackReport = writeBackReport;
|
|
94858
94896
|
exports.writeElementParagraphs = writeElementParagraphs;
|
|
94859
94897
|
exports.writeStoredViewerPrefs = writeStoredViewerPrefs;
|
|
94860
94898
|
exports.zeroDelayCssAnimation = zeroDelayCssAnimation;
|