pptx-svelte-viewer 2.17.8 → 2.18.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/{AiChatPanel-CqrEXLmH.js → AiChatPanel-D6dfMwnT.js} +1 -1
  3. package/dist/{export-DxMXX_It.js → export-DbSAFc8m.js} +63641 -58874
  4. package/dist/i18n.js +1 -1
  5. package/dist/index.d.ts +166 -17
  6. package/dist/index.js +2 -2
  7. package/dist/pptx-svelte-viewer.css +1 -1
  8. package/dist/{translator-CZy5sxU0.js → translator-CZ12ZvlE.js} +20 -0
  9. package/dist/viewer/components/props-editing.d.ts +14 -0
  10. package/dist/viewer/components/props-editing.d.ts.map +1 -1
  11. package/dist/viewer/components/ribbon/transitions/transition-presets.d.ts +13 -6
  12. package/dist/viewer/components/ribbon/transitions/transition-presets.d.ts.map +1 -1
  13. package/dist/viewer/components/viewer-body-commits.d.ts +6 -0
  14. package/dist/viewer/components/viewer-body-commits.d.ts.map +1 -1
  15. package/dist/viewer/editor/context-menu-dispatch.d.ts.map +1 -1
  16. package/dist/viewer/editor/editor-adjust-gesture.d.ts +21 -0
  17. package/dist/viewer/editor/editor-adjust-gesture.d.ts.map +1 -0
  18. package/dist/viewer/editor/editor-arrange-ops.d.ts.map +1 -1
  19. package/dist/viewer/editor/editor-controller-wiring.d.ts +21 -0
  20. package/dist/viewer/editor/editor-controller-wiring.d.ts.map +1 -1
  21. package/dist/viewer/editor/editor-controller.svelte.d.ts +8 -0
  22. package/dist/viewer/editor/editor-controller.svelte.d.ts.map +1 -1
  23. package/dist/viewer/editor/editor-document-lifecycle.d.ts.map +1 -1
  24. package/dist/viewer/editor/editor-document-state.d.ts +16 -2
  25. package/dist/viewer/editor/editor-document-state.d.ts.map +1 -1
  26. package/dist/viewer/editor/editor-handle-handlers.d.ts +42 -0
  27. package/dist/viewer/editor/editor-handle-handlers.d.ts.map +1 -0
  28. package/dist/viewer/editor/editor-master-controller.d.ts +2 -0
  29. package/dist/viewer/editor/editor-master-controller.d.ts.map +1 -1
  30. package/dist/viewer/editor/editor-selection-gestures.d.ts +8 -1
  31. package/dist/viewer/editor/editor-selection-gestures.d.ts.map +1 -1
  32. package/dist/viewer/editor/editor-selection-interactivity.d.ts +43 -0
  33. package/dist/viewer/editor/editor-selection-interactivity.d.ts.map +1 -0
  34. package/dist/viewer/editor/editor-slides-controller.d.ts +8 -1
  35. package/dist/viewer/editor/editor-slides-controller.d.ts.map +1 -1
  36. package/dist/viewer/editor/editor-state.svelte.d.ts +66 -2
  37. package/dist/viewer/editor/editor-state.svelte.d.ts.map +1 -1
  38. package/dist/viewer/editor/editor-transition-controller.d.ts +12 -0
  39. package/dist/viewer/editor/editor-transition-controller.d.ts.map +1 -1
  40. package/dist/viewer/editor/index.d.ts +9 -0
  41. package/dist/viewer/editor/index.d.ts.map +1 -1
  42. package/dist/viewer/editor/inline-text.d.ts.map +1 -1
  43. package/dist/viewer/editor/table-cell-pointer.d.ts +24 -0
  44. package/dist/viewer/editor/table-cell-pointer.d.ts.map +1 -0
  45. package/dist/viewer/editor/table-cell-selection.svelte.d.ts +51 -0
  46. package/dist/viewer/editor/table-cell-selection.svelte.d.ts.map +1 -0
  47. package/dist/viewer/index.d.ts +463 -17
  48. package/dist/viewer/index.js +1 -1
  49. package/dist/viewer/master/master-view.d.ts +8 -1
  50. package/dist/viewer/master/master-view.d.ts.map +1 -1
  51. package/dist/viewer/render/index.d.ts +2 -2
  52. package/dist/viewer/render/index.d.ts.map +1 -1
  53. package/dist/viewer/render/smartart-view.d.ts +6 -5
  54. package/dist/viewer/render/smartart-view.d.ts.map +1 -1
  55. package/dist/viewer/render/table-view.d.ts +6 -0
  56. package/dist/viewer/render/table-view.d.ts.map +1 -1
  57. package/dist/viewer/state/autosave.svelte.d.ts +9 -0
  58. package/dist/viewer/state/autosave.svelte.d.ts.map +1 -1
  59. package/dist/viewer/state/create-viewer-state-collab.svelte.d.ts.map +1 -1
  60. package/dist/viewer/state/create-viewer-state-presentation.svelte.d.ts.map +1 -1
  61. package/dist/viewer/state/create-viewer-state.svelte.d.ts.map +1 -1
  62. package/dist/viewer/state/index.d.ts +2 -0
  63. package/dist/viewer/state/index.d.ts.map +1 -1
  64. package/dist/viewer/state/table-cell-selection-context.d.ts +20 -0
  65. package/dist/viewer/state/table-cell-selection-context.d.ts.map +1 -0
  66. package/dist/viewer/state/viewer-effects.svelte.d.ts.map +1 -1
  67. package/dist/viewer/style/element-style.d.ts.map +1 -1
  68. package/package.json +1 -1
