-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust component tree colors #1109
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d3bbdcd
Add args to tree
RobbieTheWagner 46a8d01
Tweak based on feedback
RobbieTheWagner 12627b1
Add some initial colors
RobbieTheWagner 7b3b1c5
Add isCurlyInvocation
RobbieTheWagner 95f68a3
Fix scrolling issues, I think
RobbieTheWagner 0302acf
Delete dasherize.js
RobbieTheWagner 2bff865
Adjust component tree colors
nummi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
singleQuote: true, | ||
overrides: [ | ||
{ | ||
files: '**/*.hbs', | ||
options: { | ||
parser: 'glimmer', | ||
singleQuote: false | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { helper } from '@ember/component/helper'; | ||
|
||
/** | ||
* Determine the type of the component argument for display | ||
* | ||
* @method componentArgumentDisplay | ||
* @param {*} argument | ||
* @return {*} The argument with the correct type for display | ||
*/ | ||
export function componentArgumentDisplay([argument]) { | ||
if (typeof argument === 'string') { | ||
return JSON.stringify(argument).replace(/^\"|\"$/g, ''); | ||
} else if (typeof argument === 'object' && argument !== null) { | ||
return '...'; | ||
} | ||
|
||
return String(argument); | ||
} | ||
|
||
export default helper(componentArgumentDisplay); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { helper } from '@ember/component/helper'; | ||
|
||
export function isString([str]) { | ||
return typeof str === 'string'; | ||
} | ||
|
||
export default helper(isString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,7 @@ | |
{{if @item.isComponent "component-tree-item--component"}} | ||
{{if @item.hasInstance "component-tree-item--has-instance"}} | ||
{{if @item.isSelected "component-tree-item--selected"}} | ||
{{if @item.isHighlighted "component-tree-item--highlighted"}} | ||
" | ||
{{if @item.isHighlighted "component-tree-item--highlighted"}}" | ||
{{on "click" @item.toggleInspection}} | ||
{{on "mouseenter" @item.showPreview}} | ||
{{on "mouseleave" @item.hidePreview}} | ||
|
@@ -21,10 +20,81 @@ | |
{{/if}} | ||
|
||
<code | ||
class="component-tree-item__tag {{if @item.isComponent "component-tree-item__bracket"}} {{if (not @item.hasChildren) "component-tree-item__bracket--self-closing"}}" | ||
class="component-tree-item__tag | ||
{{if | ||
(and (not @item.isCurlyInvocation) @item.isComponent) | ||
"component-tree-item__bracket" | ||
}} | ||
{{if | ||
(and (not @item.isCurlyInvocation) (not @item.hasChildren) @item.isComponent) | ||
"component-tree-item__bracket--self-closing" | ||
}} | ||
{{if | ||
(and @item.isCurlyInvocation @item.isComponent) | ||
"component-tree-item-classic__bracket" | ||
}}" | ||
> | ||
{{#if @item.isComponent}} | ||
{{classify @item.name}} | ||
{{#if @item.args.positional}} | ||
<span class="component-name"> | ||
{{@item.name}} | ||
</span> | ||
|
||
{{#each @item.args.positional as |value|}} | ||
<div class="arg-token"> | ||
<span class="value-token"> | ||
{{component-argument value}} | ||
</span> | ||
</div> | ||
{{/each}} | ||
|
||
{{#each-in @item.args.named as |name value|}} | ||
<div class="arg-token"> | ||
<span class="key-token"> | ||
{{name}} | ||
</span> | ||
= | ||
<span class="value-token"> | ||
{{component-argument value}} | ||
</span> | ||
</div> | ||
{{/each-in}} | ||
{{else}} | ||
<span class="component-name"> | ||
{{classify @item.name}} | ||
</span> | ||
|
||
{{#each-in @item.args.named as |name value|}} | ||
<div class="arg-token"> | ||
{{#if (is-string value)}} | ||
<span class="at-token"> | ||
@ | ||
</span> | ||
<span class="key-token"> | ||
{{name}} | ||
</span> | ||
=" | ||
<span class="value-token"> | ||
{{component-argument value}} | ||
</span> | ||
" | ||
{{else}} | ||
<span class="at-token"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my personal opinion is that we probably don't need this 🤔 |
||
@ | ||
</span> | ||
<span class="key-token"> | ||
{{name}} | ||
</span> | ||
= | ||
<span class="bracket-token">\{{</span> | ||
<span class="value-token"> | ||
{{component-argument value}} | ||
</span> | ||
<span class="bracket-token">}}</span> | ||
{{/if}} | ||
</div> | ||
{{/each-in}} | ||
{{/if}} | ||
{{else if @item.isOutlet}} | ||
\{{outlet "{{@item.name}}"}} | ||
{{else if @item.isEngine}} | ||
|
@@ -51,4 +121,4 @@ | |
{{svg-jar "code-line" width="20px" height="20px"}} | ||
</button> | ||
{{/if}} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, this should probably just be
argument.replace(/\"/g, '\\"');
. Should probably leave a comment saying we are intentionally not wrapping it with quotes (doing it in the template), just escaping any interior quotes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was a side effect of adding
JSON.stringify
. Before, the quotes were not part of the value.