{"code":"import { html } from '@polymer/lit-element';\r\nimport { unsafeHTML } from 'lit-html/lib/unsafe-html';\r\nimport 'reflect-metadata';\r\nexport const view = (view, css) => {\r\n    return function classDecorator(constructor) {\r\n        return class WithView extends constructor {\r\n            static get template() {\r\n                const t = document.createElement('template');\r\n                t.innerHTML = `<style>${css}</style>${view}`;\r\n                return t;\r\n            }\r\n        };\r\n    };\r\n};\r\nexport const bindAttributes = function classDecorator(constructor) {\r\n    return class BoundAttributes extends constructor {\r\n        _propertiesChanged(props, changedProps, prevProps) {\r\n            // @ts-ignore\r\n            super._propertiesChanged(props, changedProps, prevProps);\r\n            // @ts-ignore\r\n            const attrs = this.constructor._boundAttributes;\r\n            if (attrs && changedProps) {\r\n                Object.keys(changedProps).forEach(k => {\r\n                    if (attrs.includes(k)) {\r\n                        // @ts-ignore\r\n                        const v = props[k];\r\n                        // @ts-ignore\r\n                        if (v || v === 0)\r\n                            this.setAttribute(k, props[k]);\r\n                        // @ts-ignore\r\n                        else\r\n                            this.removeAttribute(k);\r\n                    }\r\n                });\r\n            }\r\n        }\r\n    };\r\n};\r\nexport const component = (name) => {\r\n    return function (klass) {\r\n        window.customElements.define(name, klass);\r\n    };\r\n};\r\nexport function property(first, second) {\r\n    let args;\r\n    let isGenerator = false;\r\n    if (second === undefined) {\r\n        args = first || {};\r\n        isGenerator = true;\r\n    }\r\n    else {\r\n        args = {};\r\n    }\r\n    function decorate(target, key) {\r\n        if (Reflect.hasMetadata('design:type', target, key)) {\r\n            args.type = Reflect.getMetadata('design:type', target, key);\r\n        }\r\n        target.constructor.properties = target.constructor.properties || {};\r\n        target.constructor.properties[key] = Object.assign(args, target.constructor.properties[key] || {});\r\n    }\r\n    if (isGenerator) {\r\n        return decorate;\r\n    }\r\n    else {\r\n        return decorate(first, second);\r\n    }\r\n}\r\nexport const style = (css) => {\r\n    return function classDecorator(constructor) {\r\n        return class WithStyle extends constructor {\r\n            get _style() {\r\n                return html `${unsafeHTML(`<style> ${css} </style>`)}`;\r\n            }\r\n        };\r\n    };\r\n};\r\nexport const dispatchChange = (prop = 'value', event = 'change') => function classDecorator(constructor) {\r\n    return class DispatchChange extends constructor {\r\n        _propertiesChanged(props, changedProps, prevProps) {\r\n            // @ts-ignore\r\n            super._propertiesChanged(props, changedProps, prevProps);\r\n            // @ts-ignore\r\n            if (changedProps && changedProps[prop] !== undefined)\r\n                this.dispatchEvent(new CustomEvent(event));\r\n        }\r\n    };\r\n};\r\n","dts":{"name":"/Users/tristanmatthias/projects/origami/zen/packages/util/decorators.d.ts","text":"import { TemplateResult } from 'lit-html';\r\nimport 'reflect-metadata';\r\nexport interface Property {\r\n    name?: string;\r\n    type?: any;\r\n    value?: any;\r\n    reflectToAttribute?: boolean;\r\n    readOnly?: boolean;\r\n    notify?: boolean;\r\n    computed?: string;\r\n    observer?: string;\r\n}\r\nexport declare const view: (view: string, css?: string | undefined) => <T extends new (...args: any[]) => {}>(constructor: T) => {\r\n    new (...args: any[]): {};\r\n    readonly template: HTMLTemplateElement;\r\n} & T;\r\nexport declare const bindAttributes: <T extends new (...args: any[]) => {}>(constructor: T) => {\r\n    new (...args: any[]): {\r\n        _propertiesChanged(props: object, changedProps: object, prevProps: object): void;\r\n    };\r\n} & T;\r\nexport declare const component: (name: string) => ClassDecorator;\r\nexport declare function property(args?: Property): PropertyDecorator;\r\nexport declare function property(target: Object, key: string | symbol): void;\r\nexport declare const style: (css: string) => <T extends new (...args: any[]) => {}>(constructor: T) => {\r\n    new (...args: any[]): {\r\n        readonly _style: TemplateResult;\r\n    };\r\n} & T;\r\nexport declare const dispatchChange: (prop?: string, event?: string) => <T extends new (...args: any[]) => {}>(constructor: T) => {\r\n    new (...args: any[]): {\r\n        _propertiesChanged(props: object, changedProps: object, prevProps: object): void;\r\n    };\r\n} & T;\r\n"}}
