2020-06-19 17:59:14 -05:00
|
|
|
export function behaviorContextTypes() {
|
|
|
|
return {
|
2020-06-19 22:01:45 -05:00
|
|
|
entity: (entity) => {
|
|
|
|
const traitTypes = !entity
|
|
|
|
? {}
|
|
|
|
: Object.values(entity.allTraitInstances())
|
|
|
|
.reduce(
|
|
|
|
(r, {constructor: {behaviorContextTypes, describeParams, describeState}}) => ({
|
|
|
|
...r,
|
|
|
|
...behaviorContextTypes(),
|
|
|
|
...describeParams(),
|
|
|
|
...describeState(),
|
|
|
|
}), {},
|
|
|
|
);
|
|
|
|
return {
|
|
|
|
...traitTypes,
|
|
|
|
invokeHook: {
|
|
|
|
type: 'object',
|
|
|
|
label: 'Invoke hook.',
|
|
|
|
args: [
|
|
|
|
['hook', {
|
|
|
|
type: 'string',
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
2020-06-19 17:59:14 -05:00
|
|
|
};
|
|
|
|
}
|