ember-container-query 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.stylelintcache +1 -1
- package/CHANGELOG.md +34 -0
- package/README.md +57 -10
- package/addon/components/container-query.hbs +1 -0
- package/addon/components/container-query.ts +24 -9
- package/addon/helpers/aspect-ratio.ts +26 -0
- package/addon/helpers/height.ts +24 -0
- package/addon/helpers/width.ts +24 -0
- package/addon/index.ts +5 -0
- package/addon/modifiers/container-query.ts +37 -26
- package/addon/template-registry.ts +16 -0
- package/app/helpers/aspect-ratio.js +1 -0
- package/app/helpers/cq-aspect-ratio.js +18 -1
- package/app/helpers/cq-height.js +18 -1
- package/app/helpers/cq-width.js +18 -1
- package/app/helpers/height.js +1 -0
- package/app/helpers/width.js +1 -0
- package/components/container-query.d.ts +20 -9
- package/helpers/aspect-ratio.d.ts +13 -0
- package/helpers/height.d.ts +13 -0
- package/helpers/width.d.ts +13 -0
- package/index.d.ts +6 -0
- package/modifiers/container-query.d.ts +17 -20
- package/package.json +22 -19
- package/template-registry.d.ts +16 -0
- package/tsconfig.json +4 -1
- package/types/dummy/index.d.ts +33 -0
- package/addon/helpers/cq-aspect-ratio.ts +0 -15
- package/addon/helpers/cq-height.ts +0 -15
- package/addon/helpers/cq-width.ts +0 -15
- package/helpers/cq-aspect-ratio.d.ts +0 -10
- package/helpers/cq-height.d.ts +0 -10
- package/helpers/cq-width.d.ts +0 -10
package/.stylelintcache
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/styles/album.css":"1","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/styles/
|
|
1
|
+
[{"/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/styles/album.css":"1","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/styles/form.css":"2","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/styles/app.css":"3","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/navigation-menu.css":"4","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/styles/index.css":"5","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/styles/application.css":"6","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/styles/not-found.css":"7","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/styles/dashboard.css":"8","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-1.css":"9","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/ui/form.css":"10","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/ui/page.css":"11","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/tracks/table.css":"12","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/tracks/list.css":"13","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-2.css":"14","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-5.css":"15","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-3.css":"16","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-4.css":"17","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/ui/form/information.css":"18","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/ui/form/checkbox.css":"19","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/ui/form/field.css":"20","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/ui/form/textarea.css":"21","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-1/item.css":"22","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-2/captions.css":"23","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/ui/form/input.css":"24","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-2/stacked-chart.css":"25","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-4/memo.css":"26","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-3/tour-schedule.css":"27","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-4/memo/body.css":"28","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-4/memo/actions.css":"29","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-3/tour-schedule/responsive-image.css":"30","/Users/isaaclee/Documents/GitHub/ember-container-query/tests/dummy/app/components/widgets/widget-4/memo/header.css":"31"},{"size":892,"mtime":1672845344230,"hashOfConfig":"32"},{"size":82,"mtime":1672845344239,"hashOfConfig":"32"},{"size":1494,"mtime":1672845344232,"hashOfConfig":"32"},{"size":323,"mtime":1672845342271,"hashOfConfig":"32"},{"size":36,"mtime":1672845344240,"hashOfConfig":"32"},{"size":980,"mtime":1672845344234,"hashOfConfig":"32"},{"size":1299,"mtime":1672845344242,"hashOfConfig":"32"},{"size":1846,"mtime":1672845344237,"hashOfConfig":"32"},{"size":797,"mtime":1672845342436,"hashOfConfig":"32"},{"size":324,"mtime":1672845342377,"hashOfConfig":"32"},{"size":306,"mtime":1672845342429,"hashOfConfig":"32"},{"size":106,"mtime":1672845342371,"hashOfConfig":"32"},{"size":323,"mtime":1672845342365,"hashOfConfig":"32"},{"size":439,"mtime":1672845342448,"hashOfConfig":"32"},{"size":657,"mtime":1672845342511,"hashOfConfig":"32"},{"size":268,"mtime":1672845342466,"hashOfConfig":"32"},{"size":400,"mtime":1672845342484,"hashOfConfig":"32"},{"size":225,"mtime":1672845342406,"hashOfConfig":"32"},{"size":566,"mtime":1672845342392,"hashOfConfig":"32"},{"size":1630,"mtime":1672845342398,"hashOfConfig":"32"},{"size":375,"mtime":1672845342424,"hashOfConfig":"32"},{"size":243,"mtime":1672845342443,"hashOfConfig":"32"},{"size":2101,"mtime":1672845342453,"hashOfConfig":"32"},{"size":360,"mtime":1672845342416,"hashOfConfig":"32"},{"size":267,"mtime":1672845342460,"hashOfConfig":"32"},{"size":937,"mtime":1672845342490,"hashOfConfig":"32"},{"size":1570,"mtime":1672845342474,"hashOfConfig":"32"},{"size":493,"mtime":1672845342500,"hashOfConfig":"32"},{"size":701,"mtime":1672845342495,"hashOfConfig":"32"},{"size":159,"mtime":1672845342479,"hashOfConfig":"32"},{"size":888,"mtime":1672845342505,"hashOfConfig":"32"},"v8nntw"]
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
## 3.2.0 (2023-01-05)
|
|
2
|
+
|
|
3
|
+
### Enhancement
|
|
4
|
+
* [#147](https://github.com/ijlee2/ember-container-query/pull/147) Use relative paths whenever possible ([@ijlee2](https://github.com/ijlee2))
|
|
5
|
+
* [#130](https://github.com/ijlee2/ember-container-query/pull/130) Add easier imports from strict mode users ([@NullVoxPopuli](https://github.com/NullVoxPopuli))
|
|
6
|
+
* [#146](https://github.com/ijlee2/ember-container-query/pull/146) Renamed the helpers by dropping the cq prefix ([@ijlee2](https://github.com/ijlee2))
|
|
7
|
+
|
|
8
|
+
### Internal
|
|
9
|
+
* [#148](https://github.com/ijlee2/ember-container-query/pull/148) Updated development dependencies ([@ijlee2](https://github.com/ijlee2))
|
|
10
|
+
|
|
11
|
+
### Committers: 2
|
|
12
|
+
- Isaac Lee ([@ijlee2](https://github.com/ijlee2))
|
|
13
|
+
- [@NullVoxPopuli](https://github.com/NullVoxPopuli)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## 3.1.0 (2022-12-20)
|
|
17
|
+
|
|
18
|
+
### Enhancement
|
|
19
|
+
* [#140](https://github.com/ijlee2/ember-container-query/pull/140) Add Glint signatures ([@ijlee2](https://github.com/ijlee2))
|
|
20
|
+
|
|
21
|
+
### Internal
|
|
22
|
+
* [#145](https://github.com/ijlee2/ember-container-query/pull/145) Updated development dependencies to their latest version ([@ijlee2](https://github.com/ijlee2))
|
|
23
|
+
* [#141](https://github.com/ijlee2/ember-container-query/pull/141) Glint demo app ([@ijlee2](https://github.com/ijlee2))
|
|
24
|
+
* [#140](https://github.com/ijlee2/ember-container-query/pull/140) Add Glint signatures ([@ijlee2](https://github.com/ijlee2))
|
|
25
|
+
|
|
26
|
+
### Documentation
|
|
27
|
+
* [#141](https://github.com/ijlee2/ember-container-query/pull/141) Glint demo app ([@ijlee2](https://github.com/ijlee2))
|
|
28
|
+
* [#140](https://github.com/ijlee2/ember-container-query/pull/140) Add Glint signatures ([@ijlee2](https://github.com/ijlee2))
|
|
29
|
+
|
|
30
|
+
### Committers: 1
|
|
31
|
+
- Isaac Lee ([@ijlee2](https://github.com/ijlee2))
|
|
32
|
+
- Thanks to [@NullVoxPopuli](https://github.com/NullVoxPopuli), [@denisclark](https://github.com/denisclark), [@gossi](https://github.com/gossi), and [@buschtoens](https://github.com/buschtoens) for their help with [#140](https://github.com/ijlee2/ember-container-query/pull/140)
|
|
33
|
+
|
|
34
|
+
|
|
1
35
|
## 3.0.0 (2022-12-15)
|
|
2
36
|
|
|
3
37
|
### Breaking Change
|
package/README.md
CHANGED
|
@@ -18,6 +18,53 @@ Installation
|
|
|
18
18
|
ember install ember-container-query
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
<details>
|
|
22
|
+
<summary>Use Glint? ✨</summary>
|
|
23
|
+
|
|
24
|
+
- If you are using [strict mode](https://github.com/ember-template-imports/ember-template-imports), then you are good to go!
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
/* app/components/tracks.{gjs,gts} */
|
|
28
|
+
|
|
29
|
+
import { hash } from '@ember/helper';
|
|
30
|
+
import { ContainerQuery, height, width } from 'ember-container-query';
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<ContainerQuery
|
|
34
|
+
@features={{hash
|
|
35
|
+
small=(width max=480)
|
|
36
|
+
medium=(width min=480 max=640)
|
|
37
|
+
large=(width min=640)
|
|
38
|
+
tall=(height min=320)
|
|
39
|
+
}}
|
|
40
|
+
as |CQ|
|
|
41
|
+
>
|
|
42
|
+
...
|
|
43
|
+
</ContainerQuery>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- Otherwise, 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.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
/* types/global.d.ts */
|
|
51
|
+
|
|
52
|
+
import '@glint/environment-ember-loose';
|
|
53
|
+
|
|
54
|
+
import type EmberContainerQueryRegistry from 'ember-container-query/template-registry';
|
|
55
|
+
|
|
56
|
+
declare module '@glint/environment-ember-loose/registry' {
|
|
57
|
+
export default interface Registry extends EmberContainerQueryRegistry, /* other addon registries */ {
|
|
58
|
+
// local entries
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
⚠️ Glint is in active development and may introduce breaking changes. This addon will try to provide a stable API. Should it need to make a breaking change due to Glint, semantic versioning may not be rigorously followed (e.g. there is no new major version).
|
|
65
|
+
|
|
66
|
+
</details>
|
|
67
|
+
|
|
21
68
|
|
|
22
69
|
Applications
|
|
23
70
|
------------------------------------------------------------------------------
|
|
@@ -106,9 +153,9 @@ API
|
|
|
106
153
|
The addon provides 1 Glimmer component and 3 helpers:
|
|
107
154
|
|
|
108
155
|
- `<ContainerQuery>`
|
|
109
|
-
- `{{
|
|
110
|
-
- `{{
|
|
111
|
-
- `{{
|
|
156
|
+
- `{{aspect-ratio}}`
|
|
157
|
+
- `{{height}}`
|
|
158
|
+
- `{{width}}`
|
|
112
159
|
|
|
113
160
|
Starting `v2.1.1`, the addon extracts the core logic into a modifier. This lets you opt out of using the provided component.
|
|
114
161
|
|
|
@@ -160,7 +207,7 @@ You can consume these values in your app or addon.
|
|
|
160
207
|
|
|
161
208
|
|
|
162
209
|
<details>
|
|
163
|
-
<summary><code>{{
|
|
210
|
+
<summary><code>{{aspect-ratio}}</code>, <code>{{height}}</code>, <code>{{width}}</code></summary>
|
|
164
211
|
|
|
165
212
|
### Arguments
|
|
166
213
|
|
|
@@ -213,8 +260,8 @@ Let's look at the code that created the video demo above.
|
|
|
213
260
|
```hbs
|
|
214
261
|
<ContainerQuery
|
|
215
262
|
@features={{hash
|
|
216
|
-
large=(
|
|
217
|
-
tall=(
|
|
263
|
+
large=(width min=960)
|
|
264
|
+
tall=(height min=400)
|
|
218
265
|
}}
|
|
219
266
|
as |CQ|
|
|
220
267
|
>
|
|
@@ -254,10 +301,10 @@ Let's look at the code that created the video demo above.
|
|
|
254
301
|
```hbs
|
|
255
302
|
<ContainerQuery
|
|
256
303
|
@features={{hash
|
|
257
|
-
small=(
|
|
258
|
-
medium=(
|
|
259
|
-
large=(
|
|
260
|
-
tall=(
|
|
304
|
+
small=(width max=480)
|
|
305
|
+
medium=(width min=480 max=640)
|
|
306
|
+
large=(width min=640)
|
|
307
|
+
tall=(height min=320)
|
|
261
308
|
}}
|
|
262
309
|
as |CQ|
|
|
263
310
|
>
|
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
import { action } from '@ember/object';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
3
|
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
|
|
4
5
|
import type {
|
|
5
6
|
Dimensions,
|
|
6
7
|
Features,
|
|
8
|
+
IndexSignatureParameter,
|
|
7
9
|
QueryResults,
|
|
8
|
-
} from '
|
|
10
|
+
} from '../modifiers/container-query';
|
|
9
11
|
|
|
10
|
-
interface
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
interface ContainerQueryComponentSignature<T extends IndexSignatureParameter> {
|
|
13
|
+
Args: {
|
|
14
|
+
dataAttributePrefix?: string;
|
|
15
|
+
debounce?: number;
|
|
16
|
+
features?: Features<T>;
|
|
17
|
+
tagName?: string;
|
|
18
|
+
};
|
|
19
|
+
Blocks: {
|
|
20
|
+
default: [
|
|
21
|
+
{
|
|
22
|
+
dimensions?: Dimensions;
|
|
23
|
+
features?: QueryResults<T>;
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
};
|
|
27
|
+
Element: HTMLElement;
|
|
15
28
|
}
|
|
16
29
|
|
|
17
|
-
export default class ContainerQueryComponent
|
|
30
|
+
export default class ContainerQueryComponent<
|
|
31
|
+
T extends IndexSignatureParameter
|
|
32
|
+
> extends Component<ContainerQueryComponentSignature<T>> {
|
|
18
33
|
@tracked dimensions?: Dimensions;
|
|
19
|
-
@tracked queryResults?: QueryResults
|
|
34
|
+
@tracked queryResults?: QueryResults<T>;
|
|
20
35
|
|
|
21
36
|
// The dynamic tag is restricted to be immutable
|
|
22
37
|
tagName = this.args.tagName ?? 'div';
|
|
@@ -26,7 +41,7 @@ export default class ContainerQueryComponent extends Component<ContainerQueryCom
|
|
|
26
41
|
queryResults,
|
|
27
42
|
}: {
|
|
28
43
|
dimensions: Dimensions;
|
|
29
|
-
queryResults: QueryResults
|
|
44
|
+
queryResults: QueryResults<T>;
|
|
30
45
|
}): void {
|
|
31
46
|
this.dimensions = dimensions;
|
|
32
47
|
this.queryResults = queryResults;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { helper } from '@ember/component/helper';
|
|
2
|
+
|
|
3
|
+
import type { Metadata } from '../modifiers/container-query';
|
|
4
|
+
|
|
5
|
+
interface AspectRatioHelperSignature {
|
|
6
|
+
Args: {
|
|
7
|
+
Named: {
|
|
8
|
+
max?: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
};
|
|
11
|
+
Positional: [];
|
|
12
|
+
};
|
|
13
|
+
Return: Metadata;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const AspectRatioHelper = helper<AspectRatioHelperSignature>(
|
|
17
|
+
(_positional, named) => {
|
|
18
|
+
const dimension = 'aspectRatio';
|
|
19
|
+
const max = named.max ?? Infinity;
|
|
20
|
+
const min = named.min ?? 0;
|
|
21
|
+
|
|
22
|
+
return { dimension, max, min };
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default AspectRatioHelper;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { helper } from '@ember/component/helper';
|
|
2
|
+
|
|
3
|
+
import type { Metadata } from '../modifiers/container-query';
|
|
4
|
+
|
|
5
|
+
interface HeightHelperSignature {
|
|
6
|
+
Args: {
|
|
7
|
+
Named: {
|
|
8
|
+
max?: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
};
|
|
11
|
+
Positional: [];
|
|
12
|
+
};
|
|
13
|
+
Return: Metadata;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const HeightHelper = helper<HeightHelperSignature>((_positional, named) => {
|
|
17
|
+
const dimension = 'height';
|
|
18
|
+
const max = named.max ?? Infinity;
|
|
19
|
+
const min = named.min ?? 0;
|
|
20
|
+
|
|
21
|
+
return { dimension, max, min };
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default HeightHelper;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { helper } from '@ember/component/helper';
|
|
2
|
+
|
|
3
|
+
import type { Metadata } from '../modifiers/container-query';
|
|
4
|
+
|
|
5
|
+
interface WidthHelperSignature {
|
|
6
|
+
Args: {
|
|
7
|
+
Named: {
|
|
8
|
+
max?: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
};
|
|
11
|
+
Positional: [];
|
|
12
|
+
};
|
|
13
|
+
Return: Metadata;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const WidthHelper = helper<WidthHelperSignature>((_positional, named) => {
|
|
17
|
+
const dimension = 'width';
|
|
18
|
+
const max = named.max ?? Infinity;
|
|
19
|
+
const min = named.min ?? 0;
|
|
20
|
+
|
|
21
|
+
return { dimension, max, min };
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default WidthHelper;
|
package/addon/index.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as ContainerQuery } from './components/container-query';
|
|
2
|
+
export { default as aspectRatio } from './helpers/aspect-ratio';
|
|
3
|
+
export { default as height } from './helpers/height';
|
|
4
|
+
export { default as width } from './helpers/width';
|
|
5
|
+
export { default as containerQuery } from './modifiers/container-query';
|
|
@@ -4,38 +4,36 @@ import { debounce as _debounce } from '@ember/runloop';
|
|
|
4
4
|
import { inject as service } from '@ember/service';
|
|
5
5
|
import Modifier, { ArgsFor, NamedArgs, PositionalArgs } from 'ember-modifier';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
dimension: 'aspectRatio' | 'height' | 'width';
|
|
9
|
-
max: number;
|
|
10
|
-
min: number;
|
|
11
|
-
};
|
|
7
|
+
type IndexSignatureParameter = string | number | symbol;
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
[featureName: string]: Metadata;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type Dimensions = {
|
|
9
|
+
type Dimensions = {
|
|
18
10
|
aspectRatio: number;
|
|
19
11
|
height: number;
|
|
20
12
|
width: number;
|
|
21
13
|
};
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
type Metadata = {
|
|
16
|
+
dimension: 'aspectRatio' | 'height' | 'width';
|
|
17
|
+
max: number;
|
|
18
|
+
min: number;
|
|
25
19
|
};
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
type Features<T extends IndexSignatureParameter> = Record<T, Metadata>;
|
|
22
|
+
|
|
23
|
+
type QueryResults<T extends IndexSignatureParameter> = Record<T, boolean>;
|
|
24
|
+
|
|
25
|
+
interface ContainerQueryModifierSignature<T extends IndexSignatureParameter> {
|
|
28
26
|
Args: {
|
|
29
27
|
Named: {
|
|
30
28
|
dataAttributePrefix?: string;
|
|
31
29
|
debounce?: number;
|
|
32
|
-
features?: Features
|
|
30
|
+
features?: Features<T>;
|
|
33
31
|
onQuery?: ({
|
|
34
32
|
dimensions,
|
|
35
33
|
queryResults,
|
|
36
34
|
}: {
|
|
37
35
|
dimensions: Dimensions;
|
|
38
|
-
queryResults: QueryResults
|
|
36
|
+
queryResults: QueryResults<T>;
|
|
39
37
|
}) => void;
|
|
40
38
|
};
|
|
41
39
|
Positional: [];
|
|
@@ -43,15 +41,17 @@ interface ContainerQueryModifierSignature {
|
|
|
43
41
|
Element: Element;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
export default class ContainerQueryModifier
|
|
44
|
+
export default class ContainerQueryModifier<
|
|
45
|
+
T extends IndexSignatureParameter
|
|
46
|
+
> extends Modifier<ContainerQueryModifierSignature<T>> {
|
|
47
47
|
@service private declare readonly resizeObserver;
|
|
48
48
|
|
|
49
49
|
dimensions!: Dimensions;
|
|
50
|
-
queryResults!: QueryResults
|
|
50
|
+
queryResults!: QueryResults<T>;
|
|
51
51
|
|
|
52
52
|
private _dataAttributes: string[] = [];
|
|
53
53
|
private _element?: Element;
|
|
54
|
-
private _named!: NamedArgs<ContainerQueryModifierSignature
|
|
54
|
+
private _named!: NamedArgs<ContainerQueryModifierSignature<T>>;
|
|
55
55
|
|
|
56
56
|
get dataAttributePrefix(): string {
|
|
57
57
|
return this._named.dataAttributePrefix ?? 'container-query';
|
|
@@ -61,11 +61,14 @@ export default class ContainerQueryModifier extends Modifier<ContainerQueryModif
|
|
|
61
61
|
return this._named.debounce ?? 0;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
get features(): Features {
|
|
65
|
-
return this._named.features ?? {};
|
|
64
|
+
get features(): Features<T> {
|
|
65
|
+
return this._named.features ?? ({} as Features<T>);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
constructor(
|
|
68
|
+
constructor(
|
|
69
|
+
owner: unknown,
|
|
70
|
+
args: ArgsFor<ContainerQueryModifierSignature<T>>
|
|
71
|
+
) {
|
|
69
72
|
super(owner, args);
|
|
70
73
|
|
|
71
74
|
registerDestructor(this, () => {
|
|
@@ -75,8 +78,8 @@ export default class ContainerQueryModifier extends Modifier<ContainerQueryModif
|
|
|
75
78
|
|
|
76
79
|
modify(
|
|
77
80
|
element: Element,
|
|
78
|
-
_positional: PositionalArgs<ContainerQueryModifierSignature
|
|
79
|
-
named: NamedArgs<ContainerQueryModifierSignature
|
|
81
|
+
_positional: PositionalArgs<ContainerQueryModifierSignature<T>>,
|
|
82
|
+
named: NamedArgs<ContainerQueryModifierSignature<T>>
|
|
80
83
|
): void {
|
|
81
84
|
this._named = named;
|
|
82
85
|
|
|
@@ -126,13 +129,13 @@ export default class ContainerQueryModifier extends Modifier<ContainerQueryModif
|
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
private evaluateQueries(): void {
|
|
129
|
-
const queryResults = {} as QueryResults
|
|
132
|
+
const queryResults = {} as QueryResults<T>;
|
|
130
133
|
|
|
131
134
|
for (const [featureName, metadata] of Object.entries(this.features)) {
|
|
132
|
-
const { dimension, min, max } = metadata;
|
|
135
|
+
const { dimension, min, max } = metadata as Metadata;
|
|
133
136
|
const value = this.dimensions[dimension];
|
|
134
137
|
|
|
135
|
-
queryResults[featureName] = min <= value && value < max;
|
|
138
|
+
queryResults[featureName as T] = min <= value && value < max;
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
this.queryResults = queryResults;
|
|
@@ -166,3 +169,11 @@ export default class ContainerQueryModifier extends Modifier<ContainerQueryModif
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
}
|
|
172
|
+
|
|
173
|
+
export {
|
|
174
|
+
Dimensions,
|
|
175
|
+
Features,
|
|
176
|
+
IndexSignatureParameter,
|
|
177
|
+
Metadata,
|
|
178
|
+
QueryResults,
|
|
179
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type ContainerQueryComponent from './components/container-query';
|
|
2
|
+
import type AspectRatioHelper from './helpers/aspect-ratio';
|
|
3
|
+
import type HeightHelper from './helpers/height';
|
|
4
|
+
import type WidthHelper from './helpers/width';
|
|
5
|
+
import type ContainerQueryModifier from './modifiers/container-query';
|
|
6
|
+
|
|
7
|
+
export default interface EmberContainerQueryRegistry {
|
|
8
|
+
ContainerQuery: typeof ContainerQueryComponent;
|
|
9
|
+
'aspect-ratio': typeof AspectRatioHelper;
|
|
10
|
+
'container-query': typeof ContainerQueryModifier;
|
|
11
|
+
'cq-aspect-ratio': typeof AspectRatioHelper;
|
|
12
|
+
'cq-height': typeof HeightHelper;
|
|
13
|
+
'cq-width': typeof WidthHelper;
|
|
14
|
+
height: typeof HeightHelper;
|
|
15
|
+
width: typeof WidthHelper;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'ember-container-query/helpers/aspect-ratio';
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { deprecate } from '@ember/debug';
|
|
2
|
+
|
|
3
|
+
deprecate(
|
|
4
|
+
'The {{cq-aspect-ratio}} helper has been renamed to {{aspect-ratio}}. Please update the helper name in your template.',
|
|
5
|
+
false,
|
|
6
|
+
{
|
|
7
|
+
for: 'ember-container-query',
|
|
8
|
+
id: 'ember-container-query.rename-cq-aspect-ratio-helper',
|
|
9
|
+
since: {
|
|
10
|
+
available: '3.2.0',
|
|
11
|
+
enabled: '3.2.0',
|
|
12
|
+
},
|
|
13
|
+
until: '4.0.0',
|
|
14
|
+
url: 'https://github.com/ijlee2/ember-container-query/tree/3.2.0#api',
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export { default } from 'ember-container-query/helpers/aspect-ratio';
|
package/app/helpers/cq-height.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { deprecate } from '@ember/debug';
|
|
2
|
+
|
|
3
|
+
deprecate(
|
|
4
|
+
'The {{cq-height}} helper has been renamed to {{height}}. Please update the helper name in your template.',
|
|
5
|
+
false,
|
|
6
|
+
{
|
|
7
|
+
for: 'ember-container-query',
|
|
8
|
+
id: 'ember-container-query.rename-cq-height-helper',
|
|
9
|
+
since: {
|
|
10
|
+
available: '3.2.0',
|
|
11
|
+
enabled: '3.2.0',
|
|
12
|
+
},
|
|
13
|
+
until: '4.0.0',
|
|
14
|
+
url: 'https://github.com/ijlee2/ember-container-query/tree/3.2.0#api',
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export { default } from 'ember-container-query/helpers/height';
|
package/app/helpers/cq-width.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { deprecate } from '@ember/debug';
|
|
2
|
+
|
|
3
|
+
deprecate(
|
|
4
|
+
'The {{cq-width}} helper has been renamed to {{width}}. Please update the helper name in your template.',
|
|
5
|
+
false,
|
|
6
|
+
{
|
|
7
|
+
for: 'ember-container-query',
|
|
8
|
+
id: 'ember-container-query.rename-cq-width-helper',
|
|
9
|
+
since: {
|
|
10
|
+
available: '3.2.0',
|
|
11
|
+
enabled: '3.2.0',
|
|
12
|
+
},
|
|
13
|
+
until: '4.0.0',
|
|
14
|
+
url: 'https://github.com/ijlee2/ember-container-query/tree/3.2.0#api',
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export { default } from 'ember-container-query/helpers/width';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'ember-container-query/helpers/height';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from 'ember-container-query/helpers/width';
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import type { Dimensions, Features, QueryResults } from '
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import type { Dimensions, Features, IndexSignatureParameter, QueryResults } from '../modifiers/container-query';
|
|
3
|
+
interface ContainerQueryComponentSignature<T extends IndexSignatureParameter> {
|
|
4
|
+
Args: {
|
|
5
|
+
dataAttributePrefix?: string;
|
|
6
|
+
debounce?: number;
|
|
7
|
+
features?: Features<T>;
|
|
8
|
+
tagName?: string;
|
|
9
|
+
};
|
|
10
|
+
Blocks: {
|
|
11
|
+
default: [
|
|
12
|
+
{
|
|
13
|
+
dimensions?: Dimensions;
|
|
14
|
+
features?: QueryResults<T>;
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
};
|
|
18
|
+
Element: HTMLElement;
|
|
8
19
|
}
|
|
9
|
-
export default class ContainerQueryComponent extends Component<
|
|
20
|
+
export default class ContainerQueryComponent<T extends IndexSignatureParameter> extends Component<ContainerQueryComponentSignature<T>> {
|
|
10
21
|
dimensions?: Dimensions;
|
|
11
|
-
queryResults?: QueryResults
|
|
22
|
+
queryResults?: QueryResults<T>;
|
|
12
23
|
tagName: string;
|
|
13
24
|
updateState({ dimensions, queryResults, }: {
|
|
14
25
|
dimensions: Dimensions;
|
|
15
|
-
queryResults: QueryResults
|
|
26
|
+
queryResults: QueryResults<T>;
|
|
16
27
|
}): void;
|
|
17
28
|
}
|
|
18
29
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Metadata } from '../modifiers/container-query';
|
|
2
|
+
declare const AspectRatioHelper: import("@ember/component/helper").FunctionBasedHelper<{
|
|
3
|
+
Args: {
|
|
4
|
+
Positional: [];
|
|
5
|
+
Named: {
|
|
6
|
+
max?: number | undefined;
|
|
7
|
+
min?: number | undefined;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
Return: Metadata;
|
|
11
|
+
}>;
|
|
12
|
+
export default AspectRatioHelper;
|
|
13
|
+
//# sourceMappingURL=aspect-ratio.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Metadata } from '../modifiers/container-query';
|
|
2
|
+
declare const HeightHelper: import("@ember/component/helper").FunctionBasedHelper<{
|
|
3
|
+
Args: {
|
|
4
|
+
Positional: [];
|
|
5
|
+
Named: {
|
|
6
|
+
max?: number | undefined;
|
|
7
|
+
min?: number | undefined;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
Return: Metadata;
|
|
11
|
+
}>;
|
|
12
|
+
export default HeightHelper;
|
|
13
|
+
//# sourceMappingURL=height.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Metadata } from '../modifiers/container-query';
|
|
2
|
+
declare const WidthHelper: import("@ember/component/helper").FunctionBasedHelper<{
|
|
3
|
+
Args: {
|
|
4
|
+
Positional: [];
|
|
5
|
+
Named: {
|
|
6
|
+
max?: number | undefined;
|
|
7
|
+
min?: number | undefined;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
Return: Metadata;
|
|
11
|
+
}>;
|
|
12
|
+
export default WidthHelper;
|
|
13
|
+
//# sourceMappingURL=width.d.ts.map
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as ContainerQuery } from './components/container-query';
|
|
2
|
+
export { default as aspectRatio } from './helpers/aspect-ratio';
|
|
3
|
+
export { default as height } from './helpers/height';
|
|
4
|
+
export { default as width } from './helpers/width';
|
|
5
|
+
export { default as containerQuery } from './modifiers/container-query';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,47 +1,44 @@
|
|
|
1
1
|
import Modifier, { ArgsFor, NamedArgs, PositionalArgs } from 'ember-modifier';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
max: number;
|
|
5
|
-
min: number;
|
|
6
|
-
};
|
|
7
|
-
export type Features = {
|
|
8
|
-
[featureName: string]: Metadata;
|
|
9
|
-
};
|
|
10
|
-
export type Dimensions = {
|
|
2
|
+
type IndexSignatureParameter = string | number | symbol;
|
|
3
|
+
type Dimensions = {
|
|
11
4
|
aspectRatio: number;
|
|
12
5
|
height: number;
|
|
13
6
|
width: number;
|
|
14
7
|
};
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
type Metadata = {
|
|
9
|
+
dimension: 'aspectRatio' | 'height' | 'width';
|
|
10
|
+
max: number;
|
|
11
|
+
min: number;
|
|
17
12
|
};
|
|
18
|
-
|
|
13
|
+
type Features<T extends IndexSignatureParameter> = Record<T, Metadata>;
|
|
14
|
+
type QueryResults<T extends IndexSignatureParameter> = Record<T, boolean>;
|
|
15
|
+
interface ContainerQueryModifierSignature<T extends IndexSignatureParameter> {
|
|
19
16
|
Args: {
|
|
20
17
|
Named: {
|
|
21
18
|
dataAttributePrefix?: string;
|
|
22
19
|
debounce?: number;
|
|
23
|
-
features?: Features
|
|
20
|
+
features?: Features<T>;
|
|
24
21
|
onQuery?: ({ dimensions, queryResults, }: {
|
|
25
22
|
dimensions: Dimensions;
|
|
26
|
-
queryResults: QueryResults
|
|
23
|
+
queryResults: QueryResults<T>;
|
|
27
24
|
}) => void;
|
|
28
25
|
};
|
|
29
26
|
Positional: [];
|
|
30
27
|
};
|
|
31
28
|
Element: Element;
|
|
32
29
|
}
|
|
33
|
-
export default class ContainerQueryModifier extends Modifier<ContainerQueryModifierSignature
|
|
30
|
+
export default class ContainerQueryModifier<T extends IndexSignatureParameter> extends Modifier<ContainerQueryModifierSignature<T>> {
|
|
34
31
|
private readonly resizeObserver;
|
|
35
32
|
dimensions: Dimensions;
|
|
36
|
-
queryResults: QueryResults
|
|
33
|
+
queryResults: QueryResults<T>;
|
|
37
34
|
private _dataAttributes;
|
|
38
35
|
private _element?;
|
|
39
36
|
private _named;
|
|
40
37
|
get dataAttributePrefix(): string;
|
|
41
38
|
get debounce(): number;
|
|
42
|
-
get features(): Features
|
|
43
|
-
constructor(owner: unknown, args: ArgsFor<ContainerQueryModifierSignature
|
|
44
|
-
modify(element: Element, _positional: PositionalArgs<ContainerQueryModifierSignature
|
|
39
|
+
get features(): Features<T>;
|
|
40
|
+
constructor(owner: unknown, args: ArgsFor<ContainerQueryModifierSignature<T>>);
|
|
41
|
+
modify(element: Element, _positional: PositionalArgs<ContainerQueryModifierSignature<T>>, named: NamedArgs<ContainerQueryModifierSignature<T>>): void;
|
|
45
42
|
private onResize;
|
|
46
43
|
private registerResizeObserver;
|
|
47
44
|
private queryContainer;
|
|
@@ -50,5 +47,5 @@ export default class ContainerQueryModifier extends Modifier<ContainerQueryModif
|
|
|
50
47
|
private resetDataAttributes;
|
|
51
48
|
private setDataAttributes;
|
|
52
49
|
}
|
|
53
|
-
export {};
|
|
50
|
+
export { Dimensions, Features, IndexSignatureParameter, Metadata, QueryResults, };
|
|
54
51
|
//# sourceMappingURL=container-query.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-container-query",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Container queries using Ember modifiers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"container-queries",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"ember-addon",
|
|
11
11
|
"ember-octane",
|
|
12
12
|
"emberjs",
|
|
13
|
+
"glint",
|
|
13
14
|
"responsive-design"
|
|
14
15
|
],
|
|
15
16
|
"repository": {
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"lint:hbs:fix": "ember-template-lint . --fix",
|
|
36
37
|
"lint:js": "eslint . --cache --ext=.js,.ts",
|
|
37
38
|
"lint:js:fix": "eslint . --fix",
|
|
38
|
-
"lint:types": "
|
|
39
|
+
"lint:types": "glint",
|
|
39
40
|
"prepack": "ember ts:precompile",
|
|
40
41
|
"postpack": "ember ts:clean",
|
|
41
42
|
"start": "ember serve",
|
|
@@ -64,18 +65,20 @@
|
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"@ember/optional-features": "^2.0.0",
|
|
67
|
-
"@ember/test-helpers": "^2.9.
|
|
68
|
+
"@ember/test-helpers": "^2.9.3",
|
|
68
69
|
"@embroider/test-setup": "^2.0.2",
|
|
70
|
+
"@gavant/glint-template-types": "^0.3.0",
|
|
69
71
|
"@glimmer/component": "^1.1.2",
|
|
70
72
|
"@glimmer/tracking": "^1.1.2",
|
|
73
|
+
"@glint/core": "^v1.0.0-beta.2",
|
|
74
|
+
"@glint/environment-ember-loose": "^v1.0.0-beta.2",
|
|
75
|
+
"@glint/template": "^v1.0.0-beta.2",
|
|
71
76
|
"@percy/cli": "^1.16.0",
|
|
72
77
|
"@percy/ember": "^4.0.0",
|
|
73
|
-
"@tsconfig/ember": "^
|
|
74
|
-
"@types/ember-qunit": "^5.0.2",
|
|
75
|
-
"@types/ember-resolver": "^5.0.13",
|
|
78
|
+
"@tsconfig/ember": "^2.0.0",
|
|
76
79
|
"@types/ember__application": "^4.0.5",
|
|
77
80
|
"@types/ember__array": "^4.0.3",
|
|
78
|
-
"@types/ember__component": "^4.0.
|
|
81
|
+
"@types/ember__component": "^4.0.12",
|
|
79
82
|
"@types/ember__controller": "^4.0.4",
|
|
80
83
|
"@types/ember__debug": "^4.0.3",
|
|
81
84
|
"@types/ember__destroyable": "^4.0.1",
|
|
@@ -85,24 +88,23 @@
|
|
|
85
88
|
"@types/ember__polyfills": "^4.0.1",
|
|
86
89
|
"@types/ember__routing": "^4.0.12",
|
|
87
90
|
"@types/ember__runloop": "^4.0.2",
|
|
88
|
-
"@types/ember__service": "^4.0.
|
|
91
|
+
"@types/ember__service": "^4.0.2",
|
|
89
92
|
"@types/ember__string": "^3.0.10",
|
|
90
93
|
"@types/ember__template": "^4.0.1",
|
|
91
94
|
"@types/ember__test": "^4.0.1",
|
|
92
|
-
"@types/ember__test-helpers": "^2.8.2",
|
|
93
95
|
"@types/ember__utils": "^4.0.2",
|
|
94
96
|
"@types/htmlbars-inline-precompile": "^3.0.0",
|
|
95
97
|
"@types/qunit": "^2.19.3",
|
|
96
98
|
"@types/rsvp": "^4.0.4",
|
|
97
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
98
|
-
"@typescript-eslint/parser": "^5.
|
|
99
|
+
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
100
|
+
"@typescript-eslint/parser": "^5.48.0",
|
|
99
101
|
"broccoli-asset-rev": "^3.0.0",
|
|
100
102
|
"concurrently": "^7.6.0",
|
|
101
103
|
"d3-array": "^3.2.1",
|
|
102
104
|
"d3-axis": "^3.0.0",
|
|
103
105
|
"d3-scale": "^4.0.2",
|
|
104
106
|
"d3-selection": "^3.0.0",
|
|
105
|
-
"d3-shape": "^3.
|
|
107
|
+
"d3-shape": "^3.2.0",
|
|
106
108
|
"ember-a11y-refocus": "^3.0.2",
|
|
107
109
|
"ember-a11y-testing": "^5.1.0",
|
|
108
110
|
"ember-auto-import": "^2.5.0",
|
|
@@ -117,8 +119,8 @@
|
|
|
117
119
|
"ember-load-initializers": "^2.1.2",
|
|
118
120
|
"ember-named-blocks-polyfill": "^0.2.5",
|
|
119
121
|
"ember-page-title": "^7.0.0",
|
|
120
|
-
"ember-qunit": "^6.
|
|
121
|
-
"ember-resolver": "^
|
|
122
|
+
"ember-qunit": "^6.1.1",
|
|
123
|
+
"ember-resolver": "^9.0.1",
|
|
122
124
|
"ember-source": "~4.9.3",
|
|
123
125
|
"ember-source-channel-url": "^3.0.0",
|
|
124
126
|
"ember-svg-jar": "^2.4.2",
|
|
@@ -126,22 +128,23 @@
|
|
|
126
128
|
"ember-template-lint-plugin-prettier": "^4.1.0",
|
|
127
129
|
"ember-truth-helpers": "^3.1.1",
|
|
128
130
|
"ember-try": "^2.0.0",
|
|
129
|
-
"eslint": "^8.
|
|
130
|
-
"eslint-config-prettier": "^8.
|
|
131
|
-
"eslint-plugin-ember": "^11.2
|
|
131
|
+
"eslint": "^8.31.0",
|
|
132
|
+
"eslint-config-prettier": "^8.6.0",
|
|
133
|
+
"eslint-plugin-ember": "^11.4.2",
|
|
132
134
|
"eslint-plugin-n": "^15.6.0",
|
|
133
135
|
"eslint-plugin-prettier": "^4.2.1",
|
|
134
136
|
"eslint-plugin-qunit": "^7.3.4",
|
|
135
137
|
"eslint-plugin-simple-import-sort": "^8.0.0",
|
|
138
|
+
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
|
136
139
|
"lerna-changelog": "^2.2.0",
|
|
137
140
|
"loader.js": "^4.7.0",
|
|
138
141
|
"prettier": "^2.8.1",
|
|
139
142
|
"qunit": "^2.19.3",
|
|
140
143
|
"qunit-dom": "^2.0.0",
|
|
141
|
-
"stylelint": "^14.16.
|
|
144
|
+
"stylelint": "^14.16.1",
|
|
142
145
|
"stylelint-config-standard": "^29.0.0",
|
|
143
146
|
"stylelint-no-unsupported-browser-features": "^6.0.1",
|
|
144
|
-
"stylelint-order": "^
|
|
147
|
+
"stylelint-order": "^6.0.0",
|
|
145
148
|
"typescript": "^4.9.4",
|
|
146
149
|
"webpack": "^5.75.0"
|
|
147
150
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type ContainerQueryComponent from './components/container-query';
|
|
2
|
+
import type AspectRatioHelper from './helpers/aspect-ratio';
|
|
3
|
+
import type HeightHelper from './helpers/height';
|
|
4
|
+
import type WidthHelper from './helpers/width';
|
|
5
|
+
import type ContainerQueryModifier from './modifiers/container-query';
|
|
6
|
+
export default interface EmberContainerQueryRegistry {
|
|
7
|
+
ContainerQuery: typeof ContainerQueryComponent;
|
|
8
|
+
'aspect-ratio': typeof AspectRatioHelper;
|
|
9
|
+
'container-query': typeof ContainerQueryModifier;
|
|
10
|
+
'cq-aspect-ratio': typeof AspectRatioHelper;
|
|
11
|
+
'cq-height': typeof HeightHelper;
|
|
12
|
+
'cq-width': typeof WidthHelper;
|
|
13
|
+
height: typeof HeightHelper;
|
|
14
|
+
width: typeof WidthHelper;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=template-registry.d.ts.map
|
package/tsconfig.json
CHANGED
package/types/dummy/index.d.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Add any types here that you need for local development only.
|
|
2
|
+
// These will *not* be published as part of your addon, so be careful that your published code does not rely on them!
|
|
3
|
+
|
|
4
|
+
import '@glint/environment-ember-loose';
|
|
5
|
+
|
|
6
|
+
import SvgJarHelper from '@gavant/glint-template-types/types/ember-svg-jar/helpers/svg-jar';
|
|
7
|
+
import AndHelper from '@gavant/glint-template-types/types/ember-truth-helpers/helpers/and';
|
|
8
|
+
import OrHelper from '@gavant/glint-template-types/types/ember-truth-helpers/helpers/or';
|
|
9
|
+
import { ComponentLike, HelperLike } from '@glint/template';
|
|
10
|
+
import type EmberContainerQueryRegistry from 'ember-container-query/template-registry';
|
|
11
|
+
|
|
12
|
+
type NavigationNarratorComponent = ComponentLike<{
|
|
13
|
+
Args: {
|
|
14
|
+
skipTo: string;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
type PageTitleHelper = HelperLike<{
|
|
19
|
+
Args: { Positional: [title: string] };
|
|
20
|
+
Return: void;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
declare module '@glint/environment-ember-loose/registry' {
|
|
24
|
+
export default interface Registry extends EmberContainerQueryRegistry {
|
|
25
|
+
// Add any registry entries from other addons here that your addon itself uses (in non-strict mode templates)
|
|
26
|
+
// See https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons
|
|
27
|
+
NavigationNarrator: NavigationNarratorComponent;
|
|
28
|
+
and: typeof AndHelper;
|
|
29
|
+
or: typeof OrHelper;
|
|
30
|
+
'page-title': PageTitleHelper;
|
|
31
|
+
'svg-jar': typeof SvgJarHelper;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { helper } from '@ember/component/helper';
|
|
2
|
-
import type { Metadata } from 'ember-container-query/modifiers/container-query';
|
|
3
|
-
|
|
4
|
-
function cqAspectRatio(
|
|
5
|
-
positional: unknown[],
|
|
6
|
-
named: Record<string, unknown>
|
|
7
|
-
): Metadata {
|
|
8
|
-
const dimension = 'aspectRatio';
|
|
9
|
-
const max = (named['max'] as number | undefined) ?? Infinity;
|
|
10
|
-
const min = (named['min'] as number | undefined) ?? 0;
|
|
11
|
-
|
|
12
|
-
return { dimension, max, min };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default helper(cqAspectRatio);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { helper } from '@ember/component/helper';
|
|
2
|
-
import type { Metadata } from 'ember-container-query/modifiers/container-query';
|
|
3
|
-
|
|
4
|
-
function cqHeight(
|
|
5
|
-
positional: unknown[],
|
|
6
|
-
named: Record<string, unknown>
|
|
7
|
-
): Metadata {
|
|
8
|
-
const dimension = 'height';
|
|
9
|
-
const max = (named['max'] as number | undefined) ?? Infinity;
|
|
10
|
-
const min = (named['min'] as number | undefined) ?? 0;
|
|
11
|
-
|
|
12
|
-
return { dimension, max, min };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default helper(cqHeight);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { helper } from '@ember/component/helper';
|
|
2
|
-
import type { Metadata } from 'ember-container-query/modifiers/container-query';
|
|
3
|
-
|
|
4
|
-
function cqWidth(
|
|
5
|
-
positional: unknown[],
|
|
6
|
-
named: Record<string, unknown>
|
|
7
|
-
): Metadata {
|
|
8
|
-
const dimension = 'width';
|
|
9
|
-
const max = (named['max'] as number | undefined) ?? Infinity;
|
|
10
|
-
const min = (named['min'] as number | undefined) ?? 0;
|
|
11
|
-
|
|
12
|
-
return { dimension, max, min };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default helper(cqWidth);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from 'ember-container-query/modifiers/container-query';
|
|
2
|
-
declare const _default: import("@ember/component/helper").FunctionBasedHelper<{
|
|
3
|
-
Args: {
|
|
4
|
-
Positional: unknown[];
|
|
5
|
-
Named: Record<string, unknown>;
|
|
6
|
-
};
|
|
7
|
-
Return: Metadata;
|
|
8
|
-
}>;
|
|
9
|
-
export default _default;
|
|
10
|
-
//# sourceMappingURL=cq-aspect-ratio.d.ts.map
|
package/helpers/cq-height.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from 'ember-container-query/modifiers/container-query';
|
|
2
|
-
declare const _default: import("@ember/component/helper").FunctionBasedHelper<{
|
|
3
|
-
Args: {
|
|
4
|
-
Positional: unknown[];
|
|
5
|
-
Named: Record<string, unknown>;
|
|
6
|
-
};
|
|
7
|
-
Return: Metadata;
|
|
8
|
-
}>;
|
|
9
|
-
export default _default;
|
|
10
|
-
//# sourceMappingURL=cq-height.d.ts.map
|
package/helpers/cq-width.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from 'ember-container-query/modifiers/container-query';
|
|
2
|
-
declare const _default: import("@ember/component/helper").FunctionBasedHelper<{
|
|
3
|
-
Args: {
|
|
4
|
-
Positional: unknown[];
|
|
5
|
-
Named: Record<string, unknown>;
|
|
6
|
-
};
|
|
7
|
-
Return: Metadata;
|
|
8
|
-
}>;
|
|
9
|
-
export default _default;
|
|
10
|
-
//# sourceMappingURL=cq-width.d.ts.map
|