wordinweb 0.1.8 → 0.1.10
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/README.md +44 -1
- package/dist/index.d.ts +44 -12
- package/dist/index.js +1742 -286
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Editing is in an Alpha state and is strictly opt-in via the `editable` flag; the
|
|
|
14
14
|
|
|
15
15
|
If you discover an edge case or perf issue create an issue and include the offending Word file.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Long-document performance work focuses on incremental parsing/layout and page virtualization; the current renderer remains DOM-based.
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -198,6 +198,24 @@ Every color the chrome paints — the toolbar, comment cards, selection, caret,
|
|
|
198
198
|
| `--dxw-layout-menu-width` | `304px` | Layout option-menu width |
|
|
199
199
|
| `--dxw-layout-menu-max-height` | `480px` | Layout option-menu scroll limit |
|
|
200
200
|
| `--dxw-layout-preview-bg` | `#fff` | Paper fill in Layout option previews |
|
|
201
|
+
| `--dxw-select-height` | `26px` | Custom select trigger height |
|
|
202
|
+
| `--dxw-select-border` | `transparent` | Custom select trigger border color |
|
|
203
|
+
| `--dxw-select-radius` | `4px` | Custom select trigger corner radius |
|
|
204
|
+
| `--dxw-select-bg` | `transparent` | Custom select trigger fill |
|
|
205
|
+
| `--dxw-select-fg` | toolbar foreground | Custom select trigger text |
|
|
206
|
+
| `--dxw-select-font` | `13px system-ui` | Custom select trigger font |
|
|
207
|
+
| `--dxw-select-padding` | `0 6px` | Custom select trigger padding |
|
|
208
|
+
| `--dxw-select-menu-bg` | popover background | Custom select menu fill |
|
|
209
|
+
| `--dxw-select-menu-border` | toolbar border | Custom select menu border color |
|
|
210
|
+
| `--dxw-select-menu-radius` | `8px` | Custom select menu corner radius |
|
|
211
|
+
| `--dxw-select-menu-shadow` | popover shadow | Custom select menu shadow |
|
|
212
|
+
| `--dxw-select-menu-max-height` | `320px` | Custom select menu scroll limit |
|
|
213
|
+
| `--dxw-color-menu-width` | `236px` | Text and drawing color palette width |
|
|
214
|
+
| `--dxw-dialog-backdrop` | `rgba(32,33,36,.38)` | Editor dialog scrim |
|
|
215
|
+
| `--dxw-dialog-z-index` | `1000` | Editor dialog stacking level |
|
|
216
|
+
| `--dxw-dialog-width` | `420px` | Editor dialog width |
|
|
217
|
+
| `--dxw-dialog-radius` | `10px` | Editor dialog corner radius |
|
|
218
|
+
| `--dxw-dialog-field-bg` | popover background | Editor dialog field fill |
|
|
201
219
|
| `--dxw-canvas-bg` | `#e8eaed` | Scroll area behind the pages |
|
|
202
220
|
| `--dxw-page-bg` | `#ffffff` | Page paper |
|
|
203
221
|
| `--dxw-page-shadow` | `0 1px 3px …, 0 4px 14px …` | Page drop shadow |
|
|
@@ -238,6 +256,31 @@ Or in a stylesheet:
|
|
|
238
256
|
.dxw-dark { --dxw-toolbar-bg: #1f2937; --dxw-toolbar-fg: #e5e7eb; /* … */ }
|
|
239
257
|
```
|
|
240
258
|
|
|
259
|
+
### Custom menus and dialogs
|
|
260
|
+
|
|
261
|
+
All visible toolbar choices use WordInWeb-rendered controls rather than the
|
|
262
|
+
browser's native select, prompt, or color-picker UI. `ToolbarMenuSelect` is
|
|
263
|
+
exported for host-app controls that should match the toolbar:
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
<ToolbarMenuSelect
|
|
267
|
+
value={zoom}
|
|
268
|
+
ariaLabel="Document zoom"
|
|
269
|
+
options={[
|
|
270
|
+
{ value: "0.75", label: "75%" },
|
|
271
|
+
{ value: "1", label: "100%" },
|
|
272
|
+
{ value: "1.25", label: "125%" },
|
|
273
|
+
]}
|
|
274
|
+
onChange={setZoom}
|
|
275
|
+
/>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
For selector-level styling, the stable hooks are
|
|
279
|
+
`.dxw-menu-select-trigger`, `.dxw-menu-select-menu`,
|
|
280
|
+
`.dxw-menu-select-option`, `.dxw-color-menu`, `.dxw-color-swatch`,
|
|
281
|
+
`.dxw-input-dialog`, `.dxw-input-dialog-field`, and the dialog action button
|
|
282
|
+
classes. Prefer the variables above for theme changes.
|
|
283
|
+
|
|
241
284
|
Layout controls also expose stable `.dxw-layout-ribbon`, `.dxw-layout-menu-trigger`,
|
|
242
285
|
`.dxw-layout-menu`, `.dxw-layout-menu-item`, and `.dxw-layout-preview` classes.
|
|
243
286
|
Their `data-dxw-layout-menu`, `data-dxw-layout-option`, and
|
package/dist/index.d.ts
CHANGED
|
@@ -753,6 +753,8 @@ interface NoteRefContent {
|
|
|
753
753
|
noteType: "footnote" | "endnote";
|
|
754
754
|
id: number;
|
|
755
755
|
self?: boolean;
|
|
756
|
+
/** The document supplies the visible mark in the following run content. */
|
|
757
|
+
customMarkFollows?: boolean;
|
|
756
758
|
}
|
|
757
759
|
/** w:ruby — an East-Asian ruby (furigana) cluster: an annotation run (w:rt)
|
|
758
760
|
* riding above a base run (w:rubyBase). Both sides render as their own runs;
|
|
@@ -1245,16 +1247,24 @@ declare class DocxDocument {
|
|
|
1245
1247
|
* stable across a plain text edit). */
|
|
1246
1248
|
layoutGlobalSig(): string;
|
|
1247
1249
|
refresh(): void;
|
|
1248
|
-
/**
|
|
1249
|
-
*
|
|
1250
|
-
*
|
|
1251
|
-
*
|
|
1252
|
-
* containers, revisions, bookmarks, and section breaks use refresh().
|
|
1253
|
-
*/
|
|
1250
|
+
/** Reparse the two sibling body-story paragraphs created by Enter without
|
|
1251
|
+
* rebuilding the complete document model. Paragraphs nested in table cells
|
|
1252
|
+
* are included because legal documents spend most of their body inside
|
|
1253
|
+
* tables; revisions, bookmarks, fields, and section breaks use refresh(). */
|
|
1254
1254
|
reparseDirectBodyParagraphSplit(beforeSource: XmlElement, afterSource: XmlElement): {
|
|
1255
1255
|
before: Paragraph;
|
|
1256
1256
|
after: Paragraph;
|
|
1257
1257
|
} | null;
|
|
1258
|
+
/** Reparse a body paragraph plus several new siblings created by
|
|
1259
|
+
* click-and-type without rebuilding the complete document model. */
|
|
1260
|
+
reparseDirectBodyParagraphSplits(beforeSource: XmlElement, afterSources: XmlElement[]): Paragraph[] | null;
|
|
1261
|
+
/** Reparse one retained body-story paragraph after a structural edit that
|
|
1262
|
+
* leaves its surrounding block list unchanged, such as inserting ink. */
|
|
1263
|
+
reparseBodyParagraph(source: XmlElement): Paragraph | null;
|
|
1264
|
+
/** Reparse two sibling body-story paragraphs after Backspace/Delete merged
|
|
1265
|
+
* their XML into one. Keeps the parsed model generation stable so long
|
|
1266
|
+
* documents can use incremental layout instead of repaginating in full. */
|
|
1267
|
+
reparseDirectBodyParagraphMerge(beforeSource: XmlElement, afterSource: XmlElement, survivorSource: XmlElement): Paragraph | null;
|
|
1258
1268
|
private deriveComments;
|
|
1259
1269
|
/** Retained comments tree for edit commands (null when the doc has none). */
|
|
1260
1270
|
/**
|
|
@@ -1792,10 +1802,8 @@ interface LayoutOptions {
|
|
|
1792
1802
|
* type/delete. Lets the incremental scan skip re-hashing every block: it
|
|
1793
1803
|
* re-hashes only the hinted block and its two neighbours and reuses prev's
|
|
1794
1804
|
* per-block signatures for the rest. Purely an optimisation — the fast path
|
|
1795
|
-
* is gated on block
|
|
1796
|
-
*
|
|
1797
|
-
* multi-block edits (paste, paragraph split/merge, undo/redo, structural ops),
|
|
1798
|
-
* which take the full scan. */
|
|
1805
|
+
* is gated on block identity/count and neighbour-signature checks, so a stale
|
|
1806
|
+
* or wrong hint falls through to the full block scan. */
|
|
1799
1807
|
dirtyHint?: XmlElement;
|
|
1800
1808
|
/** Exact retained text element changed by a local edit. Used only to bound
|
|
1801
1809
|
* structural page comparison before the first actually dirty page. */
|
|
@@ -1937,7 +1945,7 @@ interface SelectionFormat {
|
|
|
1937
1945
|
verticalAlign?: "superscript" | "subscript";
|
|
1938
1946
|
}
|
|
1939
1947
|
|
|
1940
|
-
type ShapePreset = "rectangle" | "roundedRectangle" | "ellipse" | "diamond" | "textBox";
|
|
1948
|
+
type ShapePreset = "line" | "rectangle" | "roundedRectangle" | "ellipse" | "diamond" | "textBox";
|
|
1941
1949
|
type WordArtPreset = "plain" | "archUp" | "archDown" | "wave" | "chevron";
|
|
1942
1950
|
type DrawingTool = {
|
|
1943
1951
|
kind?: "pen";
|
|
@@ -2021,6 +2029,30 @@ interface MissingFont {
|
|
|
2021
2029
|
sample: string;
|
|
2022
2030
|
}
|
|
2023
2031
|
|
|
2032
|
+
interface ToolbarMenuSelectOption {
|
|
2033
|
+
value: string;
|
|
2034
|
+
label: React.ReactNode;
|
|
2035
|
+
group?: string;
|
|
2036
|
+
disabled?: boolean;
|
|
2037
|
+
fontFamily?: string;
|
|
2038
|
+
}
|
|
2039
|
+
interface ToolbarMenuSelectProps {
|
|
2040
|
+
value: string;
|
|
2041
|
+
options: ToolbarMenuSelectOption[];
|
|
2042
|
+
onChange: (value: string) => void;
|
|
2043
|
+
placeholder?: React.ReactNode;
|
|
2044
|
+
title?: string;
|
|
2045
|
+
ariaLabel?: string;
|
|
2046
|
+
triggerAriaLabel?: string;
|
|
2047
|
+
width?: number | string;
|
|
2048
|
+
menuWidth?: number;
|
|
2049
|
+
className?: string;
|
|
2050
|
+
style?: React.CSSProperties;
|
|
2051
|
+
}
|
|
2052
|
+
/** CSS-overridable replacement for visible native selects. An inert,
|
|
2053
|
+
* transparent select is kept as an event bridge for existing integrations;
|
|
2054
|
+
* every user-facing part is a button/listbox rendered by us. */
|
|
2055
|
+
declare function ToolbarMenuSelect({ value, options, onChange, placeholder, title, ariaLabel, triggerAriaLabel, width, menuWidth, className, style, }: ToolbarMenuSelectProps): react.JSX.Element;
|
|
2024
2056
|
/** Toolbar control groups a host can disable via the `features` prop. */
|
|
2025
2057
|
type ToolbarFeature = "history" | "styles" | "font" | "size" | "format" | "color" | "highlight" | "alignment" | "indent" | "spacing" | "link" | "lists" | "table" | "image" | "icon" | "screenshot" | "model3D" | "media" | "object" | "chart" | "smartArt" | "comment" | "footnote" | "bookmark" | "crossReference" | "dateTime" | "field" | "equation" | "symbol" | "shape" | "textBox" | "wordArt" | "drawing" | "arrange" | "dropCap" | "headerFooter" | "coverPage" | "pageNumber" | "break" | "layout" | "download";
|
|
2026
2058
|
type ToolbarMode = "simple" | "advanced";
|
|
@@ -2244,4 +2276,4 @@ interface DocxViewProps {
|
|
|
2244
2276
|
*/
|
|
2245
2277
|
declare function DocxView({ source, zoom, fitWidth, narrowWidth, editable, className, style, onLoad, onReady, onError, commentAuthor, showComments, revisions, onMissingFonts, }: DocxViewProps): react.JSX.Element;
|
|
2246
2278
|
|
|
2247
|
-
export { type CoverPageContent, DocxDocument, DocxToolbar, type DocxToolbarProps, DocxView, type DocxViewApi, type DocxViewProps, type DrawingTool, type LineNumberingPatch, type PageLayoutPatch, type ParagraphAlignment, type RunFormatPatch, type ScreenshotInsertResult, type SelectionFormat, type ShapePreset, type ToolbarFeature, type ToolbarMode, layoutDocument, printPages, renderToDom };
|
|
2279
|
+
export { type CoverPageContent, DocxDocument, DocxToolbar, type DocxToolbarProps, DocxView, type DocxViewApi, type DocxViewProps, type DrawingTool, type LineNumberingPatch, type PageLayoutPatch, type ParagraphAlignment, type RunFormatPatch, type ScreenshotInsertResult, type SelectionFormat, type ShapePreset, type ToolbarFeature, ToolbarMenuSelect, type ToolbarMenuSelectOption, type ToolbarMenuSelectProps, type ToolbarMode, layoutDocument, printPages, renderToDom };
|