diff --git a/src/client/components/traits.jsx b/src/client/components/traits.jsx index e77a6d3..cc7a6c0 100644 --- a/src/client/components/traits.jsx +++ b/src/client/components/traits.jsx @@ -70,23 +70,25 @@ const makeTabSelector = (context, type) => createSelector( Object.values(mapObject(description, (description, key) => { const {label, options, type: componentType} = description; const Component = TypeRenderers[componentType]; - return Component - ? ( - - ) - : null; + :
{' '}
- {JSON.stringify(value, null, 2).slice(1).slice(0, -1).trim('\n')}
+ {(value ? JSON.stringify(value, null, 2).slice(1).slice(0, -1) : '').trim('\n')}
{'}'}
diff --git a/src/client/components/types/steps-lists.js b/src/client/components/types/steps-lists.js
index d9ef3e6..efcd291 100644
--- a/src/client/components/types/steps-lists.js
+++ b/src/client/components/types/steps-lists.js
@@ -1,13 +1,21 @@
import {flatten} from '@avocado/core';
import {Context} from '@avocado/behavior'
+import {Traversal} from '@avocado/behavior/item/traversal';
import {typeFits} from './typing';
-export const variableStepsList = (key, variable, variableType, type) => {
- const description = Context.typeDescription(variableType, variable);
+export const variableStepsList = (context, previousSteps, key, variable, variableType, type) => {
const steps = [];
if (typeFits(type, variableType)) {
steps.push({type: 'key', key});
+ }
+ const traversal = new Traversal({steps: previousSteps.concat(steps)});
+ const description = Context.typeDescription(
+ variableType,
+ traversal.get(context),
+ );
+ // TODO invoke can only work at the end of steps chain
+ if (typeFits(type, variableType)) {
if ('function' === typeof variable) {
steps.push({type: 'invoke', args: []});
}
@@ -17,7 +25,7 @@ export const variableStepsList = (key, variable, variableType, type) => {
}
const sublists = Object.entries(description)
.map(([key, description]) => (
- variableStepsList(key, variable[key], description.type, type)
+ variableStepsList(context, previousSteps.concat(steps), key, variable[key], description.type, type)
))
.map((childLists) => (
childLists.map((stepsList) => (
@@ -33,7 +41,7 @@ export const contextStepsList = (context, type) => (
flatten(
Object.entries(context.all())
.map(([key, [variable, variableType]]) => (
- variableStepsList(key, variable, variableType, type)
+ variableStepsList(context, [{type: 'key', key}], key, variable, variableType, type)
))
)
.filter((stepsList) => stepsList.length > 0)
diff --git a/src/client/components/types/steps.raw.scss b/src/client/components/types/steps.raw.scss
index 27e0c68..2cfd92e 100644
--- a/src/client/components/types/steps.raw.scss
+++ b/src/client/components/types/steps.raw.scss
@@ -33,7 +33,7 @@
display: flex;
}
-.bracket, .paren {
+.paren {
color: #999999;
}