{"version":3,"file":"diffProperty.mjs","sourceRoot":"","sources":["../../../src/decorators/diffProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,uBACL,YAAoB,EACpB,eAAqC,IAAI,EACzC,gBAA2B;IAE3B,MAAM,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;QAC9C,MAAM,CAAC,YAAY,CAAC,gBAAgB,YAAY,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7E,MAAM,CAAC,YAAY,CAAC,wBAAwB,EAAE,YAAY,CAAC,CAAC;QAC5D,EAAE,CAAC,CAAC,gBAAgB,IAAI,WAAW,CAAC,CAAC,CAAC;YACrC,MAAM,CAAC,YAAY,CAAC,cAAc,EAAE;gBACnC,YAAY;gBACZ,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,gBAAgB;aAC9D,CAAC,CAAC;QACJ,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,eAAe,YAAY,CAAC","sourcesContent":["import { handleDecorator } from './handleDecorator';\nimport { DiffPropertyFunction } from './../interfaces';\nimport { auto } from './../diff';\n\n/**\n * Decorator that can be used to register a function as a specific property diff\n *\n * @param propertyName  The name of the property of which the diff function is applied\n * @param diffType      The diff type, default is DiffType.AUTO.\n * @param diffFunction  A diff function to run if diffType if DiffType.CUSTOM\n */\nexport function diffProperty(\n\tpropertyName: string,\n\tdiffFunction: DiffPropertyFunction = auto,\n\treactionFunction?: Function\n) {\n\treturn handleDecorator((target, propertyKey) => {\n\t\ttarget.addDecorator(`diffProperty:${propertyName}`, diffFunction.bind(null));\n\t\ttarget.addDecorator('registeredDiffProperty', propertyName);\n\t\tif (reactionFunction || propertyKey) {\n\t\t\ttarget.addDecorator('diffReaction', {\n\t\t\t\tpropertyName,\n\t\t\t\treaction: propertyKey ? target[propertyKey] : reactionFunction\n\t\t\t});\n\t\t}\n\t});\n}\n\nexport default diffProperty;\n"]}