Skip to content

Commit

Permalink
chore(rb-base): replace deps lit-html and skatejs with @rapid-build-u…
Browse files Browse the repository at this point in the history
…i/rb-base and make corresponding updates
  • Loading branch information
jyounce committed Aug 30, 2018
1 parent 05428e8 commit d5ec78e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 119 deletions.
5 changes: 2 additions & 3 deletions src/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
},
"flat": true,
"dependencies": {
"@rapid-build-ui/rb-button": "^0.0.7",
"lit-html": "^0.10.2",
"skatejs": "^5.2.1"
"@rapid-build-ui/rb-base": "^0.0.1",
"@rapid-build-ui/rb-button": "^0.0.8"
}
}
68 changes: 0 additions & 68 deletions src/client/scripts/event-service.js

This file was deleted.

28 changes: 10 additions & 18 deletions src/client/scripts/rb-popover.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
/*************
* RB-POPOVER
*************/
import { props, withComponent } from '../../../skatejs/dist/esnext/index.js';
import { html, withRenderer } from './renderer.js';
import EventService from './event-service.js';
import '../../rb-button/scripts/rb-button.js';
import template from '../views/rb-popover.html';
import { props, html, RbBase } from '../../rb-base/scripts/rb-base.js';
import '../../rb-button/scripts/rb-button.js';
import template from '../views/rb-popover.html';

export class RbPopover extends withComponent(withRenderer()) {
export class RbPopover extends RbBase() {
/* Lifecycle
************/
constructor() {
super();
this.rbEvent = EventService.call(this);
this.state = {
hasContent: false,
// needed to set back original position
Expand Down Expand Up @@ -43,10 +40,8 @@ export class RbPopover extends withComponent(withRenderer()) {
caption: this.shadowRoot.querySelector('.caption')
}
this._hasContent(this.shadowRoot.querySelector('slot'));
this.rbEvent.add(window, 'window', 'click touchstart', '_windowClickToggle');
}
disconnected() {
this.rbEvent.remove(window, 'window', 'click touchstart', '_windowClickToggle');
this.rb.events.add(window, 'click touchstart', this._windowClickToggle);
if (this.showPopover) this.triggerUpdate();
}

/* Properties
Expand Down Expand Up @@ -124,7 +119,10 @@ export class RbPopover extends withComponent(withRenderer()) {
this._updateCssPositionClass('remove');
}
_setPosition(position = null) { // :void (recursive until viewable)
if (!this.showPopover) return;
if (!this.rb.view.isReady) return;
if (this.state.retries.isDone()) return; // see retries.limit

// Bootstrap
this._resetPosition(position);
let dims = this._getDimensions();
Expand Down Expand Up @@ -224,13 +222,7 @@ export class RbPopover extends withComponent(withRenderer()) {

/* Observer
***********/
async rendered() { // :void
if (!this.elms) return;
if (!this.elms.pointer) return;
if (!this.showPopover) return;
// await to ensure trigger/rb-button has dimensions
// TODO: find better way to ensure sub-component are ready
await(async()=>{})();
rendered() { // :void
this._setPosition();
}

Expand Down
16 changes: 0 additions & 16 deletions src/client/scripts/renderer.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/client/views/rb-popover.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
on-click="${this._clickToggle.bind(this)}"
on-mouseover="${this._hoverToggle.bind(this)}">
</rb-button>
<div class$="popover ${props.showPopover ? '' : 'hidden'}">
<div class$="popover ${props.showPopover && this.rb.view.isReady ? '' : 'hidden'}">
<em class="pointer"></em>
${props.caption ? html`<h3 class="caption">${props.caption}</h3>` : null}
<div class="body">
Expand Down
31 changes: 18 additions & 13 deletions src/client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,30 @@
# yarn lockfile v1


"@rapid-build-ui/rb-button@^0.0.7":
version "0.0.7"
resolved "https://registry.yarnpkg.com/@rapid-build-ui/rb-button/-/rb-button-0.0.7.tgz#4abbfc311697ee243171eb696f318bbbdc76ba59"
"@rapid-build-ui/rb-base@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@rapid-build-ui/rb-base/-/rb-base-0.0.1.tgz#b8133587641bf7742667e94a8a9015e68c9dd628"
dependencies:
"@rapid-build-ui/rb-icon" "^0.0.5"
lit-html "^0.10.2"
skatejs "^5.2.1"
skatejs "^5.2.3"

"@rapid-build-ui/rb-icon@^0.0.5":
version "0.0.5"
resolved "https://registry.yarnpkg.com/@rapid-build-ui/rb-icon/-/rb-icon-0.0.5.tgz#3d772fa4379d3a5f787b69763904c29b717290d1"
"@rapid-build-ui/rb-button@^0.0.8":
version "0.0.8"
resolved "https://registry.yarnpkg.com/@rapid-build-ui/rb-button/-/rb-button-0.0.8.tgz#a1542fbfd3b1594531013b1f72bd1d72b4e6dc9e"
dependencies:
lit-html "^0.10.2"
skatejs "^5.2.1"
"@rapid-build-ui/rb-base" "^0.0.1"
"@rapid-build-ui/rb-icon" "^0.0.6"

"@rapid-build-ui/rb-icon@^0.0.6":
version "0.0.6"
resolved "https://registry.yarnpkg.com/@rapid-build-ui/rb-icon/-/rb-icon-0.0.6.tgz#0c831f0aa1f5965ddd13cc8a2af40416889fdab2"
dependencies:
"@rapid-build-ui/rb-base" "^0.0.1"

lit-html@^0.10.2:
version "0.10.2"
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-0.10.2.tgz#53c846afcf91bb1e6623179ef22e327ab8ac0e0e"

skatejs@^5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/skatejs/-/skatejs-5.2.1.tgz#d53095b31a81e9654c1ed6a79b03f89b74235e26"
skatejs@^5.2.3:
version "5.2.3"
resolved "https://registry.yarnpkg.com/skatejs/-/skatejs-5.2.3.tgz#3a0db8f7ecf89cb4d715f94eb5aae2b415ae8237"

0 comments on commit d5ec78e

Please sign in to comment.