ugcinc 5.3.2 → 5.5.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 +70 -58
- package/dist/content-skills.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/media-analysis.d.ts +460 -180
- package/dist/media-analysis.js +16 -9
- package/dist/render/components/TextElement.js +1 -1
- package/dist/render/compositions/IMessageDmComposition/convertPropsToElements.d.ts +27 -0
- package/dist/render/compositions/IMessageDmComposition/convertPropsToElements.js +629 -0
- package/dist/render/compositions/IMessageDmComposition/index.d.ts +21 -0
- package/dist/render/compositions/IMessageDmComposition/index.js +504 -0
- package/dist/render/compositions/IMessageDmComposition/types.d.ts +767 -0
- package/dist/render/compositions/IMessageDmComposition/types.js +228 -0
- package/dist/render/compositions/ImageEditorComposition.js +15 -2
- package/dist/render/compositions/VideoEditorComposition.js +7 -0
- package/dist/render/hooks/index.d.ts +10 -0
- package/dist/render/hooks/index.js +50 -0
- package/dist/render/types/base.d.ts +2 -0
- package/dist/render/types/element.d.ts +5 -0
- package/dist/render/types/native-text.d.ts +106 -1
- package/dist/render/types/native-text.js +17 -2
- package/dist/render/utils/fonts.d.ts +45 -3
- package/dist/render/utils/fonts.js +84 -3
- package/dist/render/utils/index.d.ts +1 -1
- package/dist/render/utils/index.js +9 -1
- package/dist/render/utils/positionResolver.js +2 -1
- package/dist/render.d.ts +1 -1
- package/dist/render.js +1 -1
- package/dist/skills.js +2 -2
- package/dist/stats.d.ts +24 -0
- package/dist/stats.js +11 -0
- package/package.json +1 -1
- package/skills/content-automation/SKILL.md +4 -2
- package/skills/media/SKILL.md +32 -11
- package/skills/media/references/tools.md +25 -20
package/dist/media-analysis.js
CHANGED
|
@@ -118,10 +118,10 @@ exports.matchTextStyleSchema = zod_1.z.object({ url: videoUrl,
|
|
|
118
118
|
if (value.renderer === 'tiktok-native' && value.text !== undefined && value.text.split('\n').some(line => line.replace(/ /g, '').length === 0))
|
|
119
119
|
ctx.addIssue({ code: 'custom', path: ['text'], message: 'Native text does not support empty or space-only paragraphs.' });
|
|
120
120
|
});
|
|
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(),
|
|
122
|
-
fontWeight: zod_1.z.union([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 });
|
|
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 });
|
|
123
123
|
const nativeTextMatchSchema = zod_1.z.object({
|
|
124
|
-
profile: zod_1.z.literal('tiktok-classic-ios-47'), settings: native_text_1.
|
|
124
|
+
profile: zod_1.z.literal('tiktok-classic-ios-47'), settings: native_text_1.tiktokNativeTextStickerSchema,
|
|
125
125
|
stickerUrl: videoUrl,
|
|
126
126
|
composition: zod_1.z.object({ x: finiteNumber, y: finiteNumber, width: finiteNumber.positive(), height: finiteNumber.positive(), scale: finiteNumber.positive() }),
|
|
127
127
|
maskIoU: zod_1.z.number().min(0).max(1), foregroundMae: zod_1.z.number().min(0).max(1),
|
|
@@ -132,14 +132,18 @@ const nativeTextMatchSchema = zod_1.z.object({
|
|
|
132
132
|
maskMetric: zod_1.z.literal('white-fill-iou'), outlineIoU: zod_1.z.number().min(0).max(1), emojiPixelCount: zod_1.z.number().int().nonnegative(),
|
|
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),
|
|
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
|
+
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']),
|
|
136
139
|
renderer: zod_1.z.union([
|
|
137
|
-
zod_1.z.object({ name: zod_1.z.literal('UGC-ImageEditorComposition'), ugcVersion: zod_1.z.string(),
|
|
140
|
+
zod_1.z.object({ name: zod_1.z.literal('UGC-ImageEditorComposition'), ugcVersion: zod_1.z.string(), fontLibrary: zod_1.z.object({ source: zod_1.z.literal('google-fonts'), fonts: zod_1.z.number().int(), refreshedAt: zod_1.z.number().int() }).nullable(), maxRenders: zod_1.z.number() }),
|
|
138
141
|
zod_1.z.object({ name: zod_1.z.literal('UGC-NativeTikTok'), profile: zod_1.z.literal('tiktok-classic-ios-47'), fontHashes: zod_1.z.record(zod_1.z.string()), maxRenders: zod_1.z.number() }),
|
|
139
142
|
]),
|
|
140
|
-
candidates: zod_1.z.array(zod_1.z.object({ element: matchedTextElement, previewConfig: zod_1.z.object({ width: zod_1.z.number(), height: zod_1.z.number(), aspectRatio: zod_1.z.string(), dimensionPreset: zod_1.z.literal('custom'), elements: zod_1.z.array(matchedTextElement), backgroundType: zod_1.z.literal('color'), backgroundColor: zod_1.z.string() }), maskIoU: zod_1.z.number().min(0).max(1), foregroundMae: zod_1.z.number().min(0).max(1), fontIdentity: zod_1.z.
|
|
143
|
+
candidates: zod_1.z.array(zod_1.z.object({ element: matchedTextElement, previewConfig: zod_1.z.object({ width: zod_1.z.number(), height: zod_1.z.number(), aspectRatio: zod_1.z.string(), dimensionPreset: zod_1.z.literal('custom'), elements: zod_1.z.array(matchedTextElement), backgroundType: zod_1.z.literal('color'), backgroundColor: zod_1.z.string() }), maskIoU: zod_1.z.number().min(0).max(1), outlineIoU: zod_1.z.number().min(0).max(1).nullable(), foregroundMae: zod_1.z.number().min(0).max(1).nullable(), fontIdentity: zod_1.z.enum(['identified', 'approximate']), quality: zod_1.z.enum(['close', 'approximate']) })).max(3),
|
|
144
|
+
fontIdentification: fontIdentificationSchema.nullable().optional(),
|
|
141
145
|
nativeResult: nativeTextMatchSchema.optional(), reasonCode: zod_1.z.string().max(80).nullable().optional(), nextActions: zod_1.z.array(zod_1.z.string()).max(8).optional(), fitAttempted: zod_1.z.boolean().optional(),
|
|
142
|
-
renders: zod_1.z.number().int().nonnegative(), backgroundColor: zod_1.z.string(), warnings: zod_1.z.array(zod_1.z.string()), previewUrl: zod_1.z.string().url(), manifestUrl: zod_1.z.string().url() });
|
|
146
|
+
renders: zod_1.z.number().int().nonnegative(), backgroundColor: zod_1.z.string().nullable(), warnings: zod_1.z.array(zod_1.z.string()), previewUrl: zod_1.z.string().url(), manifestUrl: zod_1.z.string().url() });
|
|
143
147
|
exports.mediaAnalysisResultSchema = zod_1.z.discriminatedUnion('operation', [exports.framesResultSchema, exports.scenesResultSchema, exports.imageTextResultSchema, exports.videoTextResultSchema, exports.audioTranscriptResultSchema, exports.audioLevelsResultSchema, exports.sampleColorsResultSchema, exports.measureLayoutResultSchema, exports.matchTextStyleResultSchema]).superRefine((value, ctx) => {
|
|
144
148
|
if (value.operation !== 'match_text_style')
|
|
145
149
|
return;
|
|
@@ -149,7 +153,10 @@ exports.mediaAnalysisResultSchema = zod_1.z.discriminatedUnion('operation', [exp
|
|
|
149
153
|
if ((value.status === 'fitted') !== (value.nativeResult !== undefined))
|
|
150
154
|
ctx.addIssue({ code: 'custom', path: ['nativeResult'], message: 'A fitted native match requires its reproducible settings and sticker.' });
|
|
151
155
|
}
|
|
152
|
-
else if (value.version !==
|
|
153
|
-
ctx.addIssue({ code: 'custom', message: 'Image-editor matching
|
|
156
|
+
else if (value.version !== 3 || value.renderer.name !== 'UGC-ImageEditorComposition' || value.nativeResult !== undefined) {
|
|
157
|
+
ctx.addIssue({ code: 'custom', message: 'Image-editor matching returns the version 3 font-library result shape.' });
|
|
158
|
+
}
|
|
159
|
+
else if (value.status === 'fitted' && !value.fontIdentification) {
|
|
160
|
+
ctx.addIssue({ code: 'custom', path: ['fontIdentification'], message: 'A fitted image-editor match names its identified library font.' });
|
|
154
161
|
}
|
|
155
162
|
});
|
|
@@ -220,7 +220,7 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
220
220
|
const backgroundOpacity = segment.backgroundOpacity ?? defaults_1.TEXT_DEFAULTS.backgroundOpacity;
|
|
221
221
|
const backgroundBorderRadius = segment.backgroundBorderRadius;
|
|
222
222
|
// Get font family
|
|
223
|
-
const fontFamily = (0, fonts_1.getFontFamily)(fontType);
|
|
223
|
+
const fontFamily = (0, fonts_1.getFontFamily)(fontType, segment.fontFamily);
|
|
224
224
|
// Calculate width and line breaks
|
|
225
225
|
const { calculatedWidth, calculatedLines, paddingTop, paddingRight, paddingBottom, paddingLeft } = (0, react_1.useMemo)(() => {
|
|
226
226
|
let finalPaddingTop = basePaddingTop;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert iMessage DM Composition props to ImageEditorElements
|
|
3
|
+
*
|
|
4
|
+
* This module transforms the composition props into renderable message elements.
|
|
5
|
+
* Header, footer, and status bar elements are rendered directly in the composition JSX.
|
|
6
|
+
*/
|
|
7
|
+
import type { ImageEditorElement } from '../../types/element';
|
|
8
|
+
import type { IMessageDmCompositionProps } from './types';
|
|
9
|
+
/** Tail render data for SVG rendering */
|
|
10
|
+
export interface TailRenderData {
|
|
11
|
+
id: string;
|
|
12
|
+
isUser: boolean;
|
|
13
|
+
messageLeft: number;
|
|
14
|
+
messageRight: number;
|
|
15
|
+
messageBottom: number;
|
|
16
|
+
}
|
|
17
|
+
/** Result of converting props to elements */
|
|
18
|
+
export interface ConversionResult {
|
|
19
|
+
elements: ImageEditorElement[];
|
|
20
|
+
imageUrls: Record<string, string>;
|
|
21
|
+
tails: TailRenderData[];
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
}
|
|
25
|
+
/** Input ID prefix for sender images */
|
|
26
|
+
export declare const SENDER_IMAGE_INPUT_ID_PREFIX = "sender-image-";
|
|
27
|
+
export declare function convertPropsToElements(props: IMessageDmCompositionProps): ConversionResult;
|