Skip to content

Commit 7a5e83e

Browse files
committed
add modifiers
1 parent ea7c146 commit 7a5e83e

File tree

11 files changed

+516
-158
lines changed

11 files changed

+516
-158
lines changed

app/components/component-tree-arg.js

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ export default class ComponentTreeArg extends Component {
1212

1313
get displayValue() {
1414
if (this.isObject) {
15+
if (this.args.value.inspect) {
16+
if (this.args.value.type === 'function') {
17+
return this.args.value.inspect
18+
.replace(/"/g, '\\"')
19+
.replace('bound ', '')
20+
.replace('{ ... }', '');
21+
}
22+
return this.args.value.inspect.replace(/"/g, '\\"');
23+
}
1524
return '...';
1625
} else if (typeof this.args.value === 'string') {
1726
// Escape any interior quotes – we will add the surrounding quotes in the template

app/components/component-tree-item.hbs

+16-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<code
2525
class="component-tree-item__tag flex whitespace-no-wrap
2626
{{if
27-
@item.isComponent
27+
(or @item.isComponent @item.isModifier @item.isHtmlTag)
2828
(if
2929
@item.isCurlyInvocation
3030
"component-tree-item-classic__bracket"
@@ -37,7 +37,7 @@
3737
}}"
3838
>
3939
{{!-- template-lint-disable no-unbalanced-curlies --}}
40-
{{#if @item.isComponent}}
40+
{{#if (or @item.isComponent @item.isModifier)}}
4141
{{#if @item.isCurlyInvocation}}
4242
<span class="component-name">
4343
{{@item.name}}
@@ -83,6 +83,20 @@
8383
\{{mount "{{@item.name}}"}}
8484
{{else if @item.isRouteTemplate}}
8585
{{@item.name}} route
86+
{{else if @item.isHtmlTag}}
87+
<span class="component-name">
88+
{{@item.name}}
89+
</span>
90+
{{#each-in @item.args.named as |name value|}}
91+
<div class="arg-token flex ml-2">
92+
<span class="key-token">
93+
{{name}}
94+
</span>
95+
={{if (is-string value) "\""}}
96+
<ComponentTreeArg @value={{value}} />
97+
{{if (is-string value) "\""}}
98+
</div>
99+
{{/each-in}}
86100
{{/if}}
87101
</code>
88102
</div>

app/components/object-inspector/property.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ export default class ObjectInspectorProperty extends Component<ObjectInspectorPr
119119
}
120120

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

126126
@action

app/controllers/component-tree.js

+11
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@ class RenderItem {
304304
return this.renderNode.type === 'component';
305305
}
306306

307+
get isModifier() {
308+
return this.renderNode.type === 'modifier';
309+
}
310+
311+
get isHtmlTag() {
312+
return this.renderNode.type === 'html-element';
313+
}
314+
307315
get name() {
308316
return this.renderNode.name;
309317
}
@@ -313,6 +321,9 @@ class RenderItem {
313321
}
314322

315323
get isCurlyInvocation() {
324+
if (this.isModifier) {
325+
return true;
326+
}
316327
return this.renderNode.args && this.renderNode.args.positional;
317328
}
318329

ember-cli-build.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -381,19 +381,18 @@ module.exports = function (defaults) {
381381
if (env === 'test') {
382382
// `ember test` expects the index.html file to be in the
383383
// output directory.
384-
output = mergeTrees([dists.basic, dists.chrome]);
385-
} else {
386384
// Change base tag for running tests in development env.
387385
dists.basic = replace(dists.basic, {
388386
files: ['tests/index.html'],
389387
patterns: [
390388
{
391389
match: /<base.*\/>/,
392-
replacement: '<base href="../" />',
390+
replacement: '',
393391
},
394392
],
395393
});
396-
394+
output = mergeTrees([dists.basic, dists.chrome]);
395+
} else {
397396
dists.testing = mergeTrees([dists.basic, dists.chrome]);
398397

399398
output = mergeTrees([

0 commit comments

Comments
 (0)