@vibecuting/component-project-helper 0.1.137 → 0.1.138
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/package.json +1 -1
- package/src/decorators/index.test.ts +3 -0
- package/src/decorators/index.ts +3 -8
- package/src/discovery/index.test.ts +1 -0
- package/src/discovery/index.ts +2 -8
- package/src/index.ts +0 -1
- package/src/meta/update-component-meta.test.ts +1 -0
- package/src/meta/update-component-skills.test.ts +1 -0
- package/src/meta/update-component-skills.ts +2 -2
- package/src/resources/video-resource.ts +2 -11
- package/src/schemas/index.test.ts +1 -0
- package/src/schemas/index.ts +2 -1
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ test('attaches normalized metadata to decorated function components', () => {
|
|
|
13
13
|
sourceFile: 'src/components/SceneFrame.tsx',
|
|
14
14
|
aspectRatio: '16:9',
|
|
15
15
|
sceneType: 'scene',
|
|
16
|
+
motion: 'static',
|
|
16
17
|
tags: ['layout', 'frame'],
|
|
17
18
|
propsTypeName: 'SceneFrameProps',
|
|
18
19
|
})
|
|
@@ -32,6 +33,7 @@ test('attaches normalized metadata to decorated function components', () => {
|
|
|
32
33
|
sourceFile: 'src/components/SceneTitle.tsx',
|
|
33
34
|
aspectRatio: '16:9',
|
|
34
35
|
sceneType: 'intro',
|
|
36
|
+
motion: 'static',
|
|
35
37
|
tags: ['title', 'hero'],
|
|
36
38
|
propsTypeName: 'SceneTitleProps',
|
|
37
39
|
})
|
|
@@ -55,6 +57,7 @@ test('attaches metadata to components with required props', () => {
|
|
|
55
57
|
sourceFile: 'src/components/RequiredPropsScene.tsx',
|
|
56
58
|
aspectRatio: '16:9',
|
|
57
59
|
sceneType: 'scene',
|
|
60
|
+
motion: 'static',
|
|
58
61
|
tags: ['required', 'props'],
|
|
59
62
|
propsTypeName: 'RequiredProps',
|
|
60
63
|
})
|
package/src/decorators/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
VIDEO_RESOURCE_METADATA_KEY,
|
|
9
9
|
createVideoResourceAnnotation,
|
|
10
10
|
defineScenePluginMetadata as defineScenePluginMetadataBase,
|
|
11
|
-
inferSceneMotion,
|
|
12
11
|
defineThemePluginMetadata as defineThemePluginMetadataBase,
|
|
13
12
|
defineTransitionPluginMetadata as defineTransitionPluginMetadataBase,
|
|
14
13
|
getVideoResourceMetadata,
|
|
@@ -33,10 +32,7 @@ export function defineComponentProjectComponentMetadata(
|
|
|
33
32
|
metadata: ComponentProjectComponentMetadata,
|
|
34
33
|
): ComponentProjectComponentMetadata {
|
|
35
34
|
const parsed = ComponentProjectComponentMetadataSchema.parse(metadata)
|
|
36
|
-
return
|
|
37
|
-
...parsed,
|
|
38
|
-
motion: parsed.motion ?? inferSceneMotion(parsed),
|
|
39
|
-
} as ComponentProjectComponentMetadata
|
|
35
|
+
return parsed as ComponentProjectComponentMetadata
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
const sceneAnnotation = createVideoResourceAnnotation(sceneResourceDescriptor)
|
|
@@ -57,14 +53,14 @@ function normalizeSceneMetadata(
|
|
|
57
53
|
sourceFile: metadata.sourceFile,
|
|
58
54
|
aspectRatio: metadata.aspectRatio,
|
|
59
55
|
sceneType: metadata.sceneType,
|
|
60
|
-
motion:
|
|
56
|
+
motion: metadata.motion,
|
|
61
57
|
sceneFamily: 'custom',
|
|
62
58
|
themePreset: undefined,
|
|
63
59
|
slots: undefined,
|
|
64
60
|
propsTypeName: metadata.propsTypeName,
|
|
65
61
|
rootLayout: 'absolute-fill',
|
|
66
62
|
tags: metadata.tags,
|
|
67
|
-
pluginKey: metadata.name,
|
|
63
|
+
pluginKey: metadata.pluginKey ?? metadata.name,
|
|
68
64
|
})
|
|
69
65
|
}
|
|
70
66
|
|
|
@@ -77,7 +73,6 @@ export const TransitionComponent = transitionAnnotation.annotate
|
|
|
77
73
|
export const ThemeComponent = themeAnnotation.annotate
|
|
78
74
|
|
|
79
75
|
export const defineScenePluginMetadata = defineScenePluginMetadataBase
|
|
80
|
-
export { inferSceneMotion }
|
|
81
76
|
export const defineTransitionPluginMetadata = defineTransitionPluginMetadataBase
|
|
82
77
|
export const defineThemePluginMetadata = defineThemePluginMetadataBase
|
|
83
78
|
|
package/src/discovery/index.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
type VideoResourceDescriptor,
|
|
12
12
|
type VideoResourceMetadata,
|
|
13
13
|
defineScenePluginMetadata,
|
|
14
|
-
inferSceneMotion,
|
|
15
14
|
ScenePluginMetadataSchema,
|
|
16
15
|
} from '../resources/video-resource.ts'
|
|
17
16
|
import {
|
|
@@ -360,13 +359,7 @@ function collectMetadataVariables(sourceFile: ts.SourceFile): Map<string, ts.Exp
|
|
|
360
359
|
function normalizeSceneMetadata(value: unknown, filePath: string): ScenePluginMetadata {
|
|
361
360
|
const modern = ScenePluginMetadataSchema.safeParse(value)
|
|
362
361
|
if (modern.success) {
|
|
363
|
-
|
|
364
|
-
return defineScenePluginMetadata({
|
|
365
|
-
...modern.data,
|
|
366
|
-
motion: explicitMotion === 'animated' || explicitMotion === 'static'
|
|
367
|
-
? explicitMotion
|
|
368
|
-
: inferSceneMotion(modern.data),
|
|
369
|
-
})
|
|
362
|
+
return defineScenePluginMetadata(modern.data)
|
|
370
363
|
}
|
|
371
364
|
|
|
372
365
|
const legacy = ComponentProjectComponentMetadataSchema.safeParse(value)
|
|
@@ -383,6 +376,7 @@ function normalizeSceneMetadata(value: unknown, filePath: string): ScenePluginMe
|
|
|
383
376
|
tags: legacy.data.tags,
|
|
384
377
|
aspectRatio: legacy.data.aspectRatio,
|
|
385
378
|
sceneType: legacy.data.sceneType,
|
|
379
|
+
motion: legacy.data.motion,
|
|
386
380
|
sceneFamily: 'custom',
|
|
387
381
|
rootLayout: 'absolute-fill',
|
|
388
382
|
propsTypeName: legacy.data.propsTypeName,
|
package/src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ type VideoResourceMetaRecord = {
|
|
|
20
20
|
tags: string[]
|
|
21
21
|
aspectRatio?: '9:16' | '16:9'
|
|
22
22
|
sceneType?: 'intro' | 'scene' | 'outro'
|
|
23
|
-
motion
|
|
23
|
+
motion: 'static' | 'animated'
|
|
24
24
|
sceneFamily?: string
|
|
25
25
|
themePreset?: string
|
|
26
26
|
slots?: Array<string | {
|
|
@@ -133,7 +133,7 @@ function renderSceneMetadata(record: VideoResourceMetaRecord): string {
|
|
|
133
133
|
`- resourceKind: ${metadata.resourceKind}`,
|
|
134
134
|
` aspectRatio: ${metadata.aspectRatio ?? ''}`,
|
|
135
135
|
` sceneType: ${metadata.sceneType ?? ''}`,
|
|
136
|
-
` motion: ${metadata.motion
|
|
136
|
+
` motion: ${metadata.motion}`,
|
|
137
137
|
` sceneFamily: ${metadata.sceneFamily ?? ''}`,
|
|
138
138
|
` themePreset: ${metadata.themePreset ?? ''}`,
|
|
139
139
|
` rootLayout: ${metadata.rootLayout ?? ''}`,
|
|
@@ -34,7 +34,7 @@ export const ScenePluginMetadataSchema = BaseVideoResourceMetadataSchema.extend(
|
|
|
34
34
|
resourceKind: z.literal('scene'),
|
|
35
35
|
aspectRatio: z.enum(['9:16', '16:9']),
|
|
36
36
|
sceneType: z.enum(['intro', 'scene', 'outro']).optional(),
|
|
37
|
-
motion: SceneMotionSchema
|
|
37
|
+
motion: SceneMotionSchema,
|
|
38
38
|
sceneFamily: SceneFamilySchema.default('custom'),
|
|
39
39
|
themePreset: z.string().min(1).optional(),
|
|
40
40
|
slots: SceneSlotsSchema.optional(),
|
|
@@ -131,17 +131,8 @@ export function getVideoResourceMetadata<TMetadata extends VideoResourceMetadata
|
|
|
131
131
|
return parsed.data as TMetadata
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
export function inferSceneMotion(input: Pick<ScenePluginMetadataInput, 'name' | 'sourceFile'>): z.infer<typeof SceneMotionSchema> {
|
|
135
|
-
return input.name.endsWith('Animated') && /(?:^|\/)animated(?:\/|$)/u.test(input.sourceFile)
|
|
136
|
-
? 'animated'
|
|
137
|
-
: 'static'
|
|
138
|
-
}
|
|
139
|
-
|
|
140
134
|
export function defineScenePluginMetadata(input: ScenePluginMetadataInput): ScenePluginMetadata {
|
|
141
|
-
return ScenePluginMetadataSchema.parse(
|
|
142
|
-
...input,
|
|
143
|
-
motion: input.motion ?? inferSceneMotion(input),
|
|
144
|
-
})
|
|
135
|
+
return ScenePluginMetadataSchema.parse(input)
|
|
145
136
|
}
|
|
146
137
|
|
|
147
138
|
export function defineTransitionPluginMetadata(
|
package/src/schemas/index.ts
CHANGED
|
@@ -21,11 +21,12 @@ export type {
|
|
|
21
21
|
|
|
22
22
|
const ComponentProjectComponentMetadataInputSchema = z.object({
|
|
23
23
|
name: z.string().min(1),
|
|
24
|
+
pluginKey: z.string().min(1).optional(),
|
|
24
25
|
description: z.string().min(1),
|
|
25
26
|
sourceFile: z.string().min(1),
|
|
26
27
|
aspectRatio: z.enum(['9:16', '16:9']),
|
|
27
28
|
sceneType: z.enum(['intro', 'scene', 'outro']).optional(),
|
|
28
|
-
motion: z.enum(['static', 'animated'])
|
|
29
|
+
motion: z.enum(['static', 'animated']),
|
|
29
30
|
tags: z.array(z.string().min(1)).default([]),
|
|
30
31
|
propsTypeName: z.string().min(1).optional(),
|
|
31
32
|
})
|