@betteroffice/docx 0.0.2 → 0.0.4

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.
Files changed (65) hide show
  1. package/README.md +20 -7
  2. package/dist/chunk-4V6MDZIK.mjs +1 -0
  3. package/dist/chunk-6KDV6AIL.mjs +1 -0
  4. package/dist/chunk-CTBUQRYQ.mjs +1 -0
  5. package/dist/chunk-GGEGIQRK.mjs +1 -0
  6. package/dist/chunk-J7LNO6SM.mjs +1 -0
  7. package/dist/{chunk-IFT6DUJX.mjs → chunk-LTVVQMHB.mjs} +1 -1
  8. package/dist/chunk-NBSLB77E.mjs +1 -0
  9. package/dist/chunk-NTSSE5QK.mjs +57 -0
  10. package/dist/chunk-YTILOUAA.mjs +16 -0
  11. package/dist/collaboration/index.d.mts +31 -6
  12. package/dist/collaboration/index.mjs +1 -1
  13. package/dist/{content-DLFHRQav.d.mts → content-C3sTRz-u.d.mts} +115 -248
  14. package/dist/core.d.mts +6 -6
  15. package/dist/core.mjs +1 -1
  16. package/dist/{displayListQueries-UGc_XBUv.d.mts → displayListQueries-DLzpvJV6.d.mts} +36 -7
  17. package/dist/docx/index.d.mts +3 -3
  18. package/dist/docx/index.mjs +1 -1
  19. package/dist/editor/index.d.mts +7 -6
  20. package/dist/{fontLoader-aSewHMKF.d.mts → fontLoader-CMH3bZ2Z.d.mts} +127 -2
  21. package/dist/{formatting-D1EPSaJP.d.mts → formatting-BEkIBePP.d.mts} +77 -203
  22. package/dist/{rustDisplayList-CX78djsZ.d.mts → frameDelta-B2kC6XiP.d.mts} +5 -274
  23. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  24. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  25. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  26. package/dist/{index-Bwxm3oiC.d.mts → index-2piKi4gO.d.mts} +147 -8
  27. package/dist/layout/index.d.mts +8 -6
  28. package/dist/layout/index.mjs +1 -1
  29. package/dist/layout/pagination/index.d.mts +4 -4
  30. package/dist/layout/pagination/index.mjs +1 -1
  31. package/dist/layout/render/index.d.mts +10 -9
  32. package/dist/layout/render/index.mjs +1 -1
  33. package/dist/plugin-api/RenderedDomContext.d.mts +7 -6
  34. package/dist/plugin-api/index.d.mts +3 -3
  35. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  36. package/dist/rustDisplayList-B0M2eBkU.d.mts +283 -0
  37. package/dist/styles/index.d.mts +2 -2
  38. package/dist/{styles-Dn_o3Vo5.d.mts → styles-BK3Jecxs.d.mts} +1 -1
  39. package/dist/types/content.d.mts +2 -2
  40. package/dist/types/document.d.mts +6 -6
  41. package/dist/{types-DMkDbvEu.d.mts → types-C1rv3KM-.d.mts} +2 -2
  42. package/dist/utils/comments.d.mts +2 -2
  43. package/dist/utils/index.d.mts +4 -4
  44. package/dist/utils/index.mjs +1 -1
  45. package/dist/utils/stylePreview.d.mts +2 -2
  46. package/dist/utils/units.d.mts +4 -34
  47. package/dist/utils/units.mjs +1 -1
  48. package/dist/wasm-F2ETFAYL.mjs +1 -0
  49. package/dist/wasm-JE7B3ROD.mjs +1 -0
  50. package/dist/wasm-edit.d.mts +25 -0
  51. package/dist/wasm-edit.mjs +1 -1
  52. package/dist/wasm-layout.d.mts +14 -1
  53. package/dist/wasm-layout.mjs +1 -1
  54. package/dist/yrs/index.d.mts +5 -4
  55. package/dist/yrs/index.mjs +1 -1
  56. package/dist/yrs/residentEngineWorker.mjs +1 -1
  57. package/package.json +1 -2
  58. package/dist/chunk-3UBMCDME.mjs +0 -1
  59. package/dist/chunk-6NEKRDXF.mjs +0 -1
  60. package/dist/chunk-AEQOEQJ7.mjs +0 -57
  61. package/dist/chunk-AZ52IWB6.mjs +0 -16
  62. package/dist/chunk-CIRN3LZA.mjs +0 -1
  63. package/dist/chunk-NTQM4EYN.mjs +0 -1
  64. package/dist/wasm-BGQBTR2J.mjs +0 -1
  65. package/dist/wasm-SA237OSP.mjs +0 -1
@@ -1,4 +1,5 @@
1
- import { I as ImagePrimitive, a as DisplayList, R as RustDisplayListQueryEngine } from './rustDisplayList-CX78djsZ.mjs';
1
+ import { I as ImagePrimitive, D as DisplayList } from './frameDelta-B2kC6XiP.mjs';
2
+ import { R as RustDisplayListQueryEngine } from './rustDisplayList-B0M2eBkU.mjs';
2
3
 
3
4
  /**
4
5
  * Locate an image primitive in a built DisplayList by its document position.
@@ -59,10 +60,14 @@ declare function captureInlinePositionEmuFromDisplayList(queries: DisplayListQue
59
60
  * facade parses the display list into the Rust store exactly ONCE
60
61
  * (`openDisplayList` → handle) and routes every hit-test / range-rect query
61
62
  * through the by-handle exports — no per-query re-serialization or re-parse.
62
- * When those exports are absent (before the integrator re-embeds the wasm) it
63
- * falls back to the JSON-arg exports, stringifying the list once and reusing
64
- * the string for every query. Either way the query RESULTS are byte-identical —
65
- * the handle path is pure perf.
63
+ * The handle is acquired LAZILY: at the first query that needs it, or when the
64
+ * host calls `prime()` from idle time. Keystroke-driven facade replacement
65
+ * therefore costs no serialization on the input path; superseded generations
66
+ * chain their adoption donor so a deferred pickup still ships one page-delta
67
+ * instead of a full re-open. When the session exports are absent (before the
68
+ * integrator re-embeds the wasm) it falls back to the JSON-arg exports,
69
+ * stringifying the list once and reusing the string for every query. Either
70
+ * way the query RESULTS are byte-identical — the handle path is pure perf.
66
71
  *
67
72
  * Handle lifecycle: the handle is opened once per facade (per display-list
68
73
  * build) and released by `dispose()`. Callers that drop the facade without
@@ -83,6 +88,7 @@ declare function captureInlinePositionEmuFromDisplayList(queries: DisplayListQue
83
88
  /** Query surface implemented by the editing wasm over its resident list. */
