Skip to content

Commit

Permalink
fix: move experimental CSS changes to VCS
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Sep 26, 2021
1 parent c93fed8 commit eee3aa0
Show file tree
Hide file tree
Showing 41 changed files with 5,877 additions and 33 deletions.
28 changes: 7 additions & 21 deletions file-content-injector.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
const fs = require("fs");

[
// TODO: Remove this when https://github.com/swc-project/swc/issues/1179 has been resolved
{
action: "replace",
file: "node_modules/@wessberg/connection-observer/dist/index.js",
match: String.raw`if (new.target === undefined) {`,
replacement: String.raw`if ((this instanceof ConnectionObserver ? this.constructor : void 0) === undefined) {`
},
// TODO: Remove this when https://github.com/swc-project/swc/issues/1179 has been resolved
{
action: "replace",
file: "node_modules/@polyfiller/object-fit/polyfill/index.js",
match: String.raw`if (new.target === undefined) {`,
replacement: String.raw`if ((this instanceof ComputedStyleObserver ? this.constructor : void 0) === undefined) {`
},
{
action: "copy",
source: "node_modules/@webcomponents/shadycss",
destination: "node_modules/@webcomponents/shadycss-experimental"
destination: "polyfill-lib/@webcomponents/shadycss-experimental"
},
{
action: "create",
file: "node_modules/@webcomponents/shadycss-experimental/src/calc-parse.js",
file: "polyfill-lib/@webcomponents/shadycss-experimental/src/calc-parse.js",
text: `/**
@license
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
Expand Down Expand Up @@ -253,19 +239,19 @@ const fs = require("fs");
},
{
action: "replace",
file: "node_modules/@webcomponents/shadycss-experimental/src/css-parse.js",
file: "polyfill-lib/@webcomponents/shadycss-experimental/src/css-parse.js",
match: String.raw`/**`,
replacement: `import {reduceCalc} from './calc-parse.js';\n/**`
},
{
action: "replace",
file: "node_modules/@webcomponents/shadycss-experimental/src/css-parse.js",
file: "polyfill-lib/@webcomponents/shadycss-experimental/src/css-parse.js",
match: String.raw`removeCustomProps(node['cssText']);`,
replacement: String.raw`reduceCalc(removeCustomProps(node['cssText']));`
},
{
action: "replace",
file: "node_modules/@webcomponents/shadycss-experimental/src/style-properties.js",
file: "polyfill-lib/@webcomponents/shadycss-experimental/src/style-properties.js",
match: String.raw`return method && method.call(this, selector);`,
replacement: `
try {
Expand All @@ -277,13 +263,13 @@ const fs = require("fs");
// Have it remove all rules containing :focus-visible
{
action: "replace",
file: "node_modules/@webcomponents/shadycss-experimental/src/style-transformer.js",
file: "polyfill-lib/@webcomponents/shadycss-experimental/src/style-transformer.js",
match: String.raw`const MATCHES =`,
replacement: `const FOCUS_VISIBLE = /:(?:focus-visible)/;\nconst MATCHES =`
},
{
action: "replace",
file: "node_modules/@webcomponents/shadycss-experimental/src/style-transformer.js",
file: "polyfill-lib/@webcomponents/shadycss-experimental/src/style-transformer.js",
match: String.raw`let stop = false;`,
replacement: String.raw`
let stop = false;
Expand Down
11 changes: 1 addition & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"polyfill-lib/**/*.*"
],
"scripts": {
"postinstall": "node ./file-content-injector.js",
"start": "node ./dist/index.js",
"generate:sandhog": "sandhog all --yes",
"generate:changelog": "standard-changelog --first-release",
Expand Down
44 changes: 44 additions & 0 deletions polyfill-lib/@webcomponents/shadycss-experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!-- ## Unreleased -->

## [1.11.0] - 2021-08.02

- Add TS externs. ([#457](https://github.com/webcomponents/polyfills/pull/457))

## [1.10.2] - 2020-10-21

- Maintenance release (no user-facing changes)

## [1.10.1] - 2020-07-20

- Maintenance release (no user-facing changes)

## [1.10.0] - 2020-06-03

- Add `@webcomponents/shadycss` module, an interface to ShadyCSS polyfills that
is importable, type-safe, and easier to use than the `window.ShadyCSS`
globals.

## [1.9.6] - 2020-03-16

- Closure type annotation improvements ([#284](https://github.com/webcomponents/polyfills/pull/284), [#280](https://github.com/webcomponents/polyfills/pull/280))

## [1.9.5] - 2020-02-26

- Maintenance release (no user-facing changes)

## [1.9.4] - 2020-01-08

- Fix Edge bug where cloned style would not apply correctly
([#242](https://github.com/webcomponents/polyfills/pull/242))

## [1.9.3] - 2019-11-12

- When the apply shim is loaded, update custom-styles even if none are currently
enqueued ([#208](https://github.com/webcomponents/polyfills/pull/208))
19 changes: 19 additions & 0 deletions polyfill-lib/@webcomponents/shadycss-experimental/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# License

Everything in this repo is BSD style license unless otherwise specified.

Copyright (c) 2015 The Polymer Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit eee3aa0

Please sign in to comment.