refactor: context description

This commit is contained in:
cha0s 2021-02-01 13:11:00 -06:00
parent 95c91e1c4b
commit 21e70ac4e4
3 changed files with 6 additions and 6 deletions

View File

@ -27,7 +27,7 @@ const Expression = ({
const Renderables = []; const Renderables = [];
let opsCount = 0; let opsCount = 0;
// eslint-disable-next-line react/destructuring-assignment // eslint-disable-next-line react/destructuring-assignment
let description = context.constructor.descriptionFor(context); let description = context.describeChildren();
const onChange = (event, value, localPath) => { const onChange = (event, value, localPath) => {
const patches = []; const patches = [];
const j = parseInt(relative(path, localPath).split('/')[1], 10); const j = parseInt(relative(path, localPath).split('/')[1], 10);
@ -339,7 +339,7 @@ Expression.propTypes = {
constructor: PropTypes.shape({ constructor: PropTypes.shape({
descriptionFor: PropTypes.func, descriptionFor: PropTypes.func,
}), }),
describe: PropTypes.func, describeChildren: PropTypes.func,
get: PropTypes.func, get: PropTypes.func,
}).isRequired, }).isRequired,
value: PropTypes.shape({ value: PropTypes.shape({

View File

@ -25,7 +25,7 @@ const Invocation = ({
childrenDescription={{ childrenDescription={{
'...': {label: '', type: 'undefined'}, '...': {label: '', type: 'undefined'},
'[literal]': {label: '', type: 'undefined'}, '[literal]': {label: '', type: 'undefined'},
...context.describe().children, ...context.describeChildren().children,
'[key]': {label: '', type: 'undefined'}, '[key]': {label: '', type: 'undefined'},
}} }}
key={path} key={path}
@ -104,7 +104,7 @@ Invocation.displayName = 'Invocation';
Invocation.propTypes = { Invocation.propTypes = {
context: PropTypes.shape({ context: PropTypes.shape({
describe: PropTypes.func, describeChildren: PropTypes.func,
}).isRequired, }).isRequired,
description: PropTypes.shape({ description: PropTypes.shape({
args: PropTypes.arrayOf( args: PropTypes.arrayOf(

View File

@ -64,7 +64,7 @@ const Literal = ({
setLiteralType(false); setLiteralType(false);
}; };
// eslint-disable-next-line react/destructuring-assignment // eslint-disable-next-line react/destructuring-assignment
const contextDescription = context.describe(); const contextDescription = context.describeChildren();
const valueComponent = (path, type, {value}) => { const valueComponent = (path, type, {value}) => {
switch (type) { switch (type) {
case 'bool': { case 'bool': {
@ -266,7 +266,7 @@ Literal.displayName = 'Literal';
Literal.propTypes = { Literal.propTypes = {
context: PropTypes.shape({ context: PropTypes.shape({
describe: PropTypes.func, describeChildren: PropTypes.func,
}).isRequired, }).isRequired,
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired,