@vibecuting/component-project-helper 0.1.136 → 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 +5 -3
- package/src/discovery/index.test.ts +1 -0
- package/src/discovery/index.ts +4 -2
- package/src/index.ts +2 -0
- 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 -0
- package/src/resources/video-resource.ts +4 -1
- package/src/schemas/index.test.ts +1 -0
- package/src/schemas/index.ts +2 -0
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
|
@@ -31,7 +31,8 @@ export type ComponentProjectComponentMetadata = LegacyComponentProjectComponentM
|
|
|
31
31
|
export function defineComponentProjectComponentMetadata(
|
|
32
32
|
metadata: ComponentProjectComponentMetadata,
|
|
33
33
|
): ComponentProjectComponentMetadata {
|
|
34
|
-
|
|
34
|
+
const parsed = ComponentProjectComponentMetadataSchema.parse(metadata)
|
|
35
|
+
return parsed as ComponentProjectComponentMetadata
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const sceneAnnotation = createVideoResourceAnnotation(sceneResourceDescriptor)
|
|
@@ -42,7 +43,7 @@ function normalizeSceneMetadata(
|
|
|
42
43
|
metadata: ComponentProjectComponentMetadata | ScenePluginMetadata,
|
|
43
44
|
): ScenePluginMetadata {
|
|
44
45
|
if ('resourceKind' in metadata) {
|
|
45
|
-
return
|
|
46
|
+
return defineScenePluginMetadataBase(metadata)
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
return ScenePluginMetadataSchema.parse({
|
|
@@ -52,13 +53,14 @@ function normalizeSceneMetadata(
|
|
|
52
53
|
sourceFile: metadata.sourceFile,
|
|
53
54
|
aspectRatio: metadata.aspectRatio,
|
|
54
55
|
sceneType: metadata.sceneType,
|
|
56
|
+
motion: metadata.motion,
|
|
55
57
|
sceneFamily: 'custom',
|
|
56
58
|
themePreset: undefined,
|
|
57
59
|
slots: undefined,
|
|
58
60
|
propsTypeName: metadata.propsTypeName,
|
|
59
61
|
rootLayout: 'absolute-fill',
|
|
60
62
|
tags: metadata.tags,
|
|
61
|
-
pluginKey: metadata.name,
|
|
63
|
+
pluginKey: metadata.pluginKey ?? metadata.name,
|
|
62
64
|
})
|
|
63
65
|
}
|
|
64
66
|
|
package/src/discovery/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type TransitionPluginMetadata,
|
|
11
11
|
type VideoResourceDescriptor,
|
|
12
12
|
type VideoResourceMetadata,
|
|
13
|
+
defineScenePluginMetadata,
|
|
13
14
|
ScenePluginMetadataSchema,
|
|
14
15
|
} from '../resources/video-resource.ts'
|
|
15
16
|
import {
|
|
@@ -358,7 +359,7 @@ function collectMetadataVariables(sourceFile: ts.SourceFile): Map<string, ts.Exp
|
|
|
358
359
|
function normalizeSceneMetadata(value: unknown, filePath: string): ScenePluginMetadata {
|
|
359
360
|
const modern = ScenePluginMetadataSchema.safeParse(value)
|
|
360
361
|
if (modern.success) {
|
|
361
|
-
return modern.data
|
|
362
|
+
return defineScenePluginMetadata(modern.data)
|
|
362
363
|
}
|
|
363
364
|
|
|
364
365
|
const legacy = ComponentProjectComponentMetadataSchema.safeParse(value)
|
|
@@ -366,7 +367,7 @@ function normalizeSceneMetadata(value: unknown, filePath: string): ScenePluginMe
|
|
|
366
367
|
throw new Error(`${filePath}: invalid scene metadata`)
|
|
367
368
|
}
|
|
368
369
|
|
|
369
|
-
return
|
|
370
|
+
return defineScenePluginMetadata({
|
|
370
371
|
resourceKind: 'scene',
|
|
371
372
|
name: legacy.data.name,
|
|
372
373
|
description: legacy.data.description,
|
|
@@ -375,6 +376,7 @@ function normalizeSceneMetadata(value: unknown, filePath: string): ScenePluginMe
|
|
|
375
376
|
tags: legacy.data.tags,
|
|
376
377
|
aspectRatio: legacy.data.aspectRatio,
|
|
377
378
|
sceneType: legacy.data.sceneType,
|
|
379
|
+
motion: legacy.data.motion,
|
|
378
380
|
sceneFamily: 'custom',
|
|
379
381
|
rootLayout: 'absolute-fill',
|
|
380
382
|
propsTypeName: legacy.data.propsTypeName,
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export {
|
|
|
2
2
|
VIDEO_RESOURCE_METADATA_KEY,
|
|
3
3
|
BaseVideoResourceMetadataSchema,
|
|
4
4
|
ScenePluginMetadataSchema,
|
|
5
|
+
SceneMotionSchema,
|
|
5
6
|
SceneSlotsSchema,
|
|
6
7
|
SceneSlotHintSchema,
|
|
7
8
|
ThemePluginMetadataSchema,
|
|
@@ -11,6 +12,7 @@ export {
|
|
|
11
12
|
createVideoResourceAnnotation,
|
|
12
13
|
getVideoResourceMetadata,
|
|
13
14
|
type ScenePluginMetadata,
|
|
15
|
+
type ScenePluginMetadataInput,
|
|
14
16
|
type SceneSlotHint,
|
|
15
17
|
type ThemePluginMetadata,
|
|
16
18
|
type TransitionPluginMetadata,
|
|
@@ -20,6 +20,7 @@ type VideoResourceMetaRecord = {
|
|
|
20
20
|
tags: string[]
|
|
21
21
|
aspectRatio?: '9:16' | '16:9'
|
|
22
22
|
sceneType?: 'intro' | 'scene' | 'outro'
|
|
23
|
+
motion: 'static' | 'animated'
|
|
23
24
|
sceneFamily?: string
|
|
24
25
|
themePreset?: string
|
|
25
26
|
slots?: Array<string | {
|
|
@@ -132,6 +133,7 @@ function renderSceneMetadata(record: VideoResourceMetaRecord): string {
|
|
|
132
133
|
`- resourceKind: ${metadata.resourceKind}`,
|
|
133
134
|
` aspectRatio: ${metadata.aspectRatio ?? ''}`,
|
|
134
135
|
` sceneType: ${metadata.sceneType ?? ''}`,
|
|
136
|
+
` motion: ${metadata.motion}`,
|
|
135
137
|
` sceneFamily: ${metadata.sceneFamily ?? ''}`,
|
|
136
138
|
` themePreset: ${metadata.themePreset ?? ''}`,
|
|
137
139
|
` rootLayout: ${metadata.rootLayout ?? ''}`,
|
|
@@ -28,11 +28,13 @@ export const SceneSlotsSchema = z.union([
|
|
|
28
28
|
])
|
|
29
29
|
|
|
30
30
|
const SceneFamilySchema = z.enum(['slide', 'canvas-2d', 'game-2d', 'three-3d', 'custom'])
|
|
31
|
+
export const SceneMotionSchema = z.enum(['static', 'animated'])
|
|
31
32
|
|
|
32
33
|
export const ScenePluginMetadataSchema = BaseVideoResourceMetadataSchema.extend({
|
|
33
34
|
resourceKind: z.literal('scene'),
|
|
34
35
|
aspectRatio: z.enum(['9:16', '16:9']),
|
|
35
36
|
sceneType: z.enum(['intro', 'scene', 'outro']).optional(),
|
|
37
|
+
motion: SceneMotionSchema,
|
|
36
38
|
sceneFamily: SceneFamilySchema.default('custom'),
|
|
37
39
|
themePreset: z.string().min(1).optional(),
|
|
38
40
|
slots: SceneSlotsSchema.optional(),
|
|
@@ -58,6 +60,7 @@ export const VideoResourceMetadataSchema = z.discriminatedUnion('resourceKind',
|
|
|
58
60
|
])
|
|
59
61
|
|
|
60
62
|
export type ScenePluginMetadata = z.infer<typeof ScenePluginMetadataSchema>
|
|
63
|
+
export type ScenePluginMetadataInput = z.input<typeof ScenePluginMetadataSchema>
|
|
61
64
|
export type SceneSlotHint = z.infer<typeof SceneSlotHintSchema>
|
|
62
65
|
export type TransitionPluginMetadata = z.infer<typeof TransitionPluginMetadataSchema>
|
|
63
66
|
export type ThemePluginMetadata = z.infer<typeof ThemePluginMetadataSchema>
|
|
@@ -128,7 +131,7 @@ export function getVideoResourceMetadata<TMetadata extends VideoResourceMetadata
|
|
|
128
131
|
return parsed.data as TMetadata
|
|
129
132
|
}
|
|
130
133
|
|
|
131
|
-
export function defineScenePluginMetadata(input:
|
|
134
|
+
export function defineScenePluginMetadata(input: ScenePluginMetadataInput): ScenePluginMetadata {
|
|
132
135
|
return ScenePluginMetadataSchema.parse(input)
|
|
133
136
|
}
|
|
134
137
|
|
package/src/schemas/index.ts
CHANGED
|
@@ -21,10 +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(),
|
|
29
|
+
motion: z.enum(['static', 'animated']),
|
|
28
30
|
tags: z.array(z.string().min(1)).default([]),
|
|
29
31
|
propsTypeName: z.string().min(1).optional(),
|
|
30
32
|
})
|