@office-kit/pptx-preview 0.9.9 → 0.10.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/LICENSE +21 -0
- package/dist/index.js +1 -1
- package/dist/node.js +1 -1
- package/dist/{src-DRrBZ3XZ.js → src-DC6HxO-i.js} +6 -5
- package/dist/src-DC6HxO-i.js.map +1 -0
- package/package.json +4 -4
- package/dist/src-DRrBZ3XZ.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yuichiro Yamashita
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MONO, c as TIMES, d as substituteFamily, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout } from "./src-
|
|
1
|
+
import { a as MONO, c as TIMES, d as substituteFamily, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout } from "./src-DC6HxO-i.js";
|
|
2
2
|
export { ARIAL, MONO, SANS, SERIF, TIMES, auditTextLayout, defaultMeasurer, renderSlideSvg as renderSlideToSvg, substituteFamily };
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MONO, c as TIMES, d as substituteFamily, i as AVG_GLYPH_W_RATIO, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout, u as isCjk } from "./src-
|
|
1
|
+
import { a as MONO, c as TIMES, d as substituteFamily, i as AVG_GLYPH_W_RATIO, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout, u as isCjk } from "./src-DC6HxO-i.js";
|
|
2
2
|
import { getSlideSize } from "@office-kit/pptx";
|
|
3
3
|
import { Resvg } from "@resvg/resvg-js";
|
|
4
4
|
import * as fontkit from "fontkit";
|
|
@@ -3119,6 +3119,7 @@ const pointCount = (spec) => {
|
|
|
3119
3119
|
return n;
|
|
3120
3120
|
};
|
|
3121
3121
|
const chartFillOpacityAttr = (opacity = 1) => opacity === 1 ? "" : ` fill-opacity="${opacity.toFixed(3)}"`;
|
|
3122
|
+
const chartPointBaseColor = (spec, colors, seriesIndex, pointIndex) => spec.series[seriesIndex]?.pointColors?.[pointIndex] ?? (spec.varyColors && spec.series.length === 1 ? colors[pointIndex % colors.length] : spec.series[seriesIndex]?.color ?? colors[seriesIndex % colors.length]);
|
|
3122
3123
|
const renderColumnChart = (f, spec, colors) => {
|
|
3123
3124
|
const N = pointCount(spec);
|
|
3124
3125
|
if (N === 0 || spec.series.length === 0) return "";
|
|
@@ -3154,7 +3155,7 @@ const renderColumnChart = (f, spec, colors) => {
|
|
|
3154
3155
|
const y0 = f.plotY + f.plotH - (Math.max(stackedTop, stackedBase) - min) / range * f.plotH;
|
|
3155
3156
|
const y1 = f.plotY + f.plotH - (Math.min(stackedTop, stackedBase) - min) / range * f.plotH;
|
|
3156
3157
|
const h = Math.abs(y1 - y0);
|
|
3157
|
-
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${spec
|
|
3158
|
+
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${chartPointBaseColor(spec, colors, s, c)}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
|
|
3158
3159
|
if (showLabelFor(s) && Math.abs(v) > 0) {
|
|
3159
3160
|
const labelY = (y0 + y1) / 2 + 3;
|
|
3160
3161
|
const labelText = isPercent ? `${Math.round(v * 100)}%` : formatDataLabelValue(spec, s, v);
|
|
@@ -3173,7 +3174,7 @@ const renderColumnChart = (f, spec, colors) => {
|
|
|
3173
3174
|
const top = f.plotY + f.plotH - (v - min) / range * f.plotH;
|
|
3174
3175
|
const y0 = Math.min(top, baseY);
|
|
3175
3176
|
const h = Math.abs(top - baseY);
|
|
3176
|
-
const baseColor =
|
|
3177
|
+
const baseColor = chartPointBaseColor(spec, colors, s, c);
|
|
3177
3178
|
const fillColor = v < 0 && spec.series[s]?.invertIfNegative ? mixHex(baseColor, "#000000", .55) : baseColor;
|
|
3178
3179
|
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${fillColor}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
|
|
3179
3180
|
if (showLabelFor(s)) {
|
|
@@ -3397,7 +3398,7 @@ const renderBarChart = (f, spec, colors) => {
|
|
|
3397
3398
|
const x0 = f.plotX + (Math.min(base, stackedTop) - min) / range * f.plotW;
|
|
3398
3399
|
const x1 = f.plotX + (Math.max(base, stackedTop) - min) / range * f.plotW;
|
|
3399
3400
|
const w = Math.abs(x1 - x0);
|
|
3400
|
-
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${spec
|
|
3401
|
+
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${chartPointBaseColor(spec, colors, s, c)}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
|
|
3401
3402
|
if (showLabelForBar(s) && Math.abs(v) > 0) {
|
|
3402
3403
|
const labelX = (x0 + x1) / 2;
|
|
3403
3404
|
const labelText = isPercent ? `${Math.round(v * 100)}%` : formatDataLabelValue(spec, s, v);
|
|
@@ -3416,7 +3417,7 @@ const renderBarChart = (f, spec, colors) => {
|
|
|
3416
3417
|
const tip = f.plotX + (v - min) / range * f.plotW;
|
|
3417
3418
|
const x0 = Math.min(tip, baseX);
|
|
3418
3419
|
const w = Math.abs(tip - baseX);
|
|
3419
|
-
const baseColor =
|
|
3420
|
+
const baseColor = chartPointBaseColor(spec, colors, s, c);
|
|
3420
3421
|
const fillColor = v < 0 && spec.series[s]?.invertIfNegative ? mixHex(baseColor, "#000000", .55) : baseColor;
|
|
3421
3422
|
out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${fillColor}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
|
|
3422
3423
|
if (showLabelForBar(s)) {
|
|
@@ -5003,4 +5004,4 @@ const auditTextLayout = (pres, options = {}) => {
|
|
|
5003
5004
|
//#endregion
|
|
5004
5005
|
export { MONO as a, TIMES as c, substituteFamily as d, AVG_GLYPH_W_RATIO as i, defaultMeasurer as l, renderSlideSvg as n, SANS as o, ARIAL as r, SERIF as s, auditTextLayout as t, isCjk as u };
|
|
5005
5006
|
|
|
5006
|
-
//# sourceMappingURL=src-
|
|
5007
|
+
//# sourceMappingURL=src-DC6HxO-i.js.map
|