@twip/web 0.0.0-canary-3e48fc9 → 0.0.0-canary-5a4f96e
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/commands.d.ts +21 -1
- package/dist/commands.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/state.d.ts +65 -0
- package/dist/twip_wasm.wasm +0 -0
- package/package.json +1 -1
package/dist/commands.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RichText } from './review.js';
|
|
2
2
|
import type { ControlKind, ControlOptions, DataBinding } from './services/elements.js';
|
|
3
3
|
import type { TabAlignment, TabLeader } from './services/ruler.js';
|
|
4
|
-
import type { HighlightColor, LineSpacing, MarkupView, ObjectWrap, RowHeight, TableWidth, UnderlineStyle } from './state.js';
|
|
4
|
+
import type { HighlightColor, HorizontalPosition, LineSpacing, MarkupView, ObjectWrap, RowHeight, TableWidth, UnderlineStyle, VerticalPosition, WrapSide } from './state.js';
|
|
5
5
|
import type { Color, CommentId, ElementId, Points, RevisionId, StyleId } from './types.js';
|
|
6
6
|
/** Which elements a field command acts on: the given ids, or the selection's by default. */
|
|
7
7
|
export interface FieldTargets {
|
|
@@ -380,6 +380,25 @@ export interface Commands {
|
|
|
380
380
|
setObjectWrap(wrap: ObjectWrap): Promise<void>;
|
|
381
381
|
/** Locks a floating object's anchor. */
|
|
382
382
|
setAnchorLocked(on: boolean): Promise<void>;
|
|
383
|
+
/**
|
|
384
|
+
* Places the floating object: each axis given is aligned, offset, or (with neither) kept where it is and measured
|
|
385
|
+
* from its new reference; `vertical: { relativeTo: 'page' }` fixes it on the page, `'paragraph'` moves it with text.
|
|
386
|
+
* Unset fields keep their value.
|
|
387
|
+
*/
|
|
388
|
+
setObjectPosition(options: {
|
|
389
|
+
horizontal?: HorizontalPosition;
|
|
390
|
+
vertical?: VerticalPosition;
|
|
391
|
+
allowOverlap?: boolean;
|
|
392
|
+
layoutInCell?: boolean;
|
|
393
|
+
}): Promise<void>;
|
|
394
|
+
/** Sets the sides text wraps on around the floating object and its distance from the text, 0 to 1584; unset fields keep their value. */
|
|
395
|
+
setObjectWrapOptions(options: {
|
|
396
|
+
side?: WrapSide;
|
|
397
|
+
top?: Points;
|
|
398
|
+
bottom?: Points;
|
|
399
|
+
left?: Points;
|
|
400
|
+
right?: Points;
|
|
401
|
+
}): Promise<void>;
|
|
383
402
|
/** Sets the alternative text, or marks the object decorative. */
|
|
384
403
|
setAltText(options: {
|
|
385
404
|
text: string;
|
|
@@ -570,6 +589,7 @@ export interface Commands {
|
|
|
570
589
|
formattingMarks?: boolean;
|
|
571
590
|
gridlines?: boolean;
|
|
572
591
|
textBoundaries?: boolean;
|
|
592
|
+
liveLayout?: boolean;
|
|
573
593
|
}): Promise<void>;
|
|
574
594
|
/** Switches between editing and design mode. */
|
|
575
595
|
setMode(mode: 'editing' | 'design'): Promise<void>;
|
package/dist/commands.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export { Editor, HeadlessEditor } from './editor.js';
|
|
8
8
|
export type { ExportResult, MountOptions, SessionOptions } from './editor.js';
|
|
9
9
|
export type { CommandEntry, CommandId, CommandInfo, Commands, FieldTargets, NoArgumentCommandId, Op, OpArgs, PlaceholderLook, } from './commands.js';
|
|
10
|
-
export type { CharacterFormatting, CommandState, CommandValues, EditorState, ElementContext, HighlightColor, LineSpacing, MarkupView, Mixed, ObjectSelection, ObjectWrap, PageFormatting, ParagraphFormatting, ReviewState, RowHeight, SelectionSummary, TableSelection, TableStyleOptions, TableWidth, Tri, UnderlineStyle, ViewState, } from './state.js';
|
|
10
|
+
export type { CharacterFormatting, CommandState, CommandValues, EditorState, ElementContext, HighlightColor, HorizontalPosition, HorizontalReference, LineSpacing, MarkupView, Mixed, ObjectHorizontalAlignment, ObjectPlacement, ObjectSelection, ObjectVerticalAlignment, ObjectWrap, PageFormatting, ParagraphFormatting, ReviewState, RowHeight, SelectionSummary, TableSelection, TableStyleOptions, TableWidth, TextDistance, Tri, UnderlineStyle, VerticalPosition, VerticalReference, ViewState, WrapSide, } from './state.js';
|
|
11
11
|
export type { HostCommand, Tooltip, TransactionRecord, TwipEvents } from './events.js';
|
|
12
12
|
export { EditorError } from './errors.js';
|
|
13
13
|
export type { ErrorCode } from './errors.js';
|
package/dist/state.d.ts
CHANGED
|
@@ -170,6 +170,7 @@ export interface CommandValues {
|
|
|
170
170
|
formattingMarks: boolean;
|
|
171
171
|
gridlines: boolean;
|
|
172
172
|
textBoundaries: boolean;
|
|
173
|
+
liveLayout: boolean;
|
|
173
174
|
};
|
|
174
175
|
/** The mode. */
|
|
175
176
|
setMode: EditorState['mode'];
|
|
@@ -306,9 +307,71 @@ export interface ObjectSelection {
|
|
|
306
307
|
decorative: boolean;
|
|
307
308
|
/** Whether a floating object's anchor is locked; `null` when inline. */
|
|
308
309
|
anchorLocked: boolean | null;
|
|
310
|
+
/** Where a floating object is and how text keeps from it; `null` when inline. */
|
|
311
|
+
placement: ObjectPlacement | null;
|
|
309
312
|
}
|
|
310
313
|
/** How text wraps around an object. */
|
|
311
314
|
export type ObjectWrap = 'inline' | 'square' | 'tight' | 'through' | 'topAndBottom' | 'behindText' | 'inFrontOfText';
|
|
315
|
+
/** What a floating object's horizontal position is measured from. */
|
|
316
|
+
export type HorizontalReference = 'column' | 'margin' | 'page' | 'character' | 'leftMargin' | 'rightMargin' | 'insideMargin' | 'outsideMargin';
|
|
317
|
+
/** What a floating object's vertical position is measured from: `paragraph` and `line` move it with the text. */
|
|
318
|
+
export type VerticalReference = 'paragraph' | 'line' | 'margin' | 'page' | 'topMargin' | 'bottomMargin' | 'insideMargin' | 'outsideMargin';
|
|
319
|
+
/** A floating object aligned across its horizontal reference. */
|
|
320
|
+
export type ObjectHorizontalAlignment = 'left' | 'center' | 'right' | 'inside' | 'outside';
|
|
321
|
+
/** A floating object aligned across its vertical reference. */
|
|
322
|
+
export type ObjectVerticalAlignment = 'top' | 'center' | 'bottom' | 'inside' | 'outside';
|
|
323
|
+
/** Which sides of a floating object text wraps on. */
|
|
324
|
+
export type WrapSide = 'bothSides' | 'left' | 'right' | 'largest';
|
|
325
|
+
/**
|
|
326
|
+
* A floating object's horizontal place: aligned across its reference, or an offset from the reference's left edge.
|
|
327
|
+
* Set with neither, the object stays where it is, measured from the new reference.
|
|
328
|
+
*/
|
|
329
|
+
export interface HorizontalPosition {
|
|
330
|
+
/** What it is measured from. */
|
|
331
|
+
relativeTo: HorizontalReference;
|
|
332
|
+
/** Aligned across the reference. */
|
|
333
|
+
align?: ObjectHorizontalAlignment;
|
|
334
|
+
/** Right of the reference's left edge, −1584 to 1584. */
|
|
335
|
+
offset?: Points;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* A floating object's vertical place: aligned across its reference, or an offset below the reference's top. Set with
|
|
339
|
+
* neither, the object stays where it is, measured from the new reference.
|
|
340
|
+
*/
|
|
341
|
+
export interface VerticalPosition {
|
|
342
|
+
/** What it is measured from. */
|
|
343
|
+
relativeTo: VerticalReference;
|
|
344
|
+
/** Aligned across the reference. */
|
|
345
|
+
align?: ObjectVerticalAlignment;
|
|
346
|
+
/** Below the reference's top, −1584 to 1584. */
|
|
347
|
+
offset?: Points;
|
|
348
|
+
}
|
|
349
|
+
/** How far text keeps from a floating object. */
|
|
350
|
+
export interface TextDistance {
|
|
351
|
+
/** Above it. */
|
|
352
|
+
top: Points;
|
|
353
|
+
/** Below it. */
|
|
354
|
+
bottom: Points;
|
|
355
|
+
/** On its left. */
|
|
356
|
+
left: Points;
|
|
357
|
+
/** On its right. */
|
|
358
|
+
right: Points;
|
|
359
|
+
}
|
|
360
|
+
/** A floating object's place and its wrapping options. */
|
|
361
|
+
export interface ObjectPlacement {
|
|
362
|
+
/** The horizontal place: an alignment or an offset. */
|
|
363
|
+
horizontal: HorizontalPosition;
|
|
364
|
+
/** The vertical place: an alignment or an offset. */
|
|
365
|
+
vertical: VerticalPosition;
|
|
366
|
+
/** Other floating objects may overlap it. */
|
|
367
|
+
allowOverlap: boolean;
|
|
368
|
+
/** In a table cell, it is kept within the cell. */
|
|
369
|
+
layoutInCell: boolean;
|
|
370
|
+
/** The sides text wraps on. */
|
|
371
|
+
wrapSide: WrapSide;
|
|
372
|
+
/** The distance from the text. */
|
|
373
|
+
distance: TextDistance;
|
|
374
|
+
}
|
|
312
375
|
/** An element the selection is in or covers. */
|
|
313
376
|
export interface ElementContext {
|
|
314
377
|
/** The element. */
|
|
@@ -436,6 +499,8 @@ export interface ViewState {
|
|
|
436
499
|
gridlines: boolean;
|
|
437
500
|
/** Text boundaries are shown. */
|
|
438
501
|
textBoundaries: boolean;
|
|
502
|
+
/** Text wraps around an object again as it is dragged; otherwise a preview shows until the release. */
|
|
503
|
+
liveLayout: boolean;
|
|
439
504
|
/** Field codes are shown. */
|
|
440
505
|
fieldCodes: boolean;
|
|
441
506
|
/** Which built-in rulers are shown. */
|
package/dist/twip_wasm.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twip/web",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-5a4f96e",
|
|
4
4
|
"description": "The Twip DOCX editor for the browser and Node: a managed, framework-independent editor over the WebAssembly engine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|