Skip to content

Commit 0c8f9b6

Browse files
committed
lib/ui utility classes (emberjs#1147)
* Cleanup warning message component - Move to lib/ui - Utility classes * Cleanup error page component - utility classes * Cleanup disclosure triangle component - utility classes * Cleanup drag handle component - utility classes * Cleanup empty message component - utility classes * Cleanup toolbar divider component - utility classes * Cleanup toolbar search field component - utility classes * Misc nav and pill css cleanup * Use ember-test-selectors - Use ember-test-selectors across entire app - Upgrade ember-test-selectors
1 parent e046038 commit 0c8f9b6

36 files changed

Lines changed: 1365 additions & 3043 deletions

app/styles/base.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
:root {
22
--font-sans-serif: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Cantarell', 'Oxygen', 'Ubuntu', 'Helvetica Neue', helvetica, arial, sans-serif;
33
--font-monospace: 'SF Mono', Menlo, Monaco, monospace;
4+
--inherit: inherit;
45
--unit0: 0;
56
--unit1: 4px;
67
--unit2: calc(var(--unit1) * 2);

app/styles/utils.scss

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1-
$units: 0, 1, 2, 3, 4;
1+
$units: 0, 1, 2, 3, 4, 5, 6;
22

3+
.box-border { box-sizing: border-box; }
4+
5+
.absolute { position: absolute; }
36
.relative { position: relative; }
47

58
.sticky {
69
position: -webkit-sticky;
710
position: sticky;
811
}
912

10-
.right-0 {
11-
right: 0;
12-
}
13+
.top-0 { top: 0; }
14+
.right-0 { right: 0; }
15+
.bottom-0 { bottom: 0; }
16+
.left-0 { left: 0; }
17+
18+
.overflow-auto { overflow: auto; }
19+
.overflow-hidden { overflow: hidden; }
1320

21+
.inline-block { display: inline-block; }
1422
.flex { display: flex; }
1523
.inline-flex { display: inline-flex; }
1624

@@ -19,19 +27,27 @@ $units: 0, 1, 2, 3, 4;
1927
.flex-shrink { flex-shrink: 1; }
2028
.flex-shrink-0 { flex-shrink: 0; }
2129

30+
.flex-row { flex-direction: row; }
31+
.flex-col { flex-direction: column; }
2232
.items-center { align-items: center; }
2333
.self-stretch { align-self: stretch; }
34+
.justify-start { justify-content: flex-start; }
35+
.justify-center { justify-content: center; }
2436

25-
.w-5 { width: var(--unit5); }
26-
.w-6 { width: var(--unit6); }
2737
.w-7 { width: var(--unit7); }
2838
.w-8 { width: var(--unit8); }
2939
.w-9 { width: var(--unit9); }
3040
.w-10 { width: var(--unit10); }
3141
.w-11 { width: var(--unit11); }
3242
.w-12 { width: var(--unit12); }
3343

44+
.w-full { width: 100%; }
45+
.w-auto { width: auto; }
3446
.h-full { height: 100%; }
47+
.h-auto { height: auto; }
48+
49+
.m-auto { margin: auto; }
50+
.border-0 { border-width: 0; }
3551

3652
@each $key in $units {
3753
.w-#{$key} { width: var(--unit#{$key}); }
@@ -70,8 +86,6 @@ $units: 0, 1, 2, 3, 4;
7086
}
7187
}
7288

73-
.border-0 { border-width: 0; }
74-
7589
.rounded-none { border-radius: 0; }
7690
.rounded-sm { border-radius: calc(var(--unit1) / 2); }
7791
.rounded { border-radius: var(--unit1); }
@@ -80,18 +94,49 @@ $units: 0, 1, 2, 3, 4;
8094

8195
.font-bold { font-weight: bold; }
8296
.font-mono { font-family: var(--font-monospace); }
97+
.leading-none { line-height: 1; }
8398
.no-underline { text-decoration: none; }
99+
.underline { text-decoration: underline; }
84100
.text-left { text-align: left; }
85101
.text-center { text-align: center; }
86102
.text-right { text-align: right; }
87103
.whitespace-no-wrap { white-space: nowrap; }
88104

89105
.bg-transparent { background-color: var(--transparent); }
90-
.bg-base00 { background-color: var(--base00); }
91-
.bg-base01 { background-color: var(--base01); }
92-
.bg-base02 { background-color: var(--base02); }
106+
107+
.fill-current { fill: currentColor; }
93108

94109
.cursor-default { cursor: default; }
95110
.cursor-pointer { cursor: pointer; }
111+
.cursor-col-resize { cursor: col-resize; }
96112

97113
.z-10 { z-index: 10; }
114+
115+
.appearance-none {
116+
-webkit-appearance: none;
117+
-moz-appearance: none;
118+
appearance: none;
119+
}
120+
121+
.pointer-events-none { pointer-events: none; }
122+
123+
.outline-none { outline: 0; }
124+
125+
/*
126+
Utilities not part of Tailwind:
127+
*/
128+
129+
.text-inherit { color: var(--inherit); }
130+
131+
.bg-base00 { background-color: var(--base00); }
132+
.bg-base01 { background-color: var(--base01); }
133+
.bg-base02 { background-color: var(--base02); }
134+
.bg-base05 { background-color: var(--base05); }
135+
.bg-spec00 { background-color: var(--spec00); }
136+
137+
.text-base11 { color: var(--base11); }
138+
.text-base13 { color: var(--base13); }
139+
140+
.text-12 { font-size: 12px; }
141+
.text-13 { font-size: 13px; }
142+
.text-18 { font-size: 18px; }

app/templates/components/component-tree-item.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<button
9797
class="component-tree-item__action inline-flex items-center h-full p-0 border-0 cursor-pointer bg-transparent z-10"
9898
title="Scroll into view"
99-
data-test="scroll-into-view"
99+
data-test-scroll-into-view
100100
{{on "click" @item.scrollIntoView}}
101101
>
102102
{{svg-jar "eye" width="20px" height="20px"}}

app/templates/components/deprecation-item.hbs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Ui::Disclosure as |disclosure|>
2-
<div class="deprecation-item px-3" data-test="deprecation-item">
2+
<div class="deprecation-item px-3" data-test-deprecation-item>
33
<div class="flex items-center">
44
<div
55
class="flex items-center flex-grow py-2"
@@ -12,12 +12,12 @@
1212
{{/if}}
1313

1414
<div class="w-12 flex-shrink-0 pr-2 text-right">
15-
<span class="pill" data-test="deprecation-count">
15+
<span class="pill" data-test-deprecation-count>
1616
{{@model.count}}
1717
</span>
1818
</div>
1919

20-
<span class="flex-grow font-bold" data-test="deprecation-message">
20+
<span class="flex-grow font-bold" data-test-deprecation-message>
2121
{{@model.message}}
2222
</span>
2323
</div>
@@ -26,7 +26,7 @@
2626
<button
2727
class="send-to-console send-to-console--chevron-only mr-2"
2828
title="Trace deprecations in console"
29-
data-test="full-trace-deprecations-btn"
29+
data-test-full-trace-deprecations-btn
3030
{{on "click" (fn @traceDeprecations @model)}}
3131
>
3232
{{svg-jar "send-with-chevron" width="6px" height="9px"}}
@@ -50,11 +50,11 @@
5050
{{#if (and @model.hasSourceMap disclosure.isExpanded)}}
5151
{{#each @model.sources as |single|}}
5252
<DeprecationItemSource @model={{single}} as |source|>
53-
<div class="deprecation-source pb-2" data-test="deprecation-source">
53+
<div class="deprecation-source pb-2" data-test-deprecation-source>
5454
<button
5555
class="send-to-console send-to-console--chevron-only mr-3"
5656
title="Trace deprecations in console"
57-
data-test="trace-deprecations-btn"
57+
data-test-trace-deprecations-btn
5858
{{on "click" (fn @traceSource @model source.model)}}
5959
>
6060
{{svg-jar "send-with-chevron" width="6px" height="9px"}}
@@ -65,13 +65,13 @@
6565
<a
6666
class="font-mono"
6767
href="#"
68-
data-test="deprecation-source-link"
68+
data-test-deprecation-source-link
6969
{{action @openResource source.model.map}}
7070
>
7171
{{source.url}}
7272
</a>
7373
{{else}}
74-
<span class="font-mono" data-test="deprecation-source-text">
74+
<span class="font-mono" data-test-deprecation-source-text>
7575
{{source.url}}
7676
</span>
7777
{{/if}}

app/templates/components/promise-item.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
<@list.cell>
2929
<div
30-
class="pill pill--bold pill--text js-promise-state"
30+
class="pill pill--text font-bold js-promise-state"
3131
style={{this.style}}
3232
>
3333
{{this.state}}

app/templates/components/route-cell-name.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
title={{@route.value.name}}
44
class={{concat
55
"js-route-name"
6-
(if this.isCurrent " pill pill--bold pill--blue pill--text")
6+
(if this.isCurrent " pill pill--blue pill--text font-bold")
77
}}
88
>
99
{{@route.value.name}}

app/templates/components/warning-message.hbs

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/templates/deprecations-toolbar.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919

2020
<Ui::ToolbarSearchField
2121
@value={{this.searchValue}}
22-
data-test="deprecations-search"
22+
data-test-deprecations-search
2323
/>
2424
</div>

app/templates/records.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
as |h|
77
>
88
<h.row as |r|>
9-
<r.cell data-test-table-header-column="" />
9+
<r.cell data-test-table-header-column />
1010
</h.row>
1111
</t.head>
1212
<t.body
@@ -18,10 +18,10 @@
1818
>
1919
<b.row
2020
class={{if (mod b.rowMeta.index 2) "striped"}}
21-
data-test-table-row=""
21+
data-test-table-row
2222
as |r|
2323
>
24-
<r.cell data-test-table-cell="" as |value column row|>
24+
<r.cell data-test-table-cell as |value column row|>
2525
<span class={{row.color}}>
2626
{{value}}
2727
</span>

app/templates/render-tree.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{#unless this.isWarningClosed}}
2-
<WarningMessage @close={{this.closeWarning}}>
2+
<Ui::WarningMessage @close={{this.closeWarning}}>
33
Render times may be inaccurate due to instrumentation and environment
4-
</WarningMessage>
4+
</Ui::WarningMessage>
55
{{/unless}}
66

77
{{#if this.showEmpty}}

0 commit comments

Comments
 (0)