From 993d4c31cc9742902cb6504223fb7ece2ce5b9ac Mon Sep 17 00:00:00 2001 From: djmaze Date: Fri, 9 Oct 2020 12:45:55 +0200 Subject: [PATCH] Update knockout-latest.debug.js --- README.md | 10 +- .../build/output/knockout-latest.debug.js | 155 ++++++++++++------ 2 files changed, 112 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 7e22d3241..63389f240 100644 --- a/README.md +++ b/README.md @@ -109,19 +109,19 @@ RainLoop 1.14 vs SnappyMail |admin.js |2.130.942 | 774.093 | |app.js |4.184.455 |2.426.328 | |boot.js | 671.522 | 5.285 | -|libs.js | 647.614 | 246.991 | +|libs.js | 647.614 | 247.440 | |polyfills.js | 325.834 | 0 | -|TOTAL |7.960.367 |3.452.697 | +|TOTAL |7.960.367 |3.453.146 | |js/min/* |RainLoop |Snappy |Rain gzip |gzip |brotli | |--------------- |--------: |--------: |--------: |--------: |--------: | |admin.min.js | 252.147 | 103.575 | 73.657 | 27.571 | 23.931 | |app.min.js | 511.202 | 327.895 |140.462 | 84.341 | 68.393 | |boot.min.js | 66.007 | 2.918 | 22.567 | 1.500 | 1.275 | -|libs.min.js | 572.545 | 141.817 |176.720 | 50.690 | 45.096 | +|libs.min.js | 572.545 | 142.244 |176.720 | 50.849 | 45.242 | |polyfills.min.js | 32.452 | 0 | 11.312 | 0 | 0 | -|TOTAL |1.434.353 | 576.205 |424.718 |164.102 |138.695 | -|TOTAL (no admin) |1.182.206 | 472.630 |351.061 |136.531 |114.764 | +|TOTAL |1.434.353 | 576.632 |424.718 |164.261 |138.841 | +|TOTAL (no admin) |1.182.206 | 473.057 |351.061 |136.690 |114.910 | For a user its around 61% smaller and faster than traditional RainLoop. diff --git a/vendors/knockout/build/output/knockout-latest.debug.js b/vendors/knockout/build/output/knockout-latest.debug.js index c9dffe545..fffbc3269 100644 --- a/vendors/knockout/build/output/knockout-latest.debug.js +++ b/vendors/knockout/build/output/knockout-latest.debug.js @@ -1,5 +1,5 @@ /*! - * Knockout JavaScript library v3.5.1-pre + * Knockout JavaScript library v3.5.1-sm * (c) The Knockout.js team - http://knockoutjs.com/ * License: MIT (http://www.opensource.org/licenses/mit-license.php) */ @@ -17,7 +17,7 @@ var DEBUG=true; // In the future, the following "ko" variable may be made distinct from "koExports" so that private objects are not externally reachable. var ko = typeof koExports !== 'undefined' ? koExports : {}; // Google Closure Compiler helpers (used only to make the minified file smaller) -ko.exportSymbol = function(koPath, object) { +ko.exportSymbol = (koPath, object) => { var tokens = koPath.split("."); // In the future, "ko" may become distinct from "koExports" (so that non-exported objects are not reachable) @@ -28,47 +28,36 @@ ko.exportSymbol = function(koPath, object) { target = target[tokens[i]]; target[tokens[tokens.length - 1]] = object; }; -ko.exportProperty = function(owner, publicName, object) { - owner[publicName] = object; -}; -ko.version = "3.5.1-pre"; +ko.exportProperty = (owner, publicName, object) => owner[publicName] = object; +ko.version = "3.5.1-sm"; ko.exportSymbol('version', ko.version); ko.utils = (() => { - function arrayCall(name, arr, p1, p2) { - return Array.prototype[name].call(arr, p1, p2); - } - - function objectForEach(obj, action) { - obj && Object.entries(obj).forEach(prop => action(prop[0], prop[1])); - } - - function extend(target, source) { - if (source) { - Object.entries(source).forEach(prop => target[prop[0]] = prop[1]); - } - return target; - } - - function setPrototypeOf(obj, proto) { - obj.__proto__ = proto; - return obj; - } + const + arrayCall = (name, arr, p1, p2) => Array.prototype[name].call(arr, p1, p2), + objectForEach = (obj, action) => obj && Object.entries(obj).forEach(prop => action(prop[0], prop[1])), + extend = (target, source) => { + source && Object.entries(source).forEach(prop => target[prop[0]] = prop[1]); + return target; + }, + setPrototypeOf = (obj, proto) => { + obj.__proto__ = proto; + return obj; + }, + // For details on the pattern for changing node classes + // see: https://github.com/knockout/knockout/issues/1597 + toggleDomNodeCssClass = (node, classNames, shouldHaveClass) => { + if (classNames) { + var addOrRemoveFn = shouldHaveClass ? 'add' : 'remove'; + classNames.split(/\s+/).forEach(className => + node.classList[addOrRemoveFn](className) + ); + } + }; var canSetPrototype = ({ __proto__: [] } instanceof Array); - // For details on the pattern for changing node classes - // see: https://github.com/knockout/knockout/issues/1597 - function toggleDomNodeCssClass(node, classNames, shouldHaveClass) { - if (classNames) { - var addOrRemoveFn = shouldHaveClass ? 'add' : 'remove'; - classNames.split(/\s+/).forEach(className => - node.classList[addOrRemoveFn](className) - ); - } - } - return { arrayForEach: (array, action, actionOwner) => arrayCall('forEach', array, action, actionOwner), @@ -792,17 +781,6 @@ ko.subscribable = function () { var defaultEvent = "change"; -// Moved out of "limit" to avoid the extra closure -function limitNotifySubscribers(value, event) { - if (!event || event === defaultEvent) { - this._limitChange(value); - } else if (event === 'beforeChange') { - this._limitBeforeChange(value); - } else { - this._origNotifySubscribers(value, event); - } -} - var ko_subscribable_fn = { init: instance => { instance._subscriptions = { "change": [] }; @@ -871,7 +849,16 @@ var ko_subscribable_fn = { if (!self._origNotifySubscribers) { self._origNotifySubscribers = self["notifySubscribers"]; - self["notifySubscribers"] = limitNotifySubscribers; + // Moved out of "limit" to avoid the extra closure + self["notifySubscribers"] = function(value, event) { + if (!event || event === defaultEvent) { + this._limitChange(value); + } else if (event === 'beforeChange') { + this._limitBeforeChange(value); + } else { + this._origNotifySubscribers(value, event); + } + } } var finish = limitFunction(() => { @@ -3659,6 +3646,78 @@ ko.bindingHandlers['html'] = { // setHtml will unwrap the value if needed ko.utils.setHtml(element, valueAccessor()) }; +(() => { + +// Makes a binding like with or if +function makeIfBinding(bindingKey, isNot) { + ko.bindingHandlers[bindingKey] = { + 'init': (element, valueAccessor, allBindings, viewModel, bindingContext) => { + var didDisplayOnLastUpdate, savedNodes, contextOptions = {}, completeOnRender, needAsyncContext, renderOnEveryChange; + + completeOnRender = allBindings.get("completeOn") == "render"; + needAsyncContext = completeOnRender || allBindings['has'](ko.bindingEvent.descendantsComplete); + + ko.computed(() => { + var value = ko.utils.unwrapObservable(valueAccessor()), + shouldDisplay = !isNot !== !value, // equivalent to isNot ? !value : !!value, + isInitial = !savedNodes, + childContext; + + if (!renderOnEveryChange && shouldDisplay === didDisplayOnLastUpdate) { + return; + } + + if (needAsyncContext) { + bindingContext = ko.bindingEvent.startPossiblyAsyncContentBinding(element, bindingContext); + } + + if (shouldDisplay) { + if (renderOnEveryChange) { + contextOptions['dataDependency'] = ko.computedContext.computed(); + } + + if (ko.computedContext.getDependenciesCount()) { + childContext = bindingContext['extend'](null, contextOptions); + } else { + childContext = bindingContext; + } + } + + // Save a copy of the inner nodes on the initial update, but only if we have dependencies. + if (isInitial && ko.computedContext.getDependenciesCount()) { + savedNodes = ko.utils.cloneNodes(ko.virtualElements.childNodes(element), true /* shouldCleanNodes */); + } + + if (shouldDisplay) { + if (!isInitial) { + ko.virtualElements.setDomNodeChildren(element, ko.utils.cloneNodes(savedNodes)); + } + + ko.applyBindingsToDescendants(childContext, element); + } else { + ko.virtualElements.emptyNode(element); + + if (!completeOnRender) { + ko.bindingEvent.notify(element, ko.bindingEvent.childrenComplete); + } + } + + didDisplayOnLastUpdate = shouldDisplay; + + }, null, { disposeWhenNodeIsRemoved: element }); + + return { 'controlsDescendantBindings': true }; + } + }; + ko.expressionRewriting.bindingRewriteValidators[bindingKey] = false; // Can't rewrite control flow bindings + ko.virtualElements.allowedBindings[bindingKey] = true; +} + +// Construct the actual binding handlers +makeIfBinding('if'); +makeIfBinding('ifnot', true); + +})(); var captionPlaceholder = {}; ko.bindingHandlers['options'] = { 'init': element => {