Skip to content

Commit

Permalink
add modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Feb 6, 2024
1 parent a415e9c commit 0529726
Show file tree
Hide file tree
Showing 10 changed files with 526 additions and 173 deletions.
9 changes: 9 additions & 0 deletions app/components/component-tree-arg.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ export default class ComponentTreeArg extends Component {

get displayValue() {
if (this.isObject) {
if (this.args.value.inspect) {
if (this.args.value.type === 'function') {
return this.args.value.inspect
.replace(/"/g, '\\"')
.replace('bound ', '')
.replace('{ ... }', '');
}
return this.args.value.inspect.replace(/"/g, '\\"');
}
return '...';
} else if (typeof this.args.value === 'string') {
// Escape any interior quotes – we will add the surrounding quotes in the template
Expand Down
10 changes: 10 additions & 0 deletions app/components/component-tree-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@
<span class="component-name">
{{@item.name}}
</span>
{{#each-in @item.args.named as |name value|}}
<div class="arg-token flex ml-2">
<span class="key-token">
{{name}}
</span>
={{if (is-string value) "\""}}
<ComponentTreeArg @value={{value}} />
{{if (is-string value) "\""}}
</div>
{{/each-in}}
{{/if}}
</code>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/components/object-inspector/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export default class ObjectInspectorProperty extends Component<ObjectInspectorPr
}

get cannotEdit() {
if (this.args.model.name === '...' || !this.isCalculated) return true;
return this.isFunction || this.isOverridden || this.readOnly;
if (this.args.model.name === '...' || !this.isCalculated || this.readOnly) return true;
return this.args.model?.value?.type !== 'type-string' && this.args.model?.value?.type !== 'type-number';
}

@action
Expand Down
7 changes: 5 additions & 2 deletions app/controllers/component-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,18 @@ class RenderItem {
}

get isComponent() {
return this.renderNode.type === 'component' || this.renderNode.type === 'remote-element';
return (
this.renderNode.type === 'component' ||
this.renderNode.type === 'remote-element'
);
}

get isModifier() {
return this.renderNode.type === 'modifier';
}

get isHtmlTag() {
return this.renderNode.type === 'htmlTag';
return this.renderNode.type === 'html-element';
}

get name() {
Expand Down
Loading

0 comments on commit 0529726

Please sign in to comment.