ember-scoped-css 3.0.0 → 3.1.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/README.md +21 -1
- package/package.json +7 -2
- package/types.d.ts +30 -0
package/README.md
CHANGED
|
@@ -194,7 +194,25 @@ Requires
|
|
|
194
194
|
- @glint/template 1.7.0 or higher
|
|
195
195
|
- @glint/tsserver-plugin 2.0.5 or higher
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
Add `ember-scoped-css/types` to the [`types`](https://www.typescriptlang.org/tsconfig#types) array in your `tsconfig.json`:
|
|
198
|
+
|
|
199
|
+
```jsonc
|
|
200
|
+
{
|
|
201
|
+
"compilerOptions": {
|
|
202
|
+
"types": ["ember-scoped-css/types"]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
If your project doesn't use `compilerOptions.types` (note that specifying it disables automatic inclusion of `@types/*` packages), you can instead import the declarations from a type-declaration file that is included in your project — `types/index.d.ts` (or similar for apps) or `unpublished-development-types/index.d.ts` (for libraries):
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
import 'ember-scoped-css/types';
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
<details><summary>What <code>ember-scoped-css/types</code> provides</summary>
|
|
214
|
+
|
|
215
|
+
It declaration-merges the known attributes for the `<style>` tag:
|
|
198
216
|
|
|
199
217
|
```ts
|
|
200
218
|
import '@glint/template';
|
|
@@ -207,6 +225,8 @@ declare global {
|
|
|
207
225
|
}
|
|
208
226
|
```
|
|
209
227
|
|
|
228
|
+
</details>
|
|
229
|
+
|
|
210
230
|
### template-lint
|
|
211
231
|
|
|
212
232
|
If you use [ember-template-lint](https://github.com/ember-template-lint/ember-template-lint) for linting the `<template>...</template>` regions of your components, you'll need to allow the `<style>` attribute to be used. The easiest way is to disable the [`no-forbidden-elements`](https://github.com/ember-template-lint/ember-template-lint/blob/main/docs/rule/no-forbidden-elements.md) rule:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-scoped-css",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"dist",
|
|
20
20
|
"declarations",
|
|
21
21
|
"addon-main.cjs",
|
|
22
|
-
"template-registry.d.ts"
|
|
22
|
+
"template-registry.d.ts",
|
|
23
|
+
"types.d.ts"
|
|
23
24
|
],
|
|
24
25
|
"exports": {
|
|
25
26
|
".": {
|
|
@@ -42,6 +43,10 @@
|
|
|
42
43
|
"types": "./template-registry.d.ts",
|
|
43
44
|
"default": "./src/noop.js"
|
|
44
45
|
},
|
|
46
|
+
"./types": {
|
|
47
|
+
"types": "./types.d.ts",
|
|
48
|
+
"default": "./src/noop.js"
|
|
49
|
+
},
|
|
45
50
|
"./test-support": {
|
|
46
51
|
"types": "./declarations/runtime/test-support.d.ts",
|
|
47
52
|
"default": "./dist/runtime/test-support.js"
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This declaration file teaches TypeScript (via Glint) about the special
|
|
3
|
+
* attributes that ember-scoped-css adds to the `<style>` element,
|
|
4
|
+
* so that `<style scoped>` and `<style inline>` type-check.
|
|
5
|
+
*
|
|
6
|
+
* Add it to your tsconfig.json:
|
|
7
|
+
*
|
|
8
|
+
* ```jsonc
|
|
9
|
+
* {
|
|
10
|
+
* "compilerOptions": {
|
|
11
|
+
* "types": ["ember-scoped-css/types"]
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* or, if you don't use `compilerOptions.types`, import it from a
|
|
17
|
+
* type-declaration file that is included in your project:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import 'ember-scoped-css/types';
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import '@glint/template';
|
|
24
|
+
|
|
25
|
+
declare global {
|
|
26
|
+
interface HTMLStyleElementAttributes {
|
|
27
|
+
scoped: '';
|
|
28
|
+
inline: '';
|
|
29
|
+
}
|
|
30
|
+
}
|