@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,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import
|
|
1
|
+
import { EMU_PER_PX, emuToPx } from "../drawing-units.js";
|
|
2
|
+
import { presetGeometryNameSchema } from "../geometry-schemas.js";
|
|
3
|
+
import { schemeColorNameSchema } from "../theme.js";
|
|
4
|
+
import "../capability.js";
|
|
5
|
+
import { A_NS, R_NS } from "./namespaces.js";
|
|
5
6
|
import { resolvePartPath } from "./opc.js";
|
|
6
7
|
import { extentEmuFragmentSchema, hexRgb6Schema, nonNegativeExtentEmuFragmentSchema, offsetEmuFragmentSchema, ooxmlIntSchema, ooxmlLineWidthEmuSchema, ooxmlNonNegativeIntSchema, ooxmlWritableExtentEmuSchema, transformAttributesFragmentSchema } from "./xml-fragments.js";
|
|
7
8
|
import { z } from "zod";
|
|
8
|
-
// ../
|
|
9
|
+
// ../core/dist/kernel/pptx-read/visual.js
|
|
9
10
|
const arrowTypes = [
|
|
10
11
|
"none",
|
|
11
12
|
"triangle",
|
|
@@ -195,9 +196,9 @@ function readDrawingColor(parentCursor, location, diagnostics) {
|
|
|
195
196
|
localName: mod.localName,
|
|
196
197
|
mechanismHint: `color-transform:${mod.localName}`
|
|
197
198
|
});
|
|
198
|
-
const baseColor = slot !== void 0 ? lumMod !== void 0 ? {
|
|
199
|
+
const baseColor = slot !== void 0 ? lumMod !== void 0 || lumOff !== void 0 ? {
|
|
199
200
|
slot,
|
|
200
|
-
lumMod,
|
|
201
|
+
lumMod: lumMod ?? 1,
|
|
201
202
|
...lumOff === void 0 ? {} : { lumOff }
|
|
202
203
|
} : slot : baseHex;
|
|
203
204
|
if (baseColor === void 0) return void 0;
|
|
@@ -261,6 +262,42 @@ function readTransformXml(xfrmCursor, location, diagnostics, options) {
|
|
|
261
262
|
...flipV ? { flipV: true } : {}
|
|
262
263
|
};
|
|
263
264
|
}
|
|
265
|
+
/** Reads independent local geometry and visual overrides on an imported placeholder. */
|
|
266
|
+
function readPlaceholderTransform(xfrm, location, diagnostics) {
|
|
267
|
+
const attrs = transformAttributesFragmentSchema.safeParse(xfrm?.attrsObject([
|
|
268
|
+
"rot",
|
|
269
|
+
"flipH",
|
|
270
|
+
"flipV"
|
|
271
|
+
]) ?? {});
|
|
272
|
+
const off = xfrm?.child(A_NS, "off");
|
|
273
|
+
const ext = xfrm?.child(A_NS, "ext");
|
|
274
|
+
const offset = off && offsetEmuFragmentSchema.safeParse(off.attrsObject(["x", "y"]));
|
|
275
|
+
const extent = ext && extentEmuFragmentSchema.safeParse(ext.attrsObject(["cx", "cy"]));
|
|
276
|
+
if (xfrm !== void 0 && (offset?.success === false || extent?.success === false)) diagnostics.push({
|
|
277
|
+
code: "invalid-xml-value",
|
|
278
|
+
category: "corrupt-input",
|
|
279
|
+
disposition: "recovered",
|
|
280
|
+
location: {
|
|
281
|
+
...location,
|
|
282
|
+
xpath: xfrm.xpath
|
|
283
|
+
},
|
|
284
|
+
attributeOrElement: "a:xfrm"
|
|
285
|
+
});
|
|
286
|
+
const { rot, flipH, flipV } = attrs.data ?? {};
|
|
287
|
+
return {
|
|
288
|
+
offset: offset?.success ? {
|
|
289
|
+
x: emuToPx(offset.data.x),
|
|
290
|
+
y: emuToPx(offset.data.y)
|
|
291
|
+
} : void 0,
|
|
292
|
+
extent: extent?.success ? {
|
|
293
|
+
width: emuToPx(extent.data.cx),
|
|
294
|
+
height: emuToPx(extent.data.cy)
|
|
295
|
+
} : void 0,
|
|
296
|
+
rotate: rot === void 0 ? void 0 : rot / 6e4,
|
|
297
|
+
flipH,
|
|
298
|
+
flipV
|
|
299
|
+
};
|
|
300
|
+
}
|
|
264
301
|
/** Reads DrawingML `<a:gradFill>` into a `LinearGradient` or `RadialGradient`. */
|
|
265
302
|
function readGradientFill(gradFillCursor, location, diagnostics) {
|
|
266
303
|
gradFillCursor.consumeAttr("rotWithShape");
|
|
@@ -438,7 +475,30 @@ function readBlipFill(blipFillCursor, pkg, location, diagnostics, validateImageB
|
|
|
438
475
|
...opacity === void 0 ? {} : { opacity }
|
|
439
476
|
};
|
|
440
477
|
}
|
|
478
|
+
/** Reads `<a:rPr>` or `<a:defRPr>` text fill (`gradFill` over `solidFill`) and `<a:ln>` text stroke. */
|
|
479
|
+
function readRunFillAndStroke(rPrCursor, location, diagnostics, readSolidFill = (solidFillCursor) => readDrawingColor(solidFillCursor, location, diagnostics)) {
|
|
480
|
+
const solidFill = rPrCursor.child(A_NS, "solidFill");
|
|
481
|
+
const gradient = rPrCursor.child(A_NS, "gradFill");
|
|
482
|
+
const color = gradient !== void 0 ? readGradientFill(gradient, location, diagnostics) : solidFill === void 0 ? void 0 : readSolidFill(solidFill);
|
|
483
|
+
const textStroke = readTextStroke(rPrCursor, location, diagnostics);
|
|
484
|
+
return {
|
|
485
|
+
...color === void 0 ? {} : { color },
|
|
486
|
+
...textStroke === void 0 ? {} : { textStroke }
|
|
487
|
+
};
|
|
488
|
+
}
|
|
441
489
|
/** Reads DrawingML `<a:ln>` stroke width, fill, dash preset, join, and line end arrows. */
|
|
490
|
+
function readTextStroke(properties, location, diagnostics) {
|
|
491
|
+
const line = properties.child(A_NS, "ln");
|
|
492
|
+
if (line === void 0) return void 0;
|
|
493
|
+
const border = readLineBorder(line, location, diagnostics);
|
|
494
|
+
if (border.noFill === true || border.borderWidth === 0) return "none";
|
|
495
|
+
if (border.borderColor === void 0) return void 0;
|
|
496
|
+
return {
|
|
497
|
+
color: border.borderColor,
|
|
498
|
+
width: border.borderWidth,
|
|
499
|
+
style: border.borderStyle
|
|
500
|
+
};
|
|
501
|
+
}
|
|
442
502
|
function readLineBorder(lnCursor, location, diagnostics) {
|
|
443
503
|
const rawLn = lnCursor.attrsObject([
|
|
444
504
|
"w",
|
|
@@ -547,18 +607,20 @@ function readLineBorder(lnCursor, location, diagnostics) {
|
|
|
547
607
|
case "bevel":
|
|
548
608
|
if (child.localName === "miter") child.consumeAttr("lim");
|
|
549
609
|
break;
|
|
550
|
-
default:
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
610
|
+
default:
|
|
611
|
+
diagnostics.push({
|
|
612
|
+
code: "unsupported-mechanism",
|
|
613
|
+
category: "unsupported",
|
|
614
|
+
disposition: "omitted",
|
|
615
|
+
location: {
|
|
616
|
+
...location,
|
|
617
|
+
xpath: child.xpath
|
|
618
|
+
},
|
|
619
|
+
namespaceUri: child.namespaceUri,
|
|
620
|
+
localName: child.localName,
|
|
621
|
+
mechanismHint: `line:${child.localName}`
|
|
622
|
+
});
|
|
623
|
+
child.suppressUnconsumed();
|
|
562
624
|
}
|
|
563
625
|
}
|
|
564
626
|
if (hasNoFill) return { noFill: true };
|
|
@@ -571,8 +633,8 @@ function readLineBorder(lnCursor, location, diagnostics) {
|
|
|
571
633
|
...endArrow === void 0 ? {} : { endArrow }
|
|
572
634
|
};
|
|
573
635
|
}
|
|
574
|
-
/** Reads DrawingML
|
|
575
|
-
function readEffectList(effectLstCursor, location, diagnostics) {
|
|
636
|
+
/** Reads a DrawingML outer shadow. Object effects also support soft edges. */
|
|
637
|
+
function readEffectList(effectLstCursor, location, diagnostics, target = "object") {
|
|
576
638
|
let boxShadow;
|
|
577
639
|
let softEdge;
|
|
578
640
|
for (const child of effectLstCursor.remainingElementChildren()) {
|
|
@@ -622,7 +684,7 @@ function readEffectList(effectLstCursor, location, diagnostics) {
|
|
|
622
684
|
distance: parsed.data.dist === void 0 ? 0 : emuToPx(parsed.data.dist),
|
|
623
685
|
angle: parsed.data.dir === void 0 ? 0 : parsed.data.dir / 6e4
|
|
624
686
|
};
|
|
625
|
-
} else if (child.localName === "softEdge") {
|
|
687
|
+
} else if (child.localName === "softEdge" && target === "object") {
|
|
626
688
|
const raw = child.attrsObject(["rad"]);
|
|
627
689
|
const parsed = softEdgeAttrSchema.safeParse(raw);
|
|
628
690
|
if (!parsed.success) {
|
|
@@ -741,50 +803,15 @@ function readBasicPlaceholderAppearance(spPr, pkg, _fallbackUnits, location, dia
|
|
|
741
803
|
*/
|
|
742
804
|
function readPlaceholderSpPrVisuals(args, options) {
|
|
743
805
|
const { spPr, pkg, location, diagnostics } = args;
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
let height;
|
|
748
|
-
let rotate;
|
|
749
|
-
let flipH;
|
|
750
|
-
let flipV;
|
|
751
|
-
let fallbackUnits = {
|
|
806
|
+
const { offset, extent, rotate, flipH, flipV } = readPlaceholderTransform(spPr.child(A_NS, "xfrm"), location, diagnostics);
|
|
807
|
+
const { width, height } = extent ?? {};
|
|
808
|
+
const fallbackUnits = extent === void 0 ? {
|
|
752
809
|
w: 0,
|
|
753
810
|
h: 0
|
|
811
|
+
} : {
|
|
812
|
+
w: Math.round(extent.width * EMU_PER_PX),
|
|
813
|
+
h: Math.round(extent.height * EMU_PER_PX)
|
|
754
814
|
};
|
|
755
|
-
const xfrm = spPr.child(A_NS, "xfrm");
|
|
756
|
-
if (xfrm !== void 0) {
|
|
757
|
-
const hasExplicitFlipH = xfrm.element.hasAttribute("flipH");
|
|
758
|
-
const hasExplicitFlipV = xfrm.element.hasAttribute("flipV");
|
|
759
|
-
if (xfrm.child("http://schemas.openxmlformats.org/drawingml/2006/main", "off") !== void 0 && xfrm.child("http://schemas.openxmlformats.org/drawingml/2006/main", "ext") !== void 0) {
|
|
760
|
-
const tf = readTransformXml(xfrm, location, diagnostics);
|
|
761
|
-
if (tf !== void 0) {
|
|
762
|
-
x = tf.x;
|
|
763
|
-
y = tf.y;
|
|
764
|
-
width = tf.width;
|
|
765
|
-
height = tf.height;
|
|
766
|
-
rotate = tf.rotate;
|
|
767
|
-
if (hasExplicitFlipH) flipH = Boolean(tf.flipH);
|
|
768
|
-
if (hasExplicitFlipV) flipV = Boolean(tf.flipV);
|
|
769
|
-
fallbackUnits = {
|
|
770
|
-
w: tf.cxEmu,
|
|
771
|
-
h: tf.cyEmu
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
} else {
|
|
775
|
-
const rawXfrm = xfrm.attrsObject([
|
|
776
|
-
"rot",
|
|
777
|
-
"flipH",
|
|
778
|
-
"flipV"
|
|
779
|
-
]);
|
|
780
|
-
const parsedXfrm = transformAttributesFragmentSchema.safeParse(rawXfrm);
|
|
781
|
-
if (parsedXfrm.success) {
|
|
782
|
-
if (parsedXfrm.data.rot !== void 0 && parsedXfrm.data.rot !== 0) rotate = parsedXfrm.data.rot / 6e4;
|
|
783
|
-
if (hasExplicitFlipH && parsedXfrm.data.flipH !== void 0) flipH = parsedXfrm.data.flipH;
|
|
784
|
-
if (hasExplicitFlipV && parsedXfrm.data.flipV !== void 0) flipV = parsedXfrm.data.flipV;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
815
|
const appearance = (options?.readAppearance ?? readBasicPlaceholderAppearance)(spPr, pkg, fallbackUnits, location, diagnostics);
|
|
789
816
|
let borderRadius;
|
|
790
817
|
let exportedGeometry;
|
|
@@ -802,10 +829,10 @@ function readPlaceholderSpPrVisuals(args, options) {
|
|
|
802
829
|
} else if (geom !== void 0 && geom !== "rect") exportedGeometry = geom;
|
|
803
830
|
const style = {};
|
|
804
831
|
for (const [key, value] of Object.entries(appearance.style)) if (value !== void 0 && (options?.allowedStyleKeys === void 0 || options.allowedStyleKeys.has(key))) style[key] = value;
|
|
805
|
-
if (
|
|
832
|
+
if (offset !== void 0) {
|
|
806
833
|
style["position"] = "absolute";
|
|
807
|
-
style["left"] = x;
|
|
808
|
-
style["top"] = y;
|
|
834
|
+
style["left"] = offset.x;
|
|
835
|
+
style["top"] = offset.y;
|
|
809
836
|
}
|
|
810
837
|
if (width !== void 0) style["width"] = width;
|
|
811
838
|
if (height !== void 0) style["height"] = height;
|
|
@@ -818,4 +845,4 @@ function readPlaceholderSpPrVisuals(args, options) {
|
|
|
818
845
|
...Object.keys(style).length === 0 ? {} : { style }
|
|
819
846
|
};
|
|
820
847
|
}
|
|
821
|
-
export { arrowTypeSchema, arrowTypes, readBlipFill, readDrawingColor, readEffectList, readGradientFill, readLineBorder, readPlaceholderSpPrVisuals, readTransformXml };
|
|
848
|
+
export { arrowTypeSchema, arrowTypes, readBlipFill, readDrawingColor, readEffectList, readGradientFill, readLineBorder, readPlaceholderSpPrVisuals, readPlaceholderTransform, readRunFillAndStroke, readTextStroke, readTransformXml };
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "
|
|
3
|
-
import {
|
|
1
|
+
import "../index.js";
|
|
2
|
+
import { assertValidLang } from "../theme.js";
|
|
3
|
+
import { placeholderRoleSchema } from "../placeholders.js";
|
|
4
|
+
import { EMU_PER_PX, emuToPx } from "../drawing-units.js";
|
|
4
5
|
import { z } from "zod";
|
|
5
|
-
// ../
|
|
6
|
+
// ../core/dist/kernel/pptx-read/xml-fragments.js
|
|
6
7
|
const integerStringPattern = /^-?\d+$/u;
|
|
7
8
|
const hexRgbPattern = /^[0-9a-fA-F]{6}$/u;
|
|
9
|
+
/** Decodes the absent `p:ph/@type` separately from an explicit `obj`. */
|
|
10
|
+
const ooxmlPlaceholderRoleSchema = placeholderRoleSchema.refine((role) => role !== "content").optional().transform((role) => role ?? "content");
|
|
8
11
|
/** Parses an OOXML signed integer attribute string into a safe integer. */
|
|
9
12
|
const ooxmlIntSchema = z.string().regex(integerStringPattern).transform((value) => Number(value)).refine((value) => Number.isSafeInteger(value));
|
|
10
13
|
/** Parses an OOXML non-negative integer attribute string into a safe integer. */
|
|
@@ -15,6 +18,8 @@ const ooxmlPositiveIntSchema = ooxmlIntSchema.refine((value) => value > 0);
|
|
|
15
18
|
const ooxmlFontSizeCentipointsSchema = ooxmlIntSchema.refine((value) => value >= 100 && value <= 4e5);
|
|
16
19
|
/** DrawingML `<a:rPr spc="...">` valid integer centipoint domain (`-4000pt .. 4000pt`). */
|
|
17
20
|
const ooxmlLetterSpacingCentipointsSchema = ooxmlIntSchema.refine((value) => value >= -4e5 && value <= 4e5);
|
|
21
|
+
/** DrawingML `<a:rPr kern="...">` valid non-negative integer centipoint domain (`0 .. 4000pt`). */
|
|
22
|
+
const ooxmlKerningCentipointsSchema = ooxmlIntSchema.refine((value) => value >= 0 && value <= 4e5);
|
|
18
23
|
/** DrawingML `<a:rPr baseline="...">` valid 32-bit signed thousandths of a percent (`ST_Percentage`). */
|
|
19
24
|
const ooxmlBaselineShiftThousandthsSchema = ooxmlIntSchema.refine((value) => value >= -2147483648 && value <= 2147483647);
|
|
20
25
|
/** DrawingML `<a:lnSpc><a:spcPts val="...">` valid centipoint domain (`>0 .. 1584pt`). */
|
|
@@ -29,6 +34,34 @@ const ooxmlAutoNumStartAtSchema = ooxmlIntSchema.refine((value) => value >= 1 &&
|
|
|
29
34
|
const ooxmlListLevelSchema = ooxmlIntSchema.refine((value) => value >= 0 && value <= 8);
|
|
30
35
|
/** DrawingML `ST_PositiveFixedAngle` domain (`0 <= value < 21_600_000`, 60,000ths of a degree). */
|
|
31
36
|
const ooxmlPositiveFixedAngleSchema = ooxmlIntSchema.refine((value) => value >= 0 && value < 216e5);
|
|
37
|
+
function cascadeOoxmlTextDecoration(inherited, local) {
|
|
38
|
+
return {
|
|
39
|
+
...inherited,
|
|
40
|
+
...local
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Projects a fully cascaded pair into the single decoration supported by TextStyle. */
|
|
44
|
+
function projectOoxmlTextDecoration(state) {
|
|
45
|
+
if (state?.underline === "underline") return "underline";
|
|
46
|
+
if (state?.strike === "line-through") return "line-through";
|
|
47
|
+
return state?.underline ?? state?.strike;
|
|
48
|
+
}
|
|
49
|
+
/** Report only at a materialized text position, after all lower layers have been applied. */
|
|
50
|
+
function reportOoxmlTextDecorationLoss(state, location, diagnostics) {
|
|
51
|
+
if (state?.underline !== "underline" || state.strike !== "line-through") return;
|
|
52
|
+
diagnostics.push({
|
|
53
|
+
code: "compatibility-fallback",
|
|
54
|
+
category: "unsupported",
|
|
55
|
+
disposition: "fallback",
|
|
56
|
+
location,
|
|
57
|
+
preferredMechanism: "underline-and-strike",
|
|
58
|
+
selectedFallback: "underline",
|
|
59
|
+
loss: {
|
|
60
|
+
lost: "native-mechanism",
|
|
61
|
+
retainedAs: "underline"
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
32
65
|
function pushInvalidXmlAttrDiagnostic(diagnostics, location, elementXpath, attrName, rawValue) {
|
|
33
66
|
diagnostics.push({
|
|
34
67
|
code: "invalid-xml-value",
|
|
@@ -42,6 +75,19 @@ function pushInvalidXmlAttrDiagnostic(diagnostics, location, elementXpath, attrN
|
|
|
42
75
|
rawValue
|
|
43
76
|
});
|
|
44
77
|
}
|
|
78
|
+
/** Reads only the two decoration attributes, leaving unrelated run properties to their owner. */
|
|
79
|
+
function readOoxmlTextDecoration(rPrCursor, location, diagnostics, diagnoseUnsupportedEnums = false) {
|
|
80
|
+
const rawU = rPrCursor.attr("u");
|
|
81
|
+
if (rawU !== void 0 && rawU !== "none" && rawU !== "sng" && diagnoseUnsupportedEnums) pushInvalidXmlAttrDiagnostic(diagnostics, location, rPrCursor.xpath, "u", rawU);
|
|
82
|
+
const rawStrike = rPrCursor.attr("strike");
|
|
83
|
+
if (rawStrike !== void 0 && rawStrike !== "noStrike" && rawStrike !== "sngStrike" && diagnoseUnsupportedEnums) pushInvalidXmlAttrDiagnostic(diagnostics, location, rPrCursor.xpath, "strike", rawStrike);
|
|
84
|
+
const underline = rawU === "sng" ? "underline" : rawU === "none" ? "none" : void 0;
|
|
85
|
+
const strike = rawStrike === "sngStrike" ? "line-through" : rawStrike === "noStrike" ? "none" : void 0;
|
|
86
|
+
return underline === void 0 && strike === void 0 ? void 0 : {
|
|
87
|
+
...underline === void 0 ? {} : { underline },
|
|
88
|
+
...strike === void 0 ? {} : { strike }
|
|
89
|
+
};
|
|
90
|
+
}
|
|
45
91
|
/**
|
|
46
92
|
* Parses `<a:rPr>`, `<a:defRPr>`, or `<a:endParaRPr>` scalar attributes independently so an
|
|
47
93
|
* out-of-range or malformed attribute strips only itself (recording `invalid-xml-value`) while
|
|
@@ -54,8 +100,6 @@ function readOoxmlRunAttrStyles(args) {
|
|
|
54
100
|
"sz",
|
|
55
101
|
"b",
|
|
56
102
|
"i",
|
|
57
|
-
"u",
|
|
58
|
-
"strike",
|
|
59
103
|
"cap",
|
|
60
104
|
"spc",
|
|
61
105
|
"kern",
|
|
@@ -90,11 +134,7 @@ function readOoxmlRunAttrStyles(args) {
|
|
|
90
134
|
if (parsed.success) fontStyle = parsed.data ? "italic" : "normal";
|
|
91
135
|
else pushInvalidXmlAttrDiagnostic(diagnostics, location, rPrCursor.xpath, "i", raw["i"]);
|
|
92
136
|
}
|
|
93
|
-
const
|
|
94
|
-
if (rawU !== void 0 && rawU !== "none" && rawU !== "sng" && args.diagnoseUnsupportedEnums === true) pushInvalidXmlAttrDiagnostic(diagnostics, location, rPrCursor.xpath, "u", rawU);
|
|
95
|
-
const rawStrike = raw["strike"];
|
|
96
|
-
if (rawStrike !== void 0 && rawStrike !== "noStrike" && rawStrike !== "sngStrike" && args.diagnoseUnsupportedEnums === true) pushInvalidXmlAttrDiagnostic(diagnostics, location, rPrCursor.xpath, "strike", rawStrike);
|
|
97
|
-
const textDecoration = rawU === "sng" ? "underline" : rawStrike === "sngStrike" ? "line-through" : args.allowNoneTextDecoration === true && rawU === "none" && rawStrike === "noStrike" ? "none" : void 0;
|
|
137
|
+
const decoration = readOoxmlTextDecoration(rPrCursor, location, diagnostics, args.diagnoseUnsupportedEnums);
|
|
98
138
|
const rawCap = raw["cap"];
|
|
99
139
|
if (rawCap !== void 0 && rawCap !== "none" && rawCap !== "all" && args.diagnoseUnsupportedEnums === true) pushInvalidXmlAttrDiagnostic(diagnostics, location, rPrCursor.xpath, "cap", rawCap);
|
|
100
140
|
const textTransform = rawCap === "all" ? "uppercase" : rawCap === "none" ? "none" : void 0;
|
|
@@ -104,6 +144,9 @@ function readOoxmlRunAttrStyles(args) {
|
|
|
104
144
|
if (parsed.success) letterSpacing = parsed.data === 0 ? 0 : parsed.data / 75;
|
|
105
145
|
else pushInvalidXmlAttrDiagnostic(diagnostics, location, rPrCursor.xpath, "spc", raw["spc"]);
|
|
106
146
|
}
|
|
147
|
+
if (raw["kern"] !== void 0) {
|
|
148
|
+
if (!ooxmlKerningCentipointsSchema.safeParse(raw["kern"]).success) pushInvalidXmlAttrDiagnostic(diagnostics, location, rPrCursor.xpath, "kern", raw["kern"]);
|
|
149
|
+
}
|
|
107
150
|
let baselineShift;
|
|
108
151
|
let inlineKind;
|
|
109
152
|
if (args.allowBaseline === true && raw["baseline"] !== void 0) {
|
|
@@ -118,7 +161,7 @@ function readOoxmlRunAttrStyles(args) {
|
|
|
118
161
|
...sizePt === void 0 ? {} : { sizePt },
|
|
119
162
|
...fontWeight === void 0 ? {} : { fontWeight },
|
|
120
163
|
...fontStyle === void 0 ? {} : { fontStyle },
|
|
121
|
-
...
|
|
164
|
+
...decoration === void 0 ? {} : { decoration },
|
|
122
165
|
...textTransform === void 0 ? {} : { textTransform },
|
|
123
166
|
...letterSpacing === void 0 ? {} : { letterSpacing },
|
|
124
167
|
...lang === void 0 ? {} : { lang },
|
|
@@ -274,4 +317,4 @@ function normalizeBulletCharacter(raw) {
|
|
|
274
317
|
recovered: true
|
|
275
318
|
};
|
|
276
319
|
}
|
|
277
|
-
export { MAXIMUM_COORDINATE_PX, MAXIMUM_LINE_WIDTH_EMU, MAXIMUM_WRITABLE_EMU, MINIMUM_WRITABLE_INT32_EMU, extentEmuFragmentSchema, hexRgb6Schema, nonNegativeExtentEmuFragmentSchema, normalizeBulletCharacter, offsetEmuFragmentSchema, ooxmlAutoNumStartAtSchema, ooxmlBaselineShiftThousandthsSchema, ooxmlBoolSchema, ooxmlFontSizeCentipointsSchema, ooxmlIntSchema, ooxmlLetterSpacingCentipointsSchema, ooxmlLineSpacingPercentSchema, ooxmlLineSpacingPointsSchema, ooxmlLineWidthEmuSchema, ooxmlListLevelSchema, ooxmlNonNegativeIntSchema, ooxmlParagraphSpacingPointsSchema, ooxmlPositiveFixedAngleSchema, ooxmlPositiveIntSchema, ooxmlPositiveLineWidthEmuSchema, ooxmlWritableExtentEmuSchema, ooxmlWritableInt32CoordEmuSchema, ooxmlWritablePositiveExtentEmuSchema, readOoxmlBoxInsets, readOoxmlRunAttrStyles, transformAttributesFragmentSchema };
|
|
320
|
+
export { MAXIMUM_COORDINATE_PX, MAXIMUM_LINE_WIDTH_EMU, MAXIMUM_WRITABLE_EMU, MINIMUM_WRITABLE_INT32_EMU, cascadeOoxmlTextDecoration, extentEmuFragmentSchema, hexRgb6Schema, nonNegativeExtentEmuFragmentSchema, normalizeBulletCharacter, offsetEmuFragmentSchema, ooxmlAutoNumStartAtSchema, ooxmlBaselineShiftThousandthsSchema, ooxmlBoolSchema, ooxmlFontSizeCentipointsSchema, ooxmlIntSchema, ooxmlKerningCentipointsSchema, ooxmlLetterSpacingCentipointsSchema, ooxmlLineSpacingPercentSchema, ooxmlLineSpacingPointsSchema, ooxmlLineWidthEmuSchema, ooxmlListLevelSchema, ooxmlNonNegativeIntSchema, ooxmlParagraphSpacingPointsSchema, ooxmlPlaceholderRoleSchema, ooxmlPositiveFixedAngleSchema, ooxmlPositiveIntSchema, ooxmlPositiveLineWidthEmuSchema, ooxmlWritableExtentEmuSchema, ooxmlWritableInt32CoordEmuSchema, ooxmlWritablePositiveExtentEmuSchema, projectOoxmlTextDecoration, readOoxmlBoxInsets, readOoxmlRunAttrStyles, readOoxmlTextDecoration, reportOoxmlTextDecorationLoss, transformAttributesFragmentSchema };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { canonicalQName } from "./namespaces.js";
|
|
2
2
|
import { DOMParser } from "@xmldom/xmldom";
|
|
3
|
-
// ../
|
|
3
|
+
// ../core/dist/kernel/pptx-read/xml-reader.js
|
|
4
4
|
var _a;
|
|
5
5
|
/** Error raised when an XML part fails well-formedness or lacks a root element. */
|
|
6
6
|
var MalformedXmlPartError = class extends Error {
|
|
@@ -133,6 +133,13 @@ var XmlElementCursor = class {
|
|
|
133
133
|
consumeAttr(localName, namespaceUri = "") {
|
|
134
134
|
return this.attr(localName, namespaceUri) !== void 0;
|
|
135
135
|
}
|
|
136
|
+
/** Returns a descendant's XPath without changing which XML has been consumed. */
|
|
137
|
+
descendantXpath(element) {
|
|
138
|
+
if (element === this.element) return this.xpath;
|
|
139
|
+
const parent = element.parentNode;
|
|
140
|
+
if (parent === null || !isXmlElement(parent)) throw new Error("Expected an XML descendant of the current cursor");
|
|
141
|
+
return childXpathFor(this.descendantXpath(parent), elementChildrenOf(parent), element);
|
|
142
|
+
}
|
|
136
143
|
/** Returns the first matching child cursor and marks that child element consumed. */
|
|
137
144
|
child(namespaceUri, localName) {
|
|
138
145
|
for (const child of this.#elementChildren()) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../
|
|
1
|
+
// ../core/dist/kernel/pptx-write/shape-tree.js
|
|
2
2
|
const emptyShapeTree = "<p:nvGrpSpPr><p:cNvPr id=\"1\" name=\"\"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"0\" cy=\"0\"/><a:chOff x=\"0\" y=\"0\"/><a:chExt cx=\"0\" cy=\"0\"/></a:xfrm></p:grpSpPr>";
|
|
3
3
|
/**
|
|
4
4
|
* Internal PresentationML shape tree wrapper shared by slides, masters, and layouts.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// ../core/dist/kernel/pptx-write/timing.js
|
|
2
|
+
function createTimingIds() {
|
|
3
|
+
let next = 1;
|
|
4
|
+
let mainSequenceId;
|
|
5
|
+
return {
|
|
6
|
+
get mainSequenceId() {
|
|
7
|
+
return mainSequenceId ??= next++;
|
|
8
|
+
},
|
|
9
|
+
take() {
|
|
10
|
+
return next++;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function writeTiming(contributions, onError) {
|
|
15
|
+
if (contributions.length === 0) return "";
|
|
16
|
+
const ids = createTimingIds();
|
|
17
|
+
const rootId = ids.take();
|
|
18
|
+
const children = [];
|
|
19
|
+
const builds = [];
|
|
20
|
+
const steps = [];
|
|
21
|
+
const startupEffects = [];
|
|
22
|
+
let requiresMainSequence = false;
|
|
23
|
+
contributions.forEach((contribute, index) => {
|
|
24
|
+
try {
|
|
25
|
+
const branches = contribute(ids);
|
|
26
|
+
requiresMainSequence ||= branches.requiresMainSequence === true;
|
|
27
|
+
children.push(...branches.rootChildren ?? []);
|
|
28
|
+
steps.push(...branches.mainSequenceSteps ?? []);
|
|
29
|
+
startupEffects.push(...branches.startupEffects ?? []);
|
|
30
|
+
builds.push(...branches.buildList ?? []);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
onError(index, error);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (requiresMainSequence || steps.length > 0 || startupEffects.length > 0) {
|
|
36
|
+
const sequenceId = ids.mainSequenceId;
|
|
37
|
+
if (startupEffects.length > 0) {
|
|
38
|
+
const entryId = ids.take();
|
|
39
|
+
const parallelId = ids.take();
|
|
40
|
+
steps.unshift(`<p:par><p:cTn id="${entryId}" fill="hold"><p:stCondLst><p:cond delay="indefinite"/><p:cond evt="onBegin" delay="0"><p:tn val="${sequenceId}"/></p:cond></p:stCondLst><p:childTnLst><p:par><p:cTn id="${parallelId}" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst>${startupEffects.join("")}</p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par>`);
|
|
41
|
+
}
|
|
42
|
+
const timeNode = `<p:cTn id="${sequenceId}" dur="indefinite" nodeType="mainSeq"`;
|
|
43
|
+
const mainTimeNode = steps.length === 0 ? `${timeNode}/>` : `${timeNode}><p:childTnLst>${steps.join("")}</p:childTnLst></p:cTn>`;
|
|
44
|
+
const slideTarget = "<p:tgtEl><p:sldTgt/></p:tgtEl>";
|
|
45
|
+
const sequence = `<p:seq concurrent="1" nextAc="seek">${mainTimeNode}<p:prevCondLst><p:cond evt="onPrev" delay="0">${slideTarget}</p:cond></p:prevCondLst><p:nextCondLst><p:cond evt="onNext" delay="0">${slideTarget}</p:cond></p:nextCondLst></p:seq>`;
|
|
46
|
+
children.unshift(sequence);
|
|
47
|
+
}
|
|
48
|
+
if (children.length === 0) return "";
|
|
49
|
+
const buildList = builds.length === 0 ? "" : `<p:bldLst>${builds.join("")}</p:bldLst>`;
|
|
50
|
+
return `<p:timing><p:tnLst><p:par><p:cTn id="${rootId}" dur="indefinite" restart="never" nodeType="tmRoot"><p:childTnLst>${children.join("")}</p:childTnLst></p:cTn></p:par></p:tnLst>${buildList}</p:timing>`;
|
|
51
|
+
}
|
|
52
|
+
export { createTimingIds, writeTiming };
|