@nutrient-sdk/document-authoring 1.9.0 → 1.10.0-preview.202511190848.699bffb9b1b1b29b73a48a4e5a94269656184974

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 CHANGED
@@ -78,7 +78,7 @@ the SDK via `npm`).
78
78
 
79
79
  ### Example
80
80
 
81
- You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.9.0-example.zip), unzip it and run:
81
+ You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.10.0-preview.202511190848.699bffb9b1b1b29b73a48a4e5a94269656184974-example.zip), unzip it and run:
82
82
 
83
83
  ```bash
84
84
  npm install
@@ -92,7 +92,7 @@ By default, the Document Authoring SDK will fetch the required files (fonts, emo
92
92
 
93
93
  ### Self-hosting the assets
94
94
 
95
- To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.9.0-assets.zip) and deploy them to a suitable location.
95
+ To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.10.0-preview.202511190848.699bffb9b1b1b29b73a48a4e5a94269656184974-assets.zip) and deploy them to a suitable location.
96
96
  Provide an appropriate base path when initializing the Document Authoring SDK.
97
97
 
98
98
  #### Example:
package/lib/docauth.mjs CHANGED
@@ -14,7 +14,7 @@ var e=[
14
14
  // Style actions
15
15
  {id:"style.apply",label:"Apply Style",description:"Apply a style to the selection"}],i={items:[{type:"built-in",id:"zoom-select",builtInType:"zoom"},{type:"separator",id:"sep-after-zoom"},{type:"built-in",id:"mobile-lock",builtInType:"mobile-lock",visible:e=>!!e.mobile},{type:"separator",id:"separator-after-mobile-lock",visible:e=>!!e.mobile},{type:"built-in",id:"undo-btn",builtInType:"undo",visible:e=>!e.mobile},{type:"built-in",id:"redo-btn",builtInType:"redo",visible:e=>!e.mobile},{type:"separator",id:"sep-after-undo-redo",visible:e=>!e.mobile},{type:"built-in",id:"style-menu",builtInType:"style-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-style",visible:e=>!e.mobile},{type:"built-in",id:"font-family-select",builtInType:"font-family",visible:e=>!e.mobile},{type:"built-in",id:"font-size-input",builtInType:"font-size",visible:e=>!e.mobile},{type:"separator",id:"sep-after-font",visible:e=>!e.mobile},{type:"built-in",id:"bold-btn",builtInType:"bold",visible:e=>!e.mobile},{type:"built-in",id:"italic-btn",builtInType:"italic",visible:e=>!e.mobile},{type:"built-in",id:"underline-btn",builtInType:"underline",visible:e=>!e.mobile},{type:"built-in",id:"strikethrough-btn",builtInType:"strikethrough",visible:e=>!e.mobile},{type:"built-in",id:"subscript-btn",builtInType:"subscript",visible:e=>!e.mobile},{type:"built-in",id:"superscript-btn",builtInType:"superscript",visible:e=>!e.mobile},{type:"separator",id:"sep-after-character-formatting",visible:e=>!e.mobile},{type:"built-in",id:"text-color-picker",builtInType:"text-color",visible:e=>!e.mobile},{type:"built-in",id:"highlight-color-picker",builtInType:"highlight-color",visible:e=>!e.mobile},{type:"separator",id:"sep-after-colors",visible:e=>!e.mobile},{type:"built-in",id:"align-left-btn",builtInType:"align-left",visible:e=>!e.mobile},{type:"built-in",id:"align-center-btn",builtInType:"align-center",visible:e=>!e.mobile},{type:"built-in",id:"align-right-btn",builtInType:"align-right",visible:e=>!e.mobile},{type:"built-in",id:"align-justify-btn",builtInType:"align-justify",visible:e=>!e.mobile},{type:"separator",id:"sep-after-alignment",visible:e=>!e.mobile},{type:"built-in",id:"line-spacing-menu",builtInType:"line-spacing-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-line-spacing",visible:e=>!e.mobile},{type:"built-in",id:"bulleted-list",builtInType:"bulleted-list",visible:e=>!e.mobile},{type:"built-in",id:"numbered-list",builtInType:"numbered-list",visible:e=>!e.mobile},{type:"separator",id:"sep-after-lists",visible:e=>!e.mobile},{type:"built-in",id:"decrease-indent-btn",builtInType:"decrease-indent",visible:e=>!e.mobile},{type:"built-in",id:"increase-indent-btn",builtInType:"increase-indent",visible:e=>!e.mobile},{type:"separator",id:"sep-after-indentation",visible:e=>!e.mobile},{type:"built-in",id:"clear-formatting-btn",builtInType:"clear-formatting",visible:e=>!e.mobile},{type:"built-in",id:"formatting-marks-btn",builtInType:"formatting-marks",visible:e=>!e.mobile},{type:"separator",id:"sep-after-formatting-marks",visible:e=>!e.mobile},{type:"built-in",id:"page-setup-menu",builtInType:"page-setup-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-page-setup",visible:e=>!e.mobile},{type:"built-in",id:"insert-menu",builtInType:"insert-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-insert",visible:e=>!e.mobile},{type:"built-in",id:"table-menu",builtInType:"table-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-table",visible:e=>!e.mobile},{type:"built-in",id:"download-menu",builtInType:"download-menu"},{type:"separator",id:"sep-before-ui-settings",visible:e=>!e.mobile},{type:"built-in",id:"ui-settings-menu",builtInType:"ui-settings-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-ui-settings",visible:e=>!e.mobile}]};
16
16
  // ../packages/ui/src/actions/default-actions-standalone.ts
17
- const t={type:"default-index"};async function l(e){return(await(async e=>{const i=new URL(e??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,t=new URL("docauth-impl-bb2295f65aaabbe8.js",i).href;return import(
17
+ const t={type:"default-index"};async function l(e){return(await(async e=>{const i=new URL(e??"https://document-authoring.cdn.staging.nutrient.io/2025/1/",window.location.href).href,t=new URL("docauth-impl-f92e3c338b35ac07.js",i).href;return import(
18
18
  /*webpackIgnore: true*/
19
19
  /* @vite-ignore */
20
20
  t)})(e?.assets?.base)).createDocAuthSystem(e)}var n={createDocAuthSystem:l,defaultFontIndex:t,defaultActions:e,defaultToolbarConfig:i};export{l as createDocAuthSystem,n as default,e as defaultActions,t as defaultFontIndex,i as defaultToolbarConfig};
@@ -14,7 +14,7 @@
14
14
  // Style actions
15
15
  {id:"style.apply",label:"Apply Style",description:"Apply a style to the selection"}],t={items:[{type:"built-in",id:"zoom-select",builtInType:"zoom"},{type:"separator",id:"sep-after-zoom"},{type:"built-in",id:"mobile-lock",builtInType:"mobile-lock",visible:e=>!!e.mobile},{type:"separator",id:"separator-after-mobile-lock",visible:e=>!!e.mobile},{type:"built-in",id:"undo-btn",builtInType:"undo",visible:e=>!e.mobile},{type:"built-in",id:"redo-btn",builtInType:"redo",visible:e=>!e.mobile},{type:"separator",id:"sep-after-undo-redo",visible:e=>!e.mobile},{type:"built-in",id:"style-menu",builtInType:"style-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-style",visible:e=>!e.mobile},{type:"built-in",id:"font-family-select",builtInType:"font-family",visible:e=>!e.mobile},{type:"built-in",id:"font-size-input",builtInType:"font-size",visible:e=>!e.mobile},{type:"separator",id:"sep-after-font",visible:e=>!e.mobile},{type:"built-in",id:"bold-btn",builtInType:"bold",visible:e=>!e.mobile},{type:"built-in",id:"italic-btn",builtInType:"italic",visible:e=>!e.mobile},{type:"built-in",id:"underline-btn",builtInType:"underline",visible:e=>!e.mobile},{type:"built-in",id:"strikethrough-btn",builtInType:"strikethrough",visible:e=>!e.mobile},{type:"built-in",id:"subscript-btn",builtInType:"subscript",visible:e=>!e.mobile},{type:"built-in",id:"superscript-btn",builtInType:"superscript",visible:e=>!e.mobile},{type:"separator",id:"sep-after-character-formatting",visible:e=>!e.mobile},{type:"built-in",id:"text-color-picker",builtInType:"text-color",visible:e=>!e.mobile},{type:"built-in",id:"highlight-color-picker",builtInType:"highlight-color",visible:e=>!e.mobile},{type:"separator",id:"sep-after-colors",visible:e=>!e.mobile},{type:"built-in",id:"align-left-btn",builtInType:"align-left",visible:e=>!e.mobile},{type:"built-in",id:"align-center-btn",builtInType:"align-center",visible:e=>!e.mobile},{type:"built-in",id:"align-right-btn",builtInType:"align-right",visible:e=>!e.mobile},{type:"built-in",id:"align-justify-btn",builtInType:"align-justify",visible:e=>!e.mobile},{type:"separator",id:"sep-after-alignment",visible:e=>!e.mobile},{type:"built-in",id:"line-spacing-menu",builtInType:"line-spacing-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-line-spacing",visible:e=>!e.mobile},{type:"built-in",id:"bulleted-list",builtInType:"bulleted-list",visible:e=>!e.mobile},{type:"built-in",id:"numbered-list",builtInType:"numbered-list",visible:e=>!e.mobile},{type:"separator",id:"sep-after-lists",visible:e=>!e.mobile},{type:"built-in",id:"decrease-indent-btn",builtInType:"decrease-indent",visible:e=>!e.mobile},{type:"built-in",id:"increase-indent-btn",builtInType:"increase-indent",visible:e=>!e.mobile},{type:"separator",id:"sep-after-indentation",visible:e=>!e.mobile},{type:"built-in",id:"clear-formatting-btn",builtInType:"clear-formatting",visible:e=>!e.mobile},{type:"built-in",id:"formatting-marks-btn",builtInType:"formatting-marks",visible:e=>!e.mobile},{type:"separator",id:"sep-after-formatting-marks",visible:e=>!e.mobile},{type:"built-in",id:"page-setup-menu",builtInType:"page-setup-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-page-setup",visible:e=>!e.mobile},{type:"built-in",id:"insert-menu",builtInType:"insert-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-insert",visible:e=>!e.mobile},{type:"built-in",id:"table-menu",builtInType:"table-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-table",visible:e=>!e.mobile},{type:"built-in",id:"download-menu",builtInType:"download-menu"},{type:"separator",id:"sep-before-ui-settings",visible:e=>!e.mobile},{type:"built-in",id:"ui-settings-menu",builtInType:"ui-settings-menu",visible:e=>!e.mobile},{type:"separator",id:"sep-after-ui-settings",visible:e=>!e.mobile}]};
16
16
  // ../packages/ui/src/actions/default-actions-standalone.ts
17
- const l={type:"default-index"};async function n(e){return(await(async e=>{const i=new URL(e??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,t=new URL("docauth-impl-bb2295f65aaabbe8.js",i).href;return import(
17
+ const l={type:"default-index"};async function n(e){return(await(async e=>{const i=new URL(e??"https://document-authoring.cdn.staging.nutrient.io/2025/1/",window.location.href).href,t=new URL("docauth-impl-f92e3c338b35ac07.js",i).href;return import(
18
18
  /*webpackIgnore: true*/
19
19
  /* @vite-ignore */
20
20
  t)})(e?.assets?.base)).createDocAuthSystem(e)}var o={createDocAuthSystem:n,defaultFontIndex:l,defaultActions:i,defaultToolbarConfig:t};e.createDocAuthSystem=n,e.default=o,e.defaultActions=i,e.defaultFontIndex=l,e.defaultToolbarConfig=t,Object.defineProperty(e,"__esModule",{value:!0})}));
package/lib/index.d.cts CHANGED
@@ -400,8 +400,14 @@ export declare type CreateEditorOptions = {
400
400
  * Allows toggling/changing various UI options.
401
401
  */
402
402
  ui?: UIOptions;
403
-
404
-
403
+ /**
404
+ * @internal
405
+ */
406
+ __hideDOCXDownload?: boolean;
407
+ /**
408
+ * @internal
409
+ */
410
+ __hidePDFDownload?: boolean;
405
411
  };
406
412
 
407
413
  /**
@@ -631,7 +637,10 @@ export declare type DocAuthDocument = {
631
637
  * @see <a href="https://www.nutrient.io/guides/document-authoring/working-with-documents/docx/" target="_blank">DOCX export guide</a>
632
638
  */
633
639
  exportDOCX(options?: ExportDOCXOptions): Promise<ArrayBuffer>;
634
-
640
+ /**
641
+ * @alpha
642
+ */
643
+ transaction<T = void>(callback: TransactionCallback<T>): Promise<T>;
635
644
  /**
636
645
  * The `DocAuthSystem` this document is bound to.
637
646
  */
@@ -1352,6 +1361,287 @@ export declare type ImportDOCXOptions = {
1352
1361
  */
1353
1362
  export declare type Locale = 'en' | 'fr' | 'de';
1354
1363
 
1364
+ /**
1365
+ * @alpha
1366
+ * @sidebarGroup programmatic api
1367
+ */
1368
+ export declare namespace Programmatic {
1369
+ /**
1370
+ * @sidebarGroup programmatic api
1371
+ */
1372
+ export type Range = {
1373
+ begin: number;
1374
+ end?: number;
1375
+ };
1376
+ /**
1377
+ * @sidebarGroup programmatic api
1378
+ */
1379
+ export type Formatting = {
1380
+ font: string | null;
1381
+ fontSize: number | null;
1382
+ bold: boolean | null;
1383
+ italic: boolean | null;
1384
+ color: string | null;
1385
+ highlight: string | null;
1386
+ strikeout: boolean | null;
1387
+ underline: boolean | null;
1388
+ };
1389
+ /**
1390
+ * @sidebarGroup programmatic api
1391
+ */
1392
+ export type SearchFor = string | RegExp;
1393
+ /**
1394
+ * @sidebarGroup programmatic api
1395
+ */
1396
+ export type Replacement = {
1397
+ text?: string;
1398
+ formatting?: Partial<Formatting>;
1399
+ };
1400
+ /**
1401
+ * @sidebarGroup programmatic api
1402
+ */
1403
+ export type ReplaceFn = (value: string) => Replacement | string;
1404
+ /**
1405
+ * @sidebarGroup programmatic api
1406
+ */
1407
+ export type ReplacementOrReplaceFn = Replacement | ReplaceFn | string;
1408
+ /**
1409
+ * @sidebarGroup programmatic api
1410
+ */
1411
+ export type ReplaceTextSignature = (searchFor: SearchFor, replace: ReplacementOrReplaceFn) => number;
1412
+ /**
1413
+ * @sidebarGroup programmatic api
1414
+ */
1415
+ export type SearchResult = {
1416
+ range: Range;
1417
+ text: string;
1418
+ };
1419
+ /**
1420
+ * @sidebarGroup programmatic api
1421
+ */
1422
+ export type TextView = {
1423
+ getPlainText(range?: Range): string;
1424
+ searchText(searchFor: SearchFor, after?: Range): SearchResult | undefined;
1425
+ replaceText: ReplaceTextSignature;
1426
+ setText(value: string, range?: Range): Range;
1427
+ setFormatting(formatting: Partial<Formatting>, range?: Range): void;
1428
+ inlines(): RangeInline[];
1429
+ addLineBreak(insertionPoint?: {
1430
+ placement: 'before' | 'after';
1431
+ range: Range;
1432
+ }): LineBreak;
1433
+ addInlineText(text: string, insertionPoint?: {
1434
+ placement: 'before' | 'after';
1435
+ range: Range;
1436
+ }): InlineText;
1437
+ removeInline(index?: number): Inline | undefined;
1438
+ };
1439
+ /**
1440
+ * @sidebarGroup programmatic api
1441
+ */
1442
+ export type Extent = {
1443
+ width: number;
1444
+ height: number;
1445
+ };
1446
+ /**
1447
+ * @sidebarGroup programmatic api
1448
+ */
1449
+ export type Image = {
1450
+ type: 'image';
1451
+ extent(): Extent;
1452
+ setExtent(extent: Partial<Extent>): void;
1453
+ };
1454
+ /**
1455
+ * @sidebarGroup programmatic api
1456
+ */
1457
+ export type Field = {
1458
+ type: 'field';
1459
+ };
1460
+ /**
1461
+ * @sidebarGroup programmatic api
1462
+ */
1463
+ export type Footnote = {
1464
+ type: 'footnote';
1465
+ };
1466
+ /**
1467
+ * @sidebarGroup programmatic api
1468
+ */
1469
+ export type FootnoteRef = {
1470
+ type: 'footnote/ref';
1471
+ };
1472
+ /**
1473
+ * @sidebarGroup programmatic api
1474
+ */
1475
+ export type Endnote = {
1476
+ type: 'endnote';
1477
+ };
1478
+ /**
1479
+ * @sidebarGroup programmatic api
1480
+ */
1481
+ export type EndnoteRef = {
1482
+ type: 'endnote/ref';
1483
+ };
1484
+ /**
1485
+ * @sidebarGroup programmatic api
1486
+ */
1487
+ export type LineBreak = {
1488
+ type: 'line-break';
1489
+ };
1490
+ /**
1491
+ * @sidebarGroup programmatic api
1492
+ */
1493
+ export type PageBreak = {
1494
+ type: 'page-break';
1495
+ };
1496
+ /**
1497
+ * @sidebarGroup programmatic api
1498
+ */
1499
+ export type Tab = {
1500
+ type: 'tab';
1501
+ };
1502
+ /**
1503
+ * @sidebarGroup programmatic api
1504
+ */
1505
+ export type Separator = {
1506
+ type: 'sep';
1507
+ };
1508
+ /**
1509
+ * @sidebarGroup programmatic api
1510
+ */
1511
+ export type InlineText = {
1512
+ type: 'text';
1513
+ plainText(): string;
1514
+ formatting(): Formatting;
1515
+ };
1516
+ /**
1517
+ * @sidebarGroup programmatic api
1518
+ */
1519
+ export type Inline = InlineText | Tab | Separator | LineBreak | PageBreak | Image | Field | Footnote | FootnoteRef | Endnote | EndnoteRef;
1520
+ /**
1521
+ * @sidebarGroup programmatic api
1522
+ */
1523
+ export type RangeInline = {
1524
+ range: Range;
1525
+ inline: Inline;
1526
+ };
1527
+ /**
1528
+ * @sidebarGroup programmatic api
1529
+ */
1530
+ export type Paragraph = {
1531
+ type: 'paragraph';
1532
+ asTextView(): TextView;
1533
+ replaceText: ReplaceTextSignature;
1534
+ };
1535
+ /**
1536
+ * @sidebarGroup programmatic api
1537
+ */
1538
+ export type TableCell = BlockLevelContainer;
1539
+ /**
1540
+ * @sidebarGroup programmatic api
1541
+ */
1542
+ export type TableRow = {
1543
+ cells(): TableCell[];
1544
+ addCell(index?: number): TableCell;
1545
+ removeCell(index: number): TableCell | undefined;
1546
+ replaceText: ReplaceTextSignature;
1547
+ };
1548
+ /**
1549
+ * @sidebarGroup programmatic api
1550
+ */
1551
+ export type Table = {
1552
+ type: 'table';
1553
+ rows(): TableRow[];
1554
+ addRow(index?: number): TableRow;
1555
+ removeRow(index: number): TableRow | undefined;
1556
+ replaceText: ReplaceTextSignature;
1557
+ };
1558
+ /**
1559
+ * @sidebarGroup programmatic api
1560
+ */
1561
+ export type BlockLevel = Paragraph | Table;
1562
+ /**
1563
+ * @sidebarGroup programmatic api
1564
+ */
1565
+ export type BlockLevelContainer = {
1566
+ blocklevels(): BlockLevel[];
1567
+ addParagraph(index?: number): Paragraph;
1568
+ addTable(index?: number): Table;
1569
+ removeElement(index: number): BlockLevel | undefined;
1570
+ replaceText: ReplaceTextSignature;
1571
+ };
1572
+ /**
1573
+ * @sidebarGroup programmatic api
1574
+ */
1575
+ export type PageSize = {
1576
+ width: number;
1577
+ height: number;
1578
+ };
1579
+ /**
1580
+ * @sidebarGroup programmatic api
1581
+ */
1582
+ export type PageMargins = {
1583
+ left: number;
1584
+ right: number;
1585
+ top: number;
1586
+ bottom: number;
1587
+ };
1588
+ /**
1589
+ * @sidebarGroup programmatic api
1590
+ */
1591
+ export type PageSetup = {
1592
+ setPageSize(size: Partial<PageSize>): void;
1593
+ setPageMargins(margins: Partial<PageMargins>): void;
1594
+ pageSize(): PageSize;
1595
+ pageMargins(): PageMargins;
1596
+ };
1597
+ /**
1598
+ * @sidebarGroup programmatic api
1599
+ */
1600
+ export type HeaderFooter = BlockLevelContainer;
1601
+ /**
1602
+ * @sidebarGroup programmatic api
1603
+ */
1604
+ export type HeadersFooters = {
1605
+ default(): HeaderFooter | null;
1606
+ first(): HeaderFooter | null;
1607
+ even(): HeaderFooter | null;
1608
+ replaceText: ReplaceTextSignature;
1609
+ };
1610
+ /**
1611
+ * @sidebarGroup programmatic api
1612
+ */
1613
+ export type HeadersAndFooters = {
1614
+ headers(): HeadersFooters;
1615
+ footers(): HeadersFooters;
1616
+ replaceText: ReplaceTextSignature;
1617
+ };
1618
+ /**
1619
+ * @sidebarGroup programmatic api
1620
+ */
1621
+ export type Section = {
1622
+ pageSetup(): PageSetup;
1623
+ headersAndFooters(): HeadersAndFooters;
1624
+ content(): BlockLevelContainer;
1625
+ };
1626
+ /**
1627
+ * @sidebarGroup programmatic api
1628
+ */
1629
+ export type Body = {
1630
+ sections(): Section[];
1631
+ addSection(index?: number): Section;
1632
+ removeSection(index: number): Section | undefined;
1633
+ replaceText: ReplaceTextSignature;
1634
+ };
1635
+ /**
1636
+ * @sidebarGroup programmatic api
1637
+ */
1638
+ export type Document = {
1639
+ body(): Body;
1640
+ replaceText: ReplaceTextSignature;
1641
+ };
1642
+ {};
1643
+ }
1644
+
1355
1645
  /**
1356
1646
  * Toolbar API - Type definitions for customizing the editor toolbar
1357
1647
  */
@@ -1553,6 +1843,28 @@ export declare type ToolbarSeparatorItem = {
1553
1843
  id: string;
1554
1844
  };
1555
1845
 
1846
+ /**
1847
+ * @alpha
1848
+ * @sidebarGroup programmatic api
1849
+ * @see {@link DocAuthDocument.transaction} for running transactions with this callback type.
1850
+ */
1851
+ export declare type TransactionCallback<T = void> = (context: {
1852
+ draft: Programmatic.Document;
1853
+ }) => Promise<TransactionResult<T>>;
1854
+
1855
+ /**
1856
+ * @alpha
1857
+ * @sidebarGroup programmatic api
1858
+ * @see {@link TransactionCallback} for the callback signature that returns this result type.
1859
+ */
1860
+ export declare type TransactionResult<T = void> = undefined | boolean | {
1861
+ commit: boolean;
1862
+ result: T;
1863
+ } | Promise<undefined | boolean | {
1864
+ commit: boolean;
1865
+ result: T;
1866
+ }>;
1867
+
1556
1868
  /**
1557
1869
  * Configuration options for the user interface.
1558
1870
  *
@@ -1588,7 +1900,16 @@ export declare type UIOptions = {
1588
1900
  */
1589
1901
  enabled: boolean;
1590
1902
  };
1591
-
1903
+ /**
1904
+ * @internal
1905
+ *
1906
+ * Initial zoom level for the editor.
1907
+ *
1908
+ * Valid range is 0.5 to 4.0, which any values provided will be clamped to.
1909
+ *
1910
+ * @defaultValue `1`
1911
+ */
1912
+ initialZoom?: number;
1592
1913
  /**
1593
1914
  * Initial toolbar configuration.
1594
1915
  *
package/lib/index.d.mts CHANGED
@@ -400,8 +400,14 @@ export declare type CreateEditorOptions = {
400
400
  * Allows toggling/changing various UI options.
401
401
  */
402
402
  ui?: UIOptions;
403
-
404
-
403
+ /**
404
+ * @internal
405
+ */
406
+ __hideDOCXDownload?: boolean;
407
+ /**
408
+ * @internal
409
+ */
410
+ __hidePDFDownload?: boolean;
405
411
  };
406
412
 
407
413
  /**
@@ -631,7 +637,10 @@ export declare type DocAuthDocument = {
631
637
  * @see <a href="https://www.nutrient.io/guides/document-authoring/working-with-documents/docx/" target="_blank">DOCX export guide</a>
632
638
  */
633
639
  exportDOCX(options?: ExportDOCXOptions): Promise<ArrayBuffer>;
634
-
640
+ /**
641
+ * @alpha
642
+ */
643
+ transaction<T = void>(callback: TransactionCallback<T>): Promise<T>;
635
644
  /**
636
645
  * The `DocAuthSystem` this document is bound to.
637
646
  */
@@ -1352,6 +1361,287 @@ export declare type ImportDOCXOptions = {
1352
1361
  */
1353
1362
  export declare type Locale = 'en' | 'fr' | 'de';
1354
1363
 
1364
+ /**
1365
+ * @alpha
1366
+ * @sidebarGroup programmatic api
1367
+ */
1368
+ export declare namespace Programmatic {
1369
+ /**
1370
+ * @sidebarGroup programmatic api
1371
+ */
1372
+ export type Range = {
1373
+ begin: number;
1374
+ end?: number;
1375
+ };
1376
+ /**
1377
+ * @sidebarGroup programmatic api
1378
+ */
1379
+ export type Formatting = {
1380
+ font: string | null;
1381
+ fontSize: number | null;
1382
+ bold: boolean | null;
1383
+ italic: boolean | null;
1384
+ color: string | null;
1385
+ highlight: string | null;
1386
+ strikeout: boolean | null;
1387
+ underline: boolean | null;
1388
+ };
1389
+ /**
1390
+ * @sidebarGroup programmatic api
1391
+ */
1392
+ export type SearchFor = string | RegExp;
1393
+ /**
1394
+ * @sidebarGroup programmatic api
1395
+ */
1396
+ export type Replacement = {
1397
+ text?: string;
1398
+ formatting?: Partial<Formatting>;
1399
+ };
1400
+ /**
1401
+ * @sidebarGroup programmatic api
1402
+ */
1403
+ export type ReplaceFn = (value: string) => Replacement | string;
1404
+ /**
1405
+ * @sidebarGroup programmatic api
1406
+ */
1407
+ export type ReplacementOrReplaceFn = Replacement | ReplaceFn | string;
1408
+ /**
1409
+ * @sidebarGroup programmatic api
1410
+ */
1411
+ export type ReplaceTextSignature = (searchFor: SearchFor, replace: ReplacementOrReplaceFn) => number;
1412
+ /**
1413
+ * @sidebarGroup programmatic api
1414
+ */
1415
+ export type SearchResult = {
1416
+ range: Range;
1417
+ text: string;
1418
+ };
1419
+ /**
1420
+ * @sidebarGroup programmatic api
1421
+ */
1422
+ export type TextView = {
1423
+ getPlainText(range?: Range): string;
1424
+ searchText(searchFor: SearchFor, after?: Range): SearchResult | undefined;
1425
+ replaceText: ReplaceTextSignature;
1426
+ setText(value: string, range?: Range): Range;
1427
+ setFormatting(formatting: Partial<Formatting>, range?: Range): void;
1428
+ inlines(): RangeInline[];
1429
+ addLineBreak(insertionPoint?: {
1430
+ placement: 'before' | 'after';
1431
+ range: Range;
1432
+ }): LineBreak;
1433
+ addInlineText(text: string, insertionPoint?: {
1434
+ placement: 'before' | 'after';
1435
+ range: Range;
1436
+ }): InlineText;
1437
+ removeInline(index?: number): Inline | undefined;
1438
+ };
1439
+ /**
1440
+ * @sidebarGroup programmatic api
1441
+ */
1442
+ export type Extent = {
1443
+ width: number;
1444
+ height: number;
1445
+ };
1446
+ /**
1447
+ * @sidebarGroup programmatic api
1448
+ */
1449
+ export type Image = {
1450
+ type: 'image';
1451
+ extent(): Extent;
1452
+ setExtent(extent: Partial<Extent>): void;
1453
+ };
1454
+ /**
1455
+ * @sidebarGroup programmatic api
1456
+ */
1457
+ export type Field = {
1458
+ type: 'field';
1459
+ };
1460
+ /**
1461
+ * @sidebarGroup programmatic api
1462
+ */
1463
+ export type Footnote = {
1464
+ type: 'footnote';
1465
+ };
1466
+ /**
1467
+ * @sidebarGroup programmatic api
1468
+ */
1469
+ export type FootnoteRef = {
1470
+ type: 'footnote/ref';
1471
+ };
1472
+ /**
1473
+ * @sidebarGroup programmatic api
1474
+ */
1475
+ export type Endnote = {
1476
+ type: 'endnote';
1477
+ };
1478
+ /**
1479
+ * @sidebarGroup programmatic api
1480
+ */
1481
+ export type EndnoteRef = {
1482
+ type: 'endnote/ref';
1483
+ };
1484
+ /**
1485
+ * @sidebarGroup programmatic api
1486
+ */
1487
+ export type LineBreak = {
1488
+ type: 'line-break';
1489
+ };
1490
+ /**
1491
+ * @sidebarGroup programmatic api
1492
+ */
1493
+ export type PageBreak = {
1494
+ type: 'page-break';
1495
+ };
1496
+ /**
1497
+ * @sidebarGroup programmatic api
1498
+ */
1499
+ export type Tab = {
1500
+ type: 'tab';
1501
+ };
1502
+ /**
1503
+ * @sidebarGroup programmatic api
1504
+ */
1505
+ export type Separator = {
1506
+ type: 'sep';
1507
+ };
1508
+ /**
1509
+ * @sidebarGroup programmatic api
1510
+ */
1511
+ export type InlineText = {
1512
+ type: 'text';
1513
+ plainText(): string;
1514
+ formatting(): Formatting;
1515
+ };
1516
+ /**
1517
+ * @sidebarGroup programmatic api
1518
+ */
1519
+ export type Inline = InlineText | Tab | Separator | LineBreak | PageBreak | Image | Field | Footnote | FootnoteRef | Endnote | EndnoteRef;
1520
+ /**
1521
+ * @sidebarGroup programmatic api
1522
+ */
1523
+ export type RangeInline = {
1524
+ range: Range;
1525
+ inline: Inline;
1526
+ };
1527
+ /**
1528
+ * @sidebarGroup programmatic api
1529
+ */
1530
+ export type Paragraph = {
1531
+ type: 'paragraph';
1532
+ asTextView(): TextView;
1533
+ replaceText: ReplaceTextSignature;
1534
+ };
1535
+ /**
1536
+ * @sidebarGroup programmatic api
1537
+ */
1538
+ export type TableCell = BlockLevelContainer;
1539
+ /**
1540
+ * @sidebarGroup programmatic api
1541
+ */
1542
+ export type TableRow = {
1543
+ cells(): TableCell[];
1544
+ addCell(index?: number): TableCell;
1545
+ removeCell(index: number): TableCell | undefined;
1546
+ replaceText: ReplaceTextSignature;
1547
+ };
1548
+ /**
1549
+ * @sidebarGroup programmatic api
1550
+ */
1551
+ export type Table = {
1552
+ type: 'table';
1553
+ rows(): TableRow[];
1554
+ addRow(index?: number): TableRow;
1555
+ removeRow(index: number): TableRow | undefined;
1556
+ replaceText: ReplaceTextSignature;
1557
+ };
1558
+ /**
1559
+ * @sidebarGroup programmatic api
1560
+ */
1561
+ export type BlockLevel = Paragraph | Table;
1562
+ /**
1563
+ * @sidebarGroup programmatic api
1564
+ */
1565
+ export type BlockLevelContainer = {
1566
+ blocklevels(): BlockLevel[];
1567
+ addParagraph(index?: number): Paragraph;
1568
+ addTable(index?: number): Table;
1569
+ removeElement(index: number): BlockLevel | undefined;
1570
+ replaceText: ReplaceTextSignature;
1571
+ };
1572
+ /**
1573
+ * @sidebarGroup programmatic api
1574
+ */
1575
+ export type PageSize = {
1576
+ width: number;
1577
+ height: number;
1578
+ };
1579
+ /**
1580
+ * @sidebarGroup programmatic api
1581
+ */
1582
+ export type PageMargins = {
1583
+ left: number;
1584
+ right: number;
1585
+ top: number;
1586
+ bottom: number;
1587
+ };
1588
+ /**
1589
+ * @sidebarGroup programmatic api
1590
+ */
1591
+ export type PageSetup = {
1592
+ setPageSize(size: Partial<PageSize>): void;
1593
+ setPageMargins(margins: Partial<PageMargins>): void;
1594
+ pageSize(): PageSize;
1595
+ pageMargins(): PageMargins;
1596
+ };
1597
+ /**
1598
+ * @sidebarGroup programmatic api
1599
+ */
1600
+ export type HeaderFooter = BlockLevelContainer;
1601
+ /**
1602
+ * @sidebarGroup programmatic api
1603
+ */
1604
+ export type HeadersFooters = {
1605
+ default(): HeaderFooter | null;
1606
+ first(): HeaderFooter | null;
1607
+ even(): HeaderFooter | null;
1608
+ replaceText: ReplaceTextSignature;
1609
+ };
1610
+ /**
1611
+ * @sidebarGroup programmatic api
1612
+ */
1613
+ export type HeadersAndFooters = {
1614
+ headers(): HeadersFooters;
1615
+ footers(): HeadersFooters;
1616
+ replaceText: ReplaceTextSignature;
1617
+ };
1618
+ /**
1619
+ * @sidebarGroup programmatic api
1620
+ */
1621
+ export type Section = {
1622
+ pageSetup(): PageSetup;
1623
+ headersAndFooters(): HeadersAndFooters;
1624
+ content(): BlockLevelContainer;
1625
+ };
1626
+ /**
1627
+ * @sidebarGroup programmatic api
1628
+ */
1629
+ export type Body = {
1630
+ sections(): Section[];
1631
+ addSection(index?: number): Section;
1632
+ removeSection(index: number): Section | undefined;
1633
+ replaceText: ReplaceTextSignature;
1634
+ };
1635
+ /**
1636
+ * @sidebarGroup programmatic api
1637
+ */
1638
+ export type Document = {
1639
+ body(): Body;
1640
+ replaceText: ReplaceTextSignature;
1641
+ };
1642
+ {};
1643
+ }
1644
+
1355
1645
  /**
1356
1646
  * Toolbar API - Type definitions for customizing the editor toolbar
1357
1647
  */
@@ -1553,6 +1843,28 @@ export declare type ToolbarSeparatorItem = {
1553
1843
  id: string;
1554
1844
  };
1555
1845
 
1846
+ /**
1847
+ * @alpha
1848
+ * @sidebarGroup programmatic api
1849
+ * @see {@link DocAuthDocument.transaction} for running transactions with this callback type.
1850
+ */
1851
+ export declare type TransactionCallback<T = void> = (context: {
1852
+ draft: Programmatic.Document;
1853
+ }) => Promise<TransactionResult<T>>;
1854
+
1855
+ /**
1856
+ * @alpha
1857
+ * @sidebarGroup programmatic api
1858
+ * @see {@link TransactionCallback} for the callback signature that returns this result type.
1859
+ */
1860
+ export declare type TransactionResult<T = void> = undefined | boolean | {
1861
+ commit: boolean;
1862
+ result: T;
1863
+ } | Promise<undefined | boolean | {
1864
+ commit: boolean;
1865
+ result: T;
1866
+ }>;
1867
+
1556
1868
  /**
1557
1869
  * Configuration options for the user interface.
1558
1870
  *
@@ -1588,7 +1900,16 @@ export declare type UIOptions = {
1588
1900
  */
1589
1901
  enabled: boolean;
1590
1902
  };
1591
-
1903
+ /**
1904
+ * @internal
1905
+ *
1906
+ * Initial zoom level for the editor.
1907
+ *
1908
+ * Valid range is 0.5 to 4.0, which any values provided will be clamped to.
1909
+ *
1910
+ * @defaultValue `1`
1911
+ */
1912
+ initialZoom?: number;
1592
1913
  /**
1593
1914
  * Initial toolbar configuration.
1594
1915
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutrient-sdk/document-authoring",
3
- "version": "1.9.0",
3
+ "version": "1.10.0-preview.202511190848.699bffb9b1b1b29b73a48a4e5a94269656184974",
4
4
  "description": "A web SDK for word processing and rich text capabilities.",
5
5
  "type": "commonjs",
6
6
  "main": "lib/docauth.umd.js",