@officedk/pptxdk 0.2.0 → 0.2.2
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 +8 -7
- 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
package/dist/build.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { _ as importOptionsSchema, a as EditabilityLoss, c as ImportError, d as ImportReport, f as cascadedOmissionSchema, g as importLocationSchema, h as importDiagnosticSchema, i as CascadedOmission, l as ImportLocation, m as fatalImportIssueSchema, n as createImporter, o as FatalImportIssue, p as editabilityLossSchema, s as ImportDiagnostic, t as ImportResult, u as ImportOptions, v as importReportSchema } from "./index-cK2KtukZ.js";
|
|
1
|
+
import { $r as TargetName, B as ResolvedSlideLayout, Br as BuildError, Bt as UnmeasuredFontIssue, C as CommonNode, Ct as ResolvedAudio, Dt as ResolvedImage, Et as ResolvedFooterSlot, Ft as ResolvedVideo, Gr as EmitOptions, Hr as BuildDiagnostic, It as ScreenPoint, Jr as PreviewError, Kr as Extension, Mt as ResolvedTable, Nt as ResolvedTableCell, Ot as ResolvedLayout, Pt as ResolvedTableRow, Qr as Target, R as ResolvedMaster, Rt as SlideLocator, St as ResolutionReport, Tt as ResolvedFooter, Ur as BuildDiagnosticFontUnavailableReason, Vr as CapabilityError, Wr as BuildOptions, Xr as PreviewPlaceholder, Zr as ResolveOptions, _i as DeclarationContainer, ai as fontEmbeddingModeSchema, bt as Resolution, ci as previewErrorSchema, ct as EmitResult, di as targetNameSchema, ei as buildDiagnosticFontUnavailableReasonSchema, fi as targetSchema, ft as Locator, gi as DeclarationChild, gt as ObjectTransform, ii as extensionSchema, it as BuildResult, jt as ResolvedSlide, kt as ResolvedObject, li as previewPlaceholderSchema, lt as FontStyleDescriptor, mt as MediaTrim, ni as buildOptionsSchema, oi as formatBaseline, ot as CapabilityModule, pi as targets, pt as LocatorResource, qr as FontEmbeddingMode, ri as emitOptionsSchema, rt as BuildReport, si as formatBaselineSchema, ti as buildDiagnosticSchema, ui as resolveOptionsSchema, ut as FontUsage, vi as DeclarationNode, vt as Rect, wi as DateTimeFormat, wt as ResolvedComment, xt as ResolutionDimensionsSummary, yi as DeclarationText, z as ResolvedPlaceholder, zt as TextMetrics } from "./index-B9_OUeA-.js";
|
|
2
|
+
import { a as ImportDiagnostic, c as ImportOptions, d as editabilityLossSchema, f as fatalImportIssueSchema, g as importReportSchema, h as importOptionsSchema, i as FatalImportIssue, l as ImportReport, m as importLocationSchema, n as CascadedOmission, o as ImportError, p as importDiagnosticSchema, r as EditabilityLoss, s as ImportLocation, u as cascadedOmissionSchema } from "./index-DA9flrlR.js";
|
|
3
|
+
import { _ as createImporter, a as CodegenDiagnosticCode, c as CodegenFileContent, d as CodegenTarget, f as codegenDiagnosticCodeSchema, g as ImportResult, h as codegenTargetSchema, i as CodegenDiagnostic, l as CodegenOptions, m as codegenOptionsSchema, n as officialCapabilityNames, o as CodegenEntryName, p as codegenDiagnosticSchema, r as createCodegen, s as CodegenError, t as createResolver, u as CodegenResult, v as emit } from "./stages-DYHSHKt4.js";
|
|
5
4
|
import { z } from "zod";
|
|
6
5
|
import { ReactNode } from "react";
|
|
7
|
-
/** Complete list of official capability names in canonical order. */
|
|
8
|
-
export declare const officialCapabilityNames: readonly ["box", "chart", "footer-placeholder", "group", "image", "line", "masters", "motion", "notes", "placeholder", "shape", "slide-background", "table", "text", "transition"];
|
|
9
6
|
/** Official capability module names accepted by `@officedk/pptxdk/build`. */
|
|
10
|
-
export type OfficialCapabilityName = "box" | "chart" | "footer-placeholder" | "group" | "image" | "line" | "masters" | "motion" | "notes" | "placeholder" | "shape" | "slide-background" | "table" | "text" | "transition";
|
|
7
|
+
export type OfficialCapabilityName = "audio" | "box" | "chart" | "comment" | "footer-placeholder" | "group" | "image" | "line" | "masters" | "motion" | "notes" | "placeholder" | "shape" | "slide-background" | "table" | "text" | "transition" | "video";
|
|
11
8
|
export declare const officialCapabilityNameSchema: z.ZodType<OfficialCapabilityName>;
|
|
12
9
|
export type TrimmedResolveOptions = ResolveOptions & {
|
|
13
10
|
readonly capabilities: readonly OfficialCapabilityName[];
|
|
@@ -32,4 +29,4 @@ export declare function resolve(input: ReactNode | CommonNode, options: TrimmedR
|
|
|
32
29
|
* Loads only the selected official capabilities, resolves the document, and emits a PPTX archive.
|
|
33
30
|
*/
|
|
34
31
|
export declare function build(input: ReactNode | CommonNode, options: TrimmedBuildOptions): Promise<BuildResult>;
|
|
35
|
-
export { type BuildDiagnostic, type BuildDiagnosticFontUnavailableReason, BuildError, type BuildOptions, type BuildReport, type BuildResult, CapabilityError, type CapabilityModule, type CascadedOmission, type CodegenDiagnostic, type CodegenDiagnosticCode, type CodegenEntryName, CodegenError, type CodegenFileContent, type CodegenOptions, type CodegenResult, type CodegenTarget, type DeclarationChild, type DeclarationContainer, type DeclarationNode, type DeclarationText, type EditabilityLoss, type EmitOptions, type EmitResult, type Extension, type FatalImportIssue, type FontEmbeddingMode, type FontStyleDescriptor, type FontUsage, type ImportDiagnostic, ImportError, type ImportLocation, type ImportOptions, type ImportReport, type ImportResult, type Locator, type LocatorResource, type ObjectTransform, type PreviewError, type PreviewPlaceholder, type Rect, type Resolution, type ResolutionDimensionsSummary, type ResolutionReport, type ResolveOptions, type ResolvedFooter, type ResolvedFooterSlot, type ResolvedImage, type ResolvedLayout, type ResolvedMaster, type ResolvedObject, type ResolvedPlaceholder, type ResolvedSlide, type ResolvedSlideLayout, type ResolvedTable, type ResolvedTableCell, type ResolvedTableRow, type ScreenPoint, type SlideLocator, type Target, type TargetName, type TextMetrics, type UnmeasuredFontIssue, buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, cascadedOmissionSchema, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen, createImporter, createResolver, editabilityLossSchema, emit, emitOptionsSchema, extensionSchema, fatalImportIssueSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, importDiagnosticSchema, importLocationSchema, importOptionsSchema, importReportSchema, previewErrorSchema, previewPlaceholderSchema, resolveOptionsSchema, targetNameSchema, targetSchema, targets };
|
|
32
|
+
export { type BuildDiagnostic, type BuildDiagnosticFontUnavailableReason, BuildError, type BuildOptions, type BuildReport, type BuildResult, CapabilityError, type CapabilityModule, type CascadedOmission, type CodegenDiagnostic, type CodegenDiagnosticCode, type CodegenEntryName, CodegenError, type CodegenFileContent, type CodegenOptions, type CodegenResult, type CodegenTarget, type DateTimeFormat, type DeclarationChild, type DeclarationContainer, type DeclarationNode, type DeclarationText, type EditabilityLoss, type EmitOptions, type EmitResult, type Extension, type FatalImportIssue, type FontEmbeddingMode, type FontStyleDescriptor, type FontUsage, type ImportDiagnostic, ImportError, type ImportLocation, type ImportOptions, type ImportReport, type ImportResult, type Locator, type LocatorResource, type MediaTrim, type ObjectTransform, type PreviewError, type PreviewPlaceholder, type Rect, type Resolution, type ResolutionDimensionsSummary, type ResolutionReport, type ResolveOptions, type ResolvedAudio, type ResolvedComment, type ResolvedFooter, type ResolvedFooterSlot, type ResolvedImage, type ResolvedLayout, type ResolvedMaster, type ResolvedObject, type ResolvedPlaceholder, type ResolvedSlide, type ResolvedSlideLayout, type ResolvedTable, type ResolvedTableCell, type ResolvedTableRow, type ResolvedVideo, type ScreenPoint, type SlideLocator, type Target, type TargetName, type TextMetrics, type UnmeasuredFontIssue, buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, cascadedOmissionSchema, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen, createImporter, createResolver, editabilityLossSchema, emit, emitOptionsSchema, extensionSchema, fatalImportIssueSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, importDiagnosticSchema, importLocationSchema, importOptionsSchema, importReportSchema, officialCapabilityNames, previewErrorSchema, previewPlaceholderSchema, resolveOptionsSchema, targetNameSchema, targetSchema, targets };
|
package/dist/build.js
CHANGED
|
@@ -1,55 +1,37 @@
|
|
|
1
|
-
import { BuildError, CapabilityError, toBuildDiagnostic } from "./core/dist/diagnostics.js";
|
|
2
|
-
import { buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, buildOptionsShape, emitOptionsSchema, extensionSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, previewErrorSchema, previewPlaceholderSchema, resolveOptionsSchema, resolveOptionsShape, targetNameSchema, targetSchema, targets } from "./core/dist/stage-options.js";
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import "./core/dist/
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "./
|
|
10
|
-
import {
|
|
11
|
-
import { createCodegen } from "./codegen/dist/codegen.js";
|
|
12
|
-
import "./import/dist/index.js";
|
|
13
|
-
import { emitBuildResult, resolveDocumentInput } from "./pptxdk/src/compose.js";
|
|
1
|
+
import { BuildError, CapabilityError, toBuildDiagnostic } from "./core/dist/kernel/diagnostics.js";
|
|
2
|
+
import { buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, buildOptionsShape, emitOptionsSchema, extensionSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, previewErrorSchema, previewPlaceholderSchema, resolveOptionsSchema, resolveOptionsShape, targetNameSchema, targetSchema, targets } from "./core/dist/kernel/stage-options.js";
|
|
3
|
+
import "./core/dist/kernel/index.js";
|
|
4
|
+
import { ImportError, cascadedOmissionSchema, editabilityLossSchema, fatalImportIssueSchema, importDiagnosticSchema, importLocationSchema, importOptionsSchema, importReportSchema } from "./core/dist/kernel/pptx-read/diagnostics.js";
|
|
5
|
+
import { CodegenError, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema } from "./core/dist/kernel/codegen.js";
|
|
6
|
+
import { emit, validateOptions } from "./core/dist/emit/emit.js";
|
|
7
|
+
import { createImporter } from "./core/dist/import/import.js";
|
|
8
|
+
import { createCodegen } from "./core/dist/codegen/codegen.js";
|
|
9
|
+
import { createResolver, officialCapabilityNames } from "./core/dist/document/stages.js";
|
|
10
|
+
import { emitBuildResult, prepareDocumentInput, resolveDocumentInput, throwIfInvalidReferenceDateOption } from "./pptxdk/src/compose.js";
|
|
14
11
|
import { z } from "zod";
|
|
15
12
|
// src/build.ts
|
|
16
|
-
/** Complete list of official capability names in canonical order. */
|
|
17
|
-
const officialCapabilityNames = Object.freeze([
|
|
18
|
-
"box",
|
|
19
|
-
"chart",
|
|
20
|
-
"footer-placeholder",
|
|
21
|
-
"group",
|
|
22
|
-
"image",
|
|
23
|
-
"line",
|
|
24
|
-
"masters",
|
|
25
|
-
"motion",
|
|
26
|
-
"notes",
|
|
27
|
-
"placeholder",
|
|
28
|
-
"shape",
|
|
29
|
-
"slide-background",
|
|
30
|
-
"table",
|
|
31
|
-
"text",
|
|
32
|
-
"transition"
|
|
33
|
-
]);
|
|
34
13
|
const rawOfficialCapabilityNameSchema = z.enum(officialCapabilityNames);
|
|
35
14
|
const officialCapabilityNameSchema = rawOfficialCapabilityNameSchema;
|
|
36
15
|
const capabilitiesSelectionSchema = z.array(rawOfficialCapabilityNameSchema).readonly();
|
|
37
16
|
const capabilityLoaders = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
17
|
+
audio: async () => (await import("./core/dist/capabilities/audio/entry.js")).audioCapability,
|
|
18
|
+
box: async () => (await import("./core/dist/capabilities/box/entry.js")).boxCapability,
|
|
19
|
+
chart: async () => (await import("./core/dist/capabilities/chart/entry.js")).chartCapability,
|
|
20
|
+
comment: async () => (await import("./core/dist/capabilities/comment/entry.js")).commentCapability,
|
|
21
|
+
"footer-placeholder": async () => (await import("./core/dist/capabilities/footer-placeholder/entry.js")).footerPlaceholderCapability,
|
|
22
|
+
group: async () => (await import("./core/dist/capabilities/group/entry.js")).groupCapability,
|
|
23
|
+
image: async () => (await import("./core/dist/capabilities/image/entry.js")).imageCapability,
|
|
24
|
+
line: async () => (await import("./core/dist/capabilities/line/entry.js")).lineCapability,
|
|
25
|
+
masters: async () => (await import("./core/dist/capabilities/masters/entry.js")).mastersCapability,
|
|
26
|
+
motion: async () => (await import("./core/dist/capabilities/motion/entry.js")).motionCapability,
|
|
27
|
+
notes: async () => (await import("./core/dist/capabilities/notes/entry.js")).notesCapability,
|
|
28
|
+
placeholder: async () => (await import("./core/dist/capabilities/placeholder/entry.js")).placeholderCapability,
|
|
29
|
+
shape: async () => (await import("./core/dist/capabilities/shape/entry.js")).shapeCapability,
|
|
30
|
+
"slide-background": async () => (await import("./core/dist/capabilities/slide-background/entry.js")).slideBackgroundCapability,
|
|
31
|
+
table: async () => (await import("./core/dist/capabilities/table/entry.js")).tableCapability,
|
|
32
|
+
text: async () => (await import("./core/dist/capabilities/text/entry.js")).textCapability,
|
|
33
|
+
video: async () => (await import("./core/dist/capabilities/video/entry.js")).videoCapability,
|
|
34
|
+
transition: async () => (await import("./core/dist/capabilities/transition/entry.js")).transitionCapability
|
|
53
35
|
};
|
|
54
36
|
const trimmedResolveOptionsSchema = z.strictObject({
|
|
55
37
|
...resolveOptionsShape,
|
|
@@ -85,10 +67,10 @@ async function selectCapabilities(names, options = {}) {
|
|
|
85
67
|
if (options.signal?.aborted) throw options.signal.reason;
|
|
86
68
|
return Object.freeze(modules);
|
|
87
69
|
}
|
|
88
|
-
async function resolveSelected(input, capabilities,
|
|
89
|
-
const
|
|
90
|
-
const modules = await selectCapabilities(capabilities,
|
|
91
|
-
return resolveDocumentInput(createResolver(modules),
|
|
70
|
+
async function resolveSelected(input, capabilities, options) {
|
|
71
|
+
const prepared = prepareDocumentInput(input);
|
|
72
|
+
const modules = await selectCapabilities(capabilities, options.signal === void 0 ? {} : { signal: options.signal });
|
|
73
|
+
return resolveDocumentInput(createResolver(modules), prepared, options);
|
|
92
74
|
}
|
|
93
75
|
/**
|
|
94
76
|
* Loads only the selected official capabilities and resolves either a CommonNode document or a JSX
|
|
@@ -103,10 +85,16 @@ async function resolve(input, options) {
|
|
|
103
85
|
prop: String(issue.keys[0]),
|
|
104
86
|
scope: "options"
|
|
105
87
|
})]);
|
|
88
|
+
throwIfInvalidReferenceDateOption(issue?.path[0], options);
|
|
106
89
|
if (issue?.path[0] === "signal") throw new BuildError([toBuildDiagnostic("resolve.signal", "invalid-options", "Resolve options signal must be an AbortSignal", { field: "signal" })]);
|
|
107
90
|
throw new BuildError([toBuildDiagnostic("resolve", "invalid-options", "Build options must be an object")]);
|
|
108
91
|
}
|
|
109
|
-
|
|
92
|
+
const capabilities = validateCapabilityNames(parsed.data.capabilities);
|
|
93
|
+
const { referenceDate, signal } = parsed.data;
|
|
94
|
+
return resolveSelected(input, capabilities, {
|
|
95
|
+
referenceDate,
|
|
96
|
+
signal
|
|
97
|
+
});
|
|
110
98
|
}
|
|
111
99
|
/**
|
|
112
100
|
* Loads only the selected official capabilities, resolves the document, and emits a PPTX archive.
|
|
@@ -122,7 +110,11 @@ async function build(input, options) {
|
|
|
122
110
|
}
|
|
123
111
|
const capabilities = validateCapabilityNames(parsed.data.capabilities);
|
|
124
112
|
const { capabilities: _capabilities, ...buildOptions } = parsed.data;
|
|
125
|
-
const
|
|
113
|
+
const { referenceDate, signal } = buildOptions;
|
|
114
|
+
const resolution = await resolveSelected(input, capabilities, {
|
|
115
|
+
referenceDate,
|
|
116
|
+
signal
|
|
117
|
+
});
|
|
126
118
|
return emitBuildResult(resolution, buildOptions);
|
|
127
119
|
}
|
|
128
120
|
export { BuildError, CapabilityError, CodegenError, ImportError, build, buildDiagnosticFontUnavailableReasonSchema, buildDiagnosticSchema, buildOptionsSchema, cascadedOmissionSchema, codegenDiagnosticCodeSchema, codegenDiagnosticSchema, codegenOptionsSchema, codegenTargetSchema, createCodegen, createImporter, createResolver, editabilityLossSchema, emit, emitOptionsSchema, extensionSchema, fatalImportIssueSchema, fontEmbeddingModeSchema, formatBaseline, formatBaselineSchema, importDiagnosticSchema, importLocationSchema, importOptionsSchema, importReportSchema, officialCapabilityNameSchema, officialCapabilityNames, previewErrorSchema, previewPlaceholderSchema, resolve, resolveOptionsSchema, selectCapabilities, targetNameSchema, targetSchema, targets, trimmedBuildOptionsSchema, trimmedResolveOptionsSchema };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
2
|
+
// ../core/dist/capabilities/audio/audio-declaration.js
|
|
3
|
+
/** Creates an editable native audio declaration without loading the audio capability. */
|
|
4
|
+
function createAudioNode(props) {
|
|
5
|
+
return new CommonNode("audio", "audio", props);
|
|
6
|
+
}
|
|
7
|
+
export { createAudioNode };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { readImageBytes } from "../shared/image-decode.js";
|
|
2
|
+
import { renderMediaPoster } from "../shared/media-poster.js";
|
|
3
|
+
import { hasBmffAudioOnlyTracks, readBmffMetadata } from "../shared/media-source.js";
|
|
4
|
+
// ../core/dist/capabilities/audio/audio-source.js
|
|
5
|
+
const formats = {
|
|
6
|
+
wav: {
|
|
7
|
+
extension: "wav",
|
|
8
|
+
contentType: "audio/wav"
|
|
9
|
+
},
|
|
10
|
+
mp3: {
|
|
11
|
+
extension: "mp3",
|
|
12
|
+
contentType: "audio/mpeg"
|
|
13
|
+
},
|
|
14
|
+
m4a: {
|
|
15
|
+
extension: "m4a",
|
|
16
|
+
contentType: "audio/mp4"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function linkedAudioContentType(url) {
|
|
20
|
+
const path = url.split(/[?#]/u, 1)[0];
|
|
21
|
+
const suffix = /\.(wav|mp3|m4a)$/iu.exec(path)?.[1]?.toLowerCase();
|
|
22
|
+
if (suffix === "wav" || suffix === "mp3" || suffix === "m4a") return formats[suffix].contentType;
|
|
23
|
+
}
|
|
24
|
+
function waveDuration(bytes) {
|
|
25
|
+
let byteRate;
|
|
26
|
+
let dataLength;
|
|
27
|
+
const riffEnd = Math.min(bytes.length, bytes.readUInt32LE(4) + 8);
|
|
28
|
+
for (let offset = 12; offset + 8 <= riffEnd;) {
|
|
29
|
+
const tag = bytes.toString("ascii", offset, offset + 4);
|
|
30
|
+
const size = bytes.readUInt32LE(offset + 4);
|
|
31
|
+
const body = offset + 8;
|
|
32
|
+
if (body + size > riffEnd) break;
|
|
33
|
+
if (tag === "fmt " && size >= 16) byteRate = bytes.readUInt32LE(body + 8);
|
|
34
|
+
if (tag === "data") dataLength = size;
|
|
35
|
+
if (byteRate && dataLength !== void 0) return 1e3 * dataLength / byteRate;
|
|
36
|
+
offset = body + size + (size & 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const mpeg1Bitrates = [
|
|
40
|
+
0,
|
|
41
|
+
32,
|
|
42
|
+
40,
|
|
43
|
+
48,
|
|
44
|
+
56,
|
|
45
|
+
64,
|
|
46
|
+
80,
|
|
47
|
+
96,
|
|
48
|
+
112,
|
|
49
|
+
128,
|
|
50
|
+
160,
|
|
51
|
+
192,
|
|
52
|
+
224,
|
|
53
|
+
256,
|
|
54
|
+
320
|
|
55
|
+
];
|
|
56
|
+
const mpeg2Bitrates = [
|
|
57
|
+
0,
|
|
58
|
+
8,
|
|
59
|
+
16,
|
|
60
|
+
24,
|
|
61
|
+
32,
|
|
62
|
+
40,
|
|
63
|
+
48,
|
|
64
|
+
56,
|
|
65
|
+
64,
|
|
66
|
+
80,
|
|
67
|
+
96,
|
|
68
|
+
112,
|
|
69
|
+
128,
|
|
70
|
+
144,
|
|
71
|
+
160
|
|
72
|
+
];
|
|
73
|
+
const mpeg1SampleRates = [
|
|
74
|
+
44100,
|
|
75
|
+
48e3,
|
|
76
|
+
32e3
|
|
77
|
+
];
|
|
78
|
+
function mp3Frame(bytes, offset) {
|
|
79
|
+
if (offset + 4 > bytes.length || bytes[offset] !== 255) return void 0;
|
|
80
|
+
const flags = bytes[offset + 1];
|
|
81
|
+
const version = flags >> 3 & 3;
|
|
82
|
+
const layer = flags >> 1 & 3;
|
|
83
|
+
const rate = bytes[offset + 2];
|
|
84
|
+
const bitrateIndex = rate >> 4;
|
|
85
|
+
const sampleRateBase = mpeg1SampleRates[rate >> 2 & 3];
|
|
86
|
+
if ((flags & 224) !== 224 || version === 1 || layer !== 1 || bitrateIndex === 15 || sampleRateBase === void 0) return void 0;
|
|
87
|
+
const sampleRate = sampleRateBase / (version === 3 ? 1 : version === 2 ? 2 : 4);
|
|
88
|
+
const samples = version === 3 ? 1152 : 576;
|
|
89
|
+
const bitrate = (version === 3 ? mpeg1Bitrates : mpeg2Bitrates)[bitrateIndex];
|
|
90
|
+
return {
|
|
91
|
+
length: bitrate === 0 ? 0 : Math.floor(samples * bitrate * 125 / sampleRate) + (rate >> 1 & 1),
|
|
92
|
+
duration: 1e3 * samples / sampleRate
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function id3End(bytes) {
|
|
96
|
+
if (bytes.length < 10 || !bytes.subarray(0, 3).equals(id3Magic) || ![
|
|
97
|
+
2,
|
|
98
|
+
3,
|
|
99
|
+
4
|
|
100
|
+
].includes(bytes[3]) || bytes[4] === 255) return void 0;
|
|
101
|
+
const size = bytes.subarray(6, 10);
|
|
102
|
+
if (size.some((byte) => byte >= 128)) return void 0;
|
|
103
|
+
const footer = bytes[3] === 4 && (bytes[5] & 16) !== 0 ? 10 : 0;
|
|
104
|
+
return 10 + size.reduce((value, byte) => (value << 7) + byte, 0) + footer;
|
|
105
|
+
}
|
|
106
|
+
const id3Magic = Buffer.from("ID3");
|
|
107
|
+
function mp3Duration(bytes, start) {
|
|
108
|
+
let duration = 0;
|
|
109
|
+
for (let offset = start; offset < bytes.length;) {
|
|
110
|
+
const frame = mp3Frame(bytes, offset);
|
|
111
|
+
if (frame === void 0 || frame.length === 0 || offset + frame.length > bytes.length) break;
|
|
112
|
+
const sideInfoSize = (bytes[offset + 1] & 8) !== 0 ? (bytes[offset + 3] & 192) === 192 ? 17 : 32 : (bytes[offset + 3] & 192) === 192 ? 9 : 17;
|
|
113
|
+
const hasCrc = (bytes[offset + 1] & 1) === 0;
|
|
114
|
+
const xing = offset + 4 + sideInfoSize + (hasCrc ? 2 : 0);
|
|
115
|
+
if (offset === start && xing + 12 <= offset + frame.length) {
|
|
116
|
+
const tag = bytes.toString("ascii", xing, xing + 4);
|
|
117
|
+
if ((tag === "Xing" || tag === "Info") && (bytes.readUInt32BE(xing + 4) & 1) !== 0) {
|
|
118
|
+
const count = bytes.readUInt32BE(xing + 8);
|
|
119
|
+
if (count > 0) return count * frame.duration;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
duration += frame.duration;
|
|
123
|
+
offset += frame.length;
|
|
124
|
+
}
|
|
125
|
+
return duration > 0 ? duration : void 0;
|
|
126
|
+
}
|
|
127
|
+
function detectAudio(bytes) {
|
|
128
|
+
const data = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
129
|
+
if (data.length >= 12 && data.toString("latin1", 0, 4) === "RIFF" && data.toString("latin1", 8, 12) === "WAVE") {
|
|
130
|
+
const duration = waveDuration(data);
|
|
131
|
+
return {
|
|
132
|
+
...formats.wav,
|
|
133
|
+
...duration === void 0 ? {} : { duration }
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const tagEnd = id3End(data);
|
|
137
|
+
if (tagEnd !== void 0 || mp3Frame(data, 0) !== void 0) {
|
|
138
|
+
const duration = mp3Duration(data, tagEnd ?? 0);
|
|
139
|
+
return {
|
|
140
|
+
...formats.mp3,
|
|
141
|
+
...duration === void 0 ? {} : { duration }
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const bmff = readBmffMetadata(bytes);
|
|
145
|
+
if (bmff !== void 0 && bmff.brands[0] !== "qt " && (bmff.brands.includes("M4A ") || hasBmffAudioOnlyTracks(bytes))) {
|
|
146
|
+
const { duration } = bmff;
|
|
147
|
+
return {
|
|
148
|
+
...formats.m4a,
|
|
149
|
+
...duration === void 0 ? {} : { duration }
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
let poster;
|
|
154
|
+
function defaultAudioPoster() {
|
|
155
|
+
poster ??= readImageBytes(renderMediaPoster(40, 40, (x, y) => {
|
|
156
|
+
const dy = Math.abs(y - 19.5);
|
|
157
|
+
const speaker = x >= 8 && x <= 13 && dy <= 5 || x >= 13 && x <= 20 && dy <= x - 7;
|
|
158
|
+
const radius = Math.hypot(x - 18, dy);
|
|
159
|
+
const waves = x >= 22 && dy < x - 17 && (radius >= 8 && radius <= 10 || radius >= 13 && radius <= 15);
|
|
160
|
+
return speaker || waves ? [
|
|
161
|
+
255,
|
|
162
|
+
255,
|
|
163
|
+
255
|
|
164
|
+
] : [
|
|
165
|
+
26,
|
|
166
|
+
36,
|
|
167
|
+
53
|
|
168
|
+
];
|
|
169
|
+
}));
|
|
170
|
+
return poster;
|
|
171
|
+
}
|
|
172
|
+
export { defaultAudioPoster, detectAudio, linkedAudioContentType };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { CapabilityError } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { layoutStyleSchema, layoutStyleShape } from "../../kernel/layout-schemas.js";
|
|
3
|
+
import { defineMediaCodegen } from "../shared/media-codegen.js";
|
|
4
|
+
import { readMediaPicture } from "../shared/media-import.js";
|
|
5
|
+
import { defineCanvasMechanism } from "../../kernel/pptx-read/mechanism.js";
|
|
6
|
+
import { validateMediaPlacement } from "../shared/media-placement.js";
|
|
7
|
+
import { supportsMediaProperty } from "../shared/media-schemas.js";
|
|
8
|
+
import { bindMediaPicture, emitMediaPicture } from "../shared/media.js";
|
|
9
|
+
import { paintImageModel } from "../shared/picture.js";
|
|
10
|
+
import "../../kernel/capability.js";
|
|
11
|
+
import "../../kernel/pptx-read/index.js";
|
|
12
|
+
import { createAudioNode } from "./audio-declaration.js";
|
|
13
|
+
import { defaultAudioPoster, detectAudio, linkedAudioContentType } from "./audio-source.js";
|
|
14
|
+
// ../core/dist/capabilities/audio/entry.js
|
|
15
|
+
const mediaOptions = {
|
|
16
|
+
kind: "audio",
|
|
17
|
+
defaultPoster: defaultAudioPoster,
|
|
18
|
+
detectMedia: detectAudio
|
|
19
|
+
};
|
|
20
|
+
function importAudioNode({ crop, geometry, placeholder: _placeholder, style, ...props }, location, diagnostics) {
|
|
21
|
+
const entries = Object.entries(style ?? {});
|
|
22
|
+
const layout = Object.fromEntries(entries.filter(([key]) => Object.hasOwn(layoutStyleShape, key)));
|
|
23
|
+
const omittedMechanisms = [
|
|
24
|
+
...crop === void 0 ? [] : ["audio-poster-crop"],
|
|
25
|
+
...geometry === void 0 ? [] : ["audio-poster-geometry"],
|
|
26
|
+
...entries.some(([key]) => !Object.hasOwn(layoutStyleShape, key)) ? ["audio-poster-style"] : []
|
|
27
|
+
];
|
|
28
|
+
for (const preferredMechanism of omittedMechanisms) diagnostics.push({
|
|
29
|
+
code: "compatibility-fallback",
|
|
30
|
+
category: "unsupported",
|
|
31
|
+
disposition: "fallback",
|
|
32
|
+
location,
|
|
33
|
+
preferredMechanism,
|
|
34
|
+
selectedFallback: "audio",
|
|
35
|
+
loss: {
|
|
36
|
+
lost: "native-mechanism",
|
|
37
|
+
retainedAs: "audio"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return createAudioNode({
|
|
41
|
+
...props,
|
|
42
|
+
...Object.keys(layout).length === 0 ? {} : { style: layoutStyleSchema.parse(layout) }
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const audioMechanism = defineCanvasMechanism({
|
|
46
|
+
key: "audio",
|
|
47
|
+
role: "canvas",
|
|
48
|
+
emit: emitMediaPicture,
|
|
49
|
+
paint(model, context) {
|
|
50
|
+
return model.hideDuringShow ? { svg: "" } : paintImageModel(model.picture, context);
|
|
51
|
+
},
|
|
52
|
+
import: {
|
|
53
|
+
target: "shape-tree",
|
|
54
|
+
localName: "pic",
|
|
55
|
+
importsMorphName: supportsMediaProperty("audio", "morphKey"),
|
|
56
|
+
matches: (_cursor, mediaKind) => mediaKind === "audio",
|
|
57
|
+
read: (context) => readMediaPicture(context, {
|
|
58
|
+
...mediaOptions,
|
|
59
|
+
createNode: importAudioNode
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
function observeAudio({ media, playback, hideDuringShow }) {
|
|
64
|
+
if (media.kind === "embedded") {
|
|
65
|
+
const { contentType } = media.format;
|
|
66
|
+
if (contentType === "video/mp4") throw new Error("Expected an audio content type");
|
|
67
|
+
return Object.freeze({
|
|
68
|
+
kind: "embedded",
|
|
69
|
+
contentType,
|
|
70
|
+
...playback,
|
|
71
|
+
hideDuringShow
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const contentType = linkedAudioContentType(media.externalUrl);
|
|
75
|
+
return Object.freeze({
|
|
76
|
+
kind: "external",
|
|
77
|
+
url: media.externalUrl,
|
|
78
|
+
...contentType === void 0 ? {} : { contentType },
|
|
79
|
+
...playback,
|
|
80
|
+
hideDuringShow
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const audioCapability = {
|
|
84
|
+
declaration: "audio",
|
|
85
|
+
codegen: defineMediaCodegen("audio", detectAudio),
|
|
86
|
+
mechanisms: [audioMechanism],
|
|
87
|
+
validatePlacement: validateMediaPlacement,
|
|
88
|
+
bind(input, context) {
|
|
89
|
+
const parsed = layoutStyleSchema.optional().safeParse(input.props["style"]);
|
|
90
|
+
if (!parsed.success) throw new CapabilityError("invalid-parameter", parsed.error.issues[0]?.message ?? "Invalid audio layout", void 0, { field: "style" });
|
|
91
|
+
const style = parsed.data;
|
|
92
|
+
const withDefaultSize = {
|
|
93
|
+
...input,
|
|
94
|
+
props: {
|
|
95
|
+
...input.props,
|
|
96
|
+
style: {
|
|
97
|
+
...style,
|
|
98
|
+
width: style?.width ?? 40,
|
|
99
|
+
height: style?.height ?? 40
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return bindMediaPicture(withDefaultSize, context, {
|
|
104
|
+
...mediaOptions,
|
|
105
|
+
resolve(model, picture) {
|
|
106
|
+
const { image: _image, ...observation } = picture.observation;
|
|
107
|
+
return {
|
|
108
|
+
...picture,
|
|
109
|
+
observation: {
|
|
110
|
+
...observation,
|
|
111
|
+
kind: "audio",
|
|
112
|
+
audio: observeAudio(model)
|
|
113
|
+
},
|
|
114
|
+
extensions: ["p14"],
|
|
115
|
+
emit: (emitContext) => audioMechanism.emit(model, emitContext),
|
|
116
|
+
paint: (paintContext) => audioMechanism.paint(model, paintContext)
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
export { audioCapability };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { readInternalDeclarationProps } from "
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import
|
|
5
|
-
import { defineObjectCodegen, expr } from "
|
|
6
|
-
import {
|
|
7
|
-
import { motionPropKeySet } from "../motion/motion-schemas.js";
|
|
1
|
+
import { readInternalDeclarationProps } from "../../kernel/document-internals.js";
|
|
2
|
+
import { serializeImageDescriptorValue } from "../shared/image-codegen.js";
|
|
3
|
+
import { motionPropKeySet } from "../shared/motion-schemas.js";
|
|
4
|
+
import "../../kernel/capability.js";
|
|
5
|
+
import { defineObjectCodegen, expr } from "../../kernel/codegen.js";
|
|
6
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
8
7
|
import { boxDeclarationPropsKeys, boxStyleSchema } from "./box-declaration.js";
|
|
9
|
-
// ../
|
|
8
|
+
// ../core/dist/capabilities/box/box-codegen.js
|
|
10
9
|
const objectMotionPropKeys = motionPropKeySet;
|
|
11
10
|
const boxAllowedPropKeys = new Set(boxDeclarationPropsKeys);
|
|
12
11
|
function isPlainRecord(value) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { authorIdSchema } from "
|
|
2
|
-
import { layoutStyleShape } from "
|
|
3
|
-
import { textStyleShape, visualStyleShape } from "
|
|
4
|
-
import { linkTargetSchema } from "
|
|
5
|
-
import "../../../core/dist/capability.js";
|
|
6
|
-
import { CommonContainer } from "../../../core/dist/document.js";
|
|
7
|
-
import { motionPropsShape } from "../motion/motion-schemas.js";
|
|
1
|
+
import { authorIdSchema } from "../../kernel/author-ids.js";
|
|
2
|
+
import { layoutStyleShape } from "../../kernel/layout-schemas.js";
|
|
3
|
+
import { textStyleShape, visualStyleShape } from "../../kernel/theme.js";
|
|
4
|
+
import { linkTargetSchema } from "../../kernel/author-schemas.js";
|
|
8
5
|
import { morphKeySchema } from "../shared/morph-api.js";
|
|
6
|
+
import { motionPropsShape } from "../shared/motion-schemas.js";
|
|
7
|
+
import "../../kernel/capability.js";
|
|
8
|
+
import { CommonContainer } from "../../kernel/document.js";
|
|
9
9
|
import { z } from "zod";
|
|
10
|
-
// ../
|
|
10
|
+
// ../core/dist/capabilities/box/box-declaration.js
|
|
11
11
|
const boxStyleObjectSchema = z.strictObject({
|
|
12
12
|
...layoutStyleShape,
|
|
13
13
|
...textStyleShape,
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import { textStyleFrom } from "
|
|
3
|
-
import { parseLinkTarget } from "
|
|
4
|
-
import { parseCapabilityLayoutContract } from "
|
|
5
|
-
import "../../../core/dist/capability.js";
|
|
6
|
-
import { xmlEscape } from "../../../emit/dist/ooxml.js";
|
|
7
|
-
import "../../../emit/dist/index.js";
|
|
8
|
-
import { motionContainerAnnotations, pickMotionProps, validateMotionFlag } from "../motion/motion-api.js";
|
|
1
|
+
import { CapabilityError } from "../../kernel/diagnostics.js";
|
|
2
|
+
import { textStyleFrom } from "../../kernel/theme.js";
|
|
3
|
+
import { parseLinkTarget } from "../../kernel/author-schemas.js";
|
|
4
|
+
import { parseCapabilityLayoutContract } from "../../kernel/layout.js";
|
|
9
5
|
import { nativeLinkXml, parseMorphKey } from "../shared/identity.js";
|
|
10
|
-
import {
|
|
6
|
+
import { motionContainerAnnotations, pickMotionProps, validateMotionFlag } from "../shared/motion-api.js";
|
|
7
|
+
import { assertVisualBoxExtent, bindVisualModel, emitVisualModel, hasVisibleBoxStyle, paintVisualModel, resolveVisualModel } from "../shared/visual.js";
|
|
8
|
+
import "../../kernel/capability.js";
|
|
9
|
+
import { xmlEscape } from "../../kernel/pptx-write/xml.js";
|
|
11
10
|
import { boxCodegen } from "./box-codegen.js";
|
|
12
11
|
import { boxDeclarationPropsKeys, boxStyleKeys } from "./box-declaration.js";
|
|
13
|
-
// ../
|
|
12
|
+
// ../core/dist/capabilities/box/box.js
|
|
14
13
|
const boxAllowedParameters = boxDeclarationPropsKeys;
|
|
15
14
|
const boxAllowedStyleKeys = new Set(boxStyleKeys);
|
|
16
15
|
function styleRecord(value) {
|
|
@@ -25,7 +24,7 @@ function objectXml(id, escapedName, properties, linkXml) {
|
|
|
25
24
|
const boxCapability = {
|
|
26
25
|
declaration: "box",
|
|
27
26
|
codegen: boxCodegen,
|
|
28
|
-
bind(input, context) {
|
|
27
|
+
*bind(input, context) {
|
|
29
28
|
const unknown = Object.keys(input.props).find((key) => !boxAllowedParameters.includes(key));
|
|
30
29
|
if (unknown !== void 0) throw new CapabilityError("unknown-parameter", `Box contains unknown parameter ${unknown}`);
|
|
31
30
|
validateMotionFlag(input.props["motion"]);
|
|
@@ -43,7 +42,7 @@ const boxCapability = {
|
|
|
43
42
|
path: context.path
|
|
44
43
|
});
|
|
45
44
|
const theme = context.theme.with(textStyleFrom(style));
|
|
46
|
-
|
|
45
|
+
const initialVisual = yield* bindVisualModel({
|
|
47
46
|
theme,
|
|
48
47
|
style,
|
|
49
48
|
box: {
|
|
@@ -79,14 +78,14 @@ const boxCapability = {
|
|
|
79
78
|
try {
|
|
80
79
|
escapedName = xmlEscape(name);
|
|
81
80
|
} catch {
|
|
82
|
-
throw new CapabilityError("invalid-xml-character", "Box.name contains characters not allowed in XML 1.0");
|
|
81
|
+
throw new CapabilityError("invalid-xml-character", "Box.name contains characters not allowed in XML 1.0", void 0, { field: "name" });
|
|
83
82
|
}
|
|
84
83
|
const visual = resolveVisualModel({
|
|
85
84
|
theme: resolveContext.theme,
|
|
86
85
|
style,
|
|
87
86
|
box,
|
|
88
87
|
layoutOnlyWhenInvisible: true
|
|
89
|
-
});
|
|
88
|
+
}, initialVisual.fill);
|
|
90
89
|
if (visual.hasVisibleStyle) assertVisualBoxExtent(box);
|
|
91
90
|
const geometryName = visual.geometry.kind === "custom" ? "custom" : visual.geometry.name;
|
|
92
91
|
const motionTarget = {
|
|
@@ -127,7 +126,7 @@ const boxCapability = {
|
|
|
127
126
|
model: visual,
|
|
128
127
|
slideNumber: paintContext.slideNumber,
|
|
129
128
|
objectId: paintContext.objectId,
|
|
130
|
-
|
|
129
|
+
registerRasterResource: paintContext.registerRasterResource
|
|
131
130
|
});
|
|
132
131
|
return {
|
|
133
132
|
svg: `${background.svg}${childrenSvg}`,
|