Skip to content

Commit

Permalink
⬆️ 7.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kobezzza committed Sep 19, 2018
1 parent 49dfef0 commit 04ed629
Show file tree
Hide file tree
Showing 8 changed files with 426 additions and 262 deletions.
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -2,7 +2,7 @@
"name": "snakeskin",
"description": "Awesome JavaScript template engine.",
"main": "dist/snakeskin.min.js",
"version": "7.4.1",
"version": "7.5.0",
"homepage": "https://github.com/SnakeskinTpl/Snakeskin",
"license": "MIT",
"authors": [
Expand Down
139 changes: 121 additions & 18 deletions dist/snakeskin.js

Large diffs are not rendered by default.

70 changes: 64 additions & 6 deletions dist/snakeskin.live.js
@@ -1,11 +1,11 @@
/*!
* Snakeskin v7.4.1 (live)
* Snakeskin v7.5.0 (live)
* https://github.com/SnakeskinTpl/Snakeskin
*
* Released under the MIT license
* https://github.com/SnakeskinTpl/Snakeskin/blob/master/LICENSE
*
* Date: 'Thu, 14 Jun 2018 15:32:23 GMT
* Date: 'Wed, 19 Sep 2018 11:00:58 GMT
*/

(function (global, factory) {
Expand All @@ -16,7 +16,7 @@

var Snakeskin = void 0;
var Snakeskin$1 = Snakeskin = {
VERSION: [7, 4, 1]
VERSION: [7, 5, 0]
};

/**
Expand All @@ -41,7 +41,28 @@ Snakeskin.Filters = {};
* The namespace for super-global variables
* @const
*/
Snakeskin.Vars = {};
Snakeskin.Vars = {
/**
* Decorator for template overriding
*
* @param {string} name
* @return {!Function}
*/
override: function override(name) {
return function (fn, ctx) {
return ctx[name] = fn;
};
},


/**
* Decorator for template ignoring
* @param {!Function} fn
*/
ignore: function ignore(fn) {
fn.ignore = true;
}
};

/**
* The namespace for local variables
Expand Down Expand Up @@ -453,11 +474,12 @@ Snakeskin$1.forIn = function (obj, callback) {
*
* @param {!Array<!Function>} decorators - array of decorator functions
* @param {!Function} fn - source function
* @param {!Object} nms - source namespace
* @return {!Function}
*/
Snakeskin$1.decorate = function (decorators, fn) {
Snakeskin$1.decorate = function (decorators, nms, fn) {
Snakeskin$1.forEach(decorators, function (decorator) {
return fn = decorator(fn) || fn;
return fn = decorator(fn, nms) || fn;
});
fn.decorators = decorators;
return fn;
Expand Down Expand Up @@ -1482,6 +1504,42 @@ Snakeskin$1.setFilterParams('attr', {
}
});

/**
* Returns a valid template name for overriding
*
* @param {string} name - base name
* @param {!Object} store - link to a store object
* @param {string} scope - scope string
* @param {boolean} init - true, if a template already defined
* @return {string}
*/
Filters['super'] = function (name, store, scope, init) {
var cache = store.templates = store.templates || {},
nm = scope + name;

cache[nm] = cache[nm] || [name];

if (init) {
return cache[nm].slice(-2)[0] || name;
}

name = name + Math.random().toString().slice(2);
cache[nm].push(name);

return name;
};

Snakeskin$1.setFilterParams('super', {
'!html': true,
bind: [function (o) {
return o.getVar('__STORE__');
}, function (o) {
return JSON.stringify(o.scope[0]);
}, function (o) {
return Boolean(o.vars[o.tplName]);
}]
});

return Snakeskin$1;

})));
44 changes: 22 additions & 22 deletions dist/snakeskin.live.min.js

Large diffs are not rendered by default.

427 changes: 215 additions & 212 deletions dist/snakeskin.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -3,7 +3,7 @@
"description": "Awesome JavaScript template engine.",
"homepage": "https://github.com/SnakeskinTpl/Snakeskin",
"main": "snakeskin.js",
"version": "7.4.1",
"version": "7.5.0",
"license": "MIT",
"author": {
"name": "kobezzza",
Expand Down
2 changes: 1 addition & 1 deletion src/core.js
Expand Up @@ -10,7 +10,7 @@

let Snakeskin;
export default Snakeskin = {
VERSION: [7, 4, 1]
VERSION: [7, 5, 0]
};

/**
Expand Down

0 comments on commit 04ed629

Please sign in to comment.