@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,24 +1,24 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "
|
|
8
|
-
import { pxToEmu, xmlEscape } from "../../../emit/dist/ooxml.js";
|
|
9
|
-
import "../../../emit/dist/index.js";
|
|
10
|
-
import "../../../import/dist/index.js";
|
|
11
|
-
import { defineCanvasMechanism } from "../../../import/dist/mechanism.js";
|
|
1
|
+
import { CapabilityError } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { pxToEmu } from "../../kernel/drawing-units.js";
|
|
3
|
+
import "../../kernel/geometry-schemas.js";
|
|
4
|
+
import { assertValidLang, textStyleKeys } from "../../kernel/theme.js";
|
|
5
|
+
import { parseLinkTarget } from "../../kernel/author-schemas.js";
|
|
6
|
+
import { paddingStyleKeys } from "../../kernel/block-flex-layout.js";
|
|
7
|
+
import { parseCapabilityLayoutContract } from "../../kernel/layout.js";
|
|
12
8
|
import { applyTransformToPoints, blockArc, evaluateGeometry, path, preset } from "../shared/geometry.js";
|
|
9
|
+
import "../../kernel/capability.js";
|
|
10
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
11
|
+
import "../../kernel/pptx-read/index.js";
|
|
12
|
+
import { xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
13
13
|
import { nativeLinkXml, parseMorphKey, parseOptionalName } from "../shared/identity.js";
|
|
14
14
|
import { customGeometryShapeImportHandler, presetShapeImportHandler } from "./shape-import.js";
|
|
15
15
|
import { shapeXml } from "./shape-xml.js";
|
|
16
|
-
import { emitVisualModel, gradientFillMechanism, imageFillMechanism, linearGradient, paintVisualModel, radialGradient, resolveVisualModel, solidFillMechanism } from "../shared/visual.js";
|
|
17
|
-
import { motionAnnotations, motionParagraphAnnotations, pickMotionProps } from "../
|
|
18
|
-
import {
|
|
16
|
+
import { bindVisualModel, emitVisualModel, gradientFillMechanism, imageFillMechanism, linearGradient, paintVisualModel, radialGradient, resolveVisualModel, solidFillMechanism } from "../shared/visual.js";
|
|
17
|
+
import { motionAnnotations, motionParagraphAnnotations, pickMotionProps } from "../shared/motion-api.js";
|
|
18
|
+
import { shapeCoordinateSchema, shapeDeclarationPropsKeys, shapeSizeSchema, shapeStyleKeyList } from "../shared/shape-declaration.js";
|
|
19
|
+
import { alignMeasuredTextWidthsForOuterEmu, computeTextMetrics, emitTextBody, measureTextLayoutFromParagraphs, parseTextContent, renderTextOutlinesSvg, resolveTextBody, textInsets } from "../shared/text-service.js";
|
|
19
20
|
import { shapeCodegen } from "./shape-codegen.js";
|
|
20
|
-
|
|
21
|
-
// ../capabilities/dist/shape/shape.js
|
|
21
|
+
// ../core/dist/capabilities/shape/shape.js
|
|
22
22
|
const allowedParameters = shapeDeclarationPropsKeys;
|
|
23
23
|
const shapeStyleKeys = shapeStyleKeyList;
|
|
24
24
|
function record(input) {
|
|
@@ -31,16 +31,16 @@ function shapeTextStyle(props) {
|
|
|
31
31
|
}
|
|
32
32
|
function validateCoordinate(value, name, path) {
|
|
33
33
|
const parsed = shapeCoordinateSchema.safeParse(value);
|
|
34
|
-
if (!parsed.success) throw new CapabilityError("invalid-coordinate", `${name} must be a finite pixel number, width and height must be greater than 0, and coordinates must be between -1000000 and 1000000`, path);
|
|
34
|
+
if (!parsed.success) throw new CapabilityError("invalid-coordinate", `${name} must be a finite pixel number, width and height must be greater than 0, and coordinates must be between -1000000 and 1000000`, path, { field: name === "x" ? "style.left" : "style.top" });
|
|
35
35
|
return parsed.data;
|
|
36
36
|
}
|
|
37
37
|
function validateSize(value, name, path) {
|
|
38
38
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
39
|
-
if (value === 0 || pxToEmu(value) === 0) throw new CapabilityError("invalid-coordinate", `Computed ${name} is 0px; ${name} must be greater than 0px`, path);
|
|
40
|
-
if (value < 0 || pxToEmu(value) < 1) throw new CapabilityError("invalid-coordinate", `Computed ${name} is ${value}px; ${name} must be greater than 0px`, path);
|
|
41
|
-
} else throw new CapabilityError("invalid-coordinate", `${name} must be a finite pixel number greater than 0px`, path);
|
|
39
|
+
if (value === 0 || pxToEmu(value) === 0) throw new CapabilityError("invalid-coordinate", `Computed ${name} is 0px; ${name} must be greater than 0px`, path, { field: `style.${name}` });
|
|
40
|
+
if (value < 0 || pxToEmu(value) < 1) throw new CapabilityError("invalid-coordinate", `Computed ${name} is ${value}px; ${name} must be greater than 0px`, path, { field: `style.${name}` });
|
|
41
|
+
} else throw new CapabilityError("invalid-coordinate", `${name} must be a finite pixel number greater than 0px`, path, { field: `style.${name}` });
|
|
42
42
|
const parsed = shapeSizeSchema.safeParse(value);
|
|
43
|
-
if (!parsed.success) throw new CapabilityError("invalid-coordinate", `${name} must convert to an EMU value between 1 and 2147483647 inclusive`, path);
|
|
43
|
+
if (!parsed.success) throw new CapabilityError("invalid-coordinate", `${name} must convert to an EMU value between 1 and 2147483647 inclusive`, path, { field: `style.${name}` });
|
|
44
44
|
return parsed.data;
|
|
45
45
|
}
|
|
46
46
|
function roundSvgNumber(value) {
|
|
@@ -70,7 +70,7 @@ function paintShapeModel(model, paintContext) {
|
|
|
70
70
|
model: model.visual,
|
|
71
71
|
slideNumber: paintContext.slideNumber,
|
|
72
72
|
objectId: paintContext.objectId,
|
|
73
|
-
|
|
73
|
+
registerRasterResource: paintContext.registerRasterResource
|
|
74
74
|
});
|
|
75
75
|
switch (model.text.kind) {
|
|
76
76
|
case "none": return visualPaint;
|
|
@@ -121,6 +121,10 @@ const customGeometryShapeMechanism = defineCanvasMechanism({
|
|
|
121
121
|
paint: paintShapeModel,
|
|
122
122
|
import: customGeometryShapeImportHandler
|
|
123
123
|
});
|
|
124
|
+
const shapeMechanisms = {
|
|
125
|
+
preset: presetShapeMechanism,
|
|
126
|
+
custom: customGeometryShapeMechanism
|
|
127
|
+
};
|
|
124
128
|
/** Shape module independently validates input, encapsulates bound state, and emits native PresentationML objects. */
|
|
125
129
|
const shapeCapability = {
|
|
126
130
|
declaration: "shape",
|
|
@@ -132,7 +136,7 @@ const shapeCapability = {
|
|
|
132
136
|
gradientFillMechanism,
|
|
133
137
|
imageFillMechanism
|
|
134
138
|
],
|
|
135
|
-
bind(input, context) {
|
|
139
|
+
*bind(input, context) {
|
|
136
140
|
const unknown = Object.keys(input.props).find((key) => key !== "children" && !allowedParameters.includes(key));
|
|
137
141
|
if (unknown !== void 0) throw new CapabilityError("unknown-parameter", `Shape contains unsupported parameter ${unknown}`, void 0, {
|
|
138
142
|
prop: unknown,
|
|
@@ -165,16 +169,22 @@ const shapeCapability = {
|
|
|
165
169
|
...rawTextStyle,
|
|
166
170
|
verticalAlign: rawTextStyle["verticalAlign"] ?? "middle"
|
|
167
171
|
};
|
|
168
|
-
const { paragraphs, paragraphMotions, style: parsedTextStyle } = hasTextBody ? parseTextContent(input.children, effectiveTextStyle, context.theme, {
|
|
172
|
+
const { paragraphs, paragraphMotions, style: parsedTextStyle } = hasTextBody ? parseTextContent(input.children, effectiveTextStyle, context.theme, {
|
|
173
|
+
slideNumber: context.slideNumber,
|
|
174
|
+
referenceDate: context.options.referenceDate
|
|
175
|
+
}, "Shape.style", void 0, void 0, { allowParagraphMotion: true }) : {
|
|
169
176
|
paragraphs: [],
|
|
170
177
|
paragraphMotions: [],
|
|
171
|
-
style: parseTextContent([], {}, context.theme, {
|
|
178
|
+
style: parseTextContent([], {}, context.theme, {
|
|
179
|
+
slideNumber: context.slideNumber,
|
|
180
|
+
referenceDate: context.options.referenceDate
|
|
181
|
+
}, "Shape.style").style
|
|
172
182
|
};
|
|
173
183
|
const visualStyle = { ...record(input.props["style"]) };
|
|
174
184
|
const geometry = input.props["geometry"];
|
|
175
185
|
const authorId = typeof input.props["id"] === "string" ? input.props["id"] : void 0;
|
|
176
186
|
const motionProps = pickMotionProps(input.props);
|
|
177
|
-
|
|
187
|
+
const initialVisual = yield* bindVisualModel({
|
|
178
188
|
theme: context.theme,
|
|
179
189
|
style: visualStyle,
|
|
180
190
|
box: {
|
|
@@ -205,9 +215,12 @@ const shapeCapability = {
|
|
|
205
215
|
const innerWidth = request.availableWidth !== void 0 ? request.availableWidth : typeof width === "number" ? Math.max(0, width - insets.left - insets.right) : void 0;
|
|
206
216
|
try {
|
|
207
217
|
const measured = measureTextLayoutFromParagraphs(paragraphs, parsedTextStyle, innerWidth);
|
|
218
|
+
const { width: widthResult, minContentWidth: minContentWidthResult } = alignMeasuredTextWidthsForOuterEmu(measured, insets, request);
|
|
208
219
|
const baseline = parsedTextStyle.verticalAlign === "top" ? measured.baseline ?? "unavailable" : "unavailable";
|
|
209
220
|
return {
|
|
210
221
|
...measured,
|
|
222
|
+
width: widthResult,
|
|
223
|
+
minContentWidth: minContentWidthResult,
|
|
211
224
|
baseline
|
|
212
225
|
};
|
|
213
226
|
} catch (error) {
|
|
@@ -232,8 +245,9 @@ const shapeCapability = {
|
|
|
232
245
|
style: visualStyle,
|
|
233
246
|
box,
|
|
234
247
|
...geometry === void 0 ? {} : { geometry }
|
|
235
|
-
});
|
|
248
|
+
}, initialVisual.fill);
|
|
236
249
|
const geometryName = visual.geometry.kind === "custom" ? "custom" : visual.geometry.name;
|
|
250
|
+
const mechanism = shapeMechanisms[visual.geometry.kind];
|
|
237
251
|
const evaluated = evaluateGeometry(visual.geometry, box);
|
|
238
252
|
const connectionSites = applyTransformToPoints(evaluated.connectionSites, box, {
|
|
239
253
|
flipH: visual.flipH,
|
|
@@ -268,7 +282,7 @@ const shapeCapability = {
|
|
|
268
282
|
try {
|
|
269
283
|
escapedName = xmlEscape(name);
|
|
270
284
|
} catch {
|
|
271
|
-
throw new CapabilityError("invalid-xml-character", "Shape.name contains characters not allowed in XML 1.0");
|
|
285
|
+
throw new CapabilityError("invalid-xml-character", "Shape.name contains characters not allowed in XML 1.0", void 0, { field: "name" });
|
|
272
286
|
}
|
|
273
287
|
const resolvedModel = {
|
|
274
288
|
escapedName,
|
|
@@ -307,10 +321,10 @@ const shapeCapability = {
|
|
|
307
321
|
fontUsages: resolvedText.fontUsages
|
|
308
322
|
},
|
|
309
323
|
emit(emitContext) {
|
|
310
|
-
return
|
|
324
|
+
return mechanism.emit(resolvedModel, emitContext);
|
|
311
325
|
},
|
|
312
326
|
paint(paintContext) {
|
|
313
|
-
return
|
|
327
|
+
return mechanism.paint(resolvedModel, paintContext);
|
|
314
328
|
}
|
|
315
329
|
};
|
|
316
330
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// ../core/dist/capabilities/shared/container-slots.js
|
|
2
|
+
const background = ["background", "style.background"];
|
|
3
|
+
const backgroundSlots = {
|
|
4
|
+
declaration: "slide-background",
|
|
5
|
+
containerSlots: {
|
|
6
|
+
master: background,
|
|
7
|
+
layout: background,
|
|
8
|
+
slide: background
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const transition = ["transition", "advanceAfter"];
|
|
12
|
+
const transitionSlots = {
|
|
13
|
+
declaration: "transition",
|
|
14
|
+
containerSlots: {
|
|
15
|
+
master: transition,
|
|
16
|
+
layout: transition,
|
|
17
|
+
slide: transition
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const motion = ["motion"];
|
|
21
|
+
const motionSlots = {
|
|
22
|
+
declaration: "motion",
|
|
23
|
+
containerSlots: {
|
|
24
|
+
master: motion,
|
|
25
|
+
layout: motion,
|
|
26
|
+
slide: motion
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const headerFooter = ["headerFooter"];
|
|
30
|
+
const mastersSlots = {
|
|
31
|
+
declaration: "slide-masters",
|
|
32
|
+
selectionName: "masters",
|
|
33
|
+
containerSlots: {
|
|
34
|
+
master: headerFooter,
|
|
35
|
+
layout: headerFooter
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const footer = ["footerPlaceholders"];
|
|
39
|
+
const footerSlots = {
|
|
40
|
+
declaration: "footer-placeholder",
|
|
41
|
+
containerSlots: {
|
|
42
|
+
deck: ["notesHeaderFooter", "handoutHeaderFooter"],
|
|
43
|
+
master: footer,
|
|
44
|
+
layout: footer,
|
|
45
|
+
slide: [
|
|
46
|
+
"footer",
|
|
47
|
+
"dateTime",
|
|
48
|
+
"slideNumber"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const officialContainerSlots = [
|
|
53
|
+
backgroundSlots,
|
|
54
|
+
transitionSlots,
|
|
55
|
+
motionSlots,
|
|
56
|
+
mastersSlots,
|
|
57
|
+
footerSlots
|
|
58
|
+
];
|
|
59
|
+
export { backgroundSlots, footerSlots, mastersSlots, motionSlots, officialContainerSlots, transitionSlots };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { dateTimeFormatSchema } from "../../kernel/date-time-format.js";
|
|
2
|
+
// ../core/dist/capabilities/shared/date-time.js
|
|
3
|
+
const english = {
|
|
4
|
+
months: "January February March April May June July August September October November December".split(" "),
|
|
5
|
+
shortMonths: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),
|
|
6
|
+
weekdays: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ")
|
|
7
|
+
};
|
|
8
|
+
const words = {
|
|
9
|
+
en: english,
|
|
10
|
+
fr: {
|
|
11
|
+
months: "janvier février mars avril mai juin juillet août septembre octobre novembre décembre".split(" "),
|
|
12
|
+
shortMonths: "janv. févr. mars avr. mai juin juil. août sept. oct. nov. déc.".split(" "),
|
|
13
|
+
weekdays: "dimanche lundi mardi mercredi jeudi vendredi samedi".split(" ")
|
|
14
|
+
},
|
|
15
|
+
de: {
|
|
16
|
+
months: "Januar Februar März April Mai Juni Juli August September Oktober November Dezember".split(" "),
|
|
17
|
+
shortMonths: "Jan. Feb. März Apr. Mai Juni Juli Aug. Sept. Okt. Nov. Dez.".split(" "),
|
|
18
|
+
weekdays: "Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag".split(" ")
|
|
19
|
+
},
|
|
20
|
+
es: {
|
|
21
|
+
months: "enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre".split(" "),
|
|
22
|
+
shortMonths: "ene feb mar abr may jun jul ago sept oct nov dic".split(" "),
|
|
23
|
+
weekdays: "domingo lunes martes miércoles jueves viernes sábado".split(" ")
|
|
24
|
+
},
|
|
25
|
+
it: {
|
|
26
|
+
months: "gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre".split(" "),
|
|
27
|
+
shortMonths: "gen feb mar apr mag giu lug ago set ott nov dic".split(" "),
|
|
28
|
+
weekdays: "domenica lunedì martedì mercoledì giovedì venerdì sabato".split(" ")
|
|
29
|
+
},
|
|
30
|
+
pt: {
|
|
31
|
+
months: "janeiro fevereiro março abril maio junho julho agosto setembro outubro novembro dezembro".split(" "),
|
|
32
|
+
shortMonths: "jan fev mar abr mai jun jul ago set out nov dez".split(" "),
|
|
33
|
+
weekdays: "domingo segunda-feira terça-feira quarta-feira quinta-feira sexta-feira sábado".split(" ")
|
|
34
|
+
},
|
|
35
|
+
zh: {
|
|
36
|
+
months: "一月 二月 三月 四月 五月 六月 七月 八月 九月 十月 十一月 十二月".split(" "),
|
|
37
|
+
shortMonths: [],
|
|
38
|
+
weekdays: "星期日 星期一 星期二 星期三 星期四 星期五 星期六".split(" "),
|
|
39
|
+
meridiem: ["上午", "下午"]
|
|
40
|
+
},
|
|
41
|
+
ja: {
|
|
42
|
+
months: [],
|
|
43
|
+
shortMonths: [],
|
|
44
|
+
weekdays: "日曜日 月曜日 火曜日 水曜日 木曜日 金曜日 土曜日".split(" "),
|
|
45
|
+
meridiem: ["午前", "午後"]
|
|
46
|
+
},
|
|
47
|
+
ko: {
|
|
48
|
+
months: [],
|
|
49
|
+
shortMonths: [],
|
|
50
|
+
weekdays: "일요일 월요일 화요일 수요일 목요일 금요일 토요일".split(" "),
|
|
51
|
+
meridiem: ["오전", "오후"]
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
function padDayOrTime(value) {
|
|
55
|
+
return String(value).padStart(2, "0");
|
|
56
|
+
}
|
|
57
|
+
/** Formats cached field text in UTC using fixed calendar words and ASCII spacing. */
|
|
58
|
+
function formatDateTime(format, timestamp, lang = "en-US") {
|
|
59
|
+
const date = new Date(timestamp);
|
|
60
|
+
const language = lang.split("-")[0]?.toLowerCase() ?? "en";
|
|
61
|
+
const calendar = Object.hasOwn(words, language) ? words[language] ?? english : english;
|
|
62
|
+
const eastAsian = language === "zh" || language === "ja" || language === "ko";
|
|
63
|
+
const month = date.getUTCMonth() + 1;
|
|
64
|
+
const day = date.getUTCDate();
|
|
65
|
+
const year = date.getUTCFullYear();
|
|
66
|
+
const shortYear = padDayOrTime((year % 100 + 100) % 100);
|
|
67
|
+
const namedMonth = calendar.months[month - 1] ?? `${month}${language === "ko" ? "월" : "月"}`;
|
|
68
|
+
const monthAbbrev = calendar.shortMonths[month - 1] ?? `${month}${language === "ko" ? "월" : "月"}`;
|
|
69
|
+
const weekday = calendar.weekdays[date.getUTCDay()];
|
|
70
|
+
const dateNumeric = eastAsian ? `${year}/${month}/${day}` : calendar === english ? `${padDayOrTime(month)}/${padDayOrTime(day)}/${year}` : language === "de" ? `${padDayOrTime(day)}.${padDayOrTime(month)}.${year}` : `${padDayOrTime(day)}/${padDayOrTime(month)}/${year}`;
|
|
71
|
+
const dateLong = eastAsian ? language === "ko" ? `${year}년 ${month}월 ${day}일` : `${year}年${month}月${day}日` : language === "de" ? `${day}. ${namedMonth} ${year}` : language === "es" || language === "pt" ? `${day} de ${namedMonth} de ${year}` : `${day} ${namedMonth} ${year}`;
|
|
72
|
+
const hours = date.getUTCHours();
|
|
73
|
+
const minutes = padDayOrTime(date.getUTCMinutes());
|
|
74
|
+
const seconds = padDayOrTime(date.getUTCSeconds());
|
|
75
|
+
const time24 = `${padDayOrTime(hours)}:${minutes}`;
|
|
76
|
+
const time12 = `${hours % 12 || 12}:${minutes}`;
|
|
77
|
+
const meridiem = (calendar.meridiem ?? ["AM", "PM"])[hours < 12 ? 0 : 1];
|
|
78
|
+
const shortTime = eastAsian ? `${meridiem} ${time12}` : `${time12} ${meridiem}`;
|
|
79
|
+
const longTime = eastAsian ? `${meridiem} ${time12}:${seconds}` : `${time12}:${seconds} ${meridiem}`;
|
|
80
|
+
switch (format) {
|
|
81
|
+
case "datetimeFigureOut":
|
|
82
|
+
case "datetime1": return dateNumeric;
|
|
83
|
+
case "datetime2": return calendar === english ? `${weekday}, ${namedMonth} ${day}, ${year}` : `${weekday}${language === "de" ? "," : ""} ${dateLong}`;
|
|
84
|
+
case "datetime3": return dateLong;
|
|
85
|
+
case "datetime4": return calendar === english ? `${namedMonth} ${day}, ${year}` : dateLong;
|
|
86
|
+
case "datetime5": return `${day}-${monthAbbrev}-${shortYear}`;
|
|
87
|
+
case "datetime6": return `${namedMonth} ${shortYear}`;
|
|
88
|
+
case "datetime7": return `${monthAbbrev}-${shortYear}`;
|
|
89
|
+
case "datetime8": return `${dateNumeric} ${shortTime}`;
|
|
90
|
+
case "datetime9": return `${dateNumeric} ${longTime}`;
|
|
91
|
+
case "datetime10": return time24;
|
|
92
|
+
case "datetime11": return `${time24}:${seconds}`;
|
|
93
|
+
case "datetime12": return shortTime;
|
|
94
|
+
case "datetime13": return longTime;
|
|
95
|
+
default: return format;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export { dateTimeFormatSchema, formatDateTime };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { CapabilityError } from "../../../
|
|
2
|
-
import "../../../
|
|
3
|
-
import { xmlEscape } from "../../../
|
|
4
|
-
import "../../../emit/dist/index.js";
|
|
1
|
+
import { CapabilityError } from "../../../kernel/diagnostics.js";
|
|
2
|
+
import "../../../kernel/capability.js";
|
|
3
|
+
import { xmlEscape } from "../../../kernel/pptx-write/xml.js";
|
|
5
4
|
import { buildEmbeddedEotPayload, fontFamilyKey, validateEmbeddableTrueTypeFont } from "./font-engine.js";
|
|
6
|
-
// ../
|
|
5
|
+
// ../core/dist/capabilities/shared/font/font-embedding.js
|
|
7
6
|
/** Retains control characters and default ignorable code points in text stream without requiring standalone cmap glyphs. */
|
|
8
7
|
function requiresFontGlyph(character) {
|
|
9
8
|
return !/^[\p{Cc}\p{Default_Ignorable_Code_Point}]$/u.test(character);
|
|
@@ -84,7 +83,7 @@ function fontPresentationContributions(uses, requested) {
|
|
|
84
83
|
kind: "font-face",
|
|
85
84
|
key: use.claimKey
|
|
86
85
|
};
|
|
87
|
-
const resolveBytes = requested === "subset" ? (characters) => buildEmbeddedEotPayload(use.bytes, checked, "subset", characters, use, requiresVisibleFontGlyph) : void 0;
|
|
86
|
+
const resolveBytes = requested === "subset" ? (characters, { signal }) => buildEmbeddedEotPayload(use.bytes, checked, "subset", characters, use, requiresVisibleFontGlyph, signal) : void 0;
|
|
88
87
|
contributions.push({
|
|
89
88
|
collection: "p:embeddedFontLst",
|
|
90
89
|
presentationAttributes: { embedTrueTypeFonts: "1" },
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CapabilityError } from "../../../
|
|
2
|
-
import { bytesSha256, computePitchFamilyFromPanose, formatPanoseHex, peekFontFaceResource } from "../../../
|
|
3
|
-
import "../../../
|
|
1
|
+
import { CapabilityError } from "../../../kernel/diagnostics.js";
|
|
2
|
+
import { bytesSha256, computePitchFamilyFromPanose, formatPanoseHex, peekFontFaceResource } from "../../../kernel/font-seal.js";
|
|
3
|
+
import "../../../kernel/capability.js";
|
|
4
4
|
import { subsetFont } from "./font-subset.js";
|
|
5
5
|
import * as fontkit from "fontkit";
|
|
6
6
|
import * as hb from "harfbuzzjs";
|
|
7
|
-
// ../
|
|
7
|
+
// ../core/dist/capabilities/shared/font/font-engine.js
|
|
8
8
|
/** Normalizes a font family name for case-insensitive, whitespace-collapsed lookup. */
|
|
9
9
|
function fontFamilyKey(value) {
|
|
10
10
|
return value.trim().replace(/\s+/gu, " ").toLowerCase();
|
|
@@ -437,6 +437,11 @@ function openMeasureFontFace(source) {
|
|
|
437
437
|
ensureHarfBuzzFont(parsed);
|
|
438
438
|
return face;
|
|
439
439
|
}
|
|
440
|
+
/** Returns whether `face` maps `codePoint` to a non-.notdef glyph. */
|
|
441
|
+
function fontFaceCoversCodePoint(face, codePoint) {
|
|
442
|
+
const parsed = parsedOfMeasureFace(face);
|
|
443
|
+
return parsed.font.hasGlyphForCodePoint(codePoint) && parsed.font.glyphForCodePoint(codePoint).id !== 0;
|
|
444
|
+
}
|
|
440
445
|
/** Returns unique visible characters in `text` that lack a non-.notdef glyph in `face`. */
|
|
441
446
|
function findMissingFontGlyphs(face, text, requiresVisibleGlyph) {
|
|
442
447
|
const parsed = parsedOfMeasureFace(face);
|
|
@@ -461,6 +466,24 @@ function shapeFontAdvances(face, visibleText) {
|
|
|
461
466
|
});
|
|
462
467
|
return parsed.font.layout(visibleText).positions.map((position) => position.xAdvance);
|
|
463
468
|
}
|
|
469
|
+
/** Returns unkerned `hmtx` horizontal advances in font design units per code point. */
|
|
470
|
+
function unkernedFontAdvances(face, visibleText) {
|
|
471
|
+
if (visibleText === "") return [];
|
|
472
|
+
const parsed = parsedOfMeasureFace(face);
|
|
473
|
+
const cache = parsed.unkernedAdvanceCache ??= /* @__PURE__ */ new Map();
|
|
474
|
+
const advances = [];
|
|
475
|
+
for (const ch of visibleText) {
|
|
476
|
+
const cp = ch.codePointAt(0);
|
|
477
|
+
if (cp === void 0) continue;
|
|
478
|
+
let width = cache.get(cp);
|
|
479
|
+
if (width === void 0) {
|
|
480
|
+
width = parsed.font.glyphForCodePoint(cp).advanceWidth;
|
|
481
|
+
cache.set(cp, width);
|
|
482
|
+
}
|
|
483
|
+
advances.push(width);
|
|
484
|
+
}
|
|
485
|
+
return advances;
|
|
486
|
+
}
|
|
464
487
|
/** Shapes `visibleText` with direction/language and returns SVG glyph outline paths and offsets. */
|
|
465
488
|
function shapeFontOutlines(face, visibleText, isRtl, lang) {
|
|
466
489
|
if (visibleText === "") return [];
|
|
@@ -586,7 +609,7 @@ function getEotNameUtf16Le(names, id, context) {
|
|
|
586
609
|
if (field === void 0) return failFont(context, "unsupported-font-format", `Font name table is missing Unicode name field ${id} required for EOT`);
|
|
587
610
|
return field;
|
|
588
611
|
}
|
|
589
|
-
function subsetTrueTypeAndVerify(parsed, checked, characters, context, requiresVisibleGlyph) {
|
|
612
|
+
async function subsetTrueTypeAndVerify(parsed, checked, characters, context, requiresVisibleGlyph, signal) {
|
|
590
613
|
const requiredCharacters = [...new Set(characters)];
|
|
591
614
|
const missingCharacters = requiredCharacters.filter((character) => {
|
|
592
615
|
const codePoint = character.codePointAt(0);
|
|
@@ -595,8 +618,9 @@ function subsetTrueTypeAndVerify(parsed, checked, characters, context, requiresV
|
|
|
595
618
|
if (missingCharacters.length > 0) return failFont(context, "font-missing-glyph", `${context.family} ${context.weight} ${context.style} font is missing glyph for emitted character ${missingCharacters[0]}`, { characters: missingCharacters });
|
|
596
619
|
let subsetBytes;
|
|
597
620
|
try {
|
|
598
|
-
subsetBytes = subsetFont(parsed.bytes, characters);
|
|
621
|
+
subsetBytes = await subsetFont(parsed.bytes, characters, signal);
|
|
599
622
|
} catch (error) {
|
|
623
|
+
signal?.throwIfAborted();
|
|
600
624
|
return failFont(context, "font-subsetting-failed", `Failed to generate character subset for ${context.family}: ${error instanceof Error ? error.message : String(error)}`);
|
|
601
625
|
}
|
|
602
626
|
let subsetParsed;
|
|
@@ -690,14 +714,11 @@ function packUncompressedEot(parsed, checked, payloadBytes, context) {
|
|
|
690
714
|
new DataView(output.buffer).setUint32(0, size, true);
|
|
691
715
|
return output;
|
|
692
716
|
}
|
|
693
|
-
|
|
694
|
-
* Generates an uncompressed EOT (`.fntdata`) container for an already-validated
|
|
695
|
-
* static TrueType font in either `"full"` or `"subset"` embedding mode.
|
|
696
|
-
*/
|
|
697
|
-
function buildEmbeddedEotPayload(sourceBytes, checked, mode, characters, context, requiresVisibleGlyph) {
|
|
717
|
+
function buildEmbeddedEotPayload(sourceBytes, checked, mode, characters, context, requiresVisibleGlyph, signal) {
|
|
698
718
|
const parsed = getOrParseFontBinary(sourceBytes, checked.identity);
|
|
699
719
|
if (parsed.sfnt === void 0) return failFont(context, "unsupported-font-format", `Font data for ${context.family} is not a valid SFNT file`);
|
|
700
|
-
|
|
720
|
+
if (mode === "full") return packUncompressedEot(parsed, checked, parsed.bytes, context);
|
|
721
|
+
return subsetTrueTypeAndVerify(parsed, checked, characters ?? "", context, requiresVisibleGlyph, signal).then((bytes) => packUncompressedEot(parsed, checked, bytes, context));
|
|
701
722
|
}
|
|
702
723
|
/**
|
|
703
724
|
* Inspects unpacked SFNT bytes from an imported PPTX embedded font part, returning
|
|
@@ -831,4 +852,4 @@ function unpackFontCollectionFaces(bytes, family, options = {}) {
|
|
|
831
852
|
}
|
|
832
853
|
return unpacked;
|
|
833
854
|
}
|
|
834
|
-
export { buildEmbeddedEotPayload, findMissingFontGlyphs, fontFamilyKey, inspectImportedEmbeddedFont, isTrueTypeFontEmbeddable, openMeasureFontFace, resolveDeclaredFaceSlot, shapeFontAdvances, shapeFontOutlines, tryInferStaticFontFaceMetadata, unpackFontCollectionFaces, validateEmbeddableTrueTypeFont, validateFontFaceResource };
|
|
855
|
+
export { buildEmbeddedEotPayload, findMissingFontGlyphs, fontFaceCoversCodePoint, fontFamilyKey, inspectImportedEmbeddedFont, isTrueTypeFontEmbeddable, openMeasureFontFace, resolveDeclaredFaceSlot, shapeFontAdvances, shapeFontOutlines, tryInferStaticFontFaceMetadata, unkernedFontAdvances, unpackFontCollectionFaces, validateEmbeddableTrueTypeFont, validateFontFaceResource };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { defaultTheme, defineTheme, isFont, isTheme } from "../../../
|
|
2
|
-
import { masterTextStyleCategoryForRole, matchMasterPlaceholderSpec } from "../../../
|
|
3
|
-
import "
|
|
4
|
-
import
|
|
5
|
-
import { P_NS } from "../../../
|
|
6
|
-
import { readEmbeddedFontList, readPresentationThemeFontScheme, unpackEotFontData } from "../../../
|
|
7
|
-
import "../../../
|
|
1
|
+
import { defaultTheme, defineTheme, isFont, isTheme } from "../../../kernel/theme.js";
|
|
2
|
+
import { masterTextStyleCategoryForRole, matchMasterPlaceholderSpec } from "../../../kernel/placeholders.js";
|
|
3
|
+
import { isInlineRichTextNodeType } from "../text-schemas.js";
|
|
4
|
+
import "../../../kernel/capability.js";
|
|
5
|
+
import { P_NS } from "../../../kernel/pptx-read/namespaces.js";
|
|
6
|
+
import { readEmbeddedFontList, readPresentationThemeFontScheme, unpackEotFontData } from "../../../kernel/pptx-read/fonts.js";
|
|
7
|
+
import { CommonNode } from "../../../kernel/document.js";
|
|
8
|
+
import "../../../kernel/pptx-read/index.js";
|
|
8
9
|
import { fontFamilyKey, inspectImportedEmbeddedFont } from "./font-engine.js";
|
|
9
10
|
import { font } from "./font.js";
|
|
10
|
-
// ../
|
|
11
|
+
// ../core/dist/capabilities/shared/font/font-import.js
|
|
11
12
|
const reservedThemeFontPattern = /^(?:major|minor|\+(?:mj|mn)-)/iu;
|
|
12
13
|
function isPlainRecord(value) {
|
|
13
14
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -141,7 +142,7 @@ function upgradeStyleRecordFontAndWeight(style, inherited, lookup, options) {
|
|
|
141
142
|
};
|
|
142
143
|
}
|
|
143
144
|
function hasUnstyledTextLeaf(node) {
|
|
144
|
-
if (node.type
|
|
145
|
+
if (isInlineRichTextNodeType(node.type)) return true;
|
|
145
146
|
if (node.type === "text" || node.type === "cell" || node.type === "notes" || node.type === "paragraph") return node.children.length === 0 || node.children.some((child) => !(child instanceof CommonNode));
|
|
146
147
|
if (node.type === "shape") return node.children.some((child) => !(child instanceof CommonNode));
|
|
147
148
|
return false;
|
|
@@ -305,8 +306,36 @@ function upgradeChartTextStyleContainer(container, inherited, lookup) {
|
|
|
305
306
|
nextContext: styleUp.nextContext
|
|
306
307
|
};
|
|
307
308
|
}
|
|
309
|
+
function upgradeChartSeriesFonts(series, inherited, lookup) {
|
|
310
|
+
if (!isPlainRecord(series)) return series;
|
|
311
|
+
const labels = upgradeChartTextStyleContainer(series["dataLabels"], inherited, lookup);
|
|
312
|
+
const patch = {};
|
|
313
|
+
if (labels.changed) patch["dataLabels"] = labels.value;
|
|
314
|
+
const rawPoints = series["points"];
|
|
315
|
+
if (isPlainRecord(rawPoints)) {
|
|
316
|
+
const changedPoints = {};
|
|
317
|
+
for (const [index, point] of Object.entries(rawPoints)) {
|
|
318
|
+
if (!isPlainRecord(point)) continue;
|
|
319
|
+
const pointLabels = upgradeChartTextStyleContainer(point["dataLabels"], labels.nextContext, lookup);
|
|
320
|
+
if (pointLabels.changed) changedPoints[index] = {
|
|
321
|
+
...point,
|
|
322
|
+
dataLabels: pointLabels.value
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
if (Object.keys(changedPoints).length > 0) patch["points"] = {
|
|
326
|
+
...rawPoints,
|
|
327
|
+
...changedPoints
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return Object.keys(patch).length === 0 ? series : {
|
|
331
|
+
...series,
|
|
332
|
+
...patch
|
|
333
|
+
};
|
|
334
|
+
}
|
|
308
335
|
function upgradeChartPropsFonts(node, chartContext, lookup) {
|
|
309
336
|
const patch = {};
|
|
337
|
+
const legendUp = upgradeStyleRecordFontAndWeight(node.props["legendStyle"], chartContext, lookup);
|
|
338
|
+
if (legendUp.changed && legendUp.value !== void 0) patch["legendStyle"] = legendUp.value;
|
|
310
339
|
const titleUp = upgradeChartTextStyleContainer(node.props["title"], chartContext, lookup);
|
|
311
340
|
if (titleUp.changed && titleUp.value !== void 0) patch["title"] = titleUp.value;
|
|
312
341
|
const rawAxes = node.props["axes"];
|
|
@@ -339,14 +368,16 @@ function upgradeChartPropsFonts(node, chartContext, lookup) {
|
|
|
339
368
|
const nextGroups = rawGroups.map((group) => {
|
|
340
369
|
if (!isPlainRecord(group)) return group;
|
|
341
370
|
const labelsUp = upgradeChartTextStyleContainer(group["dataLabels"], chartContext, lookup);
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
371
|
+
const rawSeries = group["series"];
|
|
372
|
+
const series = Array.isArray(rawSeries) ? rawSeries.map((entry) => upgradeChartSeriesFonts(entry, labelsUp.nextContext, lookup)) : [];
|
|
373
|
+
const seriesChanged = Array.isArray(rawSeries) && series.some((entry, index) => entry !== rawSeries[index]);
|
|
374
|
+
if (!labelsUp.changed && !seriesChanged) return group;
|
|
375
|
+
groupsChanged = true;
|
|
376
|
+
return {
|
|
377
|
+
...group,
|
|
378
|
+
...labelsUp.changed ? { dataLabels: labelsUp.value } : {},
|
|
379
|
+
...seriesChanged ? { series } : {}
|
|
380
|
+
};
|
|
350
381
|
});
|
|
351
382
|
if (groupsChanged) patch["groups"] = nextGroups;
|
|
352
383
|
}
|
|
@@ -491,6 +522,16 @@ function attachEmbeddedFontsToSubtree(node, inherited, lookup, masterLookups, la
|
|
|
491
522
|
themeFonts: effectiveThemeFonts
|
|
492
523
|
};
|
|
493
524
|
}
|
|
525
|
+
if (node.type === "chart") {
|
|
526
|
+
const overrideFonts = upgradeThemeOverrideOnNode(mutableNode, lookup.fontsByKey);
|
|
527
|
+
currentContext = {
|
|
528
|
+
...currentContext,
|
|
529
|
+
themeFonts: {
|
|
530
|
+
...currentContext.themeFonts,
|
|
531
|
+
...overrideFonts
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
}
|
|
494
535
|
let childPlaceholderContext = placeholderContext;
|
|
495
536
|
let nodeStyleInherited = currentContext;
|
|
496
537
|
if (node.type !== "deck" && node.type !== "slide-master" && node.type !== "slide-layout" && node.type !== "slide") {
|
|
@@ -513,12 +554,10 @@ function attachEmbeddedFontsToSubtree(node, inherited, lookup, masterLookups, la
|
|
|
513
554
|
placeholderContext.layoutPh?.listStyles?.[key1to9],
|
|
514
555
|
placeholderContext.slideTextNodeStyle
|
|
515
556
|
]);
|
|
516
|
-
} else if (node.props["placeholder"]
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
const role = layoutPh?.type ?? nativeRef?.type;
|
|
521
|
-
if (role !== void 0) {
|
|
557
|
+
} else if (typeof node.props["placeholder"] === "string") {
|
|
558
|
+
const layoutPh = nextLayout?.placeholders?.[node.props["placeholder"]];
|
|
559
|
+
if (layoutPh !== void 0) {
|
|
560
|
+
const role = layoutPh.type;
|
|
522
561
|
const category = masterTextStyleCategoryForRole(role);
|
|
523
562
|
const masterTx = nextLayout?.master?.textStyles?.[category];
|
|
524
563
|
const masterPh = nextLayout?.master?.placeholders === void 0 ? void 0 : matchMasterPlaceholderSpec(nextLayout.master.placeholders, role);
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { addAbortListener } from "node:events";
|
|
4
|
+
// ../core/dist/capabilities/shared/font/font-subset.js
|
|
4
5
|
const hbMemoryModeReadonly = 1;
|
|
5
6
|
const require = createRequire(import.meta.url);
|
|
6
|
-
let
|
|
7
|
-
function loadHarfBuzzSubset() {
|
|
8
|
-
harfBuzzSubset ??= new WebAssembly.Instance(new WebAssembly.Module(readFileSync(require.resolve("harfbuzzjs/dist/harfbuzz-subset.wasm")))).exports;
|
|
9
|
-
return harfBuzzSubset;
|
|
10
|
-
}
|
|
7
|
+
let pendingHarfBuzzSubset;
|
|
11
8
|
/** Subsets font bytes to retain real TrueType glyphs and their layout closure according to a set of Unicode characters. */
|
|
12
|
-
function subsetFont(fontBytes, characters) {
|
|
9
|
+
async function subsetFont(fontBytes, characters, signal) {
|
|
10
|
+
signal?.throwIfAborted();
|
|
11
|
+
pendingHarfBuzzSubset ??= readFile(require.resolve("harfbuzzjs/dist/harfbuzz-subset.wasm")).then((bytes) => WebAssembly.instantiate(bytes)).then(({ instance }) => instance.exports).catch((error) => {
|
|
12
|
+
pendingHarfBuzzSubset = void 0;
|
|
13
|
+
throw error;
|
|
14
|
+
});
|
|
15
|
+
const initialization = pendingHarfBuzzSubset;
|
|
16
|
+
let listener;
|
|
17
|
+
try {
|
|
18
|
+
const hb = signal === void 0 ? await initialization : await new Promise((resolve, reject) => {
|
|
19
|
+
listener = addAbortListener(signal, () => reject(signal.reason));
|
|
20
|
+
initialization.then(resolve, reject);
|
|
21
|
+
});
|
|
22
|
+
signal?.throwIfAborted();
|
|
23
|
+
return subsetWithHarfBuzz(hb, fontBytes, characters);
|
|
24
|
+
} finally {
|
|
25
|
+
listener?.[Symbol.dispose]();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function subsetWithHarfBuzz(hb, fontBytes, characters) {
|
|
13
29
|
if (fontBytes.byteLength === 0) throw new Error("Font data is empty");
|
|
14
|
-
const hb = loadHarfBuzzSubset();
|
|
15
30
|
const fontPointer = hb.malloc(fontBytes.byteLength);
|
|
16
31
|
if (fontPointer === 0) throw new Error("HarfBuzz failed to allocate font memory");
|
|
17
32
|
let sourceBlob = 0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { bytesSha256, createSealedFontFace, markImmutableBytes, markSealedFont } from "../../../
|
|
2
|
-
import { fontOptionsSchema, unsealedFontSchema } from "../../../
|
|
3
|
-
import "../../../
|
|
1
|
+
import { bytesSha256, createSealedFontFace, markImmutableBytes, markSealedFont } from "../../../kernel/font-seal.js";
|
|
2
|
+
import { fontOptionsSchema, unsealedFontSchema } from "../../../kernel/theme.js";
|
|
3
|
+
import "../../../kernel/capability.js";
|
|
4
4
|
import { tryInferStaticFontFaceMetadata, unpackFontCollectionFaces } from "./font-engine.js";
|
|
5
|
-
// ../
|
|
5
|
+
// ../core/dist/capabilities/shared/font/font.js
|
|
6
6
|
/** Creates a Font value; resources are read only from caller-provided bytes. */
|
|
7
7
|
function font(family, faces = [], options = {}) {
|
|
8
8
|
const parsedOptions = fontOptionsSchema.safeParse(options);
|