diff --git a/build/knockout-amd-helpers.js b/build/knockout-amd-helpers.js index c3a399f..4d537d8 100644 --- a/build/knockout-amd-helpers.js +++ b/build/knockout-amd-helpers.js @@ -1,4 +1,4 @@ -// knockout-amd-helpers 1.0.0 | (c) 2020 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license +// knockout-amd-helpers 1.1.0 | (c) 2020 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license define(["knockout", "require"], function(ko, require) { //helper functions to support the binding and template engine (whole lib is wrapped in an IIFE) diff --git a/build/knockout-amd-helpers.min.js b/build/knockout-amd-helpers.min.js index 6aa173c..80e2a95 100644 --- a/build/knockout-amd-helpers.min.js +++ b/build/knockout-amd-helpers.min.js @@ -1,2 +1,2 @@ -// knockout-amd-helpers 1.0.0 | (c) 2020 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license +// knockout-amd-helpers 1.1.0 | (c) 2020 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license define(["knockout","require"],function(a,b){function c(c,d){b([f(a.bindingHandlers.module.baseDir)+c],d)}var d=a.utils.unwrapObservable,e=function(a,b){var c,d=function(){return a.apply(this,b||[])};return d.prototype=a.prototype,c=new d,c.constructor=a,c},f=function(a){return a&&a.replace(/\/?$/,"/")},g=function(b){for(var c=a.virtualElements.firstChild(b);c;){if(1===c.nodeType||8===c.nodeType)return!0;c=a.virtualElements.nextSibling(c)}return!1};a.bindingHandlers.module={init:function(b,f,h,i,j){var k,l,m,n=d(f()),o={},p=a.bindingHandlers.module.initializer,q=a.bindingHandlers.module.disposeMethod;return o.templateEngine=n&&n.templateEngine,o.templateProperty=a.bindingHandlers.module.templateProperty,o.afterRender=function(a,b){var c,e=d(f());e&&e.afterRender&&(c="string"==typeof e.afterRender?b&&b[e.afterRender]:e.afterRender,"function"==typeof c&&c.apply(this,arguments))},n&&n.moveNodesToContext&&(l=Array.prototype.slice.call(a.virtualElements.childNodes(b)),a.virtualElements.emptyNode(b)),g(b)||(o.name=function(){var a=d(f());return(a&&"object"==typeof a?d(a.template||a.name):a)||""}),o.data=a.observable(),o["if"]=o.data,a.applyBindingsToNode(b,{template:o},k=j.extend({$module:null,$moduleTemplateNodes:l})),m=function(){a.computed(function(){var a=o.data();a&&("function"==typeof a[q]&&(a[q].call(a),a=null),o.data(null))}).dispose(),l=null},a.computed({read:function(){var b,g=a.bindingHandlers.module.loader||c,h=d(f());h&&"object"==typeof h&&(p=h.initializer||p,q=h.disposeMethod||q,o.templateProperty=a.unwrap(h.templateProperty)||o.templateProperty,b=[].concat(d(h.data)),h=d(h.name)),m(),h&&g(h,function(a){"function"==typeof a?a=e(a,b):a&&a[p]&&(a=a[p].apply(a,b||[])||a),k.$module=a,o.data(a)})},disposeWhenNodeIsRemoved:b}),a.utils.domNodeDisposal.addDisposeCallback(b,m),{controlsDescendantBindings:!0}},baseDir:"",initializer:"initialize",disposeMethod:"dispose",templateProperty:""},a.virtualElements&&(a.virtualElements.allowedBindings.module=!0),function(a,b){var c=new a.nativeTemplateEngine,d={};c.defaultPath="templates",c.defaultSuffix=".tmpl.html",c.defaultRequireTextPluginName="text",c.loader=function(a,d){b([c.defaultRequireTextPluginName+"!"+f(c.defaultPath)+a+c.defaultSuffix],d)},a.templateSources.requireTemplate=function(b){this.key=b,this.template=a.observable(" "),this.requested=!1,this.retrieved=!1},a.templateSources.requireTemplate.prototype.text=function(a){return!this.requested&&this.key&&(c.loader(this.key,function(a){this.retrieved=!0,this.template(a)}.bind(this)),this.requested=!0),this.key||this.template(""),0===arguments.length?this.template():void 0},c.makeTemplateSource=function(b,c){var e;return"string"==typeof b?(e=(c||document).getElementById(b),e&&"script"===e.tagName.toLowerCase()?new a.templateSources.domElement(e):(b in d||(d[b]=new a.templateSources.requireTemplate(b)),d[b])):!b||1!==b.nodeType&&8!==b.nodeType?void 0:new a.templateSources.anonymousTemplate(b)},c.renderTemplate=function(b,d,e,f){var g,h=e&&e.afterRender,i=e&&e.templateProperty&&d.$module&&d.$module[e.templateProperty];return h&&(h=e.afterRender=e.afterRender.original||e.afterRender),g=!i||"function"!=typeof i&&"string"!=typeof i?c.makeTemplateSource(b,f):{text:function(){return"function"==typeof i?i.call(d.$module):i}},"function"==typeof h&&g instanceof a.templateSources.requireTemplate&&!g.retrieved&&(e.afterRender=function(){g.retrieved&&h.apply(this,arguments)},e.afterRender.original=h),c.renderTemplateSource(g,d,e,f)},a.amdTemplateEngine=c,a.setTemplateEngine(c)}(a,b)}); \ No newline at end of file diff --git a/package.json b/package.json index 0d809df..edcf404 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "knockout-amd-helpers", - "version": "1.0.0", + "version": "1.1.0", "author": "Ryan Niemeyer", "homepage": "https://github.com/rniemeyer/knockout-sortable", "description": "Makes Knockout and AMD modules work better together",