package/dist/i18n.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as s, c as e, i as t, n as r, o, r as n, s as i, t as l } from "./translator-CZy5sxU0.js";
1
+ import { a as s, c as e, i as t, n as r, o, r as n, s as i, t as l } from "./translator-CZ12ZvlE.js";
2
2
  export {
3
3
  o as LOCALE_CATALOG,
4
4
  l as createTranslator,
package/dist/index.d.ts CHANGED
@@ -1639,7 +1639,28 @@ interface BulletInfo {
1639
1639
  autoNumType?: string;
1640
1640
  /** Auto-numbering start value. */
1641
1641
  autoNumStartAt?: number;
1642
- /** Zero-based paragraph index within the text body (for auto-numbering). */
1642
+ /**
1643
+ * Auto-numbering ORDINAL OFFSET: the zero-based distance of this paragraph
1644
+ * within its own numbered list, such that
1645
+ * `autoNumStartAt + paragraphIndex` is the ordinal to render. Despite the
1646
+ * name it is NOT the paragraph's position in the text body; the two agree
1647
+ * only for a list that starts at the first paragraph and is never
1648
+ * interrupted.
1649
+ *
1650
+ * It has to be the offset rather than the raw position because every
1651
+ * consumer that re-derives a marker from `BulletInfo` alone (the renderer's
1652
+ * `resolveParagraphBullet`, the Markdown converter's `resolveListMarker`)
1653
+ * computes `autoNumStartAt + paragraphIndex`. The load path resolves the
1654
+ * real sequence itself, restarting the count after any paragraph that
1655
+ * interrupts the list, and publishes the offset here so those consumers
1656
+ * land on the same number. With the raw position they did not, and BOTH
1657
+ * markers were painted ("3.1. Item"), because the paragraph builder drops
1658
+ * the parsed marker segment only when the two strings agree.
1659
+ *
1660
+ * Runtime-only: derived at parse time and never serialized. OOXML has no
1661
+ * counterpart (`a:buAutoNum` carries only `@type` and `@startAt`), so the
1662
+ * writer neither reads nor emits it.
1663
+ */
1643
1664
  paragraphIndex?: number;
1644
1665
  /** Bullet font family from `a:buFont`. */
1645
1666
  fontFamily?: string;
@@ -3934,6 +3955,11 @@ interface PptxTableCellStyle {
3934
3955
  italic?: boolean;
3935
3956
  underline?: boolean;
3936
3957
  color?: string;
3958
+ /**
3959
+ * Font family from the first run's `a:rPr/a:latin@typeface` (falling back to
3960
+ * `a:ea` / `a:cs`). Per-run families live on {@link PptxTableCellTextRun}.
3961
+ */
3962
+ fontFamily?: string;
3937
3963
  /**
3938
3964
  * Raw XML colour-choice node preserved from `a:tc/a:txBody/.../a:rPr/a:solidFill`
3939
3965
  * for round-trip serialisation. Currently unused by the cell-level writer
@@ -4089,6 +4115,45 @@ interface PptxTableCell3D {
4089
4115
  /** Light rig direction (`a:lightRig@dir`, e.g. `tl`, `t`, `tr`). */
4090
4116
  lightRigDirection?: string;
4091
4117
  }
4118
+ /**
4119
+ * One styled text run inside a table cell's `a:txBody`.
4120
+ *
4121
+ * `PptxTableCell.text` is a flat string and `PptxTableCell.style` describes
4122
+ * only the FIRST run, so a cell mixing formats ("Revenue **grew 42%** last
4123
+ * year") cannot be represented by those two alone. {@link PptxTableCell.runs}
4124
+ * carries the full sequence, with paragraph and line breaks as marker entries
4125
+ * so a renderer can walk it linearly.
4126
+ *
4127
+ * Structurally identical to `pptx-viewer-shared`'s `CellTextRun`, which every
4128
+ * binding's table renderer already consumes.
4129
+ *
4130
+ * @example
4131
+ * ```ts
4132
+ * const runs: PptxTableCellTextRun[] = [
4133
+ * { text: "Revenue " },
4134
+ * { text: "grew 42%", bold: true, color: "#C00000" },
4135
+ * ];
4136
+ * // => satisfies PptxTableCellTextRun[]
4137
+ * ```
4138
+ */
4139
+ interface PptxTableCellTextRun {
4140
+ /** Run text. Empty for the break markers below. */
4141
+ text: string;
4142
+ /** This entry starts a new paragraph (`a:p` boundary) rather than carrying text. */
4143
+ isParagraphBreak?: boolean;
4144
+ /** This entry is a soft line break (`a:br`) rather than carrying text. */
4145
+ isLineBreak?: boolean;
4146
+ bold?: boolean;
4147
+ italic?: boolean;
4148
+ underline?: boolean;
4149
+ strikethrough?: boolean;
4150
+ /** Resolved run colour as a CSS colour string. */
4151
+ color?: string;
4152
+ /** Run font size in points (`a:rPr@sz` / 100). */
4153
+ fontSize?: number;
4154
+ /** Run font family from `a:rPr/a:latin@typeface` (or `a:ea` / `a:cs`). */
4155
+ fontFamily?: string;
4156
+ }
4092
4157
  /**
4093
4158
  * A single table cell with text content, optional style, and merge info.
4094
4159
  *
@@ -4105,6 +4170,15 @@ interface PptxTableCell3D {
4105
4170
  interface PptxTableCell {
4106
4171
  text: string;
4107
4172
  style?: PptxTableCellStyle;
4173
+ /**
4174
+ * Per-run formatting for the cell's text, when it has any beyond what
4175
+ * {@link style} can express. Present only for cells whose `a:txBody`
4176
+ * actually carries runs; renderers fall back to {@link text} when absent.
4177
+ *
4178
+ * Editing a cell's text invalidates these (the editor produces a plain
4179
+ * string), so an edit path must clear them alongside setting `text`.
4180
+ */
4181
+ textRuns?: PptxTableCellTextRun[];
4108
4182
  /** Column span (defaults to 1). */
4109
4183
  gridSpan?: number;
4110
4184
  /** Row span (defaults to 1). */
@@ -4884,6 +4958,35 @@ interface UnknownPptxElement extends PptxElementBase {
4884
4958
  type PptxElement = TextPptxElement | ShapePptxElement | ConnectorPptxElement | ImagePptxElement | PicturePptxElement | TablePptxElement | ChartPptxElement | SmartArtPptxElement | OlePptxElement | MediaPptxElement | GroupPptxElement | InkPptxElement | ContentPartPptxElement | ZoomPptxElement | Model3DPptxElement | UnknownPptxElement;
4885
4959
  //#endregion
4886
4960
  //#region src/core/types/masters.d.ts
4961
+ /**
4962
+ * A placeholder slot declared on a master or layout.
4963
+ *
4964
+ * The geometry fields are in CSS pixels (EMU / {@link EMU_PER_PX}) and are only
4965
+ * present when the shape carried an explicit `a:xfrm`. Placeholders that
4966
+ * inherit their frame from the master leave them undefined, so consumers that
4967
+ * draw placeholder outlines (the layout gallery) must skip those entries
4968
+ * rather than assume a zero-sized box at the origin.
4969
+ *
4970
+ * @example
4971
+ * ```ts
4972
+ * const frame: PptxPlaceholderFrame = { type: "body", idx: "1", x: 63, y: 130 };
4973
+ * // => satisfies PptxPlaceholderFrame
4974
+ * ```
4975
+ */
4976
+ interface PptxPlaceholderFrame {
4977
+ /** `p:ph/@type`, lower-cased by the parser; defaults to `body` when omitted. */
4978
+ type: string;
4979
+ /** `p:ph/@idx`, when present. */
4980
+ idx?: string;
4981
+ /** Left offset in CSS pixels, when the shape declares `a:off`. */
4982
+ x?: number;
4983
+ /** Top offset in CSS pixels, when the shape declares `a:off`. */
4984
+ y?: number;
4985
+ /** Width in CSS pixels, when the shape declares `a:ext`. */
4986
+ width?: number;
4987
+ /** Height in CSS pixels, when the shape declares `a:ext`. */
4988
+ height?: number;
4989
+ }
4887
4990
  /**
4888
4991
  * Parsed notes master from `ppt/notesMasters/notesMaster1.xml`.
4889
4992
  *
@@ -4905,10 +5008,7 @@ interface PptxNotesMaster {
4905
5008
  /** Background image data URL. */
4906
5009
  backgroundImage?: string;
4907
5010
  /** Placeholder shapes found on the notes master. */
4908
- placeholders?: Array<{
4909
- type: string;
4910
- idx?: string;
4911
- }>;
5011
+ placeholders?: PptxPlaceholderFrame[];
4912
5012
  /** Editable elements on the notes master (header, footer, date, page number, slide image, notes body). */
4913
5013
  elements?: PptxElement[];
4914
5014
  /** Header/footer flags from `<p:hf>` on the notes master (P-H3). */
@@ -4936,10 +5036,7 @@ interface PptxHandoutMaster {
4936
5036
  /** Background image data URL. */
4937
5037
  backgroundImage?: string;
4938
5038
  /** Placeholder shapes found on the handout master. */
4939
- placeholders?: Array<{
4940
- type: string;
4941
- idx?: string;
4942
- }>;
5039
+ placeholders?: PptxPlaceholderFrame[];
4943
5040
  /** Editable elements on the handout master (header, footer, date, page number, slide placeholders). */
4944
5041
  elements?: PptxElement[];
4945
5042
  /** Number of slides per page for handout print layout (1, 2, 3, 4, 6, or 9). */
@@ -4977,10 +5074,7 @@ interface PptxSlideMaster {
4977
5074
  /** Layout paths associated with this master. */
4978
5075
  layoutPaths?: string[];
4979
5076
  /** Placeholder shapes on the master. */
4980
- placeholders?: Array<{
4981
- type: string;
4982
- idx?: string;
4983
- }>;
5077
+ placeholders?: PptxPlaceholderFrame[];
4984
5078
  /** Parsed element shapes on the master slide (for master view rendering). */
4985
5079
  elements?: PptxElement[];
4986
5080
  /** Parsed slide layout objects associated with this master. */
@@ -5052,10 +5146,7 @@ interface PptxSlideLayout {
5052
5146
  /** Parsed element shapes on the layout. */
5053
5147
  elements?: PptxElement[];
5054
5148
  /** Placeholder shapes on the layout. */
5055
- placeholders?: Array<{
5056
- type: string;
5057
- idx?: string;
5058
- }>;
5149
+ placeholders?: PptxPlaceholderFrame[];
5059
5150
  /** Matching name attribute for layout identification (`@matchingName`). */
5060
5151
  matchingName?: string;
5061
5152
  /** Whether the layout is marked as preserved (prevent deletion, `@preserve`). */
@@ -5069,6 +5160,42 @@ interface PptxSlideLayout {
5069
5160
  /** Header/footer flags from `<p:hf>` on this layout (P-H3). */
5070
5161
  headerFooter?: PptxHeaderFooterFlags;
5071
5162
  }
5163
+ /**
5164
+ * Rendered content of a single layout, used to draw gallery thumbnails.
5165
+ *
5166
+ * Produced on demand rather than during load: materialising every layout's
5167
+ * artwork (and decoding its images) up front costs a noticeable amount of time
5168
+ * on decks with many masters, and most sessions never open the layout gallery
5169
+ * at all.
5170
+ *
5171
+ * @example
5172
+ * ```ts
5173
+ * const preview: PptxLayoutPreview = {
5174
+ * path: "ppt/slideLayouts/slideLayout2.xml",
5175
+ * width: 960,
5176
+ * height: 540,
5177
+ * elements: [],
5178
+ * placeholders: [{ type: "title" }],
5179
+ * };
5180
+ * // => satisfies PptxLayoutPreview
5181
+ * ```
5182
+ */
5183
+ interface PptxLayoutPreview {
5184
+ /** ZIP path of the layout this preview belongs to. */
5185
+ path: string;
5186
+ /** Slide width in CSS pixels, so a thumbnail can compute its own scale. */
5187
+ width: number;
5188
+ /** Slide height in CSS pixels. */
5189
+ height: number;
5190
+ /** Background resolved from the layout, falling back to its master's. */
5191
+ backgroundColor?: string;
5192
+ /** Background image data URL, when the layout or master declares one. */
5193
+ backgroundImage?: string;
5194
+ /** The layout's own artwork (pictures, shapes and static text). */
5195
+ elements: PptxElement[];
5196
+ /** Placeholder slots, drawn as outlined frames in the gallery. */
5197
+ placeholders: PptxPlaceholderFrame[];
5198
+ }
5072
5199
  /**
5073
5200
  * A theme part available in the presentation package.
5074
5201
  *
@@ -7688,6 +7815,8 @@ interface IPptxHandlerRuntime {
7688
7815
  revokeBlobUrls(): void;
7689
7816
  getCompatibilityWarnings(): PptxCompatibilityWarning[];
7690
7817
  getLayoutOptions(): PptxLayoutOption[];
7818
+ getLayoutPreview(layoutPath: string): Promise<PptxLayoutPreview | null>;
7819
+ getLayoutPreviews(layoutPaths?: readonly string[]): Promise<PptxLayoutPreview[]>;
7691
7820
  createXmlBuilder(data: PptxData): PptxXmlBuilder;
7692
7821
  Builder(data: PptxData): PptxXmlBuilder;
7693
7822
  setTemplateBackground(path: string, backgroundColor: string | undefined): void;
@@ -7876,6 +8005,26 @@ declare class PptxHandlerCore {
7876
8005
  * @returns Array of {@link PptxLayoutOption} entries.
7877
8006
  */
7878
8007
  getLayoutOptions(): PptxLayoutOption[];
8008
+ /**
8009
+ * Build the artwork thumbnails backing the New Slide / Layout galleries.
8010
+ *
8011
+ * Parsing happens on first request and is memoised afterwards, so opening
8012
+ * the gallery costs one pass over the layout parts and reopening it costs
8013
+ * nothing. Callers that only need one entry should prefer
8014
+ * {@link getLayoutPreview}.
8015
+ *
8016
+ * @param layoutPaths - Restrict the result to these layouts; defaults to
8017
+ * every layout in the presentation.
8018
+ * @returns One {@link PptxLayoutPreview} per resolvable layout.
8019
+ */
8020
+ getLayoutPreviews(layoutPaths?: readonly string[]): Promise<PptxLayoutPreview[]>;
8021
+ /**
8022
+ * Build the artwork thumbnail for a single layout.
8023
+ *
8024
+ * @param layoutPath - Archive path of the `p:sldLayout` part.
8025
+ * @returns The preview, or `null` when the presentation has no such layout.
8026
+ */
8027
+ getLayoutPreview(layoutPath: string): Promise<PptxLayoutPreview | null>;
7879
8028
  /**
7880
8029
  * Create a fluent XML builder scoped to the given presentation data.
7881
8030
  *
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as e, G as o, H as a, J as t, K as i, Q as r, U as l, W as n, X as S, Y as m, Z as d, a as p, at as v, c as g, et as T, it as h, l as u, nt as k, o as D, ot as c, q as f, rt as x, s as A, t as C, tt as b } from "./export-DxMXX_It.js";
2
- import { i as V } from "./translator-CZy5sxU0.js";
1
+ import { $ as e, G as o, H as a, J as t, K as i, Q as r, U as l, W as n, X as S, Y as m, Z as d, a as p, at as v, c as g, et as T, it as h, l as u, nt as k, o as D, ot as c, q as f, rt as x, s as A, t as C, tt as b } from "./export-DbSAFc8m.js";
2
+ import { i as V } from "./translator-CZ12ZvlE.js";
3
3
  import "./i18n.js";
4
4
  export {
5
5
  C as PowerPointViewer,