Skip to content

Commit

Permalink
Deploy build files
Browse files Browse the repository at this point in the history
  • Loading branch information
unimonkiez committed Apr 20, 2016
1 parent ebee201 commit 576450a
Show file tree
Hide file tree
Showing 8 changed files with 328 additions and 54 deletions.
70 changes: 68 additions & 2 deletions dist/emoji-panel.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,82 @@
@font-face {
font-family: 'apple-category';
src: url(data:application/x-font-ttf;base64,AAEAAAALAIAAAwAwT1MvMg8SBf8AAAC8AAAAYGNtYXAXVtKPAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZnNUBSIAAAF4AAAKrGhlYWQJhu0qAAAMJAAAADZoaGVhB7EDzgAADFwAAAAkaG10eCoAA5EAAAyAAAAANGxvY2ENAg/OAAAMtAAAABxtYXhwABUA1QAADNAAAAAgbmFtZZlKCfsAAAzwAAABhnBvc3QAAwAAAAAOeAAAACAAAwPNAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpCAPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6Qj//f//AAAAAAAg6QD//f//AAH/4xcEAAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAADAFEAEQOvA28AFAAoAHAAAAE3NiYvASYiDwEOAR8BHgE7ATI2NwMiDgIVFB4CMzI+AjU0LgIDNjQvAS4BLwEmBgcuAScyNj8BMjY1JzQmJz4BNxQWMxcWMj8CHgEXDgEVBxQWHwEeATMUBgcuASMHIgYPAQYUFw4BIy4BJwJ3OAMFB4wHEAONBgYENwMMBqsHCwN3Wp10RER0nVpanXRERHSduAMDPAMHB2oHEAMdIAMGDANJAwUMBwYgUjAKA2oECgRqDTBOI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KxS3KjQ0KsgNFgz+kRMcHBMvLxMcHBMBOx4vyRYdHRa4CRIHAwsD8yYaGiYmGhomGhcTEBsXFBMXGiYaGiYmGhomAAAAAAEAAAAAAABHg/NZXw889QALBAAAAAAA0z1UXQAAAADTPVRdAAAAAAPvA3MAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAA+8AAQAAAAAAAAAAAAAAAAAAAA0EAAAAAAAAAAAAAAACAAAABAAAUQQAAKsEAAAJBAAANwQAAN4EAABRBAAAUQQAAG8EAABmAAAAAAAKABQAHgDEARgBpgLcA44EFARsBNIFVgABAAAADQDTAAcAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABwAAAAEAAAAAAAIABwBgAAEAAAAAAAMABwA2AAEAAAAAAAQABwB1AAEAAAAAAAUACwAVAAEAAAAAAAYABwBLAAEAAAAAAAoAGgCKAAMAAQQJAAEADgAHAAMAAQQJAAIADgBnAAMAAQQJAAMADgA9AAMAAQQJAAQADgB8AAMAAQQJAAUAFgAgAAMAAQQJAAYADgBSAAMAAQQJAAoANACkaWNvbW9vbgBpAGMAbwBtAG8AbwBuVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwaWNvbW9vbgBpAGMAbwBtAG8AbwBuaWNvbW9vbgBpAGMAbwBtAG8AbwBuUmVndWxhcgBSAGUAZwB1AGwAYQByaWNvbW9vbgBpAGMAbwBtAG8AbwBuRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype");
font-weight: normal;
font-style: normal; }

.cat {
font-family: 'apple-category' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; }

.cat-0:before {
content: "\E900"; }

.cat-1:before {
content: "\E901"; }

.cat-2:before {
content: "\E902"; }

.cat-4:before {
content: "\E903"; }

.cat-8:before {
content: "\E904"; }

.cat-16:before {
content: "\E905"; }

.cat-128:before {
content: "\E906"; }

.cat-64:before {
content: "\E907"; }

.cat-32:before {
content: "\E908"; }

.ep {
height: 100%; }

.ep-container {
height: 100%; }

.ep-categories {
height: 20px; }
height: 40px;
display: flex; }

.ep-c {
cursor: pointer;
flex: 1 1;
text-align: center;
font-size: 32px;
color: silver;
opacity: 1; }
.ep-c:hover {
opacity: 0.8; }
.ep-c > * {
vertical-align: middle; }

.ep-c-text {
display: none; }

.ep-emojies {
height: calc(100% - 20px);
position: relative;
height: calc(100% - 40px);
overflow-y: auto; }

.ep-emojies-c:last-child {
position: absolute;
min-height: 100%; }

.ep-e {
display: inline-block;
margin: 6px;
Expand Down
81 changes: 75 additions & 6 deletions dist/emoji-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
var imageSet = _ref$imageSet === undefined ? _constant.IMAGE_SET.APPLE : _ref$imageSet;
var _ref$size = _ref.size;
var size = _ref$size === undefined ? _constant.SIZE['64'] : _ref$size;
var _ref$animationDuratio = _ref.animationDuration;
var animationDuration = _ref$animationDuratio === undefined ? 300 : _ref$animationDuratio;

_classCallCheck(this, EmojiPanel);

Expand All @@ -88,7 +90,7 @@
throw new Error('`imageSet` should have one of `EmojiPanel.IMAGE_SET` values, got ${imageSet}.');
}
}
var windowImageSet = (0, _createPanel2.default)({ imageSet: imageSet, size: size });
var windowImageSet = (0, _createPanel2.default)({ imageSet: imageSet, size: size, animationDuration: animationDuration });
el.innerHTML = '';
el.appendChild(windowImageSet);

Expand Down Expand Up @@ -164,12 +166,13 @@

var imageSet = _ref.imageSet;
var size = _ref.size;
var animationDuration = _ref.animationDuration;

var panelEl = document.createElement('div');
panelEl.setAttribute('class', 'ep-container');
var panelTemplate = (0, _getPanelTemplate2.default)({ imageSet: imageSet, size: size });
panelEl.innerHTML = panelTemplate;
(0, _setEventsForTemplate2.default)(panelEl);
(0, _setEventsForTemplate2.default)(panelEl, { animationDuration: animationDuration });

return panelEl;
};
Expand Down Expand Up @@ -273,9 +276,9 @@
var sizeNumber = Number(getSizeKeyByValue(size));

return '\n <div class="ep">\n <div class="ep-categories">\n ' + _categoryOrder2.default.map(function (category) {
return '\n <span class="ep-category" data-category-id=' + category + '>\n ' + _map.categoryNameMap[category] + '\n </span>\n ';
return '\n <span class="ep-c" data-category-id=' + category + '>\n <span class="cat cat-' + category + '"></span>\n <span class="ep-c-text">' + _map.categoryNameMap[category] + '</span>\n </span>\n ';
}).join('') + '\n </div>\n <div class="ep-emojies">\n ' + _categoryOrder2.default.map(function (category) {
return '\n <div data-category-id=' + category + '>\n <div>\n ' + sortedEmojiData[category].map(function (emoji) {
return '\n <div class="ep-emojies-c" data-category-id=' + category + '>\n <div>\n ' + sortedEmojiData[category].map(function (emoji) {
return '\n <span class="ep-e ' + emojiClassName + '" style="background-position: -' + emoji.sheet_x * sizeNumber + 'px -' + emoji.sheet_y * sizeNumber + 'px">\n </span>\n ';
}).join('') + '\n </div>\n </div>\n ';
}).join('') + '\n </div>\n </div>\n ';
Expand Down Expand Up @@ -35196,10 +35199,76 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
var getIsElementScrollable = function getIsElementScrollable(el) {
return el.clientHeight !== el.scrollHeight;
};

var round = function round(num) {
return (num * 2).toFixed() / 2;
};

var scrollElementTo = function scrollElementTo(el, done) {
var newScrollHeight = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
var scrollDuration = arguments.length <= 3 || arguments[3] === undefined ? 300 : arguments[3];

var scrollHeight = el.scrollTop;
var scrollDiff = scrollHeight - newScrollHeight;
var scrollStep = Math.PI / (scrollDuration / 15);
var cosParameter = scrollDiff / 2;
var scrollCount = 0;
var scrollMargin = void 0;

var step = function step() {
setTimeout(function () {
if (el.scrollTop !== newScrollHeight) {
requestAnimationFrame(step);
scrollCount = scrollCount + 1;
scrollMargin = round(cosParameter - cosParameter * Math.cos(scrollCount * scrollStep));
el.scrollTo(0, scrollHeight - scrollMargin);
} else {
done();
}
}, 15);
};

requestAnimationFrame(step);
};

exports.default = function (el) {
var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

var animationDuration = _ref.animationDuration;

var isMidScrollAnimation = false;

exports.default = function (el, callback) {
var categoriesEl = el.querySelector('.ep-categories');
categoriesEl.addEventListener('click', function (e) {});
var emojiesContainer = el.querySelector('.ep-emojies');
categoriesEl.addEventListener('click', function (e) {
if (isMidScrollAnimation === false) {
(function () {
var target = e.target;
if (['cat', 'ep-c-text'].map(function (className) {
return target.classList.contains(className);
}).some(function (v) {
return v === true;
})) {
target = target.parentElement;
}
if (target.classList.contains('ep-c')) {
var isElementScrollable = getIsElementScrollable(emojiesContainer);
if (isElementScrollable) {
var categoryId = target.dataset.categoryId;
var categoryEl = emojiesContainer.querySelector('[data-category-id="' + categoryId + '"]');
var categoryHeight = categoryEl.offsetTop;
isMidScrollAnimation = true;
scrollElementTo(emojiesContainer, function () {
isMidScrollAnimation = false;
}, categoryHeight, animationDuration);
}
}
})();
}
});
};

/***/ },
Expand Down
Loading

0 comments on commit 576450a

Please sign in to comment.