@officedk/pptxdk 0.2.0 → 0.2.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/dist/build.d.ts +5 -8
- package/dist/build.js +44 -52
- package/dist/core/dist/capabilities/audio/audio-declaration.js +7 -0
- package/dist/core/dist/capabilities/audio/audio-source.js +172 -0
- package/dist/core/dist/capabilities/audio/entry.js +122 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box-codegen.js +7 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box-declaration.js +8 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/box/box.js +14 -15
- package/dist/core/dist/capabilities/box/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-codegen.js +11 -18
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-import.js +891 -468
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-labels.js +30 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-model.js +1 -1
- package/dist/{capabilities/dist/chart/preview/number-format.js → core/dist/capabilities/chart/chart-number-format.js} +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-schemas.js +73 -79
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart-xml.js +41 -36
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/chart.js +175 -113
- package/dist/core/dist/capabilities/chart/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/axes-and-grid.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/bar-column.js +1 -1
- package/dist/core/dist/capabilities/chart/preview/data-labels.js +474 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/error-bars.js +3 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/index.js +28 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/layout.js +7 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/legend.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/line-area.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/markers.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/pie-doughnut.js +39 -60
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scales.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/scatter.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/style.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/text-render.js +34 -24
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/trendlines.js +3 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/chart/preview/types.js +1 -1
- package/dist/core/dist/capabilities/comment/comment-codegen.js +25 -0
- package/dist/core/dist/capabilities/comment/comment-declaration.js +37 -0
- package/dist/core/dist/capabilities/comment/comment-import.js +176 -0
- package/dist/core/dist/capabilities/comment/comment.js +141 -0
- package/dist/core/dist/capabilities/comment/entry.js +1 -0
- package/dist/core/dist/capabilities/footer-placeholder/entry.js +2 -0
- package/dist/core/dist/capabilities/footer-placeholder/footer-placeholder-codegen.js +16 -0
- package/dist/{capabilities/dist/masters → core/dist/capabilities/footer-placeholder}/footer-placeholder.js +113 -50
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer-import.js +121 -0
- package/dist/core/dist/capabilities/footer-placeholder/print-header-footer.js +123 -0
- package/dist/core/dist/capabilities/group/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-codegen.js +6 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-declaration.js +8 -8
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-import.js +36 -77
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/group/group.js +17 -17
- package/dist/core/dist/capabilities/image/entry.js +4 -0
- package/dist/core/dist/capabilities/image/image-codegen.js +59 -0
- package/dist/core/dist/capabilities/image/image-declaration.js +8 -0
- package/dist/core/dist/capabilities/image/image-import.js +26 -0
- package/dist/core/dist/capabilities/image/image.js +57 -0
- package/dist/core/dist/capabilities/line/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-codegen.js +6 -7
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-declaration.js +15 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-import.js +15 -95
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/line/line.js +41 -43
- package/dist/core/dist/capabilities/masters/entry.js +1 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters-codegen.js +7 -26
- package/dist/{capabilities/dist → core/dist/capabilities}/masters/masters.js +23 -35
- package/dist/core/dist/capabilities/motion/entry.js +5 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-codegen.js +15 -35
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-import.js +25 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-plan.js +17 -14
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion-query.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/motion/motion.js +79 -75
- package/dist/core/dist/capabilities/notes/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-codegen.js +4 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-import.js +16 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes-schemas.js +6 -6
- package/dist/{capabilities/dist → core/dist/capabilities}/notes/notes.js +16 -41
- package/dist/{import/dist/sections.js → core/dist/capabilities/notes/sections-import.js} +5 -5
- package/dist/core/dist/capabilities/placeholder/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-codegen.js +5 -15
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder-schemas.js +7 -9
- package/dist/{capabilities/dist → core/dist/capabilities}/placeholder/placeholder.js +50 -107
- package/dist/core/dist/capabilities/shape/entry.js +6 -0
- package/dist/core/dist/capabilities/shape/shape-codegen.js +112 -0
- package/dist/core/dist/capabilities/shape/shape-import.js +152 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape-xml.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/shape/shape.js +44 -30
- package/dist/core/dist/capabilities/shared/container-slots.js +59 -0
- package/dist/core/dist/capabilities/shared/date-time.js +98 -0
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-embedding.js +5 -6
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-engine.js +34 -13
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-import.js +62 -23
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font-subset.js +24 -9
- package/dist/{capabilities/dist → core/dist/capabilities/shared}/font/font.js +4 -4
- package/dist/core/dist/capabilities/shared/geometry-codegen.js +101 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/geometry.js +47 -44
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/identity.js +56 -38
- package/dist/core/dist/capabilities/shared/image-codegen.js +94 -0
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-decode.js +17 -79
- package/dist/{capabilities/dist/image → core/dist/capabilities/shared}/image-schemas.js +16 -26
- package/dist/core/dist/capabilities/shared/line-match.js +78 -0
- package/dist/core/dist/capabilities/shared/media-codegen.js +86 -0
- package/dist/core/dist/capabilities/shared/media-import.js +156 -0
- package/dist/core/dist/capabilities/shared/media-placement.js +20 -0
- package/dist/core/dist/capabilities/shared/media-poster.js +50 -0
- package/dist/core/dist/capabilities/shared/media-schemas.js +60 -0
- package/dist/core/dist/capabilities/shared/media-source.js +107 -0
- package/dist/core/dist/capabilities/shared/media-trim.js +102 -0
- package/dist/core/dist/capabilities/shared/media.js +134 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/morph-api.js +5 -5
- package/dist/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-api.js +112 -99
- package/dist/{capabilities/dist/motion → core/dist/capabilities/shared}/motion-schemas.js +19 -5
- package/dist/{capabilities/dist/image/image-import.js → core/dist/capabilities/shared/picture-import.js} +97 -158
- package/dist/core/dist/capabilities/shared/picture-xml.js +13 -0
- package/dist/core/dist/capabilities/shared/picture.js +510 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/placeholder-import.js +50 -20
- package/dist/core/dist/capabilities/shared/placeholder-roles.js +42 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/preset-definitions.js +1 -1
- package/dist/core/dist/capabilities/shared/print-xml.js +77 -0
- package/dist/{capabilities/dist/text/text-codegen.js → core/dist/capabilities/shared/rich-text-codegen.js} +23 -102
- package/dist/core/dist/capabilities/shared/rich-text-import.js +472 -0
- package/dist/{capabilities/dist/shape → core/dist/capabilities/shared}/shape-declaration.js +14 -14
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/style-inheritance.js +12 -5
- package/dist/{capabilities/dist/text → core/dist/capabilities/shared}/text-declaration.js +7 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-schemas.js +77 -77
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/text-service.js +571 -260
- package/dist/{capabilities/dist → core/dist/capabilities}/shared/visual.js +137 -112
- package/dist/core/dist/capabilities/slide-background/entry.js +1 -0
- package/dist/core/dist/capabilities/slide-background/slide-background-codegen.js +15 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-import.js +5 -5
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background-xml.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/slide-background/slide-background.js +27 -33
- package/dist/core/dist/capabilities/table/entry.js +2 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-codegen.js +6 -13
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-declaration.js +2 -2
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-import.js +22 -57
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-schemas.js +40 -37
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table-xml.js +9 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/table/table.js +60 -45
- package/dist/core/dist/capabilities/text/entry.js +3 -0
- package/dist/core/dist/capabilities/text/text-codegen.js +66 -0
- package/dist/core/dist/capabilities/text/text-import.js +468 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text-xml.js +3 -4
- package/dist/{capabilities/dist → core/dist/capabilities}/text/text.js +61 -54
- package/dist/core/dist/capabilities/transition/entry.js +3 -0
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-api.js +1 -1
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-codegen.js +2 -3
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition-import.js +25 -27
- package/dist/{capabilities/dist → core/dist/capabilities}/transition/transition.js +23 -23
- package/dist/core/dist/capabilities/video/entry.js +77 -0
- package/dist/core/dist/capabilities/video/video-declaration.js +7 -0
- package/dist/core/dist/capabilities/video/video-source.js +42 -0
- package/dist/{codegen/dist → core/dist/codegen}/assets.js +13 -8
- package/dist/{codegen/dist → core/dist/codegen}/codegen.js +54 -122
- package/dist/{codegen/dist → core/dist/codegen}/identifiers.js +17 -1
- package/dist/{codegen/dist → core/dist/codegen}/index.js +2 -2
- package/dist/{codegen/dist → core/dist/codegen}/printer.js +23 -4
- package/dist/core/dist/document/all.js +41 -0
- package/dist/core/dist/document/default.js +10 -0
- package/dist/core/dist/document/document.js +218 -0
- package/dist/core/dist/document/index.js +62 -0
- package/dist/core/dist/document/stages.js +54 -0
- package/dist/{emit/dist → core/dist/emit}/emit.js +122 -60
- package/dist/core/dist/emit/index.js +6 -0
- package/dist/core/dist/emit/ooxml.js +241 -0
- package/dist/{import/dist → core/dist/import}/import.js +221 -187
- package/dist/core/dist/import/index.js +19 -0
- package/dist/{import/dist → core/dist/import}/masters.js +253 -317
- package/dist/core/dist/import/media-timing.js +233 -0
- package/dist/{import/dist → core/dist/import}/notes-masters.js +48 -45
- package/dist/core/dist/index.js +47 -15
- package/dist/core/dist/{author-ids.js → kernel/author-ids.js} +1 -1
- package/dist/core/dist/{author-schemas.js → kernel/author-schemas.js} +59 -98
- package/dist/core/dist/{block-flex-layout.js → kernel/block-flex-layout.js} +109 -78
- package/dist/core/dist/kernel/build.js +4 -0
- package/dist/core/dist/kernel/capability.js +17 -0
- package/dist/{codegen/dist/types.js → core/dist/kernel/codegen.js} +22 -2
- package/dist/core/dist/kernel/container-slots.js +104 -0
- package/dist/core/dist/kernel/date-time-format.js +18 -0
- package/dist/core/dist/kernel/declaration-snapshot.js +68 -0
- package/dist/core/dist/{declaration.js → kernel/declaration.js} +1 -1
- package/dist/core/dist/{diagnostics.js → kernel/diagnostics.js} +22 -5
- package/dist/core/dist/{document-internals.js → kernel/document-internals.js} +1 -1
- package/dist/core/dist/{document.js → kernel/document.js} +6 -5
- package/dist/core/dist/kernel/drawing-units.js +14 -0
- package/dist/core/dist/{font-seal.js → kernel/font-seal.js} +2 -2
- package/dist/core/dist/{geometry-schemas.js → kernel/geometry-schemas.js} +2 -6
- package/dist/core/dist/{grid-layout.js → kernel/grid-layout.js} +156 -55
- package/dist/core/dist/{host.js → kernel/host.js} +1 -1
- package/dist/core/dist/kernel/index.js +24 -0
- package/dist/core/dist/{input-values.js → kernel/input-values.js} +4 -3
- package/dist/core/dist/kernel/layout-definition.js +7 -0
- package/dist/core/dist/{layout-protocol.js → kernel/layout-protocol.js} +1 -1
- package/dist/core/dist/{layout-schemas.js → kernel/layout-schemas.js} +2 -6
- package/dist/core/dist/{layout.js → kernel/layout.js} +37 -38
- package/dist/core/dist/{masters.js → kernel/masters.js} +32 -55
- package/dist/core/dist/{morph.js → kernel/morph.js} +1 -1
- package/dist/core/dist/{placeholders.js → kernel/placeholders.js} +23 -9
- package/dist/{import/dist → core/dist/kernel/pptx-read}/alternate-content.js +1 -1
- package/dist/{import/dist → core/dist/kernel/pptx-read}/diagnostics.js +1 -1
- package/dist/core/dist/kernel/pptx-read/drawing-list-import.js +251 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/fonts.js +1 -1
- package/dist/core/dist/kernel/pptx-read/index.js +15 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/mechanism.js +1 -1
- package/dist/core/dist/kernel/pptx-read/media.js +26 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/namespaces.js +5 -7
- package/dist/{import/dist → core/dist/kernel/pptx-read}/opc.js +62 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/resources.js +1 -1
- package/dist/core/dist/kernel/pptx-read/shape-tree.js +57 -0
- package/dist/{import/dist → core/dist/kernel/pptx-read}/themes.js +40 -5
- package/dist/{import/dist → core/dist/kernel/pptx-read}/visual.js +94 -67
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-fragments.js +56 -13
- package/dist/{import/dist → core/dist/kernel/pptx-read}/xml-reader.js +8 -1
- package/dist/{emit/dist → core/dist/kernel/pptx-write}/shape-tree.js +1 -1
- package/dist/core/dist/kernel/pptx-write/timing.js +52 -0
- package/dist/{emit/dist/ooxml.js → core/dist/kernel/pptx-write/xml.js} +62 -274
- package/dist/core/dist/{query.js → kernel/query.js} +5 -1
- package/dist/core/dist/{resolution.js → kernel/resolution.js} +1 -1
- package/dist/core/dist/kernel/resolve-work.js +58 -0
- package/dist/core/dist/{resolve.js → kernel/resolve.js} +226 -257
- package/dist/core/dist/kernel/resource-source.js +11 -0
- package/dist/core/dist/{stage-options.js → kernel/stage-options.js} +23 -11
- package/dist/core/dist/{theme.js → kernel/theme.js} +54 -36
- package/dist/core/dist/{transform-geometry.js → kernel/transform-geometry.js} +1 -1
- package/dist/core/dist/kernel/xml-values.js +13 -0
- package/dist/{document-41spD7bq.d.ts → document-C0lPlH-L.d.ts} +614 -522
- package/dist/{capability-BbKW9w4O.d.ts → index-B9_OUeA-.d.ts} +660 -553
- package/dist/{index-BEwhk7c8.d.ts → index-BJEzQxWV.d.ts} +27 -24
- package/dist/{index-cK2KtukZ.d.ts → index-DA9flrlR.d.ts} +2 -17
- package/dist/{index-v77CTJev.d.ts → index-GSt0t9VO.d.ts} +3 -4
- package/dist/index.d.ts +7 -8
- package/dist/index.js +68 -66
- package/dist/node.d.ts +16 -14
- package/dist/node.js +86 -43
- package/dist/pptxdk/src/cli-commands.js +9 -5
- package/dist/pptxdk/src/compose.js +28 -29
- package/dist/pptxdk/src/preview-result.js +24 -0
- package/dist/{capabilities/dist/image → preview/dist}/gif-decoder.js +5 -5
- package/dist/preview/dist/index.js +84 -34
- package/dist/preview/dist/options.js +8 -4
- package/dist/preview/dist/raster.js +66 -0
- package/dist/preview/dist/svg-guard.js +8 -7
- package/dist/preview.d.ts +3 -9
- package/dist/preview.js +7 -25
- package/dist/react/dist/append.js +3 -3
- package/dist/react/dist/author/audio-elements.js +14 -0
- package/dist/{capabilities/dist/box → react/dist/author}/box-elements.js +5 -3
- package/dist/react/dist/author/chart-elements.js +14 -0
- package/dist/react/dist/author/comment-elements.js +15 -0
- package/dist/react/dist/author/group-elements.js +14 -0
- package/dist/react/dist/author/image-elements.js +14 -0
- package/dist/react/dist/author/line-elements.js +14 -0
- package/dist/{capabilities/dist/motion → react/dist/author}/motion-elements.js +6 -4
- package/dist/react/dist/author/notes-elements.js +14 -0
- package/dist/react/dist/author/placeholder-elements.js +14 -0
- package/dist/react/dist/author/shape-elements.js +14 -0
- package/dist/{capabilities/dist/table → react/dist/author}/table-elements.js +6 -4
- package/dist/{capabilities/dist/text → react/dist/author}/text-elements.js +15 -5
- package/dist/react/dist/author/video-elements.js +14 -0
- package/dist/react/dist/document-adapter.js +4 -4
- package/dist/react/dist/elements.js +7 -4
- package/dist/react/dist/from-vanilla.js +3 -3
- package/dist/react/dist/index.js +17 -3
- package/dist/react/dist/reconciler.js +3 -3
- package/dist/react.d.ts +103 -69
- package/dist/react.js +28 -28
- package/dist/{index-1ag7U9Jt.d.ts → stages-DYHSHKt4.d.ts} +23 -6
- package/dist/vanilla.d.ts +4 -4
- package/dist/vanilla.js +14 -15
- package/package.json +2 -5
- package/dist/build-zrZuX4fK.d.ts +0 -3
- package/dist/capabilities/dist/all.js +0 -34
- package/dist/capabilities/dist/chart/chart-elements.js +0 -12
- package/dist/capabilities/dist/chart/preview/data-labels.js +0 -334
- package/dist/capabilities/dist/document.js +0 -168
- package/dist/capabilities/dist/group/group-elements.js +0 -12
- package/dist/capabilities/dist/image/image-codegen.js +0 -164
- package/dist/capabilities/dist/image/image-declaration.js +0 -8
- package/dist/capabilities/dist/image/image-elements.js +0 -12
- package/dist/capabilities/dist/image/image-xml.js +0 -12
- package/dist/capabilities/dist/image/image.js +0 -552
- package/dist/capabilities/dist/line/line-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-elements.js +0 -12
- package/dist/capabilities/dist/notes/notes-xml.js +0 -38
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +0 -13
- package/dist/capabilities/dist/shape/shape-codegen.js +0 -236
- package/dist/capabilities/dist/shape/shape-elements.js +0 -12
- package/dist/capabilities/dist/shape/shape-import.js +0 -628
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +0 -44
- package/dist/capabilities/dist/text/text-import.js +0 -1224
- package/dist/core/dist/build.js +0 -4
- package/dist/core/dist/capability.js +0 -15
- package/dist/emit/dist/index.js +0 -5
- package/dist/import/dist/index.js +0 -16
- package/dist/pptxdk/src/slide.js +0 -9
- package/dist/transition-6n8GZxSg.d.ts +0 -9
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import "../capability.js";
|
|
2
|
+
import { resolveFontClassification } from "../font-seal.js";
|
|
3
|
+
import { paragraphIndentToEmu, pxToEmu } from "../drawing-units.js";
|
|
4
|
+
import { resolvePlaceholderBoxFromLayers } from "../placeholders.js";
|
|
5
5
|
import { shapeTreeXml } from "./shape-tree.js";
|
|
6
|
+
import { defaultColorMap, isFont, isTextGradient, nativeColorSlots, schemeColorSlots } from "../theme.js";
|
|
6
7
|
import { createHash } from "node:crypto";
|
|
7
|
-
// ../
|
|
8
|
-
function pxToEmu(value) {
|
|
9
|
-
return Math.round(value * 9525);
|
|
10
|
-
}
|
|
8
|
+
// ../core/dist/kernel/pptx-write/xml.js
|
|
11
9
|
function assertXml10Characters(value) {
|
|
12
10
|
for (const character of value) {
|
|
13
11
|
const codePoint = character.codePointAt(0);
|
|
@@ -54,35 +52,6 @@ const namespaces = {
|
|
|
54
52
|
relationships: "http://schemas.openxmlformats.org/package/2006/relationships",
|
|
55
53
|
contentTypes: "http://schemas.openxmlformats.org/package/2006/content-types"
|
|
56
54
|
};
|
|
57
|
-
const minimumSlideLayoutId = 2147483648;
|
|
58
|
-
function relationships(entries) {
|
|
59
|
-
return xmlDocument(`<Relationships xmlns="${namespaces.relationships}">${entries.map(({ id, type, target, targetMode }) => `<Relationship Id="${xmlEscape(id)}" Type="${xmlEscape(type)}" Target="${xmlEscape(target)}"${targetMode === void 0 ? "" : ` TargetMode="${xmlEscape(targetMode)}"`}/>`).join("")}</Relationships>`);
|
|
60
|
-
}
|
|
61
|
-
const defaultEmittedMasters = [{
|
|
62
|
-
key: "master-1",
|
|
63
|
-
name: "Office Theme",
|
|
64
|
-
layouts: [{
|
|
65
|
-
key: "layout-1",
|
|
66
|
-
name: "Blank",
|
|
67
|
-
type: "blank",
|
|
68
|
-
preserve: true
|
|
69
|
-
}]
|
|
70
|
-
}];
|
|
71
|
-
function contentTypes(masterCount, layoutCount, themeCount, themeOverrideCount, slideCount, resources, packageParts, hasCoreProperties) {
|
|
72
|
-
const overrides = [
|
|
73
|
-
["/ppt/presentation.xml", "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"],
|
|
74
|
-
...Array.from({ length: masterCount }, (_, index) => [`/ppt/slideMasters/slideMaster${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"]),
|
|
75
|
-
...Array.from({ length: layoutCount }, (_, index) => [`/ppt/slideLayouts/slideLayout${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"]),
|
|
76
|
-
...Array.from({ length: themeCount }, (_, index) => [`/ppt/theme/theme${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.theme+xml"]),
|
|
77
|
-
...Array.from({ length: themeOverrideCount }, (_, index) => [`/ppt/theme/themeOverride${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.themeOverride+xml"]),
|
|
78
|
-
...Array.from({ length: slideCount }, (_, index) => [`/ppt/slides/slide${index + 1}.xml`, "application/vnd.openxmlformats-officedocument.presentationml.slide+xml"]),
|
|
79
|
-
...hasCoreProperties ? [["/docProps/core.xml", "application/vnd.openxmlformats-package.core-properties+xml"]] : [],
|
|
80
|
-
...packageParts.map((part) => [`/${part.path}`, part.contentType])
|
|
81
|
-
];
|
|
82
|
-
const defaults = /* @__PURE__ */ new Map([["rels", "application/vnd.openxmlformats-package.relationships+xml"], ["xml", "application/xml"]]);
|
|
83
|
-
for (const resource of resources) defaults.set(resource.extension, resource.contentType);
|
|
84
|
-
return xmlDocument(`<Types xmlns="${namespaces.contentTypes}">${[...defaults].map(([extension, contentType]) => `<Default Extension="${xmlEscape(extension)}" ContentType="${xmlEscape(contentType)}"/>`).join("")}${overrides.map(([partName, contentType]) => `<Override PartName="${xmlEscape(partName)}" ContentType="${xmlEscape(contentType)}"/>`).join("")}</Types>`);
|
|
85
|
-
}
|
|
86
55
|
function normalizedHex6(color, label) {
|
|
87
56
|
const trimmed = color.trim();
|
|
88
57
|
const six = /^#[0-9a-f]{3}$/iu.test(trimmed) ? trimmed.slice(1).split("").map((c) => c + c).join("") : /^#[0-9a-f]{6}$/iu.test(trimmed) ? trimmed.slice(1) : void 0;
|
|
@@ -188,20 +157,26 @@ function lengthCentipoints(value) {
|
|
|
188
157
|
if (typeof value === "string" && value.endsWith("px")) return Math.round(Number(value.slice(0, -2)) * 75);
|
|
189
158
|
return Math.round(Number(value) * 75);
|
|
190
159
|
}
|
|
160
|
+
const ooxmlTextAlignments = {
|
|
161
|
+
left: "l",
|
|
162
|
+
center: "ctr",
|
|
163
|
+
right: "r",
|
|
164
|
+
justify: "just"
|
|
165
|
+
};
|
|
191
166
|
function ooxmlAlign(value) {
|
|
192
|
-
|
|
193
|
-
case "left": return "l";
|
|
194
|
-
case "center": return "ctr";
|
|
195
|
-
case "right": return "r";
|
|
196
|
-
case "justify": return "just";
|
|
197
|
-
}
|
|
167
|
+
return ooxmlTextAlignments[value];
|
|
198
168
|
}
|
|
169
|
+
const ooxmlTextAnchors = {
|
|
170
|
+
top: "t",
|
|
171
|
+
middle: "ctr",
|
|
172
|
+
bottom: "b"
|
|
173
|
+
};
|
|
199
174
|
function ooxmlAnchor(value) {
|
|
200
|
-
return value
|
|
175
|
+
return ooxmlTextAnchors[value];
|
|
201
176
|
}
|
|
202
177
|
function placeholderRefXml(ref) {
|
|
203
178
|
const attrs = [];
|
|
204
|
-
if (ref.
|
|
179
|
+
if (ref.type !== "content") attrs.push(`type="${xmlEscape(ref.type)}"`);
|
|
205
180
|
const size = ref.size;
|
|
206
181
|
if (size !== void 0) attrs.push(`sz="${xmlEscape(size)}"`);
|
|
207
182
|
if (ref.orient !== void 0) attrs.push(`orient="${xmlEscape(ref.orient)}"`);
|
|
@@ -209,6 +184,28 @@ function placeholderRefXml(ref) {
|
|
|
209
184
|
if (ref.hasCustomPrompt === true) attrs.push("hasCustomPrompt=\"1\"");
|
|
210
185
|
return `<p:ph${attrs.length === 0 ? "" : ` ${attrs.join(" ")}`}/>`;
|
|
211
186
|
}
|
|
187
|
+
/** Writes the text fill choice for DrawingML character properties. */
|
|
188
|
+
function textFillXml(theme, value) {
|
|
189
|
+
if (!isTextGradient(value)) return `<a:solidFill>${resolvedColorXml(typeof value === "object" && "hex" in value ? value : theme.resolveColor(value))}</a:solidFill>`;
|
|
190
|
+
return `<a:gradFill rotWithShape="1"><a:gsLst>${value.stops.map((stop) => `<a:gs pos="${Math.round(stop.position * 1e5)}">${resolvedColorXml(theme.resolveColor(stop.color))}</a:gs>`).join("")}</a:gsLst>${value.type === "linear-gradient" ? `<a:lin ang="${positiveFixedAngleUnits(value.angle - 90)}" scaled="0"/>` : "<a:path path=\"circle\"><a:fillToRect l=\"50000\" t=\"50000\" r=\"50000\" b=\"50000\"/></a:path>"}</a:gradFill>`;
|
|
191
|
+
}
|
|
192
|
+
/** Explicit no-fill lines clear an inherited glyph outline. */
|
|
193
|
+
function textStrokeXml(theme, value) {
|
|
194
|
+
if (value === void 0) return "";
|
|
195
|
+
if (value === "none" || value.width === 0) return "<a:ln><a:noFill/></a:ln>";
|
|
196
|
+
const dash = value.style === "dashed" ? "dash" : value.style === "dotted" ? "sysDot" : void 0;
|
|
197
|
+
return `<a:ln w="${pxToEmu(value.width ?? 1)}"><a:solidFill>${resolvedColorXml(theme.resolveColor(value.color))}</a:solidFill>${dash === void 0 ? "" : `<a:prstDash val="${dash}"/>`}</a:ln>`;
|
|
198
|
+
}
|
|
199
|
+
/** A declared single-slot decoration replaces both inherited DrawingML axes. */
|
|
200
|
+
function textDecorationAttributes(value) {
|
|
201
|
+
switch (value) {
|
|
202
|
+
case void 0: return [];
|
|
203
|
+
case "underline": return ["u=\"sng\"", "strike=\"noStrike\""];
|
|
204
|
+
case "line-through": return ["u=\"none\"", "strike=\"sngStrike\""];
|
|
205
|
+
case "none": return ["u=\"none\"", "strike=\"noStrike\""];
|
|
206
|
+
default: throw new Error(`Unsupported text decoration: ${String(value)}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
212
209
|
function levelDefRPrXml(style, themeContext) {
|
|
213
210
|
const attrs = [];
|
|
214
211
|
if (style.lang !== void 0) attrs.push(`lang="${xmlEscape(style.lang)}"`);
|
|
@@ -218,12 +215,11 @@ function levelDefRPrXml(style, themeContext) {
|
|
|
218
215
|
attrs.push(`b="${bold ? 1 : 0}"`);
|
|
219
216
|
}
|
|
220
217
|
if (style.fontStyle !== void 0) attrs.push(`i="${style.fontStyle === "italic" ? 1 : 0}"`);
|
|
221
|
-
|
|
222
|
-
else if (style.textDecoration === "line-through") attrs.push("strike=\"sngStrike\"");
|
|
218
|
+
attrs.push(...textDecorationAttributes(style.textDecoration));
|
|
223
219
|
if (style.textTransform === "uppercase") attrs.push("cap=\"all\"");
|
|
224
220
|
if (style.letterSpacing !== void 0) attrs.push(`spc="${Math.round(style.letterSpacing * 75)}"`);
|
|
225
|
-
|
|
226
|
-
|
|
221
|
+
const fillXml = style.color === void 0 ? "" : textFillXml(themeContext, style.color);
|
|
222
|
+
const strokeXml = textStrokeXml(themeContext, style.textStroke);
|
|
227
223
|
let effectXml = "";
|
|
228
224
|
if (style.textShadow === "none") effectXml = "<a:effectLst/>";
|
|
229
225
|
else if (style.textShadow !== void 0) effectXml = `<a:effectLst><a:outerShdw blurRad="${pxToEmu(style.textShadow.blur ?? 4)}" dist="${pxToEmu(style.textShadow.distance ?? 0)}" dir="${positiveFixedAngleUnits(style.textShadow.angle ?? 90)}" algn="ctr" rotWithShape="0">${resolvedColorXml(themeContext.resolveColor(style.textShadow.color ?? {
|
|
@@ -251,7 +247,7 @@ function levelDefRPrXml(style, themeContext) {
|
|
|
251
247
|
}
|
|
252
248
|
if (attrs.length === 0 && fillXml === "" && effectXml === "" && fontXml === "") return "";
|
|
253
249
|
const attrText = attrs.length === 0 ? "" : ` ${attrs.join(" ")}`;
|
|
254
|
-
const inner = `${fillXml}${effectXml}${fontXml}`;
|
|
250
|
+
const inner = `${strokeXml}${fillXml}${effectXml}${fontXml}`;
|
|
255
251
|
return inner === "" ? `<a:defRPr${attrText}/>` : `<a:defRPr${attrText}>${inner}</a:defRPr>`;
|
|
256
252
|
}
|
|
257
253
|
function levelLineSpacingXml(value) {
|
|
@@ -261,8 +257,8 @@ function levelLineSpacingXml(value) {
|
|
|
261
257
|
}
|
|
262
258
|
function levelParagraphPropertiesXml(tagName, level, themeContext) {
|
|
263
259
|
const attrs = [];
|
|
264
|
-
if (level.marginLeft !== void 0) attrs.push(`marL="${
|
|
265
|
-
if (level.indent !== void 0) attrs.push(`indent="${
|
|
260
|
+
if (level.marginLeft !== void 0) attrs.push(`marL="${paragraphIndentToEmu(level.marginLeft)}"`);
|
|
261
|
+
if (level.indent !== void 0) attrs.push(`indent="${paragraphIndentToEmu(level.indent)}"`);
|
|
266
262
|
if (level.align !== void 0) attrs.push(`algn="${ooxmlAlign(level.align)}"`);
|
|
267
263
|
const spcBef = level.spacingBefore === void 0 ? "" : `<a:spcBef><a:spcPts val="${Math.round(level.spacingBefore * 75)}"/></a:spcBef>`;
|
|
268
264
|
const lnSpc = levelLineSpacingXml(level.lineHeight);
|
|
@@ -313,6 +309,7 @@ function styleAsLevel1(style) {
|
|
|
313
309
|
"textTransform",
|
|
314
310
|
"textDecoration",
|
|
315
311
|
"textShadow",
|
|
312
|
+
"textStroke",
|
|
316
313
|
"lang",
|
|
317
314
|
"lineHeight",
|
|
318
315
|
"align",
|
|
@@ -341,15 +338,7 @@ function placeholderShapesXml(placeholders, themeContext, placeholderSpPrByKey)
|
|
|
341
338
|
return Object.entries(placeholders).map(([key, spec], index) => {
|
|
342
339
|
const id = 2 + index;
|
|
343
340
|
const name = xmlEscape(spec.name ?? key);
|
|
344
|
-
const
|
|
345
|
-
const phXml = placeholderRefXml({
|
|
346
|
-
type: spec.type,
|
|
347
|
-
...spec.explicitType === void 0 ? {} : { explicitType: spec.explicitType },
|
|
348
|
-
...spec.idx === void 0 ? {} : { idx: spec.idx },
|
|
349
|
-
...size === void 0 ? {} : { size },
|
|
350
|
-
...spec.orient === void 0 ? {} : { orient: spec.orient },
|
|
351
|
-
...spec.hasCustomPrompt === void 0 ? {} : { hasCustomPrompt: spec.hasCustomPrompt }
|
|
352
|
-
});
|
|
341
|
+
const phXml = placeholderRefXml(spec);
|
|
353
342
|
const resolvedBox = resolvePlaceholderBoxFromLayers([spec]);
|
|
354
343
|
const hasBox = typeof resolvedBox.x === "number" && typeof resolvedBox.y === "number" && typeof resolvedBox.width === "number" && typeof resolvedBox.height === "number";
|
|
355
344
|
const spPr = placeholderSpPrByKey?.[key] ?? (hasBox ? `<p:spPr><a:xfrm><a:off x="${pxToEmu(resolvedBox.x)}" y="${pxToEmu(resolvedBox.y)}"/><a:ext cx="${pxToEmu(resolvedBox.width)}" cy="${pxToEmu(resolvedBox.height)}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr>` : "<p:spPr/>");
|
|
@@ -393,18 +382,24 @@ function effectiveThemeWithOverride(baseTheme, override) {
|
|
|
393
382
|
...override.formatScheme === void 0 ? baseTheme.formatScheme === void 0 ? {} : { formatScheme: baseTheme.formatScheme } : { formatScheme: override.formatScheme }
|
|
394
383
|
};
|
|
395
384
|
}
|
|
385
|
+
const themeOverridePartTemplate = "ppt/theme/themeOverride{n}.xml";
|
|
386
|
+
const themeOverrideContentType = "application/vnd.openxmlformats-officedocument.themeOverride+xml";
|
|
387
|
+
function hasDeclaredThemeSlots(slots) {
|
|
388
|
+
return slots !== void 0 && Object.values(slots).some((value) => value !== void 0);
|
|
389
|
+
}
|
|
396
390
|
function hasThemeOverrideContent(override) {
|
|
397
|
-
|
|
398
|
-
return override.colors !== void 0 && Object.keys(override.colors).length > 0 || override.fonts !== void 0 && (override.fonts.major !== void 0 || override.fonts.minor !== void 0 || override.fonts.majorEastAsian !== void 0 || override.fonts.minorEastAsian !== void 0) || override.formatScheme !== void 0;
|
|
391
|
+
return hasDeclaredThemeSlots(override?.colors) || hasDeclaredThemeSlots(override?.fonts) || override?.formatScheme !== void 0;
|
|
399
392
|
}
|
|
400
393
|
function themeOverrideXml(override, baseTheme) {
|
|
401
394
|
let colorsXml = "";
|
|
402
|
-
|
|
395
|
+
const colors = override.colors;
|
|
396
|
+
if (colors !== void 0 && hasDeclaredThemeSlots(colors)) {
|
|
403
397
|
const merged = {};
|
|
404
|
-
for (const slot of nativeColorSlots) merged[slot] =
|
|
398
|
+
for (const slot of nativeColorSlots) merged[slot] = colors[slot] ?? baseTheme.colors[slot];
|
|
405
399
|
colorsXml = colorSchemeXml(baseTheme.name, merged);
|
|
406
400
|
}
|
|
407
|
-
const
|
|
401
|
+
const fonts = override.fonts;
|
|
402
|
+
const fontsXml = fonts !== void 0 && hasDeclaredThemeSlots(fonts) ? fontSchemeXml(baseTheme.name, fonts.major ?? baseTheme.fonts.major, fonts.minor ?? baseTheme.fonts.minor, fonts.majorEastAsian ?? baseTheme.fonts.majorEastAsian, fonts.minorEastAsian ?? baseTheme.fonts.minorEastAsian) : "";
|
|
408
403
|
const formatXml = override.formatScheme === void 0 ? "" : formatSchemeXml(override.formatScheme);
|
|
409
404
|
return xmlDocument(`<a:themeOverride xmlns:a="${namespaces.a}">${colorsXml}${fontsXml}${formatXml}</a:themeOverride>`);
|
|
410
405
|
}
|
|
@@ -443,11 +438,6 @@ function layoutXml(spec, themeContext, colorMapOvrXml = colorMapOverrideXml(spec
|
|
|
443
438
|
const shapes = `${placeholderShapesXml(spec.placeholders, themeContext, spec.placeholderSpPrByKey)}${spec.shapeXml ?? ""}`;
|
|
444
439
|
return xmlDocument(`<p:sldLayout xmlns:a="${namespaces.a}" xmlns:r="${namespaces.r}" xmlns:p="${namespaces.p}"${typeAttr}${preserveAttr}${matchingNameAttr}${userDrawnAttr}${showMasterSpAttr}${showMasterPhAnimAttr}><p:cSld${nameAttr}>${spec.backgroundXml ?? ""}${shapeTreeXml(shapes)}</p:cSld>${colorMapOvrXml}${spec.transitionXml ?? ""}${spec.timingXml ?? ""}${headerFooterXml(spec.headerFooter)}</p:sldLayout>`);
|
|
445
440
|
}
|
|
446
|
-
function slide(slideId, shapeXml, slideXml, backgroundXml, hidden, showMasterPlaceholderAnimations, colorMapOverride, showMasterShapes, name, colorMapOvrXml = colorMapOverrideXml(colorMapOverride)) {
|
|
447
|
-
const showMasterSpAttr = showMasterShapes === false ? " showMasterSp=\"0\"" : "";
|
|
448
|
-
const showMasterPhAnimAttr = showMasterPlaceholderAnimations === void 0 ? "" : ` showMasterPhAnim="${showMasterPlaceholderAnimations ? "1" : "0"}"`;
|
|
449
|
-
return xmlDocument(`<p:sld xmlns:a="${namespaces.a}" xmlns:r="${namespaces.r}" xmlns:p="${namespaces.p}"${showMasterSpAttr}${showMasterPhAnimAttr}${hidden ? " show=\"false\"" : ""}><p:cSld name="${xmlEscape(name ?? slideId)}">${backgroundXml}${shapeTreeXml(shapeXml)}</p:cSld>${colorMapOvrXml}${slideXml}</p:sld>`);
|
|
450
|
-
}
|
|
451
441
|
function sectionId(index, name) {
|
|
452
442
|
const hex = createHash("sha1").update(`section:${index}:${name}`).digest("hex").toUpperCase();
|
|
453
443
|
return `{${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}}`;
|
|
@@ -456,206 +446,4 @@ function sectionListXml(sections) {
|
|
|
456
446
|
if (sections.length === 0) return "";
|
|
457
447
|
return `<p:extLst><p:ext uri="{521415D9-36F7-43E2-AB2F-B90AF26B5E84}"><p14:sectionLst xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">${sections.map(({ name, slideIndexes }, index) => `<p14:section name="${xmlEscape(name)}" id="${sectionId(index, name)}"><p14:sldIdLst>${slideIndexes.map((slideIndex) => `<p14:sldId id="${255 + slideIndex}"/>`).join("")}</p14:sldIdLst></p14:section>`).join("")}</p14:sectionLst></p:ext></p:extLst>`;
|
|
458
448
|
}
|
|
459
|
-
|
|
460
|
-
return xmlDocument(`<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title>${xmlEscape(title)}</dc:title></cp:coreProperties>`);
|
|
461
|
-
}
|
|
462
|
-
function countAllocatedMasterThemeParts(mastersInput, fallbackTheme = defaultTheme) {
|
|
463
|
-
const masters = mastersInput !== void 0 && mastersInput.length > 0 ? mastersInput : defaultEmittedMasters;
|
|
464
|
-
const seen = /* @__PURE__ */ new Set();
|
|
465
|
-
let count = 0;
|
|
466
|
-
for (const spec of masters) {
|
|
467
|
-
const masterTheme = spec.theme ?? fallbackTheme;
|
|
468
|
-
if (masterTheme !== defaultTheme && seen.has(masterTheme)) continue;
|
|
469
|
-
if (masterTheme !== defaultTheme) seen.add(masterTheme);
|
|
470
|
-
count += 1;
|
|
471
|
-
}
|
|
472
|
-
return count;
|
|
473
|
-
}
|
|
474
|
-
function pptxParts(size, slides, resources = [], packageParts = [], packageRelationships = [], presentationContent = {}, presentationAttributes = [], themeValue = defaultTheme, title, sectionXml = "", mastersInput, mastersEmitDriver) {
|
|
475
|
-
const masters = mastersInput !== void 0 && mastersInput.length > 0 ? mastersInput : defaultEmittedMasters;
|
|
476
|
-
let nextMasterLayoutId = minimumSlideLayoutId;
|
|
477
|
-
let globalLayoutNumber = 0;
|
|
478
|
-
const allocatedThemePartByTheme = /* @__PURE__ */ new Map();
|
|
479
|
-
const emittedThemeParts = [];
|
|
480
|
-
const emittedThemeOverrideParts = [];
|
|
481
|
-
const allocateThemePart = (masterTheme) => {
|
|
482
|
-
if (masterTheme !== defaultTheme) {
|
|
483
|
-
const existing = allocatedThemePartByTheme.get(masterTheme);
|
|
484
|
-
if (existing !== void 0) return existing;
|
|
485
|
-
}
|
|
486
|
-
const themeNumber = emittedThemeParts.length + 1;
|
|
487
|
-
const partPath = `ppt/theme/theme${themeNumber}.xml`;
|
|
488
|
-
const allocation = {
|
|
489
|
-
partPath,
|
|
490
|
-
relTarget: `../theme/theme${themeNumber}.xml`
|
|
491
|
-
};
|
|
492
|
-
emittedThemeParts.push({
|
|
493
|
-
partPath,
|
|
494
|
-
xml: mastersEmitDriver !== void 0 ? mastersEmitDriver.emitTheme(masterTheme) : themeXml(masterTheme)
|
|
495
|
-
});
|
|
496
|
-
if (masterTheme !== defaultTheme) allocatedThemePartByTheme.set(masterTheme, allocation);
|
|
497
|
-
return allocation;
|
|
498
|
-
};
|
|
499
|
-
const allocateThemeOverridePart = (override, baseTheme) => {
|
|
500
|
-
const overrideNumber = emittedThemeOverrideParts.length + 1;
|
|
501
|
-
const partPath = `ppt/theme/themeOverride${overrideNumber}.xml`;
|
|
502
|
-
emittedThemeOverrideParts.push({
|
|
503
|
-
partPath,
|
|
504
|
-
xml: mastersEmitDriver !== void 0 ? mastersEmitDriver.emitThemeOverride(override, baseTheme) : themeOverrideXml(override, baseTheme)
|
|
505
|
-
});
|
|
506
|
-
return `../theme/themeOverride${overrideNumber}.xml`;
|
|
507
|
-
};
|
|
508
|
-
const allocatedMasters = masters.map((spec, masterIndex) => {
|
|
509
|
-
const masterNumber = masterIndex + 1;
|
|
510
|
-
const masterId = nextMasterLayoutId++;
|
|
511
|
-
const masterPart = `ppt/slideMasters/slideMaster${masterNumber}.xml`;
|
|
512
|
-
const masterTheme = spec.theme ?? themeValue;
|
|
513
|
-
const themeAllocation = allocateThemePart(masterTheme);
|
|
514
|
-
const layouts = spec.layouts.map((layoutSpec, layoutIndex) => {
|
|
515
|
-
const layoutNumber = ++globalLayoutNumber;
|
|
516
|
-
const layoutId = nextMasterLayoutId++;
|
|
517
|
-
const layoutPart = `ppt/slideLayouts/slideLayout${layoutNumber}.xml`;
|
|
518
|
-
const themeOverrideTarget = hasThemeOverrideContent(layoutSpec.themeOverride) ? allocateThemeOverridePart(layoutSpec.themeOverride, masterTheme) : void 0;
|
|
519
|
-
return {
|
|
520
|
-
spec: layoutSpec,
|
|
521
|
-
layoutNumber,
|
|
522
|
-
layoutId,
|
|
523
|
-
layoutPart,
|
|
524
|
-
masterRelId: `rId${layoutIndex + 1}`,
|
|
525
|
-
themeOverrideTarget
|
|
526
|
-
};
|
|
527
|
-
});
|
|
528
|
-
return {
|
|
529
|
-
spec,
|
|
530
|
-
masterNumber,
|
|
531
|
-
masterId,
|
|
532
|
-
masterPart,
|
|
533
|
-
masterTheme,
|
|
534
|
-
themeRelTarget: themeAllocation.relTarget,
|
|
535
|
-
presentationRelId: `rId${masterNumber}`,
|
|
536
|
-
layouts
|
|
537
|
-
};
|
|
538
|
-
});
|
|
539
|
-
const layoutPartByKey = /* @__PURE__ */ new Map();
|
|
540
|
-
const masterThemeByLayoutKey = /* @__PURE__ */ new Map();
|
|
541
|
-
for (const allocatedMaster of allocatedMasters) for (const allocatedLayout of allocatedMaster.layouts) {
|
|
542
|
-
layoutPartByKey.set(allocatedLayout.spec.key, allocatedLayout.layoutPart);
|
|
543
|
-
masterThemeByLayoutKey.set(allocatedLayout.spec.key, effectiveThemeWithOverride(allocatedMaster.masterTheme, allocatedLayout.spec.themeOverride));
|
|
544
|
-
}
|
|
545
|
-
const fallbackLayoutPart = allocatedMasters[0]?.layouts[0]?.layoutPart ?? "ppt/slideLayouts/slideLayout1.xml";
|
|
546
|
-
const fallbackMasterTheme = allocatedMasters[0]?.masterTheme ?? themeValue;
|
|
547
|
-
const slideThemeOverrideTargets = slides.map((slideSpec) => {
|
|
548
|
-
if (!hasThemeOverrideContent(slideSpec.themeOverride)) return void 0;
|
|
549
|
-
const baseTheme = (slideSpec.layoutKey === void 0 ? void 0 : masterThemeByLayoutKey.get(slideSpec.layoutKey)) ?? fallbackMasterTheme;
|
|
550
|
-
return allocateThemeOverridePart(slideSpec.themeOverride, baseTheme);
|
|
551
|
-
});
|
|
552
|
-
const masterRelationships = allocatedMasters.map(({ masterNumber, presentationRelId }) => ({
|
|
553
|
-
id: presentationRelId,
|
|
554
|
-
type: `${namespaces.r}/slideMaster`,
|
|
555
|
-
target: `slideMasters/slideMaster${masterNumber}.xml`
|
|
556
|
-
}));
|
|
557
|
-
const masterIdsXml = allocatedMasters.map(({ masterId, presentationRelId }) => `<p:sldMasterId id="${masterId}" r:id="${presentationRelId}"/>`).join("");
|
|
558
|
-
const slideRelStart = allocatedMasters.length + 1;
|
|
559
|
-
const slideRelationships = slides.map((_, index) => ({
|
|
560
|
-
id: `rId${slideRelStart + index}`,
|
|
561
|
-
type: `${namespaces.r}/slide`,
|
|
562
|
-
target: `slides/slide${index + 1}.xml`
|
|
563
|
-
}));
|
|
564
|
-
const slideIds = slides.map((_, index) => `<p:sldId id="${256 + index}" r:id="rId${slideRelStart + index}"/>`).join("");
|
|
565
|
-
const slideIdListXml = slides.length === 0 ? "" : `<p:sldIdLst>${slideIds}</p:sldIdLst>`;
|
|
566
|
-
const presentationAttributeXml = presentationAttributes.map(({ name, value }) => ` ${name}="${xmlEscape(value)}"`).join("");
|
|
567
|
-
const extraPresentationRelationships = packageRelationships.find(({ sourcePath }) => sourcePath === "ppt/presentation.xml")?.relationships ?? [];
|
|
568
|
-
const presentation = xmlDocument(`<p:presentation xmlns:a="${namespaces.a}" xmlns:r="${namespaces.r}" xmlns:p="${namespaces.p}"${presentationAttributeXml}><p:sldMasterIdLst>${masterIdsXml}</p:sldMasterIdLst>${presentationContent.beforeSlides ?? ""}${slideIdListXml}<p:sldSz cx="${pxToEmu(size.width)}" cy="${pxToEmu(size.height)}"/><p:notesSz cx="6858000" cy="9144000"/>${presentationContent.afterNotesSize ?? ""}${sectionXml}</p:presentation>`);
|
|
569
|
-
const parts = {
|
|
570
|
-
"[Content_Types].xml": contentTypes(allocatedMasters.length, globalLayoutNumber, emittedThemeParts.length, emittedThemeOverrideParts.length, slides.length, resources, packageParts, title !== void 0),
|
|
571
|
-
"_rels/.rels": relationships([{
|
|
572
|
-
id: "rId1",
|
|
573
|
-
type: `${namespaces.r}/officeDocument`,
|
|
574
|
-
target: "ppt/presentation.xml"
|
|
575
|
-
}, ...title === void 0 ? [] : [{
|
|
576
|
-
id: "rId2",
|
|
577
|
-
type: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
|
|
578
|
-
target: "docProps/core.xml"
|
|
579
|
-
}]]),
|
|
580
|
-
"ppt/presentation.xml": presentation,
|
|
581
|
-
"ppt/_rels/presentation.xml.rels": relationships([
|
|
582
|
-
...masterRelationships,
|
|
583
|
-
...slideRelationships,
|
|
584
|
-
...extraPresentationRelationships
|
|
585
|
-
])
|
|
586
|
-
};
|
|
587
|
-
const defaultThemeCtx = createThemeContext(themeValue);
|
|
588
|
-
for (const themePart of emittedThemeParts) parts[themePart.partPath] = themePart.xml;
|
|
589
|
-
for (const overridePart of emittedThemeOverrideParts) parts[overridePart.partPath] = overridePart.xml;
|
|
590
|
-
for (const allocatedMaster of allocatedMasters) {
|
|
591
|
-
const masterThemeCtx = allocatedMaster.spec.themeContext ?? (allocatedMaster.spec.theme === void 0 ? defaultThemeCtx : createThemeContext(allocatedMaster.spec.theme, void 0, allocatedMaster.spec.colorMap === void 0 ? {} : { colorMap: allocatedMaster.spec.colorMap }));
|
|
592
|
-
const masterLayoutIds = allocatedMaster.layouts.map((item) => ({
|
|
593
|
-
id: item.layoutId,
|
|
594
|
-
rId: item.masterRelId
|
|
595
|
-
}));
|
|
596
|
-
parts[allocatedMaster.masterPart] = mastersEmitDriver !== void 0 ? mastersEmitDriver.emitMaster(allocatedMaster.spec, masterLayoutIds, masterThemeCtx) : masterXml(allocatedMaster.spec, masterLayoutIds, masterThemeCtx);
|
|
597
|
-
parts[`ppt/slideMasters/_rels/slideMaster${allocatedMaster.masterNumber}.xml.rels`] = relationships([
|
|
598
|
-
...allocatedMaster.layouts.map((item) => ({
|
|
599
|
-
id: item.masterRelId,
|
|
600
|
-
type: `${namespaces.r}/slideLayout`,
|
|
601
|
-
target: `../slideLayouts/slideLayout${item.layoutNumber}.xml`
|
|
602
|
-
})),
|
|
603
|
-
{
|
|
604
|
-
id: `rId${allocatedMaster.layouts.length + 1}`,
|
|
605
|
-
type: `${namespaces.r}/theme`,
|
|
606
|
-
target: allocatedMaster.themeRelTarget
|
|
607
|
-
},
|
|
608
|
-
...allocatedMaster.spec.extraRelationships ?? []
|
|
609
|
-
]);
|
|
610
|
-
for (const allocatedLayout of allocatedMaster.layouts) {
|
|
611
|
-
const layoutThemeCtx = allocatedLayout.spec.themeOverride !== void 0 || allocatedLayout.spec.colorMapOverride !== void 0 ? masterThemeCtx.withNativeOverrides(allocatedLayout.spec.themeOverride, allocatedLayout.spec.colorMapOverride) : masterThemeCtx;
|
|
612
|
-
parts[allocatedLayout.layoutPart] = mastersEmitDriver !== void 0 ? mastersEmitDriver.emitLayout(allocatedLayout.spec, layoutThemeCtx) : layoutXml(allocatedLayout.spec, layoutThemeCtx);
|
|
613
|
-
const layoutRels = [
|
|
614
|
-
{
|
|
615
|
-
id: "rId1",
|
|
616
|
-
type: `${namespaces.r}/slideMaster`,
|
|
617
|
-
target: `../slideMasters/slideMaster${allocatedMaster.masterNumber}.xml`
|
|
618
|
-
},
|
|
619
|
-
...allocatedLayout.themeOverrideTarget === void 0 ? [] : [{
|
|
620
|
-
id: "rId2",
|
|
621
|
-
type: `${namespaces.r}/themeOverride`,
|
|
622
|
-
target: allocatedLayout.themeOverrideTarget
|
|
623
|
-
}],
|
|
624
|
-
...allocatedLayout.spec.extraRelationships ?? []
|
|
625
|
-
];
|
|
626
|
-
parts[`ppt/slideLayouts/_rels/slideLayout${allocatedLayout.layoutNumber}.xml.rels`] = relationships(layoutRels);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
slides.forEach(({ shapeXml, slideXml, backgroundXml, hidden, showMasterPlaceholderAnimations, showMasterShapes, layoutKey, colorMapOverride }, index) => {
|
|
630
|
-
const targetLayoutRel = `../${((layoutKey === void 0 ? void 0 : layoutPartByKey.get(layoutKey)) ?? fallbackLayoutPart).slice(4)}`;
|
|
631
|
-
const colorMapOvrXml = mastersEmitDriver !== void 0 ? mastersEmitDriver.emitColorMap(colorMapOverride === void 0 ? {} : { colorMapOverride }) : colorMapOverrideXml(colorMapOverride);
|
|
632
|
-
parts[`ppt/slides/slide${index + 1}.xml`] = slide(slides[index].id, shapeXml, slideXml ?? "", backgroundXml ?? "", hidden ?? false, showMasterPlaceholderAnimations, colorMapOverride, showMasterShapes, slides[index].name, colorMapOvrXml);
|
|
633
|
-
const slideOverrideTarget = slideThemeOverrideTargets[index];
|
|
634
|
-
const slideRels = [
|
|
635
|
-
{
|
|
636
|
-
id: "rId1",
|
|
637
|
-
type: `${namespaces.r}/slideLayout`,
|
|
638
|
-
target: targetLayoutRel
|
|
639
|
-
},
|
|
640
|
-
...slides[index].relationships,
|
|
641
|
-
...slideOverrideTarget === void 0 ? [] : [{
|
|
642
|
-
id: `rId${slides[index].relationships.length + 2}`,
|
|
643
|
-
type: `${namespaces.r}/themeOverride`,
|
|
644
|
-
target: slideOverrideTarget
|
|
645
|
-
}]
|
|
646
|
-
];
|
|
647
|
-
parts[`ppt/slides/_rels/slide${index + 1}.xml.rels`] = relationships(slideRels);
|
|
648
|
-
});
|
|
649
|
-
if (title !== void 0) parts["docProps/core.xml"] = coreProperties(title);
|
|
650
|
-
for (const resource of resources) parts[`ppt/media/${resource.name}`] = resource.bytes;
|
|
651
|
-
for (const part of packageParts) parts[part.path] = part.content;
|
|
652
|
-
for (const relationshipSet of packageRelationships) {
|
|
653
|
-
if (relationshipSet.sourcePath === "ppt/presentation.xml") continue;
|
|
654
|
-
const marker = relationshipSet.sourcePath.lastIndexOf("/");
|
|
655
|
-
const directory = marker === -1 ? "" : relationshipSet.sourcePath.slice(0, marker + 1);
|
|
656
|
-
const name = relationshipSet.sourcePath.slice(marker + 1);
|
|
657
|
-
parts[`${directory}_rels/${name}.rels`] = relationships(relationshipSet.relationships);
|
|
658
|
-
}
|
|
659
|
-
return parts;
|
|
660
|
-
}
|
|
661
|
-
export { assertXml10Characters, colorMapAttributesXml, colorMapOverrideXml, countAllocatedMasterThemeParts, hasThemeOverrideContent, layoutXml, masterXml, placeholderRefXml, pptxParts, pxToEmu, resolvedColorXml, sectionListXml, themeOverrideXml, themeXml, xmlDocument, xmlEscape };
|
|
449
|
+
export { assertXml10Characters, colorMapAttributesXml, colorMapOverrideXml, effectiveThemeWithOverride, hasThemeOverrideContent, layoutXml, masterXml, namespaces, paragraphIndentToEmu, placeholderRefXml, pxToEmu, resolvedColorXml, sectionListXml, textDecorationAttributes, textFillXml, textStrokeXml, themeOverrideContentType, themeOverridePartTemplate, themeOverrideXml, themeXml, xmlDocument, xmlEscape };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../core/dist/query.js
|
|
1
|
+
// ../core/dist/kernel/query.js
|
|
2
2
|
var BuildQueryError = class extends Error {
|
|
3
3
|
code;
|
|
4
4
|
constructor(code, message) {
|
|
@@ -81,6 +81,8 @@ function computeLocatorSnapshot(node, layouts, objectsById, resourcesByObjectId,
|
|
|
81
81
|
const text = partRef !== void 0 ? partRef.text : selectedText;
|
|
82
82
|
const textMetrics = partRef !== void 0 ? partRef.textMetrics : object?.textMetrics;
|
|
83
83
|
const image = object?.image;
|
|
84
|
+
const video = object?.video;
|
|
85
|
+
const audio = object?.audio;
|
|
84
86
|
const kind = partRef !== void 0 ? partRef.partKind ?? "part" : layout !== void 0 ? "layout" : object?.kind ?? defaultKind;
|
|
85
87
|
const path = partRef?.path ?? layout?.path ?? object?.path ?? node.path ?? defaultPath;
|
|
86
88
|
const resources = objects.flatMap((item) => (resourcesByObjectId.get(item.id) ?? []).map((resource) => Object.freeze({
|
|
@@ -98,6 +100,8 @@ function computeLocatorSnapshot(node, layouts, objectsById, resourcesByObjectId,
|
|
|
98
100
|
...text === void 0 ? {} : { text },
|
|
99
101
|
...textMetrics === void 0 ? {} : { textMetrics },
|
|
100
102
|
...image === void 0 ? {} : { image },
|
|
103
|
+
...video === void 0 ? {} : { video },
|
|
104
|
+
...audio === void 0 ? {} : { audio },
|
|
101
105
|
...gridArea === void 0 ? {} : { gridArea },
|
|
102
106
|
objects: Object.freeze(objects),
|
|
103
107
|
...resources.length === 0 ? {} : { resources: Object.freeze(resources) }
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { markImmutableBytes } from "./font-seal.js";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
// ../core/dist/kernel/resolve-work.js
|
|
5
|
+
function* completeBinding(binding) {
|
|
6
|
+
if (typeof binding === "object" && binding !== null && Symbol.iterator in binding) return yield* binding;
|
|
7
|
+
return binding;
|
|
8
|
+
}
|
|
9
|
+
/** Runs a part of resolution after its resource bytes have been prepared. */
|
|
10
|
+
function finishResolveWork(work, readPrepared) {
|
|
11
|
+
let step = work.next();
|
|
12
|
+
while (!step.done) {
|
|
13
|
+
let bytes;
|
|
14
|
+
try {
|
|
15
|
+
if (readPrepared === void 0) throw new Error("Local resource was not prepared during binding");
|
|
16
|
+
bytes = readPrepared(step.value);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
step = work.throw(error);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
step = work.next(bytes);
|
|
22
|
+
}
|
|
23
|
+
return step.value;
|
|
24
|
+
}
|
|
25
|
+
function createResolveFileCache() {
|
|
26
|
+
const files = /* @__PURE__ */ new Map();
|
|
27
|
+
const pathOf = (file) => file instanceof URL ? fileURLToPath(file) : file;
|
|
28
|
+
return {
|
|
29
|
+
readPrepared: (file) => {
|
|
30
|
+
const bytes = files.get(pathOf(file));
|
|
31
|
+
if (bytes === void 0) throw new Error("Local resource was not prepared during binding");
|
|
32
|
+
return bytes;
|
|
33
|
+
},
|
|
34
|
+
async complete(work, signal) {
|
|
35
|
+
let step = work.next();
|
|
36
|
+
try {
|
|
37
|
+
while (!step.done) {
|
|
38
|
+
let bytes;
|
|
39
|
+
try {
|
|
40
|
+
const path = pathOf(step.value);
|
|
41
|
+
bytes = files.get(path) ?? markImmutableBytes(await readFile(path, { signal }));
|
|
42
|
+
files.set(path, bytes);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
signal?.throwIfAborted();
|
|
45
|
+
step = work.throw(error);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
signal?.throwIfAborted();
|
|
49
|
+
step = work.next(bytes);
|
|
50
|
+
}
|
|
51
|
+
return step.value;
|
|
52
|
+
} finally {
|
|
53
|
+
if (!step.done) work.return(void 0);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export { completeBinding, createResolveFileCache, finishResolveWork };
|