Skip to content

Commit

Permalink
feat(polyfill): Adds polyfill for Constructable StyleSheets
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Feb 16, 2019
1 parent d31e79b commit b9f9989
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Here's a full list of all possible `feature` _names_.
Note that these will be deduplicated. For example, if you request `es.object`, but also request `es`, `es.object` will only be included once as part of `es`.
And, if you request `performance.now`, `date.now` will also be included since the polyfill depends on it. You don't have to worry about dependencies.

Bold-formatted polyfills are _aliases_ for one or several other related `feature`s.
**Bold**-formatted polyfills are _aliases_ for one or several other related `feature`s.

- **`requestidlecallback`**
- `request-idle-callback`
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"blob-polyfill": "^3.0.20180112",
"chalk": "^2.4.2",
"console-polyfill": "^0.3.0",
"construct-style-sheets-polyfill": "^1.0.1",
"core-js": "^3.0.0-beta.14",
"core-js-builder": "^3.0.0-beta.14",
"devcert": "^1.0.0",
Expand Down
12 changes: 12 additions & 0 deletions src/constant/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2977,6 +2977,18 @@ export const constant: IConstant = {
version: environment.NPM_PACKAGE_DEPENDENCIES_CORE_JS,
dependencies: [],
contexts: ALL_CONTEXTS
},
"adopted-style-sheets": {
polyfills: ["constructable-style-sheets"]
},
"constructable-style-sheets": {
library: "construct-style-sheets-polyfill",
relativePaths: ["adoptedStyleSheets.min.js"],
// TODO: Add features when MDN or Caniuse adds support
features: [],
version: environment.NPM_PACKAGE_DEPENDENCIES_CONSTRUCT_STYLE_SHEETS_POLYFILL,
dependencies: ["shadow-dom"],
contexts: ALL_CONTEXTS
}
}
};
1 change: 1 addition & 0 deletions src/environment/environment-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const environmentDefaults = {
NPM_PACKAGE_HOMEPAGE: "",
NPM_PACKAGE_MAIN: "",
NPM_PACKAGE_DEPENDENCIES_INTERSECTION_OBSERVER: "",
NPM_PACKAGE_DEPENDENCIES_CONSTRUCT_STYLE_SHEETS_POLYFILL: "",
NPM_PACKAGE_DEPENDENCIES_SCROLL_BEHAVIOR_POLYFILL: "",
NPM_PACKAGE_DEPENDENCIES_RESIZE_OBSERVER: "",
NPM_PACKAGE_DEPENDENCIES_SETIMMEDIATE: "",
Expand Down
6 changes: 4 additions & 2 deletions src/polyfill/polyfill-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export declare type PolyfillName =
| "requestanimationframe"
| "requestidlecallback"
| "setimmediate"
| "globalthis";
| "globalthis"
| "adopted-style-sheets";

export declare type PolyfillDealiasedName =
| "es.object.assign"
Expand Down Expand Up @@ -346,4 +347,5 @@ export declare type PolyfillDealiasedName =
| "pointer-event"
| "set-immediate"
| "web-animations"
| "global-this";
| "global-this"
| "constructable-style-sheets";

0 comments on commit b9f9989

Please sign in to comment.