UNPKG

3.17 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const path_1 = require("path");
4const buster = require.main.require('./src/meta').config['cache-buster'];
5const nconf = require.main.require('nconf');
6const url = nconf.get('url');
7function images(pack) {
8 return `.emoji-${pack.id} {` +
9 'display: inline-block;' +
10 'height: 23px;' +
11 'margin-top: -1px;' +
12 'margin-bottom: -1px;' +
13 '}';
14}
15exports.images = images;
16function sprite(pack) {
17 const classes = Object.keys(pack.dictionary).map((name) => {
18 return `.emoji-${pack.id}.emoji--${name} {` +
19 `background-position: ${pack.dictionary[name].backgroundPosition};` +
20 '}';
21 });
22 const route = `${url}/plugins/nodebb-plugin-emoji/emoji/${pack.id}`;
23 return `.emoji-${pack.id} {` +
24 `background-image: url(${route}/${path_1.basename(pack.sprite.file)}?${buster});` +
25 `background-size: ${pack.sprite.backgroundSize};` +
26 'background-repeat: no-repeat;' +
27 'display: inline-block;' +
28 'height: 23px;' +
29 'width: 23px;' +
30 'overflow: hidden;' +
31 'font-size: 23px;' +
32 'line-height: 23px;' +
33 'text-align: center;' +
34 'vertical-align: bottom;' +
35 'color: transparent;' +
36 'margin-top: -1px;' +
37 'margin-bottom: -1px;' +
38 '}' +
39 `.emoji-link .emoji-${pack.id} {` +
40 'transform: scale(1.304347826086957);' +
41 'position: relative;' +
42 'bottom: -3.5px;' +
43 'height: 23px;' +
44 'width: 23px;' +
45 'font-size: 23px;' +
46 'line-height: 23px;' +
47 '}' + classes.join('');
48}
49exports.sprite = sprite;
50function font(pack) {
51 const route = `${url}/plugins/nodebb-plugin-emoji/emoji/${pack.id}`;
52 return '@font-face {' +
53 `font-family: '${pack.font.family}';` +
54 (pack.font.eot ? `src: url(${route}/${path_1.basename(pack.font.eot)});` : '') +
55 'src: ' + [
56 pack.font.eot &&
57 `url(${route}/${path_1.basename(pack.font.eot)}?#iefix) format('embedded-opentype')`,
58 pack.font.woff2 &&
59 `url(${route}/${path_1.basename(pack.font.woff2)}) format('woff2')`,
60 pack.font.woff &&
61 `url(${route}/${path_1.basename(pack.font.woff)}) format('woff')`,
62 pack.font.ttf &&
63 `url(${route}/${path_1.basename(pack.font.ttf)}) format('truetype')`,
64 pack.font.svg &&
65 `url(${route}/${path_1.basename(pack.font.svg)}) format('svg')`,
66 ].filter(Boolean).join(', ') + ';' +
67 '}' +
68 `.emoji-${pack.id} {` +
69 `font-family: '${pack.font.family}';` +
70 'font-style: normal;' +
71 'display: inline-block;' +
72 'height: 23px;' +
73 'width: 23px;' +
74 'overflow: hidden;' +
75 'font-size: 23px;' +
76 'line-height: 23px;' +
77 'text-align: center;' +
78 'vertical-align: bottom;' +
79 'margin-top: -1px;' +
80 'margin-bottom: -1px;' +
81 '}';
82}
83exports.font = font;
84//# sourceMappingURL=css-builders.js.map
\No newline at end of file