@cesdk/node 1.77.0-rc.0 → 1.77.0-rc.2

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/index.d.mts CHANGED
@@ -1022,6 +1022,8 @@ export declare interface AssetPayload {
1022
1022
  typeface?: Typeface;
1023
1023
  transformPreset?: AssetTransformPreset;
1024
1024
  properties?: AssetProperty[];
1025
+ /** A declarative style preset the engine applies to text/caption blocks. */
1026
+ stylePreset?: AssetStylePreset;
1025
1027
  }
1026
1028
 
1027
1029
  /**
@@ -1311,6 +1313,166 @@ export declare interface AssetStringProperty {
1311
1313
  defaultValue: string;
1312
1314
  }
1313
1315
 
1316
+ /**
1317
+ * A declarative style preset the engine applies to text and caption blocks. The engine parses and
1318
+ * applies it identically on every platform. Lives in {@link AssetPayload.stylePreset}.
1319
+ *
1320
+ * Most of the look is in {@link AssetStylePreset.properties}; the other fields cover the font,
1321
+ * size-relative scaling and animations.
1322
+ * @public
1323
+ */
1324
+ export declare interface AssetStylePreset {
1325
+ /**
1326
+ * The block type this preset is for. Used as the type to create when the preset is applied with no
1327
+ * target block, and as the apply filter (it only restyles a block of this type). Omitted applies to any
1328
+ * block. Style presets target text and caption blocks; the value is the longhand id, which the engine
1329
+ * matches against the block's `getType()`.
1330
+ */
1331
+ blockType?: '//ly.img.ubq/text' | '//ly.img.ubq/caption';
1332
+ /**
1333
+ * How the preset combines with the block's current look. `'replace'` (the default) also clears the
1334
+ * decorations and animations the preset omits, so switching presets never stacks; `'merge'` layers
1335
+ * the preset on top, keeping everything it does not set. Either way the block's text content is never
1336
+ * touched, and its size only changes when the preset asks for it (`fontSize.resizeExistingOnApply`,
1337
+ * or a `text/path` baseline adopting its bounding box).
1338
+ */
1339
+ mode?: 'replace' | 'merge';
1340
+ /**
1341
+ * Font to apply. The engine resolves `family` against the registered typefaces and matches
1342
+ * `weight`/`style`. Ignored when the family is empty or not registered.
1343
+ */
1344
+ typeface?: {
1345
+ family: string;
1346
+ weight?: FontWeight;
1347
+ style?: FontStyle;
1348
+ };
1349
+ /**
1350
+ * Scene-relative font size. `scale` is a unitless multiplier on the scene's base font size (1 = the
1351
+ * base size), sizing a block created from the preset. With `resizeExistingOnApply: true` the same size
1352
+ * also resizes an existing block on apply. For an absolute size, set `properties['text/fontSize']`
1353
+ * instead (it takes precedence).
1354
+ */
1355
+ fontSize?: {
1356
+ scale: number;
1357
+ resizeExistingOnApply?: boolean;
1358
+ };
1359
+ /**
1360
+ * Lengths that scale with the block's font size. Each entry sets its `property` to `ratio × fontSize`
1361
+ * — e.g. `{ property: 'stroke/width', ratio: 0.012 }` makes the stroke width `0.012 × fontSize`. Keeps
1362
+ * a preset's stroke width, drop-shadow offset/blur, … proportional at any size.
1363
+ */
1364
+ scaleWithFontSize?: Array<{
1365
+ property: AssetStylePresetScalableProperty;
1366
+ ratio: number;
1367
+ }>;
1368
+ /**
1369
+ * The bulk of the look: typography plus the `fill/*`, `stroke/*`, `dropShadow/*` and
1370
+ * `backgroundColor/*` decorations with their `…/enabled` toggles. Known paths are value-checked and
1371
+ * autocomplete. See {@link AssetStylePresetProperties}.
1372
+ */
1373
+ properties?: AssetStylePresetProperties;
1374
+ /** Entrance animation. */
1375
+ inAnimation?: AssetStylePresetAnimation;
1376
+ /** Exit animation. */
1377
+ outAnimation?: AssetStylePresetAnimation;
1378
+ /** Looping animation. */
1379
+ loopAnimation?: AssetStylePresetAnimation;
1380
+ }
1381
+
1382
+ /**
1383
+ * An animation slot of an {@link AssetStylePreset} (`inAnimation`, `outAnimation` or `loopAnimation`).
1384
+ * @public
1385
+ */
1386
+ export declare interface AssetStylePresetAnimation {
1387
+ /** The animation block type to apply, e.g. `'//ly.img.ubq/animation/slide'`. */
1388
+ type: AnimationTypeLonghand;
1389
+ /** Configures the animation as a map of its property paths to values. */
1390
+ properties?: AssetStylePresetAnimationProperties;
1391
+ }
1392
+
1393
+ /**
1394
+ * The parameters of an {@link AssetStylePresetAnimation}: a map of the animation's property paths to
1395
+ * values. The animation's `animation/*` properties (e.g. `animation/slide/fade`,
1396
+ * `animation/grow/scaleFactor`) are value-checked and autocomplete, as are the animation controls
1397
+ * (`playback/duration`, `animationEasing`, `textWritingStyle`, `textWritingOverlap`); any other
1398
+ * property path is still accepted. These are animation paths, distinct from the block-property paths
1399
+ * in {@link AssetStylePresetProperties}.
1400
+ * @public
1401
+ */
1402
+ export declare type AssetStylePresetAnimationProperties = {
1403
+ [K in Extract<BoolPropertyName, `animation/${string}`>]?: boolean;
1404
+ } & {
1405
+ [K in Extract<EnumPropertyName, `animation/${string}`>]?: string;
1406
+ } & {
1407
+ [K in Extract<FloatPropertyName, `animation/${string}`>]?: number;
1408
+ } & {
1409
+ [K in Extract<ColorPropertyName, `animation/${string}`>]?: RGBColor | RGBAColor;
1410
+ } & {
1411
+ /** Animation controls applied outside the `animation/*` properties. */
1412
+ 'playback/duration'?: number;
1413
+ animationEasing?: string;
1414
+ textWritingStyle?: string;
1415
+ textWritingOverlap?: number;
1416
+ } & {
1417
+ [path: string]: AssetStylePresetPropertyValue;
1418
+ };
1419
+
1420
+ /**
1421
+ * The look of an {@link AssetStylePreset}: a map of property paths to values. Known paths are
1422
+ * value-checked and autocomplete (e.g. `stroke/enabled` must be a boolean, `stroke/width` a number,
1423
+ * `fill/solid/color` a color); any other property path is still accepted with the broader
1424
+ * {@link AssetStylePresetPropertyValue}. Keys without a `/` are namespaced to the block (`text/` or
1425
+ * `caption/`); keys with a `/` are used verbatim.
1426
+ * @public
1427
+ */
1428
+ export declare type AssetStylePresetProperties = {
1429
+ [K in BoolPropertyName as string extends K ? never : K]?: boolean;
1430
+ } & {
1431
+ [K in IntPropertyName as string extends K ? never : K]?: number;
1432
+ } & {
1433
+ [K in FloatPropertyName as string extends K ? never : K]?: number;
1434
+ } & {
1435
+ [K in DoublePropertyName as string extends K ? never : K]?: number;
1436
+ } & {
1437
+ [K in StringPropertyName as string extends K ? never : K]?: string;
1438
+ } & {
1439
+ [K in EnumPropertyName as string extends K ? never : K]?: string;
1440
+ } & {
1441
+ [K in ColorPropertyName as string extends K ? never : K]?: RGBColor | RGBAColor;
1442
+ } & {
1443
+ /**
1444
+ * The text-on-path baseline (see `setTextOnPath`): a single-subpath SVG path string in the block's
1445
+ * local coordinate space wraps the block's text on the path and resizes the block to the path's
1446
+ * bounding box; an explicit `null` clears the path and restores normal layout. This is a virtual
1447
+ * preset property — the baseline path is not a reflected block property, so the engine routes it
1448
+ * through `setTextOnPath`, inheriting its validation. Pair it with `text/pathOffset` and
1449
+ * `text/pathFlipped` (plain reflected properties) to fully define the path state. Which curve is
1450
+ * applied is identified by the path value itself — compare `getTextOnPath` against an entry's
1451
+ * `text/path`.
1452
+ */
1453
+ 'text/path'?: string | null;
1454
+ } & {
1455
+ [path: string]: AssetStylePresetPropertyValue;
1456
+ };
1457
+
1458
+ /**
1459
+ * A value a style preset can set on a property: a boolean, number, string (including enum values) or
1460
+ * an RGB(A) color. Colors must be RGB(A) (`{ r, g, b, a? }`); CMYK and spot colors are not supported in
1461
+ * presets. Structs and source sets cannot be set from a preset. A `null` value is ignored for regular
1462
+ * properties; for the virtual `text/path` property it clears the baseline path.
1463
+ * @public
1464
+ */
1465
+ export declare type AssetStylePresetPropertyValue = boolean | number | string | RGBColor | RGBAColor | null;
1466
+
1467
+ /**
1468
+ * A length property a style preset may scale with the block's font size (see
1469
+ * {@link AssetStylePreset.scaleWithFontSize}). Restricted to the decoration lengths for which scaling is
1470
+ * meaningful — stroke width, drop-shadow offset/blur and the caption background corner radius — not
1471
+ * arbitrary numeric properties like `rotation` or `opacity`.
1472
+ * @public
1473
+ */
1474
+ export declare type AssetStylePresetScalableProperty = 'stroke/width' | 'dropShadow/offset/x' | 'dropShadow/offset/y' | 'dropShadow/blurRadius/x' | 'dropShadow/blurRadius/y' | 'backgroundColor/cornerRadius';
1475
+
1314
1476
  /**
1315
1477
  * Transform preset payload
1316
1478
  * @public
package/index.d.ts CHANGED
@@ -1022,6 +1022,8 @@ export declare interface AssetPayload {
1022
1022
  typeface?: Typeface;
1023
1023
  transformPreset?: AssetTransformPreset;
1024
1024
  properties?: AssetProperty[];
1025
+ /** A declarative style preset the engine applies to text/caption blocks. */
1026
+ stylePreset?: AssetStylePreset;
1025
1027
  }
