@a3s-lab/office 0.12.0 → 0.13.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.
Files changed (124) hide show
  1. package/README.md +112 -7
  2. package/dist/0~1403.js +20 -12
  3. package/dist/0~2805.js +241 -241
  4. package/dist/0~4980.js +1 -1
  5. package/dist/0~5050.js +1 -20
  6. package/dist/0~5093.js +547 -547
  7. package/dist/0~6090.js +63 -4
  8. package/dist/0~7048.js +31 -29
  9. package/dist/0~document-editor.js +694 -90
  10. package/dist/0~pdf-viewer.js +41 -10
  11. package/dist/0~presentation-editor.js +8 -6
  12. package/dist/0~spreadsheet-editor.js +11892 -9682
  13. package/dist/0~work-document-import-worker-client.js +237 -0
  14. package/dist/0~work-docx-export.js +1 -1
  15. package/dist/0~work-docx-import.js +1 -1
  16. package/dist/0~work-docx-large-document-import.js +559 -0
  17. package/dist/0~work-office-diagnostics.js +46 -32
  18. package/dist/4104.js +5070 -3112
  19. package/dist/432.js +51 -7
  20. package/dist/4476.js +201 -7
  21. package/dist/5184.js +24 -2
  22. package/dist/{8928.js → 6282.js} +2338 -93
  23. package/dist/8715.js +895 -888
  24. package/dist/9356.js +3 -1
  25. package/dist/core.js +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -9
  28. package/dist/internal/features/work/editors/document-external-content.d.ts +1 -1
  29. package/dist/internal/features/work/editors/office-menu-keyboard.d.ts +1 -0
  30. package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +3 -1
  31. package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +3 -2
  32. package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +2 -1
  33. package/dist/internal/features/work/editors/presentation-workspace.d.ts +2 -1
  34. package/dist/internal/features/work/editors/spreadsheet-border-ribbon.d.ts +5 -0
  35. package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +10 -0
  36. package/dist/internal/features/work/editors/spreadsheet-cell-border-command.d.ts +3 -0
  37. package/dist/internal/features/work/editors/spreadsheet-cell-border-per-cell.d.ts +5 -0
  38. package/dist/internal/features/work/editors/spreadsheet-cell-border.d.ts +28 -0
  39. package/dist/internal/features/work/editors/spreadsheet-cell-fill-command.d.ts +3 -0
  40. package/dist/internal/features/work/editors/spreadsheet-cell-fill.d.ts +12 -0
  41. package/dist/internal/features/work/editors/spreadsheet-cell-range.d.ts +14 -0
  42. package/dist/internal/features/work/editors/spreadsheet-cell-style-command.d.ts +3 -0
  43. package/dist/internal/features/work/editors/spreadsheet-cell-style-ribbon.d.ts +9 -0
  44. package/dist/internal/features/work/editors/spreadsheet-cell-style.d.ts +41 -0
  45. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +293 -0
  46. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +10 -4
  47. package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +3 -1
  48. package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +8 -2
  49. package/dist/internal/features/work/editors/spreadsheet-home-format-ribbon.d.ts +10 -0
  50. package/dist/internal/features/work/editors/spreadsheet-in-place-workbook-sync.d.ts +10 -0
  51. package/dist/internal/features/work/editors/spreadsheet-number-format.d.ts +15 -3
  52. package/dist/internal/features/work/editors/spreadsheet-operation-projection.d.ts +14 -0
  53. package/dist/internal/features/work/editors/spreadsheet-structure-selection.d.ts +7 -0
  54. package/dist/internal/features/work/editors/use-document-pagination.d.ts +5 -0
  55. package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +2 -1
  56. package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +2 -1
  57. package/dist/internal/features/work/spreadsheet-history-value.d.ts +1 -0
  58. package/dist/internal/features/work/spreadsheet-sparse.d.ts +6 -1
  59. package/dist/internal/features/work/work-document-chunk-geometry.d.ts +28 -0
  60. package/dist/internal/features/work/work-document-chunk-node.d.ts +23 -0
  61. package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
  62. package/dist/internal/features/work/work-document-html-fingerprint.d.ts +15 -0
  63. package/dist/internal/features/work/work-document-import-worker-client.d.ts +13 -0
  64. package/dist/internal/features/work/work-document-import-worker-protocol.d.ts +36 -0
  65. package/dist/internal/features/work/work-document-import.worker.d.ts +1 -0
  66. package/dist/internal/features/work/work-document-incremental-layout.d.ts +1 -1
  67. package/dist/internal/features/work/work-document-integrity-index.d.ts +14 -0
  68. package/dist/internal/features/work/work-document-lazy-block.d.ts +3 -0
  69. package/dist/internal/features/work/work-document-lazy-html.d.ts +21 -0
  70. package/dist/internal/features/work/work-document-lazy-model.d.ts +29 -0
  71. package/dist/internal/features/work/work-document-lazy-pagination-measurement.d.ts +3 -0
  72. package/dist/internal/features/work/work-document-lazy-preview.d.ts +21 -0
  73. package/dist/internal/features/work/work-document-lazy-update.d.ts +14 -0
  74. package/dist/internal/features/work/work-document-model.d.ts +18 -2
  75. package/dist/internal/features/work/work-document-page-surface-registry.d.ts +16 -0
  76. package/dist/internal/features/work/work-document-pagination-dom.d.ts +1 -0
  77. package/dist/internal/features/work/work-document-pagination-types.d.ts +1 -0
  78. package/dist/internal/features/work/work-document-pagination.d.ts +1 -1
  79. package/dist/internal/features/work/work-document-text-statistics.d.ts +25 -0
  80. package/dist/internal/features/work/work-document-windowing.d.ts +23 -0
  81. package/dist/internal/features/work/work-docx-large-document-import.d.ts +35 -0
  82. package/dist/internal/features/work/work-docx-large-document-parser.d.ts +29 -0
  83. package/dist/internal/features/work/work-file-import.d.ts +5 -0
  84. package/dist/internal/features/work/work-file-io.d.ts +3 -3
  85. package/dist/internal/features/work/work-file-kind.d.ts +5 -0
  86. package/dist/internal/features/work/work-office-diagnostics.d.ts +10 -1
  87. package/dist/internal/features/work/work-ooxml-package.d.ts +8 -0
  88. package/dist/internal/features/work/work-presentation-layouts.d.ts +7 -1
  89. package/dist/internal/features/work/work-repository.d.ts +1 -0
  90. package/dist/internal/features/work/work-spreadsheet-compatibility-summary.d.ts +10 -0
  91. package/dist/internal/features/work/work-spreadsheet-file-export.d.ts +2 -0
  92. package/dist/internal/features/work/work-spreadsheet-file-import.d.ts +3 -0
  93. package/dist/internal/features/work/work-spreadsheet-import-diagnostics.d.ts +2 -0
  94. package/dist/internal/features/work/work-spreadsheet-import-worker-client.d.ts +6 -0
  95. package/dist/internal/features/work/work-spreadsheet-import-worker-protocol.d.ts +32 -0
  96. package/dist/internal/features/work/work-spreadsheet-import.worker.d.ts +1 -0
  97. package/dist/internal/features/work/work-spreadsheet-matrix-profile.d.ts +64 -0
  98. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-client.d.ts +6 -0
  99. package/dist/internal/features/work/work-spreadsheet-package-scan-worker-protocol.d.ts +49 -0
  100. package/dist/internal/features/work/work-spreadsheet-package-scan.worker.d.ts +1 -0
  101. package/dist/internal/features/work/work-xlsx-cell-borders.d.ts +25 -0
  102. package/dist/internal/features/work/work-xlsx-cell-style-writer.d.ts +21 -0
  103. package/dist/internal/features/work/work-xlsx-cell-style-xml.d.ts +17 -0
  104. package/dist/internal/features/work/work-xlsx-cell-styles.d.ts +13 -0
  105. package/dist/internal/features/work/work-xlsx-colors.d.ts +6 -0
  106. package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -1
  107. package/dist/internal/features/work/work-xlsx-formulas.d.ts +2 -1
  108. package/dist/internal/features/work/work-xlsx-interop.d.ts +8 -5
  109. package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +2 -1
  110. package/dist/internal/features/work/work-xlsx-plain-fast-path.d.ts +54 -0
  111. package/dist/internal/features/work/work-xlsx-style-gate.d.ts +1 -0
  112. package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +13 -0
  113. package/dist/internal/features/work/work-xlsx-worksheet.d.ts +12 -0
  114. package/dist/office-kernel.wasm +0 -0
  115. package/dist/office-kernel.worker.js +31 -29
  116. package/dist/react.d.ts +7 -1
  117. package/dist/styles.css +557 -3
  118. package/dist/work-document-import.worker.js +558 -0
  119. package/dist/work-spreadsheet-import.worker.js +24745 -0
  120. package/dist/work-spreadsheet-import.worker.js.LICENSE.txt +3 -0
  121. package/dist/work-spreadsheet-package-scan.worker.js +4161 -0
  122. package/dist/work-spreadsheet-package-scan.worker.js.LICENSE.txt +11 -0
  123. package/docs/latest/en/browser-editor-architecture.md +351 -15
  124. package/package.json +23 -3
