You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -9,50 +9,28 @@ _Make container queries that harness the power of Ember_
9
9
## Installation
10
10
11
11
```sh
12
-
ember install ember-container-query
12
+
pnpm add -D ember-container-query
13
13
```
14
14
15
15
<details>
16
-
<summary>Use Glint or <code><template></code> tag? ✨</summary>
17
16
18
-
- Update your template registry to extend this addon's. Check the [Glint documentation](https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons#using-glint-enabled-addons) for more information.
17
+
<summary>Use Glint and <code>*.hbs</code> files?</summary>
19
18
20
-
```ts
21
-
/* types/index.d.ts */
19
+
Extend this addon's template registry to get native types.
exportdefaultinterfaceRegistryextendsEmberContainerQueryRegistry, /* other addon registries */ {
29
-
// local entries
30
-
}
31
-
}
32
-
```
33
-
34
-
-Ifyouareusing [`<template>`tag](https://github.com/ember-template-imports/ember-template-imports), you are good to go! Use the named import to consume things.
exportdefaultinterfaceRegistryextendsEmberContainerQueryRegistry, /* other addon registries */ {
30
+
// local entries
31
+
}
32
+
}
33
+
```
56
34
57
35
</details>
58
36
@@ -62,6 +40,7 @@ ember install ember-container-query
62
40
Where can you use container queries? Here are real-life (and some theoretical) applications!
63
41
64
42
<details>
43
+
65
44
<summary>Create reusable components that are independent of screen size ♻️</summary>
66
45
67
46
1. Components form a core of an Ember app. We love components!
@@ -86,6 +65,7 @@ Where can you use container queries? Here are real-life (and some theoretical) a
86
65
87
66
88
67
<details>
68
+
89
69
<summary>To table or not to table? That is the question. 🤔</summary>
90
70
91
71
1. A table is great for showing structured data. On mobile, with a limited width, not so much.
@@ -98,45 +78,53 @@ Where can you use container queries? Here are real-life (and some theoretical) a
98
78
99
79
100
80
<details>
81
+
101
82
<summary>Create a customizable dashboard 🎛️ 🎚️</summary>
102
83
103
84
1. It's difficult to create dashboard widgets that can be placed anywhere and look good.
104
85
105
86
1. As a result, you may artificially constrain your users from customizing their dashboard.
106
87
107
88
1. If you _combine_ media and container queries, you can better meet the wants of designers, developers, and users.
89
+
108
90
</details>
109
91
110
92
111
93
<details>
94
+
112
95
<summary>Responsive images, videos, and D3 visualizations 🖼️ 📽️ 📈</summary>
113
96
114
97
1. Currently, you have to use [`srcset`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement/srcset) to load images with the optimal file size. Alternatively, you can [use container queries to decide which images to load](https://crunchingnumbers.live/2020/06/03/container-queries-adaptive-images/).
115
98
116
99
2. Similarly, for videos, you could use container queries to decide format and display resolution.
117
100
118
101
3. D3 components can use container queries to decide what's the best way to show data. Do you show larger chart elements, show legends, allow scrolling, show text summary? etc.
1. You may be able to compose this addon with others to arrive at something ambitious and unique.
126
111
127
112
1. For example, [`ember-printable-pages`](https://github.com/forge512/ember-printable-pages) lets us reuse components to make a printable document. The components could focus on presenting data with container queries, while `ember-printable-pages` could focus on deciding page layouts and lazily rendering components.
113
+
128
114
</details>
129
115
130
116
131
117
<details>
118
+
132
119
<summary>Hide secrets in games 🎮</summary>
133
120
134
121
1. You're designing [a game in Ember](https://www.youtube.com/watch?v=Ld1xnQWkqPU).
135
122
136
123
1. Maybe a secret, most powerful item appears when the game world is at a certain size? :)
124
+
137
125
</details>
138
126
139
-
Notconvinced?Openthe [demoapp](https://ember-container-query.netlify.app/) to see `ember-container-query` in action. (There's even a 404 page!)
127
+
You will find plenty of examples in [`docs-app`](https://github.com/ijlee2/ember-container-query/tree/main/docs-app). Visit https://ember-container-query.netlify.app/ to see the app in action!
140
128
141
129
<divalign="left">
142
130
<imgalt="A demo of ember-container-query shows a smooth transition when using a list or table to display data"src="https://user-images.githubusercontent.com/16869656/82177207-72699c00-989e-11ea-9cb6-2e388c5e98c0.gif"width="600" />
@@ -161,6 +149,7 @@ Expand the items below to learn more about the API.
@@ -189,7 +178,7 @@ You _may_<sup>1</sup> pass attributes to the component for these reasons:
189
178
190
179
<sup>2. When an [ARIA attribute has multiple values](https://github.com/ijlee2/ember-container-query/issues/38#issuecomment-647017665), the order of values can matter. At the moment, splattributes doesn't guarantee the order.</sup>
191
180
192
-
### Outputs
181
+
### Output
193
182
194
183
You can consume these values in your app or addon.
195
184
@@ -203,6 +192,7 @@ You can consume these values in your app or addon.
The output is similar to [those of `<ContainerQuery>` component](#output).
242
233
243
234
Data attributes are automatically applied to the HTML element. To get `dimensions` and `features`, you will need to pass the argument `@onQuery` (a function) to the modifier.
You can see that the album page uses 2 `<ContainerQuery>` components. Rest assured, they act independently of each other. When you pair `<ContainerQuery>` with some CSS, you can create layouts beyond the dreams of others! 🙌
356
-
357
-
For more examples, I encourage you to check out the code for my demo app. It is located under the [`docs-app`](https://github.com/ijlee2/ember-container-query/tree/main/docs-app) folder and is structured like a typical Ember app.
0 commit comments