ooxml-core 1.32.0 → 1.33.0
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/{PptxHandler-TESZUH66.cjs → PptxHandler-MGKMIK22.cjs} +3 -3
- package/dist/PptxHandler-Q7CFNKOU.mjs +7 -0
- package/dist/PptxHandler-TEC7SWBU.mjs +4 -0
- package/dist/{PresentationBuilder-3CH5TR4W.mjs → PresentationBuilder-PJMQRZI6.mjs} +2 -2
- package/dist/{PresentationBuilder-S6HXHKEJ.mjs → PresentationBuilder-SADKXDWC.mjs} +4 -4
- package/dist/{PresentationBuilder-5NFBUP7Y.cjs → PresentationBuilder-VP2637RH.cjs} +5 -5
- package/dist/automation/index.cjs +4398 -2262
- package/dist/automation/index.mjs +4398 -2262
- package/dist/chart/funnel-geometry.d.ts +1 -1
- package/dist/chart/funnel-geometry.d.ts.map +1 -1
- package/dist/chart/index.cjs +5743 -3820
- package/dist/chart/index.mjs +5736 -3821
- package/dist/chart/region-map/alias.d.ts +12 -0
- package/dist/chart/region-map/alias.d.ts.map +1 -0
- package/dist/chart/region-map/cache.d.ts +20 -0
- package/dist/chart/region-map/cache.d.ts.map +1 -0
- package/dist/chart/region-map/colors.d.ts +4 -0
- package/dist/chart/region-map/colors.d.ts.map +1 -0
- package/dist/chart/region-map/data.d.ts +45 -0
- package/dist/chart/region-map/data.d.ts.map +1 -0
- package/dist/chart/region-map/geographic-projection.d.ts +4 -0
- package/dist/chart/region-map/geographic-projection.d.ts.map +1 -0
- package/dist/chart/region-map/geometry.d.ts +10 -0
- package/dist/chart/region-map/geometry.d.ts.map +1 -0
- package/dist/chart/region-map/index.cjs +892 -0
- package/dist/chart/region-map/index.d.ts +12 -0
- package/dist/chart/region-map/index.d.ts.map +1 -0
- package/dist/chart/region-map/index.mjs +870 -0
- package/dist/chart/region-map/projection.d.ts +19 -0
- package/dist/chart/region-map/projection.d.ts.map +1 -0
- package/dist/chart/region-map/types.d.ts +39 -0
- package/dist/chart/region-map/types.d.ts.map +1 -0
- package/dist/chart/region-map/value-color-positions.d.ts +4 -0
- package/dist/chart/region-map/value-color-positions.d.ts.map +1 -0
- package/dist/chart/region-map/value-colors.d.ts +4 -0
- package/dist/chart/region-map/value-colors.d.ts.map +1 -0
- package/dist/chart/region-map/world-regions.d.ts +22 -0
- package/dist/chart/region-map/world-regions.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-camera.d.ts +26 -0
- package/dist/chart/render/chart-3d-camera.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-layout.d.ts +27 -0
- package/dist/chart/render/chart-3d-layout.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-marks.d.ts +10 -0
- package/dist/chart/render/chart-3d-marks.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-mesh.d.ts +32 -0
- package/dist/chart/render/chart-3d-mesh.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-pie.d.ts +16 -0
- package/dist/chart/render/chart-3d-pie.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-projection.d.ts +37 -0
- package/dist/chart/render/chart-3d-projection.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-scene.d.ts +9 -0
- package/dist/chart/render/chart-3d-scene.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-shading.d.ts +10 -0
- package/dist/chart/render/chart-3d-shading.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-surface.d.ts +5 -0
- package/dist/chart/render/chart-3d-surface.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-svg.d.ts +7 -0
- package/dist/chart/render/chart-3d-svg.d.ts.map +1 -0
- package/dist/chart/render/chart-3d-walls.d.ts +13 -0
- package/dist/chart/render/chart-3d-walls.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-funnel.d.ts.map +1 -1
- package/dist/chart/render/chart-svg-region-map.d.ts +4 -0
- package/dist/chart/render/chart-svg-region-map.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-text-metrics.d.ts +2 -0
- package/dist/chart/render/chart-svg-text-metrics.d.ts.map +1 -1
- package/dist/chart/render/chart-svg.d.ts.map +1 -1
- package/dist/chart/render/chart-view.d.ts +5 -1
- package/dist/chart/render/chart-view.d.ts.map +1 -1
- package/dist/chart/render/index.d.ts +5 -0
- package/dist/chart/render/index.d.ts.map +1 -1
- package/dist/chart/render/render-space.d.ts.map +1 -1
- package/dist/chart/render/summary-ex-formatting.d.ts +5 -0
- package/dist/chart/render/summary-ex-formatting.d.ts.map +1 -0
- package/dist/chart/render/summary-ex-series.d.ts.map +1 -1
- package/dist/chart/render/summary-from-chartex.d.ts.map +1 -1
- package/dist/chart/render/summary-from-space.d.ts.map +1 -1
- package/dist/chart/render/summary.d.ts +5 -1
- package/dist/chart/render/summary.d.ts.map +1 -1
- package/dist/{chunk-Q6NM64J2.cjs → chunk-2LTIDUXH.cjs} +4791 -950
- package/dist/chunk-2N7RZQLC.mjs +8 -0
- package/dist/{chunk-NAWLWKOJ.mjs → chunk-3LMHYL4W.mjs} +2 -2
- package/dist/{chunk-O7SVHLD7.mjs → chunk-6LJW76BZ.mjs} +4756 -951
- package/dist/{chunk-X6VNUBES.cjs → chunk-BDZR4DZ6.cjs} +2058 -1748
- package/dist/{chunk-IOTGRLJH.mjs → chunk-BQGLWC6N.mjs} +867 -557
- package/dist/{chunk-N6424WKA.mjs → chunk-EBBWRRSB.mjs} +1 -1
- package/dist/{chunk-UYMSFJQZ.mjs → chunk-JQVOUS6B.mjs} +5 -5
- package/dist/{chunk-3H5UAJB3.mjs → chunk-QRXMYOVN.mjs} +870 -525
- package/dist/{chunk-54S5A5PZ.mjs → chunk-VDUNZTJC.mjs} +36 -1
- package/dist/{chunk-4R65YYAD.mjs → chunk-Y2RH4QWG.mjs} +4228 -1070
- package/dist/diagram/drawing-resolve.d.ts.map +1 -1
- package/dist/diagram/drawing-view.d.ts +6 -0
- package/dist/diagram/drawing-view.d.ts.map +1 -1
- package/dist/diagram/engine/engine-to-result.d.ts.map +1 -1
- package/dist/diagram/index.cjs +786 -145
- package/dist/diagram/index.d.ts +1 -0
- package/dist/diagram/index.d.ts.map +1 -1
- package/dist/diagram/index.mjs +783 -147
- package/dist/diagram/layout/smartart-layout-types.d.ts +7 -0
- package/dist/diagram/layout/smartart-layout-types.d.ts.map +1 -1
- package/dist/diagram/layout-preview.d.ts +4 -0
- package/dist/diagram/layout-preview.d.ts.map +1 -1
- package/dist/diagram/layout-role-style.d.ts +4 -0
- package/dist/diagram/layout-role-style.d.ts.map +1 -0
- package/dist/diagram/load.d.ts.map +1 -1
- package/dist/diagram/picture-layout.d.ts +23 -0
- package/dist/diagram/picture-layout.d.ts.map +1 -0
- package/dist/diagram/types.d.ts +6 -0
- package/dist/diagram/types.d.ts.map +1 -1
- package/dist/diagram/write/cache.d.ts +1 -0
- package/dist/diagram/write/cache.d.ts.map +1 -1
- package/dist/digest/crc32.d.ts +2 -0
- package/dist/digest/crc32.d.ts.map +1 -0
- package/dist/digest/index.cjs +11 -0
- package/dist/digest/index.d.ts +1 -0
- package/dist/digest/index.d.ts.map +1 -1
- package/dist/digest/index.mjs +11 -1
- package/dist/docx/diagram-cache.d.ts.map +1 -1
- package/dist/docx/diagram-save.d.ts.map +1 -1
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +882 -212
- package/dist/docx/embedded.mjs +882 -212
- package/dist/docx/index.cjs +3082 -866
- package/dist/docx/index.mjs +3082 -866
- package/dist/docx/inline-model.d.ts +4 -0
- package/dist/docx/inline-model.d.ts.map +1 -1
- package/dist/docx/layout/adapt-floats.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/floats.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +2200 -438
- package/dist/docx/layout/index.mjs +2200 -438
- package/dist/docx/layout/input.d.ts +3 -0
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +3 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +1311 -641
- package/dist/docx/load/index.mjs +1311 -641
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +2832 -842
- package/dist/docx/ui/index.mjs +2832 -842
- package/dist/docx/ui/inline-content-schema.d.ts.map +1 -1
- package/dist/docx/ui/run-adapter.d.ts.map +1 -1
- package/dist/docx/write-drawing.d.ts.map +1 -1
- package/dist/drawingml/index.cjs +707 -111
- package/dist/drawingml/index.d.ts +7 -0
- package/dist/drawingml/index.d.ts.map +1 -1
- package/dist/drawingml/index.mjs +697 -113
- package/dist/drawingml/picture-artistic.d.ts +14 -0
- package/dist/drawingml/picture-artistic.d.ts.map +1 -0
- package/dist/drawingml/picture-effects.d.ts +4 -1
- package/dist/drawingml/picture-effects.d.ts.map +1 -1
- package/dist/drawingml/picture-fill.d.ts.map +1 -1
- package/dist/drawingml/picture-hsl-pixels.d.ts +4 -0
- package/dist/drawingml/picture-hsl-pixels.d.ts.map +1 -0
- package/dist/drawingml/picture-layout.d.ts +25 -0
- package/dist/drawingml/picture-layout.d.ts.map +1 -0
- package/dist/drawingml/picture-standard-effects.d.ts +15 -0
- package/dist/drawingml/picture-standard-effects.d.ts.map +1 -0
- package/dist/drawingml/picture-transfer.d.ts +11 -0
- package/dist/drawingml/picture-transfer.d.ts.map +1 -0
- package/dist/drawingml/raster-image.d.ts +29 -0
- package/dist/drawingml/raster-image.d.ts.map +1 -0
- package/dist/drawingml/types.d.ts +1 -0
- package/dist/drawingml/types.d.ts.map +1 -1
- package/dist/drawingml/write-pattern-picture.d.ts.map +1 -1
- package/dist/geometry/index.cjs +38 -0
- package/dist/geometry/index.d.ts +1 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.mjs +36 -1
- package/dist/geometry/picture-tile.d.ts +29 -0
- package/dist/geometry/picture-tile.d.ts.map +1 -0
- package/dist/index.cjs +15164 -12669
- package/dist/index.mjs +15164 -12669
- package/dist/pptx/automation/index.cjs +7431 -2967
- package/dist/pptx/automation/index.d.ts +5 -5
- package/dist/pptx/automation/index.mjs +7 -7
- package/dist/pptx/chunks/{elements-mSCZ84Tc.d.ts → elements-f3UbFph-.d.ts} +7 -2
- package/dist/pptx/chunks/elements-f3UbFph-.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-DnWlmYCy.d.ts → index-BnH2QjYm.d.ts} +4 -4
- package/dist/pptx/chunks/{index-DnWlmYCy.d.ts.map → index-BnH2QjYm.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-D-FdgqrP.d.ts → index-Bp-1pGo1.d.ts} +4 -4
- package/dist/pptx/chunks/{index-D-FdgqrP.d.ts.map → index-Bp-1pGo1.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-DKybuHPT.d.ts → index-BuMPQDQb.d.ts} +27 -16
- package/dist/pptx/chunks/index-BuMPQDQb.d.ts.map +1 -0
- package/dist/pptx/chunks/{smart-art-DLumQo90.d.ts → smart-art-CmOrPLLQ.d.ts} +86 -2
- package/dist/pptx/chunks/smart-art-CmOrPLLQ.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts → text-operations-D5sgspO6.d.ts} +2 -2
- package/dist/pptx/chunks/{text-operations-hyPODwIQ.d.ts.map → text-operations-D5sgspO6.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +7196 -2732
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +6 -6
- package/dist/pptx/converter/index.cjs +3895 -503
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +6828 -2969
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +7 -7
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.mjs +2 -2
- package/dist/teams/index.cjs +1964 -726
- package/dist/teams/index.mjs +1964 -726
- package/dist/visio/cell-formula.d.ts +5 -1
- package/dist/visio/cell-formula.d.ts.map +1 -1
- package/dist/visio/collab/index.cjs +3 -1
- package/dist/visio/collab/index.mjs +3 -1
- package/dist/visio/container-relationships.d.ts +19 -0
- package/dist/visio/container-relationships.d.ts.map +1 -0
- package/dist/visio/edit-container-fit.d.ts +19 -0
- package/dist/visio/edit-container-fit.d.ts.map +1 -0
- package/dist/visio/edit-container-members.d.ts +21 -0
- package/dist/visio/edit-container-members.d.ts.map +1 -0
- package/dist/visio/edit-delete.d.ts.map +1 -1
- package/dist/visio/edit-diagram-parts-commands.d.ts +23 -1
- package/dist/visio/edit-diagram-parts-commands.d.ts.map +1 -1
- package/dist/visio/edit-diagram-parts.d.ts +3 -2
- package/dist/visio/edit-diagram-parts.d.ts.map +1 -1
- package/dist/visio/edit-geometry.d.ts +4 -1
- package/dist/visio/edit-geometry.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts +13 -0
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-values.d.ts.map +1 -1
- package/dist/visio/edit-recalculate.d.ts.map +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/formula-analyze.d.ts +2 -0
- package/dist/visio/formula-analyze.d.ts.map +1 -1
- package/dist/visio/formula-evaluate.d.ts.map +1 -1
- package/dist/visio/formula-master.d.ts +1 -0
- package/dist/visio/formula-master.d.ts.map +1 -1
- package/dist/visio/index.cjs +2771 -1312
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +2771 -1312
- package/dist/visio/media.d.ts +4 -23
- package/dist/visio/media.d.ts.map +1 -1
- package/dist/visio/package-common.d.ts +1 -1
- package/dist/visio/package-common.d.ts.map +1 -1
- package/dist/visio/shape-structure.d.ts +6 -3
- package/dist/visio/shape-structure.d.ts.map +1 -1
- package/dist/visio/ui/diagram-parts.d.ts +12 -1
- package/dist/visio/ui/diagram-parts.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +2679 -1201
- package/dist/visio/ui/index.mjs +2679 -1202
- package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-ex.d.ts +1 -0
- package/dist/xlsx/edit/chart-ex.d.ts.map +1 -1
- package/dist/xlsx/edit/filter.d.ts +5 -1
- package/dist/xlsx/edit/filter.d.ts.map +1 -1
- package/dist/xlsx/edit/index.d.ts +1 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/session-calc.d.ts +5 -0
- package/dist/xlsx/edit/session-calc.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/text-columns.d.ts +21 -0
- package/dist/xlsx/edit/text-columns.d.ts.map +1 -0
- package/dist/xlsx/edit/types.d.ts +5 -1
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/embedded-chart-ex-space.d.ts +18 -0
- package/dist/xlsx/embedded-chart-ex-space.d.ts.map +1 -0
- package/dist/xlsx/filter-criteria.d.ts +22 -0
- package/dist/xlsx/filter-criteria.d.ts.map +1 -0
- package/dist/xlsx/filter-dynamic.d.ts +8 -0
- package/dist/xlsx/filter-dynamic.d.ts.map +1 -0
- package/dist/xlsx/filter-menu.d.ts +49 -0
- package/dist/xlsx/filter-menu.d.ts.map +1 -0
- package/dist/xlsx/filter-rows.d.ts +4 -4
- package/dist/xlsx/filter-rows.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +5861 -2939
- package/dist/xlsx/index.d.ts +4 -0
- package/dist/xlsx/index.d.ts.map +1 -1
- package/dist/xlsx/index.mjs +5844 -2939
- package/dist/xlsx/load/index.cjs +1871 -585
- package/dist/xlsx/load/index.mjs +1871 -585
- package/dist/xlsx/model-filter.d.ts +54 -0
- package/dist/xlsx/model-filter.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +42 -3
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/chart.d.ts.map +1 -1
- package/dist/xlsx/read/drawing.d.ts.map +1 -1
- package/dist/xlsx/read/filter-columns.d.ts +5 -0
- package/dist/xlsx/read/filter-columns.d.ts.map +1 -0
- package/dist/xlsx/read/shared-strings.d.ts +5 -3
- package/dist/xlsx/read/shared-strings.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-props.d.ts +2 -2
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/filters.d.ts +3 -0
- package/dist/xlsx/ui/commands/i18n/filters.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/index.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/tools.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/sort-filter.d.ts.map +1 -1
- package/dist/xlsx/ui/dialogs/grid-chart.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +7177 -4234
- package/dist/xlsx/ui/index.mjs +7177 -4234
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/dist/xlsx/write/filter-columns.d.ts +39 -0
- package/dist/xlsx/write/filter-columns.d.ts.map +1 -0
- package/dist/xlsx/write/shared-strings.d.ts +4 -4
- package/dist/xlsx/write/shared-strings.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-props.d.ts +2 -1
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/write/smart-art-cache.d.ts.map +1 -1
- package/dist/xlsx/write/smart-art.d.ts.map +1 -1
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/package.json +6 -1
- package/dist/PptxHandler-QY5VL3CY.mjs +0 -7
- package/dist/PptxHandler-SJ5ZUIUX.mjs +0 -4
- package/dist/chunk-3GXV5MPC.mjs +0 -41
- package/dist/pptx/chunks/elements-mSCZ84Tc.d.ts.map +0 -1
- package/dist/pptx/chunks/index-DKybuHPT.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-DLumQo90.d.ts.map +0 -1
package/dist/docx/embedded.mjs
CHANGED
|
@@ -1549,37 +1549,271 @@ function resolveDrawingColor(color, theme, options) {
|
|
|
1549
1549
|
};
|
|
1550
1550
|
}
|
|
1551
1551
|
|
|
1552
|
-
// drawingml/picture-
|
|
1553
|
-
var
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1552
|
+
// drawingml/picture-artistic.ts
|
|
1553
|
+
var ARTISTIC_PRIMARY_ATTRIBUTE = {
|
|
1554
|
+
artisticBlur: "radius",
|
|
1555
|
+
artisticCement: "crackSpacing",
|
|
1556
|
+
artisticChalkSketch: "pressure",
|
|
1557
|
+
artisticCrisscrossEtching: "pressure",
|
|
1558
|
+
artisticCutout: "numberOfShades",
|
|
1559
|
+
artisticFilmGrain: "grainSize",
|
|
1560
|
+
artisticGlass: "scaling",
|
|
1561
|
+
artisticGlowDiffused: "intensity",
|
|
1562
|
+
artisticGlowEdges: "smoothness",
|
|
1563
|
+
artisticLightScreen: "gridSize",
|
|
1564
|
+
artisticLineDrawing: "pencilSize",
|
|
1565
|
+
artisticMarker: "size",
|
|
1566
|
+
// Spelled "Mosiaic" in the schema; Microsoft's typo is part of the format.
|
|
1567
|
+
artisticMosiaicBubbles: "pressure",
|
|
1568
|
+
artisticPaintBrush: "brushSize",
|
|
1569
|
+
artisticPaintStrokes: "intensity",
|
|
1570
|
+
artisticPastelsSmooth: "scaling",
|
|
1571
|
+
artisticPencilGrayscale: "pencilSize",
|
|
1572
|
+
artisticPencilSketch: "pressure",
|
|
1573
|
+
artisticPhotocopy: "detail",
|
|
1574
|
+
artisticPlasticWrap: "smoothness",
|
|
1575
|
+
artisticTexturizer: "scaling",
|
|
1576
|
+
artisticWatercolorSponge: "brushSize"
|
|
1577
|
+
};
|
|
1578
|
+
function parseArtisticPictureExtension(node) {
|
|
1579
|
+
if (node.namespaceURI !== NS.a || node.localName !== "extLst") return void 0;
|
|
1580
|
+
const found = [];
|
|
1581
|
+
const unhandled = [];
|
|
1582
|
+
const pending = [node];
|
|
1583
|
+
while (pending.length) {
|
|
1584
|
+
const item2 = pending.pop();
|
|
1585
|
+
if (item2 !== node && !(item2.namespaceURI === NS.a && item2.localName === "ext") && !(item2.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && (["imgProps", "imgLayer", "imgEffect", "useLocalDpi"].includes(item2.localName) || ARTISTIC_PRIMARY_ATTRIBUTE[item2.localName])))
|
|
1586
|
+
unhandled.push(item2.localName);
|
|
1587
|
+
if (item2.namespaceURI === "http://schemas.microsoft.com/office/drawing/2010/main" && item2.localName.startsWith("artistic"))
|
|
1588
|
+
found.push(item2);
|
|
1589
|
+
pending.push(...elements(item2));
|
|
1590
|
+
}
|
|
1591
|
+
if (found.length !== 1) return void 0;
|
|
1592
|
+
const effect = found[0];
|
|
1593
|
+
const key = ARTISTIC_PRIMARY_ATTRIBUTE[effect.localName];
|
|
1594
|
+
if (!key) return void 0;
|
|
1595
|
+
const raw2 = key ? effect.getAttribute(key) : null;
|
|
1596
|
+
const n = raw2 === null ? 0 : Number(raw2);
|
|
1597
|
+
if (!Number.isFinite(n)) return void 0;
|
|
1598
|
+
return {
|
|
1599
|
+
kind: "artistic",
|
|
1600
|
+
name: effect.localName,
|
|
1601
|
+
radius: effect.localName === "artisticBlur" ? n : n / 1e3,
|
|
1602
|
+
baked: true,
|
|
1603
|
+
...unhandled.length ? { unhandled } : {}
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
// drawingml/write-color.ts
|
|
1608
|
+
var ELEMENTS = {
|
|
1609
|
+
srgb: "srgbClr",
|
|
1610
|
+
scheme: "schemeClr",
|
|
1611
|
+
system: "sysClr",
|
|
1612
|
+
preset: "prstClr",
|
|
1613
|
+
scrgb: "scrgbClr",
|
|
1614
|
+
hsl: "hslClr"
|
|
1615
|
+
};
|
|
1616
|
+
function drawingColorXml(color) {
|
|
1617
|
+
const local = ELEMENTS[color.kind];
|
|
1618
|
+
const doc = parseXml(`<a:${local} xmlns:a="${NS.a}"/>`);
|
|
1619
|
+
const root = doc.documentElement;
|
|
1620
|
+
if (color.kind === "scrgb" || color.kind === "hsl") {
|
|
1621
|
+
const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
|
|
1622
|
+
const values = color.value.split(",");
|
|
1623
|
+
keys.forEach((key, i) => root.setAttribute(key, values[i] ?? "0"));
|
|
1624
|
+
} else root.setAttribute("val", color.value);
|
|
1625
|
+
if (color.fallback !== void 0 && color.kind === "system")
|
|
1626
|
+
root.setAttribute("lastClr", color.fallback);
|
|
1627
|
+
for (const transform2 of color.transforms) {
|
|
1628
|
+
if (!/^[A-Za-z_][\w.-]*$/.test(transform2.name))
|
|
1629
|
+
throw new Error(`Invalid DrawingML transform ${transform2.name}`);
|
|
1630
|
+
const node = doc.createElementNS(NS.a, `a:${transform2.name}`);
|
|
1631
|
+
if (transform2.value !== "") node.setAttribute("val", transform2.value);
|
|
1632
|
+
root.appendChild(node);
|
|
1564
1633
|
}
|
|
1565
|
-
return
|
|
1634
|
+
return buildXml(doc);
|
|
1566
1635
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1636
|
+
|
|
1637
|
+
// drawingml/patch-color.ts
|
|
1638
|
+
function patchDrawingColorIn(container, color) {
|
|
1639
|
+
const old = elements(container).find((node) => parseDrawingColor(node));
|
|
1640
|
+
const before = parseDrawingColorIn(container);
|
|
1641
|
+
if (!old || !before || before.kind !== color.kind) {
|
|
1642
|
+
const next = container.ownerDocument.importNode(
|
|
1643
|
+
parseXml(drawingColorXml(color)).documentElement,
|
|
1644
|
+
true
|
|
1645
|
+
);
|
|
1646
|
+
if (old) container.replaceChild(next, old);
|
|
1647
|
+
else container.insertBefore(next, container.firstChild);
|
|
1648
|
+
return;
|
|
1573
1649
|
}
|
|
1574
|
-
if (
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1650
|
+
if (before.value !== color.value) {
|
|
1651
|
+
if (color.kind === "scrgb" || color.kind === "hsl") {
|
|
1652
|
+
const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
|
|
1653
|
+
const values = color.value.split(",");
|
|
1654
|
+
keys.forEach((key, index) => old.setAttribute(key, values[index] ?? "0"));
|
|
1655
|
+
} else old.setAttribute("val", color.value);
|
|
1656
|
+
}
|
|
1657
|
+
if (before.fallback !== color.fallback && color.kind === "system") {
|
|
1658
|
+
if (color.fallback === void 0) old.removeAttribute("lastClr");
|
|
1659
|
+
else old.setAttribute("lastClr", color.fallback);
|
|
1660
|
+
}
|
|
1661
|
+
const originals = elements(old);
|
|
1662
|
+
color.transforms.forEach((transform2, index) => {
|
|
1663
|
+
const source2 = originals[index];
|
|
1664
|
+
if (source2?.localName === transform2.name) {
|
|
1665
|
+
if (before.transforms[index]?.value !== transform2.value) {
|
|
1666
|
+
if (transform2.value === "") source2.removeAttribute("val");
|
|
1667
|
+
else source2.setAttribute("val", transform2.value);
|
|
1668
|
+
}
|
|
1669
|
+
return;
|
|
1581
1670
|
}
|
|
1671
|
+
if (!/^[A-Za-z_][\w.-]*$/u.test(transform2.name))
|
|
1672
|
+
throw new Error("Invalid DrawingML colour transform");
|
|
1673
|
+
const next = old.ownerDocument.createElementNS(NS.a, `a:${transform2.name}`);
|
|
1674
|
+
if (transform2.value !== "") next.setAttribute("val", transform2.value);
|
|
1675
|
+
if (source2) old.replaceChild(next, source2);
|
|
1676
|
+
else old.appendChild(next);
|
|
1677
|
+
});
|
|
1678
|
+
for (const extra of originals.slice(color.transforms.length)) old.removeChild(extra);
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
// drawingml/picture-standard-effects.ts
|
|
1682
|
+
var attrs = {
|
|
1683
|
+
biLevel: { threshold: "thresh" },
|
|
1684
|
+
alphaRepl: { amount: "a" },
|
|
1685
|
+
alphaBiLevel: { threshold: "thresh" },
|
|
1686
|
+
hsl: { hue: "hue", saturation: "sat", luminance: "lum" },
|
|
1687
|
+
tint: { hue: "hue", amount: "amt" },
|
|
1688
|
+
blur: { radiusEmu: "rad" }
|
|
1689
|
+
};
|
|
1690
|
+
function parseStandardPictureEffect(node) {
|
|
1691
|
+
const name = node.localName;
|
|
1692
|
+
if (![
|
|
1693
|
+
"biLevel",
|
|
1694
|
+
"alphaInv",
|
|
1695
|
+
"alphaCeiling",
|
|
1696
|
+
"alphaFloor",
|
|
1697
|
+
"alphaRepl",
|
|
1698
|
+
"alphaBiLevel",
|
|
1699
|
+
"alphaMod",
|
|
1700
|
+
"duotone",
|
|
1701
|
+
"clrRepl",
|
|
1702
|
+
"clrChange",
|
|
1703
|
+
"hsl",
|
|
1704
|
+
"tint",
|
|
1705
|
+
"blur"
|
|
1706
|
+
].includes(name))
|
|
1707
|
+
return void 0;
|
|
1708
|
+
const values = {};
|
|
1709
|
+
for (const [key, attribute2] of Object.entries(attrs[name] ?? {})) {
|
|
1710
|
+
const raw2 = node.getAttribute(attribute2);
|
|
1711
|
+
if (raw2 === null) continue;
|
|
1712
|
+
const percent = raw2.endsWith("%");
|
|
1713
|
+
const n = Number(percent ? raw2.slice(0, -1) : raw2) / (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : percent ? 100 : 1e5);
|
|
1714
|
+
if (!Number.isFinite(n) || key === "hue" && (n < 0 || n >= 360) || key === "threshold" && (n < 0 || n > 1) || key === "radiusEmu" && (!Number.isSafeInteger(n) || n < 0) || ["saturation", "luminance", "amount"].includes(key) && name !== "alphaMod" && (n < (name === "alphaRepl" ? 0 : -1) || n > 1))
|
|
1715
|
+
return void 0;
|
|
1716
|
+
values[key] = n;
|
|
1717
|
+
}
|
|
1718
|
+
if (["biLevel", "alphaBiLevel"].includes(name) && values.threshold === void 0)
|
|
1719
|
+
return void 0;
|
|
1720
|
+
if (name === "alphaRepl" && values.amount === void 0) return void 0;
|
|
1721
|
+
if (name === "alphaMod") {
|
|
1722
|
+
const cont = first(node, "cont", NS.a);
|
|
1723
|
+
const nested = cont ? elements(cont) : [];
|
|
1724
|
+
if (nested.length !== 1 || nested[0]?.localName !== "alphaModFix") return void 0;
|
|
1725
|
+
const raw2 = nested[0].getAttribute("amt") ?? "100000";
|
|
1726
|
+
const n = Number(raw2.endsWith("%") ? raw2.slice(0, -1) : raw2) / (raw2.endsWith("%") ? 100 : 1e5);
|
|
1727
|
+
if (!Number.isFinite(n) || n < 0) return void 0;
|
|
1728
|
+
values.amount = n;
|
|
1729
|
+
}
|
|
1730
|
+
let colors = [];
|
|
1731
|
+
if (name === "duotone") {
|
|
1732
|
+
const candidates = elements(node).filter(
|
|
1733
|
+
(item2) => item2.namespaceURI === NS.a && /Clr$/.test(item2.localName)
|
|
1734
|
+
);
|
|
1735
|
+
colors = candidates.map((item2) => parseDrawingColor(item2)).filter((item2) => Boolean(item2));
|
|
1736
|
+
if (colors.length !== 2) return void 0;
|
|
1737
|
+
}
|
|
1738
|
+
if (name === "clrRepl") {
|
|
1739
|
+
const color = parseDrawingColorIn(node);
|
|
1740
|
+
if (!color) return void 0;
|
|
1741
|
+
colors = [color];
|
|
1742
|
+
}
|
|
1743
|
+
if (name === "clrChange") {
|
|
1744
|
+
const from = parseDrawingColorIn(first(node, "clrFrom", NS.a)), to = parseDrawingColorIn(first(node, "clrTo", NS.a));
|
|
1745
|
+
if (!from || !to) return void 0;
|
|
1746
|
+
colors = [from, to];
|
|
1747
|
+
}
|
|
1748
|
+
if (name === "alphaInv") {
|
|
1749
|
+
const color = parseDrawingColorIn(node);
|
|
1750
|
+
if (color) colors = [color];
|
|
1582
1751
|
}
|
|
1752
|
+
return {
|
|
1753
|
+
kind: "standard",
|
|
1754
|
+
name,
|
|
1755
|
+
...Object.keys(values).length ? { values } : {},
|
|
1756
|
+
...colors.length ? { colors } : {},
|
|
1757
|
+
...name === "clrChange" && node.hasAttribute("useA") ? { useAlpha: !["0", "false"].includes(node.getAttribute("useA") ?? "") } : {},
|
|
1758
|
+
...name === "blur" && node.hasAttribute("grow") ? { grow: !["0", "false"].includes(node.getAttribute("grow") ?? "") } : {}
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
function applyStandardPictureEffect(node, effect) {
|
|
1762
|
+
const doc = node.ownerDocument, before = parseStandardPictureEffect(node);
|
|
1763
|
+
for (const [key, value] of Object.entries(effect.values ?? {})) {
|
|
1764
|
+
if (!Number.isFinite(value) || key === "hue" && (value < 0 || value >= 360) || key === "threshold" && (value < 0 || value > 1) || key === "radiusEmu" && (!Number.isSafeInteger(value) || value < 0) || key === "amount" && effect.name === "alphaMod" && value < 0 || ["saturation", "luminance", "amount"].includes(key) && effect.name !== "alphaMod" && (value < (effect.name === "alphaRepl" ? 0 : -1) || value > 1))
|
|
1765
|
+
throw new RangeError("Invalid picture effect values");
|
|
1766
|
+
}
|
|
1767
|
+
const count = effect.colors?.length ?? 0;
|
|
1768
|
+
if (["duotone", "clrChange"].includes(effect.name) && count !== 2 || effect.name === "clrRepl" && count !== 1 || effect.name === "alphaInv" && count > 1)
|
|
1769
|
+
throw new RangeError("Invalid picture effect colours");
|
|
1770
|
+
for (const [key, attribute2] of Object.entries(attrs[effect.name] ?? {})) {
|
|
1771
|
+
const value = effect.values?.[key];
|
|
1772
|
+
if (value === before?.values?.[key]) continue;
|
|
1773
|
+
if (value === void 0) node.removeAttribute(attribute2);
|
|
1774
|
+
else
|
|
1775
|
+
node.setAttribute(
|
|
1776
|
+
attribute2,
|
|
1777
|
+
String(Math.round(value * (key === "hue" ? 6e4 : key === "radiusEmu" ? 1 : 1e5)))
|
|
1778
|
+
);
|
|
1779
|
+
}
|
|
1780
|
+
if (effect.name === "alphaMod" && effect.values?.amount !== before?.values?.amount) {
|
|
1781
|
+
const cont = first(node, "cont", NS.a) ?? doc.createElementNS(NS.a, "a:cont");
|
|
1782
|
+
const fix = first(cont, "alphaModFix", NS.a) ?? doc.createElementNS(NS.a, "a:alphaModFix");
|
|
1783
|
+
fix.setAttribute("amt", String(Math.round((effect.values?.amount ?? 1) * 1e5)));
|
|
1784
|
+
if (!fix.parentNode) cont.appendChild(fix);
|
|
1785
|
+
if (!cont.parentNode) node.appendChild(cont);
|
|
1786
|
+
}
|
|
1787
|
+
if (effect.useAlpha !== before?.useAlpha) {
|
|
1788
|
+
if (effect.useAlpha === void 0) node.removeAttribute("useA");
|
|
1789
|
+
else node.setAttribute("useA", effect.useAlpha ? "1" : "0");
|
|
1790
|
+
}
|
|
1791
|
+
if (effect.grow !== before?.grow) {
|
|
1792
|
+
if (effect.grow === void 0) node.removeAttribute("grow");
|
|
1793
|
+
else node.setAttribute("grow", effect.grow ? "1" : "0");
|
|
1794
|
+
}
|
|
1795
|
+
if (JSON.stringify(effect.colors) !== JSON.stringify(before?.colors)) {
|
|
1796
|
+
if (effect.name === "duotone") {
|
|
1797
|
+
const old = elements(node).filter(
|
|
1798
|
+
(item2) => item2.namespaceURI === NS.a && /Clr$/.test(item2.localName)
|
|
1799
|
+
);
|
|
1800
|
+
for (let i = 0; i < (effect.colors?.length ?? 0); i++) {
|
|
1801
|
+
const holder = doc.createElementNS(NS.a, "a:holder");
|
|
1802
|
+
if (old[i]) holder.appendChild(doc.importNode(old[i], true));
|
|
1803
|
+
patchDrawingColorIn(holder, effect.colors[i]);
|
|
1804
|
+
const next = elements(holder)[0];
|
|
1805
|
+
if (old[i]) node.replaceChild(next, old[i]);
|
|
1806
|
+
else node.insertBefore(next, first(node, "extLst", NS.a) ?? null);
|
|
1807
|
+
}
|
|
1808
|
+
} else if (effect.name === "clrChange") {
|
|
1809
|
+
for (const [i, name] of ["clrFrom", "clrTo"].entries()) {
|
|
1810
|
+
const holder = first(node, name, NS.a) ?? doc.createElementNS(NS.a, `a:${name}`);
|
|
1811
|
+
if (effect.colors?.[i]) patchDrawingColorIn(holder, effect.colors[i]);
|
|
1812
|
+
if (!holder.parentNode) node.insertBefore(holder, first(node, "extLst", NS.a) ?? null);
|
|
1813
|
+
}
|
|
1814
|
+
} else if (effect.colors?.[0]) patchDrawingColorIn(node, effect.colors[0]);
|
|
1815
|
+
}
|
|
1816
|
+
if (!parseStandardPictureEffect(node)) throw new RangeError("Invalid picture effect values");
|
|
1583
1817
|
}
|
|
1584
1818
|
|
|
1585
1819
|
// drawingml/picture-effects.ts
|
|
@@ -1619,14 +1853,19 @@ function readPictureEffect(name, attribute2) {
|
|
|
1619
1853
|
function parsePictureEffects(blip) {
|
|
1620
1854
|
if (!blip) return [];
|
|
1621
1855
|
return elements(blip).map((node) => ({
|
|
1622
|
-
...(node.namespaceURI === NS.a ? readPictureEffect(node.localName, (name) => node.getAttribute(name)) : void 0) ?? { kind: "unsupported", name: node.localName },
|
|
1856
|
+
...(node.namespaceURI === NS.a ? readPictureEffect(node.localName, (name) => node.getAttribute(name)) ?? parseStandardPictureEffect(node) ?? parseArtisticPictureExtension(node) : void 0) ?? { kind: "unsupported", name: node.localName },
|
|
1623
1857
|
sourceXml: buildXml(node)
|
|
1624
1858
|
}));
|
|
1625
1859
|
}
|
|
1626
1860
|
function applyPictureEffects(blip, effects) {
|
|
1627
1861
|
if (JSON.stringify(parsePictureEffects(blip)) === JSON.stringify(effects)) return;
|
|
1628
1862
|
const nodes = effects.map((effect) => {
|
|
1629
|
-
const name = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind;
|
|
1863
|
+
const name = effect.kind === "grayscale" ? "grayscl" : effect.kind === "luminance" ? "lum" : effect.kind === "unsupported" ? effect.name : effect.kind === "artistic" ? "extLst" : effect.kind === "standard" ? effect.name : effect.kind;
|
|
1864
|
+
if (effect.kind === "artistic") {
|
|
1865
|
+
const before = effect.sourceXml ? parseArtisticPictureExtension(parseXml(effect.sourceXml).documentElement) : void 0;
|
|
1866
|
+
if (!effect.baked || !before || before.name !== effect.name || before.radius !== effect.radius)
|
|
1867
|
+
throw new Error("Artistic authoring requires a host-generated baked picture cache");
|
|
1868
|
+
}
|
|
1630
1869
|
const source2 = effect.sourceXml ? parseXml(effect.sourceXml).documentElement : void 0;
|
|
1631
1870
|
if (effect.kind === "unsupported" && !source2)
|
|
1632
1871
|
throw new Error("An unsupported picture effect needs source XML");
|
|
@@ -1653,12 +1892,157 @@ function applyPictureEffects(blip, effects) {
|
|
|
1653
1892
|
if (effect.amount < 0) throw new RangeError("Picture alpha must be nonnegative");
|
|
1654
1893
|
set2("amt", effect.amount);
|
|
1655
1894
|
}
|
|
1895
|
+
if (effect.kind === "standard") applyStandardPictureEffect(node, effect);
|
|
1656
1896
|
return node;
|
|
1657
1897
|
});
|
|
1658
1898
|
for (const node of elements(blip)) blip.removeChild(node);
|
|
1659
1899
|
for (const node of nodes) blip.appendChild(node);
|
|
1660
1900
|
}
|
|
1661
1901
|
|
|
1902
|
+
// drawingml/picture-layout.ts
|
|
1903
|
+
function parsePictureLayout(fill) {
|
|
1904
|
+
const out = {};
|
|
1905
|
+
const rot = fill.getAttribute("rotWithShape");
|
|
1906
|
+
if (rot !== null) out.rotWithShape = rot !== "0" && rot !== "false";
|
|
1907
|
+
const dpi = Number(fill.getAttribute("dpi"));
|
|
1908
|
+
if (fill.hasAttribute("dpi") && Number.isFinite(dpi) && dpi > 0) out.dpi = dpi;
|
|
1909
|
+
const tile = first(fill, "tile", NS.a);
|
|
1910
|
+
if (tile) {
|
|
1911
|
+
const value = {};
|
|
1912
|
+
for (const [key, attr3] of [
|
|
1913
|
+
["scaleX", "sx"],
|
|
1914
|
+
["scaleY", "sy"]
|
|
1915
|
+
]) {
|
|
1916
|
+
const n = picturePercentage(tile.getAttribute(attr3));
|
|
1917
|
+
if (n !== void 0) value[key] = n;
|
|
1918
|
+
}
|
|
1919
|
+
for (const [key, attr3] of [
|
|
1920
|
+
["offsetXEmu", "tx"],
|
|
1921
|
+
["offsetYEmu", "ty"]
|
|
1922
|
+
]) {
|
|
1923
|
+
const raw2 = tile.getAttribute(attr3);
|
|
1924
|
+
const n = raw2 === null ? NaN : Number(raw2);
|
|
1925
|
+
if (Number.isSafeInteger(n)) value[key] = n;
|
|
1926
|
+
}
|
|
1927
|
+
const alignment = tile.getAttribute("algn");
|
|
1928
|
+
if (alignment) value.alignment = alignment;
|
|
1929
|
+
const flip = tile.getAttribute("flip");
|
|
1930
|
+
if (flip && ["none", "x", "y", "xy"].includes(flip))
|
|
1931
|
+
value.flip = flip;
|
|
1932
|
+
out.tile = value;
|
|
1933
|
+
}
|
|
1934
|
+
const rect2 = first(first(fill, "stretch", NS.a), "fillRect", NS.a);
|
|
1935
|
+
if (rect2)
|
|
1936
|
+
out.fillRect = {
|
|
1937
|
+
l: picturePercentage(rect2.getAttribute("l")) ?? 0,
|
|
1938
|
+
t: picturePercentage(rect2.getAttribute("t")) ?? 0,
|
|
1939
|
+
r: picturePercentage(rect2.getAttribute("r")) ?? 0,
|
|
1940
|
+
b: picturePercentage(rect2.getAttribute("b")) ?? 0
|
|
1941
|
+
};
|
|
1942
|
+
return out;
|
|
1943
|
+
}
|
|
1944
|
+
function applyPictureLayout(fill, layout2) {
|
|
1945
|
+
const before = parsePictureLayout(fill);
|
|
1946
|
+
const attr3 = (node, name, value, old) => {
|
|
1947
|
+
if (value === old) return;
|
|
1948
|
+
if (value === void 0) node.removeAttribute(name);
|
|
1949
|
+
else node.setAttribute(name, String(value));
|
|
1950
|
+
};
|
|
1951
|
+
if (layout2.rotWithShape !== before.rotWithShape)
|
|
1952
|
+
attr3(
|
|
1953
|
+
fill,
|
|
1954
|
+
"rotWithShape",
|
|
1955
|
+
layout2.rotWithShape === void 0 ? void 0 : layout2.rotWithShape ? "1" : "0",
|
|
1956
|
+
void 0
|
|
1957
|
+
);
|
|
1958
|
+
if (layout2.dpi !== before.dpi) {
|
|
1959
|
+
if (layout2.dpi !== void 0 && (!Number.isSafeInteger(layout2.dpi) || layout2.dpi <= 0))
|
|
1960
|
+
throw new RangeError("Invalid picture DPI");
|
|
1961
|
+
attr3(fill, "dpi", layout2.dpi, void 0);
|
|
1962
|
+
}
|
|
1963
|
+
const make = (parent, name) => {
|
|
1964
|
+
const old = first(parent, name, NS.a);
|
|
1965
|
+
if (old) return old;
|
|
1966
|
+
const node = fill.ownerDocument.createElementNS(NS.a, `a:${name}`);
|
|
1967
|
+
parent.insertBefore(node, first(parent, "extLst", NS.a) ?? null);
|
|
1968
|
+
return node;
|
|
1969
|
+
};
|
|
1970
|
+
if (layout2.tile) {
|
|
1971
|
+
const stretch = first(fill, "stretch", NS.a);
|
|
1972
|
+
if (stretch) fill.removeChild(stretch);
|
|
1973
|
+
const tile = make(fill, "tile");
|
|
1974
|
+
for (const [key, name] of [
|
|
1975
|
+
["scaleX", "sx"],
|
|
1976
|
+
["scaleY", "sy"],
|
|
1977
|
+
["offsetXEmu", "tx"],
|
|
1978
|
+
["offsetYEmu", "ty"]
|
|
1979
|
+
]) {
|
|
1980
|
+
const n = layout2.tile[key];
|
|
1981
|
+
if (n !== void 0 && (!Number.isFinite(n) || (name === "sx" || name === "sy" ? n <= 0 : !Number.isSafeInteger(n))))
|
|
1982
|
+
throw new RangeError("Invalid picture tile");
|
|
1983
|
+
if (n !== before.tile?.[key])
|
|
1984
|
+
attr3(
|
|
1985
|
+
tile,
|
|
1986
|
+
name,
|
|
1987
|
+
n === void 0 ? void 0 : Math.round(n * (name === "sx" || name === "sy" ? 1e5 : 1)),
|
|
1988
|
+
void 0
|
|
1989
|
+
);
|
|
1990
|
+
}
|
|
1991
|
+
if (layout2.tile.alignment !== before.tile?.alignment) {
|
|
1992
|
+
if (layout2.tile.alignment && !["tl", "t", "tr", "l", "ctr", "r", "bl", "b", "br"].includes(layout2.tile.alignment))
|
|
1993
|
+
throw new RangeError("Invalid picture tile alignment");
|
|
1994
|
+
attr3(tile, "algn", layout2.tile.alignment, void 0);
|
|
1995
|
+
}
|
|
1996
|
+
if (layout2.tile.flip !== void 0 && !["none", "x", "y", "xy"].includes(layout2.tile.flip))
|
|
1997
|
+
throw new RangeError("Invalid picture tile flip");
|
|
1998
|
+
if (layout2.tile.flip !== before.tile?.flip) attr3(tile, "flip", layout2.tile.flip, void 0);
|
|
1999
|
+
} else if (before.tile || layout2.fillRect) {
|
|
2000
|
+
const tile = first(fill, "tile", NS.a);
|
|
2001
|
+
if (tile) fill.removeChild(tile);
|
|
2002
|
+
const rect2 = make(make(fill, "stretch"), "fillRect");
|
|
2003
|
+
for (const key of ["l", "t", "r", "b"]) {
|
|
2004
|
+
const n = layout2.fillRect?.[key];
|
|
2005
|
+
if (n !== void 0 && !Number.isFinite(n))
|
|
2006
|
+
throw new RangeError("Invalid picture fill rectangle");
|
|
2007
|
+
if (n !== before.fillRect?.[key])
|
|
2008
|
+
attr3(rect2, key, n === void 0 ? void 0 : Math.round(n * 1e5), void 0);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
// drawingml/picture-crop.ts
|
|
2014
|
+
var SIDES2 = { l: "cropLeft", t: "cropTop", r: "cropRight", b: "cropBottom" };
|
|
2015
|
+
function parsePictureCrop(blipFill) {
|
|
2016
|
+
const rect2 = first(blipFill, "srcRect", NS.a);
|
|
2017
|
+
if (!rect2) return void 0;
|
|
2018
|
+
const result = {};
|
|
2019
|
+
for (const [attr3, key] of Object.entries(SIDES2)) {
|
|
2020
|
+
const raw2 = rect2.getAttribute(attr3);
|
|
2021
|
+
if (raw2 === null || !raw2.trim()) continue;
|
|
2022
|
+
const percent = raw2.endsWith("%");
|
|
2023
|
+
const value = Number(percent ? raw2.slice(0, -1) : raw2) / (percent ? 100 : 1e5);
|
|
2024
|
+
if (Number.isFinite(value)) result[key] = value;
|
|
2025
|
+
}
|
|
2026
|
+
return result;
|
|
2027
|
+
}
|
|
2028
|
+
function applyPictureCrop(blipFill, crop) {
|
|
2029
|
+
let rect2 = first(blipFill, "srcRect", NS.a);
|
|
2030
|
+
if (!rect2 && crop && Object.values(crop).some((value) => value !== void 0)) {
|
|
2031
|
+
rect2 = blipFill.ownerDocument.createElementNS(NS.a, "a:srcRect");
|
|
2032
|
+
const blip = first(blipFill, "blip", NS.a);
|
|
2033
|
+
blipFill.insertBefore(rect2, blip?.nextSibling ?? blipFill.firstChild);
|
|
2034
|
+
}
|
|
2035
|
+
if (!rect2) return;
|
|
2036
|
+
for (const [attr3, key] of Object.entries(SIDES2)) {
|
|
2037
|
+
const value = crop?.[key];
|
|
2038
|
+
if (value === void 0) rect2.removeAttribute(attr3);
|
|
2039
|
+
else {
|
|
2040
|
+
if (!Number.isFinite(value)) throw new RangeError("Picture crop must be finite");
|
|
2041
|
+
rect2.setAttribute(attr3, String(Math.round(value * 1e5)));
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
|
|
1662
2046
|
// drawingml/picture-fill.ts
|
|
1663
2047
|
function parseDrawingPictureFill(fill) {
|
|
1664
2048
|
const blip = first(fill, "blip", NS.a);
|
|
@@ -1666,13 +2050,32 @@ function parseDrawingPictureFill(fill) {
|
|
|
1666
2050
|
const linkRelId = blip?.getAttributeNS(NS.r, "link") || void 0;
|
|
1667
2051
|
const crop = parsePictureCrop(fill);
|
|
1668
2052
|
const effects = parsePictureEffects(blip);
|
|
1669
|
-
const
|
|
1670
|
-
const
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
2053
|
+
const layout2 = parsePictureLayout(fill);
|
|
2054
|
+
const unsupported2 = [];
|
|
2055
|
+
const tile = first(fill, "tile", NS.a), stretch = first(fill, "stretch", NS.a);
|
|
2056
|
+
if (tile && stretch) unsupported2.push("tile/stretch-choice");
|
|
2057
|
+
if (tile) {
|
|
2058
|
+
for (const [attr3, key] of [
|
|
2059
|
+
["sx", "scaleX"],
|
|
2060
|
+
["sy", "scaleY"],
|
|
2061
|
+
["tx", "offsetXEmu"],
|
|
2062
|
+
["ty", "offsetYEmu"]
|
|
2063
|
+
])
|
|
2064
|
+
if (tile.hasAttribute(attr3) && (layout2.tile?.[key] === void 0 || (attr3 === "sx" || attr3 === "sy") && layout2.tile[key] <= 0))
|
|
2065
|
+
unsupported2.push(`tile:${attr3}`);
|
|
2066
|
+
if (tile.hasAttribute("algn") && !["tl", "t", "tr", "l", "ctr", "r", "bl", "b", "br"].includes(tile.getAttribute("algn") ?? ""))
|
|
2067
|
+
unsupported2.push("tile:algn");
|
|
2068
|
+
if (tile.hasAttribute("flip") && !layout2.tile?.flip) unsupported2.push("tile:flip");
|
|
2069
|
+
}
|
|
2070
|
+
const rect2 = first(stretch, "fillRect", NS.a);
|
|
2071
|
+
if (rect2)
|
|
2072
|
+
for (const key of ["l", "t", "r", "b"]) {
|
|
2073
|
+
const raw2 = rect2.getAttribute(key);
|
|
2074
|
+
if (raw2 !== null && !/^[-+]?(?:\d+\.?\d*|\.\d+)%?$/.test(raw2))
|
|
2075
|
+
unsupported2.push(`fillRect:${key}`);
|
|
2076
|
+
}
|
|
2077
|
+
if (fill.hasAttribute("rotWithShape") && !["0", "1", "true", "false"].includes(fill.getAttribute("rotWithShape") ?? ""))
|
|
2078
|
+
unsupported2.push("rotWithShape");
|
|
1676
2079
|
return {
|
|
1677
2080
|
kind: "picture",
|
|
1678
2081
|
sourceXml: buildXml(fill),
|
|
@@ -1680,6 +2083,7 @@ function parseDrawingPictureFill(fill) {
|
|
|
1680
2083
|
...linkRelId ? { linkRelId } : {},
|
|
1681
2084
|
...crop ? { crop } : {},
|
|
1682
2085
|
...effects.length ? { effects } : {},
|
|
2086
|
+
...Object.keys(layout2).length ? { layout: layout2 } : {},
|
|
1683
2087
|
...unsupported2.length ? { unsupportedPicture: unsupported2 } : {}
|
|
1684
2088
|
};
|
|
1685
2089
|
}
|
|
@@ -1811,80 +2215,6 @@ function drawingDashLength(value) {
|
|
|
1811
2215
|
return Number.isSafeInteger(number2) && number2 <= 2147483647 ? number2 : void 0;
|
|
1812
2216
|
}
|
|
1813
2217
|
|
|
1814
|
-
// drawingml/write-color.ts
|
|
1815
|
-
var ELEMENTS = {
|
|
1816
|
-
srgb: "srgbClr",
|
|
1817
|
-
scheme: "schemeClr",
|
|
1818
|
-
system: "sysClr",
|
|
1819
|
-
preset: "prstClr",
|
|
1820
|
-
scrgb: "scrgbClr",
|
|
1821
|
-
hsl: "hslClr"
|
|
1822
|
-
};
|
|
1823
|
-
function drawingColorXml(color) {
|
|
1824
|
-
const local = ELEMENTS[color.kind];
|
|
1825
|
-
const doc = parseXml(`<a:${local} xmlns:a="${NS.a}"/>`);
|
|
1826
|
-
const root = doc.documentElement;
|
|
1827
|
-
if (color.kind === "scrgb" || color.kind === "hsl") {
|
|
1828
|
-
const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
|
|
1829
|
-
const values = color.value.split(",");
|
|
1830
|
-
keys.forEach((key, i) => root.setAttribute(key, values[i] ?? "0"));
|
|
1831
|
-
} else root.setAttribute("val", color.value);
|
|
1832
|
-
if (color.fallback !== void 0 && color.kind === "system")
|
|
1833
|
-
root.setAttribute("lastClr", color.fallback);
|
|
1834
|
-
for (const transform2 of color.transforms) {
|
|
1835
|
-
if (!/^[A-Za-z_][\w.-]*$/.test(transform2.name))
|
|
1836
|
-
throw new Error(`Invalid DrawingML transform ${transform2.name}`);
|
|
1837
|
-
const node = doc.createElementNS(NS.a, `a:${transform2.name}`);
|
|
1838
|
-
if (transform2.value !== "") node.setAttribute("val", transform2.value);
|
|
1839
|
-
root.appendChild(node);
|
|
1840
|
-
}
|
|
1841
|
-
return buildXml(doc);
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
// drawingml/patch-color.ts
|
|
1845
|
-
function patchDrawingColorIn(container, color) {
|
|
1846
|
-
const old = elements(container).find((node) => parseDrawingColor(node));
|
|
1847
|
-
const before = parseDrawingColorIn(container);
|
|
1848
|
-
if (!old || !before || before.kind !== color.kind) {
|
|
1849
|
-
const next = container.ownerDocument.importNode(
|
|
1850
|
-
parseXml(drawingColorXml(color)).documentElement,
|
|
1851
|
-
true
|
|
1852
|
-
);
|
|
1853
|
-
if (old) container.replaceChild(next, old);
|
|
1854
|
-
else container.insertBefore(next, container.firstChild);
|
|
1855
|
-
return;
|
|
1856
|
-
}
|
|
1857
|
-
if (before.value !== color.value) {
|
|
1858
|
-
if (color.kind === "scrgb" || color.kind === "hsl") {
|
|
1859
|
-
const keys = color.kind === "scrgb" ? ["r", "g", "b"] : ["hue", "sat", "lum"];
|
|
1860
|
-
const values = color.value.split(",");
|
|
1861
|
-
keys.forEach((key, index) => old.setAttribute(key, values[index] ?? "0"));
|
|
1862
|
-
} else old.setAttribute("val", color.value);
|
|
1863
|
-
}
|
|
1864
|
-
if (before.fallback !== color.fallback && color.kind === "system") {
|
|
1865
|
-
if (color.fallback === void 0) old.removeAttribute("lastClr");
|
|
1866
|
-
else old.setAttribute("lastClr", color.fallback);
|
|
1867
|
-
}
|
|
1868
|
-
const originals = elements(old);
|
|
1869
|
-
color.transforms.forEach((transform2, index) => {
|
|
1870
|
-
const source2 = originals[index];
|
|
1871
|
-
if (source2?.localName === transform2.name) {
|
|
1872
|
-
if (before.transforms[index]?.value !== transform2.value) {
|
|
1873
|
-
if (transform2.value === "") source2.removeAttribute("val");
|
|
1874
|
-
else source2.setAttribute("val", transform2.value);
|
|
1875
|
-
}
|
|
1876
|
-
return;
|
|
1877
|
-
}
|
|
1878
|
-
if (!/^[A-Za-z_][\w.-]*$/u.test(transform2.name))
|
|
1879
|
-
throw new Error("Invalid DrawingML colour transform");
|
|
1880
|
-
const next = old.ownerDocument.createElementNS(NS.a, `a:${transform2.name}`);
|
|
1881
|
-
if (transform2.value !== "") next.setAttribute("val", transform2.value);
|
|
1882
|
-
if (source2) old.replaceChild(next, source2);
|
|
1883
|
-
else old.appendChild(next);
|
|
1884
|
-
});
|
|
1885
|
-
for (const extra of originals.slice(color.transforms.length)) old.removeChild(extra);
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
2218
|
// drawingml/write-pattern-picture.ts
|
|
1889
2219
|
function drawingPatternPictureXml(fill) {
|
|
1890
2220
|
const name = fill.kind === "pattern" ? "pattFill" : "blipFill";
|
|
@@ -1946,7 +2276,8 @@ function drawingPatternPictureXml(fill) {
|
|
|
1946
2276
|
applyPictureCrop(root, fill.crop);
|
|
1947
2277
|
if (fill.effects !== void 0 && JSON.stringify(before?.kind === "picture" ? before.effects ?? [] : []) !== JSON.stringify(fill.effects ?? []))
|
|
1948
2278
|
applyPictureEffects(blip, fill.effects ?? []);
|
|
1949
|
-
if (
|
|
2279
|
+
if (fill.layout !== void 0) applyPictureLayout(root, fill.layout);
|
|
2280
|
+
if (!fill.sourceXml && !fill.layout?.tile && !first(root, "stretch", NS.a)) {
|
|
1950
2281
|
const stretch = doc.createElementNS(NS.a, "a:stretch");
|
|
1951
2282
|
stretch.appendChild(doc.createElementNS(NS.a, "a:fillRect"));
|
|
1952
2283
|
root.appendChild(stretch);
|
|
@@ -18214,7 +18545,7 @@ function isSpace(ch) {
|
|
|
18214
18545
|
return ch === " " || ch === " " || ch === "\n" || ch === "\r";
|
|
18215
18546
|
}
|
|
18216
18547
|
function parseAttributes(source2) {
|
|
18217
|
-
const
|
|
18548
|
+
const attrs3 = {};
|
|
18218
18549
|
let i = 0;
|
|
18219
18550
|
const n = source2.length;
|
|
18220
18551
|
while (i < n) {
|
|
@@ -18249,9 +18580,9 @@ function parseAttributes(source2) {
|
|
|
18249
18580
|
if (name === "xmlns" || name.startsWith("xmlns:")) {
|
|
18250
18581
|
continue;
|
|
18251
18582
|
}
|
|
18252
|
-
|
|
18583
|
+
attrs3[localName(name)] = decodeEntities(value);
|
|
18253
18584
|
}
|
|
18254
|
-
return
|
|
18585
|
+
return attrs3;
|
|
18255
18586
|
}
|
|
18256
18587
|
function tagEnd2(xml, from) {
|
|
18257
18588
|
let quote = "";
|
|
@@ -18377,14 +18708,14 @@ function numOrNaN(value) {
|
|
|
18377
18708
|
function relation(value) {
|
|
18378
18709
|
return value === "ch" || value === "des" ? value : "self";
|
|
18379
18710
|
}
|
|
18380
|
-
function parseIterator(
|
|
18711
|
+
function parseIterator(attrs3) {
|
|
18381
18712
|
return {
|
|
18382
|
-
axis: list(
|
|
18383
|
-
ptType: list(
|
|
18384
|
-
hideLastTrans: list(
|
|
18385
|
-
st: numberList(
|
|
18386
|
-
cnt: numberList(
|
|
18387
|
-
step: numberList(
|
|
18713
|
+
axis: list(attrs3.axis),
|
|
18714
|
+
ptType: list(attrs3.ptType),
|
|
18715
|
+
hideLastTrans: list(attrs3.hideLastTrans).map((v) => v === "1" || v === "true"),
|
|
18716
|
+
st: numberList(attrs3.st),
|
|
18717
|
+
cnt: numberList(attrs3.cnt),
|
|
18718
|
+
step: numberList(attrs3.step)
|
|
18388
18719
|
};
|
|
18389
18720
|
}
|
|
18390
18721
|
function parseAlgorithm(element4) {
|
|
@@ -18415,41 +18746,41 @@ function parseShape2(element4) {
|
|
|
18415
18746
|
adj
|
|
18416
18747
|
};
|
|
18417
18748
|
}
|
|
18418
|
-
function parseConstraint(
|
|
18419
|
-
const op =
|
|
18749
|
+
function parseConstraint(attrs3) {
|
|
18750
|
+
const op = attrs3.op;
|
|
18420
18751
|
return {
|
|
18421
|
-
type:
|
|
18422
|
-
for: relation(
|
|
18423
|
-
forName:
|
|
18424
|
-
ptType:
|
|
18425
|
-
refType:
|
|
18426
|
-
refFor: relation(
|
|
18427
|
-
refForName:
|
|
18428
|
-
refPtType:
|
|
18752
|
+
type: attrs3.type ?? "none",
|
|
18753
|
+
for: relation(attrs3.for),
|
|
18754
|
+
forName: attrs3.forName || void 0,
|
|
18755
|
+
ptType: attrs3.ptType ?? "all",
|
|
18756
|
+
refType: attrs3.refType ?? "none",
|
|
18757
|
+
refFor: relation(attrs3.refFor),
|
|
18758
|
+
refForName: attrs3.refForName || void 0,
|
|
18759
|
+
refPtType: attrs3.refPtType ?? "all",
|
|
18429
18760
|
op: op === "equ" || op === "gte" || op === "lte" ? op : "none",
|
|
18430
|
-
val: num(
|
|
18431
|
-
hasVal:
|
|
18432
|
-
fact: num(
|
|
18761
|
+
val: num(attrs3.val, 0),
|
|
18762
|
+
hasVal: attrs3.val !== void 0,
|
|
18763
|
+
fact: num(attrs3.fact, 1)
|
|
18433
18764
|
};
|
|
18434
18765
|
}
|
|
18435
|
-
function parseRule(
|
|
18766
|
+
function parseRule(attrs3) {
|
|
18436
18767
|
return {
|
|
18437
|
-
type:
|
|
18438
|
-
for: relation(
|
|
18439
|
-
forName:
|
|
18440
|
-
ptType:
|
|
18441
|
-
val: numOrNaN(
|
|
18442
|
-
fact: numOrNaN(
|
|
18443
|
-
max: numOrNaN(
|
|
18768
|
+
type: attrs3.type ?? "none",
|
|
18769
|
+
for: relation(attrs3.for),
|
|
18770
|
+
forName: attrs3.forName || void 0,
|
|
18771
|
+
ptType: attrs3.ptType ?? "all",
|
|
18772
|
+
val: numOrNaN(attrs3.val),
|
|
18773
|
+
fact: numOrNaN(attrs3.fact),
|
|
18774
|
+
max: numOrNaN(attrs3.max)
|
|
18444
18775
|
};
|
|
18445
18776
|
}
|
|
18446
|
-
function parseCondition(
|
|
18777
|
+
function parseCondition(attrs3) {
|
|
18447
18778
|
return {
|
|
18448
|
-
...parseIterator(
|
|
18449
|
-
func:
|
|
18450
|
-
arg:
|
|
18451
|
-
op:
|
|
18452
|
-
val:
|
|
18779
|
+
...parseIterator(attrs3),
|
|
18780
|
+
func: attrs3.func ?? "cnt",
|
|
18781
|
+
arg: attrs3.arg,
|
|
18782
|
+
op: attrs3.op ?? "equ",
|
|
18783
|
+
val: attrs3.val ?? ""
|
|
18453
18784
|
};
|
|
18454
18785
|
}
|
|
18455
18786
|
function parseBody(element4, state) {
|
|
@@ -22550,7 +22881,13 @@ function buildRenderedNode(node, index, nodeById, palette, style, mergedSourceId
|
|
|
22550
22881
|
fontSize: 0,
|
|
22551
22882
|
textX: x + width / 2,
|
|
22552
22883
|
textY: y + height / 2,
|
|
22553
|
-
|
|
22884
|
+
// Picture roles often omit presOf: they present the current point's image, not its text.
|
|
22885
|
+
nodeId: primary?.id ?? (node.shape?.blipPhldr ? node.point.source?.id : void 0),
|
|
22886
|
+
picturePlaceholder: node.shape?.blipPhldr,
|
|
22887
|
+
layoutRole: node.name,
|
|
22888
|
+
contextNodeId: node.point.source?.id,
|
|
22889
|
+
textAlign: ["l", "ctr", "r"].includes(node.alg.params.parTxLTRAlign ?? "") ? node.alg.params.parTxLTRAlign : void 0,
|
|
22890
|
+
textVerticalAnchor: ["t", "ctr", "b"].includes(node.alg.params.txAnchorVert ?? "") ? node.alg.params.txAnchorVert : void 0,
|
|
22554
22891
|
rotation: transform2.rotation === 0 ? void 0 : transform2.rotation,
|
|
22555
22892
|
presetOverride: node.shape?.type ?? "roundRect",
|
|
22556
22893
|
foldedNodeIds: foldedNodeIds.length > 0 ? foldedNodeIds : void 0,
|
|
@@ -24837,6 +25174,203 @@ function approximateDiagramDrawingFromNodes(input) {
|
|
|
24837
25174
|
});
|
|
24838
25175
|
}
|
|
24839
25176
|
|
|
25177
|
+
// diagram/picture-layout.ts
|
|
25178
|
+
var DIAGRAM_PICTURE_SOURCE_NS = "urn:ooxml-core:diagram-picture-sources:1";
|
|
25179
|
+
function remapFill(fill, id) {
|
|
25180
|
+
if (!fill.sourceXml) return { ...fill, relId: id };
|
|
25181
|
+
const node = parseXml(fill.sourceXml).documentElement;
|
|
25182
|
+
const blip = first(node, "blip", NS.a);
|
|
25183
|
+
if (blip) {
|
|
25184
|
+
blip.setAttributeNS(NS.r, "r:embed", id);
|
|
25185
|
+
blip.removeAttributeNS(NS.r, "link");
|
|
25186
|
+
}
|
|
25187
|
+
return { ...fill, relId: id, sourceXml: buildXml(node) };
|
|
25188
|
+
}
|
|
25189
|
+
function captureDiagramPictures(model, dataXml2, dataParts, drawing) {
|
|
25190
|
+
const pictures = [];
|
|
25191
|
+
const parts = { ...dataParts };
|
|
25192
|
+
const add4 = (source2, owner) => {
|
|
25193
|
+
const part = source2.fill.relId ? owner[source2.fill.relId] : void 0;
|
|
25194
|
+
if (!part) return;
|
|
25195
|
+
let id = Object.keys(parts).find((key) => parts[key] === part);
|
|
25196
|
+
if (!id) {
|
|
25197
|
+
let index = 1;
|
|
25198
|
+
while (Object.hasOwn(parts, `ooxmlDiagramPicture${index}`)) index++;
|
|
25199
|
+
id = `ooxmlDiagramPicture${index}`;
|
|
25200
|
+
parts[id] = part;
|
|
25201
|
+
}
|
|
25202
|
+
const entry2 = { ...source2, fill: remapFill(source2.fill, id) };
|
|
25203
|
+
const existing = pictures.findIndex(
|
|
25204
|
+
(item2) => item2.nodeId === entry2.nodeId && (item2.role === entry2.role && item2.styleLabel === entry2.styleLabel || !item2.role && !item2.styleLabel && item2.fill.relId === entry2.fill.relId)
|
|
25205
|
+
);
|
|
25206
|
+
if (existing < 0) pictures.push(entry2);
|
|
25207
|
+
else pictures[existing] = entry2;
|
|
25208
|
+
};
|
|
25209
|
+
const root = parseXml(dataXml2).documentElement;
|
|
25210
|
+
const saved = root.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "picture");
|
|
25211
|
+
for (const element4 of saved) {
|
|
25212
|
+
const nodeId = element4.getAttribute("nodeId");
|
|
25213
|
+
const fill = first(element4, "blipFill", NS.a);
|
|
25214
|
+
if (nodeId && fill && model.nodes.some((node) => node.modelId === nodeId))
|
|
25215
|
+
add4(
|
|
25216
|
+
{
|
|
25217
|
+
nodeId,
|
|
25218
|
+
fill: parseDrawingPictureFill(fill),
|
|
25219
|
+
...element4.getAttribute("role") ? { role: element4.getAttribute("role") } : {},
|
|
25220
|
+
...element4.getAttribute("styleLabel") ? { styleLabel: element4.getAttribute("styleLabel") } : {}
|
|
25221
|
+
},
|
|
25222
|
+
dataParts
|
|
25223
|
+
);
|
|
25224
|
+
}
|
|
25225
|
+
for (const point of model.points) {
|
|
25226
|
+
if (point.fill?.kind !== "picture") continue;
|
|
25227
|
+
const nodeId = point.type === "pres" ? point.presAssocId : point.modelId;
|
|
25228
|
+
if (nodeId && model.nodes.some((node) => node.modelId === nodeId) && !pictures.some((item2) => item2.nodeId === nodeId))
|
|
25229
|
+
add4(
|
|
25230
|
+
{
|
|
25231
|
+
nodeId,
|
|
25232
|
+
fill: point.fill,
|
|
25233
|
+
...point.presName ? { role: point.presName } : {},
|
|
25234
|
+
...point.presStyleLabel ? { styleLabel: point.presStyleLabel } : {}
|
|
25235
|
+
},
|
|
25236
|
+
dataParts
|
|
25237
|
+
);
|
|
25238
|
+
}
|
|
25239
|
+
for (const shape of drawing?.shapes ?? []) {
|
|
25240
|
+
if (shape.fill?.kind !== "picture") continue;
|
|
25241
|
+
const point = model.points.find((point2) => point2.modelId === shape.modelId);
|
|
25242
|
+
const nodeId = shape.sourceNodeId ?? (point?.type === "pres" ? point.presAssocId : point?.modelId);
|
|
25243
|
+
const part = shape.fill.relId ? drawing?.pictureParts?.[shape.fill.relId] : void 0;
|
|
25244
|
+
if (saved.length && pictures.some(
|
|
25245
|
+
(item2) => item2.nodeId === nodeId && item2.fill.relId && parts[item2.fill.relId] === part && item2.role !== point?.presName && item2.styleLabel !== point?.presStyleLabel
|
|
25246
|
+
))
|
|
25247
|
+
continue;
|
|
25248
|
+
if (nodeId && model.nodes.some((node) => node.modelId === nodeId))
|
|
25249
|
+
add4(
|
|
25250
|
+
{
|
|
25251
|
+
nodeId,
|
|
25252
|
+
fill: shape.fill,
|
|
25253
|
+
...point?.presName ? { role: point.presName } : {},
|
|
25254
|
+
...point?.presStyleLabel ? { styleLabel: point.presStyleLabel } : {}
|
|
25255
|
+
},
|
|
25256
|
+
drawing?.pictureParts ?? {}
|
|
25257
|
+
);
|
|
25258
|
+
}
|
|
25259
|
+
return pictures.length ? { pictures, pictureParts: parts } : {};
|
|
25260
|
+
}
|
|
25261
|
+
function applyDiagramPictureSources(drawing, nodes, source2, issues, liveNodeIds) {
|
|
25262
|
+
if (!source2?.pictures?.length) return;
|
|
25263
|
+
if (source2.pictureParts) drawing.pictureParts = { ...source2.pictureParts };
|
|
25264
|
+
const used = /* @__PURE__ */ new Set();
|
|
25265
|
+
nodes.forEach((node, index) => {
|
|
25266
|
+
if (!node.picturePlaceholder || !node.nodeId) return;
|
|
25267
|
+
const shape = drawing.shapes[index];
|
|
25268
|
+
if (!shape) return;
|
|
25269
|
+
const candidates = source2.pictures.filter((picture2) => picture2.nodeId === node.nodeId);
|
|
25270
|
+
const matching = candidates.filter(
|
|
25271
|
+
(picture2) => picture2.role === node.layoutRole || !!picture2.styleLabel && picture2.styleLabel === node.styleLabel
|
|
25272
|
+
);
|
|
25273
|
+
const picture = matching.length === 1 ? matching[0] : candidates.length === 1 ? candidates[0] : void 0;
|
|
25274
|
+
if (picture) {
|
|
25275
|
+
shape.fill = structuredClone(picture.fill);
|
|
25276
|
+
delete shape.text;
|
|
25277
|
+
delete shape.body;
|
|
25278
|
+
used.add(picture);
|
|
25279
|
+
} else if (candidates.length)
|
|
25280
|
+
issues.push({
|
|
25281
|
+
code: "DIAGRAM_PICTURE_AMBIGUOUS",
|
|
25282
|
+
message: `Picture role ${node.layoutRole ?? node.key} has multiple source pictures; no arbitrary assignment was made.`
|
|
25283
|
+
});
|
|
25284
|
+
});
|
|
25285
|
+
if (source2.pictures.some(
|
|
25286
|
+
(picture) => (!liveNodeIds || liveNodeIds.has(picture.nodeId)) && !used.has(picture)
|
|
25287
|
+
))
|
|
25288
|
+
issues.push({
|
|
25289
|
+
code: "DIAGRAM_PICTURE_LAYOUT_UNSUPPORTED",
|
|
25290
|
+
message: "Some retained pictures have no matching image placeholder in this layout. Their source associations are preserved for a compatible layout."
|
|
25291
|
+
});
|
|
25292
|
+
}
|
|
25293
|
+
function withDiagramPictureSources(dataXml2, source2) {
|
|
25294
|
+
if (!source2?.pictures?.length) return dataXml2;
|
|
25295
|
+
const doc = parseXml(dataXml2);
|
|
25296
|
+
const root = doc.documentElement;
|
|
25297
|
+
const points = first(root, "ptLst", NS.dgm);
|
|
25298
|
+
const live = children(points ?? root, "pt", NS.dgm).filter(
|
|
25299
|
+
(point) => !["doc", "pres", "parTrans", "sibTrans"].includes(point.getAttribute("type") ?? "node")
|
|
25300
|
+
);
|
|
25301
|
+
for (const element4 of [...root.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "pictures")]) {
|
|
25302
|
+
const extension2 = element4.parentNode;
|
|
25303
|
+
if (extension2?.parentNode) extension2.parentNode.removeChild(extension2);
|
|
25304
|
+
}
|
|
25305
|
+
const retained = source2.pictures.filter(
|
|
25306
|
+
(picture) => live.some((point) => point.getAttribute("modelId") === picture.nodeId)
|
|
25307
|
+
);
|
|
25308
|
+
if (!retained.length) return buildXml(doc);
|
|
25309
|
+
const list2 = first(root, "extLst", NS.dgm) ?? doc.createElementNS(NS.dgm, "dgm:extLst");
|
|
25310
|
+
if (!list2.parentNode) root.appendChild(list2);
|
|
25311
|
+
const extension = doc.createElementNS(NS.a, "a:ext");
|
|
25312
|
+
extension.setAttribute("uri", DIAGRAM_PICTURE_SOURCE_NS);
|
|
25313
|
+
const payload = doc.createElementNS(DIAGRAM_PICTURE_SOURCE_NS, "op:pictures");
|
|
25314
|
+
extension.appendChild(payload);
|
|
25315
|
+
list2.appendChild(extension);
|
|
25316
|
+
for (const picture of retained) {
|
|
25317
|
+
if (!picture.fill.sourceXml)
|
|
25318
|
+
throw new Error("A retained SmartArt picture needs source fill XML");
|
|
25319
|
+
const element4 = doc.createElementNS(DIAGRAM_PICTURE_SOURCE_NS, "op:picture");
|
|
25320
|
+
element4.setAttribute("nodeId", picture.nodeId);
|
|
25321
|
+
if (picture.role) element4.setAttribute("role", picture.role);
|
|
25322
|
+
if (picture.styleLabel) element4.setAttribute("styleLabel", picture.styleLabel);
|
|
25323
|
+
const fill = parseXml(picture.fill.sourceXml).documentElement;
|
|
25324
|
+
element4.appendChild(doc.importNode(fill, true));
|
|
25325
|
+
payload.appendChild(element4);
|
|
25326
|
+
const presentations = children(points ?? root, "pt", NS.dgm).filter((point) => {
|
|
25327
|
+
const props = first(point, "prSet", NS.dgm);
|
|
25328
|
+
return point.getAttribute("type") === "pres" && props?.getAttribute("presAssocID") === picture.nodeId && (picture.role && props.getAttribute("presName") === picture.role || picture.styleLabel && props.getAttribute("presStyleLbl") === picture.styleLabel);
|
|
25329
|
+
});
|
|
25330
|
+
if (presentations.length === 1) {
|
|
25331
|
+
const point = presentations[0];
|
|
25332
|
+
const props = first(point, "spPr", NS.dgm) ?? doc.createElementNS(NS.dgm, "dgm:spPr");
|
|
25333
|
+
if (!props.parentNode) point.appendChild(props);
|
|
25334
|
+
for (const old of [...props.childNodes].filter((node) => node.nodeType === 1).filter(
|
|
25335
|
+
(node) => node.namespaceURI === NS.a && ["blipFill", "solidFill", "gradFill", "pattFill", "noFill", "grpFill"].includes(
|
|
25336
|
+
node.localName
|
|
25337
|
+
)
|
|
25338
|
+
))
|
|
25339
|
+
props.removeChild(old);
|
|
25340
|
+
props.insertBefore(doc.importNode(fill, true), props.firstChild);
|
|
25341
|
+
}
|
|
25342
|
+
}
|
|
25343
|
+
return buildXml(doc);
|
|
25344
|
+
}
|
|
25345
|
+
function diagramPictureRelationships(owner, source2, existing) {
|
|
25346
|
+
if (!source2?.pictures?.length || !source2.pictureParts) return existing;
|
|
25347
|
+
const rels = parseRelationships(existing);
|
|
25348
|
+
for (const [id, part] of Object.entries(source2.pictureParts)) {
|
|
25349
|
+
const previous = rels.get(id);
|
|
25350
|
+
if (previous && (previous.mode === "External" || resolvePartPath(owner, previous.target) !== part))
|
|
25351
|
+
throw new Error(`Conflicting SmartArt picture relationship: ${id}`);
|
|
25352
|
+
rels.set(id, { id, type: RELATIONSHIP_TYPES.image, target: `/${part}`, mode: "Internal" });
|
|
25353
|
+
}
|
|
25354
|
+
return buildRelationshipsXml(rels);
|
|
25355
|
+
}
|
|
25356
|
+
|
|
25357
|
+
// diagram/layout-role-style.ts
|
|
25358
|
+
function applyDiagramRoleColors(shape, role, index, minorFont) {
|
|
25359
|
+
const at = (colors) => colors[index % colors.length];
|
|
25360
|
+
const fill = role && at(role.fill.colors);
|
|
25361
|
+
if (fill && shape.fill?.kind !== "none" && shape.fill?.kind !== "picture")
|
|
25362
|
+
shape.fill = { kind: "solid", color: structuredClone(fill) };
|
|
25363
|
+
const line2 = role && at(role.line.colors);
|
|
25364
|
+
if (line2 && shape.line) shape.line.fill = { kind: "solid", color: structuredClone(line2) };
|
|
25365
|
+
const text = role && at(role.textFill.colors);
|
|
25366
|
+
for (const paragraph2 of shape.text?.paragraphs ?? []) {
|
|
25367
|
+
for (const run2 of paragraph2.runs) {
|
|
25368
|
+
if (!run2.color && text) run2.color = structuredClone(text);
|
|
25369
|
+
if (!run2.typeface && minorFont) run2.typeface = minorFont;
|
|
25370
|
+
}
|
|
25371
|
+
}
|
|
25372
|
+
}
|
|
25373
|
+
|
|
24840
25374
|
// diagram/layout-preview.ts
|
|
24841
25375
|
function diagramLayoutData(input) {
|
|
24842
25376
|
const original = input.source?.dataXml ? parseDiagramDataModel(input.source.dataXml) : void 0;
|
|
@@ -24982,6 +25516,8 @@ function previewDiagramLayout(input) {
|
|
|
24982
25516
|
];
|
|
24983
25517
|
});
|
|
24984
25518
|
const drawing2 = diagramDrawingFromViews(views);
|
|
25519
|
+
drawing2.extentEmu = { ...input.extentEmu };
|
|
25520
|
+
const colors = input.source?.colorsXml ? parseDiagramColors(input.source.colorsXml) : void 0;
|
|
24985
25521
|
const quickStyle = input.source?.quickStyleXml ? parseDiagramQuickStyle(input.source.quickStyleXml) : void 0;
|
|
24986
25522
|
const originalModel = input.source?.dataXml ? parseDiagramDataModel(input.source.dataXml) : void 0;
|
|
24987
25523
|
result.nodes.forEach((node, index) => {
|
|
@@ -24992,7 +25528,9 @@ function previewDiagramLayout(input) {
|
|
|
24992
25528
|
shape.style = label;
|
|
24993
25529
|
shape.has3d = label.requires3d ?? label.hasShape3d;
|
|
24994
25530
|
}
|
|
24995
|
-
|
|
25531
|
+
const contextNodeId = node.nodeId ?? node.contextNodeId;
|
|
25532
|
+
if (contextNodeId) shape.sourceNodeId = contextNodeId;
|
|
25533
|
+
if (node.layoutRole) shape.sourceLayoutRole = node.layoutRole;
|
|
24996
25534
|
if (node.styleLabel) shape.sourceStyleLabel = node.styleLabel;
|
|
24997
25535
|
if (node.foldedNodeIds?.length) shape.foldedNodeIds = node.foldedNodeIds;
|
|
24998
25536
|
const sourceNode = data.nodes.find((entry2) => entry2.id === node.nodeId);
|
|
@@ -25005,15 +25543,36 @@ function previewDiagramLayout(input) {
|
|
|
25005
25543
|
if (fill) shape.fill = fill;
|
|
25006
25544
|
}
|
|
25007
25545
|
const direct = originalModel?.nodes.find((entry2) => entry2.modelId === node.nodeId);
|
|
25008
|
-
if (direct?.fill) shape.fill = direct.fill;
|
|
25009
|
-
if (direct?.line) shape.line = { ...shape.line, ...direct.line };
|
|
25010
25546
|
const sourceIds = [node.nodeId, ...node.foldedNodeIds ?? []];
|
|
25011
25547
|
const textNodes = sourceIds.flatMap((id) => {
|
|
25012
25548
|
const source2 = input.nodes.find((entry2) => entry2.id === id);
|
|
25013
25549
|
return source2 ? [source2] : [];
|
|
25014
25550
|
});
|
|
25015
25551
|
if (textNodes.length) shape.text = diagramPreviewText(textNodes, node.fontSize);
|
|
25552
|
+
if (shape.text) {
|
|
25553
|
+
if (node.textVerticalAnchor) shape.text.anchor = node.textVerticalAnchor;
|
|
25554
|
+
for (const paragraph2 of shape.text.paragraphs)
|
|
25555
|
+
if (!paragraph2.align && node.textAlign) paragraph2.align = node.textAlign;
|
|
25556
|
+
}
|
|
25557
|
+
applyDiagramRoleColors(
|
|
25558
|
+
shape,
|
|
25559
|
+
colors?.labels.find((label2) => label2.name === node.styleLabel),
|
|
25560
|
+
Math.max(
|
|
25561
|
+
0,
|
|
25562
|
+
input.nodes.findIndex((entry2) => entry2.id === contextNodeId)
|
|
25563
|
+
),
|
|
25564
|
+
input.minorFont
|
|
25565
|
+
);
|
|
25566
|
+
if (direct?.fill && direct.fill.kind !== "picture") shape.fill = direct.fill;
|
|
25567
|
+
if (direct?.line) shape.line = { ...shape.line, ...direct.line };
|
|
25016
25568
|
});
|
|
25569
|
+
applyDiagramPictureSources(
|
|
25570
|
+
drawing2,
|
|
25571
|
+
result.nodes,
|
|
25572
|
+
input.source,
|
|
25573
|
+
issues,
|
|
25574
|
+
new Set(input.nodes.map((node) => node.id))
|
|
25575
|
+
);
|
|
25017
25576
|
return { drawing: drawing2, mode: "interpreted", issues };
|
|
25018
25577
|
}
|
|
25019
25578
|
} catch (error) {
|
|
@@ -25054,9 +25613,9 @@ function resolveDiagramDrawingStyles(drawing, scheme2) {
|
|
|
25054
25613
|
|
|
25055
25614
|
// diagram/write/cache.ts
|
|
25056
25615
|
var DSP2 = "http://schemas.microsoft.com/office/drawing/2008/diagram";
|
|
25057
|
-
function add2(parent, namespace, name,
|
|
25616
|
+
function add2(parent, namespace, name, attrs3 = {}) {
|
|
25058
25617
|
const child7 = parent.ownerDocument.createElementNS(namespace, name);
|
|
25059
|
-
for (const [key, value] of Object.entries(
|
|
25618
|
+
for (const [key, value] of Object.entries(attrs3)) child7.setAttribute(key, value);
|
|
25060
25619
|
parent.appendChild(child7);
|
|
25061
25620
|
return child7;
|
|
25062
25621
|
}
|
|
@@ -25074,6 +25633,7 @@ function withDiagramDrawingRelationship(xml, relationshipId) {
|
|
|
25074
25633
|
return buildXml(doc);
|
|
25075
25634
|
}
|
|
25076
25635
|
function buildGeneratedDiagramCache(dataXml2, input) {
|
|
25636
|
+
dataXml2 = withDiagramPictureSources(dataXml2, input.source);
|
|
25077
25637
|
const source2 = { ...input.source, dataXml: dataXml2 };
|
|
25078
25638
|
const model = parseDiagramDataModel(dataXml2);
|
|
25079
25639
|
const scheme2 = { ...DEFAULT_GENERATED_DIAGRAM_SCHEME, ...input.scheme };
|
|
@@ -25100,7 +25660,10 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
25100
25660
|
}
|
|
25101
25661
|
for (const shape of drawing.shapes) {
|
|
25102
25662
|
if (shape.has3d || shape.foldedNodeIds?.length) return void 0;
|
|
25103
|
-
if (shape.fill && !["none", "solid", "gradient"].includes(shape.fill.kind))
|
|
25663
|
+
if (shape.fill && !["none", "solid", "gradient", "picture"].includes(shape.fill.kind))
|
|
25664
|
+
return void 0;
|
|
25665
|
+
if (shape.fill?.kind === "picture" && (!shape.fill.relId || !drawing.pictureParts?.[shape.fill.relId]))
|
|
25666
|
+
return void 0;
|
|
25104
25667
|
if (shape.fill?.kind === "gradient" && shape.fill.path && !["circle", "rect"].includes(shape.fill.path))
|
|
25105
25668
|
return void 0;
|
|
25106
25669
|
if (shape.effects?.effects.some(
|
|
@@ -25207,12 +25770,15 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
25207
25770
|
const point = add2(points, NS.dgm, "dgm:pt", { modelId: id, type: "pres" });
|
|
25208
25771
|
add2(point, NS.dgm, "dgm:prSet", {
|
|
25209
25772
|
...shape.sourceNodeId ? { presAssocID: shape.sourceNodeId } : {},
|
|
25210
|
-
presName: "node",
|
|
25773
|
+
presName: shape.sourceLayoutRole ?? "node",
|
|
25211
25774
|
presStyleLbl: shape.sourceStyleLabel ?? "node1",
|
|
25212
25775
|
presStyleIdx: String(index),
|
|
25213
25776
|
presStyleCnt: String(drawing.shapes.length)
|
|
25214
25777
|
});
|
|
25215
|
-
add2(point, NS.dgm, "dgm:spPr");
|
|
25778
|
+
const properties = add2(point, NS.dgm, "dgm:spPr");
|
|
25779
|
+
if (shape.fill?.kind === "picture" && shape.fill.sourceXml) {
|
|
25780
|
+
properties.appendChild(doc.importNode(parseXml(shape.fill.sourceXml).documentElement, true));
|
|
25781
|
+
}
|
|
25216
25782
|
if (shape.sourceNodeId)
|
|
25217
25783
|
add2(connections, NS.dgm, "dgm:cxn", {
|
|
25218
25784
|
modelId: createOfficeGuid(),
|
|
@@ -25225,7 +25791,11 @@ function buildGeneratedDiagramCache(dataXml2, input) {
|
|
|
25225
25791
|
});
|
|
25226
25792
|
add2(marker, GENERATED_DIAGRAM_CACHE_NS, "oc:shape", { id });
|
|
25227
25793
|
});
|
|
25228
|
-
return {
|
|
25794
|
+
return {
|
|
25795
|
+
dataXml: buildXml(doc),
|
|
25796
|
+
drawingXml: serialized.xml,
|
|
25797
|
+
...drawing.pictureParts ? { pictureParts: drawing.pictureParts } : {}
|
|
25798
|
+
};
|
|
25229
25799
|
}
|
|
25230
25800
|
|
|
25231
25801
|
// diagram/relationships.ts
|
|
@@ -25490,6 +26060,29 @@ async function loadDiagram(hostPart, relationshipIds, host) {
|
|
|
25490
26060
|
code: "DIAGRAM_DRAWING_ABSENT",
|
|
25491
26061
|
message: "The package has no cached drawing for this diagram; its layout can only be recomputed from the layout definition."
|
|
25492
26062
|
});
|
|
26063
|
+
if (data && layoutSource.dataXml) {
|
|
26064
|
+
let pictureParts = {};
|
|
26065
|
+
if (paths.data) {
|
|
26066
|
+
const owner = paths.data;
|
|
26067
|
+
try {
|
|
26068
|
+
const entries = await host.readRelationshipEntries(diagramRelationshipsPart(owner));
|
|
26069
|
+
pictureParts = Object.fromEntries(
|
|
26070
|
+
(entries ?? []).filter(
|
|
26071
|
+
(entry2) => entry2.type.endsWith("/image") && entry2.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry2.target)
|
|
26072
|
+
).map((entry2) => [entry2.id, host.resolvePath(owner, entry2.target)])
|
|
26073
|
+
);
|
|
26074
|
+
} catch {
|
|
26075
|
+
issues.push({
|
|
26076
|
+
code: "DIAGRAM_PICTURE_RELATIONSHIPS_UNREADABLE",
|
|
26077
|
+
message: "Picture relationships in the diagram data could not be read."
|
|
26078
|
+
});
|
|
26079
|
+
}
|
|
26080
|
+
}
|
|
26081
|
+
Object.assign(
|
|
26082
|
+
layoutSource,
|
|
26083
|
+
captureDiagramPictures(data, layoutSource.dataXml, pictureParts, drawing)
|
|
26084
|
+
);
|
|
26085
|
+
}
|
|
25493
26086
|
return {
|
|
25494
26087
|
layoutSource,
|
|
25495
26088
|
...generatedCache ? { generatedCache: true } : {},
|
|
@@ -27861,8 +28454,8 @@ function attributes(entries) {
|
|
|
27861
28454
|
return ` ${name}="${text}"`;
|
|
27862
28455
|
}).join("");
|
|
27863
28456
|
}
|
|
27864
|
-
var cxElement = (local, content = "",
|
|
27865
|
-
var cxText = (local, text,
|
|
28457
|
+
var cxElement = (local, content = "", attrs3 = "") => content ? `<cx:${local}${attrs3}>${content}</cx:${local}>` : `<cx:${local}${attrs3}/>`;
|
|
28458
|
+
var cxText = (local, text, attrs3 = "") => text === void 0 ? "" : `<cx:${local}${attrs3}>${escapeText2(text)}</cx:${local}>`;
|
|
27866
28459
|
var cxVal = (local, value) => value === void 0 ? "" : `<cx:${local}${attributes([["val", value]])}/>`;
|
|
27867
28460
|
var formulaXml = (local, formula2) => formula2 ? cxText(local, formula2.formula, attributes([["dir", formula2.direction]])) : "";
|
|
27868
28461
|
var shapeXml = (context, shape) => shape ? cxElement("spPr", shapePropertiesInnerXml(context, shape)) : "";
|
|
@@ -28913,6 +29506,54 @@ async function appendChartExWorkbookData(bytes, before, after) {
|
|
|
28913
29506
|
return { bytes: result.bytes, space: layout2.space };
|
|
28914
29507
|
}
|
|
28915
29508
|
|
|
29509
|
+
// chart/render/chart-title-text.ts
|
|
29510
|
+
function chartRunStyle(run2) {
|
|
29511
|
+
return {
|
|
29512
|
+
...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
|
|
29513
|
+
...run2.bold === void 0 ? {} : { bold: run2.bold },
|
|
29514
|
+
...run2.italic === void 0 ? {} : { italic: run2.italic },
|
|
29515
|
+
...run2.underline === void 0 ? {} : { underline: run2.underline },
|
|
29516
|
+
...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
|
|
29517
|
+
...run2.color === void 0 ? {} : { textColor: run2.color }
|
|
29518
|
+
};
|
|
29519
|
+
}
|
|
29520
|
+
|
|
29521
|
+
// chart/render/summary-ex-formatting.ts
|
|
29522
|
+
function textStyle(body) {
|
|
29523
|
+
const paragraph2 = body?.paragraphs[0];
|
|
29524
|
+
return {
|
|
29525
|
+
...chartRunStyle(paragraph2?.defaultProperties ?? {}),
|
|
29526
|
+
...chartRunStyle(paragraph2?.runs[0] ?? {})
|
|
29527
|
+
};
|
|
29528
|
+
}
|
|
29529
|
+
function chartExFormatting(space) {
|
|
29530
|
+
return {
|
|
29531
|
+
builtInStyle: 2,
|
|
29532
|
+
sourceXml: "",
|
|
29533
|
+
entries: {
|
|
29534
|
+
title: {
|
|
29535
|
+
fontSize: 18,
|
|
29536
|
+
bold: false,
|
|
29537
|
+
textColor: {
|
|
29538
|
+
kind: "scheme",
|
|
29539
|
+
value: "tx1",
|
|
29540
|
+
transforms: []
|
|
29541
|
+
},
|
|
29542
|
+
...textStyle(space.title?.txPr),
|
|
29543
|
+
...textStyle(space.title?.tx?.rich),
|
|
29544
|
+
...space.title?.tx?.rich ? { textBody: space.title.tx.rich } : {},
|
|
29545
|
+
sourceXml: ""
|
|
29546
|
+
},
|
|
29547
|
+
legend: { fontSize: 12, ...textStyle(space.legend?.txPr), sourceXml: "" },
|
|
29548
|
+
categoryAxis: {
|
|
29549
|
+
fontSize: 10,
|
|
29550
|
+
...textStyle(space.plotArea.axes.find((a2) => a2.scaling?.kind === "cat")?.txPr),
|
|
29551
|
+
sourceXml: ""
|
|
29552
|
+
}
|
|
29553
|
+
}
|
|
29554
|
+
};
|
|
29555
|
+
}
|
|
29556
|
+
|
|
28916
29557
|
// chart/render/summary-ex-series.ts
|
|
28917
29558
|
var level2 = (source2) => ({
|
|
28918
29559
|
...source2.visibility?.value === void 0 ? {} : { showValue: source2.visibility.value },
|
|
@@ -28925,6 +29566,7 @@ var level2 = (source2) => ({
|
|
|
28925
29566
|
function chartExSeriesPaint(source2, series, defaultValues = false) {
|
|
28926
29567
|
const fill = source2.spPr?.fill;
|
|
28927
29568
|
if (fill) series.fill = fill;
|
|
29569
|
+
if (source2.spPr?.line) series.line = source2.spPr.line;
|
|
28928
29570
|
const points = {};
|
|
28929
29571
|
const fills = {};
|
|
28930
29572
|
for (const point of source2.dataPoints) {
|
|
@@ -29008,34 +29650,13 @@ function chartExSummary(source2) {
|
|
|
29008
29650
|
if (!isChartExRoot(root)) return void 0;
|
|
29009
29651
|
return chartExSummaryFromModel(parseChartExSpace(root).chartExSpace);
|
|
29010
29652
|
}
|
|
29011
|
-
function chartExFormatting() {
|
|
29012
|
-
return {
|
|
29013
|
-
builtInStyle: 2,
|
|
29014
|
-
sourceXml: "",
|
|
29015
|
-
entries: {
|
|
29016
|
-
title: {
|
|
29017
|
-
fontSize: 14,
|
|
29018
|
-
bold: false,
|
|
29019
|
-
textColor: {
|
|
29020
|
-
kind: "scheme",
|
|
29021
|
-
value: "tx1",
|
|
29022
|
-
transforms: [
|
|
29023
|
-
{ name: "lumMod", value: "65000" },
|
|
29024
|
-
{ name: "lumOff", value: "35000" }
|
|
29025
|
-
]
|
|
29026
|
-
},
|
|
29027
|
-
sourceXml: ""
|
|
29028
|
-
}
|
|
29029
|
-
}
|
|
29030
|
-
};
|
|
29031
|
-
}
|
|
29032
29653
|
function summarySeries(space, source2, chartType) {
|
|
29033
29654
|
const data = seriesData(space, source2);
|
|
29034
29655
|
const categories = dimension(data, "strDim", "cat");
|
|
29035
29656
|
const values = dimension(
|
|
29036
29657
|
data,
|
|
29037
29658
|
"numDim",
|
|
29038
|
-
chartType === "treemap" || chartType === "sunburst" ? "size" : "val"
|
|
29659
|
+
chartType === "treemap" || chartType === "sunburst" ? "size" : chartType === "regionMap" ? "colorVal" : "val"
|
|
29039
29660
|
);
|
|
29040
29661
|
const series = {
|
|
29041
29662
|
categories: categories?.points ?? [],
|
|
@@ -29044,11 +29665,24 @@ function summarySeries(space, source2, chartType) {
|
|
|
29044
29665
|
),
|
|
29045
29666
|
...seriesFill(source2)
|
|
29046
29667
|
};
|
|
29047
|
-
if (chartType === "funnel" || chartType === "boxWhisker") {
|
|
29668
|
+
if (chartType === "funnel" || chartType === "boxWhisker" || chartType === "regionMap") {
|
|
29048
29669
|
chartExSeriesPaint(source2, series, chartType === "funnel" && source2.dataLabels !== void 0);
|
|
29049
29670
|
if (source2.hidden !== void 0) series.hidden = source2.hidden;
|
|
29050
29671
|
}
|
|
29051
29672
|
if (chartType === "boxWhisker") series.boxWhisker = source2.layoutProperties ?? {};
|
|
29673
|
+
if (chartType === "regionMap") {
|
|
29674
|
+
const geo = source2.layoutProperties?.geography;
|
|
29675
|
+
series.regionMap = {
|
|
29676
|
+
...geo,
|
|
29677
|
+
...geo?.geoCacheXml ? { geographyCacheXml: geo.geoCacheXml } : {},
|
|
29678
|
+
...dimension(data, "strDim", "entityId") ? { entityIds: dimension(data, "strDim", "entityId").points } : {},
|
|
29679
|
+
...source2.layoutProperties?.regionLabelLayout ? {
|
|
29680
|
+
regionLabelLayout: source2.layoutProperties.regionLabelLayout
|
|
29681
|
+
} : {},
|
|
29682
|
+
...source2.valueColorsXml ? { valueColorsXml: source2.valueColorsXml } : {},
|
|
29683
|
+
...source2.valueColorPositionsXml ? { valueColorPositionsXml: source2.valueColorPositionsXml } : {}
|
|
29684
|
+
};
|
|
29685
|
+
}
|
|
29052
29686
|
const name = source2.tx?.value?.trim();
|
|
29053
29687
|
if (name) series.name = name;
|
|
29054
29688
|
const nameRef = source2.tx?.formula?.formula.trim();
|
|
@@ -29061,7 +29695,7 @@ function chartExSummaryFromModel(space) {
|
|
|
29061
29695
|
const all = space.plotArea.series;
|
|
29062
29696
|
const primary = all.find((s) => s.layoutId !== "paretoLine") ?? all[0];
|
|
29063
29697
|
const layoutId = primary?.layoutId ?? "";
|
|
29064
|
-
const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" ? layoutId : void 0;
|
|
29698
|
+
const chartType = layoutId === "waterfall" ? "waterfall" : layoutId === "clusteredColumn" ? "histogram" : layoutId === "treemap" || layoutId === "sunburst" || layoutId === "funnel" || layoutId === "boxWhisker" || layoutId === "regionMap" ? layoutId : void 0;
|
|
29065
29699
|
if (!primary || !chartType) return { layoutId };
|
|
29066
29700
|
const series = summarySeries(space, primary, chartType);
|
|
29067
29701
|
const layout2 = primary.layoutProperties;
|
|
@@ -29099,7 +29733,12 @@ function chartExSummaryFromModel(space) {
|
|
|
29099
29733
|
];
|
|
29100
29734
|
});
|
|
29101
29735
|
}
|
|
29102
|
-
|
|
29736
|
+
if (chartType === "funnel") {
|
|
29737
|
+
const cat = space.plotArea.axes.find((axis) => axis.scaling?.kind === "cat")?.scaling;
|
|
29738
|
+
if (cat?.kind === "cat" && typeof cat.gapWidth === "number")
|
|
29739
|
+
summary.funnelGapWidth = cat.gapWidth;
|
|
29740
|
+
}
|
|
29741
|
+
summary.formatting = chartExFormatting(space);
|
|
29103
29742
|
const title = titleOf(space);
|
|
29104
29743
|
if (title) summary.title = title;
|
|
29105
29744
|
const position2 = legend?.position;
|
|
@@ -29296,11 +29935,11 @@ function warningsFor(document) {
|
|
|
29296
29935
|
],
|
|
29297
29936
|
[
|
|
29298
29937
|
["rPrChange"],
|
|
29299
|
-
"Formatting-change revisions retain their prior run-properties snapshots and support acceptance and
|
|
29938
|
+
"Formatting-change revisions retain their prior run-properties snapshots and support acceptance, rejection and Original display; supported run-formatting changes are recorded as new revisions, other formatting edits are not."
|
|
29300
29939
|
],
|
|
29301
29940
|
[
|
|
29302
29941
|
["pPrChange"],
|
|
29303
|
-
"Paragraph-formatting-change revisions retain their prior properties snapshots and support acceptance and
|
|
29942
|
+
"Paragraph-formatting-change revisions retain their prior properties snapshots and support acceptance, rejection and Original display; pure paragraph-formatting changes are recorded as new revisions, and revised paragraph-mark merging is not shown yet."
|
|
29304
29943
|
],
|
|
29305
29944
|
[
|
|
29306
29945
|
["ffData"],
|
|
@@ -29595,6 +30234,7 @@ function parseModernDrawing(node, context) {
|
|
|
29595
30234
|
if (picture)
|
|
29596
30235
|
return {
|
|
29597
30236
|
...picture,
|
|
30237
|
+
...blip?.parentNode ? { pictureFill: parseDrawingPictureFill(blip.parentNode) } : {},
|
|
29598
30238
|
widthPx,
|
|
29599
30239
|
heightPx,
|
|
29600
30240
|
...definedProps({ altText, title, anchored }),
|
|
@@ -29698,7 +30338,7 @@ var add3 = (parent, ...items) => {
|
|
|
29698
30338
|
};
|
|
29699
30339
|
var emu3 = (px2) => String(Math.max(1, Math.round(px2 * EMU_PER_PIXEL)));
|
|
29700
30340
|
var emuOffset = (px2) => String(Math.round(px2 * EMU_PER_PIXEL));
|
|
29701
|
-
var
|
|
30341
|
+
var attrs2 = (element4, values) => {
|
|
29702
30342
|
for (const [name, value] of Object.entries(values)) element4.setAttribute(name, value);
|
|
29703
30343
|
return element4;
|
|
29704
30344
|
};
|
|
@@ -29751,9 +30391,9 @@ function textParagraphs(doc, lines2, color) {
|
|
|
29751
30391
|
}
|
|
29752
30392
|
function shapeStyle(doc) {
|
|
29753
30393
|
const ref = (name, idx, scheme2, shade) => {
|
|
29754
|
-
const node =
|
|
29755
|
-
const color =
|
|
29756
|
-
if (shade) add3(color,
|
|
30394
|
+
const node = attrs2(el2(doc, A_NS2, `a:${name}`), { idx });
|
|
30395
|
+
const color = attrs2(el2(doc, A_NS2, "a:schemeClr"), { val: scheme2 });
|
|
30396
|
+
if (shade) add3(color, attrs2(el2(doc, A_NS2, "a:shade"), { val: shade }));
|
|
29757
30397
|
return add3(node, color);
|
|
29758
30398
|
};
|
|
29759
30399
|
return add3(
|
|
@@ -29767,17 +30407,17 @@ function shapeStyle(doc) {
|
|
|
29767
30407
|
function wrapElement(doc, placement) {
|
|
29768
30408
|
switch (placement.wrap) {
|
|
29769
30409
|
case "square":
|
|
29770
|
-
return
|
|
30410
|
+
return attrs2(el2(doc, WP_NS3, "wp:wrapSquare"), { wrapText: "bothSides" });
|
|
29771
30411
|
case "tight":
|
|
29772
30412
|
case "through": {
|
|
29773
|
-
const wrap2 =
|
|
30413
|
+
const wrap2 = attrs2(
|
|
29774
30414
|
el2(doc, WP_NS3, `wp:wrap${placement.wrap === "tight" ? "Tight" : "Through"}`),
|
|
29775
30415
|
{
|
|
29776
30416
|
wrapText: "bothSides"
|
|
29777
30417
|
}
|
|
29778
30418
|
);
|
|
29779
|
-
const polygon =
|
|
29780
|
-
const point = (name, x, y) =>
|
|
30419
|
+
const polygon = attrs2(el2(doc, WP_NS3, "wp:wrapPolygon"), { edited: "0" });
|
|
30420
|
+
const point = (name, x, y) => attrs2(el2(doc, WP_NS3, `wp:${name}`), { x, y });
|
|
29781
30421
|
return add3(
|
|
29782
30422
|
wrap2,
|
|
29783
30423
|
add3(
|
|
@@ -29797,7 +30437,7 @@ function wrapElement(doc, placement) {
|
|
|
29797
30437
|
}
|
|
29798
30438
|
}
|
|
29799
30439
|
function position(doc, axis, relativeFrom, align, offsetPx) {
|
|
29800
|
-
const node =
|
|
30440
|
+
const node = attrs2(el2(doc, WP_NS3, `wp:position${axis}`), { relativeFrom });
|
|
29801
30441
|
if (align) {
|
|
29802
30442
|
const a2 = el2(doc, WP_NS3, "wp:align");
|
|
29803
30443
|
a2.textContent = align;
|
|
@@ -29808,10 +30448,10 @@ function position(doc, axis, relativeFrom, align, offsetPx) {
|
|
|
29808
30448
|
return add3(node, offset);
|
|
29809
30449
|
}
|
|
29810
30450
|
function geometry(doc, spec) {
|
|
29811
|
-
const prst =
|
|
30451
|
+
const prst = attrs2(el2(doc, A_NS2, "a:prstGeom"), { prst: spec.preset });
|
|
29812
30452
|
const avLst = el2(doc, A_NS2, "a:avLst");
|
|
29813
30453
|
for (const [name, value] of Object.entries(spec.adjustments ?? {}))
|
|
29814
|
-
add3(avLst,
|
|
30454
|
+
add3(avLst, attrs2(el2(doc, A_NS2, "a:gd"), { name, fmla: `val ${Math.round(value)}` }));
|
|
29815
30455
|
const nodes = spec.customGeometryXml ? importFragment(doc, spec.customGeometryXml) : [add3(prst, avLst)];
|
|
29816
30456
|
if (spec.fill) {
|
|
29817
30457
|
const xml = drawingFillXml(spec.fill);
|
|
@@ -29827,7 +30467,7 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29827
30467
|
const anchored = Boolean(image.anchored);
|
|
29828
30468
|
const holder = el2(doc, WP_NS3, anchored ? "wp:anchor" : "wp:inline");
|
|
29829
30469
|
if (anchored) {
|
|
29830
|
-
|
|
30470
|
+
attrs2(holder, {
|
|
29831
30471
|
distT: "0",
|
|
29832
30472
|
distB: "0",
|
|
29833
30473
|
distL: "114300",
|
|
@@ -29841,7 +30481,7 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29841
30481
|
});
|
|
29842
30482
|
add3(
|
|
29843
30483
|
holder,
|
|
29844
|
-
|
|
30484
|
+
attrs2(el2(doc, WP_NS3, "wp:simplePos"), { x: "0", y: "0" }),
|
|
29845
30485
|
position(
|
|
29846
30486
|
doc,
|
|
29847
30487
|
"H",
|
|
@@ -29860,24 +30500,24 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29860
30500
|
} else for (const side of ["distT", "distB", "distL", "distR"]) holder.setAttribute(side, "0");
|
|
29861
30501
|
add3(
|
|
29862
30502
|
holder,
|
|
29863
|
-
|
|
29864
|
-
|
|
30503
|
+
attrs2(el2(doc, WP_NS3, "wp:extent"), { cx: emu3(image.widthPx), cy: emu3(image.heightPx) }),
|
|
30504
|
+
attrs2(el2(doc, WP_NS3, "wp:effectExtent"), { l: "0", t: "0", r: "0", b: "0" })
|
|
29865
30505
|
);
|
|
29866
30506
|
if (anchored) add3(holder, wrapElement(doc, placement ?? { wrap: "none" }));
|
|
29867
|
-
const docPr =
|
|
30507
|
+
const docPr = attrs2(el2(doc, WP_NS3, "wp:docPr"), {
|
|
29868
30508
|
id: identity.id,
|
|
29869
30509
|
name: identity.name ?? `Shape ${identity.id}`
|
|
29870
30510
|
});
|
|
29871
30511
|
if (identity.descr) docPr.setAttribute("descr", identity.descr);
|
|
29872
30512
|
if (identity.title) docPr.setAttribute("title", identity.title);
|
|
29873
|
-
const xfrm =
|
|
30513
|
+
const xfrm = attrs2(el2(doc, A_NS2, "a:xfrm"), {});
|
|
29874
30514
|
if (spec.rotation) xfrm.setAttribute("rot", String(Math.round(spec.rotation * 6e4)));
|
|
29875
30515
|
if (spec.flipH) xfrm.setAttribute("flipH", "1");
|
|
29876
30516
|
if (spec.flipV) xfrm.setAttribute("flipV", "1");
|
|
29877
30517
|
add3(
|
|
29878
30518
|
xfrm,
|
|
29879
|
-
|
|
29880
|
-
|
|
30519
|
+
attrs2(el2(doc, A_NS2, "a:off"), { x: "0", y: "0" }),
|
|
30520
|
+
attrs2(el2(doc, A_NS2, "a:ext"), { cx: emu3(image.widthPx), cy: emu3(image.heightPx) })
|
|
29881
30521
|
);
|
|
29882
30522
|
const spPr = add3(el2(doc, WPS_NS2, "wps:spPr"), xfrm, ...geometry(doc, spec));
|
|
29883
30523
|
const wsp = add3(
|
|
@@ -29893,7 +30533,7 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29893
30533
|
);
|
|
29894
30534
|
add3(wsp, add3(el2(doc, WPS_NS2, "wps:txbx"), content));
|
|
29895
30535
|
}
|
|
29896
|
-
const body =
|
|
30536
|
+
const body = attrs2(el2(doc, WPS_NS2, "wps:bodyPr"), {
|
|
29897
30537
|
rot: "0",
|
|
29898
30538
|
vert: "horz",
|
|
29899
30539
|
wrap: "square",
|
|
@@ -29905,7 +30545,7 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29905
30545
|
anchorCtr: "0"
|
|
29906
30546
|
});
|
|
29907
30547
|
add3(wsp, add3(body, el2(doc, A_NS2, "a:noAutofit")));
|
|
29908
|
-
const graphicData =
|
|
30548
|
+
const graphicData = attrs2(el2(doc, A_NS2, "a:graphicData"), { uri: WPS_NS2 });
|
|
29909
30549
|
add3(
|
|
29910
30550
|
holder,
|
|
29911
30551
|
docPr,
|
|
@@ -30021,9 +30661,9 @@ function clearNonProperties(node, keep) {
|
|
|
30021
30661
|
var A_NS5 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
30022
30662
|
var WP_NS5 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
30023
30663
|
var C_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
30024
|
-
function child6(parent, ns, name,
|
|
30664
|
+
function child6(parent, ns, name, attrs3 = {}) {
|
|
30025
30665
|
const node = makeNS(parent.ownerDocument, ns, name);
|
|
30026
|
-
for (const [key, value] of Object.entries(
|
|
30666
|
+
for (const [key, value] of Object.entries(attrs3)) node.setAttribute(key, value);
|
|
30027
30667
|
parent.appendChild(node);
|
|
30028
30668
|
return node;
|
|
30029
30669
|
}
|
|
@@ -30507,6 +31147,19 @@ async function applyDiagramEdits(zip, blocks, baseBlocks, pendingMedia) {
|
|
|
30507
31147
|
...relaid && layoutId ? { layout: { uniqueId: layoutId, category: diagram.layout?.family } } : {}
|
|
30508
31148
|
})
|
|
30509
31149
|
);
|
|
31150
|
+
if (diagram.layoutSource?.pictures?.length) {
|
|
31151
|
+
zip.file(
|
|
31152
|
+
partName,
|
|
31153
|
+
withDiagramPictureSources(await zip.file(partName).async("string"), diagram.layoutSource)
|
|
31154
|
+
);
|
|
31155
|
+
const relsName = relationshipsPartFor2(partName);
|
|
31156
|
+
const rels = diagramPictureRelationships(
|
|
31157
|
+
partName,
|
|
31158
|
+
diagram.layoutSource,
|
|
31159
|
+
await zip.file(relsName)?.async("string")
|
|
31160
|
+
);
|
|
31161
|
+
if (rels) zip.file(relsName, rels);
|
|
31162
|
+
}
|
|
30510
31163
|
if (drawing) await dropDrawingPart(zip, drawing.relId, drawing.partName, drawing.ownerPart);
|
|
30511
31164
|
}
|
|
30512
31165
|
}
|
|
@@ -30519,9 +31172,9 @@ var EMU_PER_PIXEL2 = 9525;
|
|
|
30519
31172
|
function isSameDiagram(base, next) {
|
|
30520
31173
|
return Boolean(base?.parts.data?.partName) && base?.parts.data?.partName === next.parts.data?.partName && !next.inserted;
|
|
30521
31174
|
}
|
|
30522
|
-
function el3(doc, ns, qualified,
|
|
31175
|
+
function el3(doc, ns, qualified, attrs3 = {}) {
|
|
30523
31176
|
const node = makeNS(doc, ns, qualified);
|
|
30524
|
-
for (const [name, value] of Object.entries(
|
|
31177
|
+
for (const [name, value] of Object.entries(attrs3)) node.setAttribute(name, value);
|
|
30525
31178
|
return node;
|
|
30526
31179
|
}
|
|
30527
31180
|
function buildInsertedDiagramDrawing(doc, diagram, widthPx, heightPx, allocator) {
|
|
@@ -30671,6 +31324,9 @@ function buildInlineDrawing(doc, image, relId, docPrId, svgRelId) {
|
|
|
30671
31324
|
stretch.appendChild(el4(doc, A_NS7, "a:fillRect"));
|
|
30672
31325
|
const blipFill = el4(doc, PIC_NS, "pic:blipFill");
|
|
30673
31326
|
appendAll(blipFill, blip, stretch);
|
|
31327
|
+
if (image.pictureFill?.crop) applyPictureCrop(blipFill, image.pictureFill.crop);
|
|
31328
|
+
if (image.pictureFill?.effects) applyPictureEffects(blip, image.pictureFill.effects);
|
|
31329
|
+
if (image.pictureFill?.layout) applyPictureLayout(blipFill, image.pictureFill.layout);
|
|
30674
31330
|
const xfrm = el4(doc, A_NS7, "a:xfrm");
|
|
30675
31331
|
const off = el4(doc, A_NS7, "a:off");
|
|
30676
31332
|
off.setAttribute("x", "0");
|
|
@@ -30757,6 +31413,16 @@ function createImageRun(doc, image, base, old, allocator) {
|
|
|
30757
31413
|
return node;
|
|
30758
31414
|
}
|
|
30759
31415
|
if (base && oldDrawing && sameUnderlyingImage(base, image)) {
|
|
31416
|
+
if (image.pictureFill && JSON.stringify(image.pictureFill) !== JSON.stringify(base.pictureFill)) {
|
|
31417
|
+
const fill = oldDrawing.getElementsByTagNameNS(PIC_NS, "blipFill")[0];
|
|
31418
|
+
const blip = fill?.getElementsByTagNameNS(A_NS7, "blip")[0];
|
|
31419
|
+
if (fill && image.pictureFill.crop !== void 0)
|
|
31420
|
+
applyPictureCrop(fill, image.pictureFill.crop);
|
|
31421
|
+
if (blip && image.pictureFill.effects !== void 0)
|
|
31422
|
+
applyPictureEffects(blip, image.pictureFill.effects);
|
|
31423
|
+
if (fill && image.pictureFill.layout !== void 0)
|
|
31424
|
+
applyPictureLayout(fill, image.pictureFill.layout);
|
|
31425
|
+
}
|
|
30760
31426
|
if (image.widthPx !== base.widthPx || image.heightPx !== base.heightPx)
|
|
30761
31427
|
updateExtent(oldDrawing, image.widthPx, image.heightPx);
|
|
30762
31428
|
if (image.altText !== base.altText || image.title !== base.title)
|
|
@@ -34425,6 +35091,7 @@ async function applyGeneratedDiagramCaches(zip, blocks, baseBlocks, theme) {
|
|
|
34425
35091
|
const colorsXml = await read("colors");
|
|
34426
35092
|
const quickStyleXml = await read("quickStyle");
|
|
34427
35093
|
const source2 = {
|
|
35094
|
+
...diagram.layoutSource,
|
|
34428
35095
|
...layoutXml3 ? { layoutXml: layoutXml3 } : {},
|
|
34429
35096
|
...colorsXml ? { colorsXml } : {},
|
|
34430
35097
|
...quickStyleXml ? { quickStyleXml } : {}
|
|
@@ -34449,6 +35116,8 @@ async function applyGeneratedDiagramCaches(zip, blocks, baseBlocks, theme) {
|
|
|
34449
35116
|
);
|
|
34450
35117
|
zip.file(name, withDiagramDrawingRelationship(cache.dataXml, relationship2));
|
|
34451
35118
|
zip.file(drawingName, cache.drawingXml);
|
|
35119
|
+
const pictureRels = diagramPictureRelationships(drawingName, diagram.layoutSource);
|
|
35120
|
+
if (pictureRels) zip.file(drawingName.replace(/([^/]+)$/, "_rels/$1.rels"), pictureRels);
|
|
34452
35121
|
await ensureContentTypeOverride(zip, drawingName, DIAGRAM_CONTENT_TYPES.drawing);
|
|
34453
35122
|
}
|
|
34454
35123
|
}
|
|
@@ -35793,7 +36462,8 @@ async function readPackage(input) {
|
|
|
35793
36462
|
for (const part of [
|
|
35794
36463
|
run2.image?.partName,
|
|
35795
36464
|
run2.image?.svgPartName,
|
|
35796
|
-
...Object.values(run2.image?.diagram?.drawing?.pictureParts ?? {})
|
|
36465
|
+
...Object.values(run2.image?.diagram?.drawing?.pictureParts ?? {}),
|
|
36466
|
+
...Object.values(run2.image?.diagram?.layoutSource?.pictureParts ?? {})
|
|
35797
36467
|
])
|
|
35798
36468
|
if (part) imagePartNames.add(part);
|
|
35799
36469
|
});
|