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

@lrnwebcomponents/simple-colors

Package Overview
Dependencies
Maintainers
4
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lrnwebcomponents/simple-colors - npm Package Compare versions

Comparing version 0.0.34 to 0.0.35

11

build/es5-amd/lib/simple-colors-utility.js

@@ -266,3 +266,6 @@ define(["../node_modules/@polymer/polymer/polymer-legacy.js"], function(

css = "",
addTheme = function(selector, prefix, reverse) {
addProp = function addProp(prop, val) {
return prop + ": " + val + "; \n";
},
addTheme = function addTheme(selector, prefix, reverse) {
css += selector + " { ";

@@ -298,3 +301,3 @@ for (var property in root.hexCodes) {

},
addClasses = function() {
addClasses = function addClasses(prefix) {
for (var property in root.hexCodes) {

@@ -341,3 +344,3 @@ if (

},
addClass = function(prop, prefix, suffix, type, style, hex) {
addClass = function addClass(prop, prefix, suffix, type, style, hex) {
var color = "" === prop ? "none" : prop,

@@ -369,3 +372,3 @@ accent = prefix + "accent-" + suffix + type,

},
addAccent = function(prefix, color) {
addAccent = function addAccent(prefix, color) {
for (var i = 0; 10 > i; i++) {

@@ -372,0 +375,0 @@ var suffix = 5 > i ? "-foreground" : "-background",

define([
"./node_modules/@polymer/polymer/polymer-legacy.js",
"./lib/simple-colors-utility.js"
], function() {
], function(_polymerLegacy, _simpleColorsUtility) {
"use strict";

@@ -74,2 +74,9 @@ window.simpleColorsBehaviors = window.simpleColorsBehaviors || {};

_getLightTheme: function _getLightTheme(hexCodes) {
var setThemeProps = function setThemeProps(themePrefix, theme) {
for (var property in theme) {
if (theme.hasOwnProperty(property)) {
this._setProps(themePrefix + property, theme[property]);
}
}
};
this._setThemeProps("--simple-colors-", hexCodes);

@@ -76,0 +83,0 @@ this._setThemeProps("--simple-colors-light-theme-", hexCodes);

@@ -264,2 +264,5 @@ import {

css = "",
addProp = function(prop, val) {
return prop + ": " + val + "; \n";
},
addTheme = function(selector, prefix, reverse) {

@@ -291,3 +294,3 @@ css += selector + " { ";

},
addClasses = function() {
addClasses = function(prefix) {
for (var property in root.hexCodes) {

@@ -294,0 +297,0 @@ if (

@@ -75,2 +75,9 @@ import {

_getLightTheme: function(hexCodes) {
let setThemeProps = function(themePrefix, theme) {
for (var property in theme) {
if (theme.hasOwnProperty(property)) {
this._setProps(themePrefix + property, theme[property]);
}
}
};
this._setThemeProps("--simple-colors-", hexCodes);

@@ -77,0 +84,0 @@ this._setThemeProps("--simple-colors-light-theme-", hexCodes);

@@ -19,3 +19,3 @@ {

},
"version": "0.0.34",
"version": "0.0.35",
"description": "Automated conversion of simple-colors/",

@@ -48,3 +48,3 @@ "repository": {

"devDependencies": {
"@lrnwebcomponents/deduping-fix": "^0.0.34",
"@lrnwebcomponents/deduping-fix": "^0.0.35",
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page",

@@ -69,3 +69,3 @@ "@polymer/iron-demo-helpers": "3.0.2",

],
"gitHead": "85bf1e684f0f88c1ce807c92255af222057eeaa0"
"gitHead": "71dcc2b61045070a009e654226e6c0892f11a854"
}

@@ -1,1 +0,1 @@

define(["./node_modules/@polymer/polymer/polymer-legacy.js","./lib/simple-colors-utility.js"],function(){"use strict";window.simpleColorsBehaviors=window.simpleColorsBehaviors||{};window.simpleColorsBehaviors={properties:{accentColor:{type:String,value:null,reflectToAttribute:!0},dark:{type:Boolean,value:!1,reflectToAttribute:!0},__hexCodes:{type:Object,value:null},__lightTheme:{type:Object,computed:"_getLightTheme(__hexCodes)"},__darkTheme:{type:Object,computed:"_getDarkTheme(__hexCodes)"}},observers:["setTheme(accentColor,dark,__hexCodes)"],created:function created(){window.SimpleColorsUtility.requestAvailability();this.__wcagaa={greys:{small:[5,5,4,4,1],large:[5,5,5,4,2]},colors:{small:[4,3,3,1,0],large:[5,4,3,2,1]}}},ready:function ready(){this.__hexCodes=window.SimpleColorsUtility.hexCodes},setTheme:function setTheme(accentColor,dark,hexCodes){if(null!==hexCodes&&""!==hexCodes){if(null!==accentColor&&""!==accentColor){var prop=accentColor.replace(/-([a-z])/g,function(g){return g[1].toUpperCase()});if(this.__lightTheme.hasOwnProperty(prop)){this.__lightTheme.accent=this.__lightTheme[prop].slice();this.__darkTheme.accent=this.__darkTheme[prop].slice()}else{this.__lightTheme.accent=this.__hexCodes.accent.slice();this.__darkTheme.accent=this.__hexCodes.accent.slice().reverse()}}this._setThemeProps("--simple-colors-light-theme-",this.__lightTheme);this._setThemeProps("--simple-colors-dark-theme-",this.__darkTheme);if(dark){this._setThemeProps("--simple-colors-",this.__darkTheme)}else{this._setThemeProps("--simple-colors-",this.__lightTheme)}}},_setProps:function _setProps(prefix,colors){prefix=prefix.replace("-grey","").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();for(var customStyle={},i=0;i<colors.length;i++){var half=colors.length/2,suffix=i<half?"-foreground"+(i+1):"-background"+(colors.length-i);if(null!==customStyle&&null!==customStyle[prefix+suffix]){customStyle[prefix+suffix]=colors[i]}}this.updateStyles(customStyle)},_setThemeProps:function _setThemeProps(themePrefix,theme){for(var property in theme){if(theme.hasOwnProperty(property)){this._setProps(themePrefix+property,theme[property])}}},_getLightTheme:function _getLightTheme(hexCodes){this._setThemeProps("--simple-colors-",hexCodes);this._setThemeProps("--simple-colors-light-theme-",hexCodes);return hexCodes},_getDarkTheme:function _getDarkTheme(hexCodes){var dark={};for(var property in hexCodes){if(hexCodes.hasOwnProperty(property)){dark[property]=hexCodes[property].slice().reverse()}}this._setThemeProps("--simple-colors-dark-theme-",dark);return dark},getContrasts:function getContrasts(theme,isColor,isForeground,level,isSmallText){isSmallText=isSmallText!==void 0?isSmallText:!0;var results=[],data=isColor?this.__wcagaa.colors:this.__wcagaa.greys,levels=data.small[level-1];if(!isSmallText)levels=data.large[level-1];for(var i=0;i<levels;i++){var suffix=isForeground?"-background":"-foreground",index=isForeground&&"light"===theme||!isForeground&&"dark"===theme?i+1:levels-(i-1);if(!isColor){for(var property in this.__hexCodes){if("colorLevels"!==property){var _color="grey"===property?"":"-"+property.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();results.push({variable:"--simple-colors-"+theme+"-theme"+_color+suffix+(i+1),hexCode:this.__hexCodes[property][index]})}}}else{results.push({variable:"--simple-colors-"+theme+"-theme"+color+suffix+(i+1),hexCode:this.__hexCodes[property][index]})}}return results}}});
define(["./node_modules/@polymer/polymer/polymer-legacy.js","./lib/simple-colors-utility.js"],function(_polymerLegacy,_simpleColorsUtility){"use strict";window.simpleColorsBehaviors=window.simpleColorsBehaviors||{};window.simpleColorsBehaviors={properties:{accentColor:{type:String,value:null,reflectToAttribute:!0},dark:{type:Boolean,value:!1,reflectToAttribute:!0},__hexCodes:{type:Object,value:null},__lightTheme:{type:Object,computed:"_getLightTheme(__hexCodes)"},__darkTheme:{type:Object,computed:"_getDarkTheme(__hexCodes)"}},observers:["setTheme(accentColor,dark,__hexCodes)"],created:function created(){window.SimpleColorsUtility.requestAvailability();this.__wcagaa={greys:{small:[5,5,4,4,1],large:[5,5,5,4,2]},colors:{small:[4,3,3,1,0],large:[5,4,3,2,1]}}},ready:function ready(){this.__hexCodes=window.SimpleColorsUtility.hexCodes},setTheme:function setTheme(accentColor,dark,hexCodes){if(null!==hexCodes&&""!==hexCodes){if(null!==accentColor&&""!==accentColor){var prop=accentColor.replace(/-([a-z])/g,function(g){return g[1].toUpperCase()});if(this.__lightTheme.hasOwnProperty(prop)){this.__lightTheme.accent=this.__lightTheme[prop].slice();this.__darkTheme.accent=this.__darkTheme[prop].slice()}else{this.__lightTheme.accent=this.__hexCodes.accent.slice();this.__darkTheme.accent=this.__hexCodes.accent.slice().reverse()}}this._setThemeProps("--simple-colors-light-theme-",this.__lightTheme);this._setThemeProps("--simple-colors-dark-theme-",this.__darkTheme);if(dark){this._setThemeProps("--simple-colors-",this.__darkTheme)}else{this._setThemeProps("--simple-colors-",this.__lightTheme)}}},_setProps:function _setProps(prefix,colors){prefix=prefix.replace("-grey","").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();for(var customStyle={},i=0;i<colors.length;i++){var half=colors.length/2,suffix=i<half?"-foreground"+(i+1):"-background"+(colors.length-i);if(null!==customStyle&&null!==customStyle[prefix+suffix]){customStyle[prefix+suffix]=colors[i]}}this.updateStyles(customStyle)},_setThemeProps:function _setThemeProps(themePrefix,theme){for(var property in theme){if(theme.hasOwnProperty(property)){this._setProps(themePrefix+property,theme[property])}}},_getLightTheme:function _getLightTheme(hexCodes){var setThemeProps=function setThemeProps(themePrefix,theme){for(var property in theme){if(theme.hasOwnProperty(property)){this._setProps(themePrefix+property,theme[property])}}};this._setThemeProps("--simple-colors-",hexCodes);this._setThemeProps("--simple-colors-light-theme-",hexCodes);return hexCodes},_getDarkTheme:function _getDarkTheme(hexCodes){var dark={};for(var property in hexCodes){if(hexCodes.hasOwnProperty(property)){dark[property]=hexCodes[property].slice().reverse()}}this._setThemeProps("--simple-colors-dark-theme-",dark);return dark},getContrasts:function getContrasts(theme,isColor,isForeground,level,isSmallText){isSmallText=isSmallText!==void 0?isSmallText:!0;var results=[],data=isColor?this.__wcagaa.colors:this.__wcagaa.greys,levels=data.small[level-1];if(!isSmallText)levels=data.large[level-1];for(var i=0;i<levels;i++){var suffix=isForeground?"-background":"-foreground",index=isForeground&&"light"===theme||!isForeground&&"dark"===theme?i+1:levels-(i-1);if(!isColor){for(var property in this.__hexCodes){if("colorLevels"!==property){var _color="grey"===property?"":"-"+property.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();results.push({variable:"--simple-colors-"+theme+"-theme"+_color+suffix+(i+1),hexCode:this.__hexCodes[property][index]})}}}else{results.push({variable:"--simple-colors-"+theme+"-theme"+color+suffix+(i+1),hexCode:this.__hexCodes[property][index]})}}return results}}});

@@ -1,1 +0,1 @@

import{html,Polymer}from"./node_modules/@polymer/polymer/polymer-legacy.js";import"./lib/simple-colors-utility.js";window.simpleColorsBehaviors=window.simpleColorsBehaviors||{};window.simpleColorsBehaviors={properties:{accentColor:{type:String,value:null,reflectToAttribute:!0},dark:{type:Boolean,value:!1,reflectToAttribute:!0},__hexCodes:{type:Object,value:null},__lightTheme:{type:Object,computed:"_getLightTheme(__hexCodes)"},__darkTheme:{type:Object,computed:"_getDarkTheme(__hexCodes)"}},observers:["setTheme(accentColor,dark,__hexCodes)"],created:function(){window.SimpleColorsUtility.requestAvailability();this.__wcagaa={greys:{small:[5,5,4,4,1],large:[5,5,5,4,2]},colors:{small:[4,3,3,1,0],large:[5,4,3,2,1]}}},ready:function(){this.__hexCodes=window.SimpleColorsUtility.hexCodes},setTheme:function(accentColor,dark,hexCodes){if(null!==hexCodes&&""!==hexCodes){if(null!==accentColor&&""!==accentColor){let prop=accentColor.replace(/-([a-z])/g,function(g){return g[1].toUpperCase()});if(this.__lightTheme.hasOwnProperty(prop)){this.__lightTheme.accent=this.__lightTheme[prop].slice();this.__darkTheme.accent=this.__darkTheme[prop].slice()}else{this.__lightTheme.accent=this.__hexCodes.accent.slice();this.__darkTheme.accent=this.__hexCodes.accent.slice().reverse()}}this._setThemeProps("--simple-colors-light-theme-",this.__lightTheme);this._setThemeProps("--simple-colors-dark-theme-",this.__darkTheme);if(dark){this._setThemeProps("--simple-colors-",this.__darkTheme)}else{this._setThemeProps("--simple-colors-",this.__lightTheme)}}},_setProps:function(prefix,colors){prefix=prefix.replace("-grey","").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();var customStyle={};for(let i=0;i<colors.length;i++){let half=colors.length/2,suffix=i<half?"-foreground"+(i+1):"-background"+(colors.length-i);if(null!==customStyle[prefix+suffix]){customStyle[prefix+suffix]=colors[i]}}this.updateStyles(customStyle)},_setThemeProps:function(themePrefix,theme){for(var property in theme){if(theme.hasOwnProperty(property)){this._setProps(themePrefix+property,theme[property])}}},_getLightTheme:function(hexCodes){this._setThemeProps("--simple-colors-",hexCodes);this._setThemeProps("--simple-colors-light-theme-",hexCodes);return hexCodes},_getDarkTheme:function(hexCodes){let dark={};for(var property in hexCodes){if(hexCodes.hasOwnProperty(property)){dark[property]=hexCodes[property].slice().reverse()}}this._setThemeProps("--simple-colors-dark-theme-",dark);return dark},getContrasts:function(theme,isColor,isForeground,level,isSmallText){isSmallText=isSmallText!==void 0?isSmallText:!0;let results=[],data=isColor?this.__wcagaa.colors:this.__wcagaa.greys,levels=data.small[level-1];if(!isSmallText)levels=data.large[level-1];for(let i=0;i<levels;i++){let suffix=isForeground?"-background":"-foreground",index=isForeground&&"light"===theme||!isForeground&&"dark"===theme?i+1:levels-(i-1);if(!isColor){for(var property in this.__hexCodes){if("colorLevels"!==property){let color="grey"===property?"":"-"+property.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();results.push({variable:"--simple-colors-"+theme+"-theme"+color+suffix+(i+1),hexCode:this.__hexCodes[property][index]})}}}else{results.push({variable:"--simple-colors-"+theme+"-theme"+color+suffix+(i+1),hexCode:this.__hexCodes[property][index]})}}return results}};
import{html,Polymer}from"./node_modules/@polymer/polymer/polymer-legacy.js";import"./lib/simple-colors-utility.js";window.simpleColorsBehaviors=window.simpleColorsBehaviors||{};window.simpleColorsBehaviors={properties:{accentColor:{type:String,value:null,reflectToAttribute:!0},dark:{type:Boolean,value:!1,reflectToAttribute:!0},__hexCodes:{type:Object,value:null},__lightTheme:{type:Object,computed:"_getLightTheme(__hexCodes)"},__darkTheme:{type:Object,computed:"_getDarkTheme(__hexCodes)"}},observers:["setTheme(accentColor,dark,__hexCodes)"],created:function(){window.SimpleColorsUtility.requestAvailability();this.__wcagaa={greys:{small:[5,5,4,4,1],large:[5,5,5,4,2]},colors:{small:[4,3,3,1,0],large:[5,4,3,2,1]}}},ready:function(){this.__hexCodes=window.SimpleColorsUtility.hexCodes},setTheme:function(accentColor,dark,hexCodes){if(null!==hexCodes&&""!==hexCodes){if(null!==accentColor&&""!==accentColor){let prop=accentColor.replace(/-([a-z])/g,function(g){return g[1].toUpperCase()});if(this.__lightTheme.hasOwnProperty(prop)){this.__lightTheme.accent=this.__lightTheme[prop].slice();this.__darkTheme.accent=this.__darkTheme[prop].slice()}else{this.__lightTheme.accent=this.__hexCodes.accent.slice();this.__darkTheme.accent=this.__hexCodes.accent.slice().reverse()}}this._setThemeProps("--simple-colors-light-theme-",this.__lightTheme);this._setThemeProps("--simple-colors-dark-theme-",this.__darkTheme);if(dark){this._setThemeProps("--simple-colors-",this.__darkTheme)}else{this._setThemeProps("--simple-colors-",this.__lightTheme)}}},_setProps:function(prefix,colors){prefix=prefix.replace("-grey","").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();var customStyle={};for(let i=0;i<colors.length;i++){let half=colors.length/2,suffix=i<half?"-foreground"+(i+1):"-background"+(colors.length-i);if(null!==customStyle[prefix+suffix]){customStyle[prefix+suffix]=colors[i]}}this.updateStyles(customStyle)},_setThemeProps:function(themePrefix,theme){for(var property in theme){if(theme.hasOwnProperty(property)){this._setProps(themePrefix+property,theme[property])}}},_getLightTheme:function(hexCodes){let setThemeProps=function(themePrefix,theme){for(var property in theme){if(theme.hasOwnProperty(property)){this._setProps(themePrefix+property,theme[property])}}};this._setThemeProps("--simple-colors-",hexCodes);this._setThemeProps("--simple-colors-light-theme-",hexCodes);return hexCodes},_getDarkTheme:function(hexCodes){let dark={};for(var property in hexCodes){if(hexCodes.hasOwnProperty(property)){dark[property]=hexCodes[property].slice().reverse()}}this._setThemeProps("--simple-colors-dark-theme-",dark);return dark},getContrasts:function(theme,isColor,isForeground,level,isSmallText){isSmallText=isSmallText!==void 0?isSmallText:!0;let results=[],data=isColor?this.__wcagaa.colors:this.__wcagaa.greys,levels=data.small[level-1];if(!isSmallText)levels=data.large[level-1];for(let i=0;i<levels;i++){let suffix=isForeground?"-background":"-foreground",index=isForeground&&"light"===theme||!isForeground&&"dark"===theme?i+1:levels-(i-1);if(!isColor){for(var property in this.__hexCodes){if("colorLevels"!==property){let color="grey"===property?"":"-"+property.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();results.push({variable:"--simple-colors-"+theme+"-theme"+color+suffix+(i+1),hexCode:this.__hexCodes[property][index]})}}}else{results.push({variable:"--simple-colors-"+theme+"-theme"+color+suffix+(i+1),hexCode:this.__hexCodes[property][index]})}}return results}};

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