84
89
  interface ResidentDisplayListQueryEngine {
85
90
  displayHitTestRegionsJson(pageIndex: number, x: number, y: number): string;
91
+ displayVerticalMoveJson(position: number, direction: 'up' | 'down', goalX: number): string;
86
92
  displayRangeRectsJson(from: number, to: number): string;
87
93
  displayRangeRectsRegionJson(region: 'body' | 'header' | 'footer', rId: string, from: number, to: number): string;
88
94
  }
@@ -99,6 +105,10 @@ interface DisplayListRegionHit {
99
105
  rId?: string;
100
106
  pos: number | null;
101
107
  }
108
+ interface DisplayListVerticalMove {
109
+ position: number;
110
+ goalX: number;
111
+ }
102
112
  /** one highlight rectangle of a PM range, page-local px */
103
113
  interface DisplayListRect {
104
114
  pageIndex: number;
@@ -169,6 +179,7 @@ interface DisplayListQueries {
169
179
  imageByPos(pos: number, region?: DisplayListHitRegion, rId?: string): DisplayListImageGeometry | null;
170
180
  /** region-aware point → doc position (page-local coordinates) */
171
181
  hitTestRegions(pageIndex: number, x: number, y: number): DisplayListRegionHit | null;
182
+ verticalMove(position: number, direction: 'up' | 'down', goalX?: number): DisplayListVerticalMove | null;
172
183
  /** body PM range → highlight rects */
173
184
  rangeRects(from: number, to: number): DisplayListRect[];
174
185
  /**
@@ -204,6 +215,13 @@ interface DisplayListQueries {
204
215
  anchorRect(pos: number): DisplayListRect | null;
205
216
  /** Explicit body-sidebar alias retained alongside `anchorRect`. */
206
217
  sidebarAnchorRect(pos: number): DisplayListRect | null;
218
+ /**
219
+ * Acquire the Rust session handle now (adopting the donor facade's parsed
220
+ * list when possible). Optional: the first query acquires it on demand;
221
+ * hosts call this from idle time to keep serialization off interaction
222
+ * paths. No-op once attempted, superseded, or disposed.
223
+ */
224
+ prime(): void;
207
225
  /**
208
226
  * Release the wasm session handle backing this facade. Idempotent; safe to
209
227
  * call even when no handle was opened (JSON-arg fallback path). Callers that
@@ -212,11 +230,22 @@ interface DisplayListQueries {
212
230
  */
213
231
  dispose(): void;
214
232
  }
233
+ type DisplayListQuerySource = RustDisplayListQueryEngine | ResidentDisplayListQueryEngine;
234
+ /** True once a query trapped in this engine's wasm instance. */
235
+ declare function isDisplayListQuerySourceDead(engine: DisplayListQuerySource | null | undefined): boolean;
236
+ /** Subscribe to wasm traps so the host can rebuild the dead session. */
237
+ declare function onDisplayListQuerySourceFailure(listener: (error: Error) => void): () => void;
215
238
  /**
216
239
  * Build a query facade for one display list. The optional `engine` makes the
217
240
  * facade synchronous and deterministic in tests; without it the shared wasm
218
241
  * module is loaded lazily and queries no-op (`null`/`[]`) until it resolves.
242
+ *
243
+ * `previous` (the facade this build replaces) enables handle adoption: instead
244
+ * of re-serializing and re-parsing the WHOLE list into the Rust store, the new
245
+ * facade takes over the previous parsed list and patches only the pages that
246
+ * changed. The donor facade's remaining queries degrade to its own JSON-arg
247
+ * path (same stale-list semantics it always had after replacement).
219
248
  */
220
- declare function createDisplayListQueries(list: DisplayList, engine?: RustDisplayListQueryEngine | ResidentDisplayListQueryEngine): DisplayListQueries;
249
+ declare function createDisplayListQueries(list: DisplayList, engine?: RustDisplayListQueryEngine | ResidentDisplayListQueryEngine, previous?: DisplayListQueries | null): DisplayListQueries;
221
250
 
222
- export { type DisplayListRect as D, type LocatedImagePrimitive as L, type ResidentDisplayListQueryEngine as R, type DisplayListQueries as a, type DisplayListRegionHit as b, type DisplayListHitRegion as c, type DisplayListImageGeometry as d, type DisplayListImageRegion as e, type DisplayListParagraphGeometry as f, type DisplayListQuerySourceState as g, type DisplayListVisualLine as h, captureInlinePositionEmuFromDisplayList as i, createDisplayListQueries as j, findImagePrimitiveAtPoint as k, findImagePrimitiveByDocPos as l };
251
+ export { type DisplayListRect as D, type LocatedImagePrimitive as L, type ResidentDisplayListQueryEngine as R, type DisplayListQueries as a, type DisplayListRegionHit as b, type DisplayListHitRegion as c, type DisplayListImageGeometry as d, type DisplayListImageRegion as e, type DisplayListParagraphGeometry as f, type DisplayListQuerySourceState as g, type DisplayListVerticalMove as h, type DisplayListVisualLine as i, captureInlinePositionEmuFromDisplayList as j, createDisplayListQueries as k, findImagePrimitiveAtPoint as l, findImagePrimitiveByDocPos as m, isDisplayListQuerySourceDead as n, onDisplayListQuerySourceFailure as o };
@@ -1,10 +1,10 @@
1
1
  export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from '../selectiveSave-CVoajSKE.mjs';
2
2
  import { WrapType } from './wrapTypes.mjs';
3
- import { B as BlockContent, g as Comment, W as Watermark } from '../content-DLFHRQav.mjs';
3
+ import { B as BlockContent, f as Comment, W as Watermark } from '../content-C3sTRz-u.mjs';
4
4
  import { Document } from '../types/document.mjs';
5
5
  import '../docxInput-DTbCa48g.mjs';
6
- import '../formatting-D1EPSaJP.mjs';
7
- import '../styles-Dn_o3Vo5.mjs';
6
+ import '../formatting-BEkIBePP.mjs';
7
+ import '../styles-BK3Jecxs.mjs';
8
8
 
9
9
  type AnchorWrapType = Exclude<WrapType, 'inline'>;
10
10
  type ImageLayoutTarget = AnchorWrapType | 'squareLeft' | 'squareRight' | 'inline';
@@ -1,2 +1,2 @@
1
- import {e}from'../chunk-AEQOEQJ7.mjs';export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,g as updateMultipleFiles}from'../chunk-AEQOEQJ7.mjs';import'../chunk-AZ52IWB6.mjs';import'../chunk-NJHOPXZW.mjs';import'../chunk-B4IR6YP4.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';function E(e,t,o,r,i,p){let a=e.includes("w")||e.includes("e"),s=e.includes("n")||e.includes("s"),u=e.includes("w")?-1:1,l=e.includes("n")?-1:1,m=a?r+t*u:r,f=s?i+o*l:i;if(a&&s&&p){let g=Math.max(m/r,f/i);m=r*g,f=i*g;}let d=g=>Math.max(20,Math.min(2e3,g));return {width:a?d(m):r,height:s?d(f):i}}function q(e,t,o){let r=()=>t.position?.horizontal&&t.position.vertical?t.position:o?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:o.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:o.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case "inline":return {wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case "squareLeft":case "squareRight":{let i=e==="squareLeft"?"left":"right";return {wrapType:t.wrapType==="tight"||t.wrapType==="through"?t.wrapType:"square",displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "square":case "tight":case "through":{let i=t.cssFloat==="left"||t.cssFloat==="right"?t.cssFloat:"left";return {wrapType:e,displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "topAndBottom":return {wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case "behind":case "inFront":return {wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}function W(e,t){return e==="inline"?"inline":e==="behind"?"behind":e==="inFront"?"inFront":e==="square"||e==="tight"||e==="through"?t==="right"?"squareRight":"squareLeft":null}var _=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function B(e,t){return true}function z(e){switch(e){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function K(e,t){let o=t.filter(p=>p.parentId!=null);if(o.length===0)return;let r=new Map;for(let p of o){let a=r.get(p.parentId);a?a.push(p.id):r.set(p.parentId,[p.id]);}function i(p){for(let a of p)if(a.type==="paragraph"){if(!a.content.some(u=>u.type==="commentRangeStart"||u.type==="commentRangeEnd"))continue;let s=[];for(let u of a.content)if(u.type==="commentRangeStart"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeStart",id:m});}else if(u.type==="commentRangeEnd"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeEnd",id:m});}else s.push(u);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let u of s.cells)i(u.content);}i(e);}function X(e,t){let o=new Set(t.map(a=>a.id)),r=t.filter(a=>a.parentId!=null&&!o.has(a.parentId));if(r.length===0)return;let i=new Map;for(let a of r){let s=i.get(a.parentId);s?s.push(a.id):i.set(a.parentId,[a.id]);}function p(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(f=>(f.type==="insertion"||f.type==="deletion")&&i.has(f.info.id)))continue;let l=[],m=s.content;for(let f=0;f<m.length;f++){let d=m[f];if((d.type==="insertion"||d.type==="deletion")&&i.has(d.info.id)){let g=i.get(d.info.id);for(let y of g)l.push({type:"commentRangeStart",id:y});l.push(d);let h=m[f+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==d.type&&h.info.author===d.info.author&&h.info.date===d.info.date&&(l.push(h),f++);for(let y of g)l.push({type:"commentRangeEnd",id:y});}else l.push(d);}s.content=l;}else if(s.type==="table")for(let u of s.rows)for(let l of u.cells)p(l.content);}p(e);}function $(e){let t=e?.package.headers;if(t){for(let o of t.values())if(o.watermark)return o.watermark}}function G(e){let t=e.package.headers;if(!t||t.size===0)return e;let o=false,r=new Map;for(let[i,p]of t)if(p.watermark){let{watermark:a,...s}=p;r.set(i,s),o=true;}else r.set(i,p);return o?{...e,package:{...e.package,headers:r}}:e}function N(e,t){let o=e.package.headers;if(!o||o.size===0)return e;let r=new Map;for(let[i,p]of o)r.set(i,{...p,watermark:{...t}});return {...e,package:{...e.package,headers:r}}}function j(e){let t=e.package.document,o=[];if(t.sections)for(let r of t.sections)r.properties&&o.push(r.properties);return t.finalSectionProperties&&o.push(t.finalSectionProperties),o}function U(e$1,t){let o=e$1.package,r=o.document,i=o.headers,p=j(e$1),a=new Set;if(i)for(let n of i.values())a.add(n.hdrFtrType);let s=!i||i.size===0,u=p.some(n=>n.titlePg),l=p.some(n=>n.evenAndOddHeaders),m=s,f=u&&!a.has("first"),d=l&&!a.has("even");if(!m&&!f&&!d)return e$1;let g=o.relationships?new Map(o.relationships):new Map,h=new Map(i??[]),y=new Set;for(let n of g.values())n.target&&y.add(n.target.replace(/^\/?word\//,"").toLowerCase());function P(){let n=1;for(;y.has(`header${n}.xml`);)n++;let c=`header${n}.xml`;return y.add(c.toLowerCase()),c}function v(n){let c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}`,I=1;for(;g.has(c);)c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}${I++}`;return g.set(c,{id:c,type:e.header,target:P()}),h.set(c,{type:"header",hdrFtrType:n,content:[],watermark:{...t}}),c}let T={};function F(n){return T[n]??(T[n]=v(n))}function L(n,c){let I=n?.headerReferences?[...n.headerReferences]:[];return I.some(S=>S.type===c)?n??{}:(I.push({type:c,rId:F(c)}),{...n??{},headerReferences:I})}function w(n){let c=n;return m&&(c=L(c,"default")),f&&c?.titlePg&&(c=L(c,"first")),d&&c?.evenAndOddHeaders&&(c=L(c,"even")),c}let M=w(r.finalSectionProperties),k=r.sections?.map(n=>({...n,properties:w(n.properties)??n.properties}));return {...e$1,package:{...o,relationships:g,headers:h,document:{...r,finalSectionProperties:M,...k?{sections:k}:{}}}}}function Y(e,t){if(!t)return G(e);let o=N(e,t);return U(o,t)}
1
+ import {e}from'../chunk-NTSSE5QK.mjs';export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,g as updateMultipleFiles}from'../chunk-NTSSE5QK.mjs';import'../chunk-YTILOUAA.mjs';import'../chunk-6KDV6AIL.mjs';import'../chunk-NJHOPXZW.mjs';import'../chunk-B4IR6YP4.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';function E(e,t,o,r,i,p){let a=e.includes("w")||e.includes("e"),s=e.includes("n")||e.includes("s"),u=e.includes("w")?-1:1,l=e.includes("n")?-1:1,m=a?r+t*u:r,f=s?i+o*l:i;if(a&&s&&p){let g=Math.max(m/r,f/i);m=r*g,f=i*g;}let d=g=>Math.max(20,Math.min(2e3,g));return {width:a?d(m):r,height:s?d(f):i}}function q(e,t,o){let r=()=>t.position?.horizontal&&t.position.vertical?t.position:o?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:o.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:o.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case "inline":return {wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case "squareLeft":case "squareRight":{let i=e==="squareLeft"?"left":"right";return {wrapType:t.wrapType==="tight"||t.wrapType==="through"?t.wrapType:"square",displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "square":case "tight":case "through":{let i=t.cssFloat==="left"||t.cssFloat==="right"?t.cssFloat:"left";return {wrapType:e,displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "topAndBottom":return {wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case "behind":case "inFront":return {wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}function W(e,t){return e==="inline"?"inline":e==="behind"?"behind":e==="inFront"?"inFront":e==="square"||e==="tight"||e==="through"?t==="right"?"squareRight":"squareLeft":null}var _=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function B(e,t){return true}function z(e){switch(e){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function K(e,t){let o=t.filter(p=>p.parentId!=null);if(o.length===0)return;let r=new Map;for(let p of o){let a=r.get(p.parentId);a?a.push(p.id):r.set(p.parentId,[p.id]);}function i(p){for(let a of p)if(a.type==="paragraph"){if(!a.content.some(u=>u.type==="commentRangeStart"||u.type==="commentRangeEnd"))continue;let s=[];for(let u of a.content)if(u.type==="commentRangeStart"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeStart",id:m});}else if(u.type==="commentRangeEnd"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeEnd",id:m});}else s.push(u);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let u of s.cells)i(u.content);}i(e);}function X(e,t){let o=new Set(t.map(a=>a.id)),r=t.filter(a=>a.parentId!=null&&!o.has(a.parentId));if(r.length===0)return;let i=new Map;for(let a of r){let s=i.get(a.parentId);s?s.push(a.id):i.set(a.parentId,[a.id]);}function p(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(f=>(f.type==="insertion"||f.type==="deletion")&&i.has(f.info.id)))continue;let l=[],m=s.content;for(let f=0;f<m.length;f++){let d=m[f];if((d.type==="insertion"||d.type==="deletion")&&i.has(d.info.id)){let g=i.get(d.info.id);for(let y of g)l.push({type:"commentRangeStart",id:y});l.push(d);let h=m[f+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==d.type&&h.info.author===d.info.author&&h.info.date===d.info.date&&(l.push(h),f++);for(let y of g)l.push({type:"commentRangeEnd",id:y});}else l.push(d);}s.content=l;}else if(s.type==="table")for(let u of s.rows)for(let l of u.cells)p(l.content);}p(e);}function $(e){let t=e?.package.headers;if(t){for(let o of t.values())if(o.watermark)return o.watermark}}function G(e){let t=e.package.headers;if(!t||t.size===0)return e;let o=false,r=new Map;for(let[i,p]of t)if(p.watermark){let{watermark:a,...s}=p;r.set(i,s),o=true;}else r.set(i,p);return o?{...e,package:{...e.package,headers:r}}:e}function N(e,t){let o=e.package.headers;if(!o||o.size===0)return e;let r=new Map;for(let[i,p]of o)r.set(i,{...p,watermark:{...t}});return {...e,package:{...e.package,headers:r}}}function j(e){let t=e.package.document,o=[];if(t.sections)for(let r of t.sections)r.properties&&o.push(r.properties);return t.finalSectionProperties&&o.push(t.finalSectionProperties),o}function U(e$1,t){let o=e$1.package,r=o.document,i=o.headers,p=j(e$1),a=new Set;if(i)for(let n of i.values())a.add(n.hdrFtrType);let s=!i||i.size===0,u=p.some(n=>n.titlePg),l=p.some(n=>n.evenAndOddHeaders),m=s,f=u&&!a.has("first"),d=l&&!a.has("even");if(!m&&!f&&!d)return e$1;let g=o.relationships?new Map(o.relationships):new Map,h=new Map(i??[]),y=new Set;for(let n of g.values())n.target&&y.add(n.target.replace(/^\/?word\//,"").toLowerCase());function P(){let n=1;for(;y.has(`header${n}.xml`);)n++;let c=`header${n}.xml`;return y.add(c.toLowerCase()),c}function v(n){let c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}`,I=1;for(;g.has(c);)c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}${I++}`;return g.set(c,{id:c,type:e.header,target:P()}),h.set(c,{type:"header",hdrFtrType:n,content:[],watermark:{...t}}),c}let T={};function F(n){return T[n]??(T[n]=v(n))}function L(n,c){let I=n?.headerReferences?[...n.headerReferences]:[];return I.some(S=>S.type===c)?n??{}:(I.push({type:c,rId:F(c)}),{...n??{},headerReferences:I})}function w(n){let c=n;return m&&(c=L(c,"default")),f&&c?.titlePg&&(c=L(c,"first")),d&&c?.evenAndOddHeaders&&(c=L(c,"even")),c}let M=w(r.finalSectionProperties),k=r.sections?.map(n=>({...n,properties:w(n.properties)??n.properties}));return {...e$1,package:{...o,relationships:g,headers:h,document:{...r,finalSectionProperties:M,...k?{sections:k}:{}}}}}function Y(e,t){if(!t)return G(e);let o=N(e,t);return U(o,t)}
2
2
  export{_ as IMAGE_LAYOUT_OPTIONS,E as calculateResizedImageDimensions,W as deriveLayoutChoice,$ as getDocumentWatermark,K as injectReplyRangeMarkers,X as injectTCReplyRangeMarkers,B as isImageLayoutOptionEnabled,q as resolveImageLayoutAttrs,Y as setDocumentWatermark,z as toolbarValueToLayoutTarget};
@@ -1,12 +1,13 @@
1
1
  import { R as ResidentMeasurementConfig } from '../rustMeasureSource-D1KsQvVC.mjs';
2
- import { L as LayoutBlock, B as BlockExtent, a as Layout, b as LayoutOptions } from '../types-DMkDbvEu.mjs';
2
+ import { L as LayoutBlock, B as BlockExtent, a as Layout, b as LayoutOptions } from '../types-C1rv3KM-.mjs';
3
3
  import { MeasuredBlock } from '../layout/pagination/index.mjs';
4
- import { D as DisplayListHeadersFooters } from '../rustDisplayList-CX78djsZ.mjs';
4
+ import { D as DisplayListHeadersFooters } from '../rustDisplayList-B0M2eBkU.mjs';
5
5
  import { Document } from '../types/document.mjs';
6
- import { Y as YrsSession, a as YrsRenderEnv } from '../index-Bwxm3oiC.mjs';
7
- import { S as SectionProperties, N as NoteKind } from '../content-DLFHRQav.mjs';
8
- import '../formatting-D1EPSaJP.mjs';
9
- import '../styles-Dn_o3Vo5.mjs';
6
+ import { Y as YrsSession, a as YrsRenderEnv } from '../index-2piKi4gO.mjs';
7
+ import { S as SectionProperties, N as NoteKind } from '../content-C3sTRz-u.mjs';
8
+ import '../formatting-BEkIBePP.mjs';
9
+ import '../frameDelta-B2kC6XiP.mjs';
10
+ import '../styles-BK3Jecxs.mjs';
10
11
  import '../docx/wrapTypes.mjs';
11
12
 
12
13
  interface ResidentRegionLayoutRequest {
@@ -1,4 +1,129 @@
1
- import { C as ColorValue, e as Theme, f as ThemeColorSlot } from './formatting-D1EPSaJP.mjs';
1
+ import { y as ThemeColorSlot, C as ColorValue, f as Theme, x as ThemeColorScheme } from './formatting-BEkIBePP.mjs';
2
+
3
+ /**
4
+ * Color primitives and math shared across OOXML formats.
5
+ *
6
+ * Handles theme color slot references (accent1, dk1, ...), RGB hex values,
7
+ * tint/shade modifiers, and the derived color helpers (lighten/darken/blend/
8
+ * contrast) built on top of them.
9
+ *
10
+ * Tint/Shade Calculations (ECMA-376 §17.3.2.41):
11
+ * - Tint makes a color lighter (per-channel interpolation toward white)
12
+ * - Shade makes a color darker (per-channel interpolation toward black)
13
+ * - The wire value is a hex byte (00-FF) meaning "how much color to keep"
14
+ */
15
+
16
+ /**
17
+ * Resolve a ColorValue to a CSS color string
18
+ *
19
+ * @param color - ColorValue object with rgb, themeColor, tint/shade, or auto
20
+ * @param theme - Theme for resolving theme colors
21
+ * @param defaultColor - Default color if auto or undefined (default: black)
22
+ * @returns CSS color string (e.g., "#FF0000" or "inherit")
23
+ *
24
+ * @public
25
+ */
26
+ declare function resolveColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, defaultColor?: string): string;
27
+ /**
28
+ * Resolve any ColorValue (text, fill/shading, border, underline) to a 6-char
29
+ * uppercase hex string — or `undefined` if transparent/unset/unresolvable.
30
+ *
31
+ * Shared display-side resolver. Prefer this over reading `.rgb` directly so
32
+ * that `themeColor` + `themeTint`/`themeShade` are honored consistently across
33
+ * all render paths.
34
+ *
35
+ * When a themed color is present but `theme` is null/undefined, falls back to
36
+ * `color.rgb` if Word wrote one for compat; otherwise returns `undefined`.
37
+ *
38
+ * @returns 6-char uppercase hex without `#`, or `undefined`.
39
+ *
40
+ * @public
41
+ */
42
+ declare function resolveColorToHex(color: ColorValue | undefined | null, theme: Theme | null | undefined): string | undefined;
43
+ /**
44
+ * Get contrasting text color for a background
45
+ *
46
+ * @param backgroundColor - Background ColorValue
47
+ * @param theme - Theme for resolving theme colors
48
+ * @returns Black or white hex color for best contrast
49
+ *
50
+ * @public
51
+ */
52
+ declare function getContrastingColor(backgroundColor: ColorValue | undefined | null, theme: Theme | null | undefined): string;
53
+ /**
54
+ * Darken a color by a percentage
55
+ *
56
+ * @param color - ColorValue to darken
57
+ * @param theme - Theme for resolving
58
+ * @param percent - Percentage to darken (0-100)
59
+ * @returns CSS color string
60
+ *
61
+ * @public
62
+ */
63
+ declare function darkenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
64
+ /**
65
+ * Lighten a color by a percentage
66
+ *
67
+ * @param color - ColorValue to lighten
68
+ * @param theme - Theme for resolving
69
+ * @param percent - Percentage to lighten (0-100)
70
+ * @returns CSS color string
71
+ *
72
+ * @public
73
+ */
74
+ declare function lightenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
75
+ /**
76
+ * Blend two colors together
77
+ *
78
+ * @param color1 - First color
79
+ * @param color2 - Second color
80
+ * @param ratio - Blend ratio (0 = all color1, 1 = all color2)
81
+ * @param theme - Theme for resolving
82
+ * @returns CSS color string
83
+ *
84
+ * @public
85
+ */
86
+ declare function blendColors(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, ratio: number, theme: Theme | null | undefined): string;
87
+ /**
88
+ * Theme color matrix cell
89
+ *
90
+ * @public
91
+ */
92
+ interface ThemeMatrixCell {
93
+ /** Resolved hex color (6 chars, no #) */
94
+ hex: string;
95
+ /** Theme color slot */
96
+ themeSlot: ThemeColorSlot;
97
+ /** Tint hex modifier if applicable (e.g., "CC") */
98
+ tint?: string;
99
+ /** Shade hex modifier if applicable (e.g., "BF") */
100
+ shade?: string;
101
+ /** Human-readable label (e.g., "Accent 1, Lighter 60%") */
102
+ label: string;
103
+ }
104
+ /**
105
+ * Compute a single tinted or shaded hex color from a base color.
106
+ *
107
+ * @param baseHex - 6-character hex color (no #)
108
+ * @param type - 'tint' to lighten, 'shade' to darken
109
+ * @param fraction - Amount (0-1). For tint: 0=no change, 1=white. For shade: 0=black, 1=no change.
110
+ * @returns 6-character hex color (no #)
111
+ *
112
+ * @public
113
+ */
114
+ declare function getThemeTintShadeHex(baseHex: string, type: 'tint' | 'shade', fraction: number): string;
115
+ /**
116
+ * Generate the 10×6 theme color matrix for an advanced color picker.
117
+ *
118
+ * Columns: lt1, dk1, lt2, dk2, accent1-6 (matches Word's order)
119
+ * Rows: base, 80% tint, 60% tint, 40% tint, 25% shade, 50% shade
120
+ *
121
+ * @param colorScheme - Theme color scheme (falls back to Office 2016 defaults)
122
+ * @returns 6 rows × 10 columns of ThemeMatrixCell
123
+ *
124
+ * @public
125
+ */
126
+ declare function generateThemeTintShadeMatrix(colorScheme?: ThemeColorScheme | null): ThemeMatrixCell[][];
2
127
 
3
128
  /**
4
129
  * Color Resolver - Convert OOXML colors to CSS
@@ -326,4 +451,4 @@ declare function extractFontsFromDocument(document: unknown): Set<string>;
326
451
  */
327
452
  declare function loadDocumentFonts(document: unknown): Promise<void>;
328
453
 
329
- export { loadFontFromUrl as A, loadFontWithMapping as B, loadFontsWithMapping as C, onFontError as D, FONT_MAPPING as F, colorsEqual as a, createRgbColor as b, canRenderFont as c, createThemeColor as d, ensureHexPrefix as e, isFontLoaded as f, getLoadedFonts as g, isLoading as h, isBlack as i, isGoogleFontsEnabled as j, isWhite as k, loadFont as l, loadFontFromBuffer as m, loadFonts as n, onFontsLoaded as o, parseColorString as p, preloadCommonFonts as q, resolveHighlightColor as r, resolveHighlightToCss as s, resolveShadingColor as t, setGoogleFontsEnabled as u, type FontDefinition as v, extractFontsFromDocument as w, getGoogleFontEquivalent as x, loadDocumentFonts as y, loadFontDefinitions as z };
454
+ export { resolveShadingColor as A, setGoogleFontsEnabled as B, type FontDefinition as C, extractFontsFromDocument as D, getGoogleFontEquivalent as E, FONT_MAPPING as F, loadDocumentFonts as G, loadFontDefinitions as H, loadFontFromUrl as I, loadFontWithMapping as J, loadFontsWithMapping as K, onFontError as L, resolveColorToHex as M, type ThemeMatrixCell as T, colorsEqual as a, blendColors as b, canRenderFont as c, createRgbColor as d, createThemeColor as e, darkenColor as f, ensureHexPrefix as g, generateThemeTintShadeMatrix as h, getContrastingColor as i, getLoadedFonts as j, getThemeTintShadeHex as k, isBlack as l, isFontLoaded as m, isLoading as n, isGoogleFontsEnabled as o, isWhite as p, lightenColor as q, loadFont as r, loadFontFromBuffer as s, loadFonts as t, onFontsLoaded as u, parseColorString as v, preloadCommonFonts as w, resolveColor as x, resolveHighlightColor as y, resolveHighlightToCss as z };
@@ -1,239 +1,113 @@
1
- /**
2
- * Theme parsing — colors and fonts from a DrawingML theme part
3
- * (e.g. word/theme/theme1.xml, ppt/theme/theme1.xml).
4
- *
5
- * Extracts color scheme (dk1, lt1, dk2, lt2, accent1-6, hlink, folHlink)
6
- * and font scheme (majorFont, minorFont) from the theme.
7
- *
8
- * OOXML Reference:
9
- * - Uses DrawingML namespace (a:)
10
- * - Colors can be srgbClr, sysClr, or schemeClr
11
- */
12
-
13
- /**
14
- * Theme color scheme (a:clrScheme)
15
- *
16
- * @public
17
- */
1
+ /** DrawingML value contracts retained by the DOCX host. */
2
+ type ThemeColorSlot = 'dk1' | 'lt1' | 'dk2' | 'lt2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6' | 'hlink' | 'folHlink' | 'background1' | 'text1' | 'background2' | 'text2';
3
+ interface ColorValue {
4
+ rgb?: string;
5
+ themeColor?: ThemeColorSlot;
6
+ themeTint?: string;
7
+ themeShade?: string;
8
+ auto?: boolean;
9
+ }
18
10
  interface ThemeColorScheme {
19
- /** Dark 1 color (usually black) */
20
11
  dk1?: string;
21
- /** Light 1 color (usually white) */
22
12
  lt1?: string;
23
- /** Dark 2 color */
24
13
  dk2?: string;
25
- /** Light 2 color */
26
14
  lt2?: string;
27
- /** Accent colors 1-6 */
28
15
  accent1?: string;
29
16
  accent2?: string;
30
17
  accent3?: string;
31
18
  accent4?: string;
32
19
  accent5?: string;
33
20
  accent6?: string;
34
- /** Hyperlink color */
35
21
  hlink?: string;
36
- /** Followed hyperlink color */
37
22
  folHlink?: string;
38
23
  }
39
- /**
40
- * Theme font (with script variants)
41
- *
42
- * @public
43
- */
44
24
  interface ThemeFont {
45
- /** Latin font */
46
25
  latin?: string;
47
- /** East Asian font */
48
26
  ea?: string;
49
- /** Complex script font */
50
27
  cs?: string;
51
- /** Script-specific fonts */
52
28
  fonts?: Record<string, string>;
53
29
  }
54
- /**
55
- * Theme font scheme (a:fontScheme)
56
- *
57
- * @public
58
- */
59
30
  interface ThemeFontScheme {
60
- /** Major font (headings) */
61
31
  majorFont?: ThemeFont;
62
- /** Minor font (body text) */
63
32
  minorFont?: ThemeFont;
64
33
  }
65
- /**
66
- * Theme (from a theme1.xml part)
67
- *
68
- * @public
69
- */
70
34
  interface Theme {
71
- /** Theme name */
72
35
  name?: string;
73
- /** Color scheme */
74
36
  colorScheme?: ThemeColorScheme;
75
- /** Font scheme */
76
37
  fontScheme?: ThemeFontScheme;
77
- /** Format scheme (fills, lines, effects) - simplified */
78
38
  formatScheme?: {
79
39
  name?: string;
80
40
  };
81
41
  }
82
-
83
- /**
84
- * Color primitives and math shared across OOXML formats.
85
- *
86
- * Handles theme color slot references (accent1, dk1, ...), RGB hex values,
87
- * tint/shade modifiers, and the derived color helpers (lighten/darken/blend/
88
- * contrast) built on top of them.
89
- *
90
- * Tint/Shade Calculations (ECMA-376 §17.3.2.41):
91
- * - Tint makes a color lighter (per-channel interpolation toward white)
92
- * - Shade makes a color darker (per-channel interpolation toward black)
93
- * - The wire value is a hex byte (00-FF) meaning "how much color to keep"
94
- */
95
-
96
- /**
97
- * Theme color slots from a theme's clrScheme (plus the WordprocessingML
98
- * alias slots background1/text1/background2/text2).
99
- *
100
- * @public
101
- */
102
- type ThemeColorSlot = 'dk1' | 'lt1' | 'dk2' | 'lt2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6' | 'hlink' | 'folHlink' | 'background1' | 'text1' | 'background2' | 'text2';
103
- /**
104
- * ECMA-376 color reference — either a direct RGB hex, a theme slot
105
- * reference (with optional tint/shade), or `auto` for context-dependent
106
- * defaults (usually black for text on light backgrounds). When both
107
- * `rgb` and `themeColor` are set, the theme wins on Word import and the
108
- * `rgb` acts as a fallback for renderers without theme support.
109
- *
110
- * See ECMA-376 §17.18.39 (`ST_ThemeColor`).
111
- *
112
- * @public
113
- */
114
- interface ColorValue {
115
- /** RGB hex value without # (e.g., "FF0000") */
116
- rgb?: string;
117
- /** Theme color slot reference */
118
- themeColor?: ThemeColorSlot;
119
- /** Tint modifier (0-255 as hex string, e.g., "80") - makes color lighter */
120
- themeTint?: string;
121
- /** Shade modifier (0-255 as hex string) - makes color darker */
122
- themeShade?: string;
123
- /** Auto color - context-dependent (usually black for text) */
124
- auto?: boolean;
42
+ type ShapeType = 'rect' | 'roundRect' | 'ellipse' | 'triangle' | 'rtTriangle' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'hexagon' | 'heptagon' | 'octagon' | 'decagon' | 'dodecagon' | 'star4' | 'star5' | 'star6' | 'star7' | 'star8' | 'star10' | 'star12' | 'star16' | 'star24' | 'star32' | 'line' | 'straightConnector1' | 'bentConnector2' | 'bentConnector3' | 'bentConnector4' | 'bentConnector5' | 'curvedConnector2' | 'curvedConnector3' | 'curvedConnector4' | 'curvedConnector5' | 'rightArrow' | 'leftArrow' | 'upArrow' | 'downArrow' | 'leftRightArrow' | 'upDownArrow' | 'quadArrow' | 'leftRightUpArrow' | 'bentArrow' | 'uturnArrow' | 'leftUpArrow' | 'bentUpArrow' | 'curvedRightArrow' | 'curvedLeftArrow' | 'curvedUpArrow' | 'curvedDownArrow' | 'stripedRightArrow' | 'notchedRightArrow' | 'homePlate' | 'chevron' | 'rightArrowCallout' | 'downArrowCallout' | 'leftArrowCallout' | 'upArrowCallout' | 'leftRightArrowCallout' | 'quadArrowCallout' | 'circularArrow' | 'flowChartProcess' | 'flowChartAlternateProcess' | 'flowChartDecision' | 'flowChartInputOutput' | 'flowChartPredefinedProcess' | 'flowChartInternalStorage' | 'flowChartDocument' | 'flowChartMultidocument' | 'flowChartTerminator' | 'flowChartPreparation' | 'flowChartManualInput' | 'flowChartManualOperation' | 'flowChartConnector' | 'flowChartOffpageConnector' | 'flowChartPunchedCard' | 'flowChartPunchedTape' | 'flowChartSummingJunction' | 'flowChartOr' | 'flowChartCollate' | 'flowChartSort' | 'flowChartExtract' | 'flowChartMerge' | 'flowChartOnlineStorage' | 'flowChartDelay' | 'flowChartMagneticTape' | 'flowChartMagneticDisk' | 'flowChartMagneticDrum' | 'flowChartDisplay' | 'wedgeRectCallout' | 'wedgeRoundRectCallout' | 'wedgeEllipseCallout' | 'cloudCallout' | 'borderCallout1' | 'borderCallout2' | 'borderCallout3' | 'accentCallout1' | 'accentCallout2' | 'accentCallout3' | 'callout1' | 'callout2' | 'callout3' | 'accentBorderCallout1' | 'accentBorderCallout2' | 'accentBorderCallout3' | 'actionButtonBlank' | 'actionButtonHome' | 'actionButtonHelp' | 'actionButtonInformation' | 'actionButtonBackPrevious' | 'actionButtonForwardNext' | 'actionButtonBeginning' | 'actionButtonEnd' | 'actionButtonReturn' | 'actionButtonDocument' | 'actionButtonSound' | 'actionButtonMovie' | 'irregularSeal1' | 'irregularSeal2' | 'frame' | 'halfFrame' | 'corner' | 'diagStripe' | 'chord' | 'arc' | 'bracketPair' | 'bracePair' | 'leftBracket' | 'rightBracket' | 'leftBrace' | 'rightBrace' | 'can' | 'cube' | 'bevel' | 'donut' | 'noSmoking' | 'blockArc' | 'foldedCorner' | 'smileyFace' | 'heart' | 'lightningBolt' | 'sun' | 'moon' | 'cloud' | 'snip1Rect' | 'snip2SameRect' | 'snip2DiagRect' | 'snipRoundRect' | 'round1Rect' | 'round2SameRect' | 'round2DiagRect' | 'plaque' | 'teardrop' | 'mathPlus' | 'mathMinus' | 'mathMultiply' | 'mathDivide' | 'mathEqual' | 'mathNotEqual' | 'gear6' | 'gear9' | 'funnel' | 'pieWedge' | 'pie' | 'leftCircularArrow' | 'leftRightCircularArrow' | 'swooshArrow' | 'textBox';
43
+ interface ShapeFill {
44
+ type: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture';
45
+ color?: ColorValue;
46
+ gradient?: {
47
+ type: 'linear' | 'radial' | 'rectangular' | 'path';
48
+ angle?: number;
49
+ stops: Array<{
50
+ position: number;
51
+ color: ColorValue;
52
+ }>;
53
+ };
125
54
  }
126
- /**
127
- * Resolve a ColorValue to a CSS color string
128
- *
129
- * @param color - ColorValue object with rgb, themeColor, tint/shade, or auto
130
- * @param theme - Theme for resolving theme colors
131
- * @param defaultColor - Default color if auto or undefined (default: black)
132
- * @returns CSS color string (e.g., "#FF0000" or "inherit")
133
- *
134
- * @public
135
- */
136
- declare function resolveColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, defaultColor?: string): string;
137
- /**
138
- * Resolve any ColorValue (text, fill/shading, border, underline) to a 6-char
139
- * uppercase hex string — or `undefined` if transparent/unset/unresolvable.
140
- *
141
- * Shared display-side resolver. Prefer this over reading `.rgb` directly so
142
- * that `themeColor` + `themeTint`/`themeShade` are honored consistently across
143
- * all render paths.
144
- *
145
- * When a themed color is present but `theme` is null/undefined, falls back to
146
- * `color.rgb` if Word wrote one for compat; otherwise returns `undefined`.
147
- *
148
- * @returns 6-char uppercase hex without `#`, or `undefined`.
149
- *
150
- * @public
151
- */
152
- declare function resolveColorToHex(color: ColorValue | undefined | null, theme: Theme | null | undefined): string | undefined;
153
- /**
154
- * Get contrasting text color for a background
155
- *
156
- * @param backgroundColor - Background ColorValue
157
- * @param theme - Theme for resolving theme colors
158
- * @returns Black or white hex color for best contrast
159
- *
160
- * @public
161
- */
162
- declare function getContrastingColor(backgroundColor: ColorValue | undefined | null, theme: Theme | null | undefined): string;
163
- /**
164
- * Darken a color by a percentage
165
- *
166
- * @param color - ColorValue to darken
167
- * @param theme - Theme for resolving
168
- * @param percent - Percentage to darken (0-100)
169
- * @returns CSS color string
170
- *
171
- * @public
172
- */
173
- declare function darkenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
174
- /**
175
- * Lighten a color by a percentage
176
- *
177
- * @param color - ColorValue to lighten
178
- * @param theme - Theme for resolving
179
- * @param percent - Percentage to lighten (0-100)
180
- * @returns CSS color string
181
- *
182
- * @public
183
- */
184
- declare function lightenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
185
- /**
186
- * Blend two colors together
187
- *
188
- * @param color1 - First color
189
- * @param color2 - Second color
190
- * @param ratio - Blend ratio (0 = all color1, 1 = all color2)
191
- * @param theme - Theme for resolving
192
- * @returns CSS color string
193
- *
194
- * @public
195
- */
196
- declare function blendColors(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, ratio: number, theme: Theme | null | undefined): string;
197
- /**
198
- * Theme color matrix cell
199
- *
200
- * @public
201
- */
202
- interface ThemeMatrixCell {
203
- /** Resolved hex color (6 chars, no #) */
204
- hex: string;
205
- /** Theme color slot */
206
- themeSlot: ThemeColorSlot;
207
- /** Tint hex modifier if applicable (e.g., "CC") */
208
- tint?: string;
209
- /** Shade hex modifier if applicable (e.g., "BF") */
210
- shade?: string;
211
- /** Human-readable label (e.g., "Accent 1, Lighter 60%") */
212
- label: string;
55
+ interface ShapeOutline {
56
+ width?: number;
57
+ color?: ColorValue;
58
+ style?: 'solid' | 'dot' | 'dash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | 'sysDot' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot';
59
+ cap?: 'flat' | 'round' | 'square';
60
+ join?: 'bevel' | 'miter' | 'round';
61
+ headEnd?: {
62
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
63
+ width?: 'sm' | 'med' | 'lg';
64
+ length?: 'sm' | 'med' | 'lg';
65
+ };
66
+ tailEnd?: {
67
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
68
+ width?: 'sm' | 'med' | 'lg';
69
+ length?: 'sm' | 'med' | 'lg';
70
+ };
213
71
  }
214
- /**
215
- * Compute a single tinted or shaded hex color from a base color.
216
- *
217
- * @param baseHex - 6-character hex color (no #)
218
- * @param type - 'tint' to lighten, 'shade' to darken
219
- * @param fraction - Amount (0-1). For tint: 0=no change, 1=white. For shade: 0=black, 1=no change.
220
- * @returns 6-character hex color (no #)
221
- *
222
- * @public
223
- */
224
- declare function getThemeTintShadeHex(baseHex: string, type: 'tint' | 'shade', fraction: number): string;
225
- /**
226
- * Generate the 10×6 theme color matrix for an advanced color picker.
227
- *
228
- * Columns: lt1, dk1, lt2, dk2, accent1-6 (matches Word's order)
229
- * Rows: base, 80% tint, 60% tint, 40% tint, 25% shade, 50% shade
230
- *
231
- * @param colorScheme - Theme color scheme (falls back to Office 2016 defaults)
232
- * @returns 6 rows × 10 columns of ThemeMatrixCell
233
- *
234
- * @public
235
- */
236
- declare function generateThemeTintShadeMatrix(colorScheme?: ThemeColorScheme | null): ThemeMatrixCell[][];
72
+ interface ShapeTextBody<TContent = unknown> {
73
+ vertical?: boolean;
74
+ rotation?: number;
75
+ anchor?: 'top' | 'middle' | 'bottom' | 'distributed' | 'justified';
76
+ anchorCenter?: boolean;
77
+ autoFit?: 'none' | 'normal' | 'shape';
78
+ margins?: {
79
+ top?: number;
80
+ bottom?: number;
81
+ left?: number;
82
+ right?: number;
83
+ };
84
+ content: TContent[];
85
+ }
86
+ type PresetGeometryPathCommand = {
87
+ type: 'move';
88
+ x: number;
89
+ y: number;
90
+ } | {
91
+ type: 'line';
92
+ x: number;
93
+ y: number;
94
+ } | {
95
+ type: 'quad';
96
+ cpx: number;
97
+ cpy: number;
98
+ x: number;
99
+ y: number;
100
+ } | {
101
+ type: 'cubic';
102
+ cp1x: number;
103
+ cp1y: number;
104
+ cp2x: number;
105
+ cp2y: number;
106
+ x: number;
107
+ y: number;
108
+ } | {
109
+ type: 'close';
110
+ };
237
111
 
238
112
  /**
239
113
  * Color & Styling Primitives
@@ -820,4 +694,4 @@ interface TableCellFormatting {
820
694
  conditionalFormat?: ConditionalFormatStyle;
821
695
  }
822
696
 
823
- export { generateThemeTintShadeMatrix as A, type BorderSpec as B, type ColorValue as C, getContrastingColor as D, type EmphasisMark as E, type FloatingTableProperties as F, getThemeTintShadeHex as G, lightenColor as H, resolveColor as I, resolveColorToHex as J, type LineSpacingRule as L, type ParagraphFormatting as P, type RunFontHint as R, type ShadingProperties as S, type TextModernEffects as T, type UnderlineStyle as U, type TextFormatting as a, type TableFormatting as b, type TableRowFormatting as c, type TableCellFormatting as d, type Theme as e, type ThemeColorSlot as f, type CellMargins as g, type ConditionalFormatStyle as h, type ParagraphAlignment as i, type RunLanguage as j, type TabLeader as k, type TabStop as l, type TabStopAlignment as m, type TableBorders as n, type TableLook as o, type TableMeasurement as p, type TableStyleCascade as q, type TableStyleRegion as r, type TableWidthType as s, type TextEffect as t, type ThemeColorScheme as u, type ThemeFont as v, type ThemeFontScheme as w, type ThemeMatrixCell as x, blendColors as y, darkenColor as z };
697
+ export type { ThemeFontScheme as A, BorderSpec as B, ColorValue as C, ShapeTextBody as D, EmphasisMark as E, FloatingTableProperties as F, LineSpacingRule as L, PresetGeometryPathCommand as P, RunFontHint as R, ShadingProperties as S, TextModernEffects as T, UnderlineStyle as U, ParagraphFormatting as a, TextFormatting as b, TableFormatting as c, TableRowFormatting as d, TableCellFormatting as e, Theme as f, CellMargins as g, ConditionalFormatStyle as h, ParagraphAlignment as i, RunLanguage as j, ShapeFill as k, ShapeOutline as l, ShapeType as m, TabLeader as n, TabStop as o, TabStopAlignment as p, TableBorders as q, TableLook as r, TableMeasurement as s, TableStyleCascade as t, TableStyleRegion as u, TableWidthType as v, TextEffect as w, ThemeColorScheme as x, ThemeColorSlot as y, ThemeFont as z };