webcomponent
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -9,2 +9,8 @@ 'use strict'; | ||
var _extendableHtmlElement = require('./extendable-html-element'); | ||
var _extendableHtmlElement2 = _interopRequireDefault(_extendableHtmlElement); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -16,27 +22,3 @@ | ||
// shim HTMLElement if necessary | ||
// Safari breaks when attempting to inherit from HTMLElement | ||
// Babel marked as wontfix because, well, it's not really | ||
// a language issue: https://phabricator.babeljs.io/T1548 | ||
if (typeof HTMLElement !== 'function') { | ||
var _HTMLElement = function _HTMLElement() {}; | ||
_HTMLElement.prototype = HTMLElement.prototype; | ||
HTMLElement = _HTMLElement; | ||
} | ||
// Babel 6's class inheritance does not play entirely well | ||
// with HTMLElement (and other native classes), which shows up | ||
// in the implementation of customElements.define() | ||
// see https://github.com/babel/babel/issues/4480 | ||
// this patch is adapted from | ||
// https://github.com/github/babel-plugin-transform-custom-element-classes/blob/f5067aa/lib/index.js#L4-L6 | ||
function ExtendableHTMLElement() { | ||
return Reflect.construct(HTMLElement, [], this.__proto__.constructor); | ||
}; | ||
Object.setPrototypeOf(ExtendableHTMLElement.prototype, HTMLElement.prototype); | ||
Object.setPrototypeOf(ExtendableHTMLElement, HTMLElement); | ||
// on to the main show! | ||
// WebComponent = thin wrapper around HTMLElement with convenience methods | ||
var WebComponent = function (_ExtendableHTMLElemen) { | ||
@@ -86,4 +68,4 @@ _inherits(WebComponent, _ExtendableHTMLElemen); | ||
return WebComponent; | ||
}(ExtendableHTMLElement); | ||
}(_extendableHtmlElement2.default); | ||
exports.default = WebComponent; |
@@ -1,23 +0,3 @@ | ||
// shim HTMLElement if necessary | ||
// Safari breaks when attempting to inherit from HTMLElement | ||
// Babel marked as wontfix because, well, it's not really | ||
// a language issue: https://phabricator.babeljs.io/T1548 | ||
if (typeof HTMLElement !== 'function') { | ||
var _HTMLElement = function() {}; | ||
_HTMLElement.prototype = HTMLElement.prototype; | ||
HTMLElement = _HTMLElement; | ||
} | ||
import ExtendableHTMLElement from './extendable-html-element'; | ||
// Babel 6's class inheritance does not play entirely well | ||
// with HTMLElement (and other native classes), which shows up | ||
// in the implementation of customElements.define() | ||
// see https://github.com/babel/babel/issues/4480 | ||
// this patch is adapted from | ||
// https://github.com/github/babel-plugin-transform-custom-element-classes/blob/f5067aa/lib/index.js#L4-L6 | ||
function ExtendableHTMLElement() { return Reflect.construct(HTMLElement, [], this.__proto__.constructor); }; | ||
Object.setPrototypeOf(ExtendableHTMLElement.prototype, HTMLElement.prototype); | ||
Object.setPrototypeOf(ExtendableHTMLElement, HTMLElement); | ||
// on to the main show! | ||
// WebComponent = thin wrapper around HTMLElement with convenience methods | ||
@@ -24,0 +4,0 @@ export default class WebComponent extends ExtendableHTMLElement { |
{ | ||
"name": "webcomponent", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "lightweight helpers for constructing web components", | ||
@@ -8,4 +8,8 @@ "main": "build/index.js", | ||
"build": "babel lib -d build", | ||
"build-test": "webpack --config test/webpack.config.js", | ||
"prepublish": "npm run build", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "npm run build-test && npm run test-local", | ||
"test-local": "wct --plugin local test/index.html", | ||
"test-p": "wct --plugin local --persistent test/index.html", | ||
"test-sauce": "wct --plugin sauce test/index.html" | ||
}, | ||
@@ -28,6 +32,10 @@ "repository": { | ||
"devDependencies": { | ||
"@webcomponents/custom-elements": "^1.0.4", | ||
"babel-cli": "^6.6.5", | ||
"babel-core": "^6.7.6", | ||
"babel-preset-es2015": "^6.6.0" | ||
"babel-loader": "^6.4.1", | ||
"babel-preset-env": "^1.6.0", | ||
"web-component-tester": "^5.0.0", | ||
"webpack": "^1.12.9" | ||
} | ||
} |
# webcomponent | ||
[![Build Status](https://travis-ci.org/mixpanel/webcomponent.svg?branch=master)](https://travis-ci.org/mixpanel/webcomponent) | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/mixpanel-webcomponents.svg)](https://saucelabs.com/u/mixpanel-webcomponents) | ||
Lightweight utilities for constructing [Web Components](http://webcomponents.org/) | ||
@@ -57,4 +61,26 @@ | ||
## Development | ||
Install dependencies: `npm install` | ||
Run local demo: | ||
- `cd demo` | ||
- `npm install` | ||
- `npm start` | ||
- Visit [http://localhost:8080/](http://localhost:8080/) | ||
## Running tests | ||
Browser tests run with Selenium through [web-component-tester](https://github.com/Polymer/web-component-tester). | ||
#### Run with locally installed browsers | ||
`npm test` | ||
#### Tunnel to [Sauce Labs](https://saucelabs.com/) | ||
`npm run build-test && npm run test-browser-sauce` | ||
Set credentials with environment variables `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY`. The default browser/OS matrix is defined in `wct.conf.json`. | ||
## License | ||
MIT |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
35723
14
717
0
86
7
1
1