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BAAkB,gBAC1B,QAAQ,aAAe","file":"/npm/aurelia-style-binding-command-plugin@0.1.3/dist/commonjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/aurelia-style-binding-command-plugin@0.1.3/dist/commonjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar aureliaBinding = require('aurelia-binding');\nvar aureliaPal = require('aurelia-pal');\nvar aureliaTemplatingBinding = require('aurelia-templating-binding');\n\nvar styleObserverContext = 'StyleObserver:context';\r\nvar hyphenateCache = Object.create(null);\r\nvar capitalMatcher = /([A-Z])/g;\r\nfunction addHyphenAndLower(char) {\r\n    return '-' + char.toLowerCase();\r\n}\r\nfunction hyphenate(name) {\r\n    if (name in hyphenateCache) {\r\n        return hyphenateCache[name];\r\n    }\r\n    return hyphenateCache[name] = (name.charAt(0).toLowerCase() + name.slice(1)).replace(capitalMatcher, addHyphenAndLower);\r\n}\n\nvar InlineStyleObserver = /** @class */ (function () {\r\n    function InlineStyleObserver(element, cssRule) {\r\n        this.element = element;\r\n        this.cssRule = cssRule;\r\n        this.hyphenatedCssRule = hyphenate(cssRule);\r\n    }\r\n    InlineStyleObserver.prototype.getValue = function () {\r\n        return this.element.style.getPropertyValue(this.hyphenatedCssRule);\r\n    };\r\n    InlineStyleObserver.prototype.setValue = function (newValue) {\r\n        if (newValue !== this.value) {\r\n            this.prevValue = this.value;\r\n            this.value = newValue;\r\n            this.element.style.setProperty(this.hyphenatedCssRule, this.value);\r\n            this.notify();\r\n        }\r\n    };\r\n    InlineStyleObserver.prototype.notify = function () {\r\n        var prev = this.prevValue;\r\n        var curr = this.value;\r\n        this.callSubscribers(curr, prev);\r\n    };\r\n    InlineStyleObserver.prototype.syncValue = function () {\r\n        var prev = this.value;\r\n        var value = this.getValue();\r\n        if (value !== prev) {\r\n            this.prevValue = prev;\r\n            this.value = value;\r\n            this.notify();\r\n        }\r\n    };\r\n    InlineStyleObserver.prototype.observeMutation = function () {\r\n        var _this = this;\r\n        if (!this.mo) {\r\n            this.mo = aureliaPal.DOM.createMutationObserver(function () { return _this.syncValue(); });\r\n            this.mo.observe(this.element, {\r\n                attributes: true,\r\n                attributeFilter: ['style']\r\n            });\r\n        }\r\n    };\r\n    InlineStyleObserver.prototype.unobserveMutation = function () {\r\n        if (this.mo) {\r\n            this.mo.disconnect();\r\n            this.mo = null;\r\n        }\r\n    };\r\n    InlineStyleObserver.prototype.subscribe = function (context, callable) {\r\n        if (!this.hasSubscribers()) {\r\n            this.observeMutation();\r\n        }\r\n        this.addSubscriber(context, callable);\r\n    };\r\n    InlineStyleObserver.prototype.unsubscribe = function (context, callable) {\r\n        if (this.removeSubscriber(context, callable) && !this.hasSubscribers()) {\r\n            this.unobserveMutation();\r\n        }\r\n    };\r\n    return InlineStyleObserver;\r\n}());\r\naureliaBinding.subscriberCollection()(InlineStyleObserver);\n\nvar StyleExpression = /** @class */ (function () {\r\n    function StyleExpression(observerLocator, sourceExpression, targetProperty, mode, lookupFunctions) {\r\n        this.observerLocator = observerLocator;\r\n        this.sourceExpression = sourceExpression;\r\n        this.targetProperty = targetProperty;\r\n        this.mode = mode;\r\n        this.lookupFunctions = lookupFunctions;\r\n    }\r\n    StyleExpression.prototype.createBinding = function (target) {\r\n        return new StyleBinding(this.observerLocator, this.sourceExpression, target, this.targetProperty, this.mode, this.lookupFunctions);\r\n    };\r\n    return StyleExpression;\r\n}());\r\nStyleExpression.prototype.discrete = true;\r\nvar StyleBinding = /** @class */ (function () {\r\n    function StyleBinding(observerLocator, sourceExpression, target, targetProperty, mode, lookupFunctions) {\r\n        this.target = target;\r\n        this.targetProperty = targetProperty;\r\n        this.lookupFunctions = lookupFunctions;\r\n        this.observerLocator = observerLocator;\r\n        this.sourceExpression = sourceExpression;\r\n        this.mode = mode;\r\n    }\r\n    StyleBinding.prototype.updateTarget = function (value) {\r\n        this.styleObserver.setValue(value);\r\n    };\r\n    StyleBinding.prototype.updateSource = function (value) {\r\n        this.sourceExpression.assign(this.source, value, this.lookupFunctions);\r\n    };\r\n    StyleBinding.prototype.call = function (context, newValue, oldValue) {\r\n        if (!this.isBound) {\r\n            return;\r\n        }\r\n        if (context === aureliaBinding.sourceContext) {\r\n            oldValue = this.styleObserver.getValue();\r\n            newValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions);\r\n            if (newValue !== oldValue) {\r\n                this.updateTarget(newValue);\r\n            }\r\n            if (this.mode !== aureliaBinding.bindingMode.oneTime) {\r\n                this._version++;\r\n                this.sourceExpression.connect(this, this.source);\r\n                this.unobserve(false);\r\n            }\r\n            return;\r\n        }\r\n        if (context === styleObserverContext) {\r\n            if (newValue !== oldValue) {\r\n                this.updateSource(newValue);\r\n            }\r\n            return;\r\n        }\r\n        throw new Error(\"Unexpected context for style binding: \\\"\" + context + \"\\\"\");\r\n    };\r\n    StyleBinding.prototype.bind = function (source) {\r\n        if (this.isBound) {\r\n            if (this.source === source) {\r\n                return;\r\n            }\r\n            this.unbind();\r\n        }\r\n        this.isBound = true;\r\n        this.source = source;\r\n        if (this.sourceExpression.bind) {\r\n            this.sourceExpression.bind(this, source, this.lookupFunctions);\r\n        }\r\n        var _a = this, target = _a.target, targetProperty = _a.targetProperty;\r\n        var styleObserversLookup = target.__style_observer__ || (target.__style_observer__ = {});\r\n        var targetCssRule = hyphenate(targetProperty);\r\n        var styleObserver = styleObserversLookup[targetCssRule];\r\n        if (styleObserver) {\r\n            this.styleObserver = styleObserver;\r\n        }\r\n        else {\r\n            styleObserver = this.styleObserver = styleObserversLookup[targetCssRule] = new InlineStyleObserver(target, targetProperty);\r\n        }\r\n        var mode = this.mode;\r\n        // In from-view bindind mode, element inline style should be synced to view model\r\n        // during initialization phase. Only do so if there is that rule in inline style\r\n        // Not simply resolving via getPropertyValue as it normalizes everything to an empty string\r\n        // regardless the property presence\r\n        if (mode === aureliaBinding.bindingMode.fromView) {\r\n            if (target.hasAttribute('style')) {\r\n                var ruleValue = this.findRuleValue(target.style, targetCssRule);\r\n                if (ruleValue !== null) {\r\n                    this.updateSource(ruleValue);\r\n                }\r\n            }\r\n        }\r\n        else {\r\n            var value = this.sourceExpression.evaluate(source, this.lookupFunctions);\r\n            this.updateTarget(value);\r\n        }\r\n        if (mode === aureliaBinding.bindingMode.oneTime) {\r\n            return;\r\n        }\r\n        else if (mode === aureliaBinding.bindingMode.toView) {\r\n            aureliaBinding.enqueueBindingConnect(this);\r\n        }\r\n        else if (mode === aureliaBinding.bindingMode.twoWay) {\r\n            this.sourceExpression.connect(this, source);\r\n            styleObserver.subscribe(styleObserverContext, this);\r\n        }\r\n        else if (mode === aureliaBinding.bindingMode.fromView) {\r\n            styleObserver.subscribe(styleObserverContext, this);\r\n        }\r\n    };\r\n    StyleBinding.prototype.unbind = function () {\r\n        if (!this.isBound) {\r\n            return;\r\n        }\r\n        this.isBound = false;\r\n        if (this.sourceExpression.unbind) {\r\n            this.sourceExpression.unbind(this, this.source);\r\n        }\r\n        this.source = null;\r\n        this.styleObserver.unsubscribe(styleObserverContext, this);\r\n        this.styleObserver = null;\r\n        this.unobserve(true);\r\n    };\r\n    StyleBinding.prototype.connect = function (evaluate) {\r\n        if (!this.isBound) {\r\n            return;\r\n        }\r\n        if (evaluate) {\r\n            var value = this.sourceExpression.evaluate(this.source, this.lookupFunctions);\r\n            this.updateTarget(value);\r\n        }\r\n        this.sourceExpression.connect(this, this.source);\r\n    };\r\n    /**\r\n     * @internal\r\n     * Used to initially look for css value of a css rule\r\n     */\r\n    StyleBinding.prototype.findRuleValue = function (style, prop) {\r\n        for (var i = 0, ii = style.length; ii > i; ++i) {\r\n            if (style[i] === prop) {\r\n                return style.getPropertyValue(prop);\r\n            }\r\n        }\r\n        return null;\r\n    };\r\n    return StyleBinding;\r\n}());\r\naureliaBinding.connectable()(StyleBinding);\n\nvar siProto = aureliaTemplatingBinding.SyntaxInterpreter.prototype;\r\nsiProto.style = siProto['style-to-view'] = siProto['style-one-way'] = function (resources, element, info) {\r\n    return new StyleExpression(this.observerLocator, this.parser.parse(info.attrValue), info.attrName, aureliaBinding.bindingMode.toView, resources.lookupFunctions);\r\n};\r\nsiProto['style-one-time'] = function (resources, element, info) {\r\n    return new StyleExpression(this.observerLocator, this.parser.parse(info.attrValue), info.attrName, aureliaBinding.bindingMode.oneTime, resources.lookupFunctions);\r\n};\r\nsiProto['style-two-way'] = function (resources, element, info) {\r\n    return new StyleExpression(this.observerLocator, this.parser.parse(info.attrValue), info.attrName, aureliaBinding.bindingMode.twoWay, resources.lookupFunctions);\r\n};\r\nsiProto['style-from-view'] = function (resources, element, info) {\r\n    return new StyleExpression(this.observerLocator, this.parser.parse(info.attrValue), info.attrName, aureliaBinding.bindingMode.fromView, resources.lookupFunctions);\r\n};\n\nexports.InlineStyleObserver = InlineStyleObserver;\nexports.StyleExpression = StyleExpression;\nexports.StyleBinding = StyleBinding;\n"]}