MCPcopy
hub / github.com/vuetifyjs/vuetify / propsFactory

Function propsFactory

packages/vuetify/src/util/propsFactory.ts:31–57  ·  view source on GitHub ↗
(props: PropsOptions, source: string)

Source from the content-addressed store, hash-verified

29 */
30
31export function propsFactory<
32 PropsOptions extends ComponentObjectPropsOptions
33> (props: PropsOptions, source: string) {
34 return <Defaults extends PartialKeys<PropsOptions> = {}>(
35 defaults?: Defaults
36 ): AppendDefault<PropsOptions, Defaults> => {
37 return Object.keys(props).reduce<any>((obj, prop) => {
38 const isObjectDefinition = typeof props[prop] === 'object' && props[prop] != null && !Array.isArray(props[prop])
39 const definition = isObjectDefinition ? props[prop] : { type: props[prop] }
40
41 if (defaults && prop in defaults) {
42 obj[prop] = {
43 ...definition,
44 default: defaults[prop],
45 }
46 } else {
47 obj[prop] = definition
48 }
49
50 if (source && !obj[prop].source) {
51 obj[prop].source = source
52 }
53
54 return obj
55 }, {})
56 }
57}
58
59type AppendDefault<T extends ComponentObjectPropsOptions, D extends PartialKeys<T>> = {
60 [P in keyof T]-?: unknown extends D[P]

Callers 15

VVideoVolume.tsxFile · 0.90
VVideoControls.tsxFile · 0.90
VVideo.tsxFile · 0.90
VHeatmap.tsxFile · 0.90
VHeatmapLegend.tsxFile · 0.90
VHeatmapCell.tsxFile · 0.90
VProgress.tsxFile · 0.90
VMonthPicker.tsxFile · 0.90
VHighlight.tsxFile · 0.90
VPieTooltip.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…