@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecuting/component-project-helper",
3
- "version": "0.1.137",
3
+ "version": "0.1.138",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "main": "./src/index.ts",
@@ -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
  })
@@ -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: inferSceneMotion(metadata),
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
 
@@ -35,6 +35,7 @@ test('discovers scene, transition and theme resources from installed packages',
35
35
  tags: ['demo'],
36
36
  aspectRatio: '16:9',
37
37
  sceneType: 'scene',
38
+ motion: 'static',
38
39
  sceneFamily: 'custom',
39
40
  rootLayout: 'absolute-fill',
40
41
  })
@@ -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
- const explicitMotion = value && typeof value === 'object' && 'motion' in value ? value.motion : undefined
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
@@ -47,7 +47,6 @@ export {
47
47
  VideoComponent,
48
48
  defineComponentProjectComponentMetadata,
49
49
  defineScenePluginMetadata,
50
- inferSceneMotion,
51
50
  defineThemePluginMetadata,
52
51
  defineTransitionPluginMetadata,
53
52
  getScenePluginMetadata,
@@ -35,6 +35,7 @@ test('writes and checks the unified video resource metadata file', async () => {
35
35
  tags: ['demo'],
36
36
  aspectRatio: '16:9',
37
37
  sceneType: 'scene',
38
+ motion: 'static',
38
39
  sceneFamily: 'custom',
39
40
  rootLayout: 'absolute-fill',
40
41
  })
@@ -31,6 +31,7 @@ test('writes and checks the skill docs from generated metadata', async () => {
31
31
  tags: ['demo'],
32
32
  aspectRatio: '16:9',
33
33
  sceneType: 'scene',
34
+ motion: 'static',
34
35
  sceneFamily: 'custom',
35
36
  rootLayout: 'absolute-fill',
36
37
  propsTypeName: 'DemoSceneProps',
@@ -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?: 'static' | 'animated'
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 ?? 'static'}`,
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.default('static'),
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(
@@ -9,6 +9,7 @@ test('validates component metadata', () => {
9
9
  sourceFile: 'src/components/SceneFrame.tsx',
10
10
  aspectRatio: '16:9',
11
11
  sceneType: 'scene',
12
+ motion: 'static',
12
13
  tags: ['layout', 'frame'],
13
14
  propsTypeName: 'SceneFrameProps',
14
15
  })
@@ -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']).optional(),
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
  })