package/README.md CHANGED
@@ -139,8 +139,34 @@ The images below are committed visual-regression baselines from the real
139
139
  - **Framework choice** — React components, Vue 3 adapters, Custom Elements,
140
140
  and a framework-neutral Core API over the same engine.
141
141
  - **Responsive computation** — Lazy editor chunks, cancellable Workers,
142
+ streamed dense XLSX and eligible large-DOCX parsing in dedicated
143
+ transferable-input Workers, including a fail-closed plain-OOXML path that
144
+ reuses the package Worker's decompressed worksheet XML and aborts speculative
145
+ SheetJS parsing only after package authentication,
142
146
  CSS-compatible font-weight matching, Rust WebAssembly layout and
143
- calculation, and PDFium rendering.
147
+ calculation, and PDFium rendering. Spreadsheet Canvas painting is bounded
148
+ to the visible row and column range. Eligible structurally plain large DOCX
149
+ files retain one complete canonical structured model while TipTap initially
150
+ materializes only two equal-position chunks and hydrates a selected chunk on
151
+ demand. The large-DOCX Worker streams 2,048-item batches and columnar table
152
+ metadata instead of cloning one complete object graph. Pooled semantic
153
+ previews, physical page sheets, and pagination widgets are windowed
154
+ independently. The PDF rail mounts at most 32 thumbnail buttons, aborts the
155
+ exact PDFium task when a thumbnail leaves the window, and uses instant
156
+ long-distance keyboard jumps so the destination retains focus. The checked
157
+ 1,000-page fixture mounts 15 thumbnails and seven main-view pages at
158
+ readiness. Presentation decks above 60 slides use independent thumbnail-node
159
+ and scene windows. The checked 1,000-slide, 9,000-element fixture mounts 18
160
+ thumbnail buttons and 13 full thumbnail scenes, retains about 10.9 MiB of
161
+ JavaScript heap, reaches slide 1,000 in 6.1–13.4 ms, and produces no Long
162
+ Tasks. Design metadata is normalized once per controlled value and each
163
+ visible thumbnail resolves only its own slide. The checked 100,000-block
164
+ fixtures keep
165
+ selection, editing, and export positions in the canonical model instead of
166
+ replacing them with a React-only virtual list; rich and collaborative models
167
+ deliberately retain the complete compatibility path. Consecutive controlled
168
+ edits hash only changed lazy chunks and combine cached fingerprint segments,
169
+ while cloned or persisted models still receive complete HTML verification.
144
170
  - **AI without UI scraping** — Typed agent ports and host-defined selection
