Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@code.gov/code-gov-style

Package Overview
Dependencies
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@code.gov/code-gov-style - npm Package Compare versions

Comparing version 1.10.1 to 1.10.2

src/quality_tag.js

88

assets/js/code-gov-web-components.js

@@ -359,2 +359,90 @@ 'use strict';

customElements.define('filter-tag', FilterTag);
'use strict';
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
(function () {
/*global HTMLElement*/
var QualityTag =
/*#__PURE__*/
function (_HTMLElement) {
_inherits(QualityTag, _HTMLElement);
function QualityTag() {
_classCallCheck(this, QualityTag);
// establish prototype chain
return _possibleConstructorReturn(this, _getPrototypeOf(QualityTag).call(this));
}
_createClass(QualityTag, [{
key: "connectedCallback",
// fires after the element has been attached to the DOM
value: function connectedCallback() {
this.update();
}
}, {
key: "attributeChangedCallback",
value: function attributeChangedCallback(attrName, oldVal, newVal) {
if (attrName === 'score') {
this.update();
}
}
}, {
key: "update",
value: function update() {
var rounded = Math.round(Number(this.getAttribute('score')) * 10) / 10;
var category = '';
if (rounded > 0 && rounded < 4) {
category = 'low';
} else if (rounded >= 4 && rounded < 7) {
category = 'medium';
} else if (rounded >= 7) {
category = 'high';
} else {
category = '';
}
this.innerHTML = '<div class="corner-tag ' + category + '"><div class="corner-tag-value">' + rounded + '</div></div>';
}
}], [{
key: "observedAttributes",
get: function get() {
return ['score'];
}
}]);
return QualityTag;
}(_wrapNativeSuper(HTMLElement)); // let the browser know about the custom element
/*global customElements*/
customElements.define('quality-tag', QualityTag);
})();

@@ -67,2 +67,19 @@ ---

</div>
```
# Web Component
<div style="max-width: 400px">
<div class="card">
<quality-tag score="6.81"></quality-tag>
<p>Card with Quality Tag as Web Component</p>
</div>
</div>
```
<div style="max-width: 400px">
<div class="card">
<quality-tag score="6.81"></quality-tag>
<p>Card with Quality Tag as Web Component</p>
</div>
</div>
```

@@ -10,3 +10,9 @@ # Contributing

### Requirement
The following minimum requirements should be satisfied for running the `npm run serve` for local development
- npm
- ruby
- bundler
### Updating Font
code-gov-style depends on the font from [code-gov-font](https://github.com/GSA/code-gov-style). In order to use a new version of [code-gov-font](https://github.com/GSA/code-gov-style), update the version in the [package.json](https://github.com/GSA/code-gov-style/blob/master/package.json), run `npm install`, and then run `npm run update-font`. `npm run update-font` basically copies over the relevant font files from the installed package, so they're in the places that Jekyll expects.

@@ -359,2 +359,90 @@ 'use strict';

customElements.define('filter-tag', FilterTag);
'use strict';
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
(function () {
/*global HTMLElement*/
var QualityTag =
/*#__PURE__*/
function (_HTMLElement) {
_inherits(QualityTag, _HTMLElement);
function QualityTag() {
_classCallCheck(this, QualityTag);
// establish prototype chain
return _possibleConstructorReturn(this, _getPrototypeOf(QualityTag).call(this));
}
_createClass(QualityTag, [{
key: "connectedCallback",
// fires after the element has been attached to the DOM
value: function connectedCallback() {
this.update();
}
}, {
key: "attributeChangedCallback",
value: function attributeChangedCallback(attrName, oldVal, newVal) {
if (attrName === 'score') {
this.update();
}
}
}, {
key: "update",
value: function update() {
var rounded = Math.round(Number(this.getAttribute('score')) * 10) / 10;
var category = '';
if (rounded > 0 && rounded < 4) {
category = 'low';
} else if (rounded >= 4 && rounded < 7) {
category = 'medium';
} else if (rounded >= 7) {
category = 'high';
} else {
category = '';
}
this.innerHTML = '<div class="corner-tag ' + category + '"><div class="corner-tag-value">' + rounded + '</div></div>';
}
}], [{
key: "observedAttributes",
get: function get() {
return ['score'];
}
}]);
return QualityTag;
}(_wrapNativeSuper(HTMLElement)); // let the browser know about the custom element
/*global customElements*/
customElements.define('quality-tag', QualityTag);
})();

2

package.json
{
"name": "@code.gov/code-gov-style",
"version": "1.10.1",
"version": "1.10.2",
"description": "Style for code.gov including buttons, banners, and cards. Inspired by and somewhat based on USWDS.",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc