@sobree/core 0.1.33 → 0.1.34

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.
@@ -30,6 +30,19 @@ export interface InlineFramesContext {
30
30
  /** Theme colour palette (from `word/theme/theme1.xml`) so textbox /
31
31
  * shape fills declared as `<a:schemeClr>` resolve instead of vanishing. */
32
32
  theme?: ThemePalette;
33
+ /**
34
+ * Body content width in EMU (page width − left/right margins). Needed
35
+ * only to lay out a paragraph that holds MORE THAN ONE inline drawing
36
+ * (a tab-separated row of "Place Illustration here" boxes): the boxes
37
+ * are merged into one frame whose coordinate system IS the content
38
+ * column, so each box's x is a true fraction of the column. Absent ⇒
39
+ * single-drawing paragraphs only, no row layout.
40
+ */
41
+ contentWidthEmu?: number;
42
+ /** `<w:defaultTabStop>` in twips — the grid a `<w:tab>` advances to when
43
+ * the paragraph declares no explicit `<w:tabs>`. Drives the column
44
+ * positions of a multi-drawing row. Absent ⇒ Word's 720-twip default. */
45
+ defaultTabStopTwips?: number;
33
46
  }
34
47
  /**
35
48
  * One InlineFrame plus the source DOM nodes it came from.
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Expand DrawingML PRESET geometries that a CSS box can't draw — arrows,
3
+ * callouts, and the like — into an SVG outline. Box-expressible presets
4
+ * (rect / ellipse / roundedRect / line) stay as geometry enums via
5
+ * `readGeometry`; this module only handles presets that genuinely need a
6
+ * path, and returns `null` for everything else so that fallback stands.
7
+ *
8
+ * The outline is emitted in the frame's OWN `widthEmu × heightEmu` box so
9
+ * the renderer's `preserveAspectRatio="none"` scale is 1:1 — a normalised
10
+ * square box would shear the arrowhead when the frame isn't square.
11
+ *
12
+ * Adjustment handles (`<a:avLst><a:gd name="adjN" fmla="val …"/>`) tune
13
+ * the shaft thickness and head length; absent ⇒ ECMA-376 factory
14
+ * defaults. Reading them keeps the shape faithful to the source instead
15
+ * of guessing proportions.
16
+ */
17
+ export interface PresetPath {
18
+ widthEmu: number;
19
+ heightEmu: number;
20
+ d: string;
21
+ }
22
+ /** Expand the shape's `<a:prstGeom>` into a path, or `null` when the
23
+ * preset is box-expressible / unmodelled (caller keeps `readGeometry`). */
24
+ export declare function expandPresetGeometry(wsp: Element, dims: {
25
+ widthEmu: number;
26
+ heightEmu: number;
27
+ }): PresetPath | null;
@@ -1,8 +1,10 @@
1
1
  import { FrameBorder } from '../../doc/types';
2
2
  import { ThemePalette } from './colors';
3
3
  /** Map `<a:prstGeom prst>` to the AST's preset geometry enum; unknown
4
- * presets fall back to `rect`. (Custom geometry is handled separately by
5
- * the anchored reader via `customGeometry`.) */
4
+ * presets fall back to `rect`. Only the box-expressible presets live
5
+ * here those a CSS rectangle (± border-radius) can draw. Presets that
6
+ * need a real outline (arrows, callouts) are expanded to an SVG path by
7
+ * `presetGeometry`, and `<a:custGeom>` by `customGeometry`. */
6
8
  export declare function readGeometry(wsp: Element): "rect" | "ellipse" | "roundedRect" | "line";
7
9
  /**
8
10
  * First `<a:solidFill>` directly inside the shape's `spPr` (wps or pic) —