145
171
  actions receive structured context and editing commands.
146
172
  - **Automation outside the browser** — The native Rust CLI, standard MCP
@@ -250,6 +276,32 @@ export function ProjectBrief() {
250
276
  The editor owns editing, layout, import/export, and browser rendering. The host
251
277
  owns persistence and decides when, where, and how the emitted content is saved.
252
278
 
279
+ ### Preload an anticipated PDF
280
+
281
+ Editor modules remain lazy. PDFium runtime loading is a separate, explicit
282
+ choice because its unpacked WebAssembly binary is about 4.4 MiB. Warm both only
283
+ from a high-confidence intent, and use the same URL when mounting `PdfViewer`:
284
+
285
+ ```tsx
286
+ import { PdfViewer, preloadOfficeEditor } from '@a3s-lab/office/react';
287
+
288
+ const pdfiumUrl = '/assets/pdfium.wasm';
289
+
290
+ void preloadOfficeEditor('pdf', {
291
+ pdfWasmUrl: pdfiumUrl,
292
+ preloadRuntimeAssets: true,
293
+ });
294
+
295
+ <PdfViewer loadSource={loadPdf} wasmUrl={pdfiumUrl} />;
296
+ ```
297
+
298
+ The preload caches the module and, when the request succeeds, the response
299
+ body. Runtime warming is best effort: a network failure does not block editor
300
+ opening, and a later call retries it. The helper does not create a hidden
301
+ viewer or pre-initialize the PDFium Worker. On the local reference machine it
302
+ improved median shell mount by 41.6 ms but did not improve the viewer-ready
303
+ median, so Worker initialization remains the measured boundary.
304
+
253
305
  ### Persist a structured document snapshot
254
306
 
255
307
  Hosts that round-trip controlled document values across a process or language
@@ -476,7 +528,11 @@ interaction model.
476
528
  commands share the permission-resilient local fallback with their WPS
477
529
  shortcuts, a WPS-style Format Painter with single-use and double-click locked
478
530
  sessions, cross-sheet range-pattern tiling, Escape cancellation, and native
479
- style-only writes, Conditional Formatting under Home and Styles, executable
531
+ style-only writes, a Home and Font cell-border split control with side, all,
532
+ outside, inside, horizontal, vertical, clear, and diagonal targets, ten
533
+ native line styles, exact color selection, compact overlapping range writes,
534
+ single-update undo, and grid-focus restoration, Conditional Formatting under
535
+ Home and Styles, executable
480
536
  sorting plus WPS-style AutoFilter under Data, finite current-region discovery,
481
537
  `Cmd/Ctrl+Shift+L` toggling, an `Alt+ArrowDown` keyboard filter menu,
482
538
  a Home and Cells Rows and Columns menu for inserting above, below, left, or
@@ -487,6 +543,21 @@ interaction model.
487
543
  a Home and Editing Clear menu for independently removing content, formats,
488
544
  comments, hyperlinks, or all cell state while preserving merge geometry,
489
545
  with Delete and Backspace mapped to Clear Contents,
546
+ a Home and Editing Fill menu for Down, Right, Up, and Left with native
547
+ relative-formula and style propagation, WPS `Cmd/Ctrl+D` and `Cmd/Ctrl+R`
548
+ shortcuts, one-step history, protected-range preflight, a 50,000-target-cell
549
+ guard, and sparse-row-safe execution,
550
+ Home and Number presets for General, Number, CNY Currency, Accounting,
551
+ Percentage, Short Date, Time, Scientific, Fraction, and Text, including the
552
+ seven standard `Cmd/Ctrl+Shift` format shortcuts, exact XLSX format-code
553
+ round trips, value/formula preservation, and one-step history,
554
+ a Home and Styles gallery with 17 WPS built-in cell styles grouped as Common,
555
+ Data and Model, and Titles and Totals, true native previews, two-dimensional
556
+ keyboard navigation, a 10,000-cell bound, blank-cell styling, per-cell border
557
+ semantics, current-style recognition without private markers, one-step
558
+ history, and direct XLSX font, fill, alignment, wrap, rotation, border, and
559
+ number-format XF round trips with theme, indexed, and tint colors normalized
560
+ to stable RGB,
490
561
  a View and Window Freeze Panes menu for current-cell, top-row, first-column,
491
562
  and unfreeze patterns with XLSX round trips, and visible F9 workbook
492
563
  recalculation,
@@ -497,7 +568,7 @@ interaction model.
497
568
  keyboard-operated cells and sheet tabs, direct type-to-edit,
498
569
  permission-resilient multi-cell cut/copy/paste, clear, F2 editing, and
499
570
  focus-safe Escape behavior, direct
500
- font-family, vertical-alignment, text-wrap, number/percent, and decimal
571
+ font-family, vertical-alignment, text-wrap, number-format, and decimal
501
572
  controls, charts, validation, protection, comments, and print settings.
502
573
  _XLSX, XLS, ODS, and CSV import; XLSX and PDF export._
503
574
  - **Presentation** — Typed slide scene graph, multi-selection, groups, object
@@ -516,9 +587,10 @@ interaction model.
516
587
  - **PDF** — PDFium rendering, navigation, search, form filling, annotations,
517
588
  annotation color, opacity, compatible stroke-width controls, history,
518
589
  a scrollable page-thumbnail rail with current-page synchronization and
519
- focus-synchronized Arrow/Home/End navigation, bounded rendering for long
520
- files, and a dismissible page drawer whose phone trigger stays in the page
521
- controls instead of covering PDF content,
590
+ focus-synchronized Arrow/Home/End navigation, a 32-thumbnail hard window,
591
+ cancellation of stale PDFium bitmap tasks, bounded main-page rendering for
592
+ long files, and a dismissible page drawer whose phone trigger stays in the
593
+ page controls instead of covering PDF content,
522
594
  focus-safe page and search drafts, responsive search-result, navigation, and
523
595
  zoom controls, editor-scoped shortcuts, and a keyboard-operated overflow menu
524
596
  that retains secondary annotation tools and appearance settings on phones.
@@ -579,7 +651,9 @@ import {
579
651
  } from '@a3s-lab/office/core';
580
652
 
581
653
  const controller = new AbortController();
654
+ const shell = createArtifact('blank-document');
582
655
  const imported = await importOfficeFile(file, {
656
+ artifactId: shell.id,
583
657
  signal: controller.signal,
584
658
  onProgress: ({ stage, progress }) => {
585
659
  console.info(stage, `${Math.round(progress * 100)}%`);
@@ -587,12 +661,35 @@ const imported = await importOfficeFile(file, {
587
661
  });
588
662
  const output = await createArtifactBlob(imported);
589
663
  const blankDeck = createArtifact('blank-presentation');
664
+
665
+ const workbookShell = createArtifact('blank-spreadsheet');
666
+ if (workbookShell.content.type !== 'spreadsheet') {
667
+ throw new Error('Expected a Spreadsheet shell.');
668
+ }
669
+ const workbook = await importOfficeFile(spreadsheetFile, {
670
+ artifactId: workbookShell.id,
671
+ spreadsheetSheetIds: workbookShell.content.sheets.flatMap((sheet) =>
672
+ sheet.id ? [sheet.id] : [],
673
+ ),
674
+ });
590
675
  ```
591
676
 
592
677
  Import progress advances monotonically through `reading`, `parsing`,
593
678
  `analyzing`, and `finalizing`. Calling `controller.abort()` rejects with an
594
679
  `AbortError`; large reads and parser checkpoints yield so a host can keep the
595
- progress and Cancel controls responsive.
680
+ progress and Cancel controls responsive. An optional host-reserved
681
+ `artifactId` lets the UI mount an editor shell before parsing finishes and then
682
+ apply the imported controlled value without remounting that surface. The
683
+ Playground uses this boundary to overlap DOCX Worker parsing with editor
684
+ initialization; source-backed export remains attached to the reserved ID. A
685
+ Spreadsheet host can also reserve worksheet identities with
686
+ `spreadsheetSheetIds`. Eligible structurally plain workbooks then replace the
687
+ authenticated frozen matrix inside the mounted Fortune instance instead of
688
+ cloning one million cells through a second mount. Sheet-count or identity
689
+ changes, preview mode, charts, protection, merged or styled geometry, and other
690
+ stateful workbook structures retain the complete remount path. The plain-OOXML
691
+ Worker authenticates row and cell coordinates directly in its XML buffer, so a
692
+ million-cell import does not allocate or regex-match a million address strings.
596
693
 
597
694
  Spreadsheet import and export preserve sparse worksheets up to the XLSX limit
598
695
  of 1,048,576 rows by 16,384 columns. The logical `data.length`, `row`, and
@@ -1341,6 +1438,12 @@ bun run lint
1341
1438
  bun run typecheck
1342
1439
  bun run test
1343
1440
  bun run build
1441
+ bun run test:e2e:large-pdf:check
1442
+ bun run test:e2e:large-pdf
1443
+ bun run performance:pdf
1444
+ bun run test:e2e:large-presentation:check
1445
+ bun run test:e2e:large-presentation
1446
+ bun run performance:presentation
1344
1447
  ```
1345
1448
 
1346
1449
  Start the integration Playground with `bun run playground`. The full pull
@@ -1359,6 +1462,8 @@ without hard-coded return URLs.
1359
1462
 
1360
1463
  - [Live Playground](https://a3s-lab.github.io/Office/)
1361
1464
  - [Documentation center](https://a3s-lab.github.io/Office/docs/)
1465
+ - [A3S Office 0.13.1 documentation](https://a3s-lab.github.io/Office/docs/0.13.1/)
1466
+ - [A3S Office 0.13.0 documentation](https://a3s-lab.github.io/Office/docs/0.13.0/)
1362
1467
  - [A3S Office 0.12.0 documentation](https://a3s-lab.github.io/Office/docs/0.12.0/)
1363
1468
  - [A3S Office 0.11.0 documentation](https://a3s-lab.github.io/Office/docs/0.11.0/)
1364
1469
  - [A3S Office 0.10.0 documentation](https://a3s-lab.github.io/Office/docs/0.10.0/)
package/dist/0~1403.js CHANGED
@@ -125,6 +125,19 @@ function presentationGroupPath(element) {
125
125
  const DEFAULT_PRESENTATION_MASTER_ID = 'presentation-master-default';
126
126
  const DEFAULT_PRESENTATION_LAYOUT_ID = 'presentation-layout-default';
127
127
  function withPresentationDesign(content) {
128
+ const designContent = withPresentationDesignMetadata(content);
129
+ const layoutIds = new Set(designContent.layouts.map((layout)=>layout.id));
130
+ const firstLayoutId = designContent.layouts[0].id;
131
+ return {
132
+ ...designContent,
133
+ slides: designContent.slides.map((slide)=>({
134
+ ...slide,
135
+ layoutId: slide.layoutId && layoutIds.has(slide.layoutId) ? slide.layoutId : firstLayoutId,
136
+ useLayoutBackground: slide.useLayoutBackground ?? false
137
+ }))
138
+ };
139
+ }
140
+ function withPresentationDesignMetadata(content) {
128
141
  const masters = content.masters?.length ? content.masters : [
129
142
  {
130
143
  id: DEFAULT_PRESENTATION_MASTER_ID,
@@ -146,23 +159,18 @@ function withPresentationDesign(content) {
146
159
  elements: []
147
160
  }
148
161
  ];
149
- const layoutIds = new Set(layouts.map((layout)=>layout.id));
150
- const firstLayoutId = layouts[0].id;
151
162
  return {
152
163
  ...content,
153
164
  masters,
154
- layouts,
155
- slides: content.slides.map((slide)=>({
156
- ...slide,
157
- layoutId: slide.layoutId && layoutIds.has(slide.layoutId) ? slide.layoutId : firstLayoutId,
158
- useLayoutBackground: slide.useLayoutBackground ?? false
159
- }))
165
+ layouts
160
166
  };
161
167
  }
162
168
  function presentationSlideView(content, slide) {
163
- const normalized = withPresentationDesign(content);
164
- const layout = normalized.layouts?.find((candidate)=>candidate.id === slide.layoutId) ?? normalized.layouts?.[0];
165
- const master = normalized.masters?.find((candidate)=>candidate.id === layout?.masterId) ?? normalized.masters?.[0];
169
+ return presentationSlideViewFromDesign(withPresentationDesign(content), slide);
170
+ }
171
+ function presentationSlideViewFromDesign(designContent, slide) {
172
+ const layout = designContent.layouts.find((candidate)=>candidate.id === slide.layoutId) ?? designContent.layouts[0];
173
+ const master = designContent.masters.find((candidate)=>candidate.id === layout?.masterId) ?? designContent.masters[0];
166
174
  const showMasterElements = false !== slide.showMasterElements && layout?.showMasterElements !== false;
167
175
  const masterElements = showMasterElements ? master?.elements ?? [] : [];
168
176
  const layoutElements = layout?.elements ?? [];
@@ -242,4 +250,4 @@ function structuredCopy(value) {
242
250
  if ('function' == typeof structuredClone) return structuredClone(value);
243
251
  return JSON.parse(JSON.stringify(value));
244
252
  }
245
- export { applyPresentationLayout, canGroupPresentationElements, canUngroupPresentationElements, expandPresentationGroupSelection, groupPresentationElements, presentationGroupPath, presentationSelectionUnits, presentationSlideView, remapPresentationGroupPaths, ungroupPresentationElements, withPresentationDesign };
253
+ export { applyPresentationLayout, canGroupPresentationElements, canUngroupPresentationElements, expandPresentationGroupSelection, groupPresentationElements, presentationGroupPath, presentationSelectionUnits, presentationSlideView, presentationSlideViewFromDesign, remapPresentationGroupPaths, ungroupPresentationElements, withPresentationDesign, withPresentationDesignMetadata };