1026
1028
 
1027
1029
  /**
@@ -1311,6 +1313,166 @@ export declare interface AssetStringProperty {
1311
1313
  defaultValue: string;
1312
1314
  }
1313
1315
 
1316
+ /**
1317
+ * A declarative style preset the engine applies to text and caption blocks. The engine parses and
1318
+ * applies it identically on every platform. Lives in {@link AssetPayload.stylePreset}.
1319
+ *
1320
+ * Most of the look is in {@link AssetStylePreset.properties}; the other fields cover the font,
1321
+ * size-relative scaling and animations.
1322
+ * @public
1323
+ */
1324
+ export declare interface AssetStylePreset {
1325
+ /**
1326
+ * The block type this preset is for. Used as the type to create when the preset is applied with no
1327
+ * target block, and as the apply filter (it only restyles a block of this type). Omitted applies to any
1328
+ * block. Style presets target text and caption blocks; the value is the longhand id, which the engine
1329
+ * matches against the block's `getType()`.
1330
+ */
1331
+ blockType?: '//ly.img.ubq/text' | '//ly.img.ubq/caption';
1332
+ /**
1333
+ * How the preset combines with the block's current look. `'replace'` (the default) also clears the
1334
+ * decorations and animations the preset omits, so switching presets never stacks; `'merge'` layers
1335
+ * the preset on top, keeping everything it does not set. Either way the block's text content is never
1336
+ * touched, and its size only changes when the preset asks for it (`fontSize.resizeExistingOnApply`,
1337
+ * or a `text/path` baseline adopting its bounding box).
1338
+ */
1339
+ mode?: 'replace' | 'merge';
1340
+ /**
1341
+ * Font to apply. The engine resolves `family` against the registered typefaces and matches
1342
+ * `weight`/`style`. Ignored when the family is empty or not registered.
1343
+ */
1344
+ typeface?: {
1345
+ family: string;
1346
+ weight?: FontWeight;
1347
+ style?: FontStyle;
1348
+ };
1349
+ /**
1350
+ * Scene-relative font size. `scale` is a unitless multiplier on the scene's base font size (1 = the
1351
+ * base size), sizing a block created from the preset. With `resizeExistingOnApply: true` the same size
1352
+ * also resizes an existing block on apply. For an absolute size, set `properties['text/fontSize']`
1353
+ * instead (it takes precedence).
1354
+ */
1355
+ fontSize?: {
1356
+ scale: number;
1357
+ resizeExistingOnApply?: boolean;
1358
+ };
1359
+ /**
1360
+ * Lengths that scale with the block's font size. Each entry sets its `property` to `ratio × fontSize`
1361
+ * — e.g. `{ property: 'stroke/width', ratio: 0.012 }` makes the stroke width `0.012 × fontSize`. Keeps
1362
+ * a preset's stroke width, drop-shadow offset/blur, … proportional at any size.
1363
+ */
1364
+ scaleWithFontSize?: Array<{
1365
+ property: AssetStylePresetScalableProperty;
1366
+ ratio: number;
1367
+ }>;
1368
+ /**
1369
+ * The bulk of the look: typography plus the `fill/*`, `stroke/*`, `dropShadow/*` and
1370
+ * `backgroundColor/*` decorations with their `…/enabled` toggles. Known paths are value-checked and
1371
+ * autocomplete. See {@link AssetStylePresetProperties}.
1372
+ */
1373
+ properties?: AssetStylePresetProperties;
1374
+ /** Entrance animation. */
1375
+ inAnimation?: AssetStylePresetAnimation;
1376
+ /** Exit animation. */
1377
+ outAnimation?: AssetStylePresetAnimation;
1378
+ /** Looping animation. */
1379
+ loopAnimation?: AssetStylePresetAnimation;
1380
+ }
1381
+
1382
+ /**
1383
+ * An animation slot of an {@link AssetStylePreset} (`inAnimation`, `outAnimation` or `loopAnimation`).
1384
+ * @public
1385
+ */
1386
+ export declare interface AssetStylePresetAnimation {
1387
+ /** The animation block type to apply, e.g. `'//ly.img.ubq/animation/slide'`. */
1388
+ type: AnimationTypeLonghand;
1389
+ /** Configures the animation as a map of its property paths to values. */
1390
+ properties?: AssetStylePresetAnimationProperties;
1391
+ }
1392
+
1393
+ /**
1394
+ * The parameters of an {@link AssetStylePresetAnimation}: a map of the animation's property paths to
1395
+ * values. The animation's `animation/*` properties (e.g. `animation/slide/fade`,
1396
+ * `animation/grow/scaleFactor`) are value-checked and autocomplete, as are the animation controls
1397
+ * (`playback/duration`, `animationEasing`, `textWritingStyle`, `textWritingOverlap`); any other
1398
+ * property path is still accepted. These are animation paths, distinct from the block-property paths
1399
+ * in {@link AssetStylePresetProperties}.
1400
+ * @public
1401
+ */
1402
+ export declare type AssetStylePresetAnimationProperties = {
1403
+ [K in Extract<BoolPropertyName, `animation/${string}`>]?: boolean;
1404
+ } & {
1405
+ [K in Extract<EnumPropertyName, `animation/${string}`>]?: string;
1406
+ } & {
1407
+ [K in Extract<FloatPropertyName, `animation/${string}`>]?: number;
1408
+ } & {
1409
+ [K in Extract<ColorPropertyName, `animation/${string}`>]?: RGBColor | RGBAColor;
1410
+ } & {
1411
+ /** Animation controls applied outside the `animation/*` properties. */
1412
+ 'playback/duration'?: number;
1413
+ animationEasing?: string;
1414
+ textWritingStyle?: string;
1415
+ textWritingOverlap?: number;
1416
+ } & {
1417
+ [path: string]: AssetStylePresetPropertyValue;
1418
+ };
1419
+
1420
+ /**
1421
+ * The look of an {@link AssetStylePreset}: a map of property paths to values. Known paths are
1422
+ * value-checked and autocomplete (e.g. `stroke/enabled` must be a boolean, `stroke/width` a number,
1423
+ * `fill/solid/color` a color); any other property path is still accepted with the broader
1424
+ * {@link AssetStylePresetPropertyValue}. Keys without a `/` are namespaced to the block (`text/` or
1425
+ * `caption/`); keys with a `/` are used verbatim.
1426
+ * @public
1427
+ */
1428
+ export declare type AssetStylePresetProperties = {
1429
+ [K in BoolPropertyName as string extends K ? never : K]?: boolean;
1430
+ } & {
1431
+ [K in IntPropertyName as string extends K ? never : K]?: number;
1432
+ } & {
1433
+ [K in FloatPropertyName as string extends K ? never : K]?: number;
1434
+ } & {
1435
+ [K in DoublePropertyName as string extends K ? never : K]?: number;
1436
+ } & {
1437
+ [K in StringPropertyName as string extends K ? never : K]?: string;
1438
+ } & {
1439
+ [K in EnumPropertyName as string extends K ? never : K]?: string;
1440
+ } & {
1441
+ [K in ColorPropertyName as string extends K ? never : K]?: RGBColor | RGBAColor;
1442
+ } & {
1443
+ /**
1444
+ * The text-on-path baseline (see `setTextOnPath`): a single-subpath SVG path string in the block's
1445
+ * local coordinate space wraps the block's text on the path and resizes the block to the path's
1446
+ * bounding box; an explicit `null` clears the path and restores normal layout. This is a virtual
1447
+ * preset property — the baseline path is not a reflected block property, so the engine routes it
1448
+ * through `setTextOnPath`, inheriting its validation. Pair it with `text/pathOffset` and
1449
+ * `text/pathFlipped` (plain reflected properties) to fully define the path state. Which curve is
1450
+ * applied is identified by the path value itself — compare `getTextOnPath` against an entry's
1451
+ * `text/path`.
1452
+ */
1453
+ 'text/path'?: string | null;
1454
+ } & {
1455
+ [path: string]: AssetStylePresetPropertyValue;
1456
+ };
1457
+
1458
+ /**
1459
+ * A value a style preset can set on a property: a boolean, number, string (including enum values) or
1460
+ * an RGB(A) color. Colors must be RGB(A) (`{ r, g, b, a? }`); CMYK and spot colors are not supported in
1461
+ * presets. Structs and source sets cannot be set from a preset. A `null` value is ignored for regular
1462
+ * properties; for the virtual `text/path` property it clears the baseline path.
1463
+ * @public
1464
+ */
1465
+ export declare type AssetStylePresetPropertyValue = boolean | number | string | RGBColor | RGBAColor | null;
1466
+
1467
+ /**
1468
+ * A length property a style preset may scale with the block's font size (see
1469
+ * {@link AssetStylePreset.scaleWithFontSize}). Restricted to the decoration lengths for which scaling is
1470
+ * meaningful — stroke width, drop-shadow offset/blur and the caption background corner radius — not
1471
+ * arbitrary numeric properties like `rotation` or `opacity`.
1472
+ * @public
1473
+ */
1474
+ export declare type AssetStylePresetScalableProperty = 'stroke/width' | 'dropShadow/offset/x' | 'dropShadow/offset/y' | 'dropShadow/blurRadius/x' | 'dropShadow/blurRadius/y' | 'backgroundColor/cornerRadius';
1475
+
1314
1476
  /**
1315
1477
  * Transform preset payload
1316
1478
  * @public