@tko/binding.if
Advanced tools
| // @tko/binding.if 🥊 4.0.0-beta1.0 ESM | ||
| var __async = (__this, __arguments, generator) => { | ||
| return new Promise((resolve, reject) => { | ||
| var fulfilled = (value) => { | ||
| try { | ||
| step(generator.next(value)); | ||
| } catch (e) { | ||
| reject(e); | ||
| } | ||
| }; | ||
| var rejected = (value) => { | ||
| try { | ||
| step(generator.throw(value)); | ||
| } catch (e) { | ||
| reject(e); | ||
| } | ||
| }; | ||
| var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); | ||
| step((generator = generator.apply(__this, __arguments)).next()); | ||
| }); | ||
| }; | ||
| import { | ||
| cloneNodes, | ||
| virtualElements, | ||
| cleanNode, | ||
| domData | ||
| } from "@tko/utils"; | ||
| import { | ||
| dependencyDetection, | ||
| observable | ||
| } from "@tko/observable"; | ||
| import { | ||
| applyBindingsToDescendants, | ||
| AsyncBindingHandler | ||
| } from "@tko/bind"; | ||
| export default class ConditionalBindingHandler extends AsyncBindingHandler { | ||
| constructor(params) { | ||
| super(params); | ||
| this.hasElse = this.detectElse(this.$element); | ||
| const elseChainSatisfied = this.completesElseChain = observable(); | ||
| domData.set(this.$element, "conditional", { elseChainSatisfied }); | ||
| } | ||
| getIfElseNodes() { | ||
| if (this.ifElseNodes) { | ||
| return this.ifElseNodes; | ||
| } | ||
| if (dependencyDetection.getDependenciesCount() || this.hasElse) { | ||
| return this.cloneIfElseNodes(this.$element, this.hasElse); | ||
| } | ||
| } | ||
| render() { | ||
| const isFirstRender = !this.ifElseNodes; | ||
| const { shouldDisplay } = this.renderStatus(); | ||
| this.ifElseNodes = this.getIfElseNodes() || {}; | ||
| if (shouldDisplay) { | ||
| const useOriginalNodes = isFirstRender && !this.hasElse; | ||
| this.renderAndApplyBindings(this.ifElseNodes.ifNodes, useOriginalNodes); | ||
| } else if (this.hasElse) { | ||
| this.renderAndApplyBindings(this.ifElseNodes.elseNodes); | ||
| } else { | ||
| virtualElements.emptyNode(this.$element); | ||
| } | ||
| } | ||
| renderAndApplyBindings(nodes, useOriginalNodes) { | ||
| return __async(this, null, function* () { | ||
| if (!useOriginalNodes) { | ||
| virtualElements.setDomNodeChildren(this.$element, cloneNodes(nodes)); | ||
| } | ||
| const bound = yield applyBindingsToDescendants(this.bindingContext, this.$element); | ||
| this.completeBinding(bound); | ||
| }); | ||
| } | ||
| get elseChainIsAlreadySatisfied() { | ||
| return false; | ||
| } | ||
| isElseNode(node) { | ||
| return node.nodeType === 8 && node.nodeValue.trim().toLowerCase() === "else"; | ||
| } | ||
| detectElse(element) { | ||
| var children = virtualElements.childNodes(element); | ||
| for (var i = 0, j = children.length; i < j; ++i) { | ||
| if (this.isElseNode(children[i])) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| cloneIfElseNodes(element, hasElse) { | ||
| const children = virtualElements.childNodes(element); | ||
| const ifNodes = []; | ||
| const elseNodes = []; | ||
| let target = ifNodes; | ||
| for (var i = 0, j = children.length; i < j; ++i) { | ||
| if (hasElse && this.isElseNode(children[i])) { | ||
| target = elseNodes; | ||
| hasElse = false; | ||
| } else { | ||
| target.push(cleanNode(children[i].cloneNode(true))); | ||
| } | ||
| } | ||
| return { ifNodes, elseNodes }; | ||
| } | ||
| get controlsDescendants() { | ||
| return true; | ||
| } | ||
| static get allowVirtualElements() { | ||
| return true; | ||
| } | ||
| } |
| { | ||
| "version": 3, | ||
| "sources": ["../src/ConditionalBindingHandler.ts"], | ||
| "sourcesContent": ["import {\n cloneNodes, virtualElements, cleanNode, domData\n} from '@tko/utils'\n\nimport {\n dependencyDetection, observable\n} from '@tko/observable'\n\nimport {\n applyBindingsToDescendants, AsyncBindingHandler\n} from '@tko/bind'\n\n/**\n * Create a DOMbinding that controls DOM nodes presence\n *\n * Covers e.g.\n *\n * 1. DOM Nodes contents\n *\n * <div data-bind='if: x'>\n * <!-- else --> ... an optional 'if'\n * </div>\n *\n * 2. Virtual elements\n *\n * <!-- ko if: x -->\n * <!-- else -->\n * <!-- /ko -->\n *\n * 3. Else binding\n * <div data-bind='if: x'></div>\n * <div data-bind='else'></div>\n *\n * Requires `renderStatus` and `get bindingContext` to be overloaded,\n * and this.computed('render') must be called in the child constructor.\n */\nexport default class ConditionalBindingHandler extends AsyncBindingHandler {\n constructor (params) {\n super(params)\n this.hasElse = this.detectElse(this.$element)\n const elseChainSatisfied = this.completesElseChain = observable()\n domData.set(this.$element, 'conditional', { elseChainSatisfied })\n }\n\n getIfElseNodes () {\n if (this.ifElseNodes) { return this.ifElseNodes }\n if (dependencyDetection.getDependenciesCount() || this.hasElse) {\n return this.cloneIfElseNodes(this.$element, this.hasElse)\n }\n }\n\n render () {\n const isFirstRender = !this.ifElseNodes\n const {shouldDisplay} = this.renderStatus()\n\n // Save the nodes before we possibly remove them from the DOM.\n this.ifElseNodes = this.getIfElseNodes() || {}\n\n if (shouldDisplay) {\n const useOriginalNodes = isFirstRender && !this.hasElse\n this.renderAndApplyBindings(this.ifElseNodes.ifNodes, useOriginalNodes)\n } else if (this.hasElse) {\n this.renderAndApplyBindings(this.ifElseNodes.elseNodes)\n } else {\n virtualElements.emptyNode(this.$element)\n }\n }\n\n async renderAndApplyBindings (nodes, useOriginalNodes) {\n if (!useOriginalNodes) {\n virtualElements.setDomNodeChildren(this.$element, cloneNodes(nodes))\n }\n const bound = await applyBindingsToDescendants(this.bindingContext, this.$element)\n this.completeBinding(bound)\n }\n\n /**\n * This may be truthy for the `else` binding.\n */\n get elseChainIsAlreadySatisfied () { return false }\n\n /**\n * Test a node for whether it represents an 'else' condition.\n * @param {HTMLElement} node to be tested\n * @return {Boolean} true when\n *\n * Matches <!-- else -->\n */\n isElseNode (node) {\n return node.nodeType === 8 &&\n node.nodeValue.trim().toLowerCase() === 'else'\n }\n\n detectElse (element) {\n var children = virtualElements.childNodes(element)\n for (var i = 0, j = children.length; i < j; ++i) {\n if (this.isElseNode(children[i])) { return true }\n }\n return false\n }\n\n /**\n * Clone the nodes, returning `ifNodes`, `elseNodes`\n * @param {HTMLElement} element The nodes to be cloned\n * @param {boolean} hasElse short-circuit to speed up the inner-loop.\n * @return {object} Containing the cloned nodes.\n */\n cloneIfElseNodes (element, hasElse) {\n const children = virtualElements.childNodes(element)\n const ifNodes = []\n const elseNodes = []\n let target = ifNodes\n\n for (var i = 0, j = children.length; i < j; ++i) {\n if (hasElse && this.isElseNode(children[i])) {\n target = elseNodes\n hasElse = false\n } else {\n target.push(cleanNode(children[i].cloneNode(true)))\n }\n }\n\n return { ifNodes, elseNodes }\n }\n\n get controlsDescendants () { return true }\n static get allowVirtualElements () { return true }\n}\n"], | ||
| "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAAA;AA4BA,qBAAqB,kCAAkC,oBAAoB;AAAA,EACzE,YAAa,QAAQ;AACnB,UAAM,MAAM;AACZ,SAAK,UAAU,KAAK,WAAW,KAAK,QAAQ;AAC5C,UAAM,qBAAqB,KAAK,qBAAqB,WAAW;AAChE,YAAQ,IAAI,KAAK,UAAU,eAAe,EAAE,mBAAmB,CAAC;AAAA,EAClE;AAAA,EAEA,iBAAkB;AAChB,QAAI,KAAK,aAAa;AAAE,aAAO,KAAK;AAAA,IAAY;AAChD,QAAI,oBAAoB,qBAAqB,KAAK,KAAK,SAAS;AAC9D,aAAO,KAAK,iBAAiB,KAAK,UAAU,KAAK,OAAO;AAAA,IAC1D;AAAA,EACF;AAAA,EAEA,SAAU;AACR,UAAM,gBAAgB,CAAC,KAAK;AAC5B,UAAM,EAAC,kBAAiB,KAAK,aAAa;AAG1C,SAAK,cAAc,KAAK,eAAe,KAAK,CAAC;AAE7C,QAAI,eAAe;AACjB,YAAM,mBAAmB,iBAAiB,CAAC,KAAK;AAChD,WAAK,uBAAuB,KAAK,YAAY,SAAS,gBAAgB;AAAA,IACxE,WAAW,KAAK,SAAS;AACvB,WAAK,uBAAuB,KAAK,YAAY,SAAS;AAAA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// @tko/binding.if 🥊 4.0.0-beta1.0 ESM | ||
| import { | ||
| virtualElements, | ||
| domData | ||
| } from "@tko/utils"; | ||
| import { | ||
| unwrap | ||
| } from "@tko/observable"; | ||
| import { | ||
| IfBindingHandler | ||
| } from "./ifUnless"; | ||
| export class ElseBindingHandler extends IfBindingHandler { | ||
| shouldDisplayIf() { | ||
| return super.shouldDisplayIf() || this.value === void 0; | ||
| } | ||
| get elseChainIsAlreadySatisfied() { | ||
| if (!this._elseChain) { | ||
| this._elseChain = this.readElseChain(); | ||
| } | ||
| return unwrap(this._elseChain.elseChainSatisfied); | ||
| } | ||
| readElseChain() { | ||
| let node = this.$element; | ||
| do { | ||
| node = node.previousSibling; | ||
| } while (node && node.nodeType !== 1 && node.nodeType !== 8); | ||
| if (!node) { | ||
| return false; | ||
| } | ||
| if (node.nodeType === 8) { | ||
| node = virtualElements.previousSibling(node); | ||
| } | ||
| return domData.get(node, "conditional") || {}; | ||
| } | ||
| } |
| { | ||
| "version": 3, | ||
| "sources": ["../src/else.ts"], | ||
| "sourcesContent": ["import {\n virtualElements, domData\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nimport {\n IfBindingHandler\n} from './ifUnless'\n\n/**\n * The `else` binding\n * (not to be mistaken for `<!-- else -->` inside if bindings.\n */\nexport class ElseBindingHandler extends IfBindingHandler {\n shouldDisplayIf () {\n return super.shouldDisplayIf() || this.value === undefined\n }\n\n /**\n * Return any conditional that precedes the given node.\n * @return {object} { elseChainSatisfied: observable }\n */\n get elseChainIsAlreadySatisfied () {\n if (!this._elseChain) { this._elseChain = this.readElseChain() }\n return unwrap(this._elseChain.elseChainSatisfied)\n }\n\n readElseChain () {\n let node = this.$element\n do {\n node = node.previousSibling\n } while (node && node.nodeType !== 1 && node.nodeType !== 8)\n\n if (!node) { return false }\n\n if (node.nodeType === 8) {\n node = virtualElements.previousSibling(node)\n }\n\n return domData.get(node, 'conditional') || {}\n }\n}\n"], | ||
| "mappings": ";AAAA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIA;AAAA;AAAA;AAQO,aAAM,2BAA2B,iBAAiB;AAAA,EACvD,kBAAmB;AACjB,WAAO,MAAM,gBAAgB,KAAK,KAAK,UAAU;AAAA,EACnD;AAAA,MAMI,8BAA+B;AACjC,QAAI,CAAC,KAAK,YAAY;AAAE,WAAK,aAAa,KAAK,cAAc;AAAA,IAAE;AAC/D,WAAO,OAAO,KAAK,WAAW,kBAAkB;AAAA,EAClD;AAAA,EAEA,gBAAiB;AACf,QAAI,OAAO,KAAK;AAChB,OAAG;AACD,aAAO,KAAK;AAAA,IACd,SAAS,QAAQ,KAAK,aAAa,KAAK,KAAK,aAAa;AAE1D,QAAI,CAAC,MAAM;AAAE,aAAO;AAAA,IAAM;AAE1B,QAAI,KAAK,aAAa,GAAG;AACvB,aAAO,gBAAgB,gBAAgB,IAAI;AAAA,IAC7C;AAEA,WAAO,QAAQ,IAAI,MAAM,aAAa,KAAK,CAAC;AAAA,EAC9C;AACF;", | ||
| "names": [] | ||
| } |
| // @tko/binding.if 🥊 4.0.0-beta1.0 ESM | ||
| import { | ||
| unwrap | ||
| } from "@tko/observable"; | ||
| import ConditionalBindingHandler from "./ConditionalBindingHandler"; | ||
| export class IfBindingHandler extends ConditionalBindingHandler { | ||
| constructor(...args) { | ||
| super(...args); | ||
| this.ifCondition = this.computed(() => !!unwrap(this.value)); | ||
| this.computed("render"); | ||
| } | ||
| shouldDisplayIf() { | ||
| return this.ifCondition(); | ||
| } | ||
| get bindingContext() { | ||
| return this.ifCondition.isActive() ? this.$context.extend(() => { | ||
| this.ifCondition(); | ||
| return null; | ||
| }) : this.$context; | ||
| } | ||
| renderStatus() { | ||
| let shouldDisplay = this.shouldDisplayIf(); | ||
| if (this.elseChainIsAlreadySatisfied) { | ||
| shouldDisplay = false; | ||
| this.completesElseChain(true); | ||
| } else { | ||
| this.completesElseChain(shouldDisplay); | ||
| } | ||
| return { shouldDisplay }; | ||
| } | ||
| } | ||
| export class UnlessBindingHandler extends IfBindingHandler { | ||
| shouldDisplayIf() { | ||
| return !super.shouldDisplayIf(); | ||
| } | ||
| } |
| { | ||
| "version": 3, | ||
| "sources": ["../src/ifUnless.ts"], | ||
| "sourcesContent": ["\nimport {\n unwrap\n} from '@tko/observable'\n\nimport ConditionalBindingHandler from './ConditionalBindingHandler'\n\n/**\n * For the `if:` binding.\n */\nexport class IfBindingHandler extends ConditionalBindingHandler {\n constructor (...args) {\n super(...args)\n this.ifCondition = this.computed(() => !!unwrap(this.value))\n this.computed('render')\n }\n\n shouldDisplayIf () {\n return this.ifCondition()\n }\n\n get bindingContext () {\n return this.ifCondition.isActive()\n ? this.$context.extend(() => {\n // Ensure that this context is dependant upon the conditional, so the\n // order of binding application is: conditional before its children.\n // See https://github.com/knockout/kn\n // ockout/pull/2226\n this.ifCondition()\n return null\n })\n : this.$context\n }\n\n renderStatus () {\n let shouldDisplay = this.shouldDisplayIf()\n\n if (this.elseChainIsAlreadySatisfied) {\n shouldDisplay = false\n // needsRefresh = isFirstRender || this.didDisplayOnLastUpdate FIXME\n this.completesElseChain(true)\n } else {\n this.completesElseChain(shouldDisplay)\n }\n return {shouldDisplay}\n }\n}\n\nexport class UnlessBindingHandler extends IfBindingHandler {\n shouldDisplayIf () { return !super.shouldDisplayIf() }\n}\n"], | ||
| "mappings": ";AACA;AAAA;AAAA;AAIA;AAKO,aAAM,yBAAyB,0BAA0B;AAAA,EAC9D,eAAgB,MAAM;AACpB,UAAM,GAAG,IAAI;AACb,SAAK,cAAc,KAAK,SAAS,MAAM,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC;AAC3D,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,EAEA,kBAAmB;AACjB,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,MAEI,iBAAkB;AACpB,WAAO,KAAK,YAAY,SAAS,IAC7B,KAAK,SAAS,OAAO,MAAM;AAK3B,WAAK,YAAY;AACjB,aAAO;AAAA,IACT,CAAC,IACC,KAAK;AAAA,EACX;AAAA,EAEA,eAAgB;AACd,QAAI,gBAAgB,KAAK,gBAAgB;AAEzC,QAAI,KAAK,6BAA6B;AACpC,sBAAgB;AAEhB,WAAK,mBAAmB,IAAI;AAAA,IAC9B,OAAO;AACL,WAAK,mBAAmB,aAAa;AAAA,IACvC;AACA,WAAO,EAAC,cAAa;AAAA,EACvB;AACF;AAEO,aAAM,6BAA6B,iBAAiB;AAAA,EACzD,kBAAmB;AAAE,WAAO,CAAC,MAAM,gBAAgB;AAAA,EAAE;AACvD;", | ||
| "names": [] | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| // @tko/binding.if 🥊 4.0.0-beta1.0 ESM | ||
| import { | ||
| IfBindingHandler, | ||
| UnlessBindingHandler | ||
| } from "./ifUnless"; | ||
| import { | ||
| WithBindingHandler | ||
| } from "./with"; | ||
| import { | ||
| ElseBindingHandler | ||
| } from "./else"; | ||
| export const bindings = { | ||
| "if": IfBindingHandler, | ||
| "with": WithBindingHandler, | ||
| ifnot: UnlessBindingHandler, | ||
| unless: UnlessBindingHandler, | ||
| "else": ElseBindingHandler, | ||
| "elseif": ElseBindingHandler | ||
| }; |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["\nimport {\n IfBindingHandler,\n UnlessBindingHandler\n} from './ifUnless'\n\nimport {\n WithBindingHandler\n} from './with'\n\nimport {\n ElseBindingHandler\n} from './else'\n\nexport const bindings = {\n 'if': IfBindingHandler,\n 'with': WithBindingHandler,\n ifnot: UnlessBindingHandler,\n unless: UnlessBindingHandler,\n 'else': ElseBindingHandler,\n 'elseif': ElseBindingHandler\n}\n"], | ||
| "mappings": ";AACA;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIO,aAAM,WAAW;AAAA,EACtB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AACZ;", | ||
| "names": [] | ||
| } |
| // @tko/binding.if 🥊 4.0.0-beta1.0 MJS | ||
| import { | ||
| IfBindingHandler, | ||
| UnlessBindingHandler | ||
| } from "./ifUnless"; | ||
| import { | ||
| WithBindingHandler | ||
| } from "./with"; | ||
| import { | ||
| ElseBindingHandler | ||
| } from "./else"; | ||
| export const bindings = { | ||
| "if": IfBindingHandler, | ||
| "with": WithBindingHandler, | ||
| ifnot: UnlessBindingHandler, | ||
| unless: UnlessBindingHandler, | ||
| "else": ElseBindingHandler, | ||
| "elseif": ElseBindingHandler | ||
| }; |
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["\nimport {\n IfBindingHandler,\n UnlessBindingHandler\n} from './ifUnless'\n\nimport {\n WithBindingHandler\n} from './with'\n\nimport {\n ElseBindingHandler\n} from './else'\n\nexport const bindings = {\n 'if': IfBindingHandler,\n 'with': WithBindingHandler,\n ifnot: UnlessBindingHandler,\n unless: UnlessBindingHandler,\n 'else': ElseBindingHandler,\n 'elseif': ElseBindingHandler\n}\n"], | ||
| "mappings": ";AACA;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIO,aAAM,WAAW;AAAA,EACtB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AACZ;", | ||
| "names": [] | ||
| } |
+27
| // @tko/binding.if 🥊 4.0.0-beta1.0 ESM | ||
| import { | ||
| options | ||
| } from "@tko/utils"; | ||
| import { | ||
| unwrap | ||
| } from "@tko/observable"; | ||
| import ConditionalBindingHandler from "./ConditionalBindingHandler"; | ||
| export class WithBindingHandler extends ConditionalBindingHandler { | ||
| constructor(...args) { | ||
| super(...args); | ||
| this.asOption = this.allBindings.get("as"); | ||
| const conditionalFn = this.asOption && !options.createChildContextWithAs ? () => Boolean(unwrap(this.value)) : () => unwrap(this.value); | ||
| this.conditional = this.computed(conditionalFn); | ||
| this.computed("render"); | ||
| } | ||
| get bindingContext() { | ||
| if (!this.asOption) { | ||
| return this.$context.createChildContext(this.valueAccessor); | ||
| } | ||
| return options.createChildContextWithAs ? this.$context.createChildContext(this.value, this.asOption) : this.$context.extend({ [this.asOption]: this.value }); | ||
| } | ||
| renderStatus() { | ||
| const shouldDisplay = Boolean(this.conditional()); | ||
| return { shouldDisplay }; | ||
| } | ||
| } |
| { | ||
| "version": 3, | ||
| "sources": ["../src/with.ts"], | ||
| "sourcesContent": ["\nimport {\n options\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nimport ConditionalBindingHandler from './ConditionalBindingHandler'\n\n/**\n * The following fails somewhere in the `limit` functions of Observables i.e.\n * it's an issue related to async/deferUpdates.\n */\nexport class WithBindingHandler extends ConditionalBindingHandler {\n constructor (...args) {\n super(...args)\n this.asOption = this.allBindings.get('as')\n\n // If given `as`, reduce the condition to a boolean, so it does not\n // change & refresh when the value is updated.\n const conditionalFn = this.asOption && !options.createChildContextWithAs\n ? () => Boolean(unwrap(this.value)) : () => unwrap(this.value)\n this.conditional = this.computed(conditionalFn)\n\n this.computed('render')\n }\n\n get bindingContext () {\n if (!this.asOption) {\n return this.$context.createChildContext(this.valueAccessor)\n }\n return options.createChildContextWithAs\n ? this.$context.createChildContext(this.value, this.asOption)\n : this.$context.extend({[this.asOption]: this.value})\n }\n\n renderStatus () {\n const shouldDisplay = Boolean(this.conditional())\n return { shouldDisplay }\n }\n}\n"], | ||
| "mappings": ";AACA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIA;AAMO,aAAM,2BAA2B,0BAA0B;AAAA,EAChE,eAAgB,MAAM;AACpB,UAAM,GAAG,IAAI;AACb,SAAK,WAAW,KAAK,YAAY,IAAI,IAAI;AAIzC,UAAM,gBAAgB,KAAK,YAAY,CAAC,QAAQ,2BAC5C,MAAM,QAAQ,OAAO,KAAK,KAAK,CAAC,IAAI,MAAM,OAAO,KAAK,KAAK;AAC/D,SAAK,cAAc,KAAK,SAAS,aAAa;AAE9C,SAAK,SAAS,QAAQ;AAAA,EACxB;AAAA,MAEI,iBAAkB;AACpB,QAAI,CAAC,KAAK,UAAU;AAClB,aAAO,KAAK,SAAS,mBAAmB,KAAK,aAAa;AAAA,IAC5D;AACA,WAAO,QAAQ,2BACX,KAAK,SAAS,mBAAmB,KAAK,OAAO,KAAK,QAAQ,IAC1D,KAAK,SAAS,OAAO,GAAE,KAAK,WAAW,KAAK,MAAK,CAAC;AAAA,EACxD;AAAA,EAEA,eAAgB;AACd,UAAM,gBAAgB,QAAQ,KAAK,YAAY,CAAC;AAChD,WAAO,EAAE,cAAc;AAAA,EACzB;AACF;", | ||
| "names": [] | ||
| } |
+18
-28
| { | ||
| "version": "4.0.0-beta1.0", | ||
| "name": "@tko/binding.if", | ||
| "version": "4.0.0-alpha9.0", | ||
| "description": "TKO conditional (if/ifnot/unless/with/else) bindings", | ||
@@ -12,3 +12,3 @@ "module": "dist/binding.if.js", | ||
| "type": "git", | ||
| "url": "git+https://github.com/knockout/tko.binding.if.git" | ||
| "url": "git+https://github.com/knockout/tko.git" | ||
| }, | ||
@@ -20,14 +20,14 @@ "keywords": [ | ||
| ], | ||
| "author": "Knockout", | ||
| "author": "The Knockout Team", | ||
| "license": "MIT", | ||
| "bugs": { | ||
| "url": "https://github.com/knockout/tko.binding.if/issues" | ||
| "url": "https://github.com/knockout/tko/issues" | ||
| }, | ||
| "homepage": "https://tko.io", | ||
| "dependencies": { | ||
| "@tko/bind": "^4.0.0-alpha9.0", | ||
| "@tko/computed": "^4.0.0-alpha8.0", | ||
| "@tko/observable": "^4.0.0-alpha8.0", | ||
| "@tko/utils": "^4.0.0-alpha8.0", | ||
| "tslib": "^1.8.0" | ||
| "@tko/bind": "^4.0.0-beta1.0", | ||
| "@tko/computed": "^4.0.0-beta1.0", | ||
| "@tko/observable": "^4.0.0-beta1.0", | ||
| "@tko/utils": "^4.0.0-beta1.0", | ||
| "tslib": "^2.2.0" | ||
| }, | ||
@@ -39,26 +39,16 @@ "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" | ||
| }, | ||
| "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/*" | ||
| }, | ||
| "gitHead": "99114c4deded3fc5dbddd5c7c9c63c845a18263b" | ||
| } |
| /*! | ||
| * TKO conditional (if/ifnot/unless/with/else) bindings 🥊 @tko/binding.if@4.0.0-alpha9.0 | ||
| * (c) The Knockout.js Team - https://tko.io | ||
| * License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
| */ | ||
| import { cloneNodes, virtualElements, cleanNode, domData, options } from '@tko/utils'; | ||
| import { dependencyDetection, observable, unwrap } from '@tko/observable'; | ||
| import { applyBindingsToDescendants, AsyncBindingHandler } from '@tko/bind'; | ||
| /** | ||
| * Create a DOMbinding that controls DOM nodes presence | ||
| * | ||
| * Covers e.g. | ||
| * | ||
| * 1. DOM Nodes contents | ||
| * | ||
| * <div data-bind='if: x'> | ||
| * <!-- else --> ... an optional 'if' | ||
| * </div> | ||
| * | ||
| * 2. Virtual elements | ||
| * | ||
| * <!-- ko if: x --> | ||
| * <!-- else --> | ||
| * <!-- /ko --> | ||
| * | ||
| * 3. Else binding | ||
| * <div data-bind='if: x'></div> | ||
| * <div data-bind='else'></div> | ||
| * | ||
| * Requires `renderStatus` and `get bindingContext` to be overloaded, | ||
| * and this.computed('render') must be called in the child constructor. | ||
| */ | ||
| class ConditionalBindingHandler extends AsyncBindingHandler { | ||
| constructor (params) { | ||
| super(params); | ||
| this.hasElse = this.detectElse(this.$element); | ||
| const elseChainSatisfied = this.completesElseChain = observable(); | ||
| domData.set(this.$element, 'conditional', { elseChainSatisfied }); | ||
| } | ||
| getIfElseNodes () { | ||
| if (this.ifElseNodes) { return this.ifElseNodes } | ||
| if (dependencyDetection.getDependenciesCount() || this.hasElse) { | ||
| return this.cloneIfElseNodes(this.$element, this.hasElse) | ||
| } | ||
| } | ||
| render () { | ||
| const isFirstRender = !this.ifElseNodes; | ||
| const {shouldDisplay} = this.renderStatus(); | ||
| // Save the nodes before we possibly remove them from the DOM. | ||
| this.ifElseNodes = this.getIfElseNodes() || {}; | ||
| if (shouldDisplay) { | ||
| const useOriginalNodes = isFirstRender && !this.hasElse; | ||
| this.renderAndApplyBindings(this.ifElseNodes.ifNodes, useOriginalNodes); | ||
| } else if (this.hasElse) { | ||
| this.renderAndApplyBindings(this.ifElseNodes.elseNodes); | ||
| } else { | ||
| virtualElements.emptyNode(this.$element); | ||
| } | ||
| } | ||
| async renderAndApplyBindings (nodes, useOriginalNodes) { | ||
| if (!useOriginalNodes) { | ||
| virtualElements.setDomNodeChildren(this.$element, cloneNodes(nodes)); | ||
| } | ||
| const bound = await applyBindingsToDescendants(this.bindingContext, this.$element); | ||
| this.completeBinding(bound); | ||
| } | ||
| /** | ||
| * This may be truthy for the `else` binding. | ||
| */ | ||
| get elseChainIsAlreadySatisfied () { return false } | ||
| /** | ||
| * Test a node for whether it represents an 'else' condition. | ||
| * @param {HTMLElement} node to be tested | ||
| * @return {Boolean} true when | ||
| * | ||
| * Matches <!-- else --> | ||
| */ | ||
| isElseNode (node) { | ||
| return node.nodeType === 8 && | ||
| node.nodeValue.trim().toLowerCase() === 'else' | ||
| } | ||
| detectElse (element) { | ||
| var children = virtualElements.childNodes(element); | ||
| for (var i = 0, j = children.length; i < j; ++i) { | ||
| if (this.isElseNode(children[i])) { return true } | ||
| } | ||
| return false | ||
| } | ||
| /** | ||
| * Clone the nodes, returning `ifNodes`, `elseNodes` | ||
| * @param {HTMLElement} element The nodes to be cloned | ||
| * @param {boolean} hasElse short-circuit to speed up the inner-loop. | ||
| * @return {object} Containing the cloned nodes. | ||
| */ | ||
| cloneIfElseNodes (element, hasElse) { | ||
| const children = virtualElements.childNodes(element); | ||
| const ifNodes = []; | ||
| const elseNodes = []; | ||
| let target = ifNodes; | ||
| for (var i = 0, j = children.length; i < j; ++i) { | ||
| if (hasElse && this.isElseNode(children[i])) { | ||
| target = elseNodes; | ||
| hasElse = false; | ||
| } else { | ||
| target.push(cleanNode(children[i].cloneNode(true))); | ||
| } | ||
| } | ||
| return { ifNodes, elseNodes } | ||
| } | ||
| get controlsDescendants () { return true } | ||
| static get allowVirtualElements () { return true } | ||
| } | ||
| /** | ||
| * For the `if:` binding. | ||
| */ | ||
| class IfBindingHandler extends ConditionalBindingHandler { | ||
| constructor (...args) { | ||
| super(...args); | ||
| this.ifCondition = this.computed(() => !!unwrap(this.value)); | ||
| this.computed('render'); | ||
| } | ||
| shouldDisplayIf () { | ||
| return this.ifCondition() | ||
| } | ||
| get bindingContext () { | ||
| return this.ifCondition.isActive() | ||
| ? this.$context.extend(() => { | ||
| // Ensure that this context is dependant upon the conditional, so the | ||
| // order of binding application is: conditional before its children. | ||
| // See https://github.com/knockout/kn | ||
| // ockout/pull/2226 | ||
| this.ifCondition(); | ||
| return null | ||
| }) | ||
| : this.$context | ||
| } | ||
| renderStatus () { | ||
| let shouldDisplay = this.shouldDisplayIf(); | ||
| if (this.elseChainIsAlreadySatisfied) { | ||
| shouldDisplay = false; | ||
| // needsRefresh = isFirstRender || this.didDisplayOnLastUpdate FIXME | ||
| this.completesElseChain(true); | ||
| } else { | ||
| this.completesElseChain(shouldDisplay); | ||
| } | ||
| return {shouldDisplay} | ||
| } | ||
| } | ||
| class UnlessBindingHandler extends IfBindingHandler { | ||
| shouldDisplayIf () { return !super.shouldDisplayIf() } | ||
| } | ||
| /** | ||
| * The following fails somewhere in the `limit` functions of Observables i.e. | ||
| * it's an issue related to async/deferUpdates. | ||
| */ | ||
| class WithBindingHandler extends ConditionalBindingHandler { | ||
| constructor (...args) { | ||
| super(...args); | ||
| this.asOption = this.allBindings.get('as'); | ||
| // If given `as`, reduce the condition to a boolean, so it does not | ||
| // change & refresh when the value is updated. | ||
| const conditionalFn = this.asOption && !options.createChildContextWithAs | ||
| ? () => Boolean(unwrap(this.value)) : () => unwrap(this.value); | ||
| this.conditional = this.computed(conditionalFn); | ||
| this.computed('render'); | ||
| } | ||
| get bindingContext () { | ||
| if (!this.asOption) { | ||
| return this.$context.createChildContext(this.valueAccessor) | ||
| } | ||
| return options.createChildContextWithAs | ||
| ? this.$context.createChildContext(this.value, this.asOption) | ||
| : this.$context.extend({[this.asOption]: this.value}) | ||
| } | ||
| renderStatus () { | ||
| const shouldDisplay = Boolean(this.conditional()); | ||
| return { shouldDisplay } | ||
| } | ||
| } | ||
| /** | ||
| * The `else` binding | ||
| * (not to be mistaken for `<!-- else -->` inside if bindings. | ||
| */ | ||
| class ElseBindingHandler extends IfBindingHandler { | ||
| shouldDisplayIf () { | ||
| return super.shouldDisplayIf() || this.value === undefined | ||
| } | ||
| /** | ||
| * Return any conditional that precedes the given node. | ||
| * @return {object} { elseChainSatisfied: observable } | ||
| */ | ||
| get elseChainIsAlreadySatisfied () { | ||
| if (!this._elseChain) { this._elseChain = this.readElseChain(); } | ||
| return unwrap(this._elseChain.elseChainSatisfied) | ||
| } | ||
| readElseChain () { | ||
| let node = this.$element; | ||
| do { | ||
| node = node.previousSibling; | ||
| } while (node && node.nodeType !== 1 && node.nodeType !== 8) | ||
| if (!node) { return false } | ||
| if (node.nodeType === 8) { | ||
| node = virtualElements.previousSibling(node); | ||
| } | ||
| return domData.get(node, 'conditional') || {} | ||
| } | ||
| } | ||
| const bindings = { | ||
| 'if': IfBindingHandler, | ||
| 'with': WithBindingHandler, | ||
| ifnot: UnlessBindingHandler, | ||
| unless: UnlessBindingHandler, | ||
| 'else': ElseBindingHandler, | ||
| 'elseif': ElseBindingHandler | ||
| }; | ||
| export { bindings }; | ||
| //# sourceMappingURL=binding.if.es6.js.map |
| {"version":3,"file":"binding.if.es6.js","sources":["../src/ConditionalBindingHandler.js","../src/ifUnless.js","../src/with.js","../src/else.js","../src/index.js"],"sourcesContent":["import {\n cloneNodes, virtualElements, cleanNode, domData\n} from '@tko/utils'\n\nimport {\n dependencyDetection, observable\n} from '@tko/observable'\n\nimport {\n applyBindingsToDescendants, AsyncBindingHandler\n} from '@tko/bind'\n\n/**\n * Create a DOMbinding that controls DOM nodes presence\n *\n * Covers e.g.\n *\n * 1. DOM Nodes contents\n *\n * <div data-bind='if: x'>\n * <!-- else --> ... an optional 'if'\n * </div>\n *\n * 2. Virtual elements\n *\n * <!-- ko if: x -->\n * <!-- else -->\n * <!-- /ko -->\n *\n * 3. Else binding\n * <div data-bind='if: x'></div>\n * <div data-bind='else'></div>\n *\n * Requires `renderStatus` and `get bindingContext` to be overloaded,\n * and this.computed('render') must be called in the child constructor.\n */\nexport default class ConditionalBindingHandler extends AsyncBindingHandler {\n constructor (params) {\n super(params)\n this.hasElse = this.detectElse(this.$element)\n const elseChainSatisfied = this.completesElseChain = observable()\n domData.set(this.$element, 'conditional', { elseChainSatisfied })\n }\n\n getIfElseNodes () {\n if (this.ifElseNodes) { return this.ifElseNodes }\n if (dependencyDetection.getDependenciesCount() || this.hasElse) {\n return this.cloneIfElseNodes(this.$element, this.hasElse)\n }\n }\n\n render () {\n const isFirstRender = !this.ifElseNodes\n const {shouldDisplay} = this.renderStatus()\n\n // Save the nodes before we possibly remove them from the DOM.\n this.ifElseNodes = this.getIfElseNodes() || {}\n\n if (shouldDisplay) {\n const useOriginalNodes = isFirstRender && !this.hasElse\n this.renderAndApplyBindings(this.ifElseNodes.ifNodes, useOriginalNodes)\n } else if (this.hasElse) {\n this.renderAndApplyBindings(this.ifElseNodes.elseNodes)\n } else {\n virtualElements.emptyNode(this.$element)\n }\n }\n\n async renderAndApplyBindings (nodes, useOriginalNodes) {\n if (!useOriginalNodes) {\n virtualElements.setDomNodeChildren(this.$element, cloneNodes(nodes))\n }\n const bound = await applyBindingsToDescendants(this.bindingContext, this.$element)\n this.completeBinding(bound)\n }\n\n /**\n * This may be truthy for the `else` binding.\n */\n get elseChainIsAlreadySatisfied () { return false }\n\n /**\n * Test a node for whether it represents an 'else' condition.\n * @param {HTMLElement} node to be tested\n * @return {Boolean} true when\n *\n * Matches <!-- else -->\n */\n isElseNode (node) {\n return node.nodeType === 8 &&\n node.nodeValue.trim().toLowerCase() === 'else'\n }\n\n detectElse (element) {\n var children = virtualElements.childNodes(element)\n for (var i = 0, j = children.length; i < j; ++i) {\n if (this.isElseNode(children[i])) { return true }\n }\n return false\n }\n\n /**\n * Clone the nodes, returning `ifNodes`, `elseNodes`\n * @param {HTMLElement} element The nodes to be cloned\n * @param {boolean} hasElse short-circuit to speed up the inner-loop.\n * @return {object} Containing the cloned nodes.\n */\n cloneIfElseNodes (element, hasElse) {\n const children = virtualElements.childNodes(element)\n const ifNodes = []\n const elseNodes = []\n let target = ifNodes\n\n for (var i = 0, j = children.length; i < j; ++i) {\n if (hasElse && this.isElseNode(children[i])) {\n target = elseNodes\n hasElse = false\n } else {\n target.push(cleanNode(children[i].cloneNode(true)))\n }\n }\n\n return { ifNodes, elseNodes }\n }\n\n get controlsDescendants () { return true }\n static get allowVirtualElements () { return true }\n}\n","\nimport {\n unwrap\n} from '@tko/observable'\n\nimport ConditionalBindingHandler from './ConditionalBindingHandler'\n\n/**\n * For the `if:` binding.\n */\nexport class IfBindingHandler extends ConditionalBindingHandler {\n constructor (...args) {\n super(...args)\n this.ifCondition = this.computed(() => !!unwrap(this.value))\n this.computed('render')\n }\n\n shouldDisplayIf () {\n return this.ifCondition()\n }\n\n get bindingContext () {\n return this.ifCondition.isActive()\n ? this.$context.extend(() => {\n // Ensure that this context is dependant upon the conditional, so the\n // order of binding application is: conditional before its children.\n // See https://github.com/knockout/kn\n // ockout/pull/2226\n this.ifCondition()\n return null\n })\n : this.$context\n }\n\n renderStatus () {\n let shouldDisplay = this.shouldDisplayIf()\n\n if (this.elseChainIsAlreadySatisfied) {\n shouldDisplay = false\n // needsRefresh = isFirstRender || this.didDisplayOnLastUpdate FIXME\n this.completesElseChain(true)\n } else {\n this.completesElseChain(shouldDisplay)\n }\n return {shouldDisplay}\n }\n}\n\nexport class UnlessBindingHandler extends IfBindingHandler {\n shouldDisplayIf () { return !super.shouldDisplayIf() }\n}\n","\nimport {\n options\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nimport ConditionalBindingHandler from './ConditionalBindingHandler'\n\n/**\n * The following fails somewhere in the `limit` functions of Observables i.e.\n * it's an issue related to async/deferUpdates.\n */\nexport class WithBindingHandler extends ConditionalBindingHandler {\n constructor (...args) {\n super(...args)\n this.asOption = this.allBindings.get('as')\n\n // If given `as`, reduce the condition to a boolean, so it does not\n // change & refresh when the value is updated.\n const conditionalFn = this.asOption && !options.createChildContextWithAs\n ? () => Boolean(unwrap(this.value)) : () => unwrap(this.value)\n this.conditional = this.computed(conditionalFn)\n\n this.computed('render')\n }\n\n get bindingContext () {\n if (!this.asOption) {\n return this.$context.createChildContext(this.valueAccessor)\n }\n return options.createChildContextWithAs\n ? this.$context.createChildContext(this.value, this.asOption)\n : this.$context.extend({[this.asOption]: this.value})\n }\n\n renderStatus () {\n const shouldDisplay = Boolean(this.conditional())\n return { shouldDisplay }\n }\n}\n","import {\n virtualElements, domData\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nimport {\n IfBindingHandler\n} from './ifUnless.js'\n\n/**\n * The `else` binding\n * (not to be mistaken for `<!-- else -->` inside if bindings.\n */\nexport class ElseBindingHandler extends IfBindingHandler {\n shouldDisplayIf () {\n return super.shouldDisplayIf() || this.value === undefined\n }\n\n /**\n * Return any conditional that precedes the given node.\n * @return {object} { elseChainSatisfied: observable }\n */\n get elseChainIsAlreadySatisfied () {\n if (!this._elseChain) { this._elseChain = this.readElseChain() }\n return unwrap(this._elseChain.elseChainSatisfied)\n }\n\n readElseChain () {\n let node = this.$element\n do {\n node = node.previousSibling\n } while (node && node.nodeType !== 1 && node.nodeType !== 8)\n\n if (!node) { return false }\n\n if (node.nodeType === 8) {\n node = virtualElements.previousSibling(node)\n }\n\n return domData.get(node, 'conditional') || {}\n }\n}\n","\nimport {\n IfBindingHandler,\n UnlessBindingHandler\n} from './ifUnless'\n\nimport {\n WithBindingHandler\n} from './with'\n\nimport {\n ElseBindingHandler\n} from './else'\n\nexport const bindings = {\n 'if': IfBindingHandler,\n 'with': WithBindingHandler,\n ifnot: UnlessBindingHandler,\n unless: UnlessBindingHandler,\n 'else': ElseBindingHandler,\n 'elseif': ElseBindingHandler\n}\n"],"names":[],"mappings":";;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAqB,yBAAyB,SAAS,mBAAmB,CAAC;EACzE,WAAW,CAAC,CAAC,MAAM,EAAE;IACnB,KAAK,CAAC,MAAM,EAAC;IACb,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAC;IAC7C,MAAM,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,GAAG,UAAU,GAAE;IACjE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,kBAAkB,EAAE,EAAC;GAClE;;EAED,cAAc,CAAC,GAAG;IAChB,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,IAAI,CAAC,WAAW,EAAE;IACjD,IAAI,mBAAmB,CAAC,oBAAoB,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE;M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AI,CAAC,QAAQ,KAAK,CAAC,CAAC;;IAE5D,IAAI,CAAC,IAAI,EAAE,EAAE,OAAO,KAAK,EAAE;;IAE3B,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;MACvB,IAAI,GAAG,eAAe,CAAC,eAAe,CAAC,IAAI,EAAC;KAC7C;;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE;GAC9C;CACF;;AC9BW,MAAC,QAAQ,GAAG;EACtB,IAAI,EAAE,gBAAgB;EACtB,MAAM,EAAE,kBAAkB;EAC1B,KAAK,EAAE,oBAAoB;EAC3B,MAAM,EAAE,oBAAoB;EAC5B,MAAM,EAAE,kBAAkB;EAC1B,QAAQ,EAAE,kBAAkB;CAC7B;;"} |
| /*! | ||
| * TKO conditional (if/ifnot/unless/with/else) bindings 🥊 @tko/binding.if@4.0.0-alpha9.0 | ||
| * (c) The Knockout.js Team - https://tko.io | ||
| * License: MIT (http://www.opensource.org/licenses/mit-license.php) | ||
| */ | ||
| import { cloneNodes, virtualElements, cleanNode, domData, options } from '@tko/utils'; | ||
| import { dependencyDetection, observable, unwrap } from '@tko/observable'; | ||
| import { applyBindingsToDescendants, AsyncBindingHandler } from '@tko/bind'; | ||
| /*! ***************************************************************************** | ||
| 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. | ||
| ***************************************************************************** */ | ||
| /* global Reflect, Promise */ | ||
| var extendStatics = function(d, b) { | ||
| extendStatics = Object.setPrototypeOf || | ||
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
| function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
| return extendStatics(d, b); | ||
| }; | ||
| function __extends(d, b) { | ||
| extendStatics(d, b); | ||
| function __() { this.constructor = d; } | ||
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
| } | ||
| function __awaiter(thisArg, _arguments, P, generator) { | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| } | ||
| function __generator(thisArg, body) { | ||
| var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
| return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
| function verb(n) { return function (v) { return step([n, v]); }; } | ||
| function step(op) { | ||
| if (f) throw new TypeError("Generator is already executing."); | ||
| while (_) try { | ||
| 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; | ||
| if (y = 0, t) op = [op[0] & 2, t.value]; | ||
| switch (op[0]) { | ||
| case 0: case 1: t = op; break; | ||
| case 4: _.label++; return { value: op[1], done: false }; | ||
| case 5: _.label++; y = op[1]; op = [0]; continue; | ||
| case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
| default: | ||
| if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
| if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
| if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
| if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
| if (t[2]) _.ops.pop(); | ||
| _.trys.pop(); continue; | ||
| } | ||
| op = body.call(thisArg, _); | ||
| } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
| if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
| } | ||
| } | ||
| 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; | ||
| } | ||
| function __spread() { | ||
| for (var ar = [], i = 0; i < arguments.length; i++) | ||
| ar = ar.concat(__read(arguments[i])); | ||
| return ar; | ||
| } | ||
| /** | ||
| * Create a DOMbinding that controls DOM nodes presence | ||
| * | ||
| * Covers e.g. | ||
| * | ||
| * 1. DOM Nodes contents | ||
| * | ||
| * <div data-bind='if: x'> | ||
| * <!-- else --> ... an optional 'if' | ||
| * </div> | ||
| * | ||
| * 2. Virtual elements | ||
| * | ||
| * <!-- ko if: x --> | ||
| * <!-- else --> | ||
| * <!-- /ko --> | ||
| * | ||
| * 3. Else binding | ||
| * <div data-bind='if: x'></div> | ||
| * <div data-bind='else'></div> | ||
| * | ||
| * Requires `renderStatus` and `get bindingContext` to be overloaded, | ||
| * and this.computed('render') must be called in the child constructor. | ||
| */ | ||
| var ConditionalBindingHandler = /** @class */ (function (_super) { | ||
| __extends(ConditionalBindingHandler, _super); | ||
| function ConditionalBindingHandler(params) { | ||
| var _this = _super.call(this, params) || this; | ||
| _this.hasElse = _this.detectElse(_this.$element); | ||
| var elseChainSatisfied = _this.completesElseChain = observable(); | ||
| domData.set(_this.$element, 'conditional', { elseChainSatisfied: elseChainSatisfied }); | ||
| return _this; | ||
| } | ||
| ConditionalBindingHandler.prototype.getIfElseNodes = function () { | ||
| if (this.ifElseNodes) { | ||
| return this.ifElseNodes; | ||
| } | ||
| if (dependencyDetection.getDependenciesCount() || this.hasElse) { | ||
| return this.cloneIfElseNodes(this.$element, this.hasElse); | ||
| } | ||
| }; | ||
| ConditionalBindingHandler.prototype.render = function () { | ||
| var isFirstRender = !this.ifElseNodes; | ||
| var shouldDisplay = this.renderStatus().shouldDisplay; | ||
| // Save the nodes before we possibly remove them from the DOM. | ||
| this.ifElseNodes = this.getIfElseNodes() || {}; | ||
| if (shouldDisplay) { | ||
| var useOriginalNodes = isFirstRender && !this.hasElse; | ||
| this.renderAndApplyBindings(this.ifElseNodes.ifNodes, useOriginalNodes); | ||
| } | ||
| else if (this.hasElse) { | ||
| this.renderAndApplyBindings(this.ifElseNodes.elseNodes); | ||
| } | ||
| else { | ||
| virtualElements.emptyNode(this.$element); | ||
| } | ||
| }; | ||
| ConditionalBindingHandler.prototype.renderAndApplyBindings = function (nodes, useOriginalNodes) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| var bound; | ||
| return __generator(this, function (_a) { | ||
| switch (_a.label) { | ||
| case 0: | ||
| if (!useOriginalNodes) { | ||
| virtualElements.setDomNodeChildren(this.$element, cloneNodes(nodes)); | ||
| } | ||
| return [4 /*yield*/, applyBindingsToDescendants(this.bindingContext, this.$element)]; | ||
| case 1: | ||
| bound = _a.sent(); | ||
| this.completeBinding(bound); | ||
| return [2 /*return*/]; | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
| Object.defineProperty(ConditionalBindingHandler.prototype, "elseChainIsAlreadySatisfied", { | ||
| /** | ||
| * This may be truthy for the `else` binding. | ||
| */ | ||
| get: function () { return false; }, | ||
| enumerable: true, | ||
| configurable: true | ||
| }); | ||
| /** | ||
| * Test a node for whether it represents an 'else' condition. | ||
| * @param {HTMLElement} node to be tested | ||
| * @return {Boolean} true when | ||
| * | ||
| * Matches <!-- else --> | ||
| */ | ||
| ConditionalBindingHandler.prototype.isElseNode = function (node) { | ||
| return node.nodeType === 8 && | ||
| node.nodeValue.trim().toLowerCase() === 'else'; | ||
| }; | ||
| ConditionalBindingHandler.prototype.detectElse = function (element) { | ||
| var children = virtualElements.childNodes(element); | ||
| for (var i = 0, j = children.length; i < j; ++i) { | ||
| if (this.isElseNode(children[i])) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| }; | ||
| /** | ||
| * Clone the nodes, returning `ifNodes`, `elseNodes` | ||
| * @param {HTMLElement} element The nodes to be cloned | ||
| * @param {boolean} hasElse short-circuit to speed up the inner-loop. | ||
| * @return {object} Containing the cloned nodes. | ||
| */ | ||
| ConditionalBindingHandler.prototype.cloneIfElseNodes = function (element, hasElse) { | ||
| var children = virtualElements.childNodes(element); | ||
| var ifNodes = []; | ||
| var elseNodes = []; | ||
| var target = ifNodes; | ||
| for (var i = 0, j = children.length; i < j; ++i) { | ||
| if (hasElse && this.isElseNode(children[i])) { | ||
| target = elseNodes; | ||
| hasElse = false; | ||
| } | ||
| else { | ||
| target.push(cleanNode(children[i].cloneNode(true))); | ||
| } | ||
| } | ||
| return { ifNodes: ifNodes, elseNodes: elseNodes }; | ||
| }; | ||
| Object.defineProperty(ConditionalBindingHandler.prototype, "controlsDescendants", { | ||
| get: function () { return true; }, | ||
| enumerable: true, | ||
| configurable: true | ||
| }); | ||
| Object.defineProperty(ConditionalBindingHandler, "allowVirtualElements", { | ||
| get: function () { return true; }, | ||
| enumerable: true, | ||
| configurable: true | ||
| }); | ||
| return ConditionalBindingHandler; | ||
| }(AsyncBindingHandler)); | ||
| /** | ||
| * For the `if:` binding. | ||
| */ | ||
| var IfBindingHandler = /** @class */ (function (_super) { | ||
| __extends(IfBindingHandler, _super); | ||
| function IfBindingHandler() { | ||
| var args = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| args[_i] = arguments[_i]; | ||
| } | ||
| var _this = _super.apply(this, __spread(args)) || this; | ||
| _this.ifCondition = _this.computed(function () { return !!unwrap(_this.value); }); | ||
| _this.computed('render'); | ||
| return _this; | ||
| } | ||
| IfBindingHandler.prototype.shouldDisplayIf = function () { | ||
| return this.ifCondition(); | ||
| }; | ||
| Object.defineProperty(IfBindingHandler.prototype, "bindingContext", { | ||
| get: function () { | ||
| var _this = this; | ||
| return this.ifCondition.isActive() | ||
| ? this.$context.extend(function () { | ||
| // Ensure that this context is dependant upon the conditional, so the | ||
| // order of binding application is: conditional before its children. | ||
| // See https://github.com/knockout/kn | ||
| // ockout/pull/2226 | ||
| _this.ifCondition(); | ||
| return null; | ||
| }) | ||
| : this.$context; | ||
| }, | ||
| enumerable: true, | ||
| configurable: true | ||
| }); | ||
| IfBindingHandler.prototype.renderStatus = function () { | ||
| var shouldDisplay = this.shouldDisplayIf(); | ||
| if (this.elseChainIsAlreadySatisfied) { | ||
| shouldDisplay = false; | ||
| // needsRefresh = isFirstRender || this.didDisplayOnLastUpdate FIXME | ||
| this.completesElseChain(true); | ||
| } | ||
| else { | ||
| this.completesElseChain(shouldDisplay); | ||
| } | ||
| return { shouldDisplay: shouldDisplay }; | ||
| }; | ||
| return IfBindingHandler; | ||
| }(ConditionalBindingHandler)); | ||
| var UnlessBindingHandler = /** @class */ (function (_super) { | ||
| __extends(UnlessBindingHandler, _super); | ||
| function UnlessBindingHandler() { | ||
| return _super !== null && _super.apply(this, arguments) || this; | ||
| } | ||
| UnlessBindingHandler.prototype.shouldDisplayIf = function () { return !_super.prototype.shouldDisplayIf.call(this); }; | ||
| return UnlessBindingHandler; | ||
| }(IfBindingHandler)); | ||
| /** | ||
| * The following fails somewhere in the `limit` functions of Observables i.e. | ||
| * it's an issue related to async/deferUpdates. | ||
| */ | ||
| var WithBindingHandler = /** @class */ (function (_super) { | ||
| __extends(WithBindingHandler, _super); | ||
| function WithBindingHandler() { | ||
| var args = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| args[_i] = arguments[_i]; | ||
| } | ||
| var _this = _super.apply(this, __spread(args)) || this; | ||
| _this.asOption = _this.allBindings.get('as'); | ||
| // If given `as`, reduce the condition to a boolean, so it does not | ||
| // change & refresh when the value is updated. | ||
| var conditionalFn = _this.asOption && !options.createChildContextWithAs | ||
| ? function () { return Boolean(unwrap(_this.value)); } : function () { return unwrap(_this.value); }; | ||
| _this.conditional = _this.computed(conditionalFn); | ||
| _this.computed('render'); | ||
| return _this; | ||
| } | ||
| Object.defineProperty(WithBindingHandler.prototype, "bindingContext", { | ||
| get: function () { | ||
| var _a; | ||
| if (!this.asOption) { | ||
| return this.$context.createChildContext(this.valueAccessor); | ||
| } | ||
| return options.createChildContextWithAs | ||
| ? this.$context.createChildContext(this.value, this.asOption) | ||
| : this.$context.extend((_a = {}, _a[this.asOption] = this.value, _a)); | ||
| }, | ||
| enumerable: true, | ||
| configurable: true | ||
| }); | ||
| WithBindingHandler.prototype.renderStatus = function () { | ||
| var shouldDisplay = Boolean(this.conditional()); | ||
| return { shouldDisplay: shouldDisplay }; | ||
| }; | ||
| return WithBindingHandler; | ||
| }(ConditionalBindingHandler)); | ||
| /** | ||
| * The `else` binding | ||
| * (not to be mistaken for `<!-- else -->` inside if bindings. | ||
| */ | ||
| var ElseBindingHandler = /** @class */ (function (_super) { | ||
| __extends(ElseBindingHandler, _super); | ||
| function ElseBindingHandler() { | ||
| return _super !== null && _super.apply(this, arguments) || this; | ||
| } | ||
| ElseBindingHandler.prototype.shouldDisplayIf = function () { | ||
| return _super.prototype.shouldDisplayIf.call(this) || this.value === undefined; | ||
| }; | ||
| Object.defineProperty(ElseBindingHandler.prototype, "elseChainIsAlreadySatisfied", { | ||
| /** | ||
| * Return any conditional that precedes the given node. | ||
| * @return {object} { elseChainSatisfied: observable } | ||
| */ | ||
| get: function () { | ||
| if (!this._elseChain) { | ||
| this._elseChain = this.readElseChain(); | ||
| } | ||
| return unwrap(this._elseChain.elseChainSatisfied); | ||
| }, | ||
| enumerable: true, | ||
| configurable: true | ||
| }); | ||
| ElseBindingHandler.prototype.readElseChain = function () { | ||
| var node = this.$element; | ||
| do { | ||
| node = node.previousSibling; | ||
| } while (node && node.nodeType !== 1 && node.nodeType !== 8); | ||
| if (!node) { | ||
| return false; | ||
| } | ||
| if (node.nodeType === 8) { | ||
| node = virtualElements.previousSibling(node); | ||
| } | ||
| return domData.get(node, 'conditional') || {}; | ||
| }; | ||
| return ElseBindingHandler; | ||
| }(IfBindingHandler)); | ||
| var bindings = { | ||
| 'if': IfBindingHandler, | ||
| 'with': WithBindingHandler, | ||
| ifnot: UnlessBindingHandler, | ||
| unless: UnlessBindingHandler, | ||
| 'else': ElseBindingHandler, | ||
| 'elseif': ElseBindingHandler | ||
| }; | ||
| export { bindings }; | ||
| //# sourceMappingURL=binding.if.js.map |
| {"version":3,"file":"binding.if.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.__esMod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,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;;AAED,SAAgB,QAAQ,GAAG;IACvB,KAAK,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE;QAC9C,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Mixed license
LicensePackage contains multiple licenses.
Found 1 instance in 1 package
300367
447.8%16
166.67%0
-100%3094
424.41%3
50%1
Infinity%+ Added
- Removed
Updated
Updated
Updated
Updated