From e58fffd2ef4d7442293b4d2dfabf4f83530e99d0 Mon Sep 17 00:00:00 2001 From: adinvadim Date: Thu, 25 Feb 2016 01:14:10 +0300 Subject: [PATCH 1/3] ya-share2, move yashare, bem-contrib --- bower.json | 6 ++--- common.blocks/ya-share2/ya-share2.bemhtml | 19 ++++++++++++++ common.blocks/ya-share2/ya-share2.bh.js | 19 ++++++++++++++ common.blocks/ya-share2/ya-share2.browser.js | 16 ++++++++++++ .../yashare/yashare.bemhtml | 0 .../yashare/yashare.browser.js | 0 .../yashare/yashare.deps.js | 0 .../yashare.tmpl-specs/01-plain.bemjson.js | 0 .../yashare/yashare.tmpl-specs/01-plain.html | 0 desktop.blocks/.gitkeeper | 0 desktop.blocks/yashare/yashare.bh.js | 13 ---------- desktop.bundles/index/index.bemjson.js | 26 ++++++++++++++++++- package.json | 11 ++++---- 13 files changed, 88 insertions(+), 22 deletions(-) create mode 100644 common.blocks/ya-share2/ya-share2.bemhtml create mode 100644 common.blocks/ya-share2/ya-share2.bh.js create mode 100644 common.blocks/ya-share2/ya-share2.browser.js rename {desktop.blocks => common.blocks}/yashare/yashare.bemhtml (100%) rename {desktop.blocks => common.blocks}/yashare/yashare.browser.js (100%) rename {desktop.blocks => common.blocks}/yashare/yashare.deps.js (100%) rename {desktop.blocks => common.blocks}/yashare/yashare.tmpl-specs/01-plain.bemjson.js (100%) rename {desktop.blocks => common.blocks}/yashare/yashare.tmpl-specs/01-plain.html (100%) create mode 100644 desktop.blocks/.gitkeeper delete mode 100644 desktop.blocks/yashare/yashare.bh.js diff --git a/bower.json b/bower.json index afccf5d..e79ae47 100644 --- a/bower.json +++ b/bower.json @@ -1,10 +1,10 @@ { "name": "bem-social", - "version": "0.3.1", + "version": "0.3.2", "description": "BEM Social Components Library", "repository": { "type": "git", - "url": "git://github.com/bem-incubator/bem-social" + "url": "git://github.com/bem-contrib/bem-social" }, "keywords": [ "bem", @@ -24,7 +24,7 @@ "Ivan Voischev " ], "dependencies": { - "bem-components": "2.3.0" + "bem-components": "^2.3.0" }, "license": "MIT" } diff --git a/common.blocks/ya-share2/ya-share2.bemhtml b/common.blocks/ya-share2/ya-share2.bemhtml new file mode 100644 index 0000000..021275f --- /dev/null +++ b/common.blocks/ya-share2/ya-share2.bemhtml @@ -0,0 +1,19 @@ +block('ya-share2')( + js()(true), + attrs()(function() { + var ctx = this.ctx, + attrs = { + 'data-services' : (ctx.services || []).join(','), + 'data-counter' : ctx.counter, + 'data-copy' : ctx.copy, + 'data-description' : ctx.description, + 'data-image' : ctx.image, + 'data-lang' : ctx.lang || 'ru', + 'data-limit' : ctx.limit, + 'data-size' : ctx.size, + 'data-title' : ctx.title, + 'data-url' : ctx.url + }; + return attrs; + }) +); diff --git a/common.blocks/ya-share2/ya-share2.bh.js b/common.blocks/ya-share2/ya-share2.bh.js new file mode 100644 index 0000000..c7db6d4 --- /dev/null +++ b/common.blocks/ya-share2/ya-share2.bh.js @@ -0,0 +1,19 @@ +module.exports = function(bh) { + + bh.match('ya-share2', function(ctx, json) { + ctx.js(true); + ctx.attrs({ + 'data-services' : (json.services || []).join(','), + 'data-counter' : json.counter, + 'data-copy' : json.copy, + 'data-description' : json.description, + 'data-image' : json.image, + 'data-lang' : json.lang || 'ru', + 'data-limit' : json.limit, + 'data-size' : json.size, + 'data-title' : json.title, + 'data-url' : json.url + }); + }); + +}; diff --git a/common.blocks/ya-share2/ya-share2.browser.js b/common.blocks/ya-share2/ya-share2.browser.js new file mode 100644 index 0000000..1bcc0ed --- /dev/null +++ b/common.blocks/ya-share2/ya-share2.browser.js @@ -0,0 +1,16 @@ +modules.define( + 'ya-share2', + ['i-bem__dom', 'loader_type_js'], + function(provide, BEMDOM, Loader) { + + provide(BEMDOM.decl('ya-share2', { + onSetMod : { + js : { + inited : function() { + Loader('https://yastatic.net/share2/share.js'); + } + } + } + })); + +}); diff --git a/desktop.blocks/yashare/yashare.bemhtml b/common.blocks/yashare/yashare.bemhtml similarity index 100% rename from desktop.blocks/yashare/yashare.bemhtml rename to common.blocks/yashare/yashare.bemhtml diff --git a/desktop.blocks/yashare/yashare.browser.js b/common.blocks/yashare/yashare.browser.js similarity index 100% rename from desktop.blocks/yashare/yashare.browser.js rename to common.blocks/yashare/yashare.browser.js diff --git a/desktop.blocks/yashare/yashare.deps.js b/common.blocks/yashare/yashare.deps.js similarity index 100% rename from desktop.blocks/yashare/yashare.deps.js rename to common.blocks/yashare/yashare.deps.js diff --git a/desktop.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js b/common.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js similarity index 100% rename from desktop.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js rename to common.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js diff --git a/desktop.blocks/yashare/yashare.tmpl-specs/01-plain.html b/common.blocks/yashare/yashare.tmpl-specs/01-plain.html similarity index 100% rename from desktop.blocks/yashare/yashare.tmpl-specs/01-plain.html rename to common.blocks/yashare/yashare.tmpl-specs/01-plain.html diff --git a/desktop.blocks/.gitkeeper b/desktop.blocks/.gitkeeper new file mode 100644 index 0000000..e69de29 diff --git a/desktop.blocks/yashare/yashare.bh.js b/desktop.blocks/yashare/yashare.bh.js deleted file mode 100644 index 9fe0644..0000000 --- a/desktop.blocks/yashare/yashare.bh.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function(bh) { - - bh.match('yashare', function(ctx, json) { - ctx.js(true); - ctx.cls('yashare-auto-init'); - ctx.attrs({ - 'data-yashareQuickServices' : (json.quickServices || []).join(','), - 'data-yashareTheme' : json.theme || 'counter', - 'data-yashareL10n' : json.l10n || 'ru' - }); - }); - -}; diff --git a/desktop.bundles/index/index.bemjson.js b/desktop.bundles/index/index.bemjson.js index e73e603..1f7f2f1 100644 --- a/desktop.bundles/index/index.bemjson.js +++ b/desktop.bundles/index/index.bemjson.js @@ -432,7 +432,31 @@ 'master/desktop.bundles/index/blocks/page/image/bem.png' } ] - } + }, + { + tag : 'br' + }, + { + tag : 'h3', + content : 'API Yandex.Share2' + }, + { + block : 'ya-share2', + services : [ + 'vkontakte', + 'facebook', + 'twitter', + 'odnoklassniki', + 'moimir', + 'gplus' + ], + url : 'http://bem-incubator.github.io/bem-social/', + title : 'BEM Social Components Library', + description : 'Fork me on GitHub', + image : 'https://raw.githubusercontent.com/voischev/bem-social/' + + 'master/desktop.bundles/index/blocks/page/image/bem.png' + }, + ] }, { diff --git a/package.json b/package.json index 2a36cb4..d441dc8 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "BEM Social Components Library", "repository": { "type": "git", - "url": "https://github.com/bem-incubator/bem-social" + "url": "https://github.com/bem-contrib/bem-social" }, "keywords": [ "bem", @@ -18,9 +18,11 @@ "bem-environ": "^1.4.0" }, "devDependencies": { + "bh": "^3.3.0", "borschik": "^1.4.1", "borschik-tech-cleancss": "^2.0.1", "bower": "^1.3.12", + "csscomb": "~2.0.5", "enb": "^0.17.2", "enb-autoprefixer": "^0.3.0", "enb-bem-techs": "^2.0.0", @@ -29,16 +31,15 @@ "enb-bh": "^0.5.0", "enb-borschik": "^2.0.0", "enb-diverse-js": "^0.1.0", + "enb-magic-factory": "^0.5.0", "enb-magic-platform": "^0.5.0", "enb-modules": "^0.2.0", "enb-stylus": "^2.0.0", - "bh": "^3.3.0", - "ym": "^0.1.0", - "csscomb": "~2.0.5", "git-hooks": "0.0.7", "jscs": "1.5.3", "jshint": "2.3.0", - "jshint-groups": "0.6.0" + "jshint-groups": "0.6.0", + "ym": "^0.1.0" }, "scripts": { "start": "magic server", From 73b360d6bf0e611cf466e276c092b55acdad7907 Mon Sep 17 00:00:00 2001 From: adinvadim Date: Thu, 25 Feb 2016 14:01:03 +0300 Subject: [PATCH 2/3] Remove ya-share2, update yashare --- common.blocks/ya-share2/ya-share2.bemhtml | 19 ------- common.blocks/ya-share2/ya-share2.browser.js | 16 ------ common.blocks/yashare/yashare.bemhtml | 24 ++++++--- .../ya-share2.bh.js => yashare/yashare.bh.js} | 7 +-- common.blocks/yashare/yashare.browser.js | 2 +- .../yashare.tmpl-specs/01-plain.bemjson.js | 4 +- .../yashare/yashare.tmpl-specs/01-plain.html | 4 +- desktop.bundles/index/index.bemjson.js | 53 +++++-------------- 8 files changed, 36 insertions(+), 93 deletions(-) delete mode 100644 common.blocks/ya-share2/ya-share2.bemhtml delete mode 100644 common.blocks/ya-share2/ya-share2.browser.js rename common.blocks/{ya-share2/ya-share2.bh.js => yashare/yashare.bh.js} (67%) diff --git a/common.blocks/ya-share2/ya-share2.bemhtml b/common.blocks/ya-share2/ya-share2.bemhtml deleted file mode 100644 index 021275f..0000000 --- a/common.blocks/ya-share2/ya-share2.bemhtml +++ /dev/null @@ -1,19 +0,0 @@ -block('ya-share2')( - js()(true), - attrs()(function() { - var ctx = this.ctx, - attrs = { - 'data-services' : (ctx.services || []).join(','), - 'data-counter' : ctx.counter, - 'data-copy' : ctx.copy, - 'data-description' : ctx.description, - 'data-image' : ctx.image, - 'data-lang' : ctx.lang || 'ru', - 'data-limit' : ctx.limit, - 'data-size' : ctx.size, - 'data-title' : ctx.title, - 'data-url' : ctx.url - }; - return attrs; - }) -); diff --git a/common.blocks/ya-share2/ya-share2.browser.js b/common.blocks/ya-share2/ya-share2.browser.js deleted file mode 100644 index 1bcc0ed..0000000 --- a/common.blocks/ya-share2/ya-share2.browser.js +++ /dev/null @@ -1,16 +0,0 @@ -modules.define( - 'ya-share2', - ['i-bem__dom', 'loader_type_js'], - function(provide, BEMDOM, Loader) { - - provide(BEMDOM.decl('ya-share2', { - onSetMod : { - js : { - inited : function() { - Loader('https://yastatic.net/share2/share.js'); - } - } - } - })); - -}); diff --git a/common.blocks/yashare/yashare.bemhtml b/common.blocks/yashare/yashare.bemhtml index 80a50eb..03afc4f 100644 --- a/common.blocks/yashare/yashare.bemhtml +++ b/common.blocks/yashare/yashare.bemhtml @@ -1,12 +1,20 @@ block('yashare')( js()(true), - cls()('yashare-auto-init'), + cls()('ya-share2'), attrs()(function() { - var ctx = this.ctx; - return { - 'data-yashareQuickServices' : (ctx.quickServices || []).join(','), - 'data-yashareTheme' : ctx.theme || 'counter', - 'data-yashareL10n' : ctx.l10n || 'ru' - }; - }) + var ctx = this.ctx, + attrs = { + 'data-services' : (ctx.services || ctx.quickServices || []).join(','), + 'data-counter' : ctx.counter, + 'data-copy' : ctx.copy, + 'data-description' : ctx.description, + 'data-image' : ctx.image, + 'data-lang' : ctx.lang, + 'data-limit' : ctx.limit, + 'data-size' : ctx.size, + 'data-title' : ctx.title, + 'data-url' : ctx.url + }; + return attrs; + }) ); diff --git a/common.blocks/ya-share2/ya-share2.bh.js b/common.blocks/yashare/yashare.bh.js similarity index 67% rename from common.blocks/ya-share2/ya-share2.bh.js rename to common.blocks/yashare/yashare.bh.js index c7db6d4..3c2e082 100644 --- a/common.blocks/ya-share2/ya-share2.bh.js +++ b/common.blocks/yashare/yashare.bh.js @@ -1,14 +1,15 @@ module.exports = function(bh) { - bh.match('ya-share2', function(ctx, json) { + bh.match('yashare', function(ctx, json) { ctx.js(true); + ctx.cls('ya-share2'); ctx.attrs({ - 'data-services' : (json.services || []).join(','), + 'data-services' : (json.services || json.quickServices || []).join(','), 'data-counter' : json.counter, 'data-copy' : json.copy, 'data-description' : json.description, 'data-image' : json.image, - 'data-lang' : json.lang || 'ru', + 'data-lang' : json.lang, 'data-limit' : json.limit, 'data-size' : json.size, 'data-title' : json.title, diff --git a/common.blocks/yashare/yashare.browser.js b/common.blocks/yashare/yashare.browser.js index 16c5278..2540021 100644 --- a/common.blocks/yashare/yashare.browser.js +++ b/common.blocks/yashare/yashare.browser.js @@ -6,7 +6,7 @@ modules.define( onSetMod : { js : { inited : function() { - Loader('//yandex.st/share/share.js'); + Loader('https://yastatic.net/share2/share.js'); } } } diff --git a/common.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js b/common.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js index 1318c80..94f10be 100644 --- a/common.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js +++ b/common.blocks/yashare/yashare.tmpl-specs/01-plain.bemjson.js @@ -2,7 +2,5 @@ block : 'yashare' }, { block : 'yashare', - quickServices : ['a,b,c'], - theme : 'yoloswag', - l10n : 'en' + services : ['a,b,c'], }] diff --git a/common.blocks/yashare/yashare.tmpl-specs/01-plain.html b/common.blocks/yashare/yashare.tmpl-specs/01-plain.html index b6bfcf9..a45412f 100644 --- a/common.blocks/yashare/yashare.tmpl-specs/01-plain.html +++ b/common.blocks/yashare/yashare.tmpl-specs/01-plain.html @@ -1,2 +1,2 @@ -
-
+
+
diff --git a/desktop.bundles/index/index.bemjson.js b/desktop.bundles/index/index.bemjson.js index 1f7f2f1..2502ad7 100644 --- a/desktop.bundles/index/index.bemjson.js +++ b/desktop.bundles/index/index.bemjson.js @@ -378,13 +378,12 @@ 'moimir', 'gplus' ], - theme : 'counter', - l10n : 'ru', url : 'http://bem-incubator.github.io/bem-social/', title : 'BEM Social Components Library', description : 'Fork me on GitHub', image : 'https://raw.githubusercontent.com/voischev/bem-social/' + - 'master/desktop.bundles/index/blocks/page/image/bem.png' + 'master/desktop.bundles/index/blocks/page/image/bem.png', + counter : true }, { tag : 'br' @@ -401,62 +400,34 @@ 'friendfeed', 'gplus' ], - theme : 'default', - l10n : 'ru', url : 'http://bem-incubator.github.io/bem-social/', title : 'BEM Social Components Library', description : 'Fork me on GitHub', image : 'https://raw.githubusercontent.com/voischev/bem-social/' + - 'master/desktop.bundles/index/blocks/page/image/bem.png' - }, - { - tag : 'br' - }, - { - attrs : { style : 'background: #212121' }, - content : [ - { - block : 'yashare', - quickServices : [ - 'vkontakte', - 'facebook', - 'twitter', - 'odnoklassniki', - 'lj' - ], - theme : 'dark', - url : 'http://bem-incubator.github.io/bem-social/', - title : 'BEM Social Components Library', - description : 'Fork me on GitHub', - image : 'https://raw.githubusercontent.com/voischev/bem-social/' + - 'master/desktop.bundles/index/blocks/page/image/bem.png' - } - ] + 'master/desktop.bundles/index/blocks/page/image/bem.png', + limit : 4, + copy : 'last' + }, { tag : 'br' }, { - tag : 'h3', - content : 'API Yandex.Share2' - }, - { - block : 'ya-share2', - services : [ + block : 'yashare', + quickServices : [ 'vkontakte', 'facebook', 'twitter', 'odnoklassniki', - 'moimir', - 'gplus' + 'lj' ], url : 'http://bem-incubator.github.io/bem-social/', title : 'BEM Social Components Library', description : 'Fork me on GitHub', image : 'https://raw.githubusercontent.com/voischev/bem-social/' + - 'master/desktop.bundles/index/blocks/page/image/bem.png' - }, - + 'master/desktop.bundles/index/blocks/page/image/bem.png', + size : 's' + } ] }, { From b6b2d9388879d1a894a3c6c510f10d133511ad9d Mon Sep 17 00:00:00 2001 From: adinvadim Date: Tue, 22 Mar 2016 21:59:05 +0300 Subject: [PATCH 3/3] Remove old field selector, add data-bare --- common.blocks/yashare/yashare.bemhtml | 29 ++++++++++++++------------- common.blocks/yashare/yashare.bh.js | 5 +++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/common.blocks/yashare/yashare.bemhtml b/common.blocks/yashare/yashare.bemhtml index 03afc4f..3ad45e3 100644 --- a/common.blocks/yashare/yashare.bemhtml +++ b/common.blocks/yashare/yashare.bemhtml @@ -2,19 +2,20 @@ block('yashare')( js()(true), cls()('ya-share2'), attrs()(function() { - var ctx = this.ctx, - attrs = { - 'data-services' : (ctx.services || ctx.quickServices || []).join(','), - 'data-counter' : ctx.counter, - 'data-copy' : ctx.copy, - 'data-description' : ctx.description, - 'data-image' : ctx.image, - 'data-lang' : ctx.lang, - 'data-limit' : ctx.limit, - 'data-size' : ctx.size, - 'data-title' : ctx.title, - 'data-url' : ctx.url - }; - return attrs; + var ctx = this.ctx, + attrs = { + 'data-bare' : ctx.bare, + 'data-counter' : ctx.counter, + 'data-copy' : ctx.copy, + 'data-description' : ctx.description, + 'data-image' : ctx.image, + 'data-lang' : ctx.lang, + 'data-limit' : ctx.limit, + 'data-services' : (ctx.services || []).join(','), + 'data-size' : ctx.size, + 'data-title' : ctx.title, + 'data-url' : ctx.url, + }; + return attrs; }) ); diff --git a/common.blocks/yashare/yashare.bh.js b/common.blocks/yashare/yashare.bh.js index 3c2e082..dc95c88 100644 --- a/common.blocks/yashare/yashare.bh.js +++ b/common.blocks/yashare/yashare.bh.js @@ -4,16 +4,17 @@ module.exports = function(bh) { ctx.js(true); ctx.cls('ya-share2'); ctx.attrs({ - 'data-services' : (json.services || json.quickServices || []).join(','), + 'data-bare' : json.bare, 'data-counter' : json.counter, 'data-copy' : json.copy, 'data-description' : json.description, 'data-image' : json.image, 'data-lang' : json.lang, 'data-limit' : json.limit, + 'data-services' : (json.services || []).join(','), 'data-size' : json.size, 'data-title' : json.title, - 'data-url' : json.url + 'data-url' : json.url, }); });