ooxml-ui 1.8.3 → 1.8.5
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/pptx/{chunk-KMNNTEGF.cjs → chunk-7EMTVQSC.cjs} +82 -153
- package/dist/pptx/{chunk-STXGHV25.cjs → chunk-HWW2UVUP.cjs} +161 -4
- package/dist/pptx/{chunk-NVYVHNPD.mjs → chunk-MKVKISFW.mjs} +1 -1
- package/dist/pptx/{chunk-NKHPE4PS.cjs → chunk-PKDISDDZ.cjs} +2 -2
- package/dist/pptx/chunk-SABFKDRM.mjs +286 -0
- package/dist/pptx/{chunk-GHFJ46NS.mjs → chunk-W7LT3EOB.mjs} +49 -116
- package/dist/pptx/dom/index.cjs +201 -201
- package/dist/pptx/dom/index.mjs +4 -4
- package/dist/pptx/index.cjs +2781 -2765
- package/dist/pptx/index.mjs +3 -3
- package/dist/pptx/render/format-painter.cjs +5 -5
- package/dist/pptx/render/format-painter.mjs +2 -2
- package/dist/pptx/render/inspector-helpers.cjs +12 -12
- package/dist/pptx/render/inspector-helpers.d.ts.map +1 -1
- package/dist/pptx/render/inspector-helpers.mjs +1 -1
- package/dist/pptx/render/ribbon-home-commands.d.ts +11 -2
- package/dist/pptx/render/ribbon-home-commands.d.ts.map +1 -1
- package/dist/pptx/render/text-advanced.d.ts.map +1 -1
- package/dist/pptx/render/text-style-scope.d.ts +41 -1
- package/dist/pptx/render/text-style-scope.d.ts.map +1 -1
- package/dist/pptx/render/text-style-update.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/pptx/chunk-VD7HRMTA.mjs +0 -137
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { textFontSizePxToPt } from './chunk-SMSCEGAE.mjs';
|
|
2
|
-
import { updateTextSegmentStyle } from './chunk-CENGE3TZ.mjs';
|
|
3
|
-
import { hasTextProperties, hasShapeProperties } from 'ooxml-core/pptx';
|
|
4
|
-
import { isBulletMarkerSegment } from 'ooxml-core/pptx/editor/render/bullet-toggle';
|
|
5
|
-
export { DEFAULT_AUTONUM_TYPE, DEFAULT_BULLET_CHAR, bulletInfoForKind, elementBulletKind, isBulletMarkerSegment, paragraphBulletKind, paragraphsBulletKind, resolveBulletSegments, setElementBullets, splitBulletParagraphs, toggleElementBullets, toggleParagraphBullet, withoutListType } from 'ooxml-core/pptx/editor/render/bullet-toggle';
|
|
6
|
-
|
|
7
|
-
// src/pptx/render/selection-format-state.ts
|
|
8
|
-
var TEXT_DECORATION_FLAGS = [
|
|
9
|
-
"bold",
|
|
10
|
-
"italic",
|
|
11
|
-
"underline",
|
|
12
|
-
"strikethrough"
|
|
13
|
-
];
|
|
14
|
-
function isContentSegment(segment) {
|
|
15
|
-
return !segment.isParagraphBreak && segment.text !== "\n" && segment.text.length > 0 && !isBulletMarkerSegment(segment);
|
|
16
|
-
}
|
|
17
|
-
function contentSegmentsInSelection(segments, selection) {
|
|
18
|
-
if (!segments) {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
return segments.filter((segment, index) => {
|
|
22
|
-
if (!isContentSegment(segment)) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
if (!selection) {
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
if (index < selection.startSegIdx || index > selection.endSegIdx) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
if (selection.startSegIdx === selection.endSegIdx && selection.startOffset === selection.endOffset) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
const start = index === selection.startSegIdx ? selection.startOffset : 0;
|
|
35
|
-
const end = index === selection.endSegIdx ? selection.endOffset : segment.text.length;
|
|
36
|
-
return end > start;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function flagState(values) {
|
|
40
|
-
if (values.every((value) => value)) {
|
|
41
|
-
return "on";
|
|
42
|
-
}
|
|
43
|
-
return values.some((value) => value) ? "mixed" : "off";
|
|
44
|
-
}
|
|
45
|
-
function getSelectionTextStyleFlags(segments, selection, elementTextStyle) {
|
|
46
|
-
const runs = contentSegmentsInSelection(segments, selection);
|
|
47
|
-
const flags = {};
|
|
48
|
-
for (const flag of TEXT_DECORATION_FLAGS) {
|
|
49
|
-
const body = elementTextStyle?.[flag] ?? false;
|
|
50
|
-
flags[flag] = runs.length === 0 ? flagState([body]) : flagState(runs.map((run) => run.style?.[flag] ?? body));
|
|
51
|
-
}
|
|
52
|
-
return flags;
|
|
53
|
-
}
|
|
54
|
-
function nextToggleValue(state) {
|
|
55
|
-
return state !== "on";
|
|
56
|
-
}
|
|
57
|
-
function textStyleFlagsOf(element, selection = null, segments) {
|
|
58
|
-
if (!element || !hasTextProperties(element)) {
|
|
59
|
-
return { bold: "off", italic: "off", underline: "off", strikethrough: "off" };
|
|
60
|
-
}
|
|
61
|
-
return getSelectionTextStyleFlags(segments ?? element.textSegments, selection, element.textStyle);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// src/pptx/render/inspector-helpers.ts
|
|
65
|
-
var DEFAULT_FILL = "#ffffff";
|
|
66
|
-
var DEFAULT_STROKE = "#000000";
|
|
67
|
-
var DEFAULT_TEXT_COLOR = "#000000";
|
|
68
|
-
var DEFAULT_FONT_SIZE = 18;
|
|
69
|
-
function fillColorOf(el) {
|
|
70
|
-
if (hasShapeProperties(el)) {
|
|
71
|
-
return el.shapeStyle?.fillColor ?? DEFAULT_FILL;
|
|
72
|
-
}
|
|
73
|
-
return DEFAULT_FILL;
|
|
74
|
-
}
|
|
75
|
-
function strokeColorOf(el) {
|
|
76
|
-
if (hasShapeProperties(el)) {
|
|
77
|
-
return el.shapeStyle?.strokeColor ?? DEFAULT_STROKE;
|
|
78
|
-
}
|
|
79
|
-
return DEFAULT_STROKE;
|
|
80
|
-
}
|
|
81
|
-
function textColorOf(el) {
|
|
82
|
-
if (hasTextProperties(el)) {
|
|
83
|
-
return el.textStyle?.color ?? DEFAULT_TEXT_COLOR;
|
|
84
|
-
}
|
|
85
|
-
return DEFAULT_TEXT_COLOR;
|
|
86
|
-
}
|
|
87
|
-
function fontSizeOf(el, presentationDefault) {
|
|
88
|
-
if (hasTextProperties(el) && el.textStyle?.fontSize !== void 0) {
|
|
89
|
-
return textFontSizePxToPt(el.textStyle.fontSize);
|
|
90
|
-
}
|
|
91
|
-
const deckDefault = presentationDefault?.levelStyles?.[0]?.fontSize;
|
|
92
|
-
return deckDefault === void 0 ? DEFAULT_FONT_SIZE : textFontSizePxToPt(deckDefault);
|
|
93
|
-
}
|
|
94
|
-
function isBold(el) {
|
|
95
|
-
return textStyleFlagsOf(el).bold === "on";
|
|
96
|
-
}
|
|
97
|
-
function isItalic(el) {
|
|
98
|
-
return textStyleFlagsOf(el).italic === "on";
|
|
99
|
-
}
|
|
100
|
-
function isUnderline(el) {
|
|
101
|
-
return textStyleFlagsOf(el).underline === "on";
|
|
102
|
-
}
|
|
103
|
-
function shapeStylePatch(el, changes) {
|
|
104
|
-
const base = hasShapeProperties(el) ? el.shapeStyle ?? {} : {};
|
|
105
|
-
return {
|
|
106
|
-
shapeStyle: {
|
|
107
|
-
...base,
|
|
108
|
-
...changes
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
function textStylePatch(el, changes) {
|
|
113
|
-
const base = hasTextProperties(el) ? el.textStyle ?? {} : {};
|
|
114
|
-
return {
|
|
115
|
-
...hasTextProperties(el) && el.textSegments?.some((segment) => segment.paragraphInsertionStyle) ? {
|
|
116
|
-
textSegments: el.textSegments.map(
|
|
117
|
-
(segment) => updateTextSegmentStyle(segment, changes, { updateBodyStyle: false })
|
|
118
|
-
)
|
|
119
|
-
} : {},
|
|
120
|
-
textStyle: {
|
|
121
|
-
...base,
|
|
122
|
-
...changes
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function textFontSizePatch(el, fontSize) {
|
|
127
|
-
const patch = textStylePatch(el, { fontSize });
|
|
128
|
-
if (!hasTextProperties(el) || !el.textSegments) {
|
|
129
|
-
return patch;
|
|
130
|
-
}
|
|
131
|
-
return {
|
|
132
|
-
...patch,
|
|
133
|
-
textSegments: el.textSegments.map((segment) => updateTextSegmentStyle(segment, { fontSize }))
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export { DEFAULT_FONT_SIZE, TEXT_DECORATION_FLAGS, contentSegmentsInSelection, fillColorOf, fontSizeOf, getSelectionTextStyleFlags, isBold, isContentSegment, isItalic, isUnderline, nextToggleValue, shapeStylePatch, strokeColorOf, textColorOf, textFontSizePatch, textStyleFlagsOf, textStylePatch };
|