{"code":"import * as tslib_1 from \"tslib\";\r\nimport { LitElement } from '@polymer/lit-element';\r\nimport { html } from 'lit-html';\r\n// @ts-ignore\r\nimport { installRouter } from 'pwa-helpers/router';\r\nimport { component, property } from 'util/decorators';\r\nlet Link = \r\n// @bindAttributes\r\nclass Link extends LitElement {\r\n    // static _boundAttributes = ['href'];\r\n    connectedCallback() {\r\n        const time = 3; // Time to delay sending pop state\r\n        super.connectedCallback();\r\n        this.addEventListener('click', () => {\r\n            if (this.href && window.location.pathname !== this.href) {\r\n                setTimeout(() => {\r\n                    dispatchEvent(new PopStateEvent('popstate', { state: {} }));\r\n                }, time);\r\n                window.history.pushState({}, '', this.href);\r\n            }\r\n        });\r\n    }\r\n    _firstRendered() {\r\n        installRouter(this._updateClass.bind(this));\r\n    }\r\n    _render() {\r\n        return html `\n            <style>\n                :host{\n                    display: inline-block;\n                    cursor: pointer;\n                }</style>\n            <slot></slot>\n        `;\r\n    }\r\n    _updateClass(l) {\r\n        let active = l.pathname === this.href;\r\n        if (!active)\r\n            active = l.pathname === `${this.href}/`;\r\n        this.classList.toggle('active', active);\r\n    }\r\n};\r\ntslib_1.__decorate([\r\n    property,\r\n    tslib_1.__metadata(\"design:type\", String)\r\n], Link.prototype, \"href\", void 0);\r\nLink = tslib_1.__decorate([\r\n    component('zen-link')\r\n    // @bindAttributes\r\n], Link);\r\nexport default Link;\r\n","dts":{"name":"/Users/tristanmatthias/projects/origami/zen/packages/components/Link/Link.d.ts","text":"import { LitElement } from '@polymer/lit-element';\r\nimport { TemplateResult } from 'lit-html';\r\nexport interface props {\r\n    href?: string;\r\n}\r\nexport default class Link extends LitElement implements props {\r\n    href?: string;\r\n    connectedCallback(): void;\r\n    _firstRendered(): void;\r\n    _render(): TemplateResult;\r\n    _updateClass(l: Location): void;\r\n}\r\n"}}
