@textcortex/slidewise 1.8.0 → 1.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/dist/index.mjs +6287 -5264
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/editor/ElementView.tsx +97 -9
- package/src/lib/pptx/__tests__/roundtrip.test.ts +83 -0
- package/src/lib/pptx/deckToPptx.ts +280 -11
- package/src/lib/pptx/pptxToDeck.ts +1668 -129
- package/src/lib/types.ts +52 -0
package/src/lib/types.ts
CHANGED
|
@@ -66,6 +66,34 @@ export interface TextElement extends BaseElement {
|
|
|
66
66
|
vAlign: "top" | "middle" | "bottom";
|
|
67
67
|
lineHeight: number;
|
|
68
68
|
letterSpacing: number;
|
|
69
|
+
/**
|
|
70
|
+
* Optional CSS background applied behind the text box. PPTX importers set
|
|
71
|
+
* this from the layout placeholder's fill when the slide overrides the
|
|
72
|
+
* placeholder (e.g. a tinted body box hosting slide-supplied text). Stays
|
|
73
|
+
* with the text element so it sits at the same z as the text — important
|
|
74
|
+
* when the slide also has a full-bleed image that would otherwise cover
|
|
75
|
+
* the fill if rendered as a separate underlay shape.
|
|
76
|
+
*/
|
|
77
|
+
background?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Optional vector glyph drawn behind the text. Set by the PPTX importer
|
|
80
|
+
* when the layout placeholder carried an `<a:custGeom>` (typically a
|
|
81
|
+
* brand logo plate) — the path fills the text box, the text spans render
|
|
82
|
+
* on top. Same renderer contract as ShapeElement.path.
|
|
83
|
+
*/
|
|
84
|
+
backingPath?: {
|
|
85
|
+
d: string;
|
|
86
|
+
viewW: number;
|
|
87
|
+
viewH: number;
|
|
88
|
+
fill: string;
|
|
89
|
+
fillRule?: "nonzero" | "evenodd";
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Optional inner padding (in canvas pixels) for the text box. The PPTX
|
|
93
|
+
* importer fills this from `<a:bodyPr lIns/tIns/rIns/bIns>` so tinted
|
|
94
|
+
* placeholder boxes don't render with text flush to their edges.
|
|
95
|
+
*/
|
|
96
|
+
padding?: { l: number; t: number; r: number; b: number };
|
|
69
97
|
/**
|
|
70
98
|
* Optional rich-text breakdown. When present, the renderer and PPTX writer
|
|
71
99
|
* use these per-run styles; the flat fields above act as defaults for any
|
|
@@ -90,6 +118,24 @@ export interface ShapeElement extends BaseElement {
|
|
|
90
118
|
stroke?: string;
|
|
91
119
|
strokeWidth?: number;
|
|
92
120
|
radius?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Optional vector path, set when the shape was imported from a PPTX
|
|
123
|
+
* `<a:custGeom>` (logos, brand marks, hand-drawn shapes). The renderer
|
|
124
|
+
* draws this as an SVG `<path>` filling the shape's bounding box; the
|
|
125
|
+
* `shape` field remains as a sensible fallback for older renderers.
|
|
126
|
+
*/
|
|
127
|
+
path?: ShapePath;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface ShapePath {
|
|
131
|
+
/** SVG path `d` attribute. */
|
|
132
|
+
d: string;
|
|
133
|
+
/** Path coordinate-system width (mapped onto the element's bounding box). */
|
|
134
|
+
viewW: number;
|
|
135
|
+
/** Path coordinate-system height. */
|
|
136
|
+
viewH: number;
|
|
137
|
+
/** SVG `fill-rule` to apply — defaults to `nonzero`. */
|
|
138
|
+
fillRule?: "nonzero" | "evenodd";
|
|
93
139
|
}
|
|
94
140
|
|
|
95
141
|
export interface ImageElement extends BaseElement {
|
|
@@ -122,6 +168,12 @@ export interface TableElement extends BaseElement {
|
|
|
122
168
|
rowFill: string;
|
|
123
169
|
textColor: string;
|
|
124
170
|
fontSize: number;
|
|
171
|
+
/**
|
|
172
|
+
* Optional cell border colour (CSS). PPTX tables typically draw thin
|
|
173
|
+
* dividers between cells; we render them as a 1px border around each
|
|
174
|
+
* cell. Defaults to a faint grey when omitted.
|
|
175
|
+
*/
|
|
176
|
+
borderColor?: string;
|
|
125
177
|
}
|
|
126
178
|
|
|
127
179
|
export interface IconElement extends BaseElement {
|