@cesdk/node 1.75.0-nightly.20260424 → 1.75.0-nightly.20260428

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
@@ -23,10 +23,15 @@ npm install --save @cesdk/node
23
23
  ```
24
24
 
25
25
  or with `yarn`
26
- ```bash
26
+ ```bash
27
27
  yarn add @cesdk/node
28
28
  ```
29
29
 
30
+ or with `pnpm`
31
+ ```bash
32
+ pnpm add @cesdk/node
33
+ ```
34
+
30
35
  ## 2. Instantiate Creative Engine
31
36
  The last step involves the configuration and instantiation of the SDK.
32
37
 
package/index.d.ts CHANGED
@@ -4419,6 +4419,41 @@ export declare class BlockAPI {
4419
4419
  * @param to - The end index of the UTF-16 range. Defaults to the end of the current selection or text.
4420
4420
  */
4421
4421
  toggleTextDecorationOverline(id: DesignBlockId, from?: number, to?: number): void;
4422
+ /**
4423
+ * Gets the paragraph-level horizontal alignment override for a specific paragraph,
4424
+ * or the block-level alignment.
4425
+ *
4426
+ * ```javascript
4427
+ * const alignment = engine.block.getTextHorizontalAlignment(text, 0);
4428
+ * const blockAlignment = engine.block.getTextHorizontalAlignment(text); // paragraphIndex defaults to -1
4429
+ * // e.g. 'Left' | 'Center' | 'Right' | 'Auto' | undefined
4430
+ * ```
4431
+ *
4432
+ * @category Block Text
4433
+ * @param id - The text block to query.
4434
+ * @param paragraphIndex - The 0-based index of the paragraph to query.
4435
+ * Negative values return the block-level `text/horizontalAlignment` setting.
4436
+ * @returns The paragraph override, `undefined` if no override is set,
4437
+ * or the block-level alignment when `paragraphIndex < 0`.
4438
+ */
4439
+ getTextHorizontalAlignment(id: DesignBlockId, paragraphIndex?: number): TextHorizontalAlignment | undefined;
4440
+ /**
4441
+ * Sets the paragraph-level horizontal alignment override for one or all paragraphs.
4442
+ *
4443
+ * ```javascript
4444
+ * engine.block.setTextHorizontalAlignment(text, 'Center', 0);
4445
+ * engine.block.setTextHorizontalAlignment(text, undefined, 0); // clear override
4446
+ * engine.block.setTextHorizontalAlignment(text, 'Right'); // apply to all
4447
+ * ```
4448
+ *
4449
+ * @category Block Text
4450
+ * @param id - The text block to modify.
4451
+ * @param alignment - The alignment to apply, or `undefined` to clear the paragraph override.
4452
+ * @param paragraphIndex - The 0-based index of the paragraph.
4453
+ * Negative values clear all paragraph-level alignment overrides and, when `alignment` is provided,
4454
+ * apply that alignment to the whole text block.
4455
+ */
4456
+ setTextHorizontalAlignment(id: DesignBlockId, alignment: TextHorizontalAlignment | undefined, paragraphIndex?: number): void;
4422
4457
  /**
4423
4458
  * Gets the list style for a specific paragraph of a text block.
4424
4459
  *
@@ -4479,15 +4514,23 @@ export declare class BlockAPI {
4479
4514
  /**
4480
4515
  * Returns the 0-based paragraph indices that overlap the given UTF-16 range.
4481
4516
  *
4517
+ * The range is half-open (exclusive): `from` is inclusive, `to` is exclusive (one past the last
4518
+ * code unit of interest). When `from === to` the range is a cursor position and the paragraph
4519
+ * containing `from` is returned. This convention matches `getTextCursorRange`, so the values
4520
+ * it returns can be passed directly without adjustment.
4521
+ *
4522
+ * Negative values for either parameter cause all paragraph indices to be returned.
4523
+ *
4482
4524
  * ```javascript
4483
4525
  * const indices = engine.block.getTextParagraphIndices(text);
4484
- * const indices = engine.block.getTextParagraphIndices(text, 0, 5);
4526
+ * const { from, to } = engine.block.getTextCursorRange();
4527
+ * const indices = engine.block.getTextParagraphIndices(text, from, to);
4485
4528
  * ```
4486
4529
  *
4487
4530
  * @category Block Text
4488
4531
  * @param id - The text block to query.
4489
- * @param from - The start index of the UTF-16 range. Negative values reference the entire text.
4490
- * @param to - The end index of the UTF-16 range. Negative values reference the entire text.
4532
+ * @param from - The inclusive start UTF-16 index. Negative values reference the entire text.
4533
+ * @param to - The exclusive end UTF-16 index. Negative values reference the entire text.
4491
4534
  * @returns The paragraph indices overlapping the range.
4492
4535
  */
4493
4536
  getTextParagraphIndices(id: DesignBlockId, from?: number, to?: number): number[];
@@ -4618,7 +4661,10 @@ export declare class BlockAPI {
4618
4661
  /**
4619
4662
  * Gets the current text cursor or selection range.
4620
4663
  *
4621
- * Returns the UTF-16 indices of the selected range of the text block that is currently being edited.
4664
+ * Returns the UTF-16 indices of the selected range of the text block that is currently being
4665
+ * edited. The range is half-open (exclusive): `from` is the index of the first selected code
4666
+ * unit, `to` is one past the last selected code unit. When `from === to` the cursor is
4667
+ * positioned between characters with no text selected.
4622
4668
  *
4623
4669
  * ```javascript
4624
4670
  * const selectedRange = engine.block.getTextCursorRange();
@@ -5920,10 +5966,11 @@ export declare interface CompleteAssetResult extends AssetResult {
5920
5966
  * Compression format for scene serialization.
5921
5967
  * @public
5922
5968
  */
5923
- export declare enum CompressionFormat {
5969
+ declare enum CompressionFormat_2 {
5924
5970
  None = 0,
5925
5971
  Zstd = 1
5926
5972
  }
5973
+ export { CompressionFormat_2 as CompressionFormat }
5927
5974
 
5928
5975
  /**
5929
5976
  * Compression level for scene serialization.
@@ -7309,6 +7356,50 @@ export declare class EditorAPI {
7309
7356
  * @param enabled - Whether the block should be selectable.
7310
7357
  */
7311
7358
  setSelectionEnabled(id: DesignBlockId, enabled: boolean): void;
7359
+ /**
7360
+ * Set one or more rules that limit how far blocks can be positioned outside their
7361
+ * parent page during user interactions (drag, resize, touch gestures, crop).
7362
+ * Programmatic API calls are not affected.
7363
+ *
7364
+ * `overshoot` is a non-negative fraction of the moved block's own size: `0`
7365
+ * pins blocks fully inside the page, `0.3` allows 30% to extend past the page
7366
+ * bounds. Each rule's scope is determined by its keys:
7367
+ * - `{ overshoot }` — scene-wide default for every page in the scene.
7368
+ * - `{ overshoot, block }` — applies to a specific block. Pages are blocks, so
7369
+ * setting this on a page acts as the default for blocks inside that page.
7370
+ * - `{ overshoot, blockType }` — applies to every block of the given type
7371
+ * (e.g. `"text"` or `"//ly.img.ubq/text"`).
7372
+ *
7373
+ * Use `removeMovementConstraint` to clear a rule.
7374
+ *
7375
+ * When multiple rules match a block, the most specific one wins:
7376
+ * block \> parent page \> blockType \> scene-wide.
7377
+ *
7378
+ * @param rules - A single rule or an array of rules to apply.
7379
+ */
7380
+ setMovementConstraint(rules: MovementConstraintRule | MovementConstraintRule[]): void;
7381
+ /**
7382
+ * Get the effective movement constraint for a block, picking the most specific
7383
+ * matching rule: block \> parent page \> blockType \> scene-wide.
7384
+ *
7385
+ * The returned `overshoot` is a fraction of the block's own size.
7386
+ *
7387
+ * @param id - The block to query.
7388
+ * @returns `{ overshoot }` with the effective value, or `null` if unconstrained.
7389
+ */
7390
+ getMovementConstraint(id: DesignBlockId): ResolvedMovementConstraint;
7391
+ /**
7392
+ * Remove previously set movement constraints.
7393
+ *
7394
+ * - No argument: removes the scene-wide default.
7395
+ * - `{ block }` / `{ blockType }` (or an array): removes the matching scope(s).
7396
+ *
7397
+ * Removing a scope falls through to the next tier on subsequent resolution.
7398
+ *
7399
+ * @param scopes - Scope or array of scopes to remove. Omit to remove the
7400
+ * scene-wide default.
7401
+ */
7402
+ removeMovementConstraint(scopes?: MovementConstraintScope | MovementConstraintScope[]): void;
7312
7403
  }
7313
7404
 
7314
7405
  /**
@@ -7410,6 +7501,8 @@ export declare class EventAPI {
7410
7501
  * - 'exportPdfWithUnderlayer': Export the PDF document with an underlayer.
7411
7502
  * - 'underlayerSpotColorName': The name of the spot color to be used for the underlayer's fill.
7412
7503
  * - 'underlayerOffset': The adjustment in size of the shape of the underlayer.
7504
+ * - 'underlayerRenderRatio': Resolution multiplier for the underlayer contour extraction.
7505
+ * - 'underlayerMaxError': Curve-fit error tolerance for the underlayer contour.
7413
7506
  * - 'abortSignal': An abort signal that can be used to cancel the export.
7414
7507
  *
7415
7508
  * @public
@@ -7477,6 +7570,26 @@ export declare type ExportOptions = {
7477
7570
  * The adjustment in size of the shape of the underlayer.
7478
7571
  */
7479
7572
  underlayerOffset?: number;
7573
+ /**
7574
+ * Resolution multiplier for the raster pass that extracts the underlayer contour.
7575
+ * Higher values produce sharper underlayer outlines at the cost of memory and export time.
7576
+ * Useful for small text on large pages, where the 1.0 default can miss fine glyph details.
7577
+ * Values `<= 0` fall back to 1.0. `NaN` / `Infinity` are rejected at the binding boundary
7578
+ * with a `StructError`; pass a real number or leave the field undefined to use the default.
7579
+ *
7580
+ * @defaultValue 1.0
7581
+ */
7582
+ underlayerRenderRatio?: number;
7583
+ /**
7584
+ * Maximum acceptable curve-fit error, in pixels, when vectorising the underlayer contour.
7585
+ * Smaller values produce tighter fits at the cost of more path complexity.
7586
+ * Useful together with `underlayerRenderRatio` for small text on large pages.
7587
+ * Values `<= 0` fall back to 2.0. `NaN` / `Infinity` are rejected at the binding boundary
7588
+ * with a `StructError`; pass a real number or leave the field undefined to use the default.
7589
+ *
7590
+ * @defaultValue 2.0
7591
+ */
7592
+ underlayerMaxError?: number;
7480
7593
  /**
7481
7594
  * If true, the export will include text bounding boxes that account for glyph overhangs.
7482
7595
  * When enabled, text blocks with glyphs that extend beyond their frame (e.g., decorative fonts with swashes)
@@ -7875,6 +7988,33 @@ declare const MimeType_2: {
7875
7988
  declare type MimeType_2 = (typeof MimeType_2)[keyof typeof MimeType_2];
7876
7989
  export { MimeType_2 as MimeType }
7877
7990
 
7991
+ /**
7992
+ * A movement constraint rule. The scope is determined by which key is present:
7993
+ * neither (scene-wide default), `block` (per-block, includes pages), or
7994
+ * `blockType` (per-block-type).
7995
+ *
7996
+ * `overshoot` is a non-negative fraction of the moved block's own size.
7997
+ */
7998
+ declare type MovementConstraintRule = {
7999
+ overshoot: number;
8000
+ } | {
8001
+ overshoot: number;
8002
+ block: DesignBlockId;
8003
+ } | {
8004
+ overshoot: number;
8005
+ blockType: string;
8006
+ };
8007
+
8008
+ /**
8009
+ * A scope descriptor used to identify an existing movement constraint for
8010
+ * removal.
8011
+ */
8012
+ declare type MovementConstraintScope = {
8013
+ block: DesignBlockId;
8014
+ } | {
8015
+ blockType: string;
8016
+ };
8017
+
7878
8018
  /**
7879
8019
  * The block type IDs for all blocks types in the Creative Engine. Those are the types that can be
7880
8020
  * passed to `cesdk.engine.block.findByType(type)` for example.
@@ -7961,6 +8101,14 @@ declare interface Range_2 {
7961
8101
  }
7962
8102
  export { Range_2 as Range }
7963
8103
 
8104
+ /**
8105
+ * The effective movement constraint for a block, or `null` when no constraint
8106
+ * applies.
8107
+ */
8108
+ declare type ResolvedMovementConstraint = {
8109
+ overshoot: number;
8110
+ } | null;
8111
+
7964
8112
  /**
7965
8113
  * Represents a color in the RGBA color space.
7966
8114
  *
@@ -8050,7 +8198,7 @@ declare interface SaveToStringOptions {
8050
8198
  */
8051
8199
  compression?: {
8052
8200
  /** Compression format (None = no compression, Zstd = zstd compression) */
8053
- format?: CompressionFormat;
8201
+ format?: CompressionFormat_2;
8054
8202
  /** Compression level (Fastest, Default, Best) */
8055
8203
  level?: CompressionLevel;
8056
8204
  };
@@ -8172,7 +8320,7 @@ export declare class SceneAPI {
8172
8320
  allowedResourceSchemes?: string[];
8173
8321
  onDisallowedResourceScheme?: (url: string, dataHash: string) => Promise<string>;
8174
8322
  compression?: {
8175
- format?: CompressionFormat;
8323
+ format?: CompressionFormat_2;
8176
8324
  level?: CompressionLevel;
8177
8325
  };
8178
8326
  }): Promise<string>;
@@ -9445,6 +9593,8 @@ declare interface UBQExportOptions {
9445
9593
  exportPdfWithUnderlayer: boolean;
9446
9594
  underlayerSpotColorName: string;
9447
9595
  underlayerOffset: number;
9596
+ underlayerRenderRatio: number;
9597
+ underlayerMaxError: number;
9448
9598
  allowTextOverhang: boolean;
9449
9599
  exportPdfWithDeviceCMYK: boolean;
9450
9600
  }