ugcinc 5.5.1 → 5.6.0
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 +8 -5
- package/dist/media-analysis.d.ts +52 -0
- package/dist/media-analysis.js +2 -2
- package/dist/render/components/TextElement.js +9 -3
- package/dist/render/compositions/ImageEditorComposition.js +1 -0
- package/dist/render/types/base.d.ts +4 -0
- package/dist/render/types/element.d.ts +3 -1
- package/dist/render/types/index.d.ts +1 -1
- package/dist/render/utils/positionResolver.js +2 -0
- package/dist/stats.d.ts +20 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ if (res.ok) {
|
|
|
44
44
|
- `client.accounts`: list, create, update, troubleshoot, quarantine/release, and manage account lifecycle
|
|
45
45
|
- `client.posts`: create video/slideshow posts, update them, retry failures, and preview schedule conflicts
|
|
46
46
|
- `client.media`: upload media, create media records, search profile-picture candidates, search images and videos by keyword (`media.imageSearch`, cursor-paged), manage tags/names, and work with social audio
|
|
47
|
-
- `client.stats`: fetch account/post analytics, daily aggregates, top performers, refresh stats, and check stats freshness
|
|
47
|
+
- `client.stats`: fetch account/post analytics, daily aggregates, top performers, refresh stats, and check stats freshness. Daily stats methods take an optional `timezone` (IANA name, default UTC): days are calendar days in that zone.
|
|
48
48
|
- `client.org`: manage organizations, API keys, and integration keys
|
|
49
49
|
- `client.billing`: inspect subscription state and handle account deactivation, replacements, and refunds
|
|
50
50
|
- `client.automations`: create, run, publish, export, and monitor automation workflows
|
|
@@ -746,7 +746,9 @@ without a new release. Image Composer text uses a library font through
|
|
|
746
746
|
`fontFamily` (it takes precedence over `font`); `fontWeight` picks the nearest
|
|
747
747
|
weight the family has. The family list is public at
|
|
748
748
|
`https://media.ugc.inc/owned-uploads/render/0c02f309-204e-4ea1-b924-028250cfd029/catalogue.json`
|
|
749
|
-
(`fetchFontLibraryCatalogue()` in `ugcinc/render`).
|
|
749
|
+
(`fetchFontLibraryCatalogue()` in `ugcinc/render`). `fontKerning: 'none'` spaces
|
|
750
|
+
letters by their advances only, as some apps draw captions (default: the font's
|
|
751
|
+
kerning).
|
|
750
752
|
|
|
751
753
|
```typescript
|
|
752
754
|
const element = { id: 'title', type: 'text', x: 80, y: 600, width: 920, height: 200, zIndex: 1,
|
|
@@ -767,10 +769,11 @@ Image-editor version 3 results:
|
|
|
767
769
|
agreement), `margin` over the next family, `status` (`identified`, or
|
|
768
770
|
`approximate` when the caption's font is probably in no free library, such as
|
|
769
771
|
a paid font, and the closest library font is returned), `topCandidates` (up to
|
|
770
|
-
five ranked families
|
|
772
|
+
five ranked families, each with `equivalentFamilies` that render these letters
|
|
773
|
+
identically), the number of fonts scanned and the library snapshot.
|
|
771
774
|
- `candidates` (up to three families): `element` positioned in source pixels with
|
|
772
|
-
`fontFamily`, `fontWeight`, `fontSize`, `letterSpacing`, `
|
|
773
|
-
`outlineWidth`, `color` and `strokeColor` fitted with the real Image Composer
|
|
775
|
+
`fontFamily`, `fontWeight`, `fontSize`, `letterSpacing`, `fontKerning`,
|
|
776
|
+
`lineHeight`, `outlineWidth`, `color` and `strokeColor` fitted with the real Image Composer
|
|
774
777
|
renderer; a crop-sized `previewConfig`; `maskIoU` (letter-fill overlap),
|
|
775
778
|
`outlineIoU`, `foregroundMae`, `fontIdentity` and `quality: 'close' | 'approximate'`.
|
|
776
779
|
|
package/dist/media-analysis.d.ts
CHANGED
|
@@ -3587,6 +3587,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3587
3587
|
outlineWidth: z.ZodNumber;
|
|
3588
3588
|
lineHeight: z.ZodNumber;
|
|
3589
3589
|
letterSpacing: z.ZodNumber;
|
|
3590
|
+
fontKerning: z.ZodEnum<["normal", "none"]>;
|
|
3590
3591
|
textAlign: z.ZodEnum<["left", "center", "right"]>;
|
|
3591
3592
|
verticalAlign: z.ZodLiteral<"top">;
|
|
3592
3593
|
autoWidth: z.ZodLiteral<false>;
|
|
@@ -3612,6 +3613,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3612
3613
|
outlineWidth: number;
|
|
3613
3614
|
lineHeight: number;
|
|
3614
3615
|
letterSpacing: number;
|
|
3616
|
+
fontKerning: "none" | "normal";
|
|
3615
3617
|
textAlign: "left" | "right" | "center";
|
|
3616
3618
|
verticalAlign: "top";
|
|
3617
3619
|
autoWidth: false;
|
|
@@ -3637,6 +3639,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3637
3639
|
outlineWidth: number;
|
|
3638
3640
|
lineHeight: number;
|
|
3639
3641
|
letterSpacing: number;
|
|
3642
|
+
fontKerning: "none" | "normal";
|
|
3640
3643
|
textAlign: "left" | "right" | "center";
|
|
3641
3644
|
verticalAlign: "top";
|
|
3642
3645
|
autoWidth: false;
|
|
@@ -3668,6 +3671,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3668
3671
|
outlineWidth: z.ZodNumber;
|
|
3669
3672
|
lineHeight: z.ZodNumber;
|
|
3670
3673
|
letterSpacing: z.ZodNumber;
|
|
3674
|
+
fontKerning: z.ZodEnum<["normal", "none"]>;
|
|
3671
3675
|
textAlign: z.ZodEnum<["left", "center", "right"]>;
|
|
3672
3676
|
verticalAlign: z.ZodLiteral<"top">;
|
|
3673
3677
|
autoWidth: z.ZodLiteral<false>;
|
|
@@ -3693,6 +3697,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3693
3697
|
outlineWidth: number;
|
|
3694
3698
|
lineHeight: number;
|
|
3695
3699
|
letterSpacing: number;
|
|
3700
|
+
fontKerning: "none" | "normal";
|
|
3696
3701
|
textAlign: "left" | "right" | "center";
|
|
3697
3702
|
verticalAlign: "top";
|
|
3698
3703
|
autoWidth: false;
|
|
@@ -3718,6 +3723,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3718
3723
|
outlineWidth: number;
|
|
3719
3724
|
lineHeight: number;
|
|
3720
3725
|
letterSpacing: number;
|
|
3726
|
+
fontKerning: "none" | "normal";
|
|
3721
3727
|
textAlign: "left" | "right" | "center";
|
|
3722
3728
|
verticalAlign: "top";
|
|
3723
3729
|
autoWidth: false;
|
|
@@ -3749,6 +3755,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3749
3755
|
outlineWidth: number;
|
|
3750
3756
|
lineHeight: number;
|
|
3751
3757
|
letterSpacing: number;
|
|
3758
|
+
fontKerning: "none" | "normal";
|
|
3752
3759
|
textAlign: "left" | "right" | "center";
|
|
3753
3760
|
verticalAlign: "top";
|
|
3754
3761
|
autoWidth: false;
|
|
@@ -3782,6 +3789,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3782
3789
|
outlineWidth: number;
|
|
3783
3790
|
lineHeight: number;
|
|
3784
3791
|
letterSpacing: number;
|
|
3792
|
+
fontKerning: "none" | "normal";
|
|
3785
3793
|
textAlign: "left" | "right" | "center";
|
|
3786
3794
|
verticalAlign: "top";
|
|
3787
3795
|
autoWidth: false;
|
|
@@ -3819,6 +3827,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3819
3827
|
outlineWidth: number;
|
|
3820
3828
|
lineHeight: number;
|
|
3821
3829
|
letterSpacing: number;
|
|
3830
|
+
fontKerning: "none" | "normal";
|
|
3822
3831
|
textAlign: "left" | "right" | "center";
|
|
3823
3832
|
verticalAlign: "top";
|
|
3824
3833
|
autoWidth: false;
|
|
@@ -3848,6 +3857,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3848
3857
|
outlineWidth: number;
|
|
3849
3858
|
lineHeight: number;
|
|
3850
3859
|
letterSpacing: number;
|
|
3860
|
+
fontKerning: "none" | "normal";
|
|
3851
3861
|
textAlign: "left" | "right" | "center";
|
|
3852
3862
|
verticalAlign: "top";
|
|
3853
3863
|
autoWidth: false;
|
|
@@ -3885,6 +3895,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3885
3895
|
outlineWidth: number;
|
|
3886
3896
|
lineHeight: number;
|
|
3887
3897
|
letterSpacing: number;
|
|
3898
|
+
fontKerning: "none" | "normal";
|
|
3888
3899
|
textAlign: "left" | "right" | "center";
|
|
3889
3900
|
verticalAlign: "top";
|
|
3890
3901
|
autoWidth: false;
|
|
@@ -3914,6 +3925,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3914
3925
|
outlineWidth: number;
|
|
3915
3926
|
lineHeight: number;
|
|
3916
3927
|
letterSpacing: number;
|
|
3928
|
+
fontKerning: "none" | "normal";
|
|
3917
3929
|
textAlign: "left" | "right" | "center";
|
|
3918
3930
|
verticalAlign: "top";
|
|
3919
3931
|
autoWidth: false;
|
|
@@ -3943,14 +3955,17 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3943
3955
|
family: z.ZodString;
|
|
3944
3956
|
weight: z.ZodNumber;
|
|
3945
3957
|
score: z.ZodNumber;
|
|
3958
|
+
equivalentFamilies: z.ZodArray<z.ZodString, "many">;
|
|
3946
3959
|
}, "strip", z.ZodTypeAny, {
|
|
3947
3960
|
family: string;
|
|
3948
3961
|
weight: number;
|
|
3949
3962
|
score: number;
|
|
3963
|
+
equivalentFamilies: string[];
|
|
3950
3964
|
}, {
|
|
3951
3965
|
family: string;
|
|
3952
3966
|
weight: number;
|
|
3953
3967
|
score: number;
|
|
3968
|
+
equivalentFamilies: string[];
|
|
3954
3969
|
}>, "many">;
|
|
3955
3970
|
fontsScanned: z.ZodNumber;
|
|
3956
3971
|
libraryFonts: z.ZodNumber;
|
|
@@ -3967,6 +3982,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3967
3982
|
family: string;
|
|
3968
3983
|
weight: number;
|
|
3969
3984
|
score: number;
|
|
3985
|
+
equivalentFamilies: string[];
|
|
3970
3986
|
}[];
|
|
3971
3987
|
fontsScanned: number;
|
|
3972
3988
|
libraryFonts: number;
|
|
@@ -3983,6 +3999,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
3983
3999
|
family: string;
|
|
3984
4000
|
weight: number;
|
|
3985
4001
|
score: number;
|
|
4002
|
+
equivalentFamilies: string[];
|
|
3986
4003
|
}[];
|
|
3987
4004
|
fontsScanned: number;
|
|
3988
4005
|
libraryFonts: number;
|
|
@@ -4253,6 +4270,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
4253
4270
|
outlineWidth: number;
|
|
4254
4271
|
lineHeight: number;
|
|
4255
4272
|
letterSpacing: number;
|
|
4273
|
+
fontKerning: "none" | "normal";
|
|
4256
4274
|
textAlign: "left" | "right" | "center";
|
|
4257
4275
|
verticalAlign: "top";
|
|
4258
4276
|
autoWidth: false;
|
|
@@ -4282,6 +4300,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
4282
4300
|
outlineWidth: number;
|
|
4283
4301
|
lineHeight: number;
|
|
4284
4302
|
letterSpacing: number;
|
|
4303
|
+
fontKerning: "none" | "normal";
|
|
4285
4304
|
textAlign: "left" | "right" | "center";
|
|
4286
4305
|
verticalAlign: "top";
|
|
4287
4306
|
autoWidth: false;
|
|
@@ -4312,6 +4331,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
4312
4331
|
family: string;
|
|
4313
4332
|
weight: number;
|
|
4314
4333
|
score: number;
|
|
4334
|
+
equivalentFamilies: string[];
|
|
4315
4335
|
}[];
|
|
4316
4336
|
fontsScanned: number;
|
|
4317
4337
|
libraryFonts: number;
|
|
@@ -4429,6 +4449,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
4429
4449
|
outlineWidth: number;
|
|
4430
4450
|
lineHeight: number;
|
|
4431
4451
|
letterSpacing: number;
|
|
4452
|
+
fontKerning: "none" | "normal";
|
|
4432
4453
|
textAlign: "left" | "right" | "center";
|
|
4433
4454
|
verticalAlign: "top";
|
|
4434
4455
|
autoWidth: false;
|
|
@@ -4458,6 +4479,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
4458
4479
|
outlineWidth: number;
|
|
4459
4480
|
lineHeight: number;
|
|
4460
4481
|
letterSpacing: number;
|
|
4482
|
+
fontKerning: "none" | "normal";
|
|
4461
4483
|
textAlign: "left" | "right" | "center";
|
|
4462
4484
|
verticalAlign: "top";
|
|
4463
4485
|
autoWidth: false;
|
|
@@ -4488,6 +4510,7 @@ export declare const matchTextStyleResultSchema: z.ZodObject<{
|
|
|
4488
4510
|
family: string;
|
|
4489
4511
|
weight: number;
|
|
4490
4512
|
score: number;
|
|
4513
|
+
equivalentFamilies: string[];
|
|
4491
4514
|
}[];
|
|
4492
4515
|
fontsScanned: number;
|
|
4493
4516
|
libraryFonts: number;
|
|
@@ -7331,6 +7354,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7331
7354
|
outlineWidth: z.ZodNumber;
|
|
7332
7355
|
lineHeight: z.ZodNumber;
|
|
7333
7356
|
letterSpacing: z.ZodNumber;
|
|
7357
|
+
fontKerning: z.ZodEnum<["normal", "none"]>;
|
|
7334
7358
|
textAlign: z.ZodEnum<["left", "center", "right"]>;
|
|
7335
7359
|
verticalAlign: z.ZodLiteral<"top">;
|
|
7336
7360
|
autoWidth: z.ZodLiteral<false>;
|
|
@@ -7356,6 +7380,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7356
7380
|
outlineWidth: number;
|
|
7357
7381
|
lineHeight: number;
|
|
7358
7382
|
letterSpacing: number;
|
|
7383
|
+
fontKerning: "none" | "normal";
|
|
7359
7384
|
textAlign: "left" | "right" | "center";
|
|
7360
7385
|
verticalAlign: "top";
|
|
7361
7386
|
autoWidth: false;
|
|
@@ -7381,6 +7406,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7381
7406
|
outlineWidth: number;
|
|
7382
7407
|
lineHeight: number;
|
|
7383
7408
|
letterSpacing: number;
|
|
7409
|
+
fontKerning: "none" | "normal";
|
|
7384
7410
|
textAlign: "left" | "right" | "center";
|
|
7385
7411
|
verticalAlign: "top";
|
|
7386
7412
|
autoWidth: false;
|
|
@@ -7412,6 +7438,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7412
7438
|
outlineWidth: z.ZodNumber;
|
|
7413
7439
|
lineHeight: z.ZodNumber;
|
|
7414
7440
|
letterSpacing: z.ZodNumber;
|
|
7441
|
+
fontKerning: z.ZodEnum<["normal", "none"]>;
|
|
7415
7442
|
textAlign: z.ZodEnum<["left", "center", "right"]>;
|
|
7416
7443
|
verticalAlign: z.ZodLiteral<"top">;
|
|
7417
7444
|
autoWidth: z.ZodLiteral<false>;
|
|
@@ -7437,6 +7464,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7437
7464
|
outlineWidth: number;
|
|
7438
7465
|
lineHeight: number;
|
|
7439
7466
|
letterSpacing: number;
|
|
7467
|
+
fontKerning: "none" | "normal";
|
|
7440
7468
|
textAlign: "left" | "right" | "center";
|
|
7441
7469
|
verticalAlign: "top";
|
|
7442
7470
|
autoWidth: false;
|
|
@@ -7462,6 +7490,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7462
7490
|
outlineWidth: number;
|
|
7463
7491
|
lineHeight: number;
|
|
7464
7492
|
letterSpacing: number;
|
|
7493
|
+
fontKerning: "none" | "normal";
|
|
7465
7494
|
textAlign: "left" | "right" | "center";
|
|
7466
7495
|
verticalAlign: "top";
|
|
7467
7496
|
autoWidth: false;
|
|
@@ -7493,6 +7522,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7493
7522
|
outlineWidth: number;
|
|
7494
7523
|
lineHeight: number;
|
|
7495
7524
|
letterSpacing: number;
|
|
7525
|
+
fontKerning: "none" | "normal";
|
|
7496
7526
|
textAlign: "left" | "right" | "center";
|
|
7497
7527
|
verticalAlign: "top";
|
|
7498
7528
|
autoWidth: false;
|
|
@@ -7526,6 +7556,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7526
7556
|
outlineWidth: number;
|
|
7527
7557
|
lineHeight: number;
|
|
7528
7558
|
letterSpacing: number;
|
|
7559
|
+
fontKerning: "none" | "normal";
|
|
7529
7560
|
textAlign: "left" | "right" | "center";
|
|
7530
7561
|
verticalAlign: "top";
|
|
7531
7562
|
autoWidth: false;
|
|
@@ -7563,6 +7594,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7563
7594
|
outlineWidth: number;
|
|
7564
7595
|
lineHeight: number;
|
|
7565
7596
|
letterSpacing: number;
|
|
7597
|
+
fontKerning: "none" | "normal";
|
|
7566
7598
|
textAlign: "left" | "right" | "center";
|
|
7567
7599
|
verticalAlign: "top";
|
|
7568
7600
|
autoWidth: false;
|
|
@@ -7592,6 +7624,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7592
7624
|
outlineWidth: number;
|
|
7593
7625
|
lineHeight: number;
|
|
7594
7626
|
letterSpacing: number;
|
|
7627
|
+
fontKerning: "none" | "normal";
|
|
7595
7628
|
textAlign: "left" | "right" | "center";
|
|
7596
7629
|
verticalAlign: "top";
|
|
7597
7630
|
autoWidth: false;
|
|
@@ -7629,6 +7662,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7629
7662
|
outlineWidth: number;
|
|
7630
7663
|
lineHeight: number;
|
|
7631
7664
|
letterSpacing: number;
|
|
7665
|
+
fontKerning: "none" | "normal";
|
|
7632
7666
|
textAlign: "left" | "right" | "center";
|
|
7633
7667
|
verticalAlign: "top";
|
|
7634
7668
|
autoWidth: false;
|
|
@@ -7658,6 +7692,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7658
7692
|
outlineWidth: number;
|
|
7659
7693
|
lineHeight: number;
|
|
7660
7694
|
letterSpacing: number;
|
|
7695
|
+
fontKerning: "none" | "normal";
|
|
7661
7696
|
textAlign: "left" | "right" | "center";
|
|
7662
7697
|
verticalAlign: "top";
|
|
7663
7698
|
autoWidth: false;
|
|
@@ -7687,14 +7722,17 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7687
7722
|
family: z.ZodString;
|
|
7688
7723
|
weight: z.ZodNumber;
|
|
7689
7724
|
score: z.ZodNumber;
|
|
7725
|
+
equivalentFamilies: z.ZodArray<z.ZodString, "many">;
|
|
7690
7726
|
}, "strip", z.ZodTypeAny, {
|
|
7691
7727
|
family: string;
|
|
7692
7728
|
weight: number;
|
|
7693
7729
|
score: number;
|
|
7730
|
+
equivalentFamilies: string[];
|
|
7694
7731
|
}, {
|
|
7695
7732
|
family: string;
|
|
7696
7733
|
weight: number;
|
|
7697
7734
|
score: number;
|
|
7735
|
+
equivalentFamilies: string[];
|
|
7698
7736
|
}>, "many">;
|
|
7699
7737
|
fontsScanned: z.ZodNumber;
|
|
7700
7738
|
libraryFonts: z.ZodNumber;
|
|
@@ -7711,6 +7749,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7711
7749
|
family: string;
|
|
7712
7750
|
weight: number;
|
|
7713
7751
|
score: number;
|
|
7752
|
+
equivalentFamilies: string[];
|
|
7714
7753
|
}[];
|
|
7715
7754
|
fontsScanned: number;
|
|
7716
7755
|
libraryFonts: number;
|
|
@@ -7727,6 +7766,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7727
7766
|
family: string;
|
|
7728
7767
|
weight: number;
|
|
7729
7768
|
score: number;
|
|
7769
|
+
equivalentFamilies: string[];
|
|
7730
7770
|
}[];
|
|
7731
7771
|
fontsScanned: number;
|
|
7732
7772
|
libraryFonts: number;
|
|
@@ -7997,6 +8037,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
7997
8037
|
outlineWidth: number;
|
|
7998
8038
|
lineHeight: number;
|
|
7999
8039
|
letterSpacing: number;
|
|
8040
|
+
fontKerning: "none" | "normal";
|
|
8000
8041
|
textAlign: "left" | "right" | "center";
|
|
8001
8042
|
verticalAlign: "top";
|
|
8002
8043
|
autoWidth: false;
|
|
@@ -8026,6 +8067,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
8026
8067
|
outlineWidth: number;
|
|
8027
8068
|
lineHeight: number;
|
|
8028
8069
|
letterSpacing: number;
|
|
8070
|
+
fontKerning: "none" | "normal";
|
|
8029
8071
|
textAlign: "left" | "right" | "center";
|
|
8030
8072
|
verticalAlign: "top";
|
|
8031
8073
|
autoWidth: false;
|
|
@@ -8056,6 +8098,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
8056
8098
|
family: string;
|
|
8057
8099
|
weight: number;
|
|
8058
8100
|
score: number;
|
|
8101
|
+
equivalentFamilies: string[];
|
|
8059
8102
|
}[];
|
|
8060
8103
|
fontsScanned: number;
|
|
8061
8104
|
libraryFonts: number;
|
|
@@ -8173,6 +8216,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
8173
8216
|
outlineWidth: number;
|
|
8174
8217
|
lineHeight: number;
|
|
8175
8218
|
letterSpacing: number;
|
|
8219
|
+
fontKerning: "none" | "normal";
|
|
8176
8220
|
textAlign: "left" | "right" | "center";
|
|
8177
8221
|
verticalAlign: "top";
|
|
8178
8222
|
autoWidth: false;
|
|
@@ -8202,6 +8246,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
8202
8246
|
outlineWidth: number;
|
|
8203
8247
|
lineHeight: number;
|
|
8204
8248
|
letterSpacing: number;
|
|
8249
|
+
fontKerning: "none" | "normal";
|
|
8205
8250
|
textAlign: "left" | "right" | "center";
|
|
8206
8251
|
verticalAlign: "top";
|
|
8207
8252
|
autoWidth: false;
|
|
@@ -8232,6 +8277,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
8232
8277
|
family: string;
|
|
8233
8278
|
weight: number;
|
|
8234
8279
|
score: number;
|
|
8280
|
+
equivalentFamilies: string[];
|
|
8235
8281
|
}[];
|
|
8236
8282
|
fontsScanned: number;
|
|
8237
8283
|
libraryFonts: number;
|
|
@@ -8854,6 +8900,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
8854
8900
|
outlineWidth: number;
|
|
8855
8901
|
lineHeight: number;
|
|
8856
8902
|
letterSpacing: number;
|
|
8903
|
+
fontKerning: "none" | "normal";
|
|
8857
8904
|
textAlign: "left" | "right" | "center";
|
|
8858
8905
|
verticalAlign: "top";
|
|
8859
8906
|
autoWidth: false;
|
|
@@ -8883,6 +8930,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
8883
8930
|
outlineWidth: number;
|
|
8884
8931
|
lineHeight: number;
|
|
8885
8932
|
letterSpacing: number;
|
|
8933
|
+
fontKerning: "none" | "normal";
|
|
8886
8934
|
textAlign: "left" | "right" | "center";
|
|
8887
8935
|
verticalAlign: "top";
|
|
8888
8936
|
autoWidth: false;
|
|
@@ -8913,6 +8961,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
8913
8961
|
family: string;
|
|
8914
8962
|
weight: number;
|
|
8915
8963
|
score: number;
|
|
8964
|
+
equivalentFamilies: string[];
|
|
8916
8965
|
}[];
|
|
8917
8966
|
fontsScanned: number;
|
|
8918
8967
|
libraryFonts: number;
|
|
@@ -9535,6 +9584,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
9535
9584
|
outlineWidth: number;
|
|
9536
9585
|
lineHeight: number;
|
|
9537
9586
|
letterSpacing: number;
|
|
9587
|
+
fontKerning: "none" | "normal";
|
|
9538
9588
|
textAlign: "left" | "right" | "center";
|
|
9539
9589
|
verticalAlign: "top";
|
|
9540
9590
|
autoWidth: false;
|
|
@@ -9564,6 +9614,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
9564
9614
|
outlineWidth: number;
|
|
9565
9615
|
lineHeight: number;
|
|
9566
9616
|
letterSpacing: number;
|
|
9617
|
+
fontKerning: "none" | "normal";
|
|
9567
9618
|
textAlign: "left" | "right" | "center";
|
|
9568
9619
|
verticalAlign: "top";
|
|
9569
9620
|
autoWidth: false;
|
|
@@ -9594,6 +9645,7 @@ export declare const mediaAnalysisResultSchema: z.ZodEffects<z.ZodDiscriminatedU
|
|
|
9594
9645
|
family: string;
|
|
9595
9646
|
weight: number;
|
|
9596
9647
|
score: number;
|
|
9648
|
+
equivalentFamilies: string[];
|
|
9597
9649
|
}[];
|
|
9598
9650
|
fontsScanned: number;
|
|
9599
9651
|
libraryFonts: number;
|
package/dist/media-analysis.js
CHANGED
|
@@ -119,7 +119,7 @@ exports.matchTextStyleSchema = zod_1.z.object({ url: videoUrl,
|
|
|
119
119
|
ctx.addIssue({ code: 'custom', path: ['text'], message: 'Native text does not support empty or space-only paragraphs.' });
|
|
120
120
|
});
|
|
121
121
|
const matchedTextElement = zod_1.z.object({ id: zod_1.z.string(), type: zod_1.z.literal('text'), x: finiteNumber, y: finiteNumber, width: finiteNumber, height: finiteNumber, zIndex: zod_1.z.number(), textIsVariable: zod_1.z.literal(false), text: zod_1.z.string(), fontFamily: zod_1.z.string().min(1), fontSize: finiteNumber,
|
|
122
|
-
fontWeight: zod_1.z.union([zod_1.z.literal(100), zod_1.z.literal(200), zod_1.z.literal(300), zod_1.z.literal(400), zod_1.z.literal(500), zod_1.z.literal(600), zod_1.z.literal(700), zod_1.z.literal(800), zod_1.z.literal(900)]), color: zod_1.z.string(), strokeColor: zod_1.z.string(), outlineWidth: finiteNumber, lineHeight: finiteNumber, letterSpacing: finiteNumber, textAlign: zod_1.z.enum(['left', 'center', 'right']), verticalAlign: zod_1.z.literal('top'), autoWidth: zod_1.z.literal(false), paddingTop: finiteNumber, paddingRight: finiteNumber, paddingBottom: finiteNumber, paddingLeft: finiteNumber });
|
|
122
|
+
fontWeight: zod_1.z.union([zod_1.z.literal(100), zod_1.z.literal(200), zod_1.z.literal(300), zod_1.z.literal(400), zod_1.z.literal(500), zod_1.z.literal(600), zod_1.z.literal(700), zod_1.z.literal(800), zod_1.z.literal(900)]), color: zod_1.z.string(), strokeColor: zod_1.z.string(), outlineWidth: finiteNumber, lineHeight: finiteNumber, letterSpacing: finiteNumber, fontKerning: zod_1.z.enum(['normal', 'none']), textAlign: zod_1.z.enum(['left', 'center', 'right']), verticalAlign: zod_1.z.literal('top'), autoWidth: zod_1.z.literal(false), paddingTop: finiteNumber, paddingRight: finiteNumber, paddingBottom: finiteNumber, paddingLeft: finiteNumber });
|
|
123
123
|
const nativeTextMatchSchema = zod_1.z.object({
|
|
124
124
|
profile: zod_1.z.literal('tiktok-classic-ios-47'), settings: native_text_1.tiktokNativeTextStickerSchema,
|
|
125
125
|
stickerUrl: videoUrl,
|
|
@@ -133,7 +133,7 @@ const nativeTextMatchSchema = zod_1.z.object({
|
|
|
133
133
|
residualMetric: zod_1.z.literal('segmented-text-outline-and-warm-emoji'), foregroundMetric: zod_1.z.literal('estimated-background-composite-MAE') }),
|
|
134
134
|
});
|
|
135
135
|
const fontIdentificationSchema = zod_1.z.object({ status: zod_1.z.enum(['identified', 'approximate']), family: zod_1.z.string(), weight: zod_1.z.number().int(), score: zod_1.z.number().min(0).max(1), margin: zod_1.z.number().nullable(),
|
|
136
|
-
topCandidates: zod_1.z.array(zod_1.z.object({ family: zod_1.z.string(), weight: zod_1.z.number().int(), score: zod_1.z.number().min(0).max(1) })).max(5),
|
|
136
|
+
topCandidates: zod_1.z.array(zod_1.z.object({ family: zod_1.z.string(), weight: zod_1.z.number().int(), score: zod_1.z.number().min(0).max(1), equivalentFamilies: zod_1.z.array(zod_1.z.string()) })).max(5),
|
|
137
137
|
fontsScanned: zod_1.z.number().int().nonnegative(), libraryFonts: zod_1.z.number().int().nonnegative(), libraryRefreshedAt: zod_1.z.number().int(), evidenceMode: zod_1.z.enum(['outlined', 'plain']), seconds: zod_1.z.number().nonnegative() });
|
|
138
138
|
exports.matchTextStyleResultSchema = zod_1.z.object({ version: zod_1.z.union([zod_1.z.literal(2), zod_1.z.literal(3)]), operation: zod_1.z.literal('match_text_style'), source: visualSource, box: boxSchema, surface: zod_1.z.enum(['image-editor-element', 'native-text-sticker']), status: zod_1.z.enum(['fitted', 'unavailable']), reason: zod_1.z.string().nullable(), text: zod_1.z.string().nullable(), textSource: zod_1.z.enum(['supplied', 'ocr']),
|
|
139
139
|
renderer: zod_1.z.union([
|
|
@@ -56,7 +56,7 @@ const text_1 = require("../utils/text");
|
|
|
56
56
|
* By returning the actual lines, we can render with explicit line breaks,
|
|
57
57
|
* ensuring text wraps at maxWidth while displaying in a calculatedWidth container.
|
|
58
58
|
*/
|
|
59
|
-
function calculateAutoWidthAndLines({ text, maxWidth, paddingLeft, paddingRight, fontSize, fontWeight, fontFamily, letterSpacing, lineHeight, }) {
|
|
59
|
+
function calculateAutoWidthAndLines({ text, maxWidth, paddingLeft, paddingRight, fontSize, fontWeight, fontFamily, letterSpacing, fontKerning, lineHeight, }) {
|
|
60
60
|
// Check if we're in a browser environment
|
|
61
61
|
if (typeof document === 'undefined') {
|
|
62
62
|
return { width: maxWidth, lines: [text] };
|
|
@@ -77,6 +77,7 @@ function calculateAutoWidthAndLines({ text, maxWidth, paddingLeft, paddingRight,
|
|
|
77
77
|
font-size: ${fontSize}px;
|
|
78
78
|
font-weight: ${fontWeight};
|
|
79
79
|
letter-spacing: ${letterSpacing}px;
|
|
80
|
+
${fontKerning ? `font-kerning: ${fontKerning};` : ''}
|
|
80
81
|
white-space: nowrap;
|
|
81
82
|
`;
|
|
82
83
|
document.body.appendChild(measureSpan);
|
|
@@ -191,6 +192,8 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
191
192
|
const verticalAlign = segment.verticalAlign ?? defaults_1.TEXT_DEFAULTS.verticalAlign;
|
|
192
193
|
const lineHeight = segment.lineHeight ?? defaults_1.TEXT_DEFAULTS.lineHeight;
|
|
193
194
|
const letterSpacing = (segment.letterSpacing ?? defaults_1.TEXT_DEFAULTS.letterSpacing) * scale;
|
|
195
|
+
// Unset keeps the browser default (auto), so existing elements render exactly as before.
|
|
196
|
+
const fontKerning = segment.fontKerning;
|
|
194
197
|
const strokeColor = segment.strokeColor;
|
|
195
198
|
const strokeWidth = (segment.strokeWidth ?? defaults_1.TEXT_DEFAULTS.strokeWidth) * scale;
|
|
196
199
|
// Padding - base values (always used for line calculation)
|
|
@@ -246,6 +249,7 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
246
249
|
fontWeight,
|
|
247
250
|
fontFamily,
|
|
248
251
|
letterSpacing,
|
|
252
|
+
fontKerning,
|
|
249
253
|
lineHeight,
|
|
250
254
|
});
|
|
251
255
|
const isMultiLine = baseResult.lines.length >= 2;
|
|
@@ -266,6 +270,7 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
266
270
|
fontWeight,
|
|
267
271
|
fontFamily,
|
|
268
272
|
letterSpacing,
|
|
273
|
+
fontKerning,
|
|
269
274
|
lineHeight,
|
|
270
275
|
});
|
|
271
276
|
}
|
|
@@ -282,7 +287,7 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
282
287
|
basePaddingTop, basePaddingRight, basePaddingBottom, basePaddingLeft,
|
|
283
288
|
extraPaddingTop, extraPaddingRight, extraPaddingBottom, extraPaddingLeft,
|
|
284
289
|
hasExtraPadding,
|
|
285
|
-
fontSize, fontWeight, fontFamily, letterSpacing, lineHeight
|
|
290
|
+
fontSize, fontWeight, fontFamily, letterSpacing, fontKerning, lineHeight
|
|
286
291
|
]);
|
|
287
292
|
// Calculate border radius CSS
|
|
288
293
|
const borderRadiusStyle = (0, react_1.useMemo)(() => {
|
|
@@ -331,6 +336,7 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
331
336
|
color,
|
|
332
337
|
lineHeight,
|
|
333
338
|
letterSpacing,
|
|
339
|
+
...(fontKerning && { fontKerning }),
|
|
334
340
|
textAlign: alignment === 'justify' ? 'justify' : alignment,
|
|
335
341
|
padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
|
|
336
342
|
whiteSpace: 'pre-wrap',
|
|
@@ -347,7 +353,7 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
347
353
|
paintOrder: 'stroke fill',
|
|
348
354
|
}),
|
|
349
355
|
}), [
|
|
350
|
-
fontFamily, fontSize, fontWeight, color, lineHeight, letterSpacing, alignment,
|
|
356
|
+
fontFamily, fontSize, fontWeight, color, lineHeight, letterSpacing, fontKerning, alignment,
|
|
351
357
|
paddingTop, paddingRight, paddingBottom, paddingLeft,
|
|
352
358
|
autoWidth, verticalAlign, hasStroke, strokeWidth, strokeColor
|
|
353
359
|
]);
|
|
@@ -61,6 +61,7 @@ function elementToTextSegment(elem) {
|
|
|
61
61
|
strokeWidth: elem.outlineWidth ?? 0,
|
|
62
62
|
lineHeight: elem.lineHeight ?? 1.2,
|
|
63
63
|
letterSpacing: elem.letterSpacing ?? 0,
|
|
64
|
+
fontKerning: elem.fontKerning,
|
|
64
65
|
alignment: elem.textAlign ?? 'center',
|
|
65
66
|
verticalAlign: elem.verticalAlign ?? 'middle',
|
|
66
67
|
backgroundColor: elem.backgroundColor,
|
|
@@ -54,6 +54,8 @@ export type FontWeight = 'normal' | 'bold' | 100 | 200 | 300 | 400 | 500 | 600 |
|
|
|
54
54
|
* Text alignment options
|
|
55
55
|
*/
|
|
56
56
|
export type TextAlignment = 'left' | 'center' | 'right' | 'justify';
|
|
57
|
+
/** 'normal' applies the font's kerning pairs; 'none' spaces each letter by its advance only. */
|
|
58
|
+
export type FontKerning = 'normal' | 'none';
|
|
57
59
|
/**
|
|
58
60
|
* Vertical alignment options
|
|
59
61
|
*/
|
|
@@ -119,6 +121,8 @@ export interface TextStyleProperties {
|
|
|
119
121
|
lineHeight?: number;
|
|
120
122
|
/** Letter spacing in pixels (default: 0) */
|
|
121
123
|
letterSpacing?: number;
|
|
124
|
+
/** Kerning (default: 'normal'). Some apps draw text without kerning; 'none' matches them. */
|
|
125
|
+
fontKerning?: FontKerning;
|
|
122
126
|
/** How text wraps to new lines (default: 'word') */
|
|
123
127
|
textWrap?: TextWrap;
|
|
124
128
|
/** How words break across lines (default: 'normal') */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* They include relative positioning which gets resolved to absolute positions
|
|
6
6
|
* before rendering.
|
|
7
7
|
*/
|
|
8
|
-
import type { FitMode, BorderRadiusConfig, FontType, FontWeight, TextAlignment, VerticalAlignment } from './base';
|
|
8
|
+
import type { FitMode, BorderRadiusConfig, FontKerning, FontType, FontWeight, TextAlignment, VerticalAlignment } from './base';
|
|
9
9
|
import type { RelativePositionConfigX, RelativePositionConfigY } from './position';
|
|
10
10
|
/**
|
|
11
11
|
* Lightweight media reference stored in editor configs.
|
|
@@ -91,6 +91,8 @@ export interface ImageEditorElement {
|
|
|
91
91
|
lineHeight?: number;
|
|
92
92
|
/** Letter spacing in pixels */
|
|
93
93
|
letterSpacing?: number;
|
|
94
|
+
/** Kerning (default: 'normal'). Some apps draw text without kerning; 'none' matches them. */
|
|
95
|
+
fontKerning?: FontKerning;
|
|
94
96
|
/** Horizontal text alignment */
|
|
95
97
|
textAlign?: TextAlignment;
|
|
96
98
|
/** Vertical text alignment within bounds */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This module exports all types needed for building compositions
|
|
5
5
|
* and integrating with the rendering system.
|
|
6
6
|
*/
|
|
7
|
-
export type { TimeValue, BorderRadiusConfig, FitMode, SegmentType, FontType, FontWeight, TextAlignment, VerticalAlignment, TextDirection, TextWrap, WordBreak, Hyphenation, TextOverflow, TextStyleProperties, } from './base';
|
|
7
|
+
export type { TimeValue, BorderRadiusConfig, FitMode, SegmentType, FontType, FontWeight, FontKerning, TextAlignment, VerticalAlignment, TextDirection, TextWrap, WordBreak, Hyphenation, TextOverflow, TextStyleProperties, } from './base';
|
|
8
8
|
export type { VerticalAnchor, HorizontalAnchor, HorizontalSelfAnchor, VerticalSelfAnchor, RelativePositionConfigX, RelativePositionConfigY, } from './position';
|
|
9
9
|
export type { ImageEditorElement, StaticMediaItem, DimensionPresetKey, DimensionPreset, } from './element';
|
|
10
10
|
export { DIMENSION_PRESETS } from './element';
|
|
@@ -59,6 +59,8 @@ function calculateAutoWidthDimensions(elem, textContent, ctx) {
|
|
|
59
59
|
// Set font for measurement
|
|
60
60
|
const fontFamily = elem.fontFamily ? `"${(0, fonts_1.libraryFontFace)(elem.fontFamily)}", sans-serif` : (FONT_FAMILIES[fontType] ?? FONT_FAMILIES.tiktok);
|
|
61
61
|
measureCtx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
62
|
+
// A shared context keeps its last setting, so always set it; 'auto' is the canvas default.
|
|
63
|
+
measureCtx.fontKerning = elem.fontKerning ?? 'auto';
|
|
62
64
|
// Calculate available width for text wrapping
|
|
63
65
|
const availableWidth = maxWidth - paddingLeft - paddingRight;
|
|
64
66
|
// Wrap text to get lines
|
package/dist/stats.d.ts
CHANGED
|
@@ -59,6 +59,11 @@ export interface DailyAggregatedStat {
|
|
|
59
59
|
export interface GetDailyAggregatedStatsParams {
|
|
60
60
|
startDate: string;
|
|
61
61
|
endDate: string;
|
|
62
|
+
/**
|
|
63
|
+
* IANA time zone whose calendar days the result uses, for example 'America/Los_Angeles'.
|
|
64
|
+
* startDate and endDate name days in this zone. Defaults to UTC.
|
|
65
|
+
*/
|
|
66
|
+
timezone?: string;
|
|
62
67
|
accountIds?: string[];
|
|
63
68
|
tag?: string;
|
|
64
69
|
org_group?: string;
|
|
@@ -75,6 +80,11 @@ export interface DailyAccountStat {
|
|
|
75
80
|
export interface GetDailyAccountStatsParams {
|
|
76
81
|
startDate: string;
|
|
77
82
|
endDate: string;
|
|
83
|
+
/**
|
|
84
|
+
* IANA time zone whose calendar days the result uses, for example 'America/Los_Angeles'.
|
|
85
|
+
* startDate and endDate name days in this zone. Defaults to UTC.
|
|
86
|
+
*/
|
|
87
|
+
timezone?: string;
|
|
78
88
|
accountIds?: string[];
|
|
79
89
|
tag?: string;
|
|
80
90
|
org_group?: string;
|
|
@@ -103,6 +113,11 @@ export interface DailyPostStat {
|
|
|
103
113
|
export interface GetDailyPostStatsParams {
|
|
104
114
|
startDate: string;
|
|
105
115
|
endDate: string;
|
|
116
|
+
/**
|
|
117
|
+
* IANA time zone whose calendar days the result uses, for example 'America/Los_Angeles'.
|
|
118
|
+
* startDate and endDate name days in this zone. Defaults to UTC.
|
|
119
|
+
*/
|
|
120
|
+
timezone?: string;
|
|
106
121
|
accountIds?: string[];
|
|
107
122
|
tag?: string;
|
|
108
123
|
org_group?: string;
|
|
@@ -127,6 +142,11 @@ export interface DashboardDailyStat {
|
|
|
127
142
|
export interface GetDashboardDailyStatsParams {
|
|
128
143
|
startDate: string;
|
|
129
144
|
endDate: string;
|
|
145
|
+
/**
|
|
146
|
+
* IANA time zone whose calendar days the result uses, for example 'America/Los_Angeles'.
|
|
147
|
+
* startDate and endDate name days in this zone. Defaults to UTC.
|
|
148
|
+
*/
|
|
149
|
+
timezone?: string;
|
|
130
150
|
accountIds?: string[];
|
|
131
151
|
tag?: string;
|
|
132
152
|
org_group?: string;
|