{"action":"created","comment":{"url":"https://api.github.com/repos/adamskaya/hpe-components/pulls/comments/260964587","pull_request_review_id":208789663,"id":260964587,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI2MDk2NDU4Nw==","diff_hunk":"@@ -1,81 +1,165 @@\n+import SmartMulticarouselRule from './smart-multicarousel-rule';\n+\n class SmartMulticarousel extends HTMLElement {\n \n-    static get is() {\n-        return 'smart-multicarousel';\n-    }\n-\n-    constructor() {\n-        super();\n-    }\n-\n-    private connectedCallback() {\n-        this.classList.add(SmartMulticarousel.is);\n-        this._bindEvents();\n-        const a = [];\n-        for (let i = 0; i < 3; i++) {\n-            a.push(i);\n-        }\n-        this.activeIndexes = a;\n-    }\n-\n-    private disconnectedCallback() {\n-        this.removeEventListener('click', this._onClick, false);\n-    }\n-\n-    private _bindEvents() {\n-        this.addEventListener('click', (event) => this._onClick(event), false);\n-        // this.addEventListener('sc-slideanimation', () => this._onAnimate(), false);\n-    }\n-\n-    get slides(): HTMLElement[] {\n-        const els = this.querySelectorAll('[data-slide-item]') as NodeListOf<HTMLElement>;\n-        return els ? Array.from(els) : [];\n-    }\n-\n-    get activeClass() {\n-        return this.getAttribute('active-slide-class') || 'active-slide';\n-    }\n-\n-    get activeIndexes(): number[] {\n-        const indexes: number[] = [];\n-        this.slides.forEach((el, index) => {\n-            if (el.classList.contains(this.activeClass)) {\n-                indexes.push(index);\n-            }\n-        });\n-        return indexes;\n-    }\n-\n-    set activeIndexes(numNextSlides) {\n-        this.activeIndexes.forEach((index) => this.slides[index].classList.remove(this.activeClass));\n-        numNextSlides.forEach((numNextSlide) => {\n-            numNextSlide = (numNextSlide + this.slides.length) % this.slides.length;\n-            this.slides[numNextSlide].classList.add(this.activeClass);\n-        });\n-        // this.triggerSlideChange();\n-    }\n-\n-    private _onClick(event: MouseEvent) {\n-        const target = event.target as HTMLElement;\n-        // console.log(target, 4);\n-        if (target && target.dataset.slideTarget) {\n-            this.setActive(target.dataset.slideTarget);\n-        }\n-    }\n-\n-\n-    public setActive(target: number | string) {\n-        const countSlides: number = 3;\n-        if ('prev' === target) {\n-            // this.setAttribute('direction', 'right');\n-            this.activeIndexes = this.activeIndexes.map((el) => el - countSlides);\n-        } else if ('next' === target) {\n-            // this.setAttribute('direction', 'left');\n-            this.activeIndexes = this.activeIndexes.map((el) => el + countSlides);\n-        } else {\n-            this.activeIndexes = this.activeIndexes.map((el) => el + countSlides * +target);\n-        }\n-    }\n+\tstatic get is() {\n+\t\treturn 'smart-multicarousel';\n+\t}\n+\n+\tstatic get observedAttributes() {\n+\t\treturn ['data-config'];\n+\t}\n+\n+\tprivate _rules: any[];\n+\tprivate _currentCount: number;\n+\n+\tconstructor() {\n+\t\tsuper();\n+\t}\n+\n+\tprivate connectedCallback() {\n+\t\tthis.classList.add(SmartMulticarousel.is);\n+\t\tthis._bindEvents();\n+\t\tconst a = [];\n+\t\tfor (let i = 0; i < 3; i++) {\n+\t\t\ta.push(i);\n+\t\t}\n+\t\tthis.activeIndexes = a;\n+\t}\n+\n+\tprivate disconnectedCallback() {\n+\t\tthis.removeEventListener('click', this._onClick, false);\n+\t}\n+\n+\t// -----\n+\tprivate attributeChangedCallback(attrName: string, oldVal: string, newVal: string) {\n+\t\tswitch (attrName) {\n+\t\t\tcase 'data-config':\n+\t\t\t\tthis.rules = SmartMulticarousel.parseRules(newVal);\n+\t\t\t\tthis.refresh();\n+\t\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tpublic refresh() {\n+\t\tthis.removeAttribute('loaded');\n+\t\tthis.removeAttribute('ready');\n+\t\tthis.update(true);\n+\t}\n+\n+\tget config() {\n+\t\treturn this.getAttribute('data-config');\n+\t}\n+\n+\tset config(config) {\n+\t\tthis.setAttribute('data-config', config);\n+\t}\n+\n+\tget rules() {\n+\t\tif (!this._rules) {\n+\t\t\tthis.rules = SmartMulticarousel.parseRules(this.config);\n+\t\t}\n+\t\treturn this._rules;\n+\t}\n+\n+\tset rules(rules) {\n+\t\tif (Array.isArray(rules)) {\n+\t\t\t// this._detachRuleListeners();\n+\t\t\tthis._rules = rules.filter((rule) => rule instanceof SmartMulticarouselRule);\n+\t\t\t// this._attachRuleListeners();\n+\t\t\treturn;\n+\t\t}\n+\t\tthrow new Error('Rules must be an array of rules');\n+\t}\n+\n+\tget targetRule() {\n+\t\tif (Array.isArray(this.rules)) {\n+\t\t\tconst satisfied = this.rules.filter((rule) => rule.matches);\n+\t\t\treturn satisfied.length > 0 ? satisfied[satisfied.length - 1] : SmartMulticarouselRule.empty();\n+\t\t}\n+\t\treturn SmartMulticarouselRule.empty();\n+\t}\n+\n+\tpublic update(force: boolean) {\n+\t\t// if (this.lazy && !this.lazyTriggered) {","path":"src/components/core/smart-multicarousel/ts/smart-multicarousel.ts","position":160,"original_position":160,"commit_id":"ddd869fcdcf595e0c0151f211b182918d5c1e8fc","original_commit_id":"ddd869fcdcf595e0c0151f211b182918d5c1e8fc","user":{"login":"ala-n","id":8127830,"node_id":"MDQ6VXNlcjgxMjc4MzA=","avatar_url":"https://avatars2.githubusercontent.com/u/8127830?v=4","gravatar_id":"","url":"https://api.github.com/users/ala-n","html_url":"https://github.com/ala-n","followers_url":"https://api.github.com/users/ala-n/followers","following_url":"https://api.github.com/users/ala-n/following{/other_user}","gists_url":"https://api.github.com/users/ala-n/gists{/gist_id}","starred_url":"https://api.github.com/users/ala-n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ala-n/subscriptions","organizations_url":"https://api.github.com/users/ala-n/orgs","repos_url":"https://api.github.com/users/ala-n/repos","events_url":"https://api.github.com/users/ala-n/events{/privacy}","received_events_url":"https://api.github.com/users/ala-n/received_events","type":"User","site_admin":false},"body":"We will not have any lazy behavior in carousel for sure. Remove this safely)","created_at":"2019-02-27T22:03:01Z","updated_at":"2019-02-27T22:08:01Z","html_url":"https://github.com/adamskaya/hpe-components/pull/3#discussion_r260964587","pull_request_url":"https://api.github.com/repos/adamskaya/hpe-components/pulls/3","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/adamskaya/hpe-components/pulls/comments/260964587"},"html":{"href":"https://github.com/adamskaya/hpe-components/pull/3#discussion_r260964587"},"pull_request":{"href":"https://api.github.com/repos/adamskaya/hpe-components/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/adamskaya/hpe-components/pulls/3","id":256587760,"node_id":"MDExOlB1bGxSZXF1ZXN0MjU2NTg3NzYw","html_url":"https://github.com/adamskaya/hpe-components/pull/3","diff_url":"https://github.com/adamskaya/hpe-components/pull/3.diff","patch_url":"https://github.com/adamskaya/hpe-components/pull/3.patch","issue_url":"https://api.github.com/repos/adamskaya/hpe-components/issues/3","number":3,"state":"open","locked":false,"title":"Config setting","user":{"login":"adamskaya","id":31704951,"node_id":"MDQ6VXNlcjMxNzA0OTUx","avatar_url":"https://avatars3.githubusercontent.com/u/31704951?v=4","gravatar_id":"","url":"https://api.github.com/users/adamskaya","html_url":"https://github.com/adamskaya","followers_url":"https://api.github.com/users/adamskaya/followers","following_url":"https://api.github.com/users/adamskaya/following{/other_user}","gists_url":"https://api.github.com/users/adamskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/adamskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamskaya/subscriptions","organizations_url":"https://api.github.com/users/adamskaya/orgs","repos_url":"https://api.github.com/users/adamskaya/repos","events_url":"https://api.github.com/users/adamskaya/events{/privacy}","received_events_url":"https://api.github.com/users/adamskaya/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-02-27T08:46:57Z","updated_at":"2019-02-27T22:08:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/adamskaya/hpe-components/pulls/3/commits","review_comments_url":"https://api.github.com/repos/adamskaya/hpe-components/pulls/3/comments","review_comment_url":"https://api.github.com/repos/adamskaya/hpe-components/pulls/comments{/number}","comments_url":"https://api.github.com/repos/adamskaya/hpe-components/issues/3/comments","statuses_url":"https://api.github.com/repos/adamskaya/hpe-components/statuses/ddd869fcdcf595e0c0151f211b182918d5c1e8fc","head":{"label":"adamskaya:config_setting","ref":"config_setting","sha":"ddd869fcdcf595e0c0151f211b182918d5c1e8fc","user":{"login":"adamskaya","id":31704951,"node_id":"MDQ6VXNlcjMxNzA0OTUx","avatar_url":"https://avatars3.githubusercontent.com/u/31704951?v=4","gravatar_id":"","url":"https://api.github.com/users/adamskaya","html_url":"https://github.com/adamskaya","followers_url":"https://api.github.com/users/adamskaya/followers","following_url":"https://api.github.com/users/adamskaya/following{/other_user}","gists_url":"https://api.github.com/users/adamskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/adamskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamskaya/subscriptions","organizations_url":"https://api.github.com/users/adamskaya/orgs","repos_url":"https://api.github.com/users/adamskaya/repos","events_url":"https://api.github.com/users/adamskaya/events{/privacy}","received_events_url":"https://api.github.com/users/adamskaya/received_events","type":"User","site_admin":false},"repo":{"id":171307567,"node_id":"MDEwOlJlcG9zaXRvcnkxNzEzMDc1Njc=","name":"hpe-components","full_name":"adamskaya/hpe-components","private":false,"owner":{"login":"adamskaya","id":31704951,"node_id":"MDQ6VXNlcjMxNzA0OTUx","avatar_url":"https://avatars3.githubusercontent.com/u/31704951?v=4","gravatar_id":"","url":"https://api.github.com/users/adamskaya","html_url":"https://github.com/adamskaya","followers_url":"https://api.github.com/users/adamskaya/followers","following_url":"https://api.github.com/users/adamskaya/following{/other_user}","gists_url":"https://api.github.com/users/adamskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/adamskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamskaya/subscriptions","organizations_url":"https://api.github.com/users/adamskaya/orgs","repos_url":"https://api.github.com/users/adamskaya/repos","events_url":"https://api.github.com/users/adamskaya/events{/privacy}","received_events_url":"https://api.github.com/users/adamskaya/received_events","type":"User","site_admin":false},"html_url":"https://github.com/adamskaya/hpe-components","description":null,"fork":false,"url":"https://api.github.com/repos/adamskaya/hpe-components","forks_url":"https://api.github.com/repos/adamskaya/hpe-components/forks","keys_url":"https://api.github.com/repos/adamskaya/hpe-components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamskaya/hpe-components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamskaya/hpe-components/teams","hooks_url":"https://api.github.com/repos/adamskaya/hpe-components/hooks","issue_events_url":"https://api.github.com/repos/adamskaya/hpe-components/issues/events{/number}","events_url":"https://api.github.com/repos/adamskaya/hpe-components/events","assignees_url":"https://api.github.com/repos/adamskaya/hpe-components/assignees{/user}","branches_url":"https://api.github.com/repos/adamskaya/hpe-components/branches{/branch}","tags_url":"https://api.github.com/repos/adamskaya/hpe-components/tags","blobs_url":"https://api.github.com/repos/adamskaya/hpe-components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamskaya/hpe-components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamskaya/hpe-components/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamskaya/hpe-components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamskaya/hpe-components/statuses/{sha}","languages_url":"https://api.github.com/repos/adamskaya/hpe-components/languages","stargazers_url":"https://api.github.com/repos/adamskaya/hpe-components/stargazers","contributors_url":"https://api.github.com/repos/adamskaya/hpe-components/contributors","subscribers_url":"https://api.github.com/repos/adamskaya/hpe-components/subscribers","subscription_url":"https://api.github.com/repos/adamskaya/hpe-components/subscription","commits_url":"https://api.github.com/repos/adamskaya/hpe-components/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamskaya/hpe-components/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamskaya/hpe-components/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamskaya/hpe-components/issues/comments{/number}","contents_url":"https://api.github.com/repos/adamskaya/hpe-components/contents/{+path}","compare_url":"https://api.github.com/repos/adamskaya/hpe-components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamskaya/hpe-components/merges","archive_url":"https://api.github.com/repos/adamskaya/hpe-components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamskaya/hpe-components/downloads","issues_url":"https://api.github.com/repos/adamskaya/hpe-components/issues{/number}","pulls_url":"https://api.github.com/repos/adamskaya/hpe-components/pulls{/number}","milestones_url":"https://api.github.com/repos/adamskaya/hpe-components/milestones{/number}","notifications_url":"https://api.github.com/repos/adamskaya/hpe-components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamskaya/hpe-components/labels{/name}","releases_url":"https://api.github.com/repos/adamskaya/hpe-components/releases{/id}","deployments_url":"https://api.github.com/repos/adamskaya/hpe-components/deployments","created_at":"2019-02-18T15:23:12Z","updated_at":"2019-02-26T18:23:44Z","pushed_at":"2019-02-27T09:42:39Z","git_url":"git://github.com/adamskaya/hpe-components.git","ssh_url":"git@github.com:adamskaya/hpe-components.git","clone_url":"https://github.com/adamskaya/hpe-components.git","svn_url":"https://github.com/adamskaya/hpe-components","homepage":null,"size":251,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"adamskaya:master","ref":"master","sha":"0de461c6ef63ba89f6e26be2ca7707e3c0dce219","user":{"login":"adamskaya","id":31704951,"node_id":"MDQ6VXNlcjMxNzA0OTUx","avatar_url":"https://avatars3.githubusercontent.com/u/31704951?v=4","gravatar_id":"","url":"https://api.github.com/users/adamskaya","html_url":"https://github.com/adamskaya","followers_url":"https://api.github.com/users/adamskaya/followers","following_url":"https://api.github.com/users/adamskaya/following{/other_user}","gists_url":"https://api.github.com/users/adamskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/adamskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamskaya/subscriptions","organizations_url":"https://api.github.com/users/adamskaya/orgs","repos_url":"https://api.github.com/users/adamskaya/repos","events_url":"https://api.github.com/users/adamskaya/events{/privacy}","received_events_url":"https://api.github.com/users/adamskaya/received_events","type":"User","site_admin":false},"repo":{"id":171307567,"node_id":"MDEwOlJlcG9zaXRvcnkxNzEzMDc1Njc=","name":"hpe-components","full_name":"adamskaya/hpe-components","private":false,"owner":{"login":"adamskaya","id":31704951,"node_id":"MDQ6VXNlcjMxNzA0OTUx","avatar_url":"https://avatars3.githubusercontent.com/u/31704951?v=4","gravatar_id":"","url":"https://api.github.com/users/adamskaya","html_url":"https://github.com/adamskaya","followers_url":"https://api.github.com/users/adamskaya/followers","following_url":"https://api.github.com/users/adamskaya/following{/other_user}","gists_url":"https://api.github.com/users/adamskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/adamskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamskaya/subscriptions","organizations_url":"https://api.github.com/users/adamskaya/orgs","repos_url":"https://api.github.com/users/adamskaya/repos","events_url":"https://api.github.com/users/adamskaya/events{/privacy}","received_events_url":"https://api.github.com/users/adamskaya/received_events","type":"User","site_admin":false},"html_url":"https://github.com/adamskaya/hpe-components","description":null,"fork":false,"url":"https://api.github.com/repos/adamskaya/hpe-components","forks_url":"https://api.github.com/repos/adamskaya/hpe-components/forks","keys_url":"https://api.github.com/repos/adamskaya/hpe-components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamskaya/hpe-components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamskaya/hpe-components/teams","hooks_url":"https://api.github.com/repos/adamskaya/hpe-components/hooks","issue_events_url":"https://api.github.com/repos/adamskaya/hpe-components/issues/events{/number}","events_url":"https://api.github.com/repos/adamskaya/hpe-components/events","assignees_url":"https://api.github.com/repos/adamskaya/hpe-components/assignees{/user}","branches_url":"https://api.github.com/repos/adamskaya/hpe-components/branches{/branch}","tags_url":"https://api.github.com/repos/adamskaya/hpe-components/tags","blobs_url":"https://api.github.com/repos/adamskaya/hpe-components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamskaya/hpe-components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamskaya/hpe-components/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamskaya/hpe-components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamskaya/hpe-components/statuses/{sha}","languages_url":"https://api.github.com/repos/adamskaya/hpe-components/languages","stargazers_url":"https://api.github.com/repos/adamskaya/hpe-components/stargazers","contributors_url":"https://api.github.com/repos/adamskaya/hpe-components/contributors","subscribers_url":"https://api.github.com/repos/adamskaya/hpe-components/subscribers","subscription_url":"https://api.github.com/repos/adamskaya/hpe-components/subscription","commits_url":"https://api.github.com/repos/adamskaya/hpe-components/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamskaya/hpe-components/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamskaya/hpe-components/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamskaya/hpe-components/issues/comments{/number}","contents_url":"https://api.github.com/repos/adamskaya/hpe-components/contents/{+path}","compare_url":"https://api.github.com/repos/adamskaya/hpe-components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamskaya/hpe-components/merges","archive_url":"https://api.github.com/repos/adamskaya/hpe-components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamskaya/hpe-components/downloads","issues_url":"https://api.github.com/repos/adamskaya/hpe-components/issues{/number}","pulls_url":"https://api.github.com/repos/adamskaya/hpe-components/pulls{/number}","milestones_url":"https://api.github.com/repos/adamskaya/hpe-components/milestones{/number}","notifications_url":"https://api.github.com/repos/adamskaya/hpe-components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamskaya/hpe-components/labels{/name}","releases_url":"https://api.github.com/repos/adamskaya/hpe-components/releases{/id}","deployments_url":"https://api.github.com/repos/adamskaya/hpe-components/deployments","created_at":"2019-02-18T15:23:12Z","updated_at":"2019-02-26T18:23:44Z","pushed_at":"2019-02-27T09:42:39Z","git_url":"git://github.com/adamskaya/hpe-components.git","ssh_url":"git@github.com:adamskaya/hpe-components.git","clone_url":"https://github.com/adamskaya/hpe-components.git","svn_url":"https://github.com/adamskaya/hpe-components","homepage":null,"size":251,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/adamskaya/hpe-components/pulls/3"},"html":{"href":"https://github.com/adamskaya/hpe-components/pull/3"},"issue":{"href":"https://api.github.com/repos/adamskaya/hpe-components/issues/3"},"comments":{"href":"https://api.github.com/repos/adamskaya/hpe-components/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/adamskaya/hpe-components/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/adamskaya/hpe-components/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/adamskaya/hpe-components/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/adamskaya/hpe-components/statuses/ddd869fcdcf595e0c0151f211b182918d5c1e8fc"}},"author_association":"OWNER"}}
{"actor":{"display_login":"ala-n"}}