Icard/angular-clarity-master(work.../node_modules/lit-html/directives/keyed.js.map

1 line
1.8 KiB
Plaintext

{"version":3,"file":"keyed.js","sources":["../src/directives/keyed.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing} from '../lit-html.js';\nimport {\n directive,\n Directive,\n ChildPart,\n DirectiveParameters,\n} from '../directive.js';\nimport {setCommittedValue} from '../directive-helpers.js';\n\nclass Keyed extends Directive {\n key: unknown = nothing;\n\n render(k: unknown, v: unknown) {\n this.key = k;\n return v;\n }\n\n override update(part: ChildPart, [k, v]: DirectiveParameters<this>) {\n if (k !== this.key) {\n // Clear the part before returning a value. The one-arg form of\n // setCommittedValue sets the value to a sentinel which forces a\n // commit the next render.\n setCommittedValue(part);\n this.key = k;\n }\n return v;\n }\n}\n\n/**\n * Associates a renderable value with a unique key. When the key changes, the\n * previous DOM is removed and disposed before rendering the next value, even\n * if the value - such as a template - is the same.\n *\n * This is useful for forcing re-renders of stateful components, or working\n * with code that expects new data to generate new HTML elements, such as some\n * animation techniques.\n */\nexport const keyed = directive(Keyed);\n\n/**\n * The type of the class that powers this directive. Necessary for naming the\n * directive's return type.\n */\nexport type {Keyed};\n"],"names":["keyed","directive","Directive","constructor","this","key","nothing","render","k","v","update","part","setCommittedValue"],"mappings":";;;;;SA4CaA,EAAQC,EA7BrB,cAAoBC,EAApB,WAAAC,uBACEC,KAAGC,IAAYC,CAiBhB,CAfC,MAAAC,CAAOC,EAAYC,GAEjB,OADAL,KAAKC,IAAMG,EACJC,CACR,CAEQ,MAAAC,CAAOC,GAAkBH,EAAGC,IAQnC,OAPID,IAAMJ,KAAKC,MAIbO,EAAkBD,GAClBP,KAAKC,IAAMG,GAENC,CACR"}