Skip to content

Commit 4fedd5d

Browse files
authored
Merge pull request #831 from ember-learn/glint
Add Glint to the project
2 parents bd1aad6 + 1c032b6 commit 4fedd5d

File tree

8 files changed

+1351
-883
lines changed

8 files changed

+1351
-883
lines changed

app/components/api-index-filter.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ import sortBy from 'lodash.sortby';
77
const filterDataComputedParams =
88
'filterData.{showInherited,showProtected,showPrivate,showDeprecated}';
99

10+
/**
11+
* @typedef Args
12+
* @property {object} model
13+
* @property {object} filterData
14+
*/
15+
16+
/**
17+
* @typedef Blocks
18+
* @property {[ApiIndexFilter['filteredData']]} default
19+
*/
20+
21+
/**
22+
* @extends Component<{ Args: Args, Blocks: Blocks }>
23+
*/
1024
@classNames('api-index-filter')
1125
export default class ApiIndexFilter extends Component {
1226
@computed('model.methods.[]', filterDataComputedParams)

app/components/api-index.js

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,46 @@
1-
/* eslint-disable ember/no-computed-properties-in-native-classes */
2-
import { computed } from '@ember/object';
3-
import Component from '@ember/component';
1+
import Component from '@glimmer/component';
42

3+
/**
4+
* @typedef ItemData
5+
* @property {Array<{ name: string }>} methods
6+
* @property {Array<{ name: string }>} properties
7+
* @property {Array<{ name: string }>} events
8+
*/
9+
10+
/**
11+
* @typedef Args
12+
* @property {ItemData} itemData
13+
*/
14+
15+
/**
16+
* @typedef Blocks
17+
* @property {[{ sections: ApiIndex['sections'] }]} default
18+
*/
19+
20+
/**
21+
* @extends Component<{ Args: Args, Blocks: Blocks }>
22+
*/
523
export default class ApiIndex extends Component {
6-
@computed('itemData.{methods,properties,events}')
724
get sections() {
825
return [
926
{
1027
title: 'Methods',
1128
tab: 'methods',
12-
items: this.itemData.methods,
29+
items: this.args.itemData.methods,
1330
class: 'spec-method-list',
1431
routeSuffix: '.methods.method',
1532
},
1633
{
1734
title: 'Properties',
1835
tab: 'properties',
19-
items: this.itemData.properties,
36+
items: this.args.itemData.properties,
2037
class: 'spec-property-list',
2138
routeSuffix: '.properties.property',
2239
},
2340
{
2441
title: 'Events',
2542
tab: 'events',
26-
items: this.itemData.events,
43+
items: this.args.itemData.events,
2744
class: 'spec-event-list',
2845
routeSuffix: '.events.event',
2946
},

app/registry.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import ApiIndex from './components/api-index';
2+
import ApiIndexFilter from './components/api-index-filter';
3+
4+
declare module '@glint/environment-ember-loose/registry' {
5+
export default interface Registry {
6+
ApiIndex: typeof ApiIndex;
7+
ApiIndexFilter: typeof ApiIndexFilter;
8+
}
9+
}

app/templates/class-index.hbs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
<ul class="{{section.class}}">
77
{{#each section.items as |item|}}
88
<li data-test-item={{item.name}}>
9-
<LinkTo @route={{concat this.parentName section.routeSuffix }} @models={{array @model.project.id @model.projectVersion.compactVersion @model.name item.name}} @query={{hash anchor=item.name}}>
9+
<LinkTo
10+
@route="{{this.parentName}}{{section.routeSuffix}}"
11+
@models={{array
12+
@model.project.id
13+
@model.projectVersion.compactVersion
14+
@model.name item.name
15+
}}
16+
@query={{hash anchor=item.name}}
17+
>
1018
{{item.name}}
1119
</LinkTo>
1220
</li>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<div>
12
{{yield (hash
23
sections=this.sections)
34
}}
5+
</div>

jsconfig.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
2-
"compilerOptions": {
3-
"experimentalDecorators": true
4-
},
5-
}
2+
"extends": "@tsconfig/ember",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"paths": {
6+
"ember-api-docs/*": [
7+
"app/*"
8+
]
9+
}
10+
},
11+
"glint": {
12+
"environment": "ember-loose",
13+
"checkStandaloneTemplates": false
14+
}
15+
}

0 commit comments

Comments
 (0)