diff --git a/src/mm-array-munge/index.html b/src/mm-array-munge/index.html new file mode 100644 index 00000000..bd4cc32f --- /dev/null +++ b/src/mm-array-munge/index.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + diff --git a/src/mm-array-munge/mm-array-munge.html b/src/mm-array-munge/mm-array-munge.html new file mode 100644 index 00000000..fe3128ac --- /dev/null +++ b/src/mm-array-munge/mm-array-munge.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + diff --git a/src/mm-array-munge/mm-array-munge.js b/src/mm-array-munge/mm-array-munge.js new file mode 100644 index 00000000..f875e0ef --- /dev/null +++ b/src/mm-array-munge/mm-array-munge.js @@ -0,0 +1,69 @@ +/** + * @license + * Copyright (c) 2015 MediaMath Inc. All rights reserved. + * This code may only be used under the BSD style license found at http://mediamath.github.io/strand/LICENSE.txt + +*/ +(function (scope) { + + scope.ArrayMunge = Polymer({ + is: "mm-array-munge", + + behaviors: [ + StrandTraits.Resolvable, + StrandTraits.Refable + ], + + properties: { + _parsedRules:{ + type:Array, + value: function() { return []; } + }, + input:{ + type:Array, + notify:true + }, + output:{ + type:Array, + notify:true + }, + rules:{ + type:String, + value:"", + observer:"_parseRules" + } + }, + + observers:['_handleInputUpdate(input.*, _parsedRules)'], + + _handleInputUpdate() { + var o = this.input.map(function(i) { + var o = {}; + this._parsedRules.forEach(function(rule) { + var val = rule.from === '.' ? i : i[rule.from]; + if (rule.to !== '.') { + o[rule.to] = val; + } else { + o = val; + } + }) + return o; + },this); + this.set('output', o); + }, + + _parseRules: function() { + this._parsedRules = this.rules.split(",").map(function(rule) { + var parsed = rule.split("->"); + if (parsed.length === 2) { + return { + from:parsed[0], + to:parsed[1] + } + } + }, this).filter(function(o) { return !!o }); + } + + }); + +})(window.Strand = window.Strand || {}); diff --git a/src/mm-array-munge/mm-array-munge.scss b/src/mm-array-munge/mm-array-munge.scss new file mode 100644 index 00000000..ee65dcd9 --- /dev/null +++ b/src/mm-array-munge/mm-array-munge.scss @@ -0,0 +1,57 @@ +/** + * @license + * Copyright (c) 2015 MediaMath Inc. All rights reserved. + * This code may only be used under the BSD style license found at http://mediamath.github.io/strand/LICENSE.txt + +*/ +/* test.sass */ +@import "_bourbon"; +@import "_color"; +@import "_mixins"; + +:host { + color: $color-D0; + position: relative; + display: inline-block; + vertical-align: middle; + font-size: 0em; + line-height: 0em; +} + +:host([disabled]) { + pointer-events:none; + opacity: 0.5; +} + +.action { + display: inline-flex; + align-items: center; + + color: inherit; + cursor: pointer; + text-decoration: none; + + &.underline > ::content label { + text-decoration: underline; + } + + &.underline:hover > ::content label { + text-decoration: none; + } + + & > ::content label { + @include fontSmoothing(); + font-size: 13px; + line-height: 15px; + font-family: "ArimoRegular", sans-serif; + pointer-events: none; + color: inherit; + } + + & > ::content mm-icon { + pointer-events: none; + padding-right: 5px; + margin-top: -1px; + color: inherit; + } +} \ No newline at end of file