Skip to content

Commit 0acb8de

Browse files
authored
Merge branch 'master' into update-table-of-contents-component-to-glimmer
2 parents 97bc2dc + 361f97c commit 0acb8de

File tree

8 files changed

+141
-107
lines changed

8 files changed

+141
-107
lines changed
+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<section class='{{@type}}'>
2+
{{!-- TODO: Fix this link for a11y --}}
3+
<h3 class='class-field-description--link' data-anchor='{{@field.name}}' role='link' {{on 'click' (fn this.updateAnchor @field.name)}}>
4+
<a class='anchor' {{!-- template-lint-disable link-href-attributes --}}>
5+
{{svg-jar 'fa-link' class='class-field-description--link-hover' width='20px' height='20px'}}
6+
</a>
7+
<span class='{{@type}}-name'>{{@field.name}}</span>
8+
{{#if @field.params}}
9+
<span class='args'>
10+
({{join ', ' (map-by 'name' @field.params)}})
11+
</span>
12+
{{/if}}
13+
{{#if @field.return}}
14+
<span class='return-type'>{{@field.return.type}}</span>
15+
{{/if}}
16+
{{#if @field.access}}
17+
<span class='access'>{{@field.access}}</span>
18+
{{/if}}
19+
{{#if @field.deprecated}}
20+
<span class='access'>deprecated</span>
21+
{{/if}}
22+
</h3>
23+
{{#if @model.module}}
24+
<div class='attributes'>
25+
<div class='attribute'>
26+
<span class='attribute-label'>Module:</span>
27+
<span class='attribute-value'><LinkTo @route='project-version.modules.module' @models={{array @model.projectVersion.compactVersion @model.module}}>{{@model.module}}</LinkTo></span>
28+
</div>
29+
</div>
30+
{{/if}}
31+
<p class='github-link' data-test-file={{@field.file}}>
32+
{{#if @field.inherited}}
33+
Inherited from
34+
<a href='{{github-link @model.project.id @model.projectVersion.version @field.file @field.line}}' target='_blank' rel='noopener noreferrer'>
35+
{{@field.inheritedFrom}} {{@field.file}}:{{@field.line}}
36+
</a>
37+
{{else}}
38+
Defined in
39+
<a href='{{github-link @model.project.id @model.projectVersion.version @field.file @field.line}}' target='_blank' rel='noopener noreferrer'>
40+
{{@field.file}}:{{@field.line}}
41+
</a>
42+
{{/if}}
43+
</p>
44+
{{#if @field.since}}
45+
<p class='field-since'>
46+
Available since v{{@field.since}}
47+
</p>
48+
{{/if}}
49+
{{#if (and (eq @field.static 1) (eq @field.itemtype 'method') this.hasImportExample)}}
50+
<ImportExample @item={{concat '{ ' @field.name ' }'}} @package={{@field.class}}/>
51+
{{/if}}
52+
<dl class='parameters'>
53+
{{#each @field.params as |param|}}
54+
<div class='parameter'>
55+
<dt>{{param.name}}</dt>
56+
<dd class='parameter-type'>{{param.type}}</dd>
57+
<dd>{{param.description}}</dd>
58+
{{#if param.props}}
59+
<dl class='parameters'>
60+
{{#each param.props as |prop|}}
61+
<div class='prop'>
62+
<dt>{{prop.name}}</dt>
63+
<dd class='parameter-type'>{{prop.type}}</dd>
64+
<dd>{{prop.description}}</dd>
65+
</div>
66+
{{/each}}
67+
</dl>
68+
{{/if}}
69+
</div>
70+
{{/each}}
71+
{{#if @field.return}}
72+
<div class='return'>
73+
<dt>returns</dt>
74+
<dd class='return-type'>{{@field.return.type}}</dd>
75+
<dd>{{@field.return.description}}</dd>
76+
</div>
77+
{{/if}}
78+
</dl>
79+
{{html-safe @field.description}}
80+
</section>
+8-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { inject as service } from '@ember/service';
2-
import Component from '@ember/component';
2+
import Component from '@glimmer/component';
3+
import { action } from '@ember/object';
34

45
export default class ClassFieldDescription extends Component {
56
@service
67
legacyModuleMappings;
78

89
get hasImportExample() {
910
return this.legacyModuleMappings.hasFunctionMapping(
10-
this.field.name,
11-
this.field.class
11+
this.args.field.name,
12+
this.args.field.class
1213
);
1314
}
1415

@@ -18,5 +19,8 @@ export default class ClassFieldDescription extends Component {
1819
* @method updateAnchor
1920
* @method fieldName String The name representing the field that was clicked.
2021
*/
21-
updateAnchor() {}
22+
@action
23+
updateAnchor(fieldName) {
24+
this.args.updateAnchor?.(fieldName);
25+
}
2226
}

app/styles/base/_forms.scss

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@use "sass:math";
2+
13
fieldset {
24
background-color: lighten($base-border-color, 10%);
35
border: $base-border;
@@ -28,7 +30,7 @@ select {
2830

2931
label {
3032
font-weight: 600;
31-
margin-bottom: $small-spacing / 2;
33+
margin-bottom: math.div($small-spacing, 2);
3234

3335
&.required::after {
3436
content: "*";
@@ -48,8 +50,8 @@ textarea {
4850
box-sizing: border-box;
4951
font-family: $base-font-family;
5052
font-size: $base-font-size;
51-
margin-bottom: $base-spacing / 2;
52-
padding: $base-spacing / 3;
53+
margin-bottom: math.div($base-spacing, 2);
54+
padding: math.div($base-spacing, 3);
5355
transition: border-color;
5456
width: 100%;
5557

@@ -72,7 +74,7 @@ textarea {
7274
input[type="checkbox"],
7375
input[type="radio"] {
7476
display: inline;
75-
margin-right: $small-spacing / 2;
77+
margin-right: math.div($small-spacing, 2);
7678
}
7779

7880
input[type="file"] {

app/styles/base/_variables.scss

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@use "sass:math";
2+
13
// Typography
24
$base-font-family: 'Source Sans Pro', sans-serif;
35
$heading-font-family: $base-font-family;
@@ -15,7 +17,7 @@ $heading-line-height: 1.2;
1517

1618
// Spacing
1719
$base-spacing: $base-line-height * 1em;
18-
$small-spacing: $base-spacing / 2;
20+
$small-spacing: math.div($base-spacing, 2);
1921
$large-spacing: $base-spacing * 2;
2022
$top-spacing: $base-spacing * 3.333; // 80px
2123

app/templates/components/class-field-description.hbs

-80
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"lodash.union": "^4.6.0",
106106
"lodash.uniq": "^4.5.0",
107107
"lodash.values": "^4.3.0",
108-
"minimist": "^1.2.0",
108+
"minimist": "^1.2.6",
109109
"normalize.css": "^8.0.1",
110110
"npm-run-all": "^4.1.5",
111111
"prettier": "^2.2.1",

tests/integration/components/class-field-description-test.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ module('Integration | Component | class field description', function (hooks) {
2626
})
2727
);
2828

29-
await render(hbs`{{class-field-description type=type field=field}}`);
29+
await render(
30+
hbs`<ClassFieldDescription @type={{this.type}} @field={{this.field}}/>`
31+
);
3032

3133
assert.dom('.method-name').hasText('concat');
3234
assert.dom(findAll('.access')[0]).hasText('public');
@@ -47,7 +49,9 @@ module('Integration | Component | class field description', function (hooks) {
4749
})
4850
);
4951

50-
await render(hbs`{{class-field-description type=type field=field}}`);
52+
await render(
53+
hbs`<ClassFieldDescription @type={{this.type}} @field={{this.field}}/>`
54+
);
5155

5256
await triggerEvent('.class-field-description--link', 'mouseenter');
5357
assert
@@ -73,7 +77,7 @@ module('Integration | Component | class field description', function (hooks) {
7377
);
7478

7579
await render(
76-
hbs`{{class-field-description field=field updateAnchor=updateAnchor}}`
80+
hbs`<ClassFieldDescription @field={{this.field}} @updateAnchor={{this.updateAnchor}}/>`
7781
);
7882

7983
await click('.class-field-description--link');
@@ -98,7 +102,9 @@ module('Integration | Component | class field description', function (hooks) {
98102
})
99103
);
100104

101-
await render(hbs`{{class-field-description type=type field=field}}`);
105+
await render(
106+
hbs`<ClassFieldDescription @type={{this.type}} @field={{this.field}}/>`
107+
);
102108

103109
assert.dom(find('.prop:nth-child(1) dt')).hasText('prop1');
104110
assert.dom(find('.prop:nth-child(2) dt')).hasText('prop2');

yarn.lock

+33-13
Original file line numberDiff line numberDiff line change
@@ -10573,10 +10573,10 @@ minimist@^0.2.1:
1057310573
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.2.1.tgz#827ba4e7593464e7c221e8c5bed930904ee2c455"
1057410574
integrity sha512-GY8fANSrTMfBVfInqJAY41QkOM+upUTytK1jZ0c8+3HdHrJxBJ3rF5i9moClXTE8uUSnUo8cAsCoxDXvSY4DHg==
1057510575

10576-
minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5:
10577-
version "1.2.5"
10578-
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
10579-
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
10576+
minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6:
10577+
version "1.2.6"
10578+
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
10579+
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
1058010580

1058110581
minipass@^2.2.0:
1058210582
version "2.9.0"
@@ -10644,9 +10644,9 @@ morgan@^1.10.0:
1064410644
on-headers "~1.0.2"
1064510645

1064610646
mout@^1.0.0:
10647-
version "1.2.2"
10648-
resolved "https://registry.yarnpkg.com/mout/-/mout-1.2.2.tgz#c9b718a499806a0632cede178e80f436259e777d"
10649-
integrity sha512-w0OUxFEla6z3d7sVpMZGBCpQvYh8PHS1wZ6Wu9GNKHMpAHWJ0if0LsQZh3DlOqw55HlhJEOMLpFnwtxp99Y5GA==
10647+
version "1.2.3"
10648+
resolved "https://registry.yarnpkg.com/mout/-/mout-1.2.3.tgz#bd1477d8c7f2db5fcf43c91de30b6cc746b78e10"
10649+
integrity sha512-vtE+eZcSj/sBkIp6gxB87MznryWP+gHIp0XX9SKrzA5TAkvz6y7VTuNruBjYdJozd8NY5i9XVIsn8cn3SwNjzg==
1065010650

1065110651
move-concurrently@^1.0.1:
1065210652
version "1.0.1"
@@ -10719,9 +10719,9 @@ nan@^2.12.1, nan@^2.13.2:
1071910719
integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==
1072010720

1072110721
nanoid@^3.1.23:
10722-
version "3.1.23"
10723-
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81"
10724-
integrity sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==
10722+
version "3.3.4"
10723+
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
10724+
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==
1072510725

1072610726
nanomatch@^1.2.9:
1072710727
version "1.2.13"
@@ -10780,9 +10780,11 @@ no-case@^3.0.4:
1078010780
tslib "^2.0.3"
1078110781

1078210782
node-fetch@^2.6.0, node-fetch@^2.6.1:
10783-
version "2.6.1"
10784-
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
10785-
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
10783+
version "2.6.7"
10784+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
10785+
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
10786+
dependencies:
10787+
whatwg-url "^5.0.0"
1078610788

1078710789
node-gyp@^3.8.0:
1078810790
version "3.8.0"
@@ -13736,6 +13738,11 @@ tr46@^2.1.0:
1373613738
dependencies:
1373713739
punycode "^2.1.1"
1373813740

13741+
tr46@~0.0.3:
13742+
version "0.0.3"
13743+
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
13744+
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
13745+
1373913746
tracked-maps-and-sets@^2.0.0:
1374013747
version "2.2.1"
1374113748
resolved "https://registry.yarnpkg.com/tracked-maps-and-sets/-/tracked-maps-and-sets-2.2.1.tgz#323dd40540c561e8b0ffdec8bf129c68ec5025f9"
@@ -14202,6 +14209,11 @@ web-app-manifest-validator@^1.0.0:
1420214209
dependencies:
1420314210
is-array "^1.0.1"
1420414211

14212+
webidl-conversions@^3.0.0:
14213+
version "3.0.1"
14214+
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
14215+
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
14216+
1420514217
webidl-conversions@^5.0.0:
1420614218
version "5.0.0"
1420714219
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff"
@@ -14280,6 +14292,14 @@ whatwg-mimetype@^2.3.0:
1428014292
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"
1428114293
integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==
1428214294

14295+
whatwg-url@^5.0.0:
14296+
version "5.0.0"
14297+
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
14298+
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
14299+
dependencies:
14300+
tr46 "~0.0.3"
14301+
webidl-conversions "^3.0.0"
14302+
1428314303
whatwg-url@^8.0.0, whatwg-url@^8.5.0:
1428414304
version "8.7.0"
1428514305
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77"

0 commit comments

Comments
 (0)