@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
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
import { mergeDataLabels } from "../chart-labels.js";
|
|
2
1
|
import { resolveChartLineStroke, resolveSeriesColor, strokeAttrs } from "./style.js";
|
|
3
|
-
// ../
|
|
2
|
+
// ../core/dist/capabilities/chart/preview/pie-doughnut.js
|
|
4
3
|
function toScreenRadians(degreesClockwiseFromTop) {
|
|
5
4
|
return (degreesClockwiseFromTop - 90) * Math.PI / 180;
|
|
6
5
|
}
|
|
7
|
-
function hasOuterSliceLabels(group) {
|
|
8
|
-
if (group.kind === "doughnut") return false;
|
|
9
|
-
const series = group.series[0];
|
|
10
|
-
for (let i = 0; i < series.values.length; i += 1) {
|
|
11
|
-
const val = series.values[i];
|
|
12
|
-
if (val === null || val === void 0 || !Number.isFinite(val) || val <= 0) continue;
|
|
13
|
-
const eff = mergeDataLabels(mergeDataLabels(group.dataLabels, series.dataLabels), series.points?.[i]?.dataLabels);
|
|
14
|
-
if (eff === void 0 || eff === false) continue;
|
|
15
|
-
if (!(eff.value === true || eff.percent === true || eff.category === true || eff.seriesName === true)) continue;
|
|
16
|
-
const pos = eff.position ?? "bestFit";
|
|
17
|
-
if (pos === "outsideEnd" || pos === "bestFit") return true;
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
6
|
function buildSlicePath(options) {
|
|
22
7
|
const { ox, oy, innerR, outerR, startRad, endRad, spanDeg } = options;
|
|
23
8
|
if (spanDeg >= 359.999) {
|
|
@@ -51,16 +36,10 @@ function buildSlicePath(options) {
|
|
|
51
36
|
fullCircle: false
|
|
52
37
|
};
|
|
53
38
|
}
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
function renderPieOrDoughnutGroup(options) {
|
|
59
|
-
const { group, groupIndex, plotRect, theme } = options;
|
|
60
|
-
if (group.series.length === 0 || plotRect.width <= 0 || plotRect.height <= 0) return {
|
|
61
|
-
svg: "",
|
|
62
|
-
anchors: []
|
|
63
|
-
};
|
|
39
|
+
/** Places pie and doughnut slices, including their explosion offsets and label anchors. */
|
|
40
|
+
function layoutPieOrDoughnutGroup(options) {
|
|
41
|
+
const { group, groupIndex, plotRect, radiusScale } = options;
|
|
42
|
+
if (plotRect.width <= 0 || plotRect.height <= 0) return [];
|
|
64
43
|
let maxExpRatio = 0;
|
|
65
44
|
for (const series of group.series) for (let j = 0; j < series.values.length; j += 1) {
|
|
66
45
|
const val = series.values[j];
|
|
@@ -69,15 +48,12 @@ function renderPieOrDoughnutGroup(options) {
|
|
|
69
48
|
const ratio = Math.min(Math.max(0, exp), 100) / 100;
|
|
70
49
|
if (ratio > maxExpRatio) maxExpRatio = ratio;
|
|
71
50
|
}
|
|
72
|
-
const
|
|
73
|
-
const rAvail = Math.min(plotRect.width, plotRect.height) / 2 * radiusScale;
|
|
74
|
-
const rOuterTotal = Math.max(2, rAvail / (1 + maxExpRatio));
|
|
51
|
+
const rOuterTotal = Math.min(plotRect.width, plotRect.height) / 2 * radiusScale / (1 + maxExpRatio);
|
|
75
52
|
const cx = plotRect.x + plotRect.width / 2;
|
|
76
53
|
const cy = plotRect.y + plotRect.height / 2;
|
|
77
54
|
const ringCount = group.kind === "pie" ? 1 : group.series.length;
|
|
78
55
|
const rHole = rOuterTotal * (group.kind === "doughnut" ? Math.max(.1, Math.min(.9, group.holeSize / 100)) : 0);
|
|
79
56
|
const ringThickness = (rOuterTotal - rHole) / Math.max(1, ringCount);
|
|
80
|
-
const parts = [];
|
|
81
57
|
const anchors = [];
|
|
82
58
|
for (let s = 0; s < group.series.length; s += 1) {
|
|
83
59
|
const series = group.series[s];
|
|
@@ -102,33 +78,10 @@ function renderPieOrDoughnutGroup(options) {
|
|
|
102
78
|
const startRad = toScreenRadians(startDeg);
|
|
103
79
|
const endRad = toScreenRadians(endDeg);
|
|
104
80
|
const midRad = toScreenRadians(midDeg);
|
|
105
|
-
const
|
|
106
|
-
const exp = point?.explosion ?? series.explosion ?? group.explosion ?? 0;
|
|
81
|
+
const exp = (series.points?.[j])?.explosion ?? series.explosion ?? group.explosion ?? 0;
|
|
107
82
|
const expOffset = rOuterTotal * (Math.min(Math.max(0, exp), 100) / 100);
|
|
108
83
|
const ox = cx + expOffset * Math.cos(midRad);
|
|
109
84
|
const oy = cy + expOffset * Math.sin(midRad);
|
|
110
|
-
const { d, fullCircle } = buildSlicePath({
|
|
111
|
-
ox,
|
|
112
|
-
oy,
|
|
113
|
-
innerR: rIn,
|
|
114
|
-
outerR: rOut,
|
|
115
|
-
startRad,
|
|
116
|
-
endRad,
|
|
117
|
-
spanDeg
|
|
118
|
-
});
|
|
119
|
-
const fill = resolveSeriesColor(point?.color ?? series.color, j, theme);
|
|
120
|
-
const lineSpec = point?.line ?? series.line;
|
|
121
|
-
const stroke = lineSpec !== void 0 ? resolveChartLineStroke(lineSpec, theme, {
|
|
122
|
-
color: "dk1",
|
|
123
|
-
width: 1
|
|
124
|
-
}) : positiveCount > 1 || ringCount > 1 ? {
|
|
125
|
-
hex: "FFFFFF",
|
|
126
|
-
alpha: .9,
|
|
127
|
-
width: 1
|
|
128
|
-
} : void 0;
|
|
129
|
-
const strokeAttr = stroke === void 0 ? "" : ` ${strokeAttrs(stroke)}`;
|
|
130
|
-
const fillRuleAttr = fullCircle && rIn > .001 ? " fill-rule=\"evenodd\"" : "";
|
|
131
|
-
parts.push(`<path d="${d}" fill="#${fill.hex}" fill-opacity="${fill.alpha ?? 1}"${fillRuleAttr}${strokeAttr}/>`);
|
|
132
85
|
anchors.push({
|
|
133
86
|
kind: "slice",
|
|
134
87
|
groupIndex,
|
|
@@ -147,13 +100,39 @@ function renderPieOrDoughnutGroup(options) {
|
|
|
147
100
|
midAngleRad: midRad,
|
|
148
101
|
sliceSum: ringTotal,
|
|
149
102
|
percent: val / ringTotal,
|
|
150
|
-
spanDeg
|
|
103
|
+
spanDeg,
|
|
104
|
+
needsSeparator: positiveCount > 1 || ringCount > 1
|
|
151
105
|
});
|
|
152
106
|
}
|
|
153
107
|
}
|
|
154
|
-
return
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
108
|
+
return anchors;
|
|
109
|
+
}
|
|
110
|
+
function renderPieOrDoughnutGroup(group, anchors, theme) {
|
|
111
|
+
return anchors.map((anchor) => {
|
|
112
|
+
const series = group.series[anchor.groupSeriesIndex];
|
|
113
|
+
const point = series.points?.[anchor.pointIndex];
|
|
114
|
+
const { d, fullCircle } = buildSlicePath({
|
|
115
|
+
ox: anchor.cx,
|
|
116
|
+
oy: anchor.cy,
|
|
117
|
+
innerR: anchor.innerR,
|
|
118
|
+
outerR: anchor.outerR,
|
|
119
|
+
startRad: anchor.startAngleRad,
|
|
120
|
+
endRad: anchor.endAngleRad,
|
|
121
|
+
spanDeg: anchor.spanDeg
|
|
122
|
+
});
|
|
123
|
+
const fill = resolveSeriesColor(point?.color ?? series.color, anchor.pointIndex, theme);
|
|
124
|
+
const lineSpec = point?.line ?? series.line;
|
|
125
|
+
const stroke = lineSpec !== void 0 ? resolveChartLineStroke(lineSpec, theme, {
|
|
126
|
+
color: "dk1",
|
|
127
|
+
width: 1
|
|
128
|
+
}) : anchor.needsSeparator ? {
|
|
129
|
+
hex: "FFFFFF",
|
|
130
|
+
alpha: .9,
|
|
131
|
+
width: 1
|
|
132
|
+
} : void 0;
|
|
133
|
+
const strokeAttr = stroke === void 0 ? "" : ` ${strokeAttrs(stroke)}`;
|
|
134
|
+
const fillRuleAttr = fullCircle && anchor.innerR > .001 ? " fill-rule=\"evenodd\"" : "";
|
|
135
|
+
return `<path d="${d}" fill="#${fill.hex}" fill-opacity="${fill.alpha ?? 1}"${fillRuleAttr}${strokeAttr}/>`;
|
|
136
|
+
}).join("");
|
|
158
137
|
}
|
|
159
|
-
export { renderPieOrDoughnutGroup };
|
|
138
|
+
export { layoutPieOrDoughnutGroup, renderPieOrDoughnutGroup };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computeErrorBarBounds } from "./error-bars.js";
|
|
2
2
|
import { collectCategoryFitPoints, collectScatterFitPoints, fitTrendline } from "./trendlines.js";
|
|
3
3
|
import { assertNever } from "./types.js";
|
|
4
|
-
// ../
|
|
4
|
+
// ../core/dist/capabilities/chart/preview/scales.js
|
|
5
5
|
function cleanNumber(value) {
|
|
6
6
|
if (Object.is(value, -0) || value === 0) return 0;
|
|
7
7
|
return Number(value.toPrecision(12));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { renderStyledLineRun, resolvePointSegmentStroke } from "./line-area.js";
|
|
2
2
|
import { renderMarkerSvg, resolveEffectiveMarker } from "./markers.js";
|
|
3
3
|
import { chartAccentSlot, resolveChartLineStroke, resolveSeriesColor } from "./style.js";
|
|
4
|
-
// ../
|
|
4
|
+
// ../core/dist/capabilities/chart/preview/scatter.js
|
|
5
5
|
function renderScatterGroup(options) {
|
|
6
6
|
const { group, groupIndex, scales, plotRect, displayBlanksAs, theme } = options;
|
|
7
7
|
const xScale = scales.get(group.axes.x.name);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { isTextGradient } from "../../../kernel/theme.js";
|
|
2
|
+
import { measureParagraphs, parseTextContent, renderTextOutlinesSvg, withPreviewFontBoundary } from "../../shared/text-service.js";
|
|
3
|
+
import "../../../kernel/capability.js";
|
|
4
|
+
// ../core/dist/capabilities/chart/preview/text-render.js
|
|
3
5
|
function createChartClipAllocator(slideNumber, objectId) {
|
|
4
6
|
let seq = 0;
|
|
5
7
|
return {
|
|
@@ -32,13 +34,19 @@ function measureChartText(options) {
|
|
|
32
34
|
type: "#text",
|
|
33
35
|
text: options.text
|
|
34
36
|
}], options.style, options.theme, { slideNumber: options.slideNumber }, options.labelPath);
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
+
return reflowChartText({
|
|
37
38
|
paragraphs,
|
|
38
|
-
resolvedStyle
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
resolvedStyle
|
|
40
|
+
}, options.availableWidth);
|
|
41
|
+
}
|
|
42
|
+
function reflowChartText(text, width) {
|
|
43
|
+
const layout = withPreviewFontBoundary(() => measureParagraphs(text.paragraphs, width));
|
|
44
|
+
return {
|
|
45
|
+
paragraphs: text.paragraphs,
|
|
46
|
+
resolvedStyle: text.resolvedStyle,
|
|
47
|
+
width: layout.width,
|
|
48
|
+
height: layout.height,
|
|
49
|
+
layout
|
|
42
50
|
};
|
|
43
51
|
}
|
|
44
52
|
/**
|
|
@@ -49,15 +57,6 @@ function renderChartTextSvg(options) {
|
|
|
49
57
|
if (options.text === "") return "";
|
|
50
58
|
const align = options.align ?? options.style?.align ?? "center";
|
|
51
59
|
const verticalAlign = options.verticalAlign ?? options.style?.verticalAlign ?? "middle";
|
|
52
|
-
const effectiveStyle = {
|
|
53
|
-
...options.style,
|
|
54
|
-
align,
|
|
55
|
-
verticalAlign
|
|
56
|
-
};
|
|
57
|
-
const { paragraphs, style: resolvedStyle } = parseTextContent([{
|
|
58
|
-
type: "#text",
|
|
59
|
-
text: options.text
|
|
60
|
-
}], effectiveStyle, options.theme, { slideNumber: options.slideNumber }, options.labelPath);
|
|
61
60
|
const rawWidth = Math.max(1, options.box.width);
|
|
62
61
|
const rawHeight = Math.max(1, options.box.height);
|
|
63
62
|
let layoutBox;
|
|
@@ -76,11 +75,22 @@ function renderChartTextSvg(options) {
|
|
|
76
75
|
width: rawWidth,
|
|
77
76
|
height: rawHeight
|
|
78
77
|
};
|
|
79
|
-
const singleLineMeasure = withPreviewFontBoundary(() => measureTextLayoutFromParagraphs(paragraphs, resolvedStyle));
|
|
80
78
|
const allowWrap = options.wrap ?? false;
|
|
79
|
+
const measured = options.measured ?? measureChartText({
|
|
80
|
+
...options,
|
|
81
|
+
...allowWrap ? { availableWidth: layoutBox.width } : {}
|
|
82
|
+
});
|
|
83
|
+
const { resolvedStyle, layout } = measured;
|
|
84
|
+
const paragraphs = measured.paragraphs.map((paragraph) => ({
|
|
85
|
+
...paragraph,
|
|
86
|
+
style: {
|
|
87
|
+
...paragraph.style,
|
|
88
|
+
align
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
81
91
|
let effectiveLayoutBox = layoutBox;
|
|
82
|
-
if (!allowWrap &&
|
|
83
|
-
const neededWidth =
|
|
92
|
+
if (!allowWrap && measured.width > layoutBox.width) {
|
|
93
|
+
const neededWidth = measured.width + 1;
|
|
84
94
|
const delta = neededWidth - layoutBox.width;
|
|
85
95
|
const shiftedX = align === "right" ? layoutBox.x - delta : align === "center" ? layoutBox.x - delta / 2 : layoutBox.x;
|
|
86
96
|
effectiveLayoutBox = {
|
|
@@ -89,10 +99,10 @@ function renderChartTextSvg(options) {
|
|
|
89
99
|
width: neededWidth
|
|
90
100
|
};
|
|
91
101
|
}
|
|
92
|
-
const
|
|
93
|
-
const idPrefix = options.clipAllocator !== void 0 && resolvedStyle.textShadow !== void 0 ? options.clipAllocator.nextClipId() : `rp-chart-txt-${options.slideNumber}`;
|
|
102
|
+
const idPrefix = options.clipAllocator !== void 0 && (resolvedStyle.textShadow !== void 0 || isTextGradient(resolvedStyle.color)) ? options.clipAllocator.nextClipId() : `rp-chart-txt-${options.slideNumber}`;
|
|
94
103
|
let content = withPreviewFontBoundary(() => renderTextOutlinesSvg({
|
|
95
104
|
paragraphs,
|
|
105
|
+
measuredLayout: layout,
|
|
96
106
|
box: effectiveLayoutBox,
|
|
97
107
|
verticalAlign,
|
|
98
108
|
theme: options.theme,
|
|
@@ -106,11 +116,11 @@ function renderChartTextSvg(options) {
|
|
|
106
116
|
content = `<g transform="rotate(${options.rotationDegrees} ${cx} ${cy})">${content}</g>`;
|
|
107
117
|
}
|
|
108
118
|
const clipTarget = options.clipBox ?? options.box;
|
|
109
|
-
if ((options.rotationDegrees === void 0 ?
|
|
119
|
+
if ((options.rotationDegrees === void 0 ? layout.width > clipTarget.width + .5 || layout.height > clipTarget.height + .5 : layout.width > clipTarget.height + .5 || layout.height > clipTarget.width + .5) && options.clipAllocator !== void 0 && Number.isFinite(clipTarget.x) && Number.isFinite(clipTarget.y) && Number.isFinite(clipTarget.width) && Number.isFinite(clipTarget.height) && clipTarget.width > 1e-6 && clipTarget.height > 1e-6) {
|
|
110
120
|
const clipId = options.clipAllocator.nextClipId();
|
|
111
121
|
options.clipAllocator.defs.push(`<clipPath id="${clipId}" clipPathUnits="userSpaceOnUse"><rect x="${clipTarget.x}" y="${clipTarget.y}" width="${clipTarget.width}" height="${clipTarget.height}"/></clipPath>`);
|
|
112
122
|
return `<g clip-path="url(#${clipId})">${content}</g>`;
|
|
113
123
|
}
|
|
114
124
|
return content;
|
|
115
125
|
}
|
|
116
|
-
export { createChartClipAllocator, measureChartText, mergeChartTextStyle, renderChartTextSvg, resolveChartFontSizePixels };
|
|
126
|
+
export { createChartClipAllocator, measureChartText, mergeChartTextStyle, reflowChartText, renderChartTextSvg, resolveChartFontSizePixels };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CapabilityError } from "
|
|
2
|
-
import "
|
|
1
|
+
import { CapabilityError } from "../../../kernel/diagnostics.js";
|
|
2
|
+
import "../../../kernel/capability.js";
|
|
3
3
|
import { chartAccentSlot, resolveChartLineStroke, strokeAttrs } from "./style.js";
|
|
4
4
|
import { measureChartText, mergeChartTextStyle, renderChartTextSvg, resolveChartFontSizePixels } from "./text-render.js";
|
|
5
5
|
import { assertNever } from "./types.js";
|
|
6
|
-
// ../
|
|
6
|
+
// ../core/dist/capabilities/chart/preview/trendlines.js
|
|
7
7
|
function solveGaussianPartialPivoting(matrix, rhs) {
|
|
8
8
|
const n = rhs.length;
|
|
9
9
|
const a = matrix.map((row) => [...row]);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readInternalDeclarationProps } from "../../kernel/document-internals.js";
|
|
2
|
+
import "../../kernel/capability.js";
|
|
3
|
+
import { defineObjectCodegen } from "../../kernel/codegen.js";
|
|
4
|
+
import { commentDeclarationPropsSchema } from "./comment-declaration.js";
|
|
5
|
+
// ../core/dist/capabilities/comment/comment-codegen.js
|
|
6
|
+
function commentSource(node, ctx) {
|
|
7
|
+
const parsed = commentDeclarationPropsSchema.safeParse(readInternalDeclarationProps(node));
|
|
8
|
+
if (!parsed.success || node.children.length !== 0) return ctx.fail("invalid-document", "Comment requires valid author props and a plain text string");
|
|
9
|
+
const { text, ...props } = parsed.data;
|
|
10
|
+
return {
|
|
11
|
+
props: Object.entries(props).filter(([, value]) => value !== void 0),
|
|
12
|
+
text: ctx.emitValueExpr(text)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const commentCodegen = defineObjectCodegen({ declarations: { comment: {
|
|
16
|
+
emitVanilla(node, ctx) {
|
|
17
|
+
const { props, text } = commentSource(node, ctx);
|
|
18
|
+
return ctx.formatVanillaCall(ctx.useImport("comment"), [ctx.formatProps(props), text]);
|
|
19
|
+
},
|
|
20
|
+
emitReact(node, ctx) {
|
|
21
|
+
const { props, text } = commentSource(node, ctx);
|
|
22
|
+
return ctx.formatJsxElement(ctx.useImport("Comment"), props, [`{${text}}`]);
|
|
23
|
+
}
|
|
24
|
+
} } });
|
|
25
|
+
export { commentCodegen };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { authorIdSchema } from "../../kernel/author-ids.js";
|
|
2
|
+
import { xml10StringSchema } from "../../kernel/xml-values.js";
|
|
3
|
+
import "../../kernel/author-schemas.js";
|
|
4
|
+
import "../../kernel/capability.js";
|
|
5
|
+
import { CommonNode } from "../../kernel/document.js";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
const commentCoordinateSchema = z.number().refine((value) => {
|
|
8
|
+
const units = Math.round(value * 6);
|
|
9
|
+
return units >= -2147483648 && units <= 2147483647;
|
|
10
|
+
});
|
|
11
|
+
const commentDateTimeSchema = z.iso.datetime({
|
|
12
|
+
offset: true,
|
|
13
|
+
local: true
|
|
14
|
+
}).refine((value) => /T\d{2}:\d{2}:\d{2}/u.test(value));
|
|
15
|
+
const commentTimestampSchema = z.union([z.date().transform((value) => value.toISOString()).pipe(commentDateTimeSchema), commentDateTimeSchema]);
|
|
16
|
+
const commentDeclarationPropsSchema = z.strictObject({
|
|
17
|
+
id: authorIdSchema.optional(),
|
|
18
|
+
author: xml10StringSchema.refine((value) => value.trim() !== ""),
|
|
19
|
+
initials: xml10StringSchema.optional(),
|
|
20
|
+
position: z.strictObject({
|
|
21
|
+
x: commentCoordinateSchema,
|
|
22
|
+
y: commentCoordinateSchema
|
|
23
|
+
}).optional(),
|
|
24
|
+
createdAt: commentTimestampSchema.optional(),
|
|
25
|
+
text: xml10StringSchema
|
|
26
|
+
});
|
|
27
|
+
function createCommentNode(props) {
|
|
28
|
+
return new CommonNode("comment", "comment", props, { pageAffiliated: true });
|
|
29
|
+
}
|
|
30
|
+
/** Attaches a plain-text review comment when appended directly to a slide. */
|
|
31
|
+
function comment(props, text) {
|
|
32
|
+
return createCommentNode({
|
|
33
|
+
...props,
|
|
34
|
+
text
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export { comment, commentDeclarationPropsSchema, createCommentNode };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { CommonContainer } from "../../kernel/document.js";
|
|
2
|
+
import { P_NS, R_NS } from "../../kernel/pptx-read/namespaces.js";
|
|
3
|
+
import { XmlElementCursor, parseXmlPart } from "../../kernel/pptx-read/xml-reader.js";
|
|
4
|
+
import { resolvePartPath } from "../../kernel/pptx-read/opc.js";
|
|
5
|
+
import { appendUnconsumedDiagnostics } from "../../kernel/pptx-read/shape-tree.js";
|
|
6
|
+
import "../../kernel/pptx-read/index.js";
|
|
7
|
+
import { comment, commentDeclarationPropsSchema } from "./comment-declaration.js";
|
|
8
|
+
import { XMLSerializer } from "@xmldom/xmldom";
|
|
9
|
+
// ../core/dist/capabilities/comment/comment-import.js
|
|
10
|
+
const modernCommentsNamespace = "http://schemas.microsoft.com/office/powerpoint/2018/8/main";
|
|
11
|
+
const modernCommentsRelationship = "http://schemas.microsoft.com/office/2018/10/relationships/comments";
|
|
12
|
+
function readRelatedRoot(pkg, source, relationship, expectedRoot, slideIndex, diagnostics) {
|
|
13
|
+
const target = relationship.TargetMode === "External" ? void 0 : resolvePartPath(source, relationship.Target);
|
|
14
|
+
const location = {
|
|
15
|
+
part: source,
|
|
16
|
+
xpath: relationship.xpath,
|
|
17
|
+
slideIndex
|
|
18
|
+
};
|
|
19
|
+
if (target === void 0) {
|
|
20
|
+
diagnostics.push({
|
|
21
|
+
code: "broken-relationship",
|
|
22
|
+
category: "corrupt-input",
|
|
23
|
+
disposition: "omitted",
|
|
24
|
+
location,
|
|
25
|
+
relationshipId: relationship.Id
|
|
26
|
+
});
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const text = pkg.readTextPart(target);
|
|
30
|
+
if (text === void 0) {
|
|
31
|
+
diagnostics.push({
|
|
32
|
+
code: "missing-target-part",
|
|
33
|
+
category: "corrupt-input",
|
|
34
|
+
disposition: "omitted",
|
|
35
|
+
location,
|
|
36
|
+
relationshipId: relationship.Id,
|
|
37
|
+
targetPart: target
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const root = parseXmlPart(target, text);
|
|
43
|
+
if (root.namespaceURI === "http://schemas.openxmlformats.org/presentationml/2006/main" && root.localName === expectedRoot) return XmlElementCursor.createRoot(root, target, `/p:${expectedRoot}`);
|
|
44
|
+
} catch {}
|
|
45
|
+
diagnostics.push({
|
|
46
|
+
code: "corrupt-part",
|
|
47
|
+
category: "corrupt-input",
|
|
48
|
+
disposition: "omitted",
|
|
49
|
+
location: {
|
|
50
|
+
part: target,
|
|
51
|
+
slideIndex
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function reportModernComments(slideCursor, relationships, slideIndex, diagnostics) {
|
|
56
|
+
const related = new Map(relationships.filter(({ Type }) => Type === modernCommentsRelationship).map((entry) => [entry.Id, entry]));
|
|
57
|
+
function report(xpath, relationshipId) {
|
|
58
|
+
diagnostics.push({
|
|
59
|
+
code: "unsupported-mechanism",
|
|
60
|
+
category: "unsupported",
|
|
61
|
+
disposition: "omitted",
|
|
62
|
+
location: {
|
|
63
|
+
part: slideCursor.part,
|
|
64
|
+
xpath,
|
|
65
|
+
slideIndex
|
|
66
|
+
},
|
|
67
|
+
namespaceUri: modernCommentsNamespace,
|
|
68
|
+
localName: "commentRel",
|
|
69
|
+
mechanismHint: "modern-threaded-comments",
|
|
70
|
+
...relationshipId === void 0 ? {} : { relationshipId }
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function hasModernReference(element, localName) {
|
|
74
|
+
return element.namespaceURI === "http://schemas.openxmlformats.org/presentationml/2006/main" && element.localName === localName && element.getElementsByTagNameNS(modernCommentsNamespace, "commentRel").length > 0;
|
|
75
|
+
}
|
|
76
|
+
for (const extList of slideCursor.matchingChildren((element) => hasModernReference(element, "extLst"))) for (const ext of extList.matchingChildren((element) => hasModernReference(element, "ext"))) {
|
|
77
|
+
const references = ext.children(modernCommentsNamespace, "commentRel");
|
|
78
|
+
if (references.length > 0) ext.consumeAttr("uri");
|
|
79
|
+
for (const reference of references) {
|
|
80
|
+
const id = reference.attr("id", R_NS);
|
|
81
|
+
if (id !== void 0) related.delete(id);
|
|
82
|
+
report(reference.xpath, id);
|
|
83
|
+
reference.suppressUnconsumed();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (const entry of related.values()) report(entry.xpath, entry.Id);
|
|
87
|
+
}
|
|
88
|
+
function reportInvalidComment(cursor, slideIndex, diagnostics) {
|
|
89
|
+
diagnostics.push({
|
|
90
|
+
code: "invalid-xml-value",
|
|
91
|
+
category: "corrupt-input",
|
|
92
|
+
disposition: "omitted",
|
|
93
|
+
location: {
|
|
94
|
+
part: cursor.part,
|
|
95
|
+
xpath: cursor.xpath,
|
|
96
|
+
slideIndex
|
|
97
|
+
},
|
|
98
|
+
attributeOrElement: `p:${cursor.localName}`,
|
|
99
|
+
rawValue: new XMLSerializer().serializeToString(cursor.element)
|
|
100
|
+
});
|
|
101
|
+
cursor.suppressUnconsumed();
|
|
102
|
+
}
|
|
103
|
+
function readCommentAuthorTable(pkg, slideIndex, diagnostics) {
|
|
104
|
+
const authors = /* @__PURE__ */ new Map();
|
|
105
|
+
const relationship = pkg.presentationRels.find(({ Type }) => Type === `${R_NS}/commentAuthors`);
|
|
106
|
+
if (relationship === void 0) return authors;
|
|
107
|
+
const root = readRelatedRoot(pkg, pkg.presentationPath, relationship, "cmAuthorLst", slideIndex, diagnostics);
|
|
108
|
+
if (root === void 0) return authors;
|
|
109
|
+
for (const entry of root.children(P_NS, "cmAuthor")) {
|
|
110
|
+
const id = entry.attr("id");
|
|
111
|
+
const author = entry.attr("name");
|
|
112
|
+
const initials = entry.attr("initials");
|
|
113
|
+
entry.consumeAttr("lastIdx");
|
|
114
|
+
entry.consumeAttr("clrIdx");
|
|
115
|
+
entry.child(P_NS, "extLst")?.suppressUnconsumed();
|
|
116
|
+
if (id === void 0 || !/^\d+$/u.test(id) || author === void 0 || author.trim() === "" || initials === void 0 || authors.has(Number(id))) {
|
|
117
|
+
reportInvalidComment(entry, slideIndex, diagnostics);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
authors.set(Number(id), {
|
|
121
|
+
author,
|
|
122
|
+
initials
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
root.child(P_NS, "extLst")?.suppressUnconsumed();
|
|
126
|
+
appendUnconsumedDiagnostics(root, slideIndex, diagnostics);
|
|
127
|
+
return authors;
|
|
128
|
+
}
|
|
129
|
+
function coordinate(raw) {
|
|
130
|
+
return raw !== void 0 && /^[+-]?\d+$/u.test(raw) ? Number(raw) / 6 : NaN;
|
|
131
|
+
}
|
|
132
|
+
const legacyCommentsImportHandler = {
|
|
133
|
+
target: "slide",
|
|
134
|
+
slot: "comments",
|
|
135
|
+
read({ slideCursor, slideNode, part, slideIndex, package: pkg }) {
|
|
136
|
+
if (slideIndex === void 0 || !(slideNode instanceof CommonContainer)) return {};
|
|
137
|
+
const diagnostics = [];
|
|
138
|
+
const { entries } = pkg.readRelationships(part);
|
|
139
|
+
reportModernComments(slideCursor, entries, slideIndex, diagnostics);
|
|
140
|
+
const relationship = entries.find(({ Type }) => Type === `${R_NS}/comments`);
|
|
141
|
+
if (relationship === void 0) return { diagnostics };
|
|
142
|
+
const root = readRelatedRoot(pkg, part, relationship, "cmLst", slideIndex, diagnostics);
|
|
143
|
+
if (root === void 0) return { diagnostics };
|
|
144
|
+
const authors = readCommentAuthorTable(pkg, slideIndex, diagnostics);
|
|
145
|
+
for (const entry of root.children(P_NS, "cm")) {
|
|
146
|
+
const authorId = entry.attr("authorId");
|
|
147
|
+
const author = authorId === void 0 || !/^\d+$/u.test(authorId) ? void 0 : authors.get(Number(authorId));
|
|
148
|
+
const createdAt = entry.attr("dt");
|
|
149
|
+
entry.consumeAttr("idx");
|
|
150
|
+
const pos = entry.child(P_NS, "pos");
|
|
151
|
+
const text = entry.child(P_NS, "text");
|
|
152
|
+
entry.child(P_NS, "extLst")?.suppressUnconsumed();
|
|
153
|
+
const candidate = {
|
|
154
|
+
...author,
|
|
155
|
+
position: {
|
|
156
|
+
x: coordinate(pos?.attr("x")),
|
|
157
|
+
y: coordinate(pos?.attr("y"))
|
|
158
|
+
},
|
|
159
|
+
createdAt,
|
|
160
|
+
text: text?.element.textContent
|
|
161
|
+
};
|
|
162
|
+
const parsed = commentDeclarationPropsSchema.safeParse(candidate);
|
|
163
|
+
if (!parsed.success || text === void 0 || text.allElementChildren().length !== 0) {
|
|
164
|
+
reportInvalidComment(entry, slideIndex, diagnostics);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
const { text: body, ...props } = parsed.data;
|
|
168
|
+
slideNode.append(comment(props, body));
|
|
169
|
+
text.suppressUnconsumed();
|
|
170
|
+
}
|
|
171
|
+
root.child(P_NS, "extLst")?.suppressUnconsumed();
|
|
172
|
+
appendUnconsumedDiagnostics(root, slideIndex, diagnostics);
|
|
173
|
+
return { diagnostics };
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
export { legacyCommentsImportHandler };
|