@tko/lifecycle
Advanced tools
+1785
| // @tko/lifecycle 🥊 4.0.0-beta1.0 CommonJS | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // index.ts | ||
| var lifecycle_exports = {}; | ||
| __export(lifecycle_exports, { | ||
| LifeCycle: () => LifeCycle | ||
| }); | ||
| module.exports = __toCommonJS(lifecycle_exports); | ||
| // ../utils/dist/array.js | ||
| var { isArray } = Array; | ||
| function arrayForEach(array, action, thisArg) { | ||
| if (arguments.length > 2) { | ||
| action = action.bind(thisArg); | ||
| } | ||
| for (let i = 0, j = array.length; i < j; ++i) { | ||
| action(array[i], i, array); | ||
| } | ||
| } | ||
| function arrayIndexOf(array, item) { | ||
| return (isArray(array) ? array : [...array]).indexOf(item); | ||
| } | ||
| function arrayRemoveItem(array, itemToRemove) { | ||
| var index = arrayIndexOf(array, itemToRemove); | ||
| if (index > 0) { | ||
| array.splice(index, 1); | ||
| } else if (index === 0) { | ||
| array.shift(); | ||
| } | ||
| } | ||
| function findMovesInArrayComparison(left, right, limitFailedCompares) { | ||
| if (left.length && right.length) { | ||
| var failedCompares, l, r, leftItem, rightItem; | ||
| for (failedCompares = l = 0; (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]); ++l) { | ||
| for (r = 0; rightItem = right[r]; ++r) { | ||
| if (leftItem.value === rightItem.value) { | ||
| leftItem.moved = rightItem.index; | ||
| rightItem.moved = leftItem.index; | ||
| right.splice(r, 1); | ||
| failedCompares = r = 0; | ||
| break; | ||
| } | ||
| } | ||
| failedCompares += r; | ||
| } | ||
| } | ||
| } | ||
| var statusNotInOld = "added"; | ||
| var statusNotInNew = "deleted"; | ||
| function compareArrays(oldArray, newArray, options2) { | ||
| options2 = typeof options2 === "boolean" ? { dontLimitMoves: options2 } : options2 || {}; | ||
| oldArray = oldArray || []; | ||
| newArray = newArray || []; | ||
| if (oldArray.length < newArray.length) { | ||
| return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options2); | ||
| } else { | ||
| return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options2); | ||
| } | ||
| } | ||
| function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, options2) { | ||
| var myMin = Math.min, myMax = Math.max, editDistanceMatrix = [], smlIndex, smlIndexMax = smlArray.length, bigIndex, bigIndexMax = bigArray.length, compareRange = bigIndexMax - smlIndexMax || 1, maxDistance = smlIndexMax + bigIndexMax + 1, thisRow, lastRow, bigIndexMaxForRow, bigIndexMinForRow; | ||
| for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) { | ||
| lastRow = thisRow; | ||
| editDistanceMatrix.push(thisRow = []); | ||
| bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange); | ||
| bigIndexMinForRow = myMax(0, smlIndex - 1); | ||
| for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) { | ||
| if (!bigIndex) { | ||
| thisRow[bigIndex] = smlIndex + 1; | ||
| } else if (!smlIndex) { | ||
| thisRow[bigIndex] = bigIndex + 1; | ||
| } else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1]) { | ||
| thisRow[bigIndex] = lastRow[bigIndex - 1]; | ||
| } else { | ||
| var northDistance = lastRow[bigIndex] || maxDistance; | ||
| var westDistance = thisRow[bigIndex - 1] || maxDistance; | ||
| thisRow[bigIndex] = myMin(northDistance, westDistance) + 1; | ||
| } | ||
| } | ||
| } | ||
| var editScript = [], meMinusOne, notInSml = [], notInBig = []; | ||
| for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex; ) { | ||
| meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1; | ||
| if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex - 1]) { | ||
| notInSml.push(editScript[editScript.length] = { | ||
| "status": statusNotInSml, | ||
| "value": bigArray[--bigIndex], | ||
| "index": bigIndex | ||
| }); | ||
| } else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) { | ||
| notInBig.push(editScript[editScript.length] = { | ||
| "status": statusNotInBig, | ||
| "value": smlArray[--smlIndex], | ||
| "index": smlIndex | ||
| }); | ||
| } else { | ||
| --bigIndex; | ||
| --smlIndex; | ||
| if (!options2.sparse) { | ||
| editScript.push({ | ||
| "status": "retained", | ||
| "value": bigArray[bigIndex] | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| findMovesInArrayComparison(notInBig, notInSml, !options2.dontLimitMoves && smlIndexMax * 10); | ||
| return editScript.reverse(); | ||
| } | ||
| // ../utils/dist/options.js | ||
| var options = { | ||
| deferUpdates: false, | ||
| useOnlyNativeEvents: false, | ||
| protoProperty: "__ko_proto__", | ||
| defaultBindingAttribute: "data-bind", | ||
| allowVirtualElements: true, | ||
| bindingGlobals: /* @__PURE__ */ Object.create(null), | ||
| bindingProviderInstance: null, | ||
| createChildContextWithAs: false, | ||
| jQuery: globalThis.jQuery, | ||
| Promise: globalThis.Promise, | ||
| taskScheduler: null, | ||
| debug: false, | ||
| global: globalThis, | ||
| document: globalThis.document, | ||
| filters: {}, | ||
| includeDestroyed: false, | ||
| foreachHidesDestroyed: false, | ||
| onError: function(e) { | ||
| throw e; | ||
| }, | ||
| set: function(name, value) { | ||
| options[name] = value; | ||
| }, | ||
| getBindingHandler() { | ||
| }, | ||
| cleanExternalData() { | ||
| } | ||
| }; | ||
| Object.defineProperty(options, "$", { | ||
| get: function() { | ||
| return options.jQuery; | ||
| } | ||
| }); | ||
| var options_default = options; | ||
| // ../utils/dist/error.js | ||
| function catchFunctionErrors(delegate) { | ||
| if (!options_default.onError) { | ||
| return delegate; | ||
| } | ||
| return (...args) => { | ||
| try { | ||
| return delegate(...args); | ||
| } catch (err) { | ||
| options_default.onError(err); | ||
| } | ||
| }; | ||
| } | ||
| function deferError(error) { | ||
| safeSetTimeout(function() { | ||
| throw error; | ||
| }, 0); | ||
| } | ||
| function safeSetTimeout(handler, timeout) { | ||
| return setTimeout(catchFunctionErrors(handler), timeout); | ||
| } | ||
| // ../utils/dist/async.js | ||
| function throttle(callback, timeout) { | ||
| var timeoutInstance; | ||
| return function(...args) { | ||
| if (!timeoutInstance) { | ||
| timeoutInstance = safeSetTimeout(function() { | ||
| timeoutInstance = void 0; | ||
| callback(...args); | ||
| }, timeout); | ||
| } | ||
| }; | ||
| } | ||
| function debounce(callback, timeout) { | ||
| var timeoutInstance; | ||
| return function(...args) { | ||
| clearTimeout(timeoutInstance); | ||
| timeoutInstance = safeSetTimeout(() => callback(...args), timeout); | ||
| }; | ||
| } | ||
| // ../utils/dist/ie.js | ||
| var ieVersion = options_default.document && function() { | ||
| var version = 3, div = options_default.document.createElement("div"), iElems = div.getElementsByTagName("i"); | ||
| while (div.innerHTML = "<!--[if gt IE " + ++version + "]><i></i><![endif]-->", iElems[0]) { | ||
| } | ||
| if (!version) { | ||
| const userAgent = window.navigator.userAgent; | ||
| return ua.match(/MSIE ([^ ]+)/) || ua.match(/rv:([^ )]+)/); | ||
| } | ||
| return version > 4 ? version : void 0; | ||
| }(); | ||
| // ../utils/dist/object.js | ||
| function hasOwnProperty(obj, propName) { | ||
| return Object.prototype.hasOwnProperty.call(obj, propName); | ||
| } | ||
| function extend(target, source) { | ||
| if (source) { | ||
| for (var prop in source) { | ||
| if (hasOwnProperty(source, prop)) { | ||
| target[prop] = source[prop]; | ||
| } | ||
| } | ||
| } | ||
| return target; | ||
| } | ||
| function objectForEach(obj, action) { | ||
| for (var prop in obj) { | ||
| if (hasOwnProperty(obj, prop)) { | ||
| action(prop, obj[prop]); | ||
| } | ||
| } | ||
| } | ||
| // ../utils/dist/function.js | ||
| function testOverwrite() { | ||
| try { | ||
| Object.defineProperty(function x() { | ||
| }, "length", {}); | ||
| return true; | ||
| } catch (e) { | ||
| return false; | ||
| } | ||
| } | ||
| var functionSupportsLengthOverwrite = testOverwrite(); | ||
| function overwriteLengthPropertyIfSupported(fn, descriptor) { | ||
| if (functionSupportsLengthOverwrite) { | ||
| Object.defineProperty(fn, "length", descriptor); | ||
| } | ||
| } | ||
| // ../utils/dist/symbol.js | ||
| var useSymbols = typeof Symbol === "function"; | ||
| function createSymbolOrString(identifier) { | ||
| return useSymbols ? Symbol(identifier) : identifier; | ||
| } | ||
| // ../utils/dist/jquery.js | ||
| var jQueryInstance = options_default.global && options_default.global.jQuery; | ||
| // ../utils/dist/dom/info.js | ||
| function domNodeIsContainedBy(node, containedByNode) { | ||
| if (node === containedByNode) { | ||
| return true; | ||
| } | ||
| if (node.nodeType === 11) { | ||
| return false; | ||
| } | ||
| if (containedByNode.contains) { | ||
| return containedByNode.contains(node.nodeType !== 1 ? node.parentNode : node); | ||
| } | ||
| if (containedByNode.compareDocumentPosition) { | ||
| return (containedByNode.compareDocumentPosition(node) & 16) == 16; | ||
| } | ||
| while (node && node != containedByNode) { | ||
| node = node.parentNode; | ||
| } | ||
| return !!node; | ||
| } | ||
| function domNodeIsAttachedToDocument(node) { | ||
| return domNodeIsContainedBy(node, node.ownerDocument.documentElement); | ||
| } | ||
| function tagNameLower(element) { | ||
| return element && element.tagName && element.tagName.toLowerCase(); | ||
| } | ||
| // ../utils/dist/dom/data.js | ||
| var datastoreTime = new Date().getTime(); | ||
| var dataStoreKeyExpandoPropertyName = `__ko__${datastoreTime}`; | ||
| var dataStoreSymbol = Symbol("Knockout data"); | ||
| var dataStore; | ||
| var uniqueId = 0; | ||
| var modern = { | ||
| getDataForNode(node, createIfNotFound) { | ||
| let dataForNode = node[dataStoreSymbol]; | ||
| if (!dataForNode && createIfNotFound) { | ||
| dataForNode = node[dataStoreSymbol] = {}; | ||
| } | ||
| return dataForNode; | ||
| }, | ||
| clear(node) { | ||
| if (node[dataStoreSymbol]) { | ||
| delete node[dataStoreSymbol]; | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| }; | ||
| var IE = { | ||
| getDataforNode(node, createIfNotFound) { | ||
| let dataStoreKey = node[dataStoreKeyExpandoPropertyName]; | ||
| const hasExistingDataStore = dataStoreKey && dataStoreKey !== "null" && dataStore[dataStoreKey]; | ||
| if (!hasExistingDataStore) { | ||
| if (!createIfNotFound) { | ||
| return void 0; | ||
| } | ||
| dataStoreKey = node[dataStoreKeyExpandoPropertyName] = "ko" + uniqueId++; | ||
| dataStore[dataStoreKey] = {}; | ||
| } | ||
| return dataStore[dataStoreKey]; | ||
| }, | ||
| clear(node) { | ||
| const dataStoreKey = node[dataStoreKeyExpandoPropertyName]; | ||
| if (dataStoreKey) { | ||
| delete dataStore[dataStoreKey]; | ||
| node[dataStoreKeyExpandoPropertyName] = null; | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| }; | ||
| var { getDataForNode, clear } = ieVersion ? IE : modern; | ||
| function nextKey() { | ||
| return uniqueId++ + dataStoreKeyExpandoPropertyName; | ||
| } | ||
| function get(node, key) { | ||
| const dataForNode = getDataForNode(node, false); | ||
| return dataForNode && dataForNode[key]; | ||
| } | ||
| function set(node, key, value) { | ||
| var dataForNode = getDataForNode(node, value !== void 0); | ||
| dataForNode && (dataForNode[key] = value); | ||
| } | ||
| // ../utils/dist/dom/disposal.js | ||
| var domDataKey = nextKey(); | ||
| function getDisposeCallbacksCollection(node, createIfNotFound) { | ||
| var allDisposeCallbacks = get(node, domDataKey); | ||
| if (allDisposeCallbacks === void 0 && createIfNotFound) { | ||
| allDisposeCallbacks = []; | ||
| set(node, domDataKey, allDisposeCallbacks); | ||
| } | ||
| return allDisposeCallbacks; | ||
| } | ||
| function destroyCallbacksCollection(node) { | ||
| set(node, domDataKey, void 0); | ||
| } | ||
| function addDisposeCallback(node, callback) { | ||
| if (typeof callback !== "function") { | ||
| throw new Error("Callback must be a function"); | ||
| } | ||
| getDisposeCallbacksCollection(node, true).push(callback); | ||
| } | ||
| function removeDisposeCallback(node, callback) { | ||
| var callbacksCollection = getDisposeCallbacksCollection(node, false); | ||
| if (callbacksCollection) { | ||
| arrayRemoveItem(callbacksCollection, callback); | ||
| if (callbacksCollection.length === 0) { | ||
| destroyCallbacksCollection(node); | ||
| } | ||
| } | ||
| } | ||
| var otherNodeCleanerFunctions = []; | ||
| function cleanjQueryData(node) { | ||
| var jQueryCleanNodeFn = jQueryInstance ? jQueryInstance.cleanData : null; | ||
| if (jQueryCleanNodeFn) { | ||
| jQueryCleanNodeFn([node]); | ||
| } | ||
| } | ||
| otherNodeCleanerFunctions.push(cleanjQueryData); | ||
| // ../utils/dist/dom/event.js | ||
| var knownEvents = {}; | ||
| var knownEventTypesByEventName = {}; | ||
| var keyEventTypeName = options_default.global.navigator && /Firefox\/2/i.test(options_default.global.navigator.userAgent) ? "KeyboardEvent" : "UIEvents"; | ||
| knownEvents[keyEventTypeName] = ["keyup", "keydown", "keypress"]; | ||
| knownEvents["MouseEvents"] = [ | ||
| "click", | ||
| "dblclick", | ||
| "mousedown", | ||
| "mouseup", | ||
| "mousemove", | ||
| "mouseover", | ||
| "mouseout", | ||
| "mouseenter", | ||
| "mouseleave" | ||
| ]; | ||
| objectForEach(knownEvents, function(eventType, knownEventsForType) { | ||
| if (knownEventsForType.length) { | ||
| for (var i = 0, j = knownEventsForType.length; i < j; i++) { | ||
| knownEventTypesByEventName[knownEventsForType[i]] = eventType; | ||
| } | ||
| } | ||
| }); | ||
| // ../utils/dist/dom/virtualElements.js | ||
| var commentNodesHaveTextProperty = options_default.document && options_default.document.createComment("test").text === "<!--test-->"; | ||
| // ../utils/dist/dom/html.js | ||
| var supportsTemplateTag = options_default.document && "content" in options_default.document.createElement("template"); | ||
| // ../utils/dist/dom/selectExtensions.js | ||
| var hasDomDataExpandoProperty = Symbol("Knockout selectExtensions hasDomDataProperty"); | ||
| var selectExtensions = { | ||
| optionValueDomDataKey: nextKey(), | ||
| readValue: function(element) { | ||
| switch (tagNameLower(element)) { | ||
| case "option": | ||
| if (element[hasDomDataExpandoProperty] === true) { | ||
| return get(element, selectExtensions.optionValueDomDataKey); | ||
| } | ||
| return element.value; | ||
| case "select": | ||
| return element.selectedIndex >= 0 ? selectExtensions.readValue(element.options[element.selectedIndex]) : void 0; | ||
| default: | ||
| return element.value; | ||
| } | ||
| }, | ||
| writeValue: function(element, value, allowUnset) { | ||
| switch (tagNameLower(element)) { | ||
| case "option": | ||
| if (typeof value === "string") { | ||
| set(element, selectExtensions.optionValueDomDataKey, void 0); | ||
| if (hasDomDataExpandoProperty in element) { | ||
| delete element[hasDomDataExpandoProperty]; | ||
| } | ||
| element.value = value; | ||
| } else { | ||
| set(element, selectExtensions.optionValueDomDataKey, value); | ||
| element[hasDomDataExpandoProperty] = true; | ||
| element.value = typeof value === "number" ? value : ""; | ||
| } | ||
| break; | ||
| case "select": | ||
| if (value === "" || value === null) { | ||
| value = void 0; | ||
| } | ||
| var selection = -1; | ||
| for (let i = 0, n = element.options.length, optionValue; i < n; ++i) { | ||
| optionValue = selectExtensions.readValue(element.options[i]); | ||
| const strictEqual = optionValue === value; | ||
| const blankEqual = optionValue === "" && value === void 0; | ||
| const numericEqual = typeof value === "number" && Number(optionValue) === value; | ||
| if (strictEqual || blankEqual || numericEqual) { | ||
| selection = i; | ||
| break; | ||
| } | ||
| } | ||
| if (allowUnset || selection >= 0 || value === void 0 && element.size > 1) { | ||
| element.selectedIndex = selection; | ||
| } | ||
| break; | ||
| default: | ||
| if (value === null || value === void 0) { | ||
| value = ""; | ||
| } | ||
| element.value = value; | ||
| break; | ||
| } | ||
| } | ||
| }; | ||
| // ../utils/dist/tasks.js | ||
| var tasks_exports = {}; | ||
| __export(tasks_exports, { | ||
| cancel: () => cancel, | ||
| resetForTesting: () => resetForTesting, | ||
| runEarly: () => processTasks, | ||
| schedule: () => schedule | ||
| }); | ||
| var taskQueue = []; | ||
| var taskQueueLength = 0; | ||
| var nextHandle = 1; | ||
| var nextIndexToProcess = 0; | ||
| var w = options_default.global; | ||
| if (w && w.MutationObserver && !(w.navigator && w.navigator.standalone)) { | ||
| options_default.taskScheduler = function(callback) { | ||
| var div = w.document.createElement("div"); | ||
| new w.MutationObserver(callback).observe(div, { attributes: true }); | ||
| return function() { | ||
| div.classList.toggle("foo"); | ||
| }; | ||
| }(scheduledProcess); | ||
| } else if (w && w.document && "onreadystatechange" in w.document.createElement("script")) { | ||
| options_default.taskScheduler = function(callback) { | ||
| var script = document.createElement("script"); | ||
| script.onreadystatechange = function() { | ||
| script.onreadystatechange = null; | ||
| document.documentElement.removeChild(script); | ||
| script = null; | ||
| callback(); | ||
| }; | ||
| document.documentElement.appendChild(script); | ||
| }; | ||
| } else { | ||
| options_default.taskScheduler = function(callback) { | ||
| setTimeout(callback, 0); | ||
| }; | ||
| } | ||
| function processTasks() { | ||
| if (taskQueueLength) { | ||
| var mark = taskQueueLength, countMarks = 0; | ||
| for (var task; nextIndexToProcess < taskQueueLength; ) { | ||
| if (task = taskQueue[nextIndexToProcess++]) { | ||
| if (nextIndexToProcess > mark) { | ||
| if (++countMarks >= 5e3) { | ||
| nextIndexToProcess = taskQueueLength; | ||
| deferError(Error("'Too much recursion' after processing " + countMarks + " task groups.")); | ||
| break; | ||
| } | ||
| mark = taskQueueLength; | ||
| } | ||
| try { | ||
| task(); | ||
| } catch (ex) { | ||
| deferError(ex); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| function scheduledProcess() { | ||
| processTasks(); | ||
| nextIndexToProcess = taskQueueLength = taskQueue.length = 0; | ||
| } | ||
| function scheduleTaskProcessing() { | ||
| options_default.taskScheduler(scheduledProcess); | ||
| } | ||
| function schedule(func) { | ||
| if (!taskQueueLength) { | ||
| scheduleTaskProcessing(); | ||
| } | ||
| taskQueue[taskQueueLength++] = func; | ||
| return nextHandle++; | ||
| } | ||
| function cancel(handle) { | ||
| var index = handle - (nextHandle - taskQueueLength); | ||
| if (index >= nextIndexToProcess && index < taskQueueLength) { | ||
| taskQueue[index] = null; | ||
| } | ||
| } | ||
| function resetForTesting() { | ||
| var length = taskQueueLength - nextIndexToProcess; | ||
| nextIndexToProcess = taskQueueLength = taskQueue.length = 0; | ||
| return length; | ||
| } | ||
| // ../observable/dist/dependencyDetection.js | ||
| var dependencyDetection_exports = {}; | ||
| __export(dependencyDetection_exports, { | ||
| begin: () => begin, | ||
| end: () => end, | ||
| getDependencies: () => getDependencies, | ||
| getDependenciesCount: () => getDependenciesCount, | ||
| ignore: () => ignore, | ||
| ignoreDependencies: () => ignore, | ||
| isInitial: () => isInitial, | ||
| registerDependency: () => registerDependency | ||
| }); | ||
| // ../observable/dist/subscribableSymbol.js | ||
| var SUBSCRIBABLE_SYM = Symbol("Knockout Subscribable"); | ||
| function isSubscribable(instance) { | ||
| return instance && instance[SUBSCRIBABLE_SYM] || false; | ||
| } | ||
| // ../observable/dist/dependencyDetection.js | ||
| var outerFrames = []; | ||
| var currentFrame; | ||
| var lastId = 0; | ||
| function getId() { | ||
| return ++lastId; | ||
| } | ||
| function begin(options2) { | ||
| outerFrames.push(currentFrame); | ||
| currentFrame = options2; | ||
| } | ||
| function end() { | ||
| currentFrame = outerFrames.pop(); | ||
| } | ||
| function registerDependency(subscribable2) { | ||
| if (currentFrame) { | ||
| if (!isSubscribable(subscribable2)) { | ||
| throw new Error("Only subscribable things can act as dependencies"); | ||
| } | ||
| currentFrame.callback.call(currentFrame.callbackTarget, subscribable2, subscribable2._id || (subscribable2._id = getId())); | ||
| } | ||
| } | ||
| function ignore(callback, callbackTarget, callbackArgs) { | ||
| try { | ||
| begin(); | ||
| return callback.apply(callbackTarget, callbackArgs || []); | ||
| } finally { | ||
| end(); | ||
| } | ||
| } | ||
| function getDependenciesCount() { | ||
| if (currentFrame) { | ||
| return currentFrame.computed.getDependenciesCount(); | ||
| } | ||
| } | ||
| function getDependencies() { | ||
| if (currentFrame) { | ||
| return currentFrame.computed.getDependencies(); | ||
| } | ||
| } | ||
| function isInitial() { | ||
| if (currentFrame) { | ||
| return currentFrame.isInitial; | ||
| } | ||
| } | ||
| // ../observable/dist/defer.js | ||
| function deferUpdates(target) { | ||
| if (target._deferUpdates) { | ||
| return; | ||
| } | ||
| target._deferUpdates = true; | ||
| target.limit(function(callback) { | ||
| let handle; | ||
| let ignoreUpdates = false; | ||
| return function() { | ||
| if (!ignoreUpdates) { | ||
| tasks_exports.cancel(handle); | ||
| handle = tasks_exports.schedule(callback); | ||
| try { | ||
| ignoreUpdates = true; | ||
| target.notifySubscribers(void 0, "dirty"); | ||
| } finally { | ||
| ignoreUpdates = false; | ||
| } | ||
| } | ||
| }; | ||
| }); | ||
| } | ||
| // ../observable/dist/Subscription.js | ||
| var Subscription = class { | ||
| constructor(target, observer, disposeCallback) { | ||
| this._target = target; | ||
| this._callback = observer.next; | ||
| this._disposeCallback = disposeCallback; | ||
| this._isDisposed = false; | ||
| this._domNodeDisposalCallback = null; | ||
| } | ||
| dispose() { | ||
| if (this._domNodeDisposalCallback) { | ||
| removeDisposeCallback(this._node, this._domNodeDisposalCallback); | ||
| } | ||
| this._isDisposed = true; | ||
| this._disposeCallback(); | ||
| } | ||
| disposeWhenNodeIsRemoved(node) { | ||
| this._node = node; | ||
| addDisposeCallback(node, this._domNodeDisposalCallback = this.dispose.bind(this)); | ||
| } | ||
| unsubscribe() { | ||
| this.dispose(); | ||
| } | ||
| get closed() { | ||
| return this._isDisposed; | ||
| } | ||
| }; | ||
| // ../observable/dist/extenders.js | ||
| var primitiveTypes = { | ||
| "undefined": 1, | ||
| "boolean": 1, | ||
| "number": 1, | ||
| "string": 1 | ||
| }; | ||
| function valuesArePrimitiveAndEqual(a, b) { | ||
| var oldValueIsPrimitive = a === null || typeof a in primitiveTypes; | ||
| return oldValueIsPrimitive ? a === b : false; | ||
| } | ||
| function applyExtenders(requestedExtenders) { | ||
| var target = this; | ||
| if (requestedExtenders) { | ||
| objectForEach(requestedExtenders, function(key, value) { | ||
| var extenderHandler = extenders[key]; | ||
| if (typeof extenderHandler === "function") { | ||
| target = extenderHandler(target, value) || target; | ||
| } else { | ||
| options_default.onError(new Error("Extender not found: " + key)); | ||
| } | ||
| }); | ||
| } | ||
| return target; | ||
| } | ||
| function notify(target, notifyWhen) { | ||
| target.equalityComparer = notifyWhen == "always" ? null : valuesArePrimitiveAndEqual; | ||
| } | ||
| function deferred(target, option) { | ||
| if (option !== true) { | ||
| throw new Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled."); | ||
| } | ||
| deferUpdates(target); | ||
| } | ||
| function rateLimit(target, options2) { | ||
| var timeout, method, limitFunction; | ||
| if (typeof options2 === "number") { | ||
| timeout = options2; | ||
| } else { | ||
| timeout = options2.timeout; | ||
| method = options2.method; | ||
| } | ||
| target._deferUpdates = false; | ||
| limitFunction = method === "notifyWhenChangesStop" ? debounce : throttle; | ||
| target.limit(function(callback) { | ||
| return limitFunction(callback, timeout); | ||
| }); | ||
| } | ||
| var extenders = { | ||
| notify, | ||
| deferred, | ||
| rateLimit | ||
| }; | ||
| // ../observable/dist/subscribable.js | ||
| var LATEST_VALUE = Symbol("Knockout latest value"); | ||
| if (!Symbol.observable) { | ||
| Symbol.observable = Symbol.for("@tko/Symbol.observable"); | ||
| } | ||
| function subscribable() { | ||
| Object.setPrototypeOf(this, ko_subscribable_fn); | ||
| ko_subscribable_fn.init(this); | ||
| } | ||
| var defaultEvent = "change"; | ||
| var ko_subscribable_fn = { | ||
| [SUBSCRIBABLE_SYM]: true, | ||
| [Symbol.observable]() { | ||
| return this; | ||
| }, | ||
| init(instance) { | ||
| instance._subscriptions = { change: [] }; | ||
| instance._versionNumber = 1; | ||
| }, | ||
| subscribe(callback, callbackTarget, event) { | ||
| const isTC39Callback = typeof callback === "object" && callback.next; | ||
| event = event || defaultEvent; | ||
| const observer = isTC39Callback ? callback : { | ||
| next: callbackTarget ? callback.bind(callbackTarget) : callback | ||
| }; | ||
| const subscriptionInstance = new Subscription(this, observer, () => { | ||
| arrayRemoveItem(this._subscriptions[event], subscriptionInstance); | ||
| if (this.afterSubscriptionRemove) { | ||
| this.afterSubscriptionRemove(event); | ||
| } | ||
| }); | ||
| if (this.beforeSubscriptionAdd) { | ||
| this.beforeSubscriptionAdd(event); | ||
| } | ||
| if (!this._subscriptions[event]) { | ||
| this._subscriptions[event] = []; | ||
| } | ||
| this._subscriptions[event].push(subscriptionInstance); | ||
| if (isTC39Callback && LATEST_VALUE in this) { | ||
| observer.next(this[LATEST_VALUE]); | ||
| } | ||
| return subscriptionInstance; | ||
| }, | ||
| notifySubscribers(valueToNotify, event) { | ||
| event = event || defaultEvent; | ||
| if (event === defaultEvent) { | ||
| this.updateVersion(); | ||
| } | ||
| if (this.hasSubscriptionsForEvent(event)) { | ||
| const subs = event === defaultEvent && this._changeSubscriptions || [...this._subscriptions[event]]; | ||
| try { | ||
| begin(); | ||
| for (let i = 0, subscriptionInstance; subscriptionInstance = subs[i]; ++i) { | ||
| if (!subscriptionInstance._isDisposed) { | ||
| subscriptionInstance._callback(valueToNotify); | ||
| } | ||
| } | ||
| } finally { | ||
| end(); | ||
| } | ||
| } | ||
| }, | ||
| getVersion() { | ||
| return this._versionNumber; | ||
| }, | ||
| hasChanged(versionToCheck) { | ||
| return this.getVersion() !== versionToCheck; | ||
| }, | ||
| updateVersion() { | ||
| ++this._versionNumber; | ||
| }, | ||
| hasSubscriptionsForEvent(event) { | ||
| return this._subscriptions[event] && this._subscriptions[event].length; | ||
| }, | ||
| getSubscriptionsCount(event) { | ||
| if (event) { | ||
| return this._subscriptions[event] && this._subscriptions[event].length || 0; | ||
| } else { | ||
| var total = 0; | ||
| objectForEach(this._subscriptions, function(eventName, subscriptions) { | ||
| if (eventName !== "dirty") { | ||
| total += subscriptions.length; | ||
| } | ||
| }); | ||
| return total; | ||
| } | ||
| }, | ||
| isDifferent(oldValue, newValue) { | ||
| return !this.equalityComparer || !this.equalityComparer(oldValue, newValue); | ||
| }, | ||
| once(cb) { | ||
| const subs = this.subscribe((nv) => { | ||
| subs.dispose(); | ||
| cb(nv); | ||
| }); | ||
| }, | ||
| when(test, returnValue) { | ||
| const current = this.peek(); | ||
| const givenRv = arguments.length > 1; | ||
| const testFn = typeof test === "function" ? test : (v) => v === test; | ||
| if (testFn(current)) { | ||
| return options_default.Promise.resolve(givenRv ? returnValue : current); | ||
| } | ||
| return new options_default.Promise((resolve, reject) => { | ||
| const subs = this.subscribe((newValue) => { | ||
| if (testFn(newValue)) { | ||
| subs.dispose(); | ||
| resolve(givenRv ? returnValue : newValue); | ||
| } | ||
| }); | ||
| }); | ||
| }, | ||
| yet(test, ...args) { | ||
| const testFn = typeof test === "function" ? test : (v) => v === test; | ||
| const negated = (v) => !testFn(v); | ||
| return this.when(negated, ...args); | ||
| }, | ||
| next() { | ||
| return new Promise((resolve) => this.once(resolve)); | ||
| }, | ||
| toString() { | ||
| return "[object Object]"; | ||
| }, | ||
| extend: applyExtenders | ||
| }; | ||
| Object.setPrototypeOf(ko_subscribable_fn, Function.prototype); | ||
| subscribable.fn = ko_subscribable_fn; | ||
| // ../observable/dist/observable.js | ||
| function observable(initialValue) { | ||
| function Observable() { | ||
| if (arguments.length > 0) { | ||
| if (Observable.isDifferent(Observable[LATEST_VALUE], arguments[0])) { | ||
| Observable.valueWillMutate(); | ||
| Observable[LATEST_VALUE] = arguments[0]; | ||
| Observable.valueHasMutated(); | ||
| } | ||
| return this; | ||
| } else { | ||
| registerDependency(Observable); | ||
| return Observable[LATEST_VALUE]; | ||
| } | ||
| } | ||
| overwriteLengthPropertyIfSupported(Observable, { value: void 0 }); | ||
| Observable[LATEST_VALUE] = initialValue; | ||
| subscribable.fn.init(Observable); | ||
| Object.setPrototypeOf(Observable, observable.fn); | ||
| if (options_default.deferUpdates) { | ||
| deferUpdates(Observable); | ||
| } | ||
| return Observable; | ||
| } | ||
| observable.fn = { | ||
| equalityComparer: valuesArePrimitiveAndEqual, | ||
| peek() { | ||
| return this[LATEST_VALUE]; | ||
| }, | ||
| valueHasMutated() { | ||
| this.notifySubscribers(this[LATEST_VALUE], "spectate"); | ||
| this.notifySubscribers(this[LATEST_VALUE]); | ||
| }, | ||
| valueWillMutate() { | ||
| this.notifySubscribers(this[LATEST_VALUE], "beforeChange"); | ||
| }, | ||
| modify(fn, peek22 = true) { | ||
| return this(fn(peek22 ? this.peek() : this())); | ||
| }, | ||
| isWriteable: true | ||
| }; | ||
| function limitNotifySubscribers(value, event) { | ||
| if (!event || event === defaultEvent) { | ||
| this._limitChange(value); | ||
| } else if (event === "beforeChange") { | ||
| this._limitBeforeChange(value); | ||
| } else { | ||
| this._origNotifySubscribers(value, event); | ||
| } | ||
| } | ||
| subscribable.fn.limit = function limit(limitFunction) { | ||
| var self = this; | ||
| var selfIsObservable = isObservable(self); | ||
| var beforeChange = "beforeChange"; | ||
| var ignoreBeforeChange, notifyNextChange, previousValue, pendingValue, didUpdate; | ||
| if (!self._origNotifySubscribers) { | ||
| self._origNotifySubscribers = self.notifySubscribers; | ||
| self.notifySubscribers = limitNotifySubscribers; | ||
| } | ||
| var finish = limitFunction(function() { | ||
| self._notificationIsPending = false; | ||
| if (selfIsObservable && pendingValue === self) { | ||
| pendingValue = self._evalIfChanged ? self._evalIfChanged() : self(); | ||
| } | ||
| const shouldNotify = notifyNextChange || didUpdate && self.isDifferent(previousValue, pendingValue); | ||
| self._notifyNextChange = didUpdate = ignoreBeforeChange = false; | ||
| if (shouldNotify) { | ||
| self._origNotifySubscribers(previousValue = pendingValue); | ||
| } | ||
| }); | ||
| Object.assign(self, { | ||
| _limitChange(value, isDirty) { | ||
| if (!isDirty || !self._notificationIsPending) { | ||
| didUpdate = !isDirty; | ||
| } | ||
| self._changeSubscriptions = [...self._subscriptions[defaultEvent]]; | ||
| self._notificationIsPending = ignoreBeforeChange = true; | ||
| pendingValue = value; | ||
| finish(); | ||
| }, | ||
| _limitBeforeChange(value) { | ||
| if (!ignoreBeforeChange) { | ||
| previousValue = value; | ||
| self._origNotifySubscribers(value, beforeChange); | ||
| } | ||
| }, | ||
| _notifyNextChangeIfValueIsDifferent() { | ||
| if (self.isDifferent(previousValue, self.peek(true))) { | ||
| notifyNextChange = true; | ||
| } | ||
| }, | ||
| _recordUpdate() { | ||
| didUpdate = true; | ||
| } | ||
| }); | ||
| }; | ||
| Object.setPrototypeOf(observable.fn, subscribable.fn); | ||
| var protoProperty = observable.protoProperty = options_default.protoProperty; | ||
| observable.fn[protoProperty] = observable; | ||
| observable.observablePrototypes = /* @__PURE__ */ new Set([observable]); | ||
| function isObservable(instance) { | ||
| const proto = typeof instance === "function" && instance[protoProperty]; | ||
| if (proto && !observable.observablePrototypes.has(proto)) { | ||
| throw Error("Invalid object that looks like an observable; possibly from another Knockout instance"); | ||
| } | ||
| return !!proto; | ||
| } | ||
| function unwrap(value) { | ||
| return isObservable(value) ? value() : value; | ||
| } | ||
| // ../observable/dist/observableArray.changeTracking.js | ||
| var arrayChangeEventName = "arrayChange"; | ||
| function trackArrayChanges(target, options2) { | ||
| target.compareArrayOptions = {}; | ||
| if (options2 && typeof options2 === "object") { | ||
| extend(target.compareArrayOptions, options2); | ||
| } | ||
| target.compareArrayOptions.sparse = true; | ||
| if (target.cacheDiffForKnownOperation) { | ||
| return; | ||
| } | ||
| let trackingChanges = false; | ||
| let cachedDiff = null; | ||
| let arrayChangeSubscription; | ||
| let pendingNotifications = 0; | ||
| let underlyingNotifySubscribersFunction; | ||
| let underlyingBeforeSubscriptionAddFunction = target.beforeSubscriptionAdd; | ||
| let underlyingAfterSubscriptionRemoveFunction = target.afterSubscriptionRemove; | ||
| target.beforeSubscriptionAdd = function(event) { | ||
| if (underlyingBeforeSubscriptionAddFunction) { | ||
| underlyingBeforeSubscriptionAddFunction.call(target, event); | ||
| } | ||
| if (event === arrayChangeEventName) { | ||
| trackChanges(); | ||
| } | ||
| }; | ||
| target.afterSubscriptionRemove = function(event) { | ||
| if (underlyingAfterSubscriptionRemoveFunction) { | ||
| underlyingAfterSubscriptionRemoveFunction.call(target, event); | ||
| } | ||
| if (event === arrayChangeEventName && !target.hasSubscriptionsForEvent(arrayChangeEventName)) { | ||
| if (underlyingNotifySubscribersFunction) { | ||
| target.notifySubscribers = underlyingNotifySubscribersFunction; | ||
| underlyingNotifySubscribersFunction = void 0; | ||
| } | ||
| if (arrayChangeSubscription) { | ||
| arrayChangeSubscription.dispose(); | ||
| } | ||
| arrayChangeSubscription = null; | ||
| trackingChanges = false; | ||
| } | ||
| }; | ||
| function trackChanges() { | ||
| if (trackingChanges) { | ||
| return; | ||
| } | ||
| trackingChanges = true; | ||
| underlyingNotifySubscribersFunction = target["notifySubscribers"]; | ||
| target.notifySubscribers = function(valueToNotify, event) { | ||
| if (!event || event === defaultEvent) { | ||
| ++pendingNotifications; | ||
| } | ||
| return underlyingNotifySubscribersFunction.apply(this, arguments); | ||
| }; | ||
| var previousContents = [].concat(target.peek() === void 0 ? [] : target.peek()); | ||
| cachedDiff = null; | ||
| arrayChangeSubscription = target.subscribe(function(currentContents) { | ||
| let changes; | ||
| currentContents = [].concat(currentContents || []); | ||
| if (target.hasSubscriptionsForEvent(arrayChangeEventName)) { | ||
| changes = getChanges(previousContents, currentContents); | ||
| } | ||
| previousContents = currentContents; | ||
| cachedDiff = null; | ||
| pendingNotifications = 0; | ||
| if (changes && changes.length) { | ||
| target.notifySubscribers(changes, arrayChangeEventName); | ||
| } | ||
| }); | ||
| } | ||
| function getChanges(previousContents, currentContents) { | ||
| if (!cachedDiff || pendingNotifications > 1) { | ||
| cachedDiff = trackArrayChanges.compareArrays(previousContents, currentContents, target.compareArrayOptions); | ||
| } | ||
| return cachedDiff; | ||
| } | ||
| target.cacheDiffForKnownOperation = function(rawArray, operationName, args) { | ||
| if (!trackingChanges || pendingNotifications) { | ||
| return; | ||
| } | ||
| var diff = [], arrayLength = rawArray.length, argsLength = args.length, offset = 0; | ||
| function pushDiff(status, value, index) { | ||
| return diff[diff.length] = { "status": status, "value": value, "index": index }; | ||
| } | ||
| switch (operationName) { | ||
| case "push": | ||
| offset = arrayLength; | ||
| case "unshift": | ||
| for (let index = 0; index < argsLength; index++) { | ||
| pushDiff("added", args[index], offset + index); | ||
| } | ||
| break; | ||
| case "pop": | ||
| offset = arrayLength - 1; | ||
| case "shift": | ||
| if (arrayLength) { | ||
| pushDiff("deleted", rawArray[offset], offset); | ||
| } | ||
| break; | ||
| case "splice": | ||
| var startIndex = Math.min(Math.max(0, args[0] < 0 ? arrayLength + args[0] : args[0]), arrayLength), endDeleteIndex = argsLength === 1 ? arrayLength : Math.min(startIndex + (args[1] || 0), arrayLength), endAddIndex = startIndex + argsLength - 2, endIndex = Math.max(endDeleteIndex, endAddIndex), additions = [], deletions = []; | ||
| for (let index = startIndex, argsIndex = 2; index < endIndex; ++index, ++argsIndex) { | ||
| if (index < endDeleteIndex) { | ||
| deletions.push(pushDiff("deleted", rawArray[index], index)); | ||
| } | ||
| if (index < endAddIndex) { | ||
| additions.push(pushDiff("added", args[argsIndex], index)); | ||
| } | ||
| } | ||
| findMovesInArrayComparison(deletions, additions); | ||
| break; | ||
| default: | ||
| return; | ||
| } | ||
| cachedDiff = diff; | ||
| }; | ||
| } | ||
| trackArrayChanges.compareArrays = compareArrays; | ||
| extenders.trackArrayChanges = trackArrayChanges; | ||
| // ../observable/dist/observableArray.js | ||
| function observableArray(initialValues) { | ||
| initialValues = initialValues || []; | ||
| if (typeof initialValues !== "object" || !("length" in initialValues)) { | ||
| throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined."); | ||
| } | ||
| var result = observable(initialValues); | ||
| Object.setPrototypeOf(result, observableArray.fn); | ||
| trackArrayChanges(result); | ||
| overwriteLengthPropertyIfSupported(result, { get: () => result().length }); | ||
| return result; | ||
| } | ||
| observableArray.fn = { | ||
| remove(valueOrPredicate) { | ||
| var underlyingArray = this.peek(); | ||
| var removedValues = []; | ||
| var predicate = typeof valueOrPredicate === "function" && !isObservable(valueOrPredicate) ? valueOrPredicate : function(value2) { | ||
| return value2 === valueOrPredicate; | ||
| }; | ||
| for (var i = 0; i < underlyingArray.length; i++) { | ||
| var value = underlyingArray[i]; | ||
| if (predicate(value)) { | ||
| if (removedValues.length === 0) { | ||
| this.valueWillMutate(); | ||
| } | ||
| if (underlyingArray[i] !== value) { | ||
| throw Error("Array modified during remove; cannot remove item"); | ||
| } | ||
| removedValues.push(value); | ||
| underlyingArray.splice(i, 1); | ||
| i--; | ||
| } | ||
| } | ||
| if (removedValues.length) { | ||
| this.valueHasMutated(); | ||
| } | ||
| return removedValues; | ||
| }, | ||
| removeAll(arrayOfValues) { | ||
| if (arrayOfValues === void 0) { | ||
| var underlyingArray = this.peek(); | ||
| var allValues = underlyingArray.slice(0); | ||
| this.valueWillMutate(); | ||
| underlyingArray.splice(0, underlyingArray.length); | ||
| this.valueHasMutated(); | ||
| return allValues; | ||
| } | ||
| if (!arrayOfValues) { | ||
| return []; | ||
| } | ||
| return this["remove"](function(value) { | ||
| return arrayIndexOf(arrayOfValues, value) >= 0; | ||
| }); | ||
| }, | ||
| destroy(valueOrPredicate) { | ||
| var underlyingArray = this.peek(); | ||
| var predicate = typeof valueOrPredicate === "function" && !isObservable(valueOrPredicate) ? valueOrPredicate : function(value2) { | ||
| return value2 === valueOrPredicate; | ||
| }; | ||
| this.valueWillMutate(); | ||
| for (var i = underlyingArray.length - 1; i >= 0; i--) { | ||
| var value = underlyingArray[i]; | ||
| if (predicate(value)) { | ||
| value["_destroy"] = true; | ||
| } | ||
| } | ||
| this.valueHasMutated(); | ||
| }, | ||
| destroyAll(arrayOfValues) { | ||
| if (arrayOfValues === void 0) { | ||
| return this.destroy(function() { | ||
| return true; | ||
| }); | ||
| } | ||
| if (!arrayOfValues) { | ||
| return []; | ||
| } | ||
| return this.destroy(function(value) { | ||
| return arrayIndexOf(arrayOfValues, value) >= 0; | ||
| }); | ||
| }, | ||
| indexOf(item) { | ||
| return arrayIndexOf(this(), item); | ||
| }, | ||
| replace(oldItem, newItem) { | ||
| var index = this.indexOf(oldItem); | ||
| if (index >= 0) { | ||
| this.valueWillMutate(); | ||
| this.peek()[index] = newItem; | ||
| this.valueHasMutated(); | ||
| } | ||
| }, | ||
| sorted(compareFn) { | ||
| return [...this()].sort(compareFn); | ||
| }, | ||
| reversed() { | ||
| return [...this()].reverse(); | ||
| }, | ||
| [Symbol.iterator]: function* () { | ||
| yield* this(); | ||
| } | ||
| }; | ||
| Object.setPrototypeOf(observableArray.fn, observable.fn); | ||
| arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function(methodName) { | ||
| observableArray.fn[methodName] = function() { | ||
| var underlyingArray = this.peek(); | ||
| this.valueWillMutate(); | ||
| this.cacheDiffForKnownOperation(underlyingArray, methodName, arguments); | ||
| var methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments); | ||
| this.valueHasMutated(); | ||
| return methodCallResult === underlyingArray ? this : methodCallResult; | ||
| }; | ||
| }); | ||
| arrayForEach(["slice"], function(methodName) { | ||
| observableArray.fn[methodName] = function() { | ||
| var underlyingArray = this(); | ||
| return underlyingArray[methodName].apply(underlyingArray, arguments); | ||
| }; | ||
| }); | ||
| observableArray.trackArrayChanges = trackArrayChanges; | ||
| // ../computed/dist/computed.js | ||
| var computedState = createSymbolOrString("_state"); | ||
| var DISPOSED_STATE = { | ||
| dependencyTracking: null, | ||
| dependenciesCount: 0, | ||
| isDisposed: true, | ||
| isStale: false, | ||
| isDirty: false, | ||
| isSleeping: false, | ||
| disposeWhenNodeIsRemoved: null, | ||
| readFunction: null, | ||
| _options: null | ||
| }; | ||
| function computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget, options2) { | ||
| if (typeof evaluatorFunctionOrOptions === "object") { | ||
| options2 = evaluatorFunctionOrOptions; | ||
| } else { | ||
| options2 = options2 || {}; | ||
| if (evaluatorFunctionOrOptions) { | ||
| options2.read = evaluatorFunctionOrOptions; | ||
| } | ||
| } | ||
| if (typeof options2.read !== "function") { | ||
| throw Error("Pass a function that returns the value of the computed"); | ||
| } | ||
| var writeFunction = options2.write; | ||
| var state = { | ||
| latestValue: void 0, | ||
| isStale: true, | ||
| isDirty: true, | ||
| isBeingEvaluated: false, | ||
| suppressDisposalUntilDisposeWhenReturnsFalse: false, | ||
| isDisposed: false, | ||
| pure: false, | ||
| isSleeping: false, | ||
| readFunction: options2.read, | ||
| evaluatorFunctionTarget: evaluatorFunctionTarget || options2.owner, | ||
| disposeWhenNodeIsRemoved: options2.disposeWhenNodeIsRemoved || options2.disposeWhenNodeIsRemoved || null, | ||
| disposeWhen: options2.disposeWhen || options2.disposeWhen, | ||
| domNodeDisposalCallback: null, | ||
| dependencyTracking: {}, | ||
| dependenciesCount: 0, | ||
| evaluationTimeoutInstance: null | ||
| }; | ||
| function computedObservable() { | ||
| if (arguments.length > 0) { | ||
| if (typeof writeFunction === "function") { | ||
| writeFunction.apply(state.evaluatorFunctionTarget, arguments); | ||
| } else { | ||
| throw new Error("Cannot write a value to a computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."); | ||
| } | ||
| return this; | ||
| } else { | ||
| if (!state.isDisposed) { | ||
| dependencyDetection_exports.registerDependency(computedObservable); | ||
| } | ||
| if (state.isDirty || state.isSleeping && computedObservable.haveDependenciesChanged()) { | ||
| computedObservable.evaluateImmediate(); | ||
| } | ||
| return state.latestValue; | ||
| } | ||
| } | ||
| computedObservable[computedState] = state; | ||
| computedObservable.isWriteable = typeof writeFunction === "function"; | ||
| subscribable.fn.init(computedObservable); | ||
| Object.setPrototypeOf(computedObservable, computed.fn); | ||
| if (options2.pure) { | ||
| state.pure = true; | ||
| state.isSleeping = true; | ||
| extend(computedObservable, pureComputedOverrides); | ||
| } else if (options2.deferEvaluation) { | ||
| extend(computedObservable, deferEvaluationOverrides); | ||
| } | ||
| if (options_default.deferUpdates) { | ||
| extenders.deferred(computedObservable, true); | ||
| } | ||
| if (options_default.debug) { | ||
| computedObservable._options = options2; | ||
| } | ||
| if (state.disposeWhenNodeIsRemoved) { | ||
| state.suppressDisposalUntilDisposeWhenReturnsFalse = true; | ||
| if (!state.disposeWhenNodeIsRemoved.nodeType) { | ||
| state.disposeWhenNodeIsRemoved = null; | ||
| } | ||
| } | ||
| if (!state.isSleeping && !options2.deferEvaluation) { | ||
| computedObservable.evaluateImmediate(); | ||
| } | ||
| if (state.disposeWhenNodeIsRemoved && computedObservable.isActive()) { | ||
| addDisposeCallback(state.disposeWhenNodeIsRemoved, state.domNodeDisposalCallback = function() { | ||
| computedObservable.dispose(); | ||
| }); | ||
| } | ||
| return computedObservable; | ||
| } | ||
| function computedDisposeDependencyCallback(id, entryToDispose) { | ||
| if (entryToDispose !== null && entryToDispose.dispose) { | ||
| entryToDispose.dispose(); | ||
| } | ||
| } | ||
| function computedBeginDependencyDetectionCallback(subscribable2, id) { | ||
| var computedObservable = this.computedObservable, state = computedObservable[computedState]; | ||
| if (!state.isDisposed) { | ||
| if (this.disposalCount && this.disposalCandidates[id]) { | ||
| computedObservable.addDependencyTracking(id, subscribable2, this.disposalCandidates[id]); | ||
| this.disposalCandidates[id] = null; | ||
| --this.disposalCount; | ||
| } else if (!state.dependencyTracking[id]) { | ||
| computedObservable.addDependencyTracking(id, subscribable2, state.isSleeping ? { _target: subscribable2 } : computedObservable.subscribeToDependency(subscribable2)); | ||
| } | ||
| if (subscribable2._notificationIsPending) { | ||
| subscribable2._notifyNextChangeIfValueIsDifferent(); | ||
| } | ||
| } | ||
| } | ||
| computed.fn = { | ||
| equalityComparer: valuesArePrimitiveAndEqual, | ||
| getDependenciesCount() { | ||
| return this[computedState].dependenciesCount; | ||
| }, | ||
| getDependencies() { | ||
| const dependencyTracking = this[computedState].dependencyTracking; | ||
| const dependentObservables = []; | ||
| objectForEach(dependencyTracking, function(id, dependency) { | ||
| dependentObservables[dependency._order] = dependency._target; | ||
| }); | ||
| return dependentObservables; | ||
| }, | ||
| addDependencyTracking(id, target, trackingObj) { | ||
| if (this[computedState].pure && target === this) { | ||
| throw Error("A 'pure' computed must not be called recursively"); | ||
| } | ||
| this[computedState].dependencyTracking[id] = trackingObj; | ||
| trackingObj._order = this[computedState].dependenciesCount++; | ||
| trackingObj._version = target.getVersion(); | ||
| }, | ||
| haveDependenciesChanged() { | ||
| var id, dependency, dependencyTracking = this[computedState].dependencyTracking; | ||
| for (id in dependencyTracking) { | ||
| if (hasOwnProperty(dependencyTracking, id)) { | ||
| dependency = dependencyTracking[id]; | ||
| if (this._evalDelayed && dependency._target._notificationIsPending || dependency._target.hasChanged(dependency._version)) { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| markDirty() { | ||
| if (this._evalDelayed && !this[computedState].isBeingEvaluated) { | ||
| this._evalDelayed(false); | ||
| } | ||
| }, | ||
| isActive() { | ||
| const state = this[computedState]; | ||
| return state.isDirty || state.dependenciesCount > 0; | ||
| }, | ||
| respondToChange() { | ||
| if (!this._notificationIsPending) { | ||
| this.evaluatePossiblyAsync(); | ||
| } else if (this[computedState].isDirty) { | ||
| this[computedState].isStale = true; | ||
| } | ||
| }, | ||
| subscribeToDependency(target) { | ||
| if (target._deferUpdates) { | ||
| var dirtySub = target.subscribe(this.markDirty, this, "dirty"), changeSub = target.subscribe(this.respondToChange, this); | ||
| return { | ||
| _target: target, | ||
| dispose() { | ||
| dirtySub.dispose(); | ||
| changeSub.dispose(); | ||
| } | ||
| }; | ||
| } else { | ||
| return target.subscribe(this.evaluatePossiblyAsync, this); | ||
| } | ||
| }, | ||
| evaluatePossiblyAsync() { | ||
| var computedObservable = this, throttleEvaluationTimeout = computedObservable.throttleEvaluation; | ||
| if (throttleEvaluationTimeout && throttleEvaluationTimeout >= 0) { | ||
| clearTimeout(this[computedState].evaluationTimeoutInstance); | ||
| this[computedState].evaluationTimeoutInstance = safeSetTimeout(function() { | ||
| computedObservable.evaluateImmediate(true); | ||
| }, throttleEvaluationTimeout); | ||
| } else if (computedObservable._evalDelayed) { | ||
| computedObservable._evalDelayed(true); | ||
| } else { | ||
| computedObservable.evaluateImmediate(true); | ||
| } | ||
| }, | ||
| evaluateImmediate(notifyChange) { | ||
| var computedObservable = this, state = computedObservable[computedState], disposeWhen = state.disposeWhen, changed = false; | ||
| if (state.isBeingEvaluated) { | ||
| return; | ||
| } | ||
| if (state.isDisposed) { | ||
| return; | ||
| } | ||
| if (state.disposeWhenNodeIsRemoved && !domNodeIsAttachedToDocument(state.disposeWhenNodeIsRemoved) || disposeWhen && disposeWhen()) { | ||
| if (!state.suppressDisposalUntilDisposeWhenReturnsFalse) { | ||
| computedObservable.dispose(); | ||
| return; | ||
| } | ||
| } else { | ||
| state.suppressDisposalUntilDisposeWhenReturnsFalse = false; | ||
| } | ||
| state.isBeingEvaluated = true; | ||
| try { | ||
| changed = this.evaluateImmediate_CallReadWithDependencyDetection(notifyChange); | ||
| } finally { | ||
| state.isBeingEvaluated = false; | ||
| } | ||
| return changed; | ||
| }, | ||
| evaluateImmediate_CallReadWithDependencyDetection(notifyChange) { | ||
| var computedObservable = this, state = computedObservable[computedState], changed = false; | ||
| var isInitial2 = state.pure ? void 0 : !state.dependenciesCount, dependencyDetectionContext = { | ||
| computedObservable, | ||
| disposalCandidates: state.dependencyTracking, | ||
| disposalCount: state.dependenciesCount | ||
| }; | ||
| dependencyDetection_exports.begin({ | ||
| callbackTarget: dependencyDetectionContext, | ||
| callback: computedBeginDependencyDetectionCallback, | ||
| computed: computedObservable, | ||
| isInitial: isInitial2 | ||
| }); | ||
| state.dependencyTracking = {}; | ||
| state.dependenciesCount = 0; | ||
| var newValue = this.evaluateImmediate_CallReadThenEndDependencyDetection(state, dependencyDetectionContext); | ||
| if (!state.dependenciesCount) { | ||
| computedObservable.dispose(); | ||
| changed = true; | ||
| } else { | ||
| changed = computedObservable.isDifferent(state.latestValue, newValue); | ||
| } | ||
| if (changed) { | ||
| if (!state.isSleeping) { | ||
| computedObservable.notifySubscribers(state.latestValue, "beforeChange"); | ||
| } else { | ||
| computedObservable.updateVersion(); | ||
| } | ||
| state.latestValue = newValue; | ||
| if (options_default.debug) { | ||
| computedObservable._latestValue = newValue; | ||
| } | ||
| computedObservable.notifySubscribers(state.latestValue, "spectate"); | ||
| if (!state.isSleeping && notifyChange) { | ||
| computedObservable.notifySubscribers(state.latestValue); | ||
| } | ||
| if (computedObservable._recordUpdate) { | ||
| computedObservable._recordUpdate(); | ||
| } | ||
| } | ||
| if (isInitial2) { | ||
| computedObservable.notifySubscribers(state.latestValue, "awake"); | ||
| } | ||
| return changed; | ||
| }, | ||
| evaluateImmediate_CallReadThenEndDependencyDetection(state, dependencyDetectionContext) { | ||
| try { | ||
| var readFunction = state.readFunction; | ||
| return state.evaluatorFunctionTarget ? readFunction.call(state.evaluatorFunctionTarget) : readFunction(); | ||
| } finally { | ||
| dependencyDetection_exports.end(); | ||
| if (dependencyDetectionContext.disposalCount && !state.isSleeping) { | ||
| objectForEach(dependencyDetectionContext.disposalCandidates, computedDisposeDependencyCallback); | ||
| } | ||
| state.isStale = state.isDirty = false; | ||
| } | ||
| }, | ||
| peek(forceEvaluate) { | ||
| const state = this[computedState]; | ||
| if (state.isDirty && (forceEvaluate || !state.dependenciesCount) || state.isSleeping && this.haveDependenciesChanged()) { | ||
| this.evaluateImmediate(); | ||
| } | ||
| return state.latestValue; | ||
| }, | ||
| get [LATEST_VALUE]() { | ||
| return this.peek(); | ||
| }, | ||
| limit(limitFunction) { | ||
| const state = this[computedState]; | ||
| subscribable.fn.limit.call(this, limitFunction); | ||
| Object.assign(this, { | ||
| _evalIfChanged() { | ||
| if (!this[computedState].isSleeping) { | ||
| if (this[computedState].isStale) { | ||
| this.evaluateImmediate(); | ||
| } else { | ||
| this[computedState].isDirty = false; | ||
| } | ||
| } | ||
| return state.latestValue; | ||
| }, | ||
| _evalDelayed(isChange) { | ||
| this._limitBeforeChange(state.latestValue); | ||
| state.isDirty = true; | ||
| if (isChange) { | ||
| state.isStale = true; | ||
| } | ||
| this._limitChange(this, !isChange); | ||
| } | ||
| }); | ||
| }, | ||
| dispose() { | ||
| var state = this[computedState]; | ||
| if (!state.isSleeping && state.dependencyTracking) { | ||
| objectForEach(state.dependencyTracking, function(id, dependency) { | ||
| if (dependency.dispose) { | ||
| dependency.dispose(); | ||
| } | ||
| }); | ||
| } | ||
| if (state.disposeWhenNodeIsRemoved && state.domNodeDisposalCallback) { | ||
| removeDisposeCallback(state.disposeWhenNodeIsRemoved, state.domNodeDisposalCallback); | ||
| } | ||
| Object.assign(state, DISPOSED_STATE); | ||
| } | ||
| }; | ||
| var pureComputedOverrides = { | ||
| beforeSubscriptionAdd(event) { | ||
| var computedObservable = this, state = computedObservable[computedState]; | ||
| if (!state.isDisposed && state.isSleeping && event === "change") { | ||
| state.isSleeping = false; | ||
| if (state.isStale || computedObservable.haveDependenciesChanged()) { | ||
| state.dependencyTracking = null; | ||
| state.dependenciesCount = 0; | ||
| if (computedObservable.evaluateImmediate()) { | ||
| computedObservable.updateVersion(); | ||
| } | ||
| } else { | ||
| var dependenciesOrder = []; | ||
| objectForEach(state.dependencyTracking, function(id, dependency) { | ||
| dependenciesOrder[dependency._order] = id; | ||
| }); | ||
| arrayForEach(dependenciesOrder, function(id, order) { | ||
| var dependency = state.dependencyTracking[id], subscription = computedObservable.subscribeToDependency(dependency._target); | ||
| subscription._order = order; | ||
| subscription._version = dependency._version; | ||
| state.dependencyTracking[id] = subscription; | ||
| }); | ||
| if (computedObservable.haveDependenciesChanged()) { | ||
| if (computedObservable.evaluateImmediate()) { | ||
| computedObservable.updateVersion(); | ||
| } | ||
| } | ||
| } | ||
| if (!state.isDisposed) { | ||
| computedObservable.notifySubscribers(state.latestValue, "awake"); | ||
| } | ||
| } | ||
| }, | ||
| afterSubscriptionRemove(event) { | ||
| var state = this[computedState]; | ||
| if (!state.isDisposed && event === "change" && !this.hasSubscriptionsForEvent("change")) { | ||
| objectForEach(state.dependencyTracking, function(id, dependency) { | ||
| if (dependency.dispose) { | ||
| state.dependencyTracking[id] = { | ||
| _target: dependency._target, | ||
| _order: dependency._order, | ||
| _version: dependency._version | ||
| }; | ||
| dependency.dispose(); | ||
| } | ||
| }); | ||
| state.isSleeping = true; | ||
| this.notifySubscribers(void 0, "asleep"); | ||
| } | ||
| }, | ||
| getVersion() { | ||
| var state = this[computedState]; | ||
| if (state.isSleeping && (state.isStale || this.haveDependenciesChanged())) { | ||
| this.evaluateImmediate(); | ||
| } | ||
| return subscribable.fn.getVersion.call(this); | ||
| } | ||
| }; | ||
| var deferEvaluationOverrides = { | ||
| beforeSubscriptionAdd(event) { | ||
| if (event === "change" || event === "beforeChange") { | ||
| this.peek(); | ||
| } | ||
| } | ||
| }; | ||
| Object.setPrototypeOf(computed.fn, subscribable.fn); | ||
| var protoProp = observable.protoProperty; | ||
| computed.fn[protoProp] = computed; | ||
| observable.observablePrototypes.add(computed); | ||
| // ../computed/dist/throttleExtender.js | ||
| function throttleExtender(target, timeout) { | ||
| target.throttleEvaluation = timeout; | ||
| var writeTimeoutInstance = null; | ||
| return computed({ | ||
| read: target, | ||
| write: function(value) { | ||
| clearTimeout(writeTimeoutInstance); | ||
| writeTimeoutInstance = setTimeout(function() { | ||
| target(value); | ||
| }, timeout); | ||
| } | ||
| }); | ||
| } | ||
| extenders.throttle = throttleExtender; | ||
| // ../computed/dist/proxy.js | ||
| var PROXY_SYM = Symbol("Knockout Proxied Object"); | ||
| var MIRROR_SYM = Symbol("Knockout Proxied Observables"); | ||
| function makeComputed(proxy2, fn) { | ||
| return computed({ | ||
| owner: proxy2, | ||
| read: fn, | ||
| write: fn, | ||
| pure: "pure" in fn ? fn.pure : true, | ||
| deferEvaluation: "deferEvaluation" in fn ? fn.deferEvaluation : true | ||
| }).extend({ deferred: true }); | ||
| } | ||
| function setOrCreate(mirror, prop, value, proxy2) { | ||
| if (!mirror[prop]) { | ||
| const ctr = Array.isArray(value) ? observableArray : typeof value === "function" ? makeComputed.bind(null, proxy2) : observable; | ||
| mirror[prop] = ctr(value); | ||
| } else { | ||
| mirror[prop](value); | ||
| } | ||
| } | ||
| function assignOrUpdate(mirror, object, proxy2) { | ||
| for (const key of Object.keys(object)) { | ||
| setOrCreate(mirror, key, object[key], proxy2); | ||
| } | ||
| return object; | ||
| } | ||
| function proxy(object) { | ||
| const mirror = { [PROXY_SYM]: object }; | ||
| mirror[MIRROR_SYM] = mirror; | ||
| const proxy2 = new Proxy(function() { | ||
| }, { | ||
| has(target, prop) { | ||
| return prop in mirror; | ||
| }, | ||
| get(target, prop) { | ||
| return unwrap(mirror[prop]); | ||
| }, | ||
| set(target, prop, value, receiver) { | ||
| setOrCreate(mirror, prop, value, proxy2); | ||
| object[prop] = value; | ||
| return true; | ||
| }, | ||
| deleteProperty(property) { | ||
| delete mirror[property]; | ||
| return delete object[property]; | ||
| }, | ||
| apply(target, thisArg, [props]) { | ||
| if (props) { | ||
| assignOrUpdate(mirror, props, proxy2); | ||
| return Object.assign(object, props); | ||
| } | ||
| return object; | ||
| }, | ||
| getPrototypeOf() { | ||
| return Object.getPrototypeOf(object); | ||
| }, | ||
| setPrototypeOf(target, proto) { | ||
| return Object.setPrototypeOf(object, proto); | ||
| }, | ||
| defineProperty(target, prop, desc) { | ||
| return Object.defineProperty(object, prop, desc); | ||
| }, | ||
| preventExtensions() { | ||
| return Object.preventExtensions(object); | ||
| }, | ||
| isExtensible() { | ||
| return Object.isExtensible(object); | ||
| }, | ||
| ownKeys() { | ||
| return [ | ||
| ...Object.getOwnPropertyNames(object), | ||
| ...Object.getOwnPropertySymbols(object) | ||
| ]; | ||
| } | ||
| }); | ||
| assignOrUpdate(mirror, object, proxy2); | ||
| return proxy2; | ||
| } | ||
| function getObservable(proxied, prop) { | ||
| return proxied[MIRROR_SYM][prop]; | ||
| } | ||
| function peek2(proxied, prop) { | ||
| return getObservable(proxied, prop).peek(); | ||
| } | ||
| function isProxied(proxied) { | ||
| return PROXY_SYM in proxied; | ||
| } | ||
| Object.assign(proxy, { getObservable, peek: peek2, isProxied }); | ||
| // src/LifeCycle.ts | ||
| var SUBSCRIPTIONS = createSymbolOrString("LifeCycle Subscriptions List"); | ||
| var ANCHOR_NODE = createSymbolOrString("LifeCycle Anchor Node"); | ||
| var LifeCycle = class { | ||
| static mixInto(Constructor) { | ||
| const target = Constructor.prototype || Constructor; | ||
| const mixin = LifeCycle.prototype; | ||
| for (let prop of Object.getOwnPropertyNames(mixin)) { | ||
| target[prop] = mixin[prop]; | ||
| } | ||
| } | ||
| subscribe(observable2, action, subscriptionType) { | ||
| if (typeof action === "string") { | ||
| action = this[action]; | ||
| } | ||
| this.addDisposable(observable2.subscribe(action, this, subscriptionType)); | ||
| } | ||
| computed(params) { | ||
| if (typeof params === "string") { | ||
| params = { read: this[params], write: this[params] }; | ||
| } | ||
| if (typeof params === "object") { | ||
| params = Object.assign({ owner: this }, params); | ||
| } else if (typeof params === "function") { | ||
| const proto = Object.getPrototypeOf(this); | ||
| if (proto && proto[params.name] === params) { | ||
| params = params.bind(this); | ||
| } | ||
| params = { read: params, write: params }; | ||
| } else { | ||
| throw new Error("LifeCycle::computed not given a valid type."); | ||
| } | ||
| params.disposeWhenNodeIsRemoved = this[ANCHOR_NODE]; | ||
| return this.addDisposable(computed(params)); | ||
| } | ||
| addEventListener(...args) { | ||
| const node = args[0].nodeType ? args.shift() : this[ANCHOR_NODE]; | ||
| const [type, act, options2] = args; | ||
| const handler = typeof act === "string" ? this[act].bind(this) : act; | ||
| this.__addEventListener(node, type, handler, options2); | ||
| } | ||
| __addEventListener(node, eventType, handler, options2) { | ||
| node.addEventListener(eventType, handler, options2); | ||
| function dispose() { | ||
| node.removeEventListener(eventType, handler); | ||
| } | ||
| addDisposeCallback(node, dispose); | ||
| this.addDisposable({ dispose }); | ||
| } | ||
| anchorTo(nodeOrLifeCycle) { | ||
| if ("addDisposable" in nodeOrLifeCycle) { | ||
| nodeOrLifeCycle.addDisposable(this); | ||
| this[ANCHOR_NODE] = null; | ||
| } else { | ||
| this[ANCHOR_NODE] = nodeOrLifeCycle; | ||
| addDisposeCallback(nodeOrLifeCycle, () => this[ANCHOR_NODE] === nodeOrLifeCycle && this.dispose()); | ||
| } | ||
| } | ||
| dispose() { | ||
| const subscriptions = this[SUBSCRIPTIONS] || []; | ||
| subscriptions.forEach((s) => s.dispose()); | ||
| this[SUBSCRIPTIONS] = []; | ||
| this[ANCHOR_NODE] = null; | ||
| } | ||
| addDisposable(subscription) { | ||
| const subscriptions = this[SUBSCRIPTIONS] || []; | ||
| if (!this[SUBSCRIPTIONS]) { | ||
| this[SUBSCRIPTIONS] = subscriptions; | ||
| } | ||
| if (typeof subscription.dispose !== "function") { | ||
| throw new Error("Lifecycle::addDisposable argument missing `dispose`."); | ||
| } | ||
| subscriptions.push(subscription); | ||
| return subscription; | ||
| } | ||
| }; |
Sorry, the diff of this file is too big to display
| // @tko/lifecycle 🥊 4.0.0-beta1.0 ESM | ||
| export { default as LifeCycle } from "./LifeCycle"; |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["\nexport {default as LifeCycle} from './LifeCycle'\n"], | ||
| "mappings": ";AACA;", | ||
| "names": [] | ||
| } |
| // @tko/lifecycle 🥊 4.0.0-beta1.0 MJS | ||
| export { default as LifeCycle } from "./LifeCycle"; |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["\nexport {default as LifeCycle} from './LifeCycle'\n"], | ||
| "mappings": ";AACA;", | ||
| "names": [] | ||
| } |
| "use strict"; | ||
| // @tko/lifecycle 🥊 4.0.0-beta1.0 ESM | ||
| import { | ||
| addDisposeCallback, | ||
| createSymbolOrString | ||
| } from "@tko/utils"; | ||
| import { | ||
| computed | ||
| } from "@tko/computed"; | ||
| const SUBSCRIPTIONS = createSymbolOrString("LifeCycle Subscriptions List"); | ||
| const ANCHOR_NODE = createSymbolOrString("LifeCycle Anchor Node"); | ||
| export default class LifeCycle { | ||
| static mixInto(Constructor) { | ||
| const target = Constructor.prototype || Constructor; | ||
| const mixin = LifeCycle.prototype; | ||
| for (let prop of Object.getOwnPropertyNames(mixin)) { | ||
| target[prop] = mixin[prop]; | ||
| } | ||
| } | ||
| subscribe(observable, action, subscriptionType) { | ||
| if (typeof action === "string") { | ||
| action = this[action]; | ||
| } | ||
| this.addDisposable(observable.subscribe(action, this, subscriptionType)); | ||
| } | ||
| computed(params) { | ||
| if (typeof params === "string") { | ||
| params = { read: this[params], write: this[params] }; | ||
| } | ||
| if (typeof params === "object") { | ||
| params = Object.assign({ owner: this }, params); | ||
| } else if (typeof params === "function") { | ||
| const proto = Object.getPrototypeOf(this); | ||
| if (proto && proto[params.name] === params) { | ||
| params = params.bind(this); | ||
| } | ||
| params = { read: params, write: params }; | ||
| } else { | ||
| throw new Error("LifeCycle::computed not given a valid type."); | ||
| } | ||
| params.disposeWhenNodeIsRemoved = this[ANCHOR_NODE]; | ||
| return this.addDisposable(computed(params)); | ||
| } | ||
| addEventListener(...args) { | ||
| const node = args[0].nodeType ? args.shift() : this[ANCHOR_NODE]; | ||
| const [type, act, options] = args; | ||
| const handler = typeof act === "string" ? this[act].bind(this) : act; | ||
| this.__addEventListener(node, type, handler, options); | ||
| } | ||
| __addEventListener(node, eventType, handler, options) { | ||
| node.addEventListener(eventType, handler, options); | ||
| function dispose() { | ||
| node.removeEventListener(eventType, handler); | ||
| } | ||
| addDisposeCallback(node, dispose); | ||
| this.addDisposable({ dispose }); | ||
| } | ||
| anchorTo(nodeOrLifeCycle) { | ||
| if ("addDisposable" in nodeOrLifeCycle) { | ||
| nodeOrLifeCycle.addDisposable(this); | ||
| this[ANCHOR_NODE] = null; | ||
| } else { | ||
| this[ANCHOR_NODE] = nodeOrLifeCycle; | ||
| addDisposeCallback(nodeOrLifeCycle, () => this[ANCHOR_NODE] === nodeOrLifeCycle && this.dispose()); | ||
| } | ||
| } | ||
| dispose() { | ||
| const subscriptions = this[SUBSCRIPTIONS] || []; | ||
| subscriptions.forEach((s) => s.dispose()); | ||
| this[SUBSCRIPTIONS] = []; | ||
| this[ANCHOR_NODE] = null; | ||
| } | ||
| addDisposable(subscription) { | ||
| const subscriptions = this[SUBSCRIPTIONS] || []; | ||
| if (!this[SUBSCRIPTIONS]) { | ||
| this[SUBSCRIPTIONS] = subscriptions; | ||
| } | ||
| if (typeof subscription.dispose !== "function") { | ||
| throw new Error("Lifecycle::addDisposable argument missing `dispose`."); | ||
| } | ||
| subscriptions.push(subscription); | ||
| return subscription; | ||
| } | ||
| } |
| { | ||
| "version": 3, | ||
| "sources": ["../src/LifeCycle.ts"], | ||
| "sourcesContent": ["'use strict'\n\nimport {\n addDisposeCallback, createSymbolOrString\n} from '@tko/utils'\n\nimport {\n computed\n} from '@tko/computed'\n\nconst SUBSCRIPTIONS = createSymbolOrString('LifeCycle Subscriptions List')\nconst ANCHOR_NODE = createSymbolOrString('LifeCycle Anchor Node')\n\nexport default class LifeCycle {\n // NOTE: For more advanced integration as an ES6 mixin, see e.g.:\n // http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/\n\n /**\n * Copy the properties of the LifeCycle class to the target (or its prototype)\n *\n * NOTE: getOwnPropertyNames is needed to copy the non-enumerable properties.\n */\n static mixInto (Constructor) {\n const target = Constructor.prototype || Constructor\n const mixin = LifeCycle.prototype\n for (let prop of Object.getOwnPropertyNames(mixin)) {\n target[prop] = mixin[prop]\n }\n }\n\n subscribe (observable, action, subscriptionType) {\n if (typeof action === 'string') { action = this[action] }\n this.addDisposable(observable.subscribe(action, this, subscriptionType))\n }\n\n computed (params) {\n if (typeof params === 'string') {\n params = { read: this[params], write: this[params] }\n }\n\n if (typeof params === 'object') {\n params = Object.assign({ owner: this }, params)\n } else if (typeof params === 'function') {\n const proto = Object.getPrototypeOf(this)\n if (proto && proto[params.name] === params) { params = params.bind(this) }\n params = { read: params, write: params }\n } else {\n throw new Error('LifeCycle::computed not given a valid type.')\n }\n\n params.disposeWhenNodeIsRemoved = this[ANCHOR_NODE]\n return this.addDisposable(computed(params))\n }\n\n /**\n * Add an event listener for the given or anchored node.\n * @param {node} [node] (optional) The target node (otherwise the anchored node)\n * @param {string} [type] Event type\n * @param {function|string} [action] Either call the given function or `this[action]`\n * @param {object} [options] (optional) Passed as `options` to `node.addEventListener`\n */\n addEventListener (...args) {\n const node = args[0].nodeType ? args.shift() : this[ANCHOR_NODE]\n const [type, act, options] = args\n const handler = typeof act === 'string' ? this[act].bind(this) : act\n this.__addEventListener(node, type, handler, options)\n }\n\n __addEventListener (node, eventType, handler, options) {\n node.addEventListener(eventType, handler, options)\n function dispose () { node.removeEventListener(eventType, handler) }\n addDisposeCallback(node, dispose)\n this.addDisposable({ dispose })\n }\n\n anchorTo (nodeOrLifeCycle) {\n if ('addDisposable' in nodeOrLifeCycle) {\n nodeOrLifeCycle.addDisposable(this)\n this[ANCHOR_NODE] = null // re-anchor on `anchorTo` calls\n } else {\n this[ANCHOR_NODE] = nodeOrLifeCycle\n addDisposeCallback(nodeOrLifeCycle, () => this[ANCHOR_NODE] === nodeOrLifeCycle && this.dispose())\n }\n }\n\n dispose () {\n const subscriptions = this[SUBSCRIPTIONS] || []\n subscriptions.forEach(s => s.dispose())\n this[SUBSCRIPTIONS] = []\n this[ANCHOR_NODE] = null\n }\n\n addDisposable (subscription) {\n const subscriptions = this[SUBSCRIPTIONS] || []\n if (!this[SUBSCRIPTIONS]) { this[SUBSCRIPTIONS] = subscriptions }\n if (typeof subscription.dispose !== 'function') {\n throw new Error('Lifecycle::addDisposable argument missing `dispose`.')\n }\n subscriptions.push(subscription)\n return subscription\n }\n}\n"], | ||
| "mappings": ";;AAEA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIA,MAAM,gBAAgB,qBAAqB,8BAA8B;AACzE,MAAM,cAAc,qBAAqB,uBAAuB;AAEhE,qBAAqB,UAAU;AAAA,SAStB,QAAS,aAAa;AAC3B,UAAM,SAAS,YAAY,aAAa;AACxC,UAAM,QAAQ,UAAU;AACxB,aAAS,QAAQ,OAAO,oBAAoB,KAAK,GAAG;AAClD,aAAO,QAAQ,MAAM;AAAA,IACvB;AAAA,EACF;AAAA,EAEA,UAAW,YAAY,QAAQ,kBAAkB;AAC/C,QAAI,OAAO,WAAW,UAAU;AAAE,eAAS,KAAK;AAAA,IAAQ;AACxD,SAAK,cAAc,WAAW,UAAU,QAAQ,MAAM,gBAAgB,CAAC;AAAA,EACzE;AAAA,EAEA,SAAU,QAAQ;AAChB,QAAI,OAAO,WAAW,UAAU;AAC9B,eAAS,EAAE,MAAM,KAAK,SAAS,OAAO,KAAK,QAAQ;AAAA,IACrD;AAEA,QAAI,OAAO,WAAW,UAAU;AAC9B,eAAS,OAAO,OAAO,EAAE,OAAO,KAAK,GAAG,MAAM;AAAA,IAChD,WAAW,OAAO,WAAW,YAAY;AACvC,YAAM,QAAQ,OAAO,eAAe,IAAI;AACxC,UAAI,SAAS,MAAM,OAAO,UAAU,QAAQ;AAAE,iBAAS,OAAO,KAAK,IAAI;AAAA,MAAE;AACzE,eAAS,EAAE,MAAM,QAAQ,OAAO,OAAO;AAAA,IACzC,OAAO;AACL,YAAM,IAAI,MAAM,6CAA6C;AAAA,IAC/D;AAEA,WAAO,2BAA2B,KAAK;AACvC,WAAO,KAAK,cAAc,SAAS,MAAM,CAAC;AAAA,EAC5C;AAAA,EASA,oBAAqB,MAAM;AACzB,UAAM,OAAO,KAAK,GAAG,WAAW,KAAK,MAAM,IAAI,KAAK;AACpD,UAAM,CAAC,MAAM,KAAK,WAAW;AAC7B,UAAM,UAAU,OAAO,QAAQ,WAAW,KAAK,KAAK,KAAK,IAAI,IAAI;AACjE,SAAK,mBAAmB,MAAM,MAAM,SAAS,OAAO;AAAA,EACtD;AAAA,EAEA,mBAAoB,MAAM,WAAW,SAAS,SAAS;AACrD,SAAK,iBAAiB,WAAW,SAAS,OAAO;AACjD,uBAAoB;AAAE,WAAK,oBAAoB,WAAW,OAAO;AAAA,IAAE;AACnE,uBAAmB,MAAM,OAAO;AAChC,SAAK,cAAc,EAAE,QAAQ,CAAC;AAAA,EAChC;AAAA,EAEA,SAAU,iBAAiB;AACzB,QAAI,mBAAmB,iBAAiB;AACtC,sBAAgB,cAAc,IAAI;AAClC,WAAK,eAAe;AAAA,IACtB,OAAO;AACL,WAAK,eAAe;AACpB,yBAAmB,iBAAiB,MAAM,KAAK,iBAAiB,mBAAmB,KAAK,QAAQ,CAAC;AAAA,IACnG;AAAA,EACF;AAAA,EAEA,UAAW;AACT,UAAM,gBAAgB,KAAK,kBAAkB,CAAC;AAC9C,kBAAc,QAAQ,OAAK,EAAE,QAAQ,CAAC;AACtC,SAAK,iBAAiB,CAAC;AACvB,SAAK,eAAe;AAAA,EACtB;AAAA,EAEA,cAAe,cAAc;AAC3B,UAAM,gBAAgB,KAAK,kBAAkB,CAAC;AAC9C,QAAI,CAAC,KAAK,gBAAgB;AAAE,WAAK,iBAAiB;AAAA,IAAc;AAChE,QAAI,OAAO,aAAa,YAAY,YAAY;AAC9C,YAAM,IAAI,MAAM,sDAAsD;AAAA,IACxE;AACA,kBAAc,KAAK,YAAY;AAC/B,WAAO;AAAA,EACT;AACF;", | ||
| "names": [] | ||
| } |
+22
-26
| { | ||
| "version": "4.0.0-beta1.0", | ||
| "module": "dist/lifecycle.js", | ||
| "dependencies": { | ||
| "@tko/computed": "^4.0.0-alpha8.0", | ||
| "@tko/utils": "^4.0.0-alpha8.0", | ||
| "tslib": "^1.8.0" | ||
| "@tko/computed": "^4.0.0-beta1.0", | ||
| "@tko/utils": "^4.0.0-beta1.0", | ||
| "tslib": "^2.2.0" | ||
| }, | ||
| "devDependencies": { | ||
| "peerDependencies": { | ||
| "@tko/observable": "^4.0.0-alpha8.0" | ||
@@ -16,6 +17,8 @@ }, | ||
| "name": "@tko/lifecycle", | ||
| "version": "4.0.0-alpha9.0", | ||
| "description": "Knockout LifeCycle for object instances", | ||
| "repository": "git@github.com:knockout/tko.lifecycle.git", | ||
| "author": "Knockout Team", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/knockout/tko.git" | ||
| }, | ||
| "author": "The Knockout Team", | ||
| "license": "MIT", | ||
@@ -28,19 +31,2 @@ "karma": { | ||
| }, | ||
| "__about__shared.package.json": "These properties are copied into all packages/*/package.json. Run `yarn repackage`", | ||
| "standard": { | ||
| "env": [ | ||
| "browser", | ||
| "jasmine", | ||
| "mocha" | ||
| ] | ||
| }, | ||
| "scripts": { | ||
| "test": "npx karma start ../../karma.conf.js --once", | ||
| "build": "npx rollup -c ../../rollup.config.js", | ||
| "watch": "npx karma start ../../karma.conf.js", | ||
| "prepare": "npx rollup -c ../../rollup.config.js" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "homepage": "https://tko.io", | ||
@@ -50,6 +36,16 @@ "licenses": [ | ||
| "type": "MIT", | ||
| "url": "http://www.opensource.org/licenses/mit-license.php" | ||
| "url": "https://opensource.org/licenses/MIT" | ||
| } | ||
| ], | ||
| "gitHead": "90cdb597db01d50725c567810af092e70a5b32d9" | ||
| "exports": { | ||
| ".": { | ||
| "require": "./dist/index.cjs", | ||
| "import": "./dist/index.js" | ||
| }, | ||
| "./helpers/*": "./helpers/*" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/knockout/tko/issues" | ||
| }, | ||
| "gitHead": "99114c4deded3fc5dbddd5c7c9c63c845a18263b" | ||
| } |
| /*! | ||
| * Knockout LifeCycle for object instances 🥊 @tko/lifecycle@4.0.0-alpha9.0 | ||
| * (c) The Knockout.js Team - https://tko.io | ||
| * License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
| */ | ||
| import { addDisposeCallback, createSymbolOrString } from '@tko/utils'; | ||
| import { computed } from '@tko/computed'; | ||
| const SUBSCRIPTIONS = createSymbolOrString('LifeCycle Subscriptions List'); | ||
| const ANCHOR_NODE = createSymbolOrString('LifeCycle Anchor Node'); | ||
| class LifeCycle { | ||
| // NOTE: For more advanced integration as an ES6 mixin, see e.g.: | ||
| // http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/ | ||
| /** | ||
| * Copy the properties of the LifeCycle class to the target (or its prototype) | ||
| * | ||
| * NOTE: getOwnPropertyNames is needed to copy the non-enumerable properties. | ||
| */ | ||
| static mixInto (Constructor) { | ||
| const target = Constructor.prototype || Constructor; | ||
| const mixin = LifeCycle.prototype; | ||
| for (let prop of Object.getOwnPropertyNames(mixin)) { | ||
| target[prop] = mixin[prop]; | ||
| } | ||
| } | ||
| subscribe (observable, action, subscriptionType) { | ||
| if (typeof action === 'string') { action = this[action]; } | ||
| this.addDisposable(observable.subscribe(action, this, subscriptionType)); | ||
| } | ||
| computed (params) { | ||
| if (typeof params === 'string') { | ||
| params = { read: this[params], write: this[params] }; | ||
| } | ||
| if (typeof params === 'object') { | ||
| params = Object.assign({ owner: this }, params); | ||
| } else if (typeof params === 'function') { | ||
| const proto = Object.getPrototypeOf(this); | ||
| if (proto && proto[params.name] === params) { params = params.bind(this); } | ||
| params = { read: params, write: params }; | ||
| } else { | ||
| throw new Error('LifeCycle::computed not given a valid type.') | ||
| } | ||
| params.disposeWhenNodeIsRemoved = this[ANCHOR_NODE]; | ||
| return this.addDisposable(computed(params)) | ||
| } | ||
| /** | ||
| * Add an event listener for the given or anchored node. | ||
| * @param {node} [node] (optional) The target node (otherwise the anchored node) | ||
| * @param {string} [type] Event type | ||
| * @param {function|string} [action] Either call the given function or `this[action]` | ||
| * @param {object} [options] (optional) Passed as `options` to `node.addEventListener` | ||
| */ | ||
| addEventListener (...args) { | ||
| const node = args[0].nodeType ? args.shift() : this[ANCHOR_NODE]; | ||
| const [type, act, options] = args; | ||
| const handler = typeof act === 'string' ? this[act].bind(this) : act; | ||
| this.__addEventListener(node, type, handler, options); | ||
| } | ||
| __addEventListener (node, eventType, handler, options) { | ||
| node.addEventListener(eventType, handler, options); | ||
| function dispose () { node.removeEventListener(eventType, handler); } | ||
| addDisposeCallback(node, dispose); | ||
| this.addDisposable({ dispose }); | ||
| } | ||
| anchorTo (nodeOrLifeCycle) { | ||
| if ('addDisposable' in nodeOrLifeCycle) { | ||
| nodeOrLifeCycle.addDisposable(this); | ||
| this[ANCHOR_NODE] = null; // re-anchor on `anchorTo` calls | ||
| } else { | ||
| this[ANCHOR_NODE] = nodeOrLifeCycle; | ||
| addDisposeCallback(nodeOrLifeCycle, () => this[ANCHOR_NODE] === nodeOrLifeCycle && this.dispose()); | ||
| } | ||
| } | ||
| dispose () { | ||
| const subscriptions = this[SUBSCRIPTIONS] || []; | ||
| subscriptions.forEach(s => s.dispose()); | ||
| this[SUBSCRIPTIONS] = []; | ||
| this[ANCHOR_NODE] = null; | ||
| } | ||
| addDisposable (subscription) { | ||
| const subscriptions = this[SUBSCRIPTIONS] || []; | ||
| if (!this[SUBSCRIPTIONS]) { this[SUBSCRIPTIONS] = subscriptions; } | ||
| if (typeof subscription.dispose !== 'function') { | ||
| throw new Error('Lifecycle::addDisposable argument missing `dispose`.') | ||
| } | ||
| subscriptions.push(subscription); | ||
| return subscription | ||
| } | ||
| } | ||
| export { LifeCycle }; | ||
| //# sourceMappingURL=lifecycle.es6.js.map |
| {"version":3,"file":"lifecycle.es6.js","sources":["../src/LifeCycle.js"],"sourcesContent":["'use strict'\n\nimport {\n addDisposeCallback, createSymbolOrString\n} from '@tko/utils'\n\nimport {\n computed\n} from '@tko/computed'\n\nconst SUBSCRIPTIONS = createSymbolOrString('LifeCycle Subscriptions List')\nconst ANCHOR_NODE = createSymbolOrString('LifeCycle Anchor Node')\n\nexport default class LifeCycle {\n // NOTE: For more advanced integration as an ES6 mixin, see e.g.:\n // http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/\n\n /**\n * Copy the properties of the LifeCycle class to the target (or its prototype)\n *\n * NOTE: getOwnPropertyNames is needed to copy the non-enumerable properties.\n */\n static mixInto (Constructor) {\n const target = Constructor.prototype || Constructor\n const mixin = LifeCycle.prototype\n for (let prop of Object.getOwnPropertyNames(mixin)) {\n target[prop] = mixin[prop]\n }\n }\n\n subscribe (observable, action, subscriptionType) {\n if (typeof action === 'string') { action = this[action] }\n this.addDisposable(observable.subscribe(action, this, subscriptionType))\n }\n\n computed (params) {\n if (typeof params === 'string') {\n params = { read: this[params], write: this[params] }\n }\n\n if (typeof params === 'object') {\n params = Object.assign({ owner: this }, params)\n } else if (typeof params === 'function') {\n const proto = Object.getPrototypeOf(this)\n if (proto && proto[params.name] === params) { params = params.bind(this) }\n params = { read: params, write: params }\n } else {\n throw new Error('LifeCycle::computed not given a valid type.')\n }\n\n params.disposeWhenNodeIsRemoved = this[ANCHOR_NODE]\n return this.addDisposable(computed(params))\n }\n\n /**\n * Add an event listener for the given or anchored node.\n * @param {node} [node] (optional) The target node (otherwise the anchored node)\n * @param {string} [type] Event type\n * @param {function|string} [action] Either call the given function or `this[action]`\n * @param {object} [options] (optional) Passed as `options` to `node.addEventListener`\n */\n addEventListener (...args) {\n const node = args[0].nodeType ? args.shift() : this[ANCHOR_NODE]\n const [type, act, options] = args\n const handler = typeof act === 'string' ? this[act].bind(this) : act\n this.__addEventListener(node, type, handler, options)\n }\n\n __addEventListener (node, eventType, handler, options) {\n node.addEventListener(eventType, handler, options)\n function dispose () { node.removeEventListener(eventType, handler) }\n addDisposeCallback(node, dispose)\n this.addDisposable({ dispose })\n }\n\n anchorTo (nodeOrLifeCycle) {\n if ('addDisposable' in nodeOrLifeCycle) {\n nodeOrLifeCycle.addDisposable(this)\n this[ANCHOR_NODE] = null // re-anchor on `anchorTo` calls\n } else {\n this[ANCHOR_NODE] = nodeOrLifeCycle\n addDisposeCallback(nodeOrLifeCycle, () => this[ANCHOR_NODE] === nodeOrLifeCycle && this.dispose())\n }\n }\n\n dispose () {\n const subscriptions = this[SUBSCRIPTIONS] || []\n subscriptions.forEach(s => s.dispose())\n this[SUBSCRIPTIONS] = []\n this[ANCHOR_NODE] = null\n }\n\n addDisposable (subscription) {\n const subscriptions = this[SUBSCRIPTIONS] || []\n if (!this[SUBSCRIPTIONS]) { this[SUBSCRIPTIONS] = subscriptions }\n if (typeof subscription.dispose !== 'function') {\n throw new Error('Lifecycle::addDisposable argument missing `dispose`.')\n }\n subscriptions.push(subscription)\n return subscription\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAUA,MAAM,aAAa,GAAG,oBAAoB,CAAC,8BAA8B,EAAC;AAC1E,MAAM,WAAW,GAAG,oBAAoB,CAAC,uBAAuB,EAAC;;AAEjE,MAAqB,SAAS,CAAC;;;;;;;;;EAS7B,OAAO,OAAO,CAAC,CAAC,WAAW,EAAE;IAC3B,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,IAAI,YAAW;IACnD,MAAM,KAAK,GAAG,SAAS,CAAC,UAAS;IACjC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE;MAClD,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,EAAC;KAC3B;GACF;;EAED,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAC/C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,EAAC,EAAE;IACzD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAC;GACzE;;EAED,QAAQ,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;MAC9B,MAAM,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAE;KACrD;;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;MAC9B,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EAAC;KAChD,MAAM,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;MACvC,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAC;MACzC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,MAAM,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAC,EAAE;MAC1E,MAAM,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAE;KACzC,MAAM;MACL,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC;KAC/D;;IAED,MAAM,CAAC,wBAAwB,GAAG,IAAI,CAAC,WAAW,EAAC;IACnD,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;GAC5C;;;;;;;;;EASD,gBAAgB,CAAC,CAAC,GAAG,IAAI,EAAE;IACzB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAC;IAChE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,KAAI;IACjC,MAAM,OAAO,GAAG,OAAO,GAAG,KAAK,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAG;IACpE,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAC;GACtD;;EAED,kBAAkB,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE;IACrD,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAC;IAClD,SAAS,OAAO,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,EAAC,EAAE;IACpE,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAC;IACjC,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,EAAC;GAChC;;EAED,QAAQ,CAAC,CAAC,eAAe,EAAE;IACzB,IAAI,eAAe,IAAI,eAAe,EAAE;MACtC,eAAe,CAAC,aAAa,CAAC,IAAI,EAAC;MACnC,IAAI,CAAC,WAAW,CAAC,GAAG,KAAI;KACzB,MAAM;MACL,IAAI,CAAC,WAAW,CAAC,GAAG,gBAAe;MACnC,kBAAkB,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,eAAe,IAAI,IAAI,CAAC,OAAO,EAAE,EAAC;KACnG;GACF;;EAED,OAAO,CAAC,GAAG;IACT,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,GAAE;IAC/C,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAC;IACvC,IAAI,CAAC,aAAa,CAAC,GAAG,GAAE;IACxB,IAAI,CAAC,WAAW,CAAC,GAAG,KAAI;GACzB;;EAED,aAAa,CAAC,CAAC,YAAY,EAAE;IAC3B,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,GAAE;IAC/C,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,cAAa,EAAE;IACjE,IAAI,OAAO,YAAY,CAAC,OAAO,KAAK,UAAU,EAAE;MAC9C,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC;KACxE;IACD,aAAa,CAAC,IAAI,CAAC,YAAY,EAAC;IAChC,OAAO,YAAY;GACpB;CACF;;"} |
| /*! | ||
| * Knockout LifeCycle for object instances 🥊 @tko/lifecycle@4.0.0-alpha9.0 | ||
| * (c) The Knockout.js Team - https://tko.io | ||
| * License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
| */ | ||
| import { addDisposeCallback, createSymbolOrString } from '@tko/utils'; | ||
| import { computed } from '@tko/computed'; | ||
| /*! ***************************************************************************** | ||
| Copyright (c) Microsoft Corporation. All rights reserved. | ||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
| this file except in compliance with the License. You may obtain a copy of the | ||
| License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
| WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
| MERCHANTABLITY OR NON-INFRINGEMENT. | ||
| See the Apache Version 2.0 License for specific language governing permissions | ||
| and limitations under the License. | ||
| ***************************************************************************** */ | ||
| function __values(o) { | ||
| var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
| if (m) return m.call(o); | ||
| return { | ||
| next: function () { | ||
| if (o && i >= o.length) o = void 0; | ||
| return { value: o && o[i++], done: !o }; | ||
| } | ||
| }; | ||
| } | ||
| function __read(o, n) { | ||
| var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
| if (!m) return o; | ||
| var i = m.call(o), r, ar = [], e; | ||
| try { | ||
| while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
| } | ||
| catch (error) { e = { error: error }; } | ||
| finally { | ||
| try { | ||
| if (r && !r.done && (m = i["return"])) m.call(i); | ||
| } | ||
| finally { if (e) throw e.error; } | ||
| } | ||
| return ar; | ||
| } | ||
| var SUBSCRIPTIONS = createSymbolOrString('LifeCycle Subscriptions List'); | ||
| var ANCHOR_NODE = createSymbolOrString('LifeCycle Anchor Node'); | ||
| var LifeCycle = /** @class */ (function () { | ||
| function LifeCycle() { | ||
| } | ||
| // NOTE: For more advanced integration as an ES6 mixin, see e.g.: | ||
| // http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/ | ||
| /** | ||
| * Copy the properties of the LifeCycle class to the target (or its prototype) | ||
| * | ||
| * NOTE: getOwnPropertyNames is needed to copy the non-enumerable properties. | ||
| */ | ||
| LifeCycle.mixInto = function (Constructor) { | ||
| var e_1, _a; | ||
| var target = Constructor.prototype || Constructor; | ||
| var mixin = LifeCycle.prototype; | ||
| try { | ||
| for (var _b = __values(Object.getOwnPropertyNames(mixin)), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
| var prop = _c.value; | ||
| target[prop] = mixin[prop]; | ||
| } | ||
| } | ||
| catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
| finally { | ||
| try { | ||
| if (_c && !_c.done && (_a = _b["return"])) _a.call(_b); | ||
| } | ||
| finally { if (e_1) throw e_1.error; } | ||
| } | ||
| }; | ||
| LifeCycle.prototype.subscribe = function (observable, action, subscriptionType) { | ||
| if (typeof action === 'string') { | ||
| action = this[action]; | ||
| } | ||
| this.addDisposable(observable.subscribe(action, this, subscriptionType)); | ||
| }; | ||
| LifeCycle.prototype.computed = function (params) { | ||
| if (typeof params === 'string') { | ||
| params = { read: this[params], write: this[params] }; | ||
| } | ||
| if (typeof params === 'object') { | ||
| params = Object.assign({ owner: this }, params); | ||
| } | ||
| else if (typeof params === 'function') { | ||
| var proto = Object.getPrototypeOf(this); | ||
| if (proto && proto[params.name] === params) { | ||
| params = params.bind(this); | ||
| } | ||
| params = { read: params, write: params }; | ||
| } | ||
| else { | ||
| throw new Error('LifeCycle::computed not given a valid type.'); | ||
| } | ||
| params.disposeWhenNodeIsRemoved = this[ANCHOR_NODE]; | ||
| return this.addDisposable(computed(params)); | ||
| }; | ||
| /** | ||
| * Add an event listener for the given or anchored node. | ||
| * @param {node} [node] (optional) The target node (otherwise the anchored node) | ||
| * @param {string} [type] Event type | ||
| * @param {function|string} [action] Either call the given function or `this[action]` | ||
| * @param {object} [options] (optional) Passed as `options` to `node.addEventListener` | ||
| */ | ||
| LifeCycle.prototype.addEventListener = function () { | ||
| var args = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| args[_i] = arguments[_i]; | ||
| } | ||
| var node = args[0].nodeType ? args.shift() : this[ANCHOR_NODE]; | ||
| var _a = __read(args, 3), type = _a[0], act = _a[1], options = _a[2]; | ||
| var handler = typeof act === 'string' ? this[act].bind(this) : act; | ||
| this.__addEventListener(node, type, handler, options); | ||
| }; | ||
| LifeCycle.prototype.__addEventListener = function (node, eventType, handler, options) { | ||
| node.addEventListener(eventType, handler, options); | ||
| function dispose() { node.removeEventListener(eventType, handler); } | ||
| addDisposeCallback(node, dispose); | ||
| this.addDisposable({ dispose: dispose }); | ||
| }; | ||
| LifeCycle.prototype.anchorTo = function (nodeOrLifeCycle) { | ||
| var _this = this; | ||
| if ('addDisposable' in nodeOrLifeCycle) { | ||
| nodeOrLifeCycle.addDisposable(this); | ||
| this[ANCHOR_NODE] = null; // re-anchor on `anchorTo` calls | ||
| } | ||
| else { | ||
| this[ANCHOR_NODE] = nodeOrLifeCycle; | ||
| addDisposeCallback(nodeOrLifeCycle, function () { return _this[ANCHOR_NODE] === nodeOrLifeCycle && _this.dispose(); }); | ||
| } | ||
| }; | ||
| LifeCycle.prototype.dispose = function () { | ||
| var subscriptions = this[SUBSCRIPTIONS] || []; | ||
| subscriptions.forEach(function (s) { return s.dispose(); }); | ||
| this[SUBSCRIPTIONS] = []; | ||
| this[ANCHOR_NODE] = null; | ||
| }; | ||
| LifeCycle.prototype.addDisposable = function (subscription) { | ||
| var subscriptions = this[SUBSCRIPTIONS] || []; | ||
| if (!this[SUBSCRIPTIONS]) { | ||
| this[SUBSCRIPTIONS] = subscriptions; | ||
| } | ||
| if (typeof subscription.dispose !== 'function') { | ||
| throw new Error('Lifecycle::addDisposable argument missing `dispose`.'); | ||
| } | ||
| subscriptions.push(subscription); | ||
| return subscription; | ||
| }; | ||
| return LifeCycle; | ||
| }()); | ||
| export { LifeCycle }; | ||
| //# sourceMappingURL=lifecycle.js.map |
| {"version":3,"file":"lifecycle.js","sources":["../../../node_modules/tslib/tslib.es6.js"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;AAcA;AA8FA,SAAgB,QAAQ,CAAC,CAAC,EAAE;IACxB,IAAI,CAAC,GAAG,OAAO,MAAM,KAAK,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAClE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,OAAO;QACH,IAAI,EAAE,YAAY;YACd,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;YACnC,OAAO,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;SAC3C;KACJ,CAAC;CACL;;AAED,SAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;IACzB,IAAI,CAAC,GAAG,OAAO,MAAM,KAAK,UAAU,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3D,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACjB,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACjC,IAAI;QACA,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KAC9E;IACD,OAAO,KAAK,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE;YAC/B;QACJ,IAAI;YACA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACpD;gBACO,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,EAAE;KACpC;IACD,OAAO,EAAE,CAAC;CACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
LicensePackage contains multiple licenses.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
189963
516.9%0
-100%10
66.67%0
-100%1843
649.19%0
-100%0
-100%4
33.33%1
Infinity%+ Added
- Removed
Updated
Updated
Updated