Skip to content

Commit 846afd9

Browse files
committed
Improve documentation with reference of all available effects.
1 parent 6125ff0 commit 846afd9

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

newIDE/app/scripts/lib/ExtensionReferenceGenerator.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,56 @@ const generateExtensionRawText = (
632632
...expressionsReferenceTexts,
633633
];
634634
}),
635+
{ text: '' },
636+
...extension
637+
.getExtensionEffectTypes()
638+
.toJSArray()
639+
.map(
640+
/**
641+
* @param {string} effectType
642+
* @returns {RawText}
643+
*/
644+
effectType => {
645+
const effectMetadata = extension.getEffectMetadata(effectType);
646+
const properties = effectMetadata.getProperties();
647+
const propertyNames = properties.keys().toJSArray();
648+
649+
return {
650+
text: [
651+
`### Effect "${effectMetadata.getFullName()}"`,
652+
'',
653+
`${effectMetadata.getDescription().replace(/\n/g, ' ')}`,
654+
'',
655+
...[
656+
effectMetadata.isMarkedAsUnique()
657+
? 'This effect can be added only once on a layer.'
658+
: null,
659+
effectMetadata.isMarkedAsOnlyWorkingFor2D()
660+
? effectMetadata.isMarkedAsNotWorkingForObjects()
661+
? 'This effect is for 2D layers only.'
662+
: 'This effect is for 2D layers or objects only.'
663+
: null,
664+
effectMetadata.isMarkedAsOnlyWorkingFor3D()
665+
? 'This effect is for 3D layers only.'
666+
: null,
667+
].filter(Boolean),
668+
'',
669+
`Properties of this effect are:`,
670+
'',
671+
...propertyNames.map(propertyName => {
672+
const propertyMetadata = properties.get(propertyName);
673+
return [
674+
propertyMetadata.getDescription()
675+
? `- **${propertyMetadata.getLabel()}**: ${propertyMetadata.getDescription()}.`
676+
: `- **${propertyMetadata.getLabel()}**.`,
677+
`Default value is \`${propertyMetadata.getValue()}\`. For events, write: \`"${propertyName}"\`.`,
678+
].join(' ');
679+
}),
680+
'',
681+
].join(`\n`),
682+
};
683+
}
684+
),
635685
generateExtensionFooterText({ extension }),
636686
].filter(Boolean);
637687
};

0 commit comments

Comments
 (0)