diff options
author | Matěj Cepl <mcepl@redhat.com> | 2014-02-23 01:56:33 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2014-02-23 01:56:33 +0100 |
commit | 4876c70191852f9c256325df4394770e5636206e (patch) | |
tree | 395a5e597fa228022857774419514311b31a663e /style | |
parent | 4b61d269bf0cd94a0d290f53a160d62ca70e040c (diff) | |
download | zalmy-4876c70191852f9c256325df4394770e5636206e.tar.gz |
Add brick (http://mozilla.github.io/brick/) support files.
Diffstat (limited to 'style')
-rw-r--r-- | style/OpenSans-SemiBold.ttf | bin | 0 -> 221328 bytes | |||
-rw-r--r-- | style/brick-1.0.0rc1.css | 1028 | ||||
-rw-r--r-- | style/brick-1.0.0rc1.js | 4013 | ||||
-rw-r--r-- | style/brick-1.0.0rc1.min.css | 130 | ||||
-rw-r--r-- | style/brick-1.0.0rc1.min.js | 3 | ||||
-rw-r--r-- | style/readme-1.0.0rc1.txt | 16 |
6 files changed, 5190 insertions, 0 deletions
diff --git a/style/OpenSans-SemiBold.ttf b/style/OpenSans-SemiBold.ttf Binary files differnew file mode 100644 index 0000000..1a7679e --- /dev/null +++ b/style/OpenSans-SemiBold.ttf diff --git a/style/brick-1.0.0rc1.css b/style/brick-1.0.0rc1.css new file mode 100644 index 0000000..00c185e --- /dev/null +++ b/style/brick-1.0.0rc1.css @@ -0,0 +1,1028 @@ +x-appbar { + padding: 0; + width: 100%; + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; +} +x-appbar, +x-appbar * { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +x-appbar > * { + border: none; + vertical-align: middle; + text-align: center; + -webkit-flex-align: center; + -ms-flex-align: center; + -webkit-align-items: center; + -webkit-align-items: center; + -moz-align-items: center; + -ms-align-items: center; + align-items: center; + text-align: center; +} +x-appbar > header { + min-width: auto; + min-height: auto; + -webkit-box-flex: 1; + -moz-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + box-flex: 1; + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + margin: 0; +} + +x-calendar { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-tap-highlight-color: transparent; + -moz-tap-highlight-color: transparent; + tap-highlight-color: transparent; + position: relative; + display: inline-block; + margin: 0; + padding: 0; + max-width: 100%; + font-size: 1em; + text-align: center; + overflow: hidden; +} +x-calendar, +x-calendar * { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +x-calendar .calendar { + position: relative; + display: inline-block; + overflow: hidden; + width: 100%; + height: 100%; +} +x-calendar .month { + display: inline-block; + margin: 0; + padding: 0; + vertical-align: top; + white-space: nowrap; + width: 224px; + max-width: 100%; +} +x-calendar .week, +x-calendar .weekday-labels { + margin: 1px 0; + overflow: visible; + width: 100%; + white-space: nowrap; +} +x-calendar .day, +x-calendar .prev, +x-calendar .next, +x-calendar .weekday-label { + display: inline-block; + width: 32px; +} +x-calendar .month-label, +x-calendar .weekday-labels, +x-calendar .week, +x-calendar .prev, +x-calendar .next { + height: 2em; + line-height: 2em; +} +x-calendar .weekday-label { + opacity: 0.8; + font-size: 0.8em; +} +x-calendar .weekday-label, +x-calendar .day { + height: 100%; + line-height: inherit; + margin: 0 auto; +} +x-calendar .month-label { + width: 100%; +} +x-calendar .day { + position: relative; + white-space: nowrap; +} +x-calendar .badmonth { + opacity: 0.5; +} +x-calendar:not([controls]) .controls { + display: none !important; +} +x-calendar[controls] .controls { + display: block; +} +x-calendar .prev, +x-calendar .next { + position: absolute; + top: 0px; + max-width: 3em; +} +x-calendar .prev { + left: 0px; +} +x-calendar .next { + right: 0px; +} +x-calendar:not([active]) .day:hover, +x-calendar:not([active]) .prev:hover, +x-calendar:not([active]) .next:hover { + cursor: pointer; +} + +x-deck { + display: block; + position: relative; + overflow: hidden; + height: 100%; + width: 100%; +} +x-deck > x-card { + display: none; + position: absolute !important; + left: 0; + right: 0; + height: 100%; + width: 100%; + overflow: hidden; + z-index: 0; + opacity: 1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + -webkit-transform-style: preserve-3d; + -moz-transform-style: preserve-3d; + -ms-transform-style: preserve-3d; + -o-transform-style: preserve-3d; + transform-style: preserve-3d; + -webkit-transform: translate(0%, 0%) scale(1); + -moz-transform: translate(0%, 0%) scale(1); + -ms-transform: translate(0%, 0%) scale(1); + -o-transform: translate(0%, 0%) scale(1); + transform: translate(0%, 0%) scale(1); +} +x-deck > x-card[selected], +x-deck > x-card[transition] { + display: block; +} +/*** Default Transition ***/ +x-deck:not([transition-type]) > x-card:not([transition-type]), +x-deck[transition-type="fade-scale"] > x-card, +x-deck > x-card[transition-type="fade-scale"] { + opacity: 0; + -webkit-transform: scale(0.85); + -moz-transform: scale(0.85); + -ms-transform: scale(0.85); + -o-transform: scale(0.85); + transform: scale(0.85); + -webkit-transition: opacity 0.5s ease, -webkit-transform 0.5s ease; + -moz-transition: opacity 0.5s ease, -moz-transform 0.5s ease; + -ms-transition: opacity 0.5s ease, -ms-transform 0.5s ease; + -o-transition: opacity 0.5s ease, -o-transform 0.5s ease; + transition: opacity 0.5s ease, transform 0.5s ease; +} +x-deck > x-card[show][transition] { + opacity: 1; + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + -o-transform: scale(1); + transform: scale(1); +} +/*** General Slide Setup ***/ +x-deck[transition-type^="slide"] > x-card, +x-deck > x-card[transition-type^="slide"] { + z-index: 1; +} +x-deck[transition-type^="slide"] > x-card[transition-direction="reverse"], +x-deck > x-card[transition-type^="slide"][transition-direction="reverse"] { + z-index: 2; +} +x-deck[transition-type^="slide"] > x-card[show], +x-deck > x-card[show][transition-type^="slide"], +x-deck[transition-type^="slide"] > x-card[hide], +x-deck > x-card[hide][transition-type^="slide"] { + -webkit-transition: -webkit-transform 0.6s ease; + -moz-transition: -moz-transform 0.6s ease; + -ms-transition: -ms-transform 0.6s ease; + -o-transition: -o-transform 0.6s ease; + transition: transform 0.6s ease; +} +/*** Right/Left Slide Styles ***/ +x-deck[transition-type="slide-right"] > x-card[show][transition-direction="forward"], +x-deck > x-card[show][transition-direction="forward"][transition-type="slide-right"], +x-deck[transition-type="slide-right"] > x-card[hide][transition-direction="reverse"], +x-deck > x-card[hide][transition-direction="reverse"][transition-type="slide-right"], +x-deck[transition-type="slide-left"] > x-card[show][transition-direction="reverse"], +x-deck > x-card[show][transition-direction="reverse"][transition-type="slide-left"], +x-deck[transition-type="slide-left"] > x-card[hide][transition-direction="forward"], +x-deck > x-card[hide][transition-direction="forward"][transition-type="slide-left"] { + -webkit-transform: translate(-100%, 0); + -moz-transform: translate(-100%, 0); + -ms-transform: translate(-100%, 0); + -o-transform: translate(-100%, 0); + transform: translate(-100%, 0); +} +x-deck[transition-type="slide-right"] > x-card[show][transition-direction="reverse"], +x-deck > x-card[show][transition-direction="reverse"][transition-type="slide-right"], +x-deck[transition-type="slide-right"] > x-card[hide][transition-direction="forward"], +x-deck > x-card[hide][transition-direction="forward"][transition-type="slide-right"], +x-deck[transition-type="slide-left"] > x-card[show][transition-direction="forward"], +x-deck > x-card[show][transition-direction="forward"][transition-type="slide-left"], +x-deck[transition-type="slide-left"] > x-card[hide][transition-direction="reverse"], +x-deck > x-card[hide][transition-direction="reverse"][transition-type="slide-left"] { + -webkit-transform: translate(100%, 0); + -moz-transform: translate(100%, 0); + -ms-transform: translate(100%, 0); + -o-transform: translate(100%, 0); + transform: translate(100%, 0); +} +/*** Up/Down Slide Styles ***/ +x-deck[transition-type="slide-up"] > x-card[show][transition-direction="reverse"], +x-deck > x-card[show][transition-direction="reverse"][transition-type="slide-up"], +x-deck[transition-type="slide-up"] > x-card[hide][transition-direction="forward"], +x-deck > x-card[hide][transition-direction="forward"][transition-type="slide-up"], +x-deck[transition-type="slide-down"] > x-card[show][transition-direction="forward"], +x-deck > x-card[show][transition-direction="forward"][transition-type="slide-down"], +x-deck[transition-type="slide-down"] > x-card[hide][transition-direction="reverse"], +x-deck > x-card[hide][transition-direction="reverse"][transition-type="slide-down"] { + -webkit-transform: translate(0, -100%); + -moz-transform: translate(0, -100%); + -ms-transform: translate(0, -100%); + -o-transform: translate(0, -100%); + transform: translate(0, -100%); +} +x-deck[transition-type="slide-up"] > x-card[show][transition-direction="forward"], +x-deck > x-card[show][transition-direction="forward"][transition-type="slide-up"], +x-deck[transition-type="slide-up"] > x-card[hide][transition-direction="reverse"], +x-deck > x-card[hide][transition-direction="reverse"][transition-type="slide-up"], +x-deck[transition-type="slide-down"] > x-card[show][transition-direction="reverse"], +x-deck > x-card[show][transition-direction="reverse"][transition-type="slide-down"], +x-deck[transition-type="slide-down"] > x-card[hide][transition-direction="forward"], +x-deck > x-card[hide][transition-direction="forward"][transition-type="slide-down"] { + -webkit-transform: translate(0, 100%); + -moz-transform: translate(0, 100%); + -ms-transform: translate(0, 100%); + -o-transform: translate(0, 100%); + transform: translate(0, 100%); +} +/*** General Slide Show State ***/ +x-deck[transition-type^="slide"] > x-card[show][transition], +x-deck > x-card[show][transition][transition-type^="slide"] { + -webkit-transform: translate(0%, 0%); + -moz-transform: translate(0%, 0%); + -ms-transform: translate(0%, 0%); + -o-transform: translate(0%, 0%); + transform: translate(0%, 0%); +} + +x-flipbox { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: block; + position: relative; + height: 100%; + width: 100%; + -webkit-transform-style: preserve-3d; + -moz-transform-style: preserve-3d; + -ms-transform-style: preserve-3d; + -o-transform-style: preserve-3d; + transform-style: preserve-3d; +} +x-flipbox > * { + display: block; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -ms-backface-visibility: hidden; + -o-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-transition-property: -webkit-transform; + -moz-transition-property: -moz-transform; + -ms-transition-property: -ms-transform; + -o-transition-property: -o-transform; + transition-property: transform; + -webkit-transition-duration: 0.25s; + -moz-transition-duration: 0.25s; + -ms-transition-duration: 0.25s; + -o-transition-duration: 0.25s; + transition-duration: 0.25s; + -webkit-transition-timing-function: linear; + -moz-transition-timing-function: linear; + -ms-transition-timing-function: linear; + -o-transition-timing-function: linear; + transition-timing-function: linear; + -webkit-transition-delay: 0s; + -moz-transition-delay: 0s; + -ms-transition-delay: 0s; + -o-transition-delay: 0s; + transition-delay: 0s; +/* DO NOT ERASE THESE TRANSFORM-STYLES; they fix a flickering issue in FFOS*/ + -webkit-transform-style: preserve-3d; + -moz-transform-style: preserve-3d; + -ms-transform-style: preserve-3d; + -o-transform-style: preserve-3d; + transform-style: preserve-3d; +} +x-flipbox > *:first-child { + -webkit-transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 2px); + -moz-transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 2px); + -ms-transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 2px); + -o-transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 2px); + transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 2px); + z-index: 2; +} +x-flipbox > *:last-child { + -webkit-transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 1px); + -moz-transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 1px); + -ms-transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 1px); + -o-transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 1px); + transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 1px); + z-index: 1; +} +x-flipbox[_anim-direction="up"] > *:first-child, +x-flipbox[_anim-direction="down"] > *:first-child { + -webkit-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 2px); + -moz-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 2px); + -ms-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 2px); + -o-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 2px); + transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 2px); +} +x-flipbox[_anim-direction="up"] > *:last-child { + -webkit-transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 1px); + -moz-transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 1px); + -ms-transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 1px); + -o-transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 1px); + transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 1px); +} +x-flipbox[_anim-direction="down"] > *:last-child { + -webkit-transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 1px); + -moz-transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 1px); + -ms-transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 1px); + -o-transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 1px); + transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 1px); +} +x-flipbox[flipped]:after { +/* DO NOT ERASE THIS :after SELECTOR */ + content: ""; + display: none; +} +x-flipbox[flipped] > *:first-child { + -webkit-transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 2px); + -moz-transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 2px); + -ms-transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 2px); + -o-transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 2px); + transform: perspective(800px) rotateY(180deg) translate3d(0px, 0px, 2px); + z-index: 1; +} +x-flipbox[flipped] > *:last-child { + -webkit-transform: perspective(800px) rotateY(360deg) translate3d(0px, 0px, 1px); + -moz-transform: perspective(800px) rotateY(360deg) translate3d(0px, 0px, 1px); + -ms-transform: perspective(800px) rotateY(360deg) translate3d(0px, 0px, 1px); + -o-transform: perspective(800px) rotateY(360deg) translate3d(0px, 0px, 1px); + transform: perspective(800px) rotateY(360deg) translate3d(0px, 0px, 1px); + z-index: 2; +} +x-flipbox[_anim-direction="left"][flipped] > *:first-child { + -webkit-transform: perspective(800px) rotateY(-180deg) translate3d(0px, 0px, 2px); + -moz-transform: perspective(800px) rotateY(-180deg) translate3d(0px, 0px, 2px); + -ms-transform: perspective(800px) rotateY(-180deg) translate3d(0px, 0px, 2px); + -o-transform: perspective(800px) rotateY(-180deg) translate3d(0px, 0px, 2px); + transform: perspective(800px) rotateY(-180deg) translate3d(0px, 0px, 2px); +} +x-flipbox[_anim-direction="left"][flipped] > *:last-child { + -webkit-transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 1px); + -moz-transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 1px); + -ms-transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 1px); + -o-transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 1px); + transform: perspective(800px) rotateY(0deg) translate3d(0px, 0px, 1px); +} +x-flipbox[_anim-direction="up"][flipped] > *:first-child { + -webkit-transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 2px); + -moz-transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 2px); + -ms-transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 2px); + -o-transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 2px); + transform: perspective(800px) rotateX(180deg) translate3d(0px, 0px, 2px); +} +x-flipbox[_anim-direction="up"][flipped] > *:last-child { + -webkit-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); + -moz-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); + -ms-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); + -o-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); + transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); +} +x-flipbox[_anim-direction="down"][flipped] > *:first-child { + -webkit-transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 2px); + -moz-transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 2px); + -ms-transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 2px); + -o-transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 2px); + transform: perspective(800px) rotateX(-180deg) translate3d(0px, 0px, 2px); +} +x-flipbox[_anim-direction="down"][flipped] > *:last-child { + -webkit-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); + -moz-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); + -ms-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); + -o-transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); + transform: perspective(800px) rotateX(0deg) translate3d(0px, 0px, 1px); +} + +x-layout { +/* relative positioning is important because x-layout should really be + * placed in a parent container for it to fill; + * also, setting position:absolute causes older flexbox implementations, + * such as Firefox 18 (which is the version in FirefoxOS) to render + * flex items in a way such that it won't override a height:0 declaration, + * which is important for allowing the flex item to shrink past its + * content size */ + position: relative !important; + display: -webkit-box; +/* OLD - iOS 6-, Safari 3.1-6 */ + display: -moz-box; +/* OLD - Firefox 19- (buggy but mostly works) */ + display: -ms-flexbox; +/* TWEENER - IE 10 */ + display: -webkit-flex; +/* NEW - Chrome */ + display: flex; +/* NEW, Spec - Opera 12.1, Firefox 20+ */ + width: 100%; + height: 100%; + overflow: hidden; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-orient: vertical; + -moz-box-orient: vertical; + -ms-box-orient: vertical; + box-orient: vertical; + -webkit-flex-direction: column; + -moz-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; +} +x-layout > header, +x-layout > footer { + margin: 0 !important; + overflow: hidden; + z-index: 1; + -webkit-transform: translateZ(0); + -moz-transform: translateZ(0); + -ms-transform: translateZ(0); + transform: translateZ(0); +} +x-layout > header, +x-layout > footer { + -webkit-transition: -webkit-transform 0.2s ease-in-out; + -moz-transition: -moz-transform 0.2s ease-in-out; + -ms-transition: -ms-transform 0.2s ease-in-out; + transition: transform 0.2s ease-in-out; +} +x-layout > section { + -webkit-box-flex: 1; + -moz-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + flex: 1; + -webkit-transition: margin 0.2s ease-in-out; + -moz-transition: margin 0.2s ease-in-out; + -ms-transition: margin 0.2s ease-in-out; + transition: margin 0.2s ease-in-out; + -webkit-transform: translateZ(0); + -moz-transform: translateZ(0); + -ms-transform: translateZ(0); + transform: translateZ(0); + overflow: auto; +/* DON'T ERASE THIS: although this gets overridden by the flex display + * render, this fixes an issue with older browsers (ex: FF18) where unless + * a flex item was height 0, it would refuse to shrink past the auto + * height of the content, preventing the scrollbar from appearing */ + height: 0; + position: relative; +} +x-layout:not([content-maximizing]):not([maxcontent]) > section { + margin: 0 !important; +} +x-layout > section > *:only-child { +/* fix for issue where 100% height children of flex items render as zero + * height in Webkit + * see: http://stackoverflow.com/a/15389545 + */ + height: 100%; + position: absolute; +} +x-layout[content-maximizing] > header, +x-layout[content-maximized] > header, +x-layout[maxcontent] > header { + -webkit-transform: translateY(-100%); + -moz-transform: translateY(-100%); + -ms-transform: translateY(-100%); + transform: translateY(-100%); +} +x-layout[content-maximizing] > footer, +x-layout[content-maximized] > footer, +x-layout[maxcontent] > footer { + -webkit-transform: translateY(100%); + -moz-transform: translateY(100%); + -ms-transform: translateY(100%); + transform: translateY(100%); +} + +x-slider { + display: inline-block; + position: relative; + margin: 0; + padding: 0; +} +x-slider > input { + margin: 0; + padding: 0; + position: relative; + overflow: hidden; + vertical-align: middle; + width: 100%; + min-height: 100%; +} +x-slider .slider-track { + position: absolute; + display: block; + left: 0; + right: 0; + bottom: 0; + top: 0; + width: 100%; + height: 4px; + margin: auto; + pointer-events: none; +} +x-slider .slider-thumb { + cursor: default; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-tap-highlight-color: transparent; + -moz-tap-highlight-color: transparent; + tap-highlight-color: transparent; + vertical-align: middle; + position: absolute !important; + top: 0; + left: 0; + width: 32px; + height: 32px; + margin: 0; + padding: 0; +} +x-slider[polyfill] { + cursor: default; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-tap-highlight-color: transparent; + -moz-tap-highlight-color: transparent; + tap-highlight-color: transparent; +} +x-slider[polyfill] > input { + cursor: default; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-tap-highlight-color: transparent; + -moz-tap-highlight-color: transparent; + tap-highlight-color: transparent; + display: block; + position: relative; +} +x-slider[polyfill] > input::-webkit-slider-thumb { + visibility: hidden; +} +x-slider[polyfill] > input::-moz-range-thumb { + width: 0px; + height: 0px; +} +x-slider[polyfill] > input::-moz-range-track { + height: 0; + width: 0; +} +x-slider:not([polyfill]) > .slider-thumb { + visibility: hidden !important; +} + +x-tabbar { + display: block; + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + width: 100%; + overflow: hidden; + white-space: nowrap; + text-align: center; +} +x-tabbar > x-tabbar-tab { + min-width: auto; + min-height: auto; + -webkit-box-flex: 1; + -moz-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + box-flex: 1; + flex: 1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + min-width: auto; + min-height: auto; + vertical-align: middle; +} +x-tabbar > x-tabbar-tab > *:only-child { + vertical-align: top; + height: 100%; + width: 100%; + margin: 0 !important; +} + +x-toggle { + display: inline-block; + cursor: pointer; +} +x-toggle[focus] { + outline: 1px dashed rgba(0,0,0,0.3); +} +x-toggle[no-box] .x-toggle-check { + display: none; +} +x-toggle input:checked + .x-toggle-check { + background: #000; +} +x-toggle[type="radio"] .x-toggle-check { + -webkit-border-radius: 1em; + -moz-border-radius: 1em; + border-radius: 1em; +} +x-toggle:after { + content: attr(label); + display: inline-block; + vertical-align: middle; +} +x-toggle .x-toggle-check { + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 16px; + height: 16px; + margin: 0px 3px 0px 0px; + color: #000; + vertical-align: middle; + border: 1px solid; + overflow: hidden !important; +} +x-toggle input { + position: absolute; + outline: none; + z-index: -1; +/* do not remove visibility or display because we still want tab-ability */ + opacity: 0.0001 !important; +} +x-togglebar { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + border: 1px solid #000; + border-radius: 4px; + clear: both; +} +x-togglebar x-toggle { + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + padding: 1px 4px 2px; + border-left: inherit; + text-align: center; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-box-flex: 1; + -moz-box-flex: 1; + -webkit-flex: 1; + -ms-flex: 1; + box-flex: 1; + flex: 1; + -webkit-box-align: center; + -moz-box-align: center; + -ms-flex-align: center; + -webkit-align-items: center; + align-items: center; + -webkit-box-pack: center; + -moz-box-pack: center; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; +} +x-togglebar x-toggle:first-child { + border-left-color: transparent; +} +x-togglebar x-toggle[checked] { + background: rgba(0,0,0,0.2); +} +x-togglebar x-toggle[focus] { + -webkit-box-shadow: 0 0 2px 0 transparent; + -moz-box-shadow: 0 0 2px 0 transparent; + box-shadow: 0 0 2px 0 transparent; +} +x-togglebar x-toggle .x-toggle-check { + height: 10px; + width: 10px; +} +x-togglebar x-toggle[type="checkbox"] .x-toggle-check { + display: none; +} +x-togglebar[orientation="vertical"] { + -webkit-box-orient: vertical; + -moz-box-orient: vertical; + -ms-box-orient: vertical; + box-orient: vertical; + -webkit-flex-direction: column; + -moz-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; +} +x-togglebar[orientation="vertical"] x-toggle { + border-top: inherit; + border-left: none; +} +x-togglebar[orientation="vertical"] x-toggle:first-child { + border-top: none; +} + +x-appbar { + background-color: #00202f; + color: #fff; + font-family: "Fira Sans", "Fira Sans", "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif; + font-size: 17px; + height: 45px; + line-height: 45px; +} +x-appbar > header { + font-weight: 600; +} +x-appbar > * { + color: #fff; + font-family: "Fira Sans", "Fira Sans", "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif; + font-size: inherit; + line-height: inherit; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +x-appbar > button { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + min-width: 45px; + background: transparent; +} +x-appbar > button:hover { + background-color: #00405d; +} +x-appbar > button::-moz-focus-inner { + border: 0; + padding: 0; +} +x-appbar > header:after { + padding-left: 6px; + font-size: 60%; +} + +x-calendar { + border: 1px solid #cecece; + border-radius: 3px; + font-size: 1em; + font-family: "Fira Sans", "Fira Sans", "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif; + background-color: #fff; + color: #444; +} +x-calendar .weekday-label { + opacity: 0.8; +} +x-calendar .month-label { + border-bottom: 1px solid #cecece; +} +x-calendar .day[active] { + border-color: #ffa500; +} +x-calendar .day.chosen { + background: #0095dd; + color: #fff; +} +x-calendar .day.today { + font-weight: bold; +} +x-calendar:not([active]) .prev:hover, +x-calendar:not([active]) .next:hover { + background-color: #f9f9f9; + opacity: 0.7; +} +x-calendar:not([active]) .day:not(.chosen):hover { + background: #ccc; +} + +html, +body { + min-height: 100%; +} + +x-slider { + height: 27px; +} +x-slider:not([polyfill]) .slider-thumb { + display: none; +} +x-slider:not([polyfill]) input { + z-index: 1; +} +x-slider[polyfill] input { + visibility: hidden; +} +x-slider .slider-progress { + position: absolute; + top: 0; + left: 0; + height: 100%; + border-radius: 3px; + background: #0095dd; +} +x-slider .slider-thumb, +x-slider input[type='range']::-webkit-slider-thumb { + background: #fff; + -webkit-appearance: none; + border-radius: 13px; + border: 1px solid #acacac; + box-shadow: 0px 0.5px 1px 0px rgba(0,0,0,0.2); + cursor: pointer; + display: block; + height: 25px; + width: 25px; +} +x-slider .slider-thumb, +x-slider input[type='range']::-moz-range-thumb { + background: #fff; + -moz-appearance: none; + border-radius: 13px; + border: 1px solid #acacac; + box-shadow: 0px 0.5px 1px 0px rgba(0,0,0,0.2); + cursor: pointer; + display: block; + height: 25px; + width: 25px; +} +x-slider .slider-track { + background: #d8d8d8; + border-radius: 3px; + height: 2px; + overflow: hidden; +} +x-slider input[type=range]::-moz-range-track { + -moz-appearance: none; + background: #d8d8d8; + border: 0 !important; + outline: 0; + border-radius: 3px; + height: 2px; + box-shadow: 0 none; +} +x-slider input[type=range]::-moz-range-progress { + background: #0095dd; + border-radius: 3px; +} +x-slider input { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + background: transparent; + border: 0px solid transparent; + color: transparent; +} + +x-tabbar { + background: #00202f; + color: #fff; + font-family: "Fira Sans", "Fira Sans", "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif; + height: 45px; + line-height: 45px; +} +x-tabbar > x-tabbar-tab { + letter-spacing: normal; + overflow: hidden; + cursor: pointer; +} +x-tabbar > x-tabbar-tab:hover { + background-color: #00405d; + color: #eaeaea; +} +x-tabbar > x-tabbar-tab:active { + color: #f2f2f2; +} +x-tabbar > x-tabbar-tab > x-iconbutton:only-child { + border: 0; +} + +x-toggle[focus] { + outline: 0; +} +x-toggle .x-toggle-content { + min-height: 22px; + line-height: 24px; +} +x-toggle .x-toggle-check { + width: 22px; + height: 22px; + border-radius: 3px; + margin: 0px 3px 0px 0px; + color: #000; + vertical-align: middle; + border: 1px solid #00202f; + position: relative; + background: #fff; +} +x-toggle[no-box] .x-toggle-check { + display: none !important; +} +x-toggle[type="radio"] input:checked + .x-toggle-check { + background: #fff; +} +x-toggle[type="radio"] input:checked + .x-toggle-check:after { + content: ''; + display: block; + position: absolute; + left: 0; + top: 0; + bottom: 0; + right: 0; + margin: auto; + border-radius: 50%; + width: 14px; + height: 14px; + background: #0095dd; +} +x-toggle[type="checkbox"] input:checked + .x-toggle-check { + border-width: 0; + background: #0095dd; +} +x-toggle[type="checkbox"] input:checked + .x-toggle-check:after { + content: ''; + display: block; + position: absolute; + left: 0; + top: 0; + bottom: 3.2px; + right: 0; + margin: auto; + width: 10px; + height: 5px; + border: solid #fff; + border-width: 0 0 2px 2px; + -webkit-transform: rotate(-45deg); + -moz-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + -o-transform: rotate(-45deg); + transform: rotate(-45deg); +} diff --git a/style/brick-1.0.0rc1.js b/style/brick-1.0.0rc1.js new file mode 100644 index 0000000..ffd21c3 --- /dev/null +++ b/style/brick-1.0.0rc1.js @@ -0,0 +1,4013 @@ +window.Platform = {}; + +var logFlags = {}; + +(function() { + if (typeof window.Element === "undefined" || "classList" in document.documentElement) return; + var prototype = Array.prototype, indexOf = prototype.indexOf, slice = prototype.slice, push = prototype.push, splice = prototype.splice, join = prototype.join; + function DOMTokenList(el) { + this._element = el; + if (el.className != this._classCache) { + this._classCache = el.className; + if (!this._classCache) return; + var classes = this._classCache.replace(/^\s+|\s+$/g, "").split(/\s+/), i; + for (i = 0; i < classes.length; i++) { + push.call(this, classes[i]); + } + } + } + function setToClassName(el, classes) { + el.className = classes.join(" "); + } + DOMTokenList.prototype = { + add: function(token) { + if (this.contains(token)) return; + push.call(this, token); + setToClassName(this._element, slice.call(this, 0)); + }, + contains: function(token) { + return indexOf.call(this, token) !== -1; + }, + item: function(index) { + return this[index] || null; + }, + remove: function(token) { + var i = indexOf.call(this, token); + if (i === -1) { + return; + } + splice.call(this, i, 1); + setToClassName(this._element, slice.call(this, 0)); + }, + toString: function() { + return join.call(this, " "); + }, + toggle: function(token) { + if (indexOf.call(this, token) === -1) { + this.add(token); + } else { + this.remove(token); + } + } + }; + window.DOMTokenList = DOMTokenList; + function defineElementGetter(obj, prop, getter) { + if (Object.defineProperty) { + Object.defineProperty(obj, prop, { + get: getter + }); + } else { + obj.__defineGetter__(prop, getter); + } + } + defineElementGetter(Element.prototype, "classList", function() { + return new DOMTokenList(this); + }); +})(); + +if (typeof WeakMap === "undefined") { + (function() { + var defineProperty = Object.defineProperty; + var counter = Date.now() % 1e9; + var WeakMap = function() { + this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__"); + }; + WeakMap.prototype = { + set: function(key, value) { + var entry = key[this.name]; + if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, { + value: [ key, value ], + writable: true + }); + }, + get: function(key) { + var entry; + return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined; + }, + "delete": function(key) { + this.set(key, undefined); + } + }; + window.WeakMap = WeakMap; + })(); +} + +(function(global) { + var registrationsTable = new WeakMap(); + var setImmediate = window.msSetImmediate; + if (!setImmediate) { + var setImmediateQueue = []; + var sentinel = String(Math.random()); + window.addEventListener("message", function(e) { + if (e.data === sentinel) { + var queue = setImmediateQueue; + setImmediateQueue = []; + queue.forEach(function(func) { + func(); + }); + } + }); + setImmediate = function(func) { + setImmediateQueue.push(func); + window.postMessage(sentinel, "*"); + }; + } + var isScheduled = false; + var scheduledObservers = []; + function scheduleCallback(observer) { + scheduledObservers.push(observer); + if (!isScheduled) { + isScheduled = true; + setImmediate(dispatchCallbacks); + } + } + function wrapIfNeeded(node) { + return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node; + } + function dispatchCallbacks() { + isScheduled = false; + var observers = scheduledObservers; + scheduledObservers = []; + observers.sort(function(o1, o2) { + return o1.uid_ - o2.uid_; + }); + var anyNonEmpty = false; + observers.forEach(function(observer) { + var queue = observer.takeRecords(); + removeTransientObserversFor(observer); + if (queue.length) { + observer.callback_(queue, observer); + anyNonEmpty = true; + } + }); + if (anyNonEmpty) dispatchCallbacks(); + } + function removeTransientObserversFor(observer) { + observer.nodes_.forEach(function(node) { + var registrations = registrationsTable.get(node); + if (!registrations) return; + registrations.forEach(function(registration) { + if (registration.observer === observer) registration.removeTransientObservers(); + }); + }); + } + function forEachAncestorAndObserverEnqueueRecord(target, callback) { + for (var node = target; node; node = node.parentNode) { + var registrations = registrationsTable.get(node); + if (registrations) { + for (var j = 0; j < registrations.length; j++) { + var registration = registrations[j]; + var options = registration.options; + if (node !== target && !options.subtree) continue; + var record = callback(options); + if (record) registration.enqueue(record); + } + } + } + } + var uidCounter = 0; + function JsMutationObserver(callback) { + this.callback_ = callback; + this.nodes_ = []; + this.records_ = []; + this.uid_ = ++uidCounter; + } + JsMutationObserver.prototype = { + observe: function(target, options) { + target = wrapIfNeeded(target); + if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) { + throw new SyntaxError(); + } + var registrations = registrationsTable.get(target); + if (!registrations) registrationsTable.set(target, registrations = []); + var registration; + for (var i = 0; i < registrations.length; i++) { + if (registrations[i].observer === this) { + registration = registrations[i]; + registration.removeListeners(); + registration.options = options; + break; + } + } + if (!registration) { + registration = new Registration(this, target, options); + registrations.push(registration); + this.nodes_.push(target); + } + registration.addListeners(); + }, + disconnect: function() { + this.nodes_.forEach(function(node) { + var registrations = registrationsTable.get(node); + for (var i = 0; i < registrations.length; i++) { + var registration = registrations[i]; + if (registration.observer === this) { + registration.removeListeners(); + registrations.splice(i, 1); + break; + } + } + }, this); + this.records_ = []; + }, + takeRecords: function() { + var copyOfRecords = this.records_; + this.records_ = []; + return copyOfRecords; + } + }; + function MutationRecord(type, target) { + this.type = type; + this.target = target; + this.addedNodes = []; + this.removedNodes = []; + this.previousSibling = null; + this.nextSibling = null; + this.attributeName = null; + this.attributeNamespace = null; + this.oldValue = null; + } + function copyMutationRecord(original) { + var record = new MutationRecord(original.type, original.target); + record.addedNodes = original.addedNodes.slice(); + record.removedNodes = original.removedNodes.slice(); + record.previousSibling = original.previousSibling; + record.nextSibling = original.nextSibling; + record.attributeName = original.attributeName; + record.attributeNamespace = original.attributeNamespace; + record.oldValue = original.oldValue; + return record; + } + var currentRecord, recordWithOldValue; + function getRecord(type, target) { + return currentRecord = new MutationRecord(type, target); + } + function getRecordWithOldValue(oldValue) { + if (recordWithOldValue) return recordWithOldValue; + recordWithOldValue = copyMutationRecord(currentRecord); + recordWithOldValue.oldValue = oldValue; + return recordWithOldValue; + } + function clearRecords() { + currentRecord = recordWithOldValue = undefined; + } + function recordRepresentsCurrentMutation(record) { + return record === recordWithOldValue || record === currentRecord; + } + function selectRecord(lastRecord, newRecord) { + if (lastRecord === newRecord) return lastRecord; + if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue; + return null; + } + function Registration(observer, target, options) { + this.observer = observer; + this.target = target; + this.options = options; + this.transientObservedNodes = []; + } + Registration.prototype = { + enqueue: function(record) { + var records = this.observer.records_; + var length = records.length; + if (records.length > 0) { + var lastRecord = records[length - 1]; + var recordToReplaceLast = selectRecord(lastRecord, record); + if (recordToReplaceLast) { + records[length - 1] = recordToReplaceLast; + return; + } + } else { + scheduleCallback(this.observer); + } + records[length] = record; + }, + addListeners: function() { + this.addListeners_(this.target); + }, + addListeners_: function(node) { + var options = this.options; + if (options.attributes) node.addEventListener("DOMAttrModified", this, true); + if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true); + if (options.childList) node.addEventListener("DOMNodeInserted", this, true); + if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true); + }, + removeListeners: function() { + this.removeListeners_(this.target); + }, + removeListeners_: function(node) { + var options = this.options; + if (options.attributes) node.removeEventListener("DOMAttrModified", this, true); + if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true); + if (options.childList) node.removeEventListener("DOMNodeInserted", this, true); + if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true); + }, + addTransientObserver: function(node) { + if (node === this.target) return; + this.addListeners_(node); + this.transientObservedNodes.push(node); + var registrations = registrationsTable.get(node); + if (!registrations) registrationsTable.set(node, registrations = []); + registrations.push(this); + }, + removeTransientObservers: function() { + var transientObservedNodes = this.transientObservedNodes; + this.transientObservedNodes = []; + transientObservedNodes.forEach(function(node) { + this.removeListeners_(node); + var registrations = registrationsTable.get(node); + for (var i = 0; i < registrations.length; i++) { + if (registrations[i] === this) { + registrations.splice(i, 1); + break; + } + } + }, this); + }, + handleEvent: function(e) { + e.stopImmediatePropagation(); + switch (e.type) { + case "DOMAttrModified": + var name = e.attrName; + var namespace = e.relatedNode.namespaceURI; + var target = e.target; + var record = new getRecord("attributes", target); + record.attributeName = name; + record.attributeNamespace = namespace; + var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue; + forEachAncestorAndObserverEnqueueRecord(target, function(options) { + if (!options.attributes) return; + if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) { + return; + } + if (options.attributeOldValue) return getRecordWithOldValue(oldValue); + return record; + }); + break; + + case "DOMCharacterDataModified": + var target = e.target; + var record = getRecord("characterData", target); + var oldValue = e.prevValue; + forEachAncestorAndObserverEnqueueRecord(target, function(options) { + if (!options.characterData) return; + if (options.characterDataOldValue) return getRecordWithOldValue(oldValue); + return record; + }); + break; + + case "DOMNodeRemoved": + this.addTransientObserver(e.target); + + case "DOMNodeInserted": + var target = e.relatedNode; + var changedNode = e.target; + var addedNodes, removedNodes; + if (e.type === "DOMNodeInserted") { + addedNodes = [ changedNode ]; + removedNodes = []; + } else { + addedNodes = []; + removedNodes = [ changedNode ]; + } + var previousSibling = changedNode.previousSibling; + var nextSibling = changedNode.nextSibling; + var record = getRecord("childList", target); + record.addedNodes = addedNodes; + record.removedNodes = removedNodes; + record.previousSibling = previousSibling; + record.nextSibling = nextSibling; + forEachAncestorAndObserverEnqueueRecord(target, function(options) { + if (!options.childList) return; + return record; + }); + } + clearRecords(); + } + }; + global.JsMutationObserver = JsMutationObserver; + if (!global.MutationObserver && global.WebKitMutationObserver) global.MutationObserver = global.WebKitMutationObserver; + if (!global.MutationObserver) global.MutationObserver = JsMutationObserver; +})(this); + +(function(scope) { + if (!scope) { + scope = window.CustomElements = { + flags: {} + }; + } + var flags = scope.flags; + var hasNative = Boolean(document.register); + var useNative = !flags.register && hasNative; + if (useNative) { + var nop = function() {}; + scope.registry = {}; + scope.upgradeElement = nop; + scope.watchShadow = nop; + scope.upgrade = nop; + scope.upgradeAll = nop; + scope.upgradeSubtree = nop; + scope.observeDocument = nop; + scope.upgradeDocument = nop; + scope.takeRecords = nop; + } else { + function register(name, options) { + var definition = options || {}; + if (!name) { + throw new Error("document.register: first argument `name` must not be empty"); + } + if (name.indexOf("-") < 0) { + throw new Error("document.register: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'."); + } + definition.name = name; + if (!definition.prototype) { + throw new Error("Options missing required prototype property"); + } + definition.lifecycle = definition.lifecycle || {}; + definition.ancestry = ancestry(definition.extends); + resolveTagName(definition); + resolvePrototypeChain(definition); + overrideAttributeApi(definition.prototype); + registerDefinition(name, definition); + definition.ctor = generateConstructor(definition); + definition.ctor.prototype = definition.prototype; + definition.prototype.constructor = definition.ctor; + if (scope.ready) { + scope.upgradeAll(document); + } + return definition.ctor; + } + function ancestry(extnds) { + var extendee = registry[extnds]; + if (extendee) { + return ancestry(extendee.extends).concat([ extendee ]); + } + return []; + } + function resolveTagName(definition) { + var baseTag = definition.extends; + for (var i = 0, a; a = definition.ancestry[i]; i++) { + baseTag = a.is && a.tag; + } + definition.tag = baseTag || definition.name; + if (baseTag) { + definition.is = definition.name; + } + } + function resolvePrototypeChain(definition) { + if (!Object.__proto__) { + var nativePrototype = HTMLElement.prototype; + if (definition.is) { + var inst = document.createElement(definition.tag); + nativePrototype = Object.getPrototypeOf(inst); + } + var proto = definition.prototype, ancestor; + while (proto && proto !== nativePrototype) { + var ancestor = Object.getPrototypeOf(proto); + proto.__proto__ = ancestor; + proto = ancestor; + } + } + definition.native = nativePrototype; + } + function instantiate(definition) { + return upgrade(domCreateElement(definition.tag), definition); + } + function upgrade(element, definition) { + if (definition.is) { + element.setAttribute("is", definition.is); + } + element.removeAttribute("unresolved"); + implement(element, definition); + element.__upgraded__ = true; + scope.upgradeSubtree(element); + created(element); + return element; + } + function implement(element, definition) { + if (Object.__proto__) { + element.__proto__ = definition.prototype; + } else { + customMixin(element, definition.prototype, definition.native); + element.__proto__ = definition.prototype; + } + } + function customMixin(inTarget, inSrc, inNative) { + var used = {}; + var p = inSrc; + while (p !== inNative && p !== HTMLUnknownElement.prototype) { + var keys = Object.getOwnPropertyNames(p); + for (var i = 0, k; k = keys[i]; i++) { + if (!used[k]) { + Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k)); + used[k] = 1; + } + } + p = Object.getPrototypeOf(p); + } + } + function created(element) { + if (element.createdCallback) { + element.createdCallback(); + } + } + function overrideAttributeApi(prototype) { + if (prototype.setAttribute._polyfilled) { + return; + } + var setAttribute = prototype.setAttribute; + prototype.setAttribute = function(name, value) { + changeAttribute.call(this, name, value, setAttribute); + }; + var removeAttribute = prototype.removeAttribute; + prototype.removeAttribute = function(name) { + changeAttribute.call(this, name, null, removeAttribute); + }; + prototype.setAttribute._polyfilled = true; + } + function changeAttribute(name, value, operation) { + var oldValue = this.getAttribute(name); + operation.apply(this, arguments); + var newValue = this.getAttribute(name); + if (this.attributeChangedCallback && newValue !== oldValue) { + this.attributeChangedCallback(name, oldValue, newValue); + } + } + var registry = {}; + function registerDefinition(name, definition) { + registry[name] = definition; + } + function generateConstructor(definition) { + return function() { + return instantiate(definition); + }; + } + function createElement(tag, typeExtension) { + var definition = registry[typeExtension || tag]; + if (definition) { + return new definition.ctor(); + } + return domCreateElement(tag); + } + function upgradeElement(element) { + if (!element.__upgraded__ && element.nodeType === Node.ELEMENT_NODE) { + var type = element.getAttribute("is") || element.localName; + var definition = registry[type]; + return definition && upgrade(element, definition); + } + } + function cloneNode(deep) { + var n = domCloneNode.call(this, deep); + scope.upgradeAll(n); + return n; + } + var domCreateElement = document.createElement.bind(document); + var domCloneNode = Node.prototype.cloneNode; + document.register = register; + document.createElement = createElement; + Node.prototype.cloneNode = cloneNode; + scope.registry = registry; + scope.upgrade = upgradeElement; + } + scope.hasNative = hasNative; + scope.useNative = useNative; +})(window.CustomElements); + +(function(scope) { + var logFlags = window.logFlags || {}; + function findAll(node, find, data) { + var e = node.firstElementChild; + if (!e) { + e = node.firstChild; + while (e && e.nodeType !== Node.ELEMENT_NODE) { + e = e.nextSibling; + } + } + while (e) { + if (find(e, data) !== true) { + findAll(e, find, data); + } + e = e.nextElementSibling; + } + return null; + } + function forRoots(node, cb) { + var root = node.shadowRoot; + while (root) { + forSubtree(root, cb); + root = root.olderShadowRoot; + } + } + function forSubtree(node, cb) { + findAll(node, function(e) { + if (cb(e)) { + return true; + } + forRoots(e, cb); + }); + forRoots(node, cb); + } + function added(node) { + if (upgrade(node)) { + insertedNode(node); + return true; + } + inserted(node); + } + function addedSubtree(node) { + forSubtree(node, function(e) { + if (added(e)) { + return true; + } + }); + } + function addedNode(node) { + return added(node) || addedSubtree(node); + } + function upgrade(node) { + if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) { + var type = node.getAttribute("is") || node.localName; + var definition = scope.registry[type]; + if (definition) { + logFlags.dom && console.group("upgrade:", node.localName); + scope.upgrade(node); + logFlags.dom && console.groupEnd(); + return true; + } + } + } + function insertedNode(node) { + inserted(node); + if (inDocument(node)) { + forSubtree(node, function(e) { + inserted(e); + }); + } + } + var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver; + scope.hasPolyfillMutations = hasPolyfillMutations; + var isPendingMutations = false; + var pendingMutations = []; + function deferMutation(fn) { + pendingMutations.push(fn); + if (!isPendingMutations) { + isPendingMutations = true; + var async = window.Platform && window.Platform.endOfMicrotask || setTimeout; + async(takeMutations); + } + } + function takeMutations() { + isPendingMutations = false; + var $p = pendingMutations; + for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) { + p(); + } + pendingMutations = []; + } + function inserted(element) { + if (hasPolyfillMutations) { + deferMutation(function() { + _inserted(element); + }); + } else { + _inserted(element); + } + } + function _inserted(element) { + if (element.enteredViewCallback || element.__upgraded__ && logFlags.dom) { + logFlags.dom && console.group("inserted:", element.localName); + if (inDocument(element)) { + element.__inserted = (element.__inserted || 0) + 1; + if (element.__inserted < 1) { + element.__inserted = 1; + } + if (element.__inserted > 1) { + logFlags.dom && console.warn("inserted:", element.localName, "insert/remove count:", element.__inserted); + } else if (element.enteredViewCallback) { + logFlags.dom && console.log("inserted:", element.localName); + element.enteredViewCallback(); + } + } + logFlags.dom && console.groupEnd(); + } + } + function removedNode(node) { + removed(node); + forSubtree(node, function(e) { + removed(e); + }); + } + function removed(element) { + if (hasPolyfillMutations) { + deferMutation(function() { + _removed(element); + }); + } else { + _removed(element); + } + } + function _removed(element) { + if (element.leftViewCallback || element.__upgraded__ && logFlags.dom) { + logFlags.dom && console.log("removed:", element.localName); + if (!inDocument(element)) { + element.__inserted = (element.__inserted || 0) - 1; + if (element.__inserted > 0) { + element.__inserted = 0; + } + if (element.__inserted < 0) { + logFlags.dom && console.warn("removed:", element.localName, "insert/remove count:", element.__inserted); + } else if (element.leftViewCallback) { + element.leftViewCallback(); + } + } + } + } + function inDocument(element) { + var p = element; + var doc = window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(document) || document; + while (p) { + if (p == doc) { + return true; + } + p = p.parentNode || p.host; + } + } + function watchShadow(node) { + if (node.shadowRoot && !node.shadowRoot.__watched) { + logFlags.dom && console.log("watching shadow-root for: ", node.localName); + var root = node.shadowRoot; + while (root) { + watchRoot(root); + root = root.olderShadowRoot; + } + } + } + function watchRoot(root) { + if (!root.__watched) { + observe(root); + root.__watched = true; + } + } + function handler(mutations) { + if (logFlags.dom) { + var mx = mutations[0]; + if (mx && mx.type === "childList" && mx.addedNodes) { + if (mx.addedNodes) { + var d = mx.addedNodes[0]; + while (d && d !== document && !d.host) { + d = d.parentNode; + } + var u = d && (d.URL || d._URL || d.host && d.host.localName) || ""; + u = u.split("/?").shift().split("/").pop(); + } + } + console.group("mutations (%d) [%s]", mutations.length, u || ""); + } + mutations.forEach(function(mx) { + if (mx.type === "childList") { + forEach(mx.addedNodes, function(n) { + if (!n.localName) { + return; + } + addedNode(n); + }); + forEach(mx.removedNodes, function(n) { + if (!n.localName) { + return; + } + removedNode(n); + }); + } + }); + logFlags.dom && console.groupEnd(); + } + var observer = new MutationObserver(handler); + function takeRecords() { + handler(observer.takeRecords()); + takeMutations(); + } + var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach); + function observe(inRoot) { + observer.observe(inRoot, { + childList: true, + subtree: true + }); + } + function observeDocument(document) { + observe(document); + } + function upgradeDocument(document) { + logFlags.dom && console.group("upgradeDocument: ", (document.URL || document._URL || "").split("/").pop()); + addedNode(document); + logFlags.dom && console.groupEnd(); + } + scope.watchShadow = watchShadow; + scope.upgradeAll = addedNode; + scope.upgradeSubtree = addedSubtree; + scope.observeDocument = observeDocument; + scope.upgradeDocument = upgradeDocument; + scope.takeRecords = takeRecords; +})(window.CustomElements); + +(function() { + var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none"; + var parser = { + selectors: [ "link[rel=" + IMPORT_LINK_TYPE + "]" ], + map: { + link: "parseLink" + }, + parse: function(inDocument) { + if (!inDocument.__parsed) { + inDocument.__parsed = true; + var elts = inDocument.querySelectorAll(parser.selectors); + forEach(elts, function(e) { + parser[parser.map[e.localName]](e); + }); + CustomElements.upgradeDocument(inDocument); + CustomElements.observeDocument(inDocument); + } + }, + parseLink: function(linkElt) { + if (isDocumentLink(linkElt)) { + this.parseImport(linkElt); + } + }, + parseImport: function(linkElt) { + if (linkElt.content) { + parser.parse(linkElt.content); + } + } + }; + function isDocumentLink(inElt) { + return inElt.localName === "link" && inElt.getAttribute("rel") === IMPORT_LINK_TYPE; + } + var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach); + CustomElements.parser = parser; +})(); + +(function(scope) { + function bootstrap() { + CustomElements.parser.parse(document); + CustomElements.upgradeDocument(document); + var async = window.Platform && Platform.endOfMicrotask ? Platform.endOfMicrotask : setTimeout; + async(function() { + CustomElements.ready = true; + CustomElements.readyTime = Date.now(); + if (window.HTMLImports) { + CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime; + } + document.body.dispatchEvent(new CustomEvent("WebComponentsReady", { + bubbles: true + })); + }); + } + if (typeof window.CustomEvent !== "function") { + window.CustomEvent = function(inType) { + var e = document.createEvent("HTMLEvents"); + e.initEvent(inType, true, true); + return e; + }; + } + if (document.readyState === "complete" || scope.flags.eager) { + bootstrap(); + } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) { + bootstrap(); + } else { + var loadEvent = window.HTMLImports ? "HTMLImportsLoaded" : "DOMContentLoaded"; + window.addEventListener(loadEvent, bootstrap); + } +})(window.CustomElements); + +(function() { + var win = window, doc = document, noop = function() {}, trueop = function() { + return true; + }, regexPseudoSplit = /([\w-]+(?:\([^\)]+\))?)/g, regexPseudoReplace = /(\w*)(?:\(([^\)]*)\))?/, regexDigits = /(\d+)/g, keypseudo = { + action: function(pseudo, event) { + return pseudo.value.match(regexDigits).indexOf(String(event.keyCode)) > -1 == (pseudo.name == "keypass") || null; + } + }, prefix = function() { + var styles = win.getComputedStyle(doc.documentElement, ""), pre = (Array.prototype.slice.call(styles).join("").match(/-(moz|webkit|ms)-/) || styles.OLink === "" && [ "", "o" ])[1]; + return { + dom: pre == "ms" ? "MS" : pre, + lowercase: pre, + css: "-" + pre + "-", + js: pre == "ms" ? pre : pre[0].toUpperCase() + pre.substr(1) + }; + }(), matchSelector = Element.prototype.matchesSelector || Element.prototype[prefix.lowercase + "MatchesSelector"], mutation = win.MutationObserver || win[prefix.js + "MutationObserver"]; + var typeCache = {}, typeString = typeCache.toString, typeRegexp = /\s([a-zA-Z]+)/; + function typeOf(obj) { + var type = typeString.call(obj); + return typeCache[type] || (typeCache[type] = type.match(typeRegexp)[1].toLowerCase()); + } + function clone(item, type) { + var fn = clone[type || typeOf(item)]; + return fn ? fn(item) : item; + } + clone.object = function(src) { + var obj = {}; + for (var key in src) obj[key] = clone(src[key]); + return obj; + }; + clone.array = function(src) { + var i = src.length, array = new Array(i); + while (i--) array[i] = clone(src[i]); + return array; + }; + var unsliceable = [ "undefined", "null", "number", "boolean", "string", "function" ]; + function toArray(obj) { + return unsliceable.indexOf(typeOf(obj)) == -1 ? Array.prototype.slice.call(obj, 0) : [ obj ]; + } + var str = ""; + function query(element, selector) { + return (selector || str).length ? toArray(element.querySelectorAll(selector)) : []; + } + function parseMutations(element, mutations) { + var diff = { + added: [], + removed: [] + }; + mutations.forEach(function(record) { + record._mutation = true; + for (var z in diff) { + var type = element._records[z == "added" ? "inserted" : "removed"], nodes = record[z + "Nodes"], length = nodes.length; + for (var i = 0; i < length && diff[z].indexOf(nodes[i]) == -1; i++) { + diff[z].push(nodes[i]); + type.forEach(function(fn) { + fn(nodes[i], record); + }); + } + } + }); + } + function mergeOne(source, key, current) { + var type = typeOf(current); + if (type == "object" && typeOf(source[key]) == "object") xtag.merge(source[key], current); else source[key] = clone(current, type); + return source; + } + function wrapMixin(tag, key, pseudo, value, original) { + if (typeof original[key] != "function") original[key] = value; else { + original[key] = xtag.wrap(original[key], xtag.applyPseudos(pseudo, value, tag.pseudos)); + } + } + var uniqueMixinCount = 0; + function mergeMixin(tag, mixin, original, mix) { + if (mix) { + var uniques = {}; + for (var z in original) uniques[z.split(":")[0]] = z; + for (z in mixin) { + wrapMixin(tag, uniques[z.split(":")[0]] || z, z, mixin[z], original); + } + } else { + for (var zz in mixin) { + wrapMixin(tag, zz + ":__mixin__(" + uniqueMixinCount++ + ")", zz, mixin[zz], original); + } + } + } + function applyMixins(tag) { + tag.mixins.forEach(function(name) { + var mixin = xtag.mixins[name]; + for (var type in mixin) { + var item = mixin[type], original = tag[type]; + if (!original) tag[type] = item; else { + switch (type) { + case "accessors": + case "prototype": + for (var z in item) { + if (!original[z]) original[z] = item[z]; else mergeMixin(tag, item[z], original[z], true); + } + break; + + default: + mergeMixin(tag, item, original, type != "events"); + } + } + } + }); + return tag; + } + function delegateAction(pseudo, event) { + var match, target = event.target; + if (!target.tagName) return null; + if (xtag.matchSelector(target, pseudo.value)) match = target; else if (xtag.matchSelector(target, pseudo.value + " *")) { + var parent = target.parentNode; + while (!match) { + if (xtag.matchSelector(parent, pseudo.value)) match = parent; + parent = parent.parentNode; + } + } + return match ? pseudo.listener = pseudo.listener.bind(match) : null; + } + function touchFilter(event) { + if (event.type.match("touch")) { + event.target.__touched__ = true; + } else if (event.target.__touched__ && event.type.match("mouse")) { + delete event.target.__touched__; + return; + } + return true; + } + function createFlowEvent(type) { + var flow = type == "over"; + return { + attach: "OverflowEvent" in win ? "overflowchanged" : [], + condition: function(event, custom) { + event.flow = type; + return event.type == type + "flow" || event.orient === 0 && event.horizontalOverflow == flow || event.orient == 1 && event.verticalOverflow == flow || event.orient == 2 && event.horizontalOverflow == flow && event.verticalOverflow == flow; + } + }; + } + function writeProperty(key, event, base, desc) { + if (desc) event[key] = base[key]; else Object.defineProperty(event, key, { + writable: true, + enumerable: true, + value: base[key] + }); + } + var skipProps = {}; + for (var z in document.createEvent("CustomEvent")) skipProps[z] = 1; + function inheritEvent(event, base) { + var desc = Object.getOwnPropertyDescriptor(event, "target"); + for (var z in base) { + if (!skipProps[z]) writeProperty(z, event, base, desc); + } + event.baseEvent = base; + } + function getArgs(attr, value) { + return { + value: attr.boolean ? "" : value, + method: attr.boolean && !value ? "removeAttribute" : "setAttribute" + }; + } + function modAttr(element, attr, name, value) { + var args = getArgs(attr, value); + element[args.method](name, args.value); + } + function syncAttr(element, attr, name, value, method) { + var nodes = attr.property ? [ element.xtag[attr.property] ] : attr.selector ? xtag.query(element, attr.selector) : [], index = nodes.length; + while (index--) nodes[index][method](name, value); + } + function updateView(element, name, value) { + if (element.__view__) { + element.__view__.updateBindingValue(element, name, value); + } + } + function attachProperties(tag, prop, z, accessor, attr, name) { + var key = z.split(":"), type = key[0]; + if (type == "get") { + key[0] = prop; + tag.prototype[prop].get = xtag.applyPseudos(key.join(":"), accessor[z], tag.pseudos); + } else if (type == "set") { + key[0] = prop; + var setter = tag.prototype[prop].set = xtag.applyPseudos(key.join(":"), attr ? function(value) { + this.xtag._skipSet = true; + if (!this.xtag._skipAttr) modAttr(this, attr, name, value); + if (this.xtag._skipAttr && attr.skip) delete this.xtag._skipAttr; + accessor[z].call(this, attr.boolean ? !!value : value); + updateView(this, name, value); + delete this.xtag._skipSet; + } : accessor[z] ? function(value) { + accessor[z].call(this, value); + updateView(this, name, value); + } : null, tag.pseudos); + if (attr) attr.setter = setter; + } else tag.prototype[prop][z] = accessor[z]; + } + function parseAccessor(tag, prop) { + tag.prototype[prop] = {}; + var accessor = tag.accessors[prop], attr = accessor.attribute, name = attr && attr.name ? attr.name.toLowerCase() : prop; + if (attr) { + attr.key = prop; + tag.attributes[name] = attr; + } + for (var z in accessor) attachProperties(tag, prop, z, accessor, attr, name); + if (attr) { + if (!tag.prototype[prop].get) { + var method = (attr.boolean ? "has" : "get") + "Attribute"; + tag.prototype[prop].get = function() { + return this[method](name); + }; + } + if (!tag.prototype[prop].set) tag.prototype[prop].set = function(value) { + modAttr(this, attr, name, value); + updateView(this, name, value); + }; + } + } + var readyTags = {}; + function fireReady(name) { + readyTags[name] = (readyTags[name] || []).filter(function(obj) { + return (obj.tags = obj.tags.filter(function(z) { + return z != name && !xtag.tags[z]; + })).length || obj.fn(); + }); + } + var xtag = { + tags: {}, + defaultOptions: { + pseudos: [], + mixins: [], + events: {}, + methods: {}, + accessors: {}, + lifecycle: {}, + attributes: {}, + prototype: { + xtag: { + get: function() { + return this.__xtag__ ? this.__xtag__ : this.__xtag__ = { + data: {} + }; + } + } + } + }, + register: function(name, options) { + var _name; + if (typeof name == "string") { + _name = name.toLowerCase(); + } else { + return; + } + var basePrototype = options.prototype; + delete options.prototype; + var tag = xtag.tags[_name] = applyMixins(xtag.merge({}, xtag.defaultOptions, options)); + for (var z in tag.events) tag.events[z] = xtag.parseEvent(z, tag.events[z]); + for (z in tag.lifecycle) tag.lifecycle[z.split(":")[0]] = xtag.applyPseudos(z, tag.lifecycle[z], tag.pseudos); + for (z in tag.methods) tag.prototype[z.split(":")[0]] = { + value: xtag.applyPseudos(z, tag.methods[z], tag.pseudos), + enumerable: true + }; + for (z in tag.accessors) parseAccessor(tag, z); + var ready = tag.lifecycle.created || tag.lifecycle.ready; + tag.prototype.createdCallback = { + enumerable: true, + value: function() { + var element = this; + xtag.addEvents(this, tag.events); + tag.mixins.forEach(function(mixin) { + if (xtag.mixins[mixin].events) xtag.addEvents(element, xtag.mixins[mixin].events); + }); + var output = ready ? ready.apply(this, toArray(arguments)) : null; + for (var name in tag.attributes) { + var attr = tag.attributes[name], hasAttr = this.hasAttribute(name); + if (hasAttr || attr.boolean) { + this[attr.key] = attr.boolean ? hasAttr : this.getAttribute(name); + } + } + tag.pseudos.forEach(function(obj) { + obj.onAdd.call(element, obj); + }); + return output; + } + }; + if (tag.lifecycle.inserted) tag.prototype.enteredViewCallback = { + value: tag.lifecycle.inserted, + enumerable: true + }; + if (tag.lifecycle.removed) tag.prototype.leftViewCallback = { + value: tag.lifecycle.removed, + enumerable: true + }; + if (tag.lifecycle.attributeChanged) tag.prototype.attributeChangedCallback = { + value: tag.lifecycle.attributeChanged, + enumerable: true + }; + var setAttribute = tag.prototype.setAttribute || HTMLElement.prototype.setAttribute; + tag.prototype.setAttribute = { + writable: true, + enumberable: true, + value: function(name, value) { + var attr = tag.attributes[name.toLowerCase()]; + if (!this.xtag._skipAttr) setAttribute.call(this, name, attr && attr.boolean ? "" : value); + if (attr) { + if (attr.setter && !this.xtag._skipSet) { + this.xtag._skipAttr = true; + attr.setter.call(this, attr.boolean ? true : value); + } + value = attr.skip ? attr.boolean ? this.hasAttribute(name) : this.getAttribute(name) : value; + syncAttr(this, attr, name, attr.boolean ? "" : value, "setAttribute"); + } + delete this.xtag._skipAttr; + } + }; + var removeAttribute = tag.prototype.removeAttribute || HTMLElement.prototype.removeAttribute; + tag.prototype.removeAttribute = { + writable: true, + enumberable: true, + value: function(name) { + var attr = tag.attributes[name.toLowerCase()]; + if (!this.xtag._skipAttr) removeAttribute.call(this, name); + if (attr) { + if (attr.setter && !this.xtag._skipSet) { + this.xtag._skipAttr = true; + attr.setter.call(this, attr.boolean ? false : undefined); + } + syncAttr(this, attr, name, undefined, "removeAttribute"); + } + delete this.xtag._skipAttr; + } + }; + var elementProto = basePrototype ? basePrototype : options["extends"] ? Object.create(doc.createElement(options["extends"]).constructor).prototype : win.HTMLElement.prototype; + var definition = { + prototype: Object.create(elementProto, tag.prototype) + }; + if (options["extends"]) { + definition["extends"] = options["extends"]; + } + var reg = doc.register(_name, definition); + fireReady(_name); + return reg; + }, + ready: function(names, fn) { + var obj = { + tags: toArray(names), + fn: fn + }; + if (obj.tags.reduce(function(last, name) { + if (xtag.tags[name]) return last; + (readyTags[name] = readyTags[name] || []).push(obj); + }, true)) fn(); + }, + mixins: {}, + prefix: prefix, + captureEvents: [ "focus", "blur", "scroll", "underflow", "overflow", "overflowchanged", "DOMMouseScroll" ], + customEvents: { + overflow: createFlowEvent("over"), + underflow: createFlowEvent("under"), + animationstart: { + attach: [ prefix.dom + "AnimationStart" ] + }, + animationend: { + attach: [ prefix.dom + "AnimationEnd" ] + }, + transitionend: { + attach: [ prefix.dom + "TransitionEnd" ] + }, + move: { + attach: [ "mousemove", "touchmove" ], + condition: touchFilter + }, + enter: { + attach: [ "mouseover", "touchenter" ], + condition: touchFilter + }, + leave: { + attach: [ "mouseout", "touchleave" ], + condition: touchFilter + }, + scrollwheel: { + attach: [ "DOMMouseScroll", "mousewheel" ], + condition: function(event) { + event.delta = event.wheelDelta ? event.wheelDelta / 40 : Math.round(event.detail / 3.5 * -1); + return true; + } + }, + tapstart: { + observe: { + mousedown: doc, + touchstart: doc + }, + condition: touchFilter + }, + tapend: { + observe: { + mouseup: doc, + touchend: doc + }, + condition: touchFilter + }, + tapmove: { + attach: [ "tapstart", "dragend", "touchcancel" ], + condition: function(event, custom) { + switch (event.type) { + case "move": + return true; + + case "dragover": + var last = custom.lastDrag || {}; + custom.lastDrag = event; + return last.pageX != event.pageX && last.pageY != event.pageY || null; + + case "tapstart": + if (!custom.move) { + custom.current = this; + custom.move = xtag.addEvents(this, { + move: custom.listener, + dragover: custom.listener + }); + custom.tapend = xtag.addEvent(doc, "tapend", custom.listener); + } + break; + + case "tapend": + case "dragend": + case "touchcancel": + if (!event.touches.length) { + if (custom.move) xtag.removeEvents(custom.current, custom.move || {}); + if (custom.tapend) xtag.removeEvent(doc, custom.tapend || {}); + delete custom.lastDrag; + delete custom.current; + delete custom.tapend; + delete custom.move; + } + } + } + } + }, + pseudos: { + __mixin__: {}, + keypass: keypseudo, + keyfail: keypseudo, + delegate: { + action: delegateAction + }, + within: { + action: delegateAction, + onAdd: function(pseudo) { + var condition = pseudo.source.condition; + if (condition) pseudo.source.condition = function(event, custom) { + return xtag.query(this, pseudo.value).filter(function(node) { + return node == event.target || node.contains ? node.contains(event.target) : null; + })[0] ? condition.call(this, event, custom) : null; + }; + } + }, + preventable: { + action: function(pseudo, event) { + return !event.defaultPrevented; + } + } + }, + clone: clone, + typeOf: typeOf, + toArray: toArray, + wrap: function(original, fn) { + return function() { + var args = toArray(arguments), output = original.apply(this, args); + fn.apply(this, args); + return output; + }; + }, + merge: function(source, k, v) { + if (typeOf(k) == "string") return mergeOne(source, k, v); + for (var i = 1, l = arguments.length; i < l; i++) { + var object = arguments[i]; + for (var key in object) mergeOne(source, key, object[key]); + } + return source; + }, + uid: function() { + return Math.random().toString(36).substr(2, 10); + }, + query: query, + skipTransition: function(element, fn) { + var prop = prefix.js + "TransitionProperty"; + element.style[prop] = element.style.transitionProperty = "none"; + var callback = fn(); + return xtag.requestFrame(function() { + xtag.requestFrame(function() { + element.style[prop] = element.style.transitionProperty = ""; + if (callback) xtag.requestFrame(callback); + }); + }); + }, + requestFrame: function() { + var raf = win.requestAnimationFrame || win[prefix.lowercase + "RequestAnimationFrame"] || function(fn) { + return win.setTimeout(fn, 20); + }; + return function(fn) { + return raf(fn); + }; + }(), + cancelFrame: function() { + var cancel = win.cancelAnimationFrame || win[prefix.lowercase + "CancelAnimationFrame"] || win.clearTimeout; + return function(id) { + return cancel(id); + }; + }(), + matchSelector: function(element, selector) { + return matchSelector.call(element, selector); + }, + set: function(element, method, value) { + element[method] = value; + if (window.CustomElements) CustomElements.upgradeAll(element); + }, + innerHTML: function(el, html) { + xtag.set(el, "innerHTML", html); + }, + hasClass: function(element, klass) { + return element.className.split(" ").indexOf(klass.trim()) > -1; + }, + addClass: function(element, klass) { + var list = element.className.trim().split(" "); + klass.trim().split(" ").forEach(function(name) { + if (!~list.indexOf(name)) list.push(name); + }); + element.className = list.join(" ").trim(); + return element; + }, + removeClass: function(element, klass) { + var classes = klass.trim().split(" "); + element.className = element.className.trim().split(" ").filter(function(name) { + return name && !~classes.indexOf(name); + }).join(" "); + return element; + }, + toggleClass: function(element, klass) { + return xtag[xtag.hasClass(element, klass) ? "removeClass" : "addClass"].call(null, element, klass); + }, + queryChildren: function(element, selector) { + var id = element.id, guid = element.id = id || "x_" + xtag.uid(), attr = "#" + guid + " > "; + selector = attr + (selector + "").replace(",", "," + attr, "g"); + var result = element.parentNode.querySelectorAll(selector); + if (!id) element.removeAttribute("id"); + return toArray(result); + }, + createFragment: function(content) { + var frag = doc.createDocumentFragment(); + if (content) { + var div = frag.appendChild(doc.createElement("div")), nodes = toArray(content.nodeName ? arguments : !(div.innerHTML = content) || div.children), length = nodes.length, index = 0; + while (index < length) frag.insertBefore(nodes[index++], div); + frag.removeChild(div); + } + return frag; + }, + manipulate: function(element, fn) { + var next = element.nextSibling, parent = element.parentNode, frag = doc.createDocumentFragment(), returned = fn.call(frag.appendChild(element), frag) || element; + if (next) parent.insertBefore(returned, next); else parent.appendChild(returned); + }, + applyPseudos: function(key, fn, target, source) { + var listener = fn, pseudos = {}; + if (key.match(":")) { + var split = key.match(regexPseudoSplit), i = split.length; + while (--i) { + split[i].replace(regexPseudoReplace, function(match, name, value) { + if (!xtag.pseudos[name]) throw "pseudo not found: " + name + " " + split; + var pseudo = pseudos[i] = Object.create(xtag.pseudos[name]); + pseudo.key = key; + pseudo.name = name; + pseudo.value = value; + pseudo["arguments"] = (value || "").split(","); + pseudo.action = pseudo.action || trueop; + pseudo.source = source; + var last = listener; + listener = function() { + var args = toArray(arguments), obj = { + key: key, + name: name, + value: value, + source: source, + arguments: pseudo["arguments"], + listener: last + }; + var output = pseudo.action.apply(this, [ obj ].concat(args)); + if (output === null || output === false) return output; + return obj.listener.apply(this, args); + }; + if (target && pseudo.onAdd) { + if (target.nodeName) pseudo.onAdd.call(target, pseudo); else target.push(pseudo); + } + }); + } + } + for (var z in pseudos) { + if (pseudos[z].onCompiled) listener = pseudos[z].onCompiled(listener, pseudos[z]) || listener; + } + return listener; + }, + removePseudos: function(target, pseudos) { + pseudos.forEach(function(obj) { + if (obj.onRemove) obj.onRemove.call(target, obj); + }); + }, + parseEvent: function(type, fn) { + var pseudos = type.split(":"), key = pseudos.shift(), custom = xtag.customEvents[key], event = xtag.merge({ + type: key, + stack: noop, + condition: trueop, + attach: [], + _attach: [], + pseudos: "", + _pseudos: [], + onAdd: noop, + onRemove: noop + }, custom || {}); + event.attach = toArray(event.base || event.attach); + event.chain = key + (event.pseudos.length ? ":" + event.pseudos : "") + (pseudos.length ? ":" + pseudos.join(":") : ""); + var condition = event.condition; + event.condition = function(e) { + var t = e.touches, tt = e.targetTouches; + return condition.apply(this, toArray(arguments)); + }; + var stack = xtag.applyPseudos(event.chain, fn, event._pseudos, event); + event.stack = function(e) { + var t = e.touches, tt = e.targetTouches; + var detail = e.detail || {}; + if (!detail.__stack__) return stack.apply(this, toArray(arguments)); else if (detail.__stack__ == stack) { + e.stopPropagation(); + e.cancelBubble = true; + return stack.apply(this, toArray(arguments)); + } + }; + event.listener = function(e) { + var args = toArray(arguments), output = event.condition.apply(this, args.concat([ event ])); + if (!output) return output; + if (e.type != key) { + xtag.fireEvent(e.target, key, { + baseEvent: e, + detail: output !== true && (output.__stack__ = stack) ? output : { + __stack__: stack + } + }); + } else return event.stack.apply(this, args); + }; + event.attach.forEach(function(name) { + event._attach.push(xtag.parseEvent(name, event.listener)); + }); + if (custom && custom.observe && !custom.__observing__) { + custom.observer = function(e) { + var output = event.condition.apply(this, toArray(arguments).concat([ custom ])); + if (!output) return output; + xtag.fireEvent(e.target, key, { + baseEvent: e, + detail: output !== true ? output : {} + }); + }; + for (var z in custom.observe) xtag.addEvent(custom.observe[z] || document, z, custom.observer, true); + custom.__observing__ = true; + } + return event; + }, + addEvent: function(element, type, fn, capture) { + var event = typeof fn == "function" ? xtag.parseEvent(type, fn) : fn; + event._pseudos.forEach(function(obj) { + obj.onAdd.call(element, obj); + }); + event._attach.forEach(function(obj) { + xtag.addEvent(element, obj.type, obj); + }); + event.onAdd.call(element, event, event.listener); + element.addEventListener(event.type, event.stack, capture || xtag.captureEvents.indexOf(event.type) > -1); + return event; + }, + addEvents: function(element, obj) { + var events = {}; + for (var z in obj) { + events[z] = xtag.addEvent(element, z, obj[z]); + } + return events; + }, + removeEvent: function(element, type, event) { + event = event || type; + event.onRemove.call(element, event, event.listener); + xtag.removePseudos(element, event._pseudos); + event._attach.forEach(function(obj) { + xtag.removeEvent(element, obj); + }); + element.removeEventListener(event.type, event.stack); + }, + removeEvents: function(element, obj) { + for (var z in obj) xtag.removeEvent(element, obj[z]); + }, + fireEvent: function(element, type, options, warn) { + var event = doc.createEvent("CustomEvent"); + options = options || {}; + if (warn) console.warn("fireEvent has been modified"); + event.initCustomEvent(type, options.bubbles !== false, options.cancelable !== false, options.detail); + if (options.baseEvent) inheritEvent(event, options.baseEvent); + try { + element.dispatchEvent(event); + } catch (e) { + console.warn("This error may have been caused by a change in the fireEvent method", e); + } + }, + addObserver: function(element, type, fn) { + if (!element._records) { + element._records = { + inserted: [], + removed: [] + }; + if (mutation) { + element._observer = new mutation(function(mutations) { + parseMutations(element, mutations); + }); + element._observer.observe(element, { + subtree: true, + childList: true, + attributes: !true, + characterData: false + }); + } else [ "Inserted", "Removed" ].forEach(function(type) { + element.addEventListener("DOMNode" + type, function(event) { + event._mutation = true; + element._records[type.toLowerCase()].forEach(function(fn) { + fn(event.target, event); + }); + }, false); + }); + } + if (element._records[type].indexOf(fn) == -1) element._records[type].push(fn); + }, + removeObserver: function(element, type, fn) { + var obj = element._records; + if (obj && fn) { + obj[type].splice(obj[type].indexOf(fn), 1); + } else { + obj[type] = []; + } + } + }; + var touching = false, touchTarget = null; + doc.addEventListener("mousedown", function(e) { + touching = true; + touchTarget = e.target; + }, true); + doc.addEventListener("mouseup", function() { + touching = false; + touchTarget = null; + }, true); + doc.addEventListener("dragend", function() { + touching = false; + touchTarget = null; + }, true); + var UIEventProto = { + touches: { + configurable: true, + get: function() { + return this.__touches__ || (this.identifier = 0) || (this.__touches__ = touching ? [ this ] : []); + } + }, + targetTouches: { + configurable: true, + get: function() { + return this.__targetTouches__ || (this.__targetTouches__ = touching && this.currentTarget && (this.currentTarget == touchTarget || this.currentTarget.contains && this.currentTarget.contains(touchTarget)) ? (this.identifier = 0) || [ this ] : []); + } + }, + changedTouches: { + configurable: true, + get: function() { + return this.__changedTouches__ || (this.identifier = 0) || (this.__changedTouches__ = [ this ]); + } + } + }; + for (z in UIEventProto) { + UIEvent.prototype[z] = UIEventProto[z]; + Object.defineProperty(UIEvent.prototype, z, UIEventProto[z]); + } + function addTap(el, tap, e) { + if (!el.__tap__) { + el.__tap__ = { + click: e.type == "mousedown" + }; + if (el.__tap__.click) el.addEventListener("click", tap.observer); else { + el.__tap__.scroll = tap.observer.bind(el); + window.addEventListener("scroll", el.__tap__.scroll, true); + el.addEventListener("touchmove", tap.observer); + el.addEventListener("touchcancel", tap.observer); + el.addEventListener("touchend", tap.observer); + } + } + if (!el.__tap__.click) { + el.__tap__.x = e.touches[0].pageX; + el.__tap__.y = e.touches[0].pageY; + } + } + function removeTap(el, tap) { + if (el.__tap__) { + if (el.__tap__.click) el.removeEventListener("click", tap.observer); else { + window.removeEventListener("scroll", el.__tap__.scroll, true); + el.removeEventListener("touchmove", tap.observer); + el.removeEventListener("touchcancel", tap.observer); + el.removeEventListener("touchend", tap.observer); + } + delete el.__tap__; + } + } + function checkTapPosition(el, tap, e) { + var touch = e.changedTouches[0], tol = tap.gesture.tolerance; + if (touch.pageX < el.__tap__.x + tol && touch.pageX > el.__tap__.x - tol && touch.pageY < el.__tap__.y + tol && touch.pageY > el.__tap__.y - tol) return true; + } + xtag.customEvents.tap = { + observe: { + mousedown: document, + touchstart: document + }, + gesture: { + tolerance: 8 + }, + condition: function(e, tap) { + var el = e.target; + switch (e.type) { + case "touchstart": + if (el.__tap__ && el.__tap__.click) removeTap(el, tap); + addTap(el, tap, e); + return; + + case "mousedown": + if (!el.__tap__) addTap(el, tap, e); + return; + + case "scroll": + case "touchcancel": + removeTap(this, tap); + return; + + case "touchmove": + case "touchend": + if (this.__tap__ && !checkTapPosition(this, tap, e)) { + removeTap(this, tap); + return; + } + return e.type == "touchend" || null; + + case "click": + removeTap(this, tap); + return true; + } + } + }; + win.xtag = xtag; + if (typeof define == "function" && define.amd) define(xtag); + doc.addEventListener("WebComponentsReady", function() { + xtag.fireEvent(doc.body, "DOMComponentsLoaded"); + }); +})(); + +(function() { + xtag.register("x-appbar", { + lifecycle: { + created: function() { + var header = xtag.queryChildren(this, "header")[0]; + if (!header) { + header = document.createElement("header"); + this.appendChild(header); + } + this.xtag.data.header = header; + this.subheading = this.subheading; + } + }, + accessors: { + heading: { + attribute: {}, + get: function() { + return this.xtag.data.header.innerHTML; + }, + set: function(value) { + this.xtag.data.header.innerHTML = value; + } + }, + subheading: { + attribute: {}, + get: function() { + return this.getAttribute("subheading") || ""; + }, + set: function(value) { + this.xtag.data.header.setAttribute("subheading", value); + } + } + } + }); +})(); + +(function() { + var LEFT_MOUSE_BTN = 0; + var GET_DEFAULT_LABELS = function() { + return { + prev: "←", + next: "→", + months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], + weekdays: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ] + }; + }; + function normalize(localDate) { + var normalizedDate = new Date(localDate.valueOf()); + normalizedDate.setHours(0); + normalizedDate.setMinutes(0); + normalizedDate.setSeconds(0); + normalizedDate.setMilliseconds(0); + return normalizedDate; + } + var TODAY = normalize(new Date()); + var DRAG_ADD = "add"; + var DRAG_REMOVE = "remove"; + var CHOSEN_CLASS = "chosen"; + var className = "className"; + function appendChild(parent, child) { + parent.appendChild(child); + } + function parseIntDec(num) { + return parseInt(num, 10); + } + function isWeekdayNum(dayNum) { + var dayInt = parseIntDec(dayNum); + return dayInt === dayNum && !isNaN(dayInt) && dayInt >= 0 && dayInt <= 6; + } + function isValidDateObj(d) { + return d instanceof Date && !!d.getTime && !isNaN(d.getTime()); + } + function isArray(a) { + if (a && a.isArray) { + return a.isArray(); + } else { + return Object.prototype.toString.call(a) === "[object Array]"; + } + } + function makeEl(s) { + var a = s.split("."); + var tag = a.shift(); + var el = document.createElement(tag); + el[className] = a.join(" "); + return el; + } + function getWindowViewport() { + var docElem = document.documentElement; + var rect = { + left: docElem.scrollLeft || document.body.scrollLeft || 0, + top: docElem.scrollTop || document.body.scrollTop || 0, + width: docElem.clientWidth, + height: docElem.clientHeight + }; + rect.right = rect.left + rect.width; + rect.bottom = rect.top + rect.height; + return rect; + } + function getRect(el) { + var rect = el.getBoundingClientRect(); + var viewport = getWindowViewport(); + var docScrollLeft = viewport.left; + var docScrollTop = viewport.top; + return { + left: rect.left + docScrollLeft, + right: rect.right + docScrollLeft, + top: rect.top + docScrollTop, + bottom: rect.bottom + docScrollTop, + width: rect.width, + height: rect.height + }; + } + function addClass(el, c) { + xtag.addClass(el, c); + } + function removeClass(el, c) { + xtag.removeClass(el, c); + } + function hasClass(el, c) { + return xtag.hasClass(el, c); + } + function getYear(d) { + return d.getFullYear(); + } + function getMonth(d) { + return d.getMonth(); + } + function getDate(d) { + return d.getDate(); + } + function getDay(d) { + return d.getDay(); + } + function pad(n, padSize) { + var str = n.toString(); + var padZeros = new Array(padSize).join("0"); + return (padZeros + str).substr(-padSize); + } + function iso(d) { + return [ pad(getYear(d), 4), pad(getMonth(d) + 1, 2), pad(getDate(d), 2) ].join("-"); + } + var ISO_DATE_REGEX = /(\d{4})[^\d]?(\d{2})[^\d]?(\d{2})/; + function fromIso(s) { + if (isValidDateObj(s)) { + return s; + } + var d = ISO_DATE_REGEX.exec(s); + if (d) { + return normalize(new Date(d[1], d[2] - 1, d[3])); + } else { + return null; + } + } + function parseSingleDate(dateStr) { + if (isValidDateObj(dateStr)) { + return dateStr; + } + var isoParsed = fromIso(dateStr); + if (isoParsed) { + return isoParsed; + } else { + var parsedMs = Date.parse(dateStr); + if (!isNaN(parsedMs)) { + return normalize(new Date(parsedMs)); + } + return null; + } + } + function parseMultiDates(multiDateStr) { + var ranges; + if (isArray(multiDateStr)) { + ranges = multiDateStr.slice(0); + } else if (isValidDateObj(multiDateStr)) { + return [ multiDateStr ]; + } else if (typeof multiDateStr === "string" && multiDateStr.length > 0) { + try { + ranges = JSON.parse(multiDateStr); + if (!isArray(ranges)) { + return null; + } + } catch (err) { + var parsedSingle = parseSingleDate(multiDateStr); + if (parsedSingle) { + return [ parsedSingle ]; + } else { + return null; + } + } + } else { + return null; + } + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (isValidDateObj(range)) { + continue; + } else if (typeof range === "string") { + var parsedDate = parseSingleDate(range); + if (!parsedDate) { + return null; + } + ranges[i] = parsedDate; + } else if (isArray(range) && range.length === 2) { + var parsedStartDate = parseSingleDate(range[0]); + if (!parsedStartDate) { + return null; + } + var parsedEndDate = parseSingleDate(range[1]); + if (!parsedEndDate) { + return null; + } + if (parsedStartDate.valueOf() > parsedEndDate.valueOf()) { + return null; + } + ranges[i] = [ parsedStartDate, parsedEndDate ]; + } else { + return null; + } + } + return ranges; + } + function from(base, y, m, d) { + if (y === undefined) { + y = getYear(base); + } + if (m === undefined) { + m = getMonth(base); + } + if (d === undefined) { + d = getDate(base); + } + return normalize(new Date(y, m, d)); + } + function daysInMonth(month, year) { + if (!year) { + year = new Date().getFullYear(); + } + return new Date(year, month + 1, 0).getDate(); + } + function relOffset(base, y, m, d) { + return from(base, getYear(base) + y, getMonth(base) + m, getDate(base) + d); + } + function nextMonth(d) { + var date = d.getDate(); + var daysInNextMonth = daysInMonth(d.getMonth() + 1, d.getFullYear()); + if (date > daysInNextMonth) { + date = daysInNextMonth; + } + return new Date(d.getFullYear(), d.getMonth() + 1, date); + } + function prevMonth(d) { + var date = d.getDate(); + var daysInPrevMonth = daysInMonth(d.getMonth() - 1, d.getFullYear()); + if (date > daysInPrevMonth) { + date = daysInPrevMonth; + } + return new Date(d.getFullYear(), d.getMonth() - 1, date); + } + function findWeekStart(d, firstWeekday) { + firstWeekday = parseIntDec(firstWeekday); + if (!isWeekdayNum(firstWeekday)) { + firstWeekday = 0; + } + for (var step = 0; step < 7; step++) { + if (getDay(d) === firstWeekday) { + return d; + } else { + d = prevDay(d); + } + } + throw "unable to find week start"; + } + function findWeekEnd(d, lastWeekDay) { + lastWeekDay = parseIntDec(lastWeekDay); + if (!isWeekdayNum(lastWeekDay)) { + lastWeekDay = 6; + } + for (var step = 0; step < 7; step++) { + if (getDay(d) === lastWeekDay) { + return d; + } else { + d = nextDay(d); + } + } + throw "unable to find week end"; + } + function findFirst(d) { + d = new Date(d.valueOf()); + d.setDate(1); + return normalize(d); + } + function findLast(d) { + return prevDay(relOffset(d, 0, 1, 0)); + } + function nextDay(d) { + return relOffset(d, 0, 0, 1); + } + function prevDay(d) { + return relOffset(d, 0, 0, -1); + } + function dateMatches(d, matches) { + if (!matches) { + return; + } + matches = matches.length === undefined ? [ matches ] : matches; + var foundMatch = false; + matches.forEach(function(match) { + if (match.length === 2) { + if (dateInRange(match[0], match[1], d)) { + foundMatch = true; + } + } else { + if (iso(match) === iso(d)) { + foundMatch = true; + } + } + }); + return foundMatch; + } + function dateInRange(start, end, d) { + return iso(start) <= iso(d) && iso(d) <= iso(end); + } + function sortRanges(ranges) { + ranges.sort(function(rangeA, rangeB) { + var dateA = isValidDateObj(rangeA) ? rangeA : rangeA[0]; + var dateB = isValidDateObj(rangeB) ? rangeB : rangeB[0]; + return dateA.valueOf() - dateB.valueOf(); + }); + } + function makeControls(labelData) { + var controls = makeEl("div.controls"); + var prev = makeEl("span.prev"); + var next = makeEl("span.next"); + prev.innerHTML = labelData.prev; + next.innerHTML = labelData.next; + appendChild(controls, prev); + appendChild(controls, next); + return controls; + } + function Calendar(data) { + var self = this; + data = data || {}; + self._span = data.span || 1; + self._multiple = data.multiple || false; + self._viewDate = self._sanitizeViewDate(data.view, data.chosen); + self._chosenRanges = self._sanitizeChosenRanges(data.chosen, data.view); + self._firstWeekdayNum = data.firstWeekdayNum || 0; + self._el = makeEl("div.calendar"); + self._labels = GET_DEFAULT_LABELS(); + self._customRenderFn = null; + self._renderRecursionFlag = false; + self.render(true); + } + var CALENDAR_PROTOTYPE = Calendar.prototype; + CALENDAR_PROTOTYPE.makeMonth = function(d) { + if (!isValidDateObj(d)) { + throw "Invalid view date!"; + } + var firstWeekday = this.firstWeekdayNum; + var chosen = this.chosen; + var labels = this.labels; + var month = getMonth(d); + var sDate = findWeekStart(findFirst(d), firstWeekday); + var monthEl = makeEl("div.month"); + var monthLabel = makeEl("div.month-label"); + monthLabel.textContent = labels.months[month] + " " + getYear(d); + appendChild(monthEl, monthLabel); + var weekdayLabels = makeEl("div.weekday-labels"); + for (var step = 0; step < 7; step++) { + var weekdayNum = (firstWeekday + step) % 7; + var weekdayLabel = makeEl("span.weekday-label"); + weekdayLabel.textContent = labels.weekdays[weekdayNum]; + appendChild(weekdayLabels, weekdayLabel); + } + appendChild(monthEl, weekdayLabels); + var week = makeEl("div.week"); + var cDate = sDate; + var maxDays = 7 * 6; + for (step = 0; step < maxDays; step++) { + var day = makeEl("span.day"); + day.setAttribute("data-date", iso(cDate)); + day.textContent = getDate(cDate); + if (getMonth(cDate) !== month) { + addClass(day, "badmonth"); + } + if (dateMatches(cDate, chosen)) { + addClass(day, CHOSEN_CLASS); + } + if (dateMatches(cDate, TODAY)) { + addClass(day, "today"); + } + appendChild(week, day); + cDate = nextDay(cDate); + if ((step + 1) % 7 === 0) { + appendChild(monthEl, week); + week = makeEl("div.week"); + var done = getMonth(cDate) > month || getMonth(cDate) < month && getYear(cDate) > getYear(sDate); + if (done) { + break; + } + } + } + return monthEl; + }; + CALENDAR_PROTOTYPE._sanitizeViewDate = function(viewDate, chosenRanges) { + chosenRanges = chosenRanges === undefined ? this.chosen : chosenRanges; + var saneDate; + if (isValidDateObj(viewDate)) { + saneDate = viewDate; + } else if (isValidDateObj(chosenRanges)) { + saneDate = chosenRanges; + } else if (isArray(chosenRanges) && chosenRanges.length > 0) { + var firstRange = chosenRanges[0]; + if (isValidDateObj(firstRange)) { + saneDate = firstRange; + } else { + saneDate = firstRange[0]; + } + } else { + saneDate = TODAY; + } + return saneDate; + }; + function _collapseRanges(ranges) { + ranges = ranges.slice(0); + sortRanges(ranges); + var collapsed = []; + for (var i = 0; i < ranges.length; i++) { + var currRange = ranges[i]; + var prevRange = collapsed.length > 0 ? collapsed[collapsed.length - 1] : null; + var currStart, currEnd; + var prevStart, prevEnd; + if (isValidDateObj(currRange)) { + currStart = currEnd = currRange; + } else { + currStart = currRange[0]; + currEnd = currRange[1]; + } + currRange = dateMatches(currStart, currEnd) ? currStart : [ currStart, currEnd ]; + if (isValidDateObj(prevRange)) { + prevStart = prevEnd = prevRange; + } else if (prevRange) { + prevStart = prevRange[0]; + prevEnd = prevRange[1]; + } else { + collapsed.push(currRange); + continue; + } + if (dateMatches(currStart, [ prevRange ]) || dateMatches(prevDay(currStart), [ prevRange ])) { + var minStart = prevStart.valueOf() < currStart.valueOf() ? prevStart : currStart; + var maxEnd = prevEnd.valueOf() > currEnd.valueOf() ? prevEnd : currEnd; + var newRange = dateMatches(minStart, maxEnd) ? minStart : [ minStart, maxEnd ]; + collapsed[collapsed.length - 1] = newRange; + } else { + collapsed.push(currRange); + } + } + return collapsed; + } + CALENDAR_PROTOTYPE._sanitizeChosenRanges = function(chosenRanges, viewDate) { + viewDate = viewDate === undefined ? this.view : viewDate; + var cleanRanges; + if (isValidDateObj(chosenRanges)) { + cleanRanges = [ chosenRanges ]; + } else if (isArray(chosenRanges)) { + cleanRanges = chosenRanges; + } else if (chosenRanges === null || chosenRanges === undefined || !viewDate) { + cleanRanges = []; + } else { + cleanRanges = [ viewDate ]; + } + var collapsedRanges = _collapseRanges(cleanRanges); + if (!this.multiple && collapsedRanges.length > 0) { + var firstRange = collapsedRanges[0]; + if (isValidDateObj(firstRange)) { + return [ firstRange ]; + } else { + return [ firstRange[0] ]; + } + } else { + return collapsedRanges; + } + }; + CALENDAR_PROTOTYPE.addDate = function(dateObj, append) { + if (isValidDateObj(dateObj)) { + if (append) { + this.chosen.push(dateObj); + this.chosen = this.chosen; + } else { + this.chosen = [ dateObj ]; + } + } + }; + CALENDAR_PROTOTYPE.removeDate = function(dateObj) { + if (!isValidDateObj(dateObj)) { + return; + } + var ranges = this.chosen.slice(0); + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + if (dateMatches(dateObj, [ range ])) { + ranges.splice(i, 1); + if (isArray(range)) { + var rangeStart = range[0]; + var rangeEnd = range[1]; + var prevDate = prevDay(dateObj); + var nextDate = nextDay(dateObj); + if (dateMatches(prevDate, [ range ])) { + ranges.push([ rangeStart, prevDate ]); + } + if (dateMatches(nextDate, [ range ])) { + ranges.push([ nextDate, rangeEnd ]); + } + } + this.chosen = _collapseRanges(ranges); + break; + } + } + }; + CALENDAR_PROTOTYPE.hasChosenDate = function(dateObj) { + return dateMatches(dateObj, this._chosenRanges); + }; + CALENDAR_PROTOTYPE.hasVisibleDate = function(dateObj, excludeBadMonths) { + var startDate = excludeBadMonths ? this.firstVisibleMonth : this.firstVisibleDate; + var endDate = excludeBadMonths ? findLast(this.lastVisibleMonth) : this.lastVisibleDate; + return dateMatches(dateObj, [ [ startDate, endDate ] ]); + }; + CALENDAR_PROTOTYPE.render = function(preserveNodes) { + var span = this._span; + var i; + if (!preserveNodes) { + this.el.innerHTML = ""; + var ref = this.firstVisibleMonth; + for (i = 0; i < span; i++) { + appendChild(this.el, this.makeMonth(ref)); + ref = relOffset(ref, 0, 1, 0); + } + } else { + var days = xtag.query(this.el, ".day"); + var day; + for (i = 0; i < days.length; i++) { + day = days[i]; + if (!day.hasAttribute("data-date")) { + continue; + } + var dateIso = day.getAttribute("data-date"); + var parsedDate = fromIso(dateIso); + if (!parsedDate) { + continue; + } else { + if (dateMatches(parsedDate, this._chosenRanges)) { + addClass(day, CHOSEN_CLASS); + } else { + removeClass(day, CHOSEN_CLASS); + } + if (dateMatches(parsedDate, [ TODAY ])) { + addClass(day, "today"); + } else { + removeClass(day, "today"); + } + } + } + } + this._callCustomRenderer(); + }; + CALENDAR_PROTOTYPE._callCustomRenderer = function() { + if (!this._customRenderFn) { + return; + } + if (this._renderRecursionFlag) { + throw "Error: customRenderFn causes recursive loop of " + "rendering calendar; make sure your custom rendering " + "function doesn't modify attributes of the x-calendar that " + "would require a re-render!"; + } + var days = xtag.query(this.el, ".day"); + for (var i = 0; i < days.length; i++) { + var day = days[i]; + var dateIso = day.getAttribute("data-date"); + var parsedDate = fromIso(dateIso); + this._renderRecursionFlag = true; + this._customRenderFn(day, parsedDate ? parsedDate : null, dateIso); + this._renderRecursionFlag = false; + } + }; + Object.defineProperties(CALENDAR_PROTOTYPE, { + el: { + get: function() { + return this._el; + } + }, + multiple: { + get: function() { + return this._multiple; + }, + set: function(multi) { + this._multiple = multi; + this.chosen = this._sanitizeChosenRanges(this.chosen); + this.render(true); + } + }, + span: { + get: function() { + return this._span; + }, + set: function(newSpan) { + var parsedSpan = parseIntDec(newSpan); + if (!isNaN(parsedSpan) && parsedSpan >= 0) { + this._span = parsedSpan; + } else { + this._span = 0; + } + this.render(false); + } + }, + view: { + attribute: {}, + get: function() { + return this._viewDate; + }, + set: function(rawViewDate) { + var newViewDate = this._sanitizeViewDate(rawViewDate); + var oldViewDate = this._viewDate; + this._viewDate = newViewDate; + this.render(getMonth(oldViewDate) === getMonth(newViewDate) && getYear(oldViewDate) === getYear(newViewDate)); + } + }, + chosen: { + get: function() { + return this._chosenRanges; + }, + set: function(newChosenRanges) { + this._chosenRanges = this._sanitizeChosenRanges(newChosenRanges); + this.render(true); + } + }, + firstWeekdayNum: { + get: function() { + return this._firstWeekdayNum; + }, + set: function(weekdayNum) { + weekdayNum = parseIntDec(weekdayNum); + if (!isWeekdayNum(weekdayNum)) { + weekdayNum = 0; + } + this._firstWeekdayNum = weekdayNum; + this.render(false); + } + }, + lastWeekdayNum: { + get: function() { + return (this._firstWeekdayNum + 6) % 7; + } + }, + customRenderFn: { + get: function() { + return this._customRenderFn; + }, + set: function(newRenderFn) { + this._customRenderFn = newRenderFn; + this.render(true); + } + }, + chosenString: { + get: function() { + if (this.multiple) { + var isoDates = this.chosen.slice(0); + for (var i = 0; i < isoDates.length; i++) { + var range = isoDates[i]; + if (isValidDateObj(range)) { + isoDates[i] = iso(range); + } else { + isoDates[i] = [ iso(range[0]), iso(range[1]) ]; + } + } + return JSON.stringify(isoDates); + } else if (this.chosen.length > 0) { + return iso(this.chosen[0]); + } else { + return ""; + } + } + }, + firstVisibleMonth: { + get: function() { + return findFirst(this.view); + } + }, + lastVisibleMonth: { + get: function() { + return relOffset(this.firstVisibleMonth, 0, Math.max(0, this.span - 1), 0); + } + }, + firstVisibleDate: { + get: function() { + return findWeekStart(this.firstVisibleMonth, this.firstWeekdayNum); + } + }, + lastVisibleDate: { + get: function() { + return findWeekEnd(findLast(this.lastVisibleMonth), this.lastWeekdayNum); + } + }, + labels: { + get: function() { + return this._labels; + }, + set: function(newLabelData) { + var oldLabelData = this.labels; + for (var labelType in oldLabelData) { + if (!(labelType in newLabelData)) { + continue; + } + var oldLabel = this._labels[labelType]; + var newLabel = newLabelData[labelType]; + if (isArray(oldLabel)) { + if (isArray(newLabel) && oldLabel.length === newLabel.length) { + newLabel = newLabel.slice(0); + for (var i = 0; i < newLabel.length; i++) { + newLabel[i] = newLabel[i].toString ? newLabel[i].toString() : String(newLabel[i]); + } + } else { + throw "invalid label given for '" + labelType + "': expected array of " + oldLabel.length + " labels, got " + JSON.stringify(newLabel); + } + } else { + newLabel = String(newLabel); + } + oldLabelData[labelType] = newLabel; + } + this.render(false); + } + } + }); + function _onDragStart(xCalendar, day) { + var isoDate = day.getAttribute("data-date"); + var dateObj = parseSingleDate(isoDate); + var toggleEventName; + if (hasClass(day, CHOSEN_CLASS)) { + xCalendar.xtag.dragType = DRAG_REMOVE; + toggleEventName = "datetoggleoff"; + } else { + xCalendar.xtag.dragType = DRAG_ADD; + toggleEventName = "datetoggleon"; + } + xCalendar.xtag.dragStartEl = day; + xCalendar.xtag.dragAllowTap = true; + if (!xCalendar.noToggle) { + xtag.fireEvent(xCalendar, toggleEventName, { + detail: { + date: dateObj, + iso: isoDate + } + }); + } + xCalendar.setAttribute("active", true); + day.setAttribute("active", true); + } + function _onDragMove(xCalendar, day) { + var isoDate = day.getAttribute("data-date"); + var dateObj = parseSingleDate(isoDate); + if (day !== xCalendar.xtag.dragStartEl) { + xCalendar.xtag.dragAllowTap = false; + } + if (!xCalendar.noToggle) { + if (xCalendar.xtag.dragType === DRAG_ADD && !hasClass(day, CHOSEN_CLASS)) { + xtag.fireEvent(xCalendar, "datetoggleon", { + detail: { + date: dateObj, + iso: isoDate + } + }); + } else if (xCalendar.xtag.dragType === DRAG_REMOVE && hasClass(day, CHOSEN_CLASS)) { + xtag.fireEvent(xCalendar, "datetoggleoff", { + detail: { + date: dateObj, + iso: isoDate + } + }); + } + } + if (xCalendar.xtag.dragType) { + day.setAttribute("active", true); + } + } + function _onDragEnd() { + var xCalendars = xtag.query(document, "x-calendar"); + for (var i = 0; i < xCalendars.length; i++) { + var xCalendar = xCalendars[i]; + xCalendar.xtag.dragType = null; + xCalendar.xtag.dragStartEl = null; + xCalendar.xtag.dragAllowTap = false; + xCalendar.removeAttribute("active"); + } + var days = xtag.query(document, "x-calendar .day[active]"); + for (var j = 0; j < days.length; j++) { + days[j].removeAttribute("active"); + } + } + function _pointIsInRect(x, y, rect) { + return rect.left <= x && x <= rect.right && rect.top <= y && y <= rect.bottom; + } + var DOC_MOUSEUP_LISTENER = null; + var DOC_TOUCHEND_LISTENER = null; + xtag.register("x-calendar", { + lifecycle: { + created: function() { + this.innerHTML = ""; + var chosenRange = this.getAttribute("chosen"); + this.xtag.calObj = new Calendar({ + span: this.getAttribute("span"), + view: parseSingleDate(this.getAttribute("view")), + chosen: parseMultiDates(chosenRange), + multiple: this.hasAttribute("multiple"), + firstWeekdayNum: this.getAttribute("first-weekday-num") + }); + appendChild(this, this.xtag.calObj.el); + this.xtag.calControls = null; + this.xtag.dragType = null; + this.xtag.dragStartEl = null; + this.xtag.dragAllowTap = false; + }, + inserted: function() { + if (!DOC_MOUSEUP_LISTENER) { + DOC_MOUSEUP_LISTENER = xtag.addEvent(document, "mouseup", _onDragEnd); + } + if (!DOC_TOUCHEND_LISTENER) { + DOC_TOUCHEND_LISTENER = xtag.addEvent(document, "touchend", _onDragEnd); + } + this.render(false); + }, + removed: function() { + if (xtag.query(document, "x-calendar").length === 0) { + if (DOC_MOUSEUP_LISTENER) { + xtag.removeEvent(document, "mouseup", DOC_MOUSEUP_LISTENER); + DOC_MOUSEUP_LISTENER = null; + } + if (DOC_TOUCHEND_LISTENER) { + xtag.removeEvent(document, "touchend", DOC_TOUCHEND_LISTENER); + DOC_TOUCHEND_LISTENER = null; + } + } + } + }, + events: { + "tap:delegate(.next)": function(e) { + var xCalendar = e.currentTarget; + xCalendar.nextMonth(); + xtag.fireEvent(xCalendar, "nextmonth"); + }, + "tap:delegate(.prev)": function(e) { + var xCalendar = e.currentTarget; + xCalendar.prevMonth(); + xtag.fireEvent(xCalendar, "prevmonth"); + }, + "tapstart:delegate(.day)": function(e) { + if (!e.touches && e.button && e.button !== LEFT_MOUSE_BTN) { + return; + } + e.preventDefault(); + if (e.baseEvent) { + e.baseEvent.preventDefault(); + } + _onDragStart(e.currentTarget, this); + }, + touchmove: function(e) { + if (!(e.touches && e.touches.length > 0)) { + return; + } + var xCalendar = e.currentTarget; + if (!xCalendar.xtag.dragType) { + return; + } + var touch = e.touches[0]; + var days = xtag.query(xCalendar, ".day"); + for (var i = 0; i < days.length; i++) { + var day = days[i]; + if (_pointIsInRect(touch.pageX, touch.pageY, getRect(day))) { + _onDragMove(xCalendar, day); + } else { + day.removeAttribute("active"); + } + } + }, + "mouseover:delegate(.day)": function(e) { + var xCalendar = e.currentTarget; + var day = this; + _onDragMove(xCalendar, day); + }, + "mouseout:delegate(.day)": function() { + var day = this; + day.removeAttribute("active"); + }, + "tapend:delegate(.day)": function(e) { + var xCalendar = e.currentTarget; + if (!xCalendar.xtag.dragAllowTap) { + return; + } + var day = this; + var isoDate = day.getAttribute("data-date"); + var dateObj = parseSingleDate(isoDate); + xtag.fireEvent(xCalendar, "datetap", { + detail: { + date: dateObj, + iso: isoDate + } + }); + }, + datetoggleon: function(e) { + var xCalendar = this; + xCalendar.toggleDateOn(e.detail.date, xCalendar.multiple); + }, + datetoggleoff: function(e) { + var xCalendar = this; + xCalendar.toggleDateOff(e.detail.date); + } + }, + accessors: { + controls: { + attribute: { + "boolean": true + }, + set: function(hasControls) { + if (hasControls && !this.xtag.calControls) { + this.xtag.calControls = makeControls(this.xtag.calObj.labels); + appendChild(this, this.xtag.calControls); + } + } + }, + multiple: { + attribute: { + "boolean": true + }, + get: function() { + return this.xtag.calObj.multiple; + }, + set: function(multi) { + this.xtag.calObj.multiple = multi; + this.chosen = this.chosen; + } + }, + span: { + attribute: {}, + get: function() { + return this.xtag.calObj.span; + }, + set: function(newCalSpan) { + this.xtag.calObj.span = newCalSpan; + } + }, + view: { + attribute: {}, + get: function() { + return this.xtag.calObj.view; + }, + set: function(newView) { + var parsedDate = parseSingleDate(newView); + if (parsedDate) { + this.xtag.calObj.view = parsedDate; + } + } + }, + chosen: { + attribute: { + skip: true + }, + get: function() { + var chosenRanges = this.xtag.calObj.chosen; + if (!this.multiple) { + if (chosenRanges.length > 0) { + var firstRange = chosenRanges[0]; + if (isValidDateObj(firstRange)) { + return firstRange; + } else { + return firstRange[0]; + } + } else { + return null; + } + } else { + return this.xtag.calObj.chosen; + } + }, + set: function(newDates) { + var parsedDateRanges = this.multiple ? parseMultiDates(newDates) : parseSingleDate(newDates); + if (parsedDateRanges) { + this.xtag.calObj.chosen = parsedDateRanges; + } else { + this.xtag.calObj.chosen = null; + } + if (this.xtag.calObj.chosenString) { + this.setAttribute("chosen", this.xtag.calObj.chosenString); + } else { + this.removeAttribute("chosen"); + } + } + }, + firstWeekdayNum: { + attribute: { + name: "first-weekday-num" + }, + set: function(weekdayNum) { + this.xtag.calObj.firstWeekdayNum = weekdayNum; + } + }, + noToggle: { + attribute: { + "boolean": true, + name: "notoggle" + }, + set: function(toggleDisabled) { + if (toggleDisabled) { + this.chosen = null; + } + } + }, + firstVisibleMonth: { + get: function() { + return this.xtag.calObj.firstVisibleMonth; + } + }, + lastVisibleMonth: { + get: function() { + return this.xtag.calObj.lastVisibleMonth; + } + }, + firstVisibleDate: { + get: function() { + return this.xtag.calObj.firstVisibleDate; + } + }, + lastVisibleDate: { + get: function() { + return this.xtag.calObj.lastVisibleDate; + } + }, + customRenderFn: { + get: function() { + return this.xtag.calObj.customRenderFn; + }, + set: function(newRenderFn) { + this.xtag.calObj.customRenderFn = newRenderFn; + } + }, + labels: { + get: function() { + return JSON.parse(JSON.stringify(this.xtag.calObj.labels)); + }, + set: function(newLabelData) { + this.xtag.calObj.labels = newLabelData; + var labels = this.xtag.calObj.labels; + var prevControl = this.querySelector(".controls > .prev"); + if (prevControl) { + prevControl.textContent = labels.prev; + } + var nextControl = this.querySelector(".controls > .next"); + if (nextControl) { + nextControl.textContent = labels.next; + } + } + } + }, + methods: { + render: function(preserveNodes) { + this.xtag.calObj.render(preserveNodes); + }, + prevMonth: function() { + var calObj = this.xtag.calObj; + calObj.view = prevMonth(calObj.view); + }, + nextMonth: function() { + var calObj = this.xtag.calObj; + calObj.view = nextMonth(calObj.view); + }, + toggleDateOn: function(newDateObj, append) { + this.xtag.calObj.addDate(newDateObj, append); + this.chosen = this.chosen; + }, + toggleDateOff: function(dateObj) { + this.xtag.calObj.removeDate(dateObj); + this.chosen = this.chosen; + }, + toggleDate: function(dateObj, appendIfAdd) { + if (this.xtag.calObj.hasChosenDate(dateObj)) { + this.toggleDateOff(dateObj); + } else { + this.toggleDateOn(dateObj, appendIfAdd); + } + }, + hasVisibleDate: function(dateObj, excludeBadMonths) { + return this.xtag.calObj.hasVisibleDate(dateObj, excludeBadMonths); + } + } + }); +})(); + +(function() { + var matchNum = /[1-9]/, replaceSpaces = / /g, captureTimes = /(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi, transPre = "transition" in getComputedStyle(document.documentElement) ? "t" : xtag.prefix.js + "T", transDur = transPre + "ransitionDuration", transProp = transPre + "ransitionProperty", skipFrame = function(fn) { + xtag.requestFrame(function() { + xtag.requestFrame(fn); + }); + }, ready = document.readyState == "complete" ? skipFrame(function() { + ready = false; + }) : xtag.addEvent(document, "readystatechange", function() { + if (document.readyState == "complete") { + skipFrame(function() { + ready = false; + }); + xtag.removeEvent(document, "readystatechange", ready); + } + }); + function getTransitions(node) { + node.__transitions__ = node.__transitions__ || {}; + return node.__transitions__; + } + function startTransition(node, name, transitions) { + var style = getComputedStyle(node), after = transitions[name].after; + node.setAttribute("transition", name); + if (after && !style[transDur].match(matchNum)) after(); + } + xtag.addEvents(document, { + transitionend: function(e) { + var node = e.target, name = node.getAttribute("transition"); + if (name) { + var i = 0, max = 0, prop = null, style = getComputedStyle(node), transitions = getTransitions(node), props = style[transProp].replace(replaceSpaces, "").split(","); + style[transDur].replace(captureTimes, function(match, time, unit) { + time = parseFloat(time) * (unit === "s" ? 1e3 : 1); + if (time > max) prop = i, max = time; + i++; + }); + prop = props[prop]; + if (!prop) throw new SyntaxError("No matching transition property found"); else if (e.propertyName == prop && transitions[name].after) transitions[name].after(); + } + } + }); + xtag.transition = function(node, name, obj) { + var transitions = getTransitions(node), options = transitions[name] = obj || {}; + if (options.immediate) options.immediate(); + if (options.before) { + options.before(); + if (ready) xtag.skipTransition(node, function() { + startTransition(node, name, transitions); + }); else skipFrame(function() { + startTransition(node, name, transitions); + }); + } else startTransition(node, name, transitions); + }; + xtag.pseudos.transition = { + onCompiled: function(fn, pseudo) { + var options = {}, when = pseudo["arguments"][0] || "immediate", name = pseudo["arguments"][1] || pseudo.key.split(":")[0]; + return function() { + var target = this, args = arguments; + if (this.hasAttribute("transition")) { + options[when] = function() { + return fn.apply(target, args); + }; + xtag.transition(this, name, options); + } else return fn.apply(this, args); + }; + } + }; +})(); + +(function() { + var sides = { + next: [ "nextElementSibling", "firstElementChild" ], + previous: [ "previousElementSibling", "lastElementChild" ] + }; + function indexOfCard(deck, card) { + return Array.prototype.indexOf.call(deck.children, card); + } + function getCard(deck, item) { + return item && item.nodeName ? item : isNaN(item) ? xtag.queryChildren(deck, item) : deck.children[item]; + } + function checkCard(deck, card, selected) { + return card && (selected ? card == deck.xtag.selected : card != deck.xtag.selected) && deck == card.parentNode && card.nodeName == "X-CARD"; + } + function shuffle(deck, side, direction) { + var getters = sides[side], selected = deck.xtag.selected && deck.xtag.selected[getters[0]]; + if (selected) deck.showCard(selected, direction); else if (deck.loop || deck.selectedIndex == -1) deck.showCard(deck[getters[1]], direction); + } + xtag.register("x-deck", { + events: { + "reveal:delegate(x-card)": function(e) { + if (this.parentNode == e.currentTarget) e.currentTarget.showCard(this); + } + }, + accessors: { + loop: { + attribute: { + "boolean": true + } + }, + cards: { + get: function() { + return xtag.queryChildren(this, "x-card"); + } + }, + selectedCard: { + get: function() { + return this.xtag.selected || null; + }, + set: function(card) { + this.showCard(card); + } + }, + selectedIndex: { + attribute: { + name: "selected-index", + unlink: true + }, + get: function() { + return this.hasAttribute("selected-index") ? Number(this.getAttribute("selected-index")) : -1; + }, + set: function(value) { + var index = Number(value), card = this.cards[index]; + if (card) { + this.setAttribute("selected-index", index); + if (card != this.xtag.selected) this.showCard(card); + } else { + this.removeAttribute("selected-index"); + if (this.xtag.selected) this.hideCard(this.xtag.selected); + } + } + }, + transitionType: { + attribute: { + name: "transition-type" + }, + get: function() { + return this.getAttribute("transition-type") || "fade-scale"; + } + } + }, + methods: { + nextCard: function(direction) { + shuffle(this, "next", direction); + }, + previousCard: function(direction) { + shuffle(this, "previous", direction); + }, + showCard: function(item, direction) { + var card = getCard(this, item); + if (checkCard(this, card, false)) { + var selected = this.xtag.selected, nextIndex = indexOfCard(this, card); + direction = direction || (nextIndex > indexOfCard(this, selected) ? "forward" : "reverse"); + if (selected) this.hideCard(selected, direction); + this.xtag.selected = card; + this.selectedIndex = nextIndex; + if (!card.hasAttribute("selected")) card.selected = true; + xtag.transition(card, "show", { + before: function() { + card.setAttribute("show", ""); + card.setAttribute("transition-direction", direction); + }, + after: function() { + xtag.fireEvent(card, "show"); + } + }); + } + }, + hideCard: function(item, direction) { + var card = getCard(this, item); + if (checkCard(this, card, true)) { + this.xtag.selected = null; + if (card.hasAttribute("selected")) card.selected = false; + xtag.transition(card, "hide", { + before: function() { + card.removeAttribute("show"); + card.setAttribute("hide", ""); + card.setAttribute("transition-direction", direction || "reverse"); + }, + after: function() { + card.removeAttribute("hide"); + card.removeAttribute("transition"); + card.removeAttribute("transition-direction"); + xtag.fireEvent(card, "hide"); + } + }); + } + } + } + }); + xtag.register("x-card", { + lifecycle: { + inserted: function() { + var deck = this.parentNode; + if (deck.nodeName == "X-DECK") { + this.xtag.deck = deck; + if (this != deck.selected && this.selected) deck.showCard(this); + } + }, + removed: function() { + var deck = this.xtag.deck; + if (deck) { + if (this == deck.xtag.selected) { + deck.xtag.selected = null; + deck.removeAttribute("selected-index"); + } else deck.showCard(deck.selectedCard); + this.xtag.deck = null; + } + } + }, + accessors: { + transitionType: { + attribute: { + name: "transition-type" + } + }, + selected: { + attribute: { + "boolean": true + }, + set: function(val) { + var deck = this.xtag.deck; + if (deck) { + if (val && this != deck.selected) deck.showCard(this); else if (!val && this == deck.selected) deck.hideCard(this); + } + } + } + } + }); +})(); + +(function() { + function reveal(e) { + var flipBox = e.currentTarget; + if (this.parentNode == flipBox) { + if (this.parentNode.firstElementChild == this) { + flipBox.flipped = false; + } else if (this.parentNode.lastElementChild == this) { + flipBox.flipped = true; + } + } + } + xtag.register("x-flipbox", { + lifecycle: { + created: function() { + if (this.firstElementChild) { + xtag.skipTransition(this.firstElementChild, function() {}); + } + if (this.lastElementChild) { + xtag.skipTransition(this.lastElementChild, function() {}); + } + if (!this.hasAttribute("direction")) { + this.xtag._direction = "right"; + } + } + }, + events: { + "transitionend:delegate(x-flipbox > *:first-child)": function(e) { + var flipBox = e.currentTarget; + if (this.parentNode == flipBox) { + xtag.fireEvent(flipBox, "flipend"); + } + }, + "reveal:delegate(x-flipbox > *)": reveal + }, + accessors: { + direction: { + attribute: {}, + get: function() { + return this.xtag._direction; + }, + set: function(value) { + var self = this; + xtag.skipTransition(this.firstElementChild, function() { + self.setAttribute("_anim-direction", value); + return function() {}; + }); + xtag.skipTransition(this.lastElementChild, function() { + self.setAttribute("_anim-direction", value); + }); + this.xtag._direction = value; + } + }, + flipped: { + attribute: { + "boolean": true + } + } + }, + methods: { + toggle: function() { + this.flipped = !this.flipped; + }, + showFront: function() { + this.flipped = false; + }, + showBack: function() { + this.flipped = true; + } + } + }); +})(); + +(function() { + function getLayoutElements(layout) { + var first = layout.firstElementChild; + if (!first) { + return { + header: null, + section: null, + footer: null + }; + } + var second = first.nextElementSibling; + return { + header: first.nodeName == "HEADER" ? first : null, + section: first.nodeName == "SECTION" ? first : second && second.nodeName == "SECTION" ? second : null, + footer: layout.lastElementChild.nodeName == "FOOTER" ? layout.lastElementChild : null + }; + } + function getLayoutScroll(layout, element) { + var scroll = element.__layoutScroll__ = element.__layoutScroll__ || Object.defineProperty(element, "__layoutScroll__", { + value: { + last: element.scrollTop + } + }).__layoutScroll__; + var now = element.scrollTop, buffer = layout.scrollBuffer; + scroll.max = scroll.max || Math.max(now + buffer, buffer); + scroll.min = scroll.min || Math.max(now - buffer, buffer); + return scroll; + } + function maxContent(layout, elements) { + layout.setAttribute("content-maximizing", null); + if (elements.section) { + if (elements.header) { + elements.section.style.marginTop = "-" + elements.header.getBoundingClientRect().height + "px"; + } + if (elements.footer) { + elements.section.style.marginBottom = "-" + elements.footer.getBoundingClientRect().height + "px"; + } + } + } + function minContent(layout, elements) { + layout.removeAttribute("content-maximized"); + layout.removeAttribute("content-maximizing"); + if (elements.section) { + elements.section.style.marginTop = ""; + elements.section.style.marginBottom = ""; + } + } + function evaluateScroll(event) { + if (!event.currentTarget.hasAttribute("content-maximizing")) { + var target = event.target, layout = event.currentTarget; + if (this.scrollhide && (target.parentNode == layout || xtag.matchSelector(target, layout.scrollTarget))) { + var now = target.scrollTop, buffer = layout.scrollBuffer, elements = getLayoutElements(layout), scroll = getLayoutScroll(layout, target); + if (now > scroll.last) { + scroll.min = Math.max(now - buffer, buffer); + } else if (now < scroll.last) { + scroll.max = Math.max(now + buffer, buffer); + } + if (!layout.maxcontent) { + if (now > scroll.max && !layout.hasAttribute("content-maximized")) { + maxContent(layout, elements); + } else if (now < scroll.min) { + minContent(layout, elements); + } + } + scroll.last = now; + } + } + } + xtag.register("x-layout", { + lifecycle: { + created: function() {} + }, + events: { + scroll: evaluateScroll, + transitionend: function(e) { + var elements = getLayoutElements(this); + if (this.hasAttribute("content-maximizing") && (e.target == elements.header || e.target == elements.section || e.target == elements.footer)) { + this.setAttribute("content-maximized", null); + this.removeAttribute("content-maximizing"); + } + }, + "tap:delegate(section)": function(e) { + var layout = e.currentTarget; + if (layout.taphide && this.parentNode == layout) { + var elements = getLayoutElements(layout); + if (layout.hasAttribute("content-maximizing") || layout.hasAttribute("content-maximized")) { + if (!layout.maxcontent) { + minContent(layout, elements); + } + } else { + maxContent(layout, elements); + } + } + }, + "mouseover:delegate(section)": function(e) { + var layout = e.currentTarget; + if (layout.hoverhide && this.parentNode == layout && !layout.hasAttribute("content-maximized") && !layout.hasAttribute("content-maximizing") && (!e.relatedTarget || this.contains(e.target))) { + maxContent(layout, getLayoutElements(layout)); + } + }, + "mouseout:delegate(section)": function(e) { + var layout = e.currentTarget; + if (layout.hoverhide && this.parentNode == layout && (layout.hasAttribute("content-maximized") || layout.hasAttribute("content-maximizing")) && (layout == e.relatedTarget || !layout.contains(e.relatedTarget))) { + minContent(layout, getLayoutElements(layout)); + } + } + }, + accessors: { + scrollTarget: { + attribute: { + name: "scroll-target" + } + }, + scrollBuffer: { + attribute: { + name: "scroll-buffer" + }, + get: function() { + return Number(this.getAttribute("scroll-buffer")) || 30; + } + }, + taphide: { + attribute: { + "boolean": true + } + }, + hoverhide: { + attribute: { + "boolean": true + } + }, + scrollhide: { + attribute: { + "boolean": true + } + }, + maxcontent: { + attribute: { + "boolean": true + }, + set: function(value) { + var elements = getLayoutElements(this); + if (value) { + maxContent(this, elements); + } else if (!this.hasAttribute("content-maximizing")) { + minContent(this, elements); + } + } + } + } + }); +})(); + +(function() { + var KEYCODES = { + 33: "PAGE_UP", + 34: "PAGE_DOWN", + 35: "END", + 36: "HOME", + 37: "LEFT_ARROW", + 38: "UP_ARROW", + 39: "RIGHT_ARROW", + 40: "DOWN_ARROW" + }; + var LEFT_MOUSE_BTN = 0; + function isNum(num) { + return !isNaN(parseFloat(num)); + } + function hasNumAttr(elem, attrName) { + return elem.hasAttribute(attrName) && isNum(elem.getAttribute(attrName)); + } + function roundToStep(rawRangeVal, step, rangeMin, roundFn) { + roundFn = roundFn ? roundFn : Math.round; + rangeMin = isNum(rangeMin) ? rangeMin : 0; + if (!isNum(rawRangeVal)) { + throw "invalid value " + rawRangeVal; + } + if (!isNum(step) || +step <= 0) { + throw "invalid step " + step; + } + return roundFn((rawRangeVal - rangeMin) / step) * step + rangeMin; + } + function constrainToSteppedRange(value, min, max, step) { + if (value < min) { + return min; + } else if (value > max) { + return Math.max(min, roundToStep(max, step, min, Math.floor)); + } else { + return value; + } + } + function getDefaultVal(min, max, step) { + var roundedVal = roundToStep((max - min) / 2 + min, step, min); + return constrainToSteppedRange(roundedVal, min, max, step); + } + function _rawValToFraction(slider, value) { + var min = slider.min; + var max = slider.max; + return (value - min) / (max - min); + } + function _fractionToRawVal(slider, fraction) { + var min = slider.min; + var max = slider.max; + return (max - min) * fraction + min; + } + function _fractionToCorrectedVal(slider, sliderFraction) { + sliderFraction = Math.min(Math.max(0, sliderFraction), 1); + var rawVal = _fractionToRawVal(slider, sliderFraction); + var roundedVal = roundToStep(rawVal, slider.step, slider.min); + return constrainToSteppedRange(roundedVal, slider.min, slider.max, slider.step); + } + function _positionThumb(slider, value) { + var thumb = slider.xtag.sliderThumb; + if (!thumb) { + return; + } + var sliderRect = slider.getBoundingClientRect(); + var thumbRect = thumb.getBoundingClientRect(); + var fraction = _rawValToFraction(slider, value); + var vertical = slider.vertical; + var sliderWidth = sliderRect[vertical ? "height" : "width"]; + var thumbWidth = thumbRect[vertical ? "height" : "width"]; + var availableWidth = Math.max(sliderWidth - thumbWidth, 0); + var newThumbX = availableWidth * fraction; + var finalPercentage = newThumbX / sliderWidth; + thumb.style[vertical ? "left" : "top"] = 0; + thumb.style[vertical ? "top" : "left"] = finalPercentage * 100 + "%"; + slider.xtag.sliderProgress.style[vertical ? "height" : "width"] = fraction * 100 + "%"; + } + function _redraw(slider) { + _positionThumb(slider, slider.value); + } + function _onMouseInput(slider, pageX, pageY) { + var inputEl = slider.xtag.rangeInputEl; + var inputOffsets = inputEl.getBoundingClientRect(); + var thumbWidth = slider.xtag.sliderThumb.getBoundingClientRect().width; + var inputClickX = pageX - inputOffsets.left - thumbWidth / 2; + var divideby = inputOffsets.width - thumbWidth / 2; + if (slider.vertical) { + divideby = inputOffsets.height; + inputClickX = pageY - inputOffsets.top; + } + slider.value = _fractionToCorrectedVal(slider, inputClickX / divideby); + xtag.fireEvent(slider, "input"); + _redraw(slider); + } + function _onDragStart(slider, pageX, pageY) { + slider.xtag.dragInitVal = slider.value; + _onMouseInput(slider, pageX, pageY); + var callbacks = slider.xtag.callbackFns; + var _addBodyListener = function(event, listener) { + document.body.addEventListener(event, listener); + }; + _addBodyListener("mousemove", callbacks.onMouseDragMove); + _addBodyListener("touchmove", callbacks.onTouchDragMove); + _addBodyListener("mouseup", callbacks.onDragEnd); + _addBodyListener("touchend", callbacks.onDragEnd); + var thumb = slider.xtag.sliderThumb; + if (thumb) { + thumb.setAttribute("active", true); + } + } + function _onDragMove(slider, pageX, pageY) { + _onMouseInput(slider, pageX, pageY); + } + function _makeCallbackFns(slider) { + return { + onMouseDragStart: function(e) { + if (e.button !== LEFT_MOUSE_BTN) { + return; + } + _onDragStart(slider, e.pageX, e.pageY); + e.preventDefault(); + }, + onTouchDragStart: function(e) { + var touches = e.targetTouches; + if (touches.length !== 1) { + return; + } + _onDragStart(slider, touches[0].pageX, touches[0].pageY); + e.preventDefault(); + }, + onMouseDragMove: function(e) { + _onDragMove(slider, e.pageX, e.pageY); + e.preventDefault(); + }, + onTouchDragMove: function(e) { + var touches = e.targetTouches; + if (touches.length !== 1) { + return; + } + _onDragMove(slider, touches[0].pageX, touches[0].pageY); + e.preventDefault(); + }, + onDragEnd: function(e) { + var callbacks = slider.xtag.callbackFns; + var _removeBodyListener = function(event, listener) { + document.body.removeEventListener(event, listener); + }; + _removeBodyListener("mousemove", callbacks.onMouseDragMove); + _removeBodyListener("touchmove", callbacks.onTouchDragMove); + _removeBodyListener("mouseup", callbacks.onDragEnd); + _removeBodyListener("touchend", callbacks.onDragEnd); + var thumb = slider.xtag.sliderThumb; + if (thumb) { + thumb.removeAttribute("active"); + } + if (slider.value !== slider.xtag.dragInitVal) { + xtag.fireEvent(slider, "change"); + } + slider.xtag.dragInitVal = null; + e.preventDefault(); + }, + onKeyDown: function(e) { + var keyCode = e.keyCode; + if (keyCode in KEYCODES) { + var oldVal = this.value; + var min = this.min; + var max = this.max; + var step = this.step; + var rangeSize = Math.max(0, max - min); + var largeStep = Math.max(rangeSize / 10, step); + switch (KEYCODES[keyCode]) { + case "LEFT_ARROW": + case "DOWN_ARROW": + this.value = Math.max(oldVal - step, min); + break; + + case "RIGHT_ARROW": + case "UP_ARROW": + this.value = Math.min(oldVal + step, max); + break; + + case "HOME": + this.value = min; + break; + + case "END": + this.value = max; + break; + + case "PAGE_DOWN": + this.value = Math.max(oldVal - largeStep, min); + break; + + case "PAGE_UP": + this.value = Math.min(oldVal + largeStep, max); + break; + + default: + break; + } + if (this.value !== oldVal) { + xtag.fireEvent(this, "change"); + } + e.preventDefault(); + } + } + }; + } + xtag.register("x-slider", { + lifecycle: { + created: function() { + var self = this; + self.xtag.callbackFns = _makeCallbackFns(self); + self.xtag.dragInitVal = null; + var input = document.createElement("input"); + xtag.addClass(input, "input"); + input.setAttribute("type", "range"); + var initMax = hasNumAttr(self, "max") ? +self.getAttribute("max") : 100; + var initMin = hasNumAttr(self, "min") ? +self.getAttribute("min") : 0; + var initStep = hasNumAttr(self, "step") ? +self.getAttribute("step") : 1; + initStep = initStep > 0 ? initStep : 1; + var initVal = hasNumAttr(self, "value") ? +self.getAttribute("value") : getDefaultVal(initMin, initMax, initStep); + input.setAttribute("max", initMax); + input.setAttribute("min", initMin); + input.setAttribute("step", initStep); + input.setAttribute("value", initVal); + self.xtag.rangeInputEl = input; + self.appendChild(self.xtag.rangeInputEl); + var sliderTrack = document.createElement("div"); + xtag.addClass(sliderTrack, "slider-track"); + this.xtag.sliderTrack = sliderTrack; + this.appendChild(sliderTrack); + var sliderProgress = document.createElement("div"); + xtag.addClass(sliderProgress, "slider-progress"); + this.xtag.sliderProgress = sliderProgress; + sliderTrack.appendChild(sliderProgress); + var sliderThumb = document.createElement("span"); + xtag.addClass(sliderThumb, "slider-thumb"); + this.xtag.sliderThumb = sliderThumb; + this.appendChild(sliderThumb); + if (input.type !== "range" || self.hasAttribute("polyfill")) { + self.setAttribute("polyfill", true); + } else { + self.removeAttribute("polyfill"); + } + this.addEventListener("mousedown", self.xtag.callbackFns.onMouseDragStart); + this.addEventListener("touchstart", self.xtag.callbackFns.onTouchDragStart); + this.addEventListener("keydown", self.xtag.callbackFns.onKeyDown); + self.setAttribute("value", initVal); + }, + inserted: function() { + var self = this; + xtag.requestFrame(function() { + xtag.requestFrame(function() { + _redraw(self); + }); + }); + }, + attributeChanged: function(property) { + if (property == "min" || property == "max" || property == "step") { + _redraw(this); + } + } + }, + events: { + "change:delegate(input[type=range])": function(e) { + e.stopPropagation(); + xtag.fireEvent(e.currentTarget, "change"); + }, + "input:delegate(input[type=range])": function(e) { + e.stopPropagation(); + xtag.fireEvent(e.currentTarget, "input"); + }, + "focus:delegate(input[type=range])": function(e) { + var slider = e.currentTarget; + xtag.fireEvent(slider, "focus", {}, { + bubbles: false + }); + }, + "blur:delegate(input[type=range])": function(e) { + var slider = e.currentTarget; + xtag.fireEvent(slider, "blur", {}, { + bubbles: false + }); + } + }, + accessors: { + polyfill: { + attribute: { + "boolean": true + }, + set: function(isPolyfill) { + var callbackFns = this.xtag.callbackFns; + if (isPolyfill) { + this.setAttribute("tabindex", 0); + this.xtag.rangeInputEl.setAttribute("tabindex", -1); + this.xtag.rangeInputEl.setAttribute("readonly", true); + _redraw(this); + } else { + this.removeAttribute("tabindex"); + this.xtag.rangeInputEl.removeAttribute("tabindex"); + this.xtag.rangeInputEl.removeAttribute("readonly"); + } + } + }, + vertical: { + attribute: { + "boolean": true + }, + set: function() { + _redraw(this); + } + }, + max: { + attribute: { + selector: "input[type=range]" + }, + get: function() { + return +this.xtag.rangeInputEl.getAttribute("max"); + } + }, + min: { + attribute: { + selector: "input[type=range]" + }, + get: function() { + return +this.xtag.rangeInputEl.getAttribute("min"); + } + }, + step: { + attribute: { + selector: "input[type=range]" + }, + get: function() { + return +this.xtag.rangeInputEl.getAttribute("step"); + } + }, + name: { + attribute: { + selector: "input[type=range]" + }, + set: function(newName) { + var input = this.xtag.rangeInputEl; + if (newName === null || newName === undefined) { + input.removeAttribute("name"); + } else { + input.setAttribute("name", newName); + } + } + }, + value: { + attribute: { + selector: "input[type=range]" + }, + get: function() { + return +this.xtag.rangeInputEl.value; + }, + set: function(rawVal) { + if (!isNum(rawVal)) { + rawVal = getDefaultVal(this.min, this.max, this.step); + } + rawVal = +rawVal; + var min = this.min; + var max = this.max; + var step = this.step; + var roundedVal = roundToStep(rawVal, step, min); + var finalVal = constrainToSteppedRange(roundedVal, min, max, step); + this.xtag.rangeInputEl.value = finalVal; + _redraw(this); + } + }, + inputElem: { + get: function() { + return this.xtag.rangeInputEl; + } + } + }, + methods: {} + }); +})(); + +(function() { + function getWindowViewport() { + var docElem = document.documentElement; + var rect = { + left: docElem.scrollLeft || document.body.scrollLeft || 0, + top: docElem.scrollTop || document.body.scrollTop || 0, + width: docElem.clientWidth, + height: docElem.clientHeight + }; + rect.right = rect.left + rect.width; + rect.bottom = rect.top + rect.height; + return rect; + } + function getRect(el) { + var rect = el.getBoundingClientRect(); + var viewport = getWindowViewport(); + var docScrollLeft = viewport.left; + var docScrollTop = viewport.top; + return { + left: rect.left + docScrollLeft, + right: rect.right + docScrollLeft, + top: rect.top + docScrollTop, + bottom: rect.bottom + docScrollTop, + width: rect.width, + height: rect.height + }; + } + function _pointIsInRect(x, y, rect) { + return rect.left <= x && x <= rect.right && rect.top <= y && y <= rect.bottom; + } + xtag.register("x-tabbar", { + lifecycle: { + created: function() { + this.xtag.overallEventToFire = "reveal"; + } + }, + events: { + "tap:delegate(x-tabbar-tab)": function() { + var activeTab = xtag.query(this.parentNode, "x-tabbar-tab[selected]"); + if (activeTab.length) { + activeTab.forEach(function(t) { + t.removeAttribute("selected"); + }); + } + this.setAttribute("selected", true); + } + }, + accessors: { + tabs: { + get: function() { + return xtag.queryChildren(this, "x-tabbar-tab"); + } + }, + targetEvent: { + attribute: { + name: "target-event" + }, + get: function() { + return this.xtag.overallEventToFire; + }, + set: function(newEventType) { + this.xtag.overallEventToFire = newEventType; + } + } + }, + methods: {} + }); + function _onTabbarTabTap(tabEl) { + if (tabEl.parentNode.nodeName.toLowerCase() === "x-tabbar") { + var targetEvent = tabEl.targetEvent; + var targets = tabEl.targetSelector ? xtag.query(document, tabEl.targetSelector) : tabEl.targetElems; + targets.forEach(function(targ) { + xtag.fireEvent(targ, targetEvent); + }); + } + } + xtag.register("x-tabbar-tab", { + lifecycle: { + created: function() { + this.xtag.targetSelector = null; + this.xtag.overrideTargetElems = null; + this.xtag.targetEvent = null; + } + }, + events: { + tap: function(e) { + var tabEl = e.currentTarget; + if (e.changedTouches && e.changedTouches.length > 0) { + var releasedTouch = e.changedTouches[0]; + var tabRect = getRect(tabEl); + if (_pointIsInRect(releasedTouch.pageX, releasedTouch.pageY, tabRect)) { + _onTabbarTabTap(tabEl); + } + } else { + _onTabbarTabTap(tabEl); + } + } + }, + accessors: { + targetSelector: { + attribute: { + name: "target-selector" + }, + get: function() { + return this.xtag.targetSelector; + }, + set: function(newTargetSelector) { + this.xtag.targetSelector = newTargetSelector; + if (newTargetSelector) { + this.xtag.overrideTargetElems = null; + } + } + }, + targetElems: { + get: function() { + if (this.targetSelector) { + return xtag.query(document, this.targetSelector); + } else if (this.xtag.overrideTargetElems !== null) { + return this.xtag.overrideTargetElems; + } else { + return []; + } + }, + set: function(newElems) { + this.removeAttribute("target-selector"); + this.xtag.overrideTargetElems = newElems; + } + }, + targetEvent: { + attribute: { + name: "target-event" + }, + get: function() { + if (this.xtag.targetEvent) { + return this.xtag.targetEvent; + } else if (this.parentNode.nodeName.toLowerCase() === "x-tabbar") { + return this.parentNode.targetEvent; + } else { + throw "tabbar-tab is missing event to fire"; + } + }, + set: function(newEvent) { + this.xtag.targetEvent = newEvent; + } + } + }, + methods: {} + }); +})(); + +(function() { + function setScope(toggle) { + var form = toggle.xtag.input.form; + if (form) toggle.removeAttribute("x-toggle-no-form"); else toggle.setAttribute("x-toggle-no-form", ""); + toggle.xtag.scope = toggle.parentNode ? form || document : null; + } + function updateScope(scope) { + var names = {}; + var docSelector = scope == document ? "[x-toggle-no-form]" : ""; + xtag.query(scope, "x-toggle[name]" + docSelector).forEach(function(toggle) { + var name = toggle.name; + if (name && !names[name]) { + var named = xtag.query(scope, 'x-toggle[name="' + name + '"]' + docSelector); + var type = named.length > 1 ? "radio" : "checkbox"; + named.forEach(function(toggle) { + if (toggle.xtag && toggle.xtag.input) { + toggle.type = type; + } + }); + names[name] = true; + } + }); + } + function toggleGroup(toggle) { + if (shifted && toggle.group && toggle.type != "radio") { + var toggles = toggle.groupToggles; + var selector = 'x-toggle[group="' + toggle.group + '"][active]'; + var active = toggle.xtag.scope.querySelector(selector); + if (active && toggle != active) { + toggle.checked = active.checked; + var state = active.checked; + var index = toggles.indexOf(toggle); + var activeIndex = toggles.indexOf(active); + var minIndex = Math.min(index, activeIndex); + var maxIndex = Math.max(index, activeIndex); + toggles.slice(minIndex, maxIndex + 1).forEach(function(toggle) { + if (toggle != active) toggle.checked = state; + }); + return true; + } + } + } + function activateToggle(toggle) { + if (inTogglebar(toggle)) return; + toggle.groupToggles.forEach(function(node) { + node.active = false; + }); + toggle.active = true; + } + function inTogglebar(toggle) { + return toggle.parentNode && toggle.parentNode.nodeName == "X-TOGGLEBAR"; + } + var shifted = false; + xtag.addEvents(document, { + DOMComponentsLoaded: function() { + updateScope(document); + xtag.toArray(document.forms).forEach(updateScope); + }, + WebComponentsReady: function() { + updateScope(document); + xtag.toArray(document.forms).forEach(updateScope); + }, + keydown: function(e) { + shifted = e.shiftKey; + }, + keyup: function(e) { + shifted = e.shiftKey; + }, + "focus:delegate(x-toggle)": function(e) { + this.focus = true; + this.xtag.input.focus(); + }, + "blur:delegate(x-toggle)": function(e) { + this.focus = false; + }, + "tap:delegate(x-toggle)": function(e) { + var input = this.xtag.input; + if (input.type == "radio" ? !this.checked : true) { + input.checked = !input.checked; + var change = document.createEvent("Event"); + change.initEvent("change", true, false); + input.dispatchEvent(change); + } + input.focus(); + }, + "change:delegate(x-toggle)": function(e) { + this.xtag.input.focus(); + if (inTogglebar(this) || !toggleGroup(this) && this.type != "radio") this.checked = this.xtag.input.checked; + activateToggle(this); + } + }); + var template = xtag.createFragment('<input /><div class="x-toggle-check"></div>'); + xtag.register("x-toggle", { + lifecycle: { + created: function() { + this.appendChild(template.cloneNode(true)); + this.xtag.input = this.querySelector("input"); + this.xtag.checkEl = this.querySelector(".x-toggle-check"); + this.type = "checkbox"; + setScope(this); + var name = this.getAttribute("name"); + if (name) { + this.xtag.input.name = this.getAttribute("name"); + } + if (this.hasAttribute("checked")) { + this.checked = true; + } + }, + inserted: function() { + setScope(this); + if (this.name) { + updateScope(this.xtag.scope); + } + }, + removed: function() { + updateScope(this.xtag.scope); + setScope(this); + } + }, + accessors: { + noBox: { + attribute: { + name: "no-box", + "boolean": true + } + }, + type: { + attribute: {}, + set: function(type) { + this.xtag.input.type = type; + } + }, + label: { + attribute: {} + }, + focus: { + attribute: { + "boolean": true + } + }, + active: { + attribute: { + "boolean": true + } + }, + group: { + attribute: {} + }, + groupToggles: { + get: function() { + return xtag.query(this.xtag.scope, 'x-toggle[group="' + this.group + '"]'); + } + }, + name: { + attribute: { + skip: true + }, + set: function(name) { + if (name === null) { + this.removeAttribute("name"); + this.type = "checkbox"; + } else { + this.setAttribute("name", name); + } + this.xtag.input.name = name; + updateScope(this.xtag.scope); + } + }, + checked: { + get: function() { + return this.xtag.input.checked; + }, + set: function(value) { + var name = this.name, state = value === "true" || value === true; + if (name) { + var scopeSelector = this.xtag.scope == document ? "[x-toggle-no-form]" : ""; + var selector = 'x-toggle[checked][name="' + name + '"]' + scopeSelector; + var previous = this.xtag.scope.querySelector(selector); + if (previous) { + previous.removeAttribute("checked"); + } + } + this.xtag.input.checked = state; + if (state) { + this.setAttribute("checked", ""); + } else { + this.removeAttribute("checked"); + } + } + }, + value: { + attribute: {}, + get: function() { + return this.xtag.input.value; + }, + set: function(value) { + this.xtag.input.value = value; + } + } + } + }); + xtag.register("x-togglebar", { + events: {} + }); +})();
\ No newline at end of file diff --git a/style/brick-1.0.0rc1.min.css b/style/brick-1.0.0rc1.min.css new file mode 100644 index 0000000..2888e79 --- /dev/null +++ b/style/brick-1.0.0rc1.min.css @@ -0,0 +1,130 @@ +x-appbar{padding:0;width:100%;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex} +x-appbar,x-appbar *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box} +x-appbar > *{border:none;vertical-align:middle;text-align:center;-webkit-flex-align:center;-ms-flex-align:center;-webkit-align-items:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;align-items:center;text-align:center} +x-appbar > header{min-width:auto;min-height:auto;-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1;-ms-flex:1;box-flex:1;flex:1;overflow:hidden;text-overflow:ellipsis;margin:0} +x-calendar{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-moz-tap-highlight-color:transparent;tap-highlight-color:transparent;position:relative;display:inline-block;margin:0;padding:0;max-width:100%;font-size:1em;text-align:center;overflow:hidden} +x-calendar,x-calendar *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box} +x-calendar .calendar{position:relative;display:inline-block;overflow:hidden;width:100%;height:100%} +x-calendar .month{display:inline-block;margin:0;padding:0;vertical-align:top;white-space:nowrap;width:224px;max-width:100%} +x-calendar .week,x-calendar .weekday-labels{margin:1px 0;overflow:visible;width:100%;white-space:nowrap} +x-calendar .day,x-calendar .prev,x-calendar .next,x-calendar .weekday-label{display:inline-block;width:32px} +x-calendar .month-label,x-calendar .weekday-labels,x-calendar .week,x-calendar .prev,x-calendar .next{height:2em;line-height:2em} +x-calendar .weekday-label{opacity:.8;font-size:.8em} +x-calendar .weekday-label,x-calendar .day{height:100%;line-height:inherit;margin:0 auto} +x-calendar .month-label{width:100%} +x-calendar .day{position:relative;white-space:nowrap} +x-calendar .badmonth{opacity:.5} +x-calendar:not([controls]) .controls{display:none !important} +x-calendar[controls] .controls{display:block} +x-calendar .prev,x-calendar .next{position:absolute;top:0;max-width:3em} +x-calendar .prev{left:0} +x-calendar .next{right:0} +x-calendar:not([active]) .day:hover,x-calendar:not([active]) .prev:hover,x-calendar:not([active]) .next:hover{cursor:pointer} +x-deck{display:block;position:relative;overflow:hidden;height:100%;width:100%} +x-deck > x-card{display:none;position:absolute !important;left:0;right:0;height:100%;width:100%;overflow:hidden;z-index:0;opacity:1;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-ms-transform-style:preserve-3d;-o-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transform:translate(0%,0%) scale(1);-moz-transform:translate(0%,0%) scale(1);-ms-transform:translate(0%,0%) scale(1);-o-transform:translate(0%,0%) scale(1);transform:translate(0%,0%) scale(1)} +x-deck > x-card[selected],x-deck > x-card[transition]{display:block} +x-deck:not([transition-type]) > x-card:not([transition-type]),x-deck[transition-type="fade-scale"] > x-card,x-deck > x-card[transition-type="fade-scale"]{opacity:0;-webkit-transform:scale(.85);-moz-transform:scale(.85);-ms-transform:scale(.85);-o-transform:scale(.85);transform:scale(.85);-webkit-transition:opacity .5s ease,-webkit-transform .5s ease;-moz-transition:opacity .5s ease,-moz-transform .5s ease;-ms-transition:opacity .5s ease,-ms-transform .5s ease;-o-transition:opacity .5s ease,-o-transform .5s ease;transition:opacity .5s ease,transform .5s ease} +x-deck > x-card[show][transition]{opacity:1;-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)} +x-deck[transition-type^="slide"] > x-card,x-deck > x-card[transition-type^="slide"]{z-index:1} +x-deck[transition-type^="slide"] > x-card[transition-direction="reverse"],x-deck > x-card[transition-type^="slide"][transition-direction="reverse"]{z-index:2} +x-deck[transition-type^="slide"] > x-card[show],x-deck > x-card[show][transition-type^="slide"],x-deck[transition-type^="slide"] > x-card[hide],x-deck > x-card[hide][transition-type^="slide"]{-webkit-transition:-webkit-transform .6s ease;-moz-transition:-moz-transform .6s ease;-ms-transition:-ms-transform .6s ease;-o-transition:-o-transform .6s ease;transition:transform .6s ease} +x-deck[transition-type="slide-right"] > x-card[show][transition-direction="forward"],x-deck > x-card[show][transition-direction="forward"][transition-type="slide-right"],x-deck[transition-type="slide-right"] > x-card[hide][transition-direction="reverse"],x-deck > x-card[hide][transition-direction="reverse"][transition-type="slide-right"],x-deck[transition-type="slide-left"] > x-card[show][transition-direction="reverse"],x-deck > x-card[show][transition-direction="reverse"][transition-type="slide-left"],x-deck[transition-type="slide-left"] > x-card[hide][transition-direction="forward"],x-deck > x-card[hide][transition-direction="forward"][transition-type="slide-left"]{-webkit-transform:translate(-100%,0);-moz-transform:translate(-100%,0);-ms-transform:translate(-100%,0);-o-transform:translate(-100%,0);transform:translate(-100%,0)} +x-deck[transition-type="slide-right"] > x-card[show][transition-direction="reverse"],x-deck > x-card[show][transition-direction="reverse"][transition-type="slide-right"],x-deck[transition-type="slide-right"] > x-card[hide][transition-direction="forward"],x-deck > x-card[hide][transition-direction="forward"][transition-type="slide-right"],x-deck[transition-type="slide-left"] > x-card[show][transition-direction="forward"],x-deck > x-card[show][transition-direction="forward"][transition-type="slide-left"],x-deck[transition-type="slide-left"] > x-card[hide][transition-direction="reverse"],x-deck > x-card[hide][transition-direction="reverse"][transition-type="slide-left"]{-webkit-transform:translate(100%,0);-moz-transform:translate(100%,0);-ms-transform:translate(100%,0);-o-transform:translate(100%,0);transform:translate(100%,0)} +x-deck[transition-type="slide-up"] > x-card[show][transition-direction="reverse"],x-deck > x-card[show][transition-direction="reverse"][transition-type="slide-up"],x-deck[transition-type="slide-up"] > x-card[hide][transition-direction="forward"],x-deck > x-card[hide][transition-direction="forward"][transition-type="slide-up"],x-deck[transition-type="slide-down"] > x-card[show][transition-direction="forward"],x-deck > x-card[show][transition-direction="forward"][transition-type="slide-down"],x-deck[transition-type="slide-down"] > x-card[hide][transition-direction="reverse"],x-deck > x-card[hide][transition-direction="reverse"][transition-type="slide-down"]{-webkit-transform:translate(0,-100%);-moz-transform:translate(0,-100%);-ms-transform:translate(0,-100%);-o-transform:translate(0,-100%);transform:translate(0,-100%)} +x-deck[transition-type="slide-up"] > x-card[show][transition-direction="forward"],x-deck > x-card[show][transition-direction="forward"][transition-type="slide-up"],x-deck[transition-type="slide-up"] > x-card[hide][transition-direction="reverse"],x-deck > x-card[hide][transition-direction="reverse"][transition-type="slide-up"],x-deck[transition-type="slide-down"] > x-card[show][transition-direction="reverse"],x-deck > x-card[show][transition-direction="reverse"][transition-type="slide-down"],x-deck[transition-type="slide-down"] > x-card[hide][transition-direction="forward"],x-deck > x-card[hide][transition-direction="forward"][transition-type="slide-down"]{-webkit-transform:translate(0,100%);-moz-transform:translate(0,100%);-ms-transform:translate(0,100%);-o-transform:translate(0,100%);transform:translate(0,100%)} +x-deck[transition-type^="slide"] > x-card[show][transition],x-deck > x-card[show][transition][transition-type^="slide"]{-webkit-transform:translate(0%,0%);-moz-transform:translate(0%,0%);-ms-transform:translate(0%,0%);-o-transform:translate(0%,0%);transform:translate(0%,0%)} +x-flipbox{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;position:relative;height:100%;width:100%;-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-ms-transform-style:preserve-3d;-o-transform-style:preserve-3d;transform-style:preserve-3d} +x-flipbox > *{display:block;position:absolute;top:0;left:0;width:100%;height:100%;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;-o-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition-property:-webkit-transform;-moz-transition-property:-moz-transform;-ms-transition-property:-ms-transform;-o-transition-property:-o-transform;transition-property:transform;-webkit-transition-duration:.25s;-moz-transition-duration:.25s;-ms-transition-duration:.25s;-o-transition-duration:.25s;transition-duration:.25s;-webkit-transition-timing-function:linear;-moz-transition-timing-function:linear;-ms-transition-timing-function:linear;-o-transition-timing-function:linear;transition-timing-function:linear;-webkit-transition-delay:0;-moz-transition-delay:0;-ms-transition-delay:0;-o-transition-delay:0;transition-delay:0;-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-ms-transform-style:preserve-3d;-o-transform-style:preserve-3d;transform-style:preserve-3d} +x-flipbox > *:first-child{-webkit-transform:perspective(800px) rotateY(0) translate3d(0,0,2px);-moz-transform:perspective(800px) rotateY(0) translate3d(0,0,2px);-ms-transform:perspective(800px) rotateY(0) translate3d(0,0,2px);-o-transform:perspective(800px) rotateY(0) translate3d(0,0,2px);transform:perspective(800px) rotateY(0) translate3d(0,0,2px);z-index:2} +x-flipbox > *:last-child{-webkit-transform:perspective(800px) rotateY(180deg) translate3d(0,0,1px);-moz-transform:perspective(800px) rotateY(180deg) translate3d(0,0,1px);-ms-transform:perspective(800px) rotateY(180deg) translate3d(0,0,1px);-o-transform:perspective(800px) rotateY(180deg) translate3d(0,0,1px);transform:perspective(800px) rotateY(180deg) translate3d(0,0,1px);z-index:1} +x-flipbox[_anim-direction="up"] > *:first-child,x-flipbox[_anim-direction="down"] > *:first-child{-webkit-transform:perspective(800px) rotateX(0) translate3d(0,0,2px);-moz-transform:perspective(800px) rotateX(0) translate3d(0,0,2px);-ms-transform:perspective(800px) rotateX(0) translate3d(0,0,2px);-o-transform:perspective(800px) rotateX(0) translate3d(0,0,2px);transform:perspective(800px) rotateX(0) translate3d(0,0,2px)} +x-flipbox[_anim-direction="up"] > *:last-child{-webkit-transform:perspective(800px) rotateX(-180deg) translate3d(0,0,1px);-moz-transform:perspective(800px) rotateX(-180deg) translate3d(0,0,1px);-ms-transform:perspective(800px) rotateX(-180deg) translate3d(0,0,1px);-o-transform:perspective(800px) rotateX(-180deg) translate3d(0,0,1px);transform:perspective(800px) rotateX(-180deg) translate3d(0,0,1px)} +x-flipbox[_anim-direction="down"] > *:last-child{-webkit-transform:perspective(800px) rotateX(180deg) translate3d(0,0,1px);-moz-transform:perspective(800px) rotateX(180deg) translate3d(0,0,1px);-ms-transform:perspective(800px) rotateX(180deg) translate3d(0,0,1px);-o-transform:perspective(800px) rotateX(180deg) translate3d(0,0,1px);transform:perspective(800px) rotateX(180deg) translate3d(0,0,1px)} +x-flipbox[flipped]:after{content:"";display:none} +x-flipbox[flipped] > *:first-child{-webkit-transform:perspective(800px) rotateY(180deg) translate3d(0,0,2px);-moz-transform:perspective(800px) rotateY(180deg) translate3d(0,0,2px);-ms-transform:perspective(800px) rotateY(180deg) translate3d(0,0,2px);-o-transform:perspective(800px) rotateY(180deg) translate3d(0,0,2px);transform:perspective(800px) rotateY(180deg) translate3d(0,0,2px);z-index:1} +x-flipbox[flipped] > *:last-child{-webkit-transform:perspective(800px) rotateY(360deg) translate3d(0,0,1px);-moz-transform:perspective(800px) rotateY(360deg) translate3d(0,0,1px);-ms-transform:perspective(800px) rotateY(360deg) translate3d(0,0,1px);-o-transform:perspective(800px) rotateY(360deg) translate3d(0,0,1px);transform:perspective(800px) rotateY(360deg) translate3d(0,0,1px);z-index:2} +x-flipbox[_anim-direction="left"][flipped] > *:first-child{-webkit-transform:perspective(800px) rotateY(-180deg) translate3d(0,0,2px);-moz-transform:perspective(800px) rotateY(-180deg) translate3d(0,0,2px);-ms-transform:perspective(800px) rotateY(-180deg) translate3d(0,0,2px);-o-transform:perspective(800px) rotateY(-180deg) translate3d(0,0,2px);transform:perspective(800px) rotateY(-180deg) translate3d(0,0,2px)} +x-flipbox[_anim-direction="left"][flipped] > *:last-child{-webkit-transform:perspective(800px) rotateY(0) translate3d(0,0,1px);-moz-transform:perspective(800px) rotateY(0) translate3d(0,0,1px);-ms-transform:perspective(800px) rotateY(0) translate3d(0,0,1px);-o-transform:perspective(800px) rotateY(0) translate3d(0,0,1px);transform:perspective(800px) rotateY(0) translate3d(0,0,1px)} +x-flipbox[_anim-direction="up"][flipped] > *:first-child{-webkit-transform:perspective(800px) rotateX(180deg) translate3d(0,0,2px);-moz-transform:perspective(800px) rotateX(180deg) translate3d(0,0,2px);-ms-transform:perspective(800px) rotateX(180deg) translate3d(0,0,2px);-o-transform:perspective(800px) rotateX(180deg) translate3d(0,0,2px);transform:perspective(800px) rotateX(180deg) translate3d(0,0,2px)} +x-flipbox[_anim-direction="up"][flipped] > *:last-child{-webkit-transform:perspective(800px) rotateX(0) translate3d(0,0,1px);-moz-transform:perspective(800px) rotateX(0) translate3d(0,0,1px);-ms-transform:perspective(800px) rotateX(0) translate3d(0,0,1px);-o-transform:perspective(800px) rotateX(0) translate3d(0,0,1px);transform:perspective(800px) rotateX(0) translate3d(0,0,1px)} +x-flipbox[_anim-direction="down"][flipped] > *:first-child{-webkit-transform:perspective(800px) rotateX(-180deg) translate3d(0,0,2px);-moz-transform:perspective(800px) rotateX(-180deg) translate3d(0,0,2px);-ms-transform:perspective(800px) rotateX(-180deg) translate3d(0,0,2px);-o-transform:perspective(800px) rotateX(-180deg) translate3d(0,0,2px);transform:perspective(800px) rotateX(-180deg) translate3d(0,0,2px)} +x-flipbox[_anim-direction="down"][flipped] > *:last-child{-webkit-transform:perspective(800px) rotateX(0) translate3d(0,0,1px);-moz-transform:perspective(800px) rotateX(0) translate3d(0,0,1px);-ms-transform:perspective(800px) rotateX(0) translate3d(0,0,1px);-o-transform:perspective(800px) rotateX(0) translate3d(0,0,1px);transform:perspective(800px) rotateX(0) translate3d(0,0,1px)} +x-layout{position:relative !important;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;width:100%;height:100%;overflow:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;-webkit-box-orient:vertical;-moz-box-orient:vertical;-ms-box-orient:vertical;box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column} +x-layout > header,x-layout > footer{margin:0 !important;overflow:hidden;z-index:1;-webkit-transform:translateZ(0);-moz-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0)} +x-layout > header,x-layout > footer{-webkit-transition:-webkit-transform .2s ease-in-out;-moz-transition:-moz-transform .2s ease-in-out;-ms-transition:-ms-transform .2s ease-in-out;transition:transform .2s ease-in-out} +x-layout > section{-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-transition:margin .2s ease-in-out;-moz-transition:margin .2s ease-in-out;-ms-transition:margin .2s ease-in-out;transition:margin .2s ease-in-out;-webkit-transform:translateZ(0);-moz-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);overflow:auto;height:0;position:relative} +x-layout:not([content-maximizing]):not([maxcontent]) > section{margin:0 !important} +x-layout > section > *:only-child{height:100%;position:absolute} +x-layout[content-maximizing] > header,x-layout[content-maximized] > header,x-layout[maxcontent] > header{-webkit-transform:translateY(-100%);-moz-transform:translateY(-100%);-ms-transform:translateY(-100%);transform:translateY(-100%)} +x-layout[content-maximizing] > footer,x-layout[content-maximized] > footer,x-layout[maxcontent] > footer{-webkit-transform:translateY(100%);-moz-transform:translateY(100%);-ms-transform:translateY(100%);transform:translateY(100%)} +x-slider{display:inline-block;position:relative;margin:0;padding:0} +x-slider > input{margin:0;padding:0;position:relative;overflow:hidden;vertical-align:middle;width:100%;min-height:100%} +x-slider .slider-track{position:absolute;display:block;left:0;right:0;bottom:0;top:0;width:100%;height:4px;margin:auto;pointer-events:none} +x-slider .slider-thumb{cursor:default;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-moz-tap-highlight-color:transparent;tap-highlight-color:transparent;vertical-align:middle;position:absolute !important;top:0;left:0;width:32px;height:32px;margin:0;padding:0} +x-slider[polyfill]{cursor:default;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-moz-tap-highlight-color:transparent;tap-highlight-color:transparent} +x-slider[polyfill] > input{cursor:default;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-moz-tap-highlight-color:transparent;tap-highlight-color:transparent;display:block;position:relative} +x-slider[polyfill] > input::-webkit-slider-thumb{visibility:hidden} +x-slider[polyfill] > input::-moz-range-thumb{width:0;height:0} +x-slider[polyfill] > input::-moz-range-track{height:0;width:0} +x-slider:not([polyfill]) > .slider-thumb{visibility:hidden !important} +x-tabbar{display:block;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;width:100%;overflow:hidden;white-space:nowrap;text-align:center} +x-tabbar > x-tabbar-tab{min-width:auto;min-height:auto;-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1;-ms-flex:1;box-flex:1;flex:1;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:inline-block;min-width:auto;min-height:auto;vertical-align:middle} +x-tabbar > x-tabbar-tab > *:only-child{vertical-align:top;height:100%;width:100%;margin:0 !important} +x-toggle{display:inline-block;cursor:pointer} +x-toggle[focus]{outline:1px dashed rgba(0,0,0,0.3)} +x-toggle[no-box] .x-toggle-check{display:none} +x-toggle input:checked + .x-toggle-check{background:#000} +x-toggle[type="radio"] .x-toggle-check{-webkit-border-radius:1em;-moz-border-radius:1em;border-radius:1em} +x-toggle:after{content:attr(label);display:inline-block;vertical-align:middle} +x-toggle .x-toggle-check{display:inline-block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:16px;height:16px;margin:0 3px 0 0;color:#000;vertical-align:middle;border:1px solid;overflow:hidden !important} +x-toggle input{position:absolute;outline:none;z-index:-1;opacity:.0001 !important} +x-togglebar{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;border:1px solid #000;border-radius:4px;clear:both} +x-togglebar x-toggle{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;padding:1px 4px 2px;border-left:inherit;text-align:center;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-box-flex:1;-moz-box-flex:1;-webkit-flex:1;-ms-flex:1;box-flex:1;flex:1;-webkit-box-align:center;-moz-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-moz-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center} +x-togglebar x-toggle:first-child{border-left-color:transparent} +x-togglebar x-toggle[checked]{background:rgba(0,0,0,0.2)} +x-togglebar x-toggle[focus]{-webkit-box-shadow:0 0 2px 0 transparent;-moz-box-shadow:0 0 2px 0 transparent;box-shadow:0 0 2px 0 transparent} +x-togglebar x-toggle .x-toggle-check{height:10px;width:10px} +x-togglebar x-toggle[type="checkbox"] .x-toggle-check{display:none} +x-togglebar[orientation="vertical"]{-webkit-box-orient:vertical;-moz-box-orient:vertical;-ms-box-orient:vertical;box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column} +x-togglebar[orientation="vertical"] x-toggle{border-top:inherit;border-left:none} +x-togglebar[orientation="vertical"] x-toggle:first-child{border-top:none} +x-appbar{background-color:#00202f;color:#fff;font-family:"Fira Sans","Fira Sans","Segoe UI",Frutiger,"Frutiger Linotype","Dejavu Sans","Helvetica Neue",Arial,sans-serif;font-size:17px;height:45px;line-height:45px} +x-appbar > header{font-weight:600} +x-appbar > *{color:#fff;font-family:"Fira Sans","Fira Sans","Segoe UI",Frutiger,"Frutiger Linotype","Dejavu Sans","Helvetica Neue",Arial,sans-serif;font-size:inherit;line-height:inherit;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box} +x-appbar > button{cursor:pointer;padding-left:2px;padding-right:2px;min-width:45px;background:transparent} +x-appbar > button:hover{background-color:#00405d} +x-appbar > button::-moz-focus-inner{border:0;padding:0} +x-appbar > header:after{padding-left:6px;font-size:60%} +x-calendar{border:1px solid #cecece;border-radius:3px;font-size:1em;font-family:"Fira Sans","Fira Sans","Segoe UI",Frutiger,"Frutiger Linotype","Dejavu Sans","Helvetica Neue",Arial,sans-serif;background-color:#fff;color:#444} +x-calendar .weekday-label{opacity:.8} +x-calendar .month-label{border-bottom:1px solid #cecece} +x-calendar .day[active]{border-color:#ffa500} +x-calendar .day.chosen{background:#0095dd;color:#fff} +x-calendar .day.today{font-weight:bold} +x-calendar:not([active]) .prev:hover,x-calendar:not([active]) .next:hover{background-color:#f9f9f9;opacity:.7} +x-calendar:not([active]) .day:not(.chosen):hover{background:#ccc} +html,body{min-height:100%} +x-slider{height:27px} +x-slider:not([polyfill]) .slider-thumb{display:none} +x-slider:not([polyfill]) input{z-index:1} +x-slider[polyfill] input{visibility:hidden} +x-slider .slider-progress{position:absolute;top:0;left:0;height:100%;border-radius:3px;background:#0095dd} +x-slider .slider-thumb,x-slider input[type='range']::-webkit-slider-thumb{background:#fff;-webkit-appearance:none;border-radius:13px;border:1px solid #acacac;box-shadow:0 .5px 1px 0 rgba(0,0,0,0.2);cursor:pointer;display:block;height:25px;width:25px} +x-slider .slider-thumb,x-slider input[type='range']::-moz-range-thumb{background:#fff;-moz-appearance:none;border-radius:13px;border:1px solid #acacac;box-shadow:0 .5px 1px 0 rgba(0,0,0,0.2);cursor:pointer;display:block;height:25px;width:25px} +x-slider .slider-track{background:#d8d8d8;border-radius:3px;height:2px;overflow:hidden} +x-slider input[type=range]::-moz-range-track{-moz-appearance:none;background:#d8d8d8;border:0 !important;outline:0;border-radius:3px;height:2px;box-shadow:0 none} +x-slider input[type=range]::-moz-range-progress{background:#0095dd;border-radius:3px} +x-slider input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0 solid transparent;color:transparent} +x-tabbar{background:#00202f;color:#fff;font-family:"Fira Sans","Fira Sans","Segoe UI",Frutiger,"Frutiger Linotype","Dejavu Sans","Helvetica Neue",Arial,sans-serif;height:45px;line-height:45px} +x-tabbar > x-tabbar-tab{letter-spacing:normal;overflow:hidden;cursor:pointer} +x-tabbar > x-tabbar-tab:hover{background-color:#00405d;color:#eaeaea} +x-tabbar > x-tabbar-tab:active{color:#f2f2f2} +x-tabbar > x-tabbar-tab > x-iconbutton:only-child{border:0} +x-toggle[focus]{outline:0} +x-toggle .x-toggle-content{min-height:22px;line-height:24px} +x-toggle .x-toggle-check{width:22px;height:22px;border-radius:3px;margin:0 3px 0 0;color:#000;vertical-align:middle;border:1px solid #00202f;position:relative;background:#fff} +x-toggle[no-box] .x-toggle-check{display:none !important} +x-toggle[type="radio"] input:checked + .x-toggle-check{background:#fff} +x-toggle[type="radio"] input:checked + .x-toggle-check:after{content:'';display:block;position:absolute;left:0;top:0;bottom:0;right:0;margin:auto;border-radius:50%;width:14px;height:14px;background:#0095dd} +x-toggle[type="checkbox"] input:checked + .x-toggle-check{border-width:0;background:#0095dd} +x-toggle[type="checkbox"] input:checked + .x-toggle-check:after{content:'';display:block;position:absolute;left:0;top:0;bottom:3.2px;right:0;margin:auto;width:10px;height:5px;border:solid #fff;border-width:0 0 2px 2px;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)} diff --git a/style/brick-1.0.0rc1.min.js b/style/brick-1.0.0rc1.min.js new file mode 100644 index 0000000..25924fb --- /dev/null +++ b/style/brick-1.0.0rc1.min.js @@ -0,0 +1,3 @@ +window.Platform={};var logFlags={};!function(){function a(a){if(this._element=a,a.className!=this._classCache){if(this._classCache=a.className,!this._classCache)return;var b,c=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(b=0;b<c.length;b++)g.call(this,c[b])}}function b(a,b){a.className=b.join(" ")}function c(a,b,c){Object.defineProperty?Object.defineProperty(a,b,{get:c}):a.__defineGetter__(b,c)}if(!("undefined"==typeof window.Element||"classList"in document.documentElement)){var d=Array.prototype,e=d.indexOf,f=d.slice,g=d.push,h=d.splice,i=d.join;a.prototype={add:function(a){this.contains(a)||(g.call(this,a),b(this._element,f.call(this,0)))},contains:function(a){return-1!==e.call(this,a)},item:function(a){return this[a]||null},remove:function(a){var c=e.call(this,a);-1!==c&&(h.call(this,c,1),b(this._element,f.call(this,0)))},toString:function(){return i.call(this," ")},toggle:function(a){-1===e.call(this,a)?this.add(a):this.remove(a)}},window.DOMTokenList=a,c(Element.prototype,"classList",function(){return new a(this)})}}(),"undefined"==typeof WeakMap&&!function(){var a=Object.defineProperty,b=Date.now()%1e9,c=function(){this.name="__st"+(1e9*Math.random()>>>0)+(b++ +"__")};c.prototype={set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){this.set(a,void 0)}},window.WeakMap=c}(),function(a){function b(a){u.push(a),t||(t=!0,q(d))}function c(a){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(a)||a}function d(){t=!1;var a=u;u=[],a.sort(function(a,b){return a.uid_-b.uid_});var b=!1;a.forEach(function(a){var c=a.takeRecords();e(a),c.length&&(a.callback_(c,a),b=!0)}),b&&d()}function e(a){a.nodes_.forEach(function(b){var c=p.get(b);c&&c.forEach(function(b){b.observer===a&&b.removeTransientObservers()})})}function f(a,b){for(var c=a;c;c=c.parentNode){var d=p.get(c);if(d)for(var e=0;e<d.length;e++){var f=d[e],g=f.options;if(c===a||g.subtree){var h=b(g);h&&f.enqueue(h)}}}}function g(a){this.callback_=a,this.nodes_=[],this.records_=[],this.uid_=++v}function h(a,b){this.type=a,this.target=b,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function i(a){var b=new h(a.type,a.target);return b.addedNodes=a.addedNodes.slice(),b.removedNodes=a.removedNodes.slice(),b.previousSibling=a.previousSibling,b.nextSibling=a.nextSibling,b.attributeName=a.attributeName,b.attributeNamespace=a.attributeNamespace,b.oldValue=a.oldValue,b}function j(a,b){return w=new h(a,b)}function k(a){return x?x:(x=i(w),x.oldValue=a,x)}function l(){w=x=void 0}function m(a){return a===x||a===w}function n(a,b){return a===b?a:x&&m(a)?x:null}function o(a,b,c){this.observer=a,this.target=b,this.options=c,this.transientObservedNodes=[]}var p=new WeakMap,q=window.msSetImmediate;if(!q){var r=[],s=String(Math.random());window.addEventListener("message",function(a){if(a.data===s){var b=r;r=[],b.forEach(function(a){a()})}}),q=function(a){r.push(a),window.postMessage(s,"*")}}var t=!1,u=[],v=0;g.prototype={observe:function(a,b){if(a=c(a),!b.childList&&!b.attributes&&!b.characterData||b.attributeOldValue&&!b.attributes||b.attributeFilter&&b.attributeFilter.length&&!b.attributes||b.characterDataOldValue&&!b.characterData)throw new SyntaxError;var d=p.get(a);d||p.set(a,d=[]);for(var e,f=0;f<d.length;f++)if(d[f].observer===this){e=d[f],e.removeListeners(),e.options=b;break}e||(e=new o(this,a,b),d.push(e),this.nodes_.push(a)),e.addListeners()},disconnect:function(){this.nodes_.forEach(function(a){for(var b=p.get(a),c=0;c<b.length;c++){var d=b[c];if(d.observer===this){d.removeListeners(),b.splice(c,1);break}}},this),this.records_=[]},takeRecords:function(){var a=this.records_;return this.records_=[],a}};var w,x;o.prototype={enqueue:function(a){var c=this.observer.records_,d=c.length;if(c.length>0){var e=c[d-1],f=n(e,a);if(f)return c[d-1]=f,void 0}else b(this.observer);c[d]=a},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(a){var b=this.options;b.attributes&&a.addEventListener("DOMAttrModified",this,!0),b.characterData&&a.addEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.addEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(a){var b=this.options;b.attributes&&a.removeEventListener("DOMAttrModified",this,!0),b.characterData&&a.removeEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.removeEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(a){if(a!==this.target){this.addListeners_(a),this.transientObservedNodes.push(a);var b=p.get(a);b||p.set(a,b=[]),b.push(this)}},removeTransientObservers:function(){var a=this.transientObservedNodes;this.transientObservedNodes=[],a.forEach(function(a){this.removeListeners_(a);for(var b=p.get(a),c=0;c<b.length;c++)if(b[c]===this){b.splice(c,1);break}},this)},handleEvent:function(a){switch(a.stopImmediatePropagation(),a.type){case"DOMAttrModified":var b=a.attrName,c=a.relatedNode.namespaceURI,d=a.target,e=new j("attributes",d);e.attributeName=b,e.attributeNamespace=c;var g=a.attrChange===MutationEvent.ADDITION?null:a.prevValue;f(d,function(a){return!a.attributes||a.attributeFilter&&a.attributeFilter.length&&-1===a.attributeFilter.indexOf(b)&&-1===a.attributeFilter.indexOf(c)?void 0:a.attributeOldValue?k(g):e});break;case"DOMCharacterDataModified":var d=a.target,e=j("characterData",d),g=a.prevValue;f(d,function(a){return a.characterData?a.characterDataOldValue?k(g):e:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(a.target);case"DOMNodeInserted":var h,i,d=a.relatedNode,m=a.target;"DOMNodeInserted"===a.type?(h=[m],i=[]):(h=[],i=[m]);var n=m.previousSibling,o=m.nextSibling,e=j("childList",d);e.addedNodes=h,e.removedNodes=i,e.previousSibling=n,e.nextSibling=o,f(d,function(a){return a.childList?e:void 0})}l()}},a.JsMutationObserver=g,!a.MutationObserver&&a.WebKitMutationObserver&&(a.MutationObserver=a.WebKitMutationObserver),a.MutationObserver||(a.MutationObserver=g)}(this),function(a){function b(b,f){var g=f||{};if(!b)throw new Error("document.register: first argument `name` must not be empty");if(b.indexOf("-")<0)throw new Error("document.register: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(b)+"'.");if(g.name=b,!g.prototype)throw new Error("Options missing required prototype property");return g.lifecycle=g.lifecycle||{},g.ancestry=c(g.extends),d(g),e(g),k(g.prototype),m(b,g),g.ctor=n(g),g.ctor.prototype=g.prototype,g.prototype.constructor=g.ctor,a.ready&&a.upgradeAll(document),g.ctor}function c(a){var b=v[a];return b?c(b.extends).concat([b]):[]}function d(a){for(var b,c=a.extends,d=0;b=a.ancestry[d];d++)c=b.is&&b.tag;a.tag=c||a.name,c&&(a.is=a.name)}function e(a){if(!Object.__proto__){var b=HTMLElement.prototype;if(a.is){var c=document.createElement(a.tag);b=Object.getPrototypeOf(c)}for(var d,e=a.prototype;e&&e!==b;){var d=Object.getPrototypeOf(e);e.__proto__=d,e=d}}a.native=b}function f(a){return g(w(a.tag),a)}function g(b,c){return c.is&&b.setAttribute("is",c.is),b.removeAttribute("unresolved"),h(b,c),b.__upgraded__=!0,a.upgradeSubtree(b),j(b),b}function h(a,b){Object.__proto__?a.__proto__=b.prototype:(i(a,b.prototype,b.native),a.__proto__=b.prototype)}function i(a,b,c){for(var d={},e=b;e!==c&&e!==HTMLUnknownElement.prototype;){for(var f,g=Object.getOwnPropertyNames(e),h=0;f=g[h];h++)d[f]||(Object.defineProperty(a,f,Object.getOwnPropertyDescriptor(e,f)),d[f]=1);e=Object.getPrototypeOf(e)}}function j(a){a.createdCallback&&a.createdCallback()}function k(a){if(!a.setAttribute._polyfilled){var b=a.setAttribute;a.setAttribute=function(a,c){l.call(this,a,c,b)};var c=a.removeAttribute;a.removeAttribute=function(a){l.call(this,a,null,c)},a.setAttribute._polyfilled=!0}}function l(a,b,c){var d=this.getAttribute(a);c.apply(this,arguments);var e=this.getAttribute(a);this.attributeChangedCallback&&e!==d&&this.attributeChangedCallback(a,d,e)}function m(a,b){v[a]=b}function n(a){return function(){return f(a)}}function o(a,b){var c=v[b||a];return c?new c.ctor:w(a)}function p(a){if(!a.__upgraded__&&a.nodeType===Node.ELEMENT_NODE){var b=a.getAttribute("is")||a.localName,c=v[b];return c&&g(a,c)}}function q(b){var c=x.call(this,b);return a.upgradeAll(c),c}a||(a=window.CustomElements={flags:{}});var r=a.flags,s=Boolean(document.register),t=!r.register&&s;if(t){var u=function(){};a.registry={},a.upgradeElement=u,a.watchShadow=u,a.upgrade=u,a.upgradeAll=u,a.upgradeSubtree=u,a.observeDocument=u,a.upgradeDocument=u,a.takeRecords=u}else{var v={},w=document.createElement.bind(document),x=Node.prototype.cloneNode;document.register=b,document.createElement=o,Node.prototype.cloneNode=q,a.registry=v,a.upgrade=p}a.hasNative=s,a.useNative=t}(window.CustomElements),function(a){function b(a,c,d){var e=a.firstElementChild;if(!e)for(e=a.firstChild;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;for(;e;)c(e,d)!==!0&&b(e,c,d),e=e.nextElementSibling;return null}function c(a,b){for(var c=a.shadowRoot;c;)d(c,b),c=c.olderShadowRoot}function d(a,d){b(a,function(a){return d(a)?!0:(c(a,d),void 0)}),c(a,d)}function e(a){return h(a)?(i(a),!0):(l(a),void 0)}function f(a){d(a,function(a){return e(a)?!0:void 0})}function g(a){return e(a)||f(a)}function h(b){if(!b.__upgraded__&&b.nodeType===Node.ELEMENT_NODE){var c=b.getAttribute("is")||b.localName,d=a.registry[c];if(d)return y.dom&&console.group("upgrade:",b.localName),a.upgrade(b),y.dom&&console.groupEnd(),!0}}function i(a){l(a),q(a)&&d(a,function(a){l(a)})}function j(a){if(B.push(a),!A){A=!0;var b=window.Platform&&window.Platform.endOfMicrotask||setTimeout;b(k)}}function k(){A=!1;for(var a,b=B,c=0,d=b.length;d>c&&(a=b[c]);c++)a();B=[]}function l(a){z?j(function(){m(a)}):m(a)}function m(a){(a.enteredViewCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.group("inserted:",a.localName),q(a)&&(a.__inserted=(a.__inserted||0)+1,a.__inserted<1&&(a.__inserted=1),a.__inserted>1?y.dom&&console.warn("inserted:",a.localName,"insert/remove count:",a.__inserted):a.enteredViewCallback&&(y.dom&&console.log("inserted:",a.localName),a.enteredViewCallback())),y.dom&&console.groupEnd())}function n(a){o(a),d(a,function(a){o(a)})}function o(a){z?j(function(){p(a)}):p(a)}function p(a){(a.leftViewCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.log("removed:",a.localName),q(a)||(a.__inserted=(a.__inserted||0)-1,a.__inserted>0&&(a.__inserted=0),a.__inserted<0?y.dom&&console.warn("removed:",a.localName,"insert/remove count:",a.__inserted):a.leftViewCallback&&a.leftViewCallback()))}function q(a){for(var b=a,c=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(document)||document;b;){if(b==c)return!0;b=b.parentNode||b.host}}function r(a){if(a.shadowRoot&&!a.shadowRoot.__watched){y.dom&&console.log("watching shadow-root for: ",a.localName);for(var b=a.shadowRoot;b;)s(b),b=b.olderShadowRoot}}function s(a){a.__watched||(v(a),a.__watched=!0)}function t(a){if(y.dom){var b=a[0];if(b&&"childList"===b.type&&b.addedNodes&&b.addedNodes){for(var c=b.addedNodes[0];c&&c!==document&&!c.host;)c=c.parentNode;var d=c&&(c.URL||c._URL||c.host&&c.host.localName)||"";d=d.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",a.length,d||"")}a.forEach(function(a){"childList"===a.type&&(D(a.addedNodes,function(a){a.localName&&g(a)}),D(a.removedNodes,function(a){a.localName&&n(a)}))}),y.dom&&console.groupEnd()}function u(){t(C.takeRecords()),k()}function v(a){C.observe(a,{childList:!0,subtree:!0})}function w(a){v(a)}function x(a){y.dom&&console.group("upgradeDocument: ",(a.URL||a._URL||"").split("/").pop()),g(a),y.dom&&console.groupEnd()}var y=window.logFlags||{},z=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;a.hasPolyfillMutations=z;var A=!1,B=[],C=new MutationObserver(t),D=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.watchShadow=r,a.upgradeAll=g,a.upgradeSubtree=f,a.observeDocument=w,a.upgradeDocument=x,a.takeRecords=u}(window.CustomElements),function(){function a(a){return"link"===a.localName&&a.getAttribute("rel")===b}var b=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",c={selectors:["link[rel="+b+"]"],map:{link:"parseLink"},parse:function(a){if(!a.__parsed){a.__parsed=!0;var b=a.querySelectorAll(c.selectors);d(b,function(a){c[c.map[a.localName]](a)}),CustomElements.upgradeDocument(a),CustomElements.observeDocument(a)}},parseLink:function(b){a(b)&&this.parseImport(b)},parseImport:function(a){a.content&&c.parse(a.content)}},d=Array.prototype.forEach.call.bind(Array.prototype.forEach);CustomElements.parser=c}(),function(a){function b(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document);var a=window.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;a(function(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.body.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a){var b=document.createEvent("HTMLEvents");return b.initEvent(a,!0,!0),b}),"complete"===document.readyState||a.flags.eager)b();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var c=window.HTMLImports?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(c,b)}else b()}(window.CustomElements),function(){function a(a){var b=K.call(a);return J[b]||(J[b]=b.match(L)[1].toLowerCase())}function b(c,d){var e=b[d||a(c)];return e?e(c):c}function c(b){return-1==M.indexOf(a(b))?Array.prototype.slice.call(b,0):[b]}function d(a,b){return(b||N).length?c(a.querySelectorAll(b)):[]}function e(a,b){var c={added:[],removed:[]};b.forEach(function(b){b._mutation=!0;for(var d in c)for(var e=a._records["added"==d?"inserted":"removed"],f=b[d+"Nodes"],g=f.length,h=0;g>h&&-1==c[d].indexOf(f[h]);h++)c[d].push(f[h]),e.forEach(function(a){a(f[h],b)})})}function f(c,d,e){var f=a(e);return"object"==f&&"object"==a(c[d])?S.merge(c[d],e):c[d]=b(e,f),c}function g(a,b,c,d,e){e[b]="function"!=typeof e[b]?d:S.wrap(e[b],S.applyPseudos(c,d,a.pseudos))}function h(a,b,c,d){if(d){var e={};for(var f in c)e[f.split(":")[0]]=f;for(f in b)g(a,e[f.split(":")[0]]||f,f,b[f],c)}else for(var h in b)g(a,h+":__mixin__("+O++ +")",h,b[h],c)}function i(a){return a.mixins.forEach(function(b){var c=S.mixins[b];for(var d in c){var e=c[d],f=a[d];if(f)switch(d){case"accessors":case"prototype":for(var g in e)f[g]?h(a,e[g],f[g],!0):f[g]=e[g];break;default:h(a,e,f,"events"!=d)}else a[d]=e}}),a}function j(a,b){var c,d=b.target;if(!d.tagName)return null;if(S.matchSelector(d,a.value))c=d;else if(S.matchSelector(d,a.value+" *"))for(var e=d.parentNode;!c;)S.matchSelector(e,a.value)&&(c=e),e=e.parentNode;return c?a.listener=a.listener.bind(c):null}function k(a){if(a.type.match("touch"))a.target.__touched__=!0;else if(a.target.__touched__&&a.type.match("mouse"))return delete a.target.__touched__,void 0;return!0}function l(a){var b="over"==a;return{attach:"OverflowEvent"in y?"overflowchanged":[],condition:function(c){return c.flow=a,c.type==a+"flow"||0===c.orient&&c.horizontalOverflow==b||1==c.orient&&c.verticalOverflow==b||2==c.orient&&c.horizontalOverflow==b&&c.verticalOverflow==b}}}function m(a,b,c,d){d?b[a]=c[a]:Object.defineProperty(b,a,{writable:!0,enumerable:!0,value:c[a]})}function n(a,b){var c=Object.getOwnPropertyDescriptor(a,"target");for(var d in b)P[d]||m(d,a,b,c);a.baseEvent=b}function o(a,b){return{value:a.boolean?"":b,method:a.boolean&&!b?"removeAttribute":"setAttribute"}}function p(a,b,c,d){var e=o(b,d);a[e.method](c,e.value)}function q(a,b,c,d,e){for(var f=b.property?[a.xtag[b.property]]:b.selector?S.query(a,b.selector):[],g=f.length;g--;)f[g][e](c,d)}function r(a,b,c){a.__view__&&a.__view__.updateBindingValue(a,b,c)}function s(a,b,c,d,e,f){var g=c.split(":"),h=g[0];if("get"==h)g[0]=b,a.prototype[b].get=S.applyPseudos(g.join(":"),d[c],a.pseudos);else if("set"==h){g[0]=b;var i=a.prototype[b].set=S.applyPseudos(g.join(":"),e?function(a){this.xtag._skipSet=!0,this.xtag._skipAttr||p(this,e,f,a),this.xtag._skipAttr&&e.skip&&delete this.xtag._skipAttr,d[c].call(this,e.boolean?!!a:a),r(this,f,a),delete this.xtag._skipSet}:d[c]?function(a){d[c].call(this,a),r(this,f,a)}:null,a.pseudos);e&&(e.setter=i)}else a.prototype[b][c]=d[c]}function t(a,b){a.prototype[b]={};var c=a.accessors[b],d=c.attribute,e=d&&d.name?d.name.toLowerCase():b;d&&(d.key=b,a.attributes[e]=d);for(var f in c)s(a,b,f,c,d,e);if(d){if(!a.prototype[b].get){var g=(d.boolean?"has":"get")+"Attribute";a.prototype[b].get=function(){return this[g](e)}}a.prototype[b].set||(a.prototype[b].set=function(a){p(this,d,e,a),r(this,e,a)})}}function u(a){R[a]=(R[a]||[]).filter(function(b){return(b.tags=b.tags.filter(function(b){return b!=a&&!S.tags[b]})).length||b.fn()})}function v(a,b,c){a.__tap__||(a.__tap__={click:"mousedown"==c.type},a.__tap__.click?a.addEventListener("click",b.observer):(a.__tap__.scroll=b.observer.bind(a),window.addEventListener("scroll",a.__tap__.scroll,!0),a.addEventListener("touchmove",b.observer),a.addEventListener("touchcancel",b.observer),a.addEventListener("touchend",b.observer))),a.__tap__.click||(a.__tap__.x=c.touches[0].pageX,a.__tap__.y=c.touches[0].pageY)}function w(a,b){a.__tap__&&(a.__tap__.click?a.removeEventListener("click",b.observer):(window.removeEventListener("scroll",a.__tap__.scroll,!0),a.removeEventListener("touchmove",b.observer),a.removeEventListener("touchcancel",b.observer),a.removeEventListener("touchend",b.observer)),delete a.__tap__)}function x(a,b,c){var d=c.changedTouches[0],e=b.gesture.tolerance;return d.pageX<a.__tap__.x+e&&d.pageX>a.__tap__.x-e&&d.pageY<a.__tap__.y+e&&d.pageY>a.__tap__.y-e?!0:void 0}var y=window,z=document,A=function(){},B=function(){return!0},C=/([\w-]+(?:\([^\)]+\))?)/g,D=/(\w*)(?:\(([^\)]*)\))?/,E=/(\d+)/g,F={action:function(a,b){return a.value.match(E).indexOf(String(b.keyCode))>-1==("keypass"==a.name)||null}},G=function(){var a=y.getComputedStyle(z.documentElement,""),b=(Array.prototype.slice.call(a).join("").match(/-(moz|webkit|ms)-/)||""===a.OLink&&["","o"])[1];return{dom:"ms"==b?"MS":b,lowercase:b,css:"-"+b+"-",js:"ms"==b?b:b[0].toUpperCase()+b.substr(1)}}(),H=Element.prototype.matchesSelector||Element.prototype[G.lowercase+"MatchesSelector"],I=y.MutationObserver||y[G.js+"MutationObserver"],J={},K=J.toString,L=/\s([a-zA-Z]+)/;b.object=function(a){var c={};for(var d in a)c[d]=b(a[d]);return c},b.array=function(a){for(var c=a.length,d=new Array(c);c--;)d[c]=b(a[c]);return d};var M=["undefined","null","number","boolean","string","function"],N="",O=0,P={};for(var Q in document.createEvent("CustomEvent"))P[Q]=1;var R={},S={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__?this.__xtag__:this.__xtag__={data:{}}}}}},register:function(a,b){var d;if("string"==typeof a){d=a.toLowerCase();var e=b.prototype;delete b.prototype;var f=S.tags[d]=i(S.merge({},S.defaultOptions,b));for(var g in f.events)f.events[g]=S.parseEvent(g,f.events[g]);for(g in f.lifecycle)f.lifecycle[g.split(":")[0]]=S.applyPseudos(g,f.lifecycle[g],f.pseudos);for(g in f.methods)f.prototype[g.split(":")[0]]={value:S.applyPseudos(g,f.methods[g],f.pseudos),enumerable:!0};for(g in f.accessors)t(f,g);var h=f.lifecycle.created||f.lifecycle.ready;f.prototype.createdCallback={enumerable:!0,value:function(){var a=this;S.addEvents(this,f.events),f.mixins.forEach(function(b){S.mixins[b].events&&S.addEvents(a,S.mixins[b].events)});var b=h?h.apply(this,c(arguments)):null;for(var d in f.attributes){var e=f.attributes[d],g=this.hasAttribute(d);(g||e.boolean)&&(this[e.key]=e.boolean?g:this.getAttribute(d))}return f.pseudos.forEach(function(b){b.onAdd.call(a,b)}),b}},f.lifecycle.inserted&&(f.prototype.enteredViewCallback={value:f.lifecycle.inserted,enumerable:!0}),f.lifecycle.removed&&(f.prototype.leftViewCallback={value:f.lifecycle.removed,enumerable:!0}),f.lifecycle.attributeChanged&&(f.prototype.attributeChangedCallback={value:f.lifecycle.attributeChanged,enumerable:!0});var j=f.prototype.setAttribute||HTMLElement.prototype.setAttribute;f.prototype.setAttribute={writable:!0,enumberable:!0,value:function(a,b){var c=f.attributes[a.toLowerCase()];this.xtag._skipAttr||j.call(this,a,c&&c.boolean?"":b),c&&(c.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,c.setter.call(this,c.boolean?!0:b)),b=c.skip?c.boolean?this.hasAttribute(a):this.getAttribute(a):b,q(this,c,a,c.boolean?"":b,"setAttribute")),delete this.xtag._skipAttr}};var k=f.prototype.removeAttribute||HTMLElement.prototype.removeAttribute;f.prototype.removeAttribute={writable:!0,enumberable:!0,value:function(a){var b=f.attributes[a.toLowerCase()];this.xtag._skipAttr||k.call(this,a),b&&(b.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,b.setter.call(this,b.boolean?!1:void 0)),q(this,b,a,void 0,"removeAttribute")),delete this.xtag._skipAttr}};var l=e?e:b["extends"]?Object.create(z.createElement(b["extends"]).constructor).prototype:y.HTMLElement.prototype,m={prototype:Object.create(l,f.prototype)};b["extends"]&&(m["extends"]=b["extends"]);var n=z.register(d,m);return u(d),n}},ready:function(a,b){var d={tags:c(a),fn:b};d.tags.reduce(function(a,b){return S.tags[b]?a:((R[b]=R[b]||[]).push(d),void 0)},!0)&&b()},mixins:{},prefix:G,captureEvents:["focus","blur","scroll","underflow","overflow","overflowchanged","DOMMouseScroll"],customEvents:{overflow:l("over"),underflow:l("under"),animationstart:{attach:[G.dom+"AnimationStart"]},animationend:{attach:[G.dom+"AnimationEnd"]},transitionend:{attach:[G.dom+"TransitionEnd"]},move:{attach:["mousemove","touchmove"],condition:k},enter:{attach:["mouseover","touchenter"],condition:k},leave:{attach:["mouseout","touchleave"],condition:k},scrollwheel:{attach:["DOMMouseScroll","mousewheel"],condition:function(a){return a.delta=a.wheelDelta?a.wheelDelta/40:Math.round(-1*(a.detail/3.5)),!0}},tapstart:{observe:{mousedown:z,touchstart:z},condition:k},tapend:{observe:{mouseup:z,touchend:z},condition:k},tapmove:{attach:["tapstart","dragend","touchcancel"],condition:function(a,b){switch(a.type){case"move":return!0;case"dragover":var c=b.lastDrag||{};return b.lastDrag=a,c.pageX!=a.pageX&&c.pageY!=a.pageY||null;case"tapstart":b.move||(b.current=this,b.move=S.addEvents(this,{move:b.listener,dragover:b.listener}),b.tapend=S.addEvent(z,"tapend",b.listener));break;case"tapend":case"dragend":case"touchcancel":a.touches.length||(b.move&&S.removeEvents(b.current,b.move||{}),b.tapend&&S.removeEvent(z,b.tapend||{}),delete b.lastDrag,delete b.current,delete b.tapend,delete b.move)}}}},pseudos:{__mixin__:{},keypass:F,keyfail:F,delegate:{action:j},within:{action:j,onAdd:function(a){var b=a.source.condition;b&&(a.source.condition=function(c,d){return S.query(this,a.value).filter(function(a){return a==c.target||a.contains?a.contains(c.target):null})[0]?b.call(this,c,d):null})}},preventable:{action:function(a,b){return!b.defaultPrevented}}},clone:b,typeOf:a,toArray:c,wrap:function(a,b){return function(){var d=c(arguments),e=a.apply(this,d);return b.apply(this,d),e}},merge:function(b,c,d){if("string"==a(c))return f(b,c,d);for(var e=1,g=arguments.length;g>e;e++){var h=arguments[e];for(var i in h)f(b,i,h[i])}return b},uid:function(){return Math.random().toString(36).substr(2,10)},query:d,skipTransition:function(a,b){var c=G.js+"TransitionProperty";a.style[c]=a.style.transitionProperty="none";var d=b();return S.requestFrame(function(){S.requestFrame(function(){a.style[c]=a.style.transitionProperty="",d&&S.requestFrame(d)})})},requestFrame:function(){var a=y.requestAnimationFrame||y[G.lowercase+"RequestAnimationFrame"]||function(a){return y.setTimeout(a,20)};return function(b){return a(b)}}(),cancelFrame:function(){var a=y.cancelAnimationFrame||y[G.lowercase+"CancelAnimationFrame"]||y.clearTimeout;return function(b){return a(b)}}(),matchSelector:function(a,b){return H.call(a,b)},set:function(a,b,c){a[b]=c,window.CustomElements&&CustomElements.upgradeAll(a)},innerHTML:function(a,b){S.set(a,"innerHTML",b)},hasClass:function(a,b){return a.className.split(" ").indexOf(b.trim())>-1},addClass:function(a,b){var c=a.className.trim().split(" ");return b.trim().split(" ").forEach(function(a){~c.indexOf(a)||c.push(a)}),a.className=c.join(" ").trim(),a},removeClass:function(a,b){var c=b.trim().split(" ");return a.className=a.className.trim().split(" ").filter(function(a){return a&&!~c.indexOf(a)}).join(" "),a},toggleClass:function(a,b){return S[S.hasClass(a,b)?"removeClass":"addClass"].call(null,a,b)},queryChildren:function(a,b){var d=a.id,e=a.id=d||"x_"+S.uid(),f="#"+e+" > ";b=f+(b+"").replace(",",","+f,"g");var g=a.parentNode.querySelectorAll(b);return d||a.removeAttribute("id"),c(g)},createFragment:function(a){var b=z.createDocumentFragment();if(a){for(var d=b.appendChild(z.createElement("div")),e=c(a.nodeName?arguments:!(d.innerHTML=a)||d.children),f=e.length,g=0;f>g;)b.insertBefore(e[g++],d);b.removeChild(d)}return b},manipulate:function(a,b){var c=a.nextSibling,d=a.parentNode,e=z.createDocumentFragment(),f=b.call(e.appendChild(a),e)||a;c?d.insertBefore(f,c):d.appendChild(f)},applyPseudos:function(a,b,d,e){var f=b,g={};if(a.match(":"))for(var h=a.match(C),i=h.length;--i;)h[i].replace(D,function(b,j,k){if(!S.pseudos[j])throw"pseudo not found: "+j+" "+h;var l=g[i]=Object.create(S.pseudos[j]);l.key=a,l.name=j,l.value=k,l.arguments=(k||"").split(","),l.action=l.action||B,l.source=e;var m=f;f=function(){var b=c(arguments),d={key:a,name:j,value:k,source:e,arguments:l.arguments,listener:m},f=l.action.apply(this,[d].concat(b));return null===f||f===!1?f:d.listener.apply(this,b)},d&&l.onAdd&&(d.nodeName?l.onAdd.call(d,l):d.push(l))});for(var j in g)g[j].onCompiled&&(f=g[j].onCompiled(f,g[j])||f);return f},removePseudos:function(a,b){b.forEach(function(b){b.onRemove&&b.onRemove.call(a,b)})},parseEvent:function(a,b){var d=a.split(":"),e=d.shift(),f=S.customEvents[e],g=S.merge({type:e,stack:A,condition:B,attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:A,onRemove:A},f||{});g.attach=c(g.base||g.attach),g.chain=e+(g.pseudos.length?":"+g.pseudos:"")+(d.length?":"+d.join(":"):"");var h=g.condition;g.condition=function(a){return a.touches,a.targetTouches,h.apply(this,c(arguments))};var i=S.applyPseudos(g.chain,b,g._pseudos,g);if(g.stack=function(a){a.touches,a.targetTouches;var b=a.detail||{};return b.__stack__?b.__stack__==i?(a.stopPropagation(),a.cancelBubble=!0,i.apply(this,c(arguments))):void 0:i.apply(this,c(arguments))},g.listener=function(a){var b=c(arguments),d=g.condition.apply(this,b.concat([g]));return d?a.type==e?g.stack.apply(this,b):(S.fireEvent(a.target,e,{baseEvent:a,detail:d!==!0&&(d.__stack__=i)?d:{__stack__:i}}),void 0):d},g.attach.forEach(function(a){g._attach.push(S.parseEvent(a,g.listener))}),f&&f.observe&&!f.__observing__){f.observer=function(a){var b=g.condition.apply(this,c(arguments).concat([f]));return b?(S.fireEvent(a.target,e,{baseEvent:a,detail:b!==!0?b:{}}),void 0):b};for(var j in f.observe)S.addEvent(f.observe[j]||document,j,f.observer,!0);f.__observing__=!0}return g},addEvent:function(a,b,c,d){var e="function"==typeof c?S.parseEvent(b,c):c;return e._pseudos.forEach(function(b){b.onAdd.call(a,b)}),e._attach.forEach(function(b){S.addEvent(a,b.type,b)}),e.onAdd.call(a,e,e.listener),a.addEventListener(e.type,e.stack,d||S.captureEvents.indexOf(e.type)>-1),e},addEvents:function(a,b){var c={};for(var d in b)c[d]=S.addEvent(a,d,b[d]);return c},removeEvent:function(a,b,c){c=c||b,c.onRemove.call(a,c,c.listener),S.removePseudos(a,c._pseudos),c._attach.forEach(function(b){S.removeEvent(a,b)}),a.removeEventListener(c.type,c.stack)},removeEvents:function(a,b){for(var c in b)S.removeEvent(a,b[c])},fireEvent:function(a,b,c,d){var e=z.createEvent("CustomEvent");c=c||{},d&&console.warn("fireEvent has been modified"),e.initCustomEvent(b,c.bubbles!==!1,c.cancelable!==!1,c.detail),c.baseEvent&&n(e,c.baseEvent);try{a.dispatchEvent(e)}catch(f){console.warn("This error may have been caused by a change in the fireEvent method",f)}},addObserver:function(a,b,c){a._records||(a._records={inserted:[],removed:[]},I?(a._observer=new I(function(b){e(a,b)}),a._observer.observe(a,{subtree:!0,childList:!0,attributes:!1,characterData:!1})):["Inserted","Removed"].forEach(function(b){a.addEventListener("DOMNode"+b,function(c){c._mutation=!0,a._records[b.toLowerCase()].forEach(function(a){a(c.target,c)})},!1)})),-1==a._records[b].indexOf(c)&&a._records[b].push(c)},removeObserver:function(a,b,c){var d=a._records;d&&c?d[b].splice(d[b].indexOf(c),1):d[b]=[]}},T=!1,U=null;z.addEventListener("mousedown",function(a){T=!0,U=a.target},!0),z.addEventListener("mouseup",function(){T=!1,U=null},!0),z.addEventListener("dragend",function(){T=!1,U=null},!0);var V={touches:{configurable:!0,get:function(){return this.__touches__||(this.identifier=0)||(this.__touches__=T?[this]:[])}},targetTouches:{configurable:!0,get:function(){return this.__targetTouches__||(this.__targetTouches__=T&&this.currentTarget&&(this.currentTarget==U||this.currentTarget.contains&&this.currentTarget.contains(U))?(this.identifier=0)||[this]:[])}},changedTouches:{configurable:!0,get:function(){return this.__changedTouches__||(this.identifier=0)||(this.__changedTouches__=[this])}}};for(Q in V)UIEvent.prototype[Q]=V[Q],Object.defineProperty(UIEvent.prototype,Q,V[Q]);S.customEvents.tap={observe:{mousedown:document,touchstart:document},gesture:{tolerance:8},condition:function(a,b){var c=a.target;switch(a.type){case"touchstart":return c.__tap__&&c.__tap__.click&&w(c,b),v(c,b,a),void 0;case"mousedown":return c.__tap__||v(c,b,a),void 0;case"scroll":case"touchcancel":return w(this,b),void 0;case"touchmove":case"touchend":return this.__tap__&&!x(this,b,a)?(w(this,b),void 0):"touchend"==a.type||null;case"click":return w(this,b),!0}}},y.xtag=S,"function"==typeof define&&define.amd&&define(S),z.addEventListener("WebComponentsReady",function(){S.fireEvent(z.body,"DOMComponentsLoaded")})}(),function(){xtag.register("x-appbar",{lifecycle:{created:function(){var a=xtag.queryChildren(this,"header")[0];a||(a=document.createElement("header"),this.appendChild(a)),this.xtag.data.header=a,this.subheading=this.subheading}},accessors:{heading:{attribute:{},get:function(){return this.xtag.data.header.innerHTML},set:function(a){this.xtag.data.header.innerHTML=a}},subheading:{attribute:{},get:function(){return this.getAttribute("subheading")||""},set:function(a){this.xtag.data.header.setAttribute("subheading",a)}}}})}(),function(){function a(a){var b=new Date(a.valueOf());return b.setHours(0),b.setMinutes(0),b.setSeconds(0),b.setMilliseconds(0),b}function b(a,b){a.appendChild(b)}function c(a){return parseInt(a,10)}function d(a){var b=c(a);return b===a&&!isNaN(b)&&b>=0&&6>=b}function e(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function f(a){return a&&a.isArray?a.isArray():"[object Array]"===Object.prototype.toString.call(a)}function g(a){var b=a.split("."),c=b.shift(),d=document.createElement(c);return d[W]=b.join(" "),d}function h(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function i(a){var b=a.getBoundingClientRect(),c=h(),d=c.left,e=c.top;return{left:b.left+d,right:b.right+d,top:b.top+e,bottom:b.bottom+e,width:b.width,height:b.height}}function j(a,b){xtag.addClass(a,b)}function k(a,b){xtag.removeClass(a,b)}function l(a,b){return xtag.hasClass(a,b)}function m(a){return a.getFullYear()}function n(a){return a.getMonth() +}function o(a){return a.getDate()}function p(a){return a.getDay()}function q(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function r(a){return[q(m(a),4),q(n(a)+1,2),q(o(a),2)].join("-")}function s(b){if(e(b))return b;var c=X.exec(b);return c?a(new Date(c[1],c[2]-1,c[3])):null}function t(b){if(e(b))return b;var c=s(b);if(c)return c;var d=Date.parse(b);return isNaN(d)?null:a(new Date(d))}function u(a){var b;if(f(a))b=a.slice(0);else{if(e(a))return[a];if(!("string"==typeof a&&a.length>0))return null;try{if(b=JSON.parse(a),!f(b))return null}catch(c){var d=t(a);return d?[d]:null}}for(var g=0;g<b.length;g++){var h=b[g];if(!e(h))if("string"==typeof h){var i=t(h);if(!i)return null;b[g]=i}else{if(!f(h)||2!==h.length)return null;var j=t(h[0]);if(!j)return null;var k=t(h[1]);if(!k)return null;if(j.valueOf()>k.valueOf())return null;b[g]=[j,k]}}return b}function v(b,c,d,e){return void 0===c&&(c=m(b)),void 0===d&&(d=n(b)),void 0===e&&(e=o(b)),a(new Date(c,d,e))}function w(a,b){return b||(b=(new Date).getFullYear()),new Date(b,a+1,0).getDate()}function x(a,b,c,d){return v(a,m(a)+b,n(a)+c,o(a)+d)}function y(a){var b=a.getDate(),c=w(a.getMonth()+1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()+1,b)}function z(a){var b=a.getDate(),c=w(a.getMonth()-1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()-1,b)}function A(a,b){b=c(b),d(b)||(b=0);for(var e=0;7>e;e++){if(p(a)===b)return a;a=F(a)}throw"unable to find week start"}function B(a,b){b=c(b),d(b)||(b=6);for(var e=0;7>e;e++){if(p(a)===b)return a;a=E(a)}throw"unable to find week end"}function C(b){return b=new Date(b.valueOf()),b.setDate(1),a(b)}function D(a){return F(x(a,0,1,0))}function E(a){return x(a,0,0,1)}function F(a){return x(a,0,0,-1)}function G(a,b){if(b){b=void 0===b.length?[b]:b;var c=!1;return b.forEach(function(b){2===b.length?H(b[0],b[1],a)&&(c=!0):r(b)===r(a)&&(c=!0)}),c}}function H(a,b,c){return r(a)<=r(c)&&r(c)<=r(b)}function I(a){a.sort(function(a,b){var c=e(a)?a:a[0],d=e(b)?b:b[0];return c.valueOf()-d.valueOf()})}function J(a){var c=g("div.controls"),d=g("span.prev"),e=g("span.next");return d.innerHTML=a.prev,e.innerHTML=a.next,b(c,d),b(c,e),c}function K(a){var b=this;a=a||{},b._span=a.span||1,b._multiple=a.multiple||!1,b._viewDate=b._sanitizeViewDate(a.view,a.chosen),b._chosenRanges=b._sanitizeChosenRanges(a.chosen,a.view),b._firstWeekdayNum=a.firstWeekdayNum||0,b._el=g("div.calendar"),b._labels=R(),b._customRenderFn=null,b._renderRecursionFlag=!1,b.render(!0)}function L(a){a=a.slice(0),I(a);for(var b=[],c=0;c<a.length;c++){var d,f,g,h,i=a[c],j=b.length>0?b[b.length-1]:null;if(e(i)?d=f=i:(d=i[0],f=i[1]),i=G(d,f)?d:[d,f],e(j))g=h=j;else{if(!j){b.push(i);continue}g=j[0],h=j[1]}if(G(d,[j])||G(F(d),[j])){var k=g.valueOf()<d.valueOf()?g:d,l=h.valueOf()>f.valueOf()?h:f,m=G(k,l)?k:[k,l];b[b.length-1]=m}else b.push(i)}return b}function M(a,b){var c,d=b.getAttribute("data-date"),e=t(d);l(b,V)?(a.xtag.dragType=U,c="datetoggleoff"):(a.xtag.dragType=T,c="datetoggleon"),a.xtag.dragStartEl=b,a.xtag.dragAllowTap=!0,a.noToggle||xtag.fireEvent(a,c,{detail:{date:e,iso:d}}),a.setAttribute("active",!0),b.setAttribute("active",!0)}function N(a,b){var c=b.getAttribute("data-date"),d=t(c);b!==a.xtag.dragStartEl&&(a.xtag.dragAllowTap=!1),a.noToggle||(a.xtag.dragType!==T||l(b,V)?a.xtag.dragType===U&&l(b,V)&&xtag.fireEvent(a,"datetoggleoff",{detail:{date:d,iso:c}}):xtag.fireEvent(a,"datetoggleon",{detail:{date:d,iso:c}})),a.xtag.dragType&&b.setAttribute("active",!0)}function O(){for(var a=xtag.query(document,"x-calendar"),b=0;b<a.length;b++){var c=a[b];c.xtag.dragType=null,c.xtag.dragStartEl=null,c.xtag.dragAllowTap=!1,c.removeAttribute("active")}for(var d=xtag.query(document,"x-calendar .day[active]"),e=0;e<d.length;e++)d[e].removeAttribute("active")}function P(a,b,c){return c.left<=a&&a<=c.right&&c.top<=b&&b<=c.bottom}var Q=0,R=function(){return{prev:"←",next:"→",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}},S=a(new Date),T="add",U="remove",V="chosen",W="className",X=/(\d{4})[^\d]?(\d{2})[^\d]?(\d{2})/,Y=K.prototype;Y.makeMonth=function(a){if(!e(a))throw"Invalid view date!";var c=this.firstWeekdayNum,d=this.chosen,f=this.labels,h=n(a),i=A(C(a),c),k=g("div.month"),l=g("div.month-label");l.textContent=f.months[h]+" "+m(a),b(k,l);for(var p=g("div.weekday-labels"),q=0;7>q;q++){var s=(c+q)%7,t=g("span.weekday-label");t.textContent=f.weekdays[s],b(p,t)}b(k,p);var u=g("div.week"),v=i,w=42;for(q=0;w>q;q++){var x=g("span.day");if(x.setAttribute("data-date",r(v)),x.textContent=o(v),n(v)!==h&&j(x,"badmonth"),G(v,d)&&j(x,V),G(v,S)&&j(x,"today"),b(u,x),v=E(v),0===(q+1)%7){b(k,u),u=g("div.week");var y=n(v)>h||n(v)<h&&m(v)>m(i);if(y)break}}return k},Y._sanitizeViewDate=function(a,b){b=void 0===b?this.chosen:b;var c;if(e(a))c=a;else if(e(b))c=b;else if(f(b)&&b.length>0){var d=b[0];c=e(d)?d:d[0]}else c=S;return c},Y._sanitizeChosenRanges=function(a,b){b=void 0===b?this.view:b;var c;c=e(a)?[a]:f(a)?a:null!==a&&void 0!==a&&b?[b]:[];var d=L(c);if(!this.multiple&&d.length>0){var g=d[0];return e(g)?[g]:[g[0]]}return d},Y.addDate=function(a,b){e(a)&&(b?(this.chosen.push(a),this.chosen=this.chosen):this.chosen=[a])},Y.removeDate=function(a){if(e(a))for(var b=this.chosen.slice(0),c=0;c<b.length;c++){var d=b[c];if(G(a,[d])){if(b.splice(c,1),f(d)){var g=d[0],h=d[1],i=F(a),j=E(a);G(i,[d])&&b.push([g,i]),G(j,[d])&&b.push([j,h])}this.chosen=L(b);break}}},Y.hasChosenDate=function(a){return G(a,this._chosenRanges)},Y.hasVisibleDate=function(a,b){var c=b?this.firstVisibleMonth:this.firstVisibleDate,d=b?D(this.lastVisibleMonth):this.lastVisibleDate;return G(a,[[c,d]])},Y.render=function(a){var c,d=this._span;if(a){var e,f=xtag.query(this.el,".day");for(c=0;c<f.length;c++)if(e=f[c],e.hasAttribute("data-date")){var g=e.getAttribute("data-date"),h=s(g);h&&(G(h,this._chosenRanges)?j(e,V):k(e,V),G(h,[S])?j(e,"today"):k(e,"today"))}}else{this.el.innerHTML="";var i=this.firstVisibleMonth;for(c=0;d>c;c++)b(this.el,this.makeMonth(i)),i=x(i,0,1,0)}this._callCustomRenderer()},Y._callCustomRenderer=function(){if(this._customRenderFn){if(this._renderRecursionFlag)throw"Error: customRenderFn causes recursive loop of rendering calendar; make sure your custom rendering function doesn't modify attributes of the x-calendar that would require a re-render!";for(var a=xtag.query(this.el,".day"),b=0;b<a.length;b++){var c=a[b],d=c.getAttribute("data-date"),e=s(d);this._renderRecursionFlag=!0,this._customRenderFn(c,e?e:null,d),this._renderRecursionFlag=!1}}},Object.defineProperties(Y,{el:{get:function(){return this._el}},multiple:{get:function(){return this._multiple},set:function(a){this._multiple=a,this.chosen=this._sanitizeChosenRanges(this.chosen),this.render(!0)}},span:{get:function(){return this._span},set:function(a){var b=c(a);this._span=!isNaN(b)&&b>=0?b:0,this.render(!1)}},view:{attribute:{},get:function(){return this._viewDate},set:function(a){var b=this._sanitizeViewDate(a),c=this._viewDate;this._viewDate=b,this.render(n(c)===n(b)&&m(c)===m(b))}},chosen:{get:function(){return this._chosenRanges},set:function(a){this._chosenRanges=this._sanitizeChosenRanges(a),this.render(!0)}},firstWeekdayNum:{get:function(){return this._firstWeekdayNum},set:function(a){a=c(a),d(a)||(a=0),this._firstWeekdayNum=a,this.render(!1)}},lastWeekdayNum:{get:function(){return(this._firstWeekdayNum+6)%7}},customRenderFn:{get:function(){return this._customRenderFn},set:function(a){this._customRenderFn=a,this.render(!0)}},chosenString:{get:function(){if(this.multiple){for(var a=this.chosen.slice(0),b=0;b<a.length;b++){var c=a[b];a[b]=e(c)?r(c):[r(c[0]),r(c[1])]}return JSON.stringify(a)}return this.chosen.length>0?r(this.chosen[0]):""}},firstVisibleMonth:{get:function(){return C(this.view)}},lastVisibleMonth:{get:function(){return x(this.firstVisibleMonth,0,Math.max(0,this.span-1),0)}},firstVisibleDate:{get:function(){return A(this.firstVisibleMonth,this.firstWeekdayNum)}},lastVisibleDate:{get:function(){return B(D(this.lastVisibleMonth),this.lastWeekdayNum)}},labels:{get:function(){return this._labels},set:function(a){var b=this.labels;for(var c in b)if(c in a){var d=this._labels[c],e=a[c];if(f(d)){if(!f(e)||d.length!==e.length)throw"invalid label given for '"+c+"': expected array of "+d.length+" labels, got "+JSON.stringify(e);e=e.slice(0);for(var g=0;g<e.length;g++)e[g]=e[g].toString?e[g].toString():String(e[g])}else e=String(e);b[c]=e}this.render(!1)}}});var Z=null,$=null;xtag.register("x-calendar",{lifecycle:{created:function(){this.innerHTML="";var a=this.getAttribute("chosen");this.xtag.calObj=new K({span:this.getAttribute("span"),view:t(this.getAttribute("view")),chosen:u(a),multiple:this.hasAttribute("multiple"),firstWeekdayNum:this.getAttribute("first-weekday-num")}),b(this,this.xtag.calObj.el),this.xtag.calControls=null,this.xtag.dragType=null,this.xtag.dragStartEl=null,this.xtag.dragAllowTap=!1},inserted:function(){Z||(Z=xtag.addEvent(document,"mouseup",O)),$||($=xtag.addEvent(document,"touchend",O)),this.render(!1)},removed:function(){0===xtag.query(document,"x-calendar").length&&(Z&&(xtag.removeEvent(document,"mouseup",Z),Z=null),$&&(xtag.removeEvent(document,"touchend",$),$=null))}},events:{"tap:delegate(.next)":function(a){var b=a.currentTarget;b.nextMonth(),xtag.fireEvent(b,"nextmonth")},"tap:delegate(.prev)":function(a){var b=a.currentTarget;b.prevMonth(),xtag.fireEvent(b,"prevmonth")},"tapstart:delegate(.day)":function(a){(a.touches||!a.button||a.button===Q)&&(a.preventDefault(),a.baseEvent&&a.baseEvent.preventDefault(),M(a.currentTarget,this))},touchmove:function(a){if(a.touches&&a.touches.length>0){var b=a.currentTarget;if(b.xtag.dragType)for(var c=a.touches[0],d=xtag.query(b,".day"),e=0;e<d.length;e++){var f=d[e];P(c.pageX,c.pageY,i(f))?N(b,f):f.removeAttribute("active")}}},"mouseover:delegate(.day)":function(a){var b=a.currentTarget,c=this;N(b,c)},"mouseout:delegate(.day)":function(){var a=this;a.removeAttribute("active")},"tapend:delegate(.day)":function(a){var b=a.currentTarget;if(b.xtag.dragAllowTap){var c=this,d=c.getAttribute("data-date"),e=t(d);xtag.fireEvent(b,"datetap",{detail:{date:e,iso:d}})}},datetoggleon:function(a){var b=this;b.toggleDateOn(a.detail.date,b.multiple)},datetoggleoff:function(a){var b=this;b.toggleDateOff(a.detail.date)}},accessors:{controls:{attribute:{"boolean":!0},set:function(a){a&&!this.xtag.calControls&&(this.xtag.calControls=J(this.xtag.calObj.labels),b(this,this.xtag.calControls))}},multiple:{attribute:{"boolean":!0},get:function(){return this.xtag.calObj.multiple},set:function(a){this.xtag.calObj.multiple=a,this.chosen=this.chosen}},span:{attribute:{},get:function(){return this.xtag.calObj.span},set:function(a){this.xtag.calObj.span=a}},view:{attribute:{},get:function(){return this.xtag.calObj.view},set:function(a){var b=t(a);b&&(this.xtag.calObj.view=b)}},chosen:{attribute:{skip:!0},get:function(){var a=this.xtag.calObj.chosen;if(this.multiple)return this.xtag.calObj.chosen;if(a.length>0){var b=a[0];return e(b)?b:b[0]}return null},set:function(a){var b=this.multiple?u(a):t(a);this.xtag.calObj.chosen=b?b:null,this.xtag.calObj.chosenString?this.setAttribute("chosen",this.xtag.calObj.chosenString):this.removeAttribute("chosen")}},firstWeekdayNum:{attribute:{name:"first-weekday-num"},set:function(a){this.xtag.calObj.firstWeekdayNum=a}},noToggle:{attribute:{"boolean":!0,name:"notoggle"},set:function(a){a&&(this.chosen=null)}},firstVisibleMonth:{get:function(){return this.xtag.calObj.firstVisibleMonth}},lastVisibleMonth:{get:function(){return this.xtag.calObj.lastVisibleMonth}},firstVisibleDate:{get:function(){return this.xtag.calObj.firstVisibleDate}},lastVisibleDate:{get:function(){return this.xtag.calObj.lastVisibleDate}},customRenderFn:{get:function(){return this.xtag.calObj.customRenderFn},set:function(a){this.xtag.calObj.customRenderFn=a}},labels:{get:function(){return JSON.parse(JSON.stringify(this.xtag.calObj.labels))},set:function(a){this.xtag.calObj.labels=a;var b=this.xtag.calObj.labels,c=this.querySelector(".controls > .prev");c&&(c.textContent=b.prev);var d=this.querySelector(".controls > .next");d&&(d.textContent=b.next)}}},methods:{render:function(a){this.xtag.calObj.render(a)},prevMonth:function(){var a=this.xtag.calObj;a.view=z(a.view)},nextMonth:function(){var a=this.xtag.calObj;a.view=y(a.view)},toggleDateOn:function(a,b){this.xtag.calObj.addDate(a,b),this.chosen=this.chosen},toggleDateOff:function(a){this.xtag.calObj.removeDate(a),this.chosen=this.chosen},toggleDate:function(a,b){this.xtag.calObj.hasChosenDate(a)?this.toggleDateOff(a):this.toggleDateOn(a,b)},hasVisibleDate:function(a,b){return this.xtag.calObj.hasVisibleDate(a,b)}}})}(),function(){function a(a){return a.__transitions__=a.__transitions__||{},a.__transitions__}function b(a,b,d){var e=getComputedStyle(a),f=d[b].after;a.setAttribute("transition",b),f&&!e[g].match(c)&&f()}var c=/[1-9]/,d=/ /g,e=/(\d|\d+?[.]?\d+?)(s|ms)(?!\w)/gi,f="transition"in getComputedStyle(document.documentElement)?"t":xtag.prefix.js+"T",g=f+"ransitionDuration",h=f+"ransitionProperty",i=function(a){xtag.requestFrame(function(){xtag.requestFrame(a)})},j="complete"==document.readyState?i(function(){j=!1}):xtag.addEvent(document,"readystatechange",function(){"complete"==document.readyState&&(i(function(){j=!1}),xtag.removeEvent(document,"readystatechange",j))});xtag.addEvents(document,{transitionend:function(b){var c=b.target,f=c.getAttribute("transition");if(f){var i=0,j=0,k=null,l=getComputedStyle(c),m=a(c),n=l[h].replace(d,"").split(",");if(l[g].replace(e,function(a,b,c){b=parseFloat(b)*("s"===c?1e3:1),b>j&&(k=i,j=b),i++}),k=n[k],!k)throw new SyntaxError("No matching transition property found");b.propertyName==k&&m[f].after&&m[f].after()}}}),xtag.transition=function(c,d,e){var f=a(c),g=f[d]=e||{};g.immediate&&g.immediate(),g.before?(g.before(),j?xtag.skipTransition(c,function(){b(c,d,f)}):i(function(){b(c,d,f)})):b(c,d,f)},xtag.pseudos.transition={onCompiled:function(a,b){var c={},d=b.arguments[0]||"immediate",e=b.arguments[1]||b.key.split(":")[0];return function(){var b=this,f=arguments;return this.hasAttribute("transition")?(c[d]=function(){return a.apply(b,f)},xtag.transition(this,e,c),void 0):a.apply(this,f)}}}}(),function(){function a(a,b){return Array.prototype.indexOf.call(a.children,b)}function b(a,b){return b&&b.nodeName?b:isNaN(b)?xtag.queryChildren(a,b):a.children[b]}function c(a,b,c){return b&&(c?b==a.xtag.selected:b!=a.xtag.selected)&&a==b.parentNode&&"X-CARD"==b.nodeName}function d(a,b,c){var d=e[b],f=a.xtag.selected&&a.xtag.selected[d[0]];f?a.showCard(f,c):(a.loop||-1==a.selectedIndex)&&a.showCard(a[d[1]],c)}var e={next:["nextElementSibling","firstElementChild"],previous:["previousElementSibling","lastElementChild"]};xtag.register("x-deck",{events:{"reveal:delegate(x-card)":function(a){this.parentNode==a.currentTarget&&a.currentTarget.showCard(this)}},accessors:{loop:{attribute:{"boolean":!0}},cards:{get:function(){return xtag.queryChildren(this,"x-card")}},selectedCard:{get:function(){return this.xtag.selected||null},set:function(a){this.showCard(a)}},selectedIndex:{attribute:{name:"selected-index",unlink:!0},get:function(){return this.hasAttribute("selected-index")?Number(this.getAttribute("selected-index")):-1},set:function(a){var b=Number(a),c=this.cards[b];c?(this.setAttribute("selected-index",b),c!=this.xtag.selected&&this.showCard(c)):(this.removeAttribute("selected-index"),this.xtag.selected&&this.hideCard(this.xtag.selected))}},transitionType:{attribute:{name:"transition-type"},get:function(){return this.getAttribute("transition-type")||"fade-scale"}}},methods:{nextCard:function(a){d(this,"next",a)},previousCard:function(a){d(this,"previous",a)},showCard:function(d,e){var f=b(this,d);if(c(this,f,!1)){var g=this.xtag.selected,h=a(this,f);e=e||(h>a(this,g)?"forward":"reverse"),g&&this.hideCard(g,e),this.xtag.selected=f,this.selectedIndex=h,f.hasAttribute("selected")||(f.selected=!0),xtag.transition(f,"show",{before:function(){f.setAttribute("show",""),f.setAttribute("transition-direction",e)},after:function(){xtag.fireEvent(f,"show")}})}},hideCard:function(a,d){var e=b(this,a);c(this,e,!0)&&(this.xtag.selected=null,e.hasAttribute("selected")&&(e.selected=!1),xtag.transition(e,"hide",{before:function(){e.removeAttribute("show"),e.setAttribute("hide",""),e.setAttribute("transition-direction",d||"reverse")},after:function(){e.removeAttribute("hide"),e.removeAttribute("transition"),e.removeAttribute("transition-direction"),xtag.fireEvent(e,"hide")}}))}}}),xtag.register("x-card",{lifecycle:{inserted:function(){var a=this.parentNode;"X-DECK"==a.nodeName&&(this.xtag.deck=a,this!=a.selected&&this.selected&&a.showCard(this))},removed:function(){var a=this.xtag.deck;a&&(this==a.xtag.selected?(a.xtag.selected=null,a.removeAttribute("selected-index")):a.showCard(a.selectedCard),this.xtag.deck=null)}},accessors:{transitionType:{attribute:{name:"transition-type"}},selected:{attribute:{"boolean":!0},set:function(a){var b=this.xtag.deck;b&&(a&&this!=b.selected?b.showCard(this):a||this!=b.selected||b.hideCard(this))}}}})}(),function(){function a(a){var b=a.currentTarget;this.parentNode==b&&(this.parentNode.firstElementChild==this?b.flipped=!1:this.parentNode.lastElementChild==this&&(b.flipped=!0))}xtag.register("x-flipbox",{lifecycle:{created:function(){this.firstElementChild&&xtag.skipTransition(this.firstElementChild,function(){}),this.lastElementChild&&xtag.skipTransition(this.lastElementChild,function(){}),this.hasAttribute("direction")||(this.xtag._direction="right")}},events:{"transitionend:delegate(x-flipbox > *:first-child)":function(a){var b=a.currentTarget;this.parentNode==b&&xtag.fireEvent(b,"flipend")},"reveal:delegate(x-flipbox > *)":a},accessors:{direction:{attribute:{},get:function(){return this.xtag._direction},set:function(a){var b=this;xtag.skipTransition(this.firstElementChild,function(){return b.setAttribute("_anim-direction",a),function(){}}),xtag.skipTransition(this.lastElementChild,function(){b.setAttribute("_anim-direction",a)}),this.xtag._direction=a}},flipped:{attribute:{"boolean":!0}}},methods:{toggle:function(){this.flipped=!this.flipped},showFront:function(){this.flipped=!1},showBack:function(){this.flipped=!0}}})}(),function(){function a(a){var b=a.firstElementChild;if(!b)return{header:null,section:null,footer:null};var c=b.nextElementSibling;return{header:"HEADER"==b.nodeName?b:null,section:"SECTION"==b.nodeName?b:c&&"SECTION"==c.nodeName?c:null,footer:"FOOTER"==a.lastElementChild.nodeName?a.lastElementChild:null}}function b(a,b){var c=b.__layoutScroll__=b.__layoutScroll__||Object.defineProperty(b,"__layoutScroll__",{value:{last:b.scrollTop}}).__layoutScroll__,d=b.scrollTop,e=a.scrollBuffer;return c.max=c.max||Math.max(d+e,e),c.min=c.min||Math.max(d-e,e),c}function c(a,b){a.setAttribute("content-maximizing",null),b.section&&(b.header&&(b.section.style.marginTop="-"+b.header.getBoundingClientRect().height+"px"),b.footer&&(b.section.style.marginBottom="-"+b.footer.getBoundingClientRect().height+"px"))}function d(a,b){a.removeAttribute("content-maximized"),a.removeAttribute("content-maximizing"),b.section&&(b.section.style.marginTop="",b.section.style.marginBottom="")}function e(e){if(!e.currentTarget.hasAttribute("content-maximizing")){var f=e.target,g=e.currentTarget;if(this.scrollhide&&(f.parentNode==g||xtag.matchSelector(f,g.scrollTarget))){var h=f.scrollTop,i=g.scrollBuffer,j=a(g),k=b(g,f);h>k.last?k.min=Math.max(h-i,i):h<k.last&&(k.max=Math.max(h+i,i)),g.maxcontent||(h>k.max&&!g.hasAttribute("content-maximized")?c(g,j):h<k.min&&d(g,j)),k.last=h}}}xtag.register("x-layout",{lifecycle:{created:function(){}},events:{scroll:e,transitionend:function(b){var c=a(this);!this.hasAttribute("content-maximizing")||b.target!=c.header&&b.target!=c.section&&b.target!=c.footer||(this.setAttribute("content-maximized",null),this.removeAttribute("content-maximizing"))},"tap:delegate(section)":function(b){var e=b.currentTarget;if(e.taphide&&this.parentNode==e){var f=a(e);e.hasAttribute("content-maximizing")||e.hasAttribute("content-maximized")?e.maxcontent||d(e,f):c(e,f)}},"mouseover:delegate(section)":function(b){var d=b.currentTarget;!d.hoverhide||this.parentNode!=d||d.hasAttribute("content-maximized")||d.hasAttribute("content-maximizing")||b.relatedTarget&&!this.contains(b.target)||c(d,a(d))},"mouseout:delegate(section)":function(b){var c=b.currentTarget;!c.hoverhide||this.parentNode!=c||!c.hasAttribute("content-maximized")&&!c.hasAttribute("content-maximizing")||c!=b.relatedTarget&&c.contains(b.relatedTarget)||d(c,a(c))}},accessors:{scrollTarget:{attribute:{name:"scroll-target"}},scrollBuffer:{attribute:{name:"scroll-buffer"},get:function(){return Number(this.getAttribute("scroll-buffer"))||30}},taphide:{attribute:{"boolean":!0}},hoverhide:{attribute:{"boolean":!0}},scrollhide:{attribute:{"boolean":!0}},maxcontent:{attribute:{"boolean":!0},set:function(b){var e=a(this);b?c(this,e):this.hasAttribute("content-maximizing")||d(this,e)}}}})}(),function(){function a(a){return!isNaN(parseFloat(a))}function b(b,c){return b.hasAttribute(c)&&a(b.getAttribute(c))}function c(b,c,d,e){if(e=e?e:Math.round,d=a(d)?d:0,!a(b))throw"invalid value "+b;if(!a(c)||0>=+c)throw"invalid step "+c;return e((b-d)/c)*c+d}function d(a,b,d,e){return b>a?b:a>d?Math.max(b,c(d,e,b,Math.floor)):a}function e(a,b,e){var f=c((b-a)/2+a,e,a);return d(f,a,b,e)}function f(a,b){var c=a.min,d=a.max;return(b-c)/(d-c)}function g(a,b){var c=a.min,d=a.max;return(d-c)*b+c}function h(a,b){b=Math.min(Math.max(0,b),1);var e=g(a,b),f=c(e,a.step,a.min);return d(f,a.min,a.max,a.step)}function i(a,b){var c=a.xtag.sliderThumb;if(c){var d=a.getBoundingClientRect(),e=c.getBoundingClientRect(),g=f(a,b),h=a.vertical,i=d[h?"height":"width"],j=e[h?"height":"width"],k=Math.max(i-j,0),l=k*g,m=l/i;c.style[h?"left":"top"]=0,c.style[h?"top":"left"]=100*m+"%",a.xtag.sliderProgress.style[h?"height":"width"]=100*g+"%"}}function j(a){i(a,a.value)}function k(a,b,c){var d=a.xtag.rangeInputEl,e=d.getBoundingClientRect(),f=a.xtag.sliderThumb.getBoundingClientRect().width,g=b-e.left-f/2,i=e.width-f/2;a.vertical&&(i=e.height,g=c-e.top),a.value=h(a,g/i),xtag.fireEvent(a,"input"),j(a)}function l(a,b,c){a.xtag.dragInitVal=a.value,k(a,b,c);var d=a.xtag.callbackFns,e=function(a,b){document.body.addEventListener(a,b)};e("mousemove",d.onMouseDragMove),e("touchmove",d.onTouchDragMove),e("mouseup",d.onDragEnd),e("touchend",d.onDragEnd);var f=a.xtag.sliderThumb;f&&f.setAttribute("active",!0)}function m(a,b,c){k(a,b,c)}function n(a){return{onMouseDragStart:function(b){b.button===p&&(l(a,b.pageX,b.pageY),b.preventDefault())},onTouchDragStart:function(b){var c=b.targetTouches;1===c.length&&(l(a,c[0].pageX,c[0].pageY),b.preventDefault())},onMouseDragMove:function(b){m(a,b.pageX,b.pageY),b.preventDefault()},onTouchDragMove:function(b){var c=b.targetTouches;1===c.length&&(m(a,c[0].pageX,c[0].pageY),b.preventDefault())},onDragEnd:function(b){var c=a.xtag.callbackFns,d=function(a,b){document.body.removeEventListener(a,b)};d("mousemove",c.onMouseDragMove),d("touchmove",c.onTouchDragMove),d("mouseup",c.onDragEnd),d("touchend",c.onDragEnd);var e=a.xtag.sliderThumb;e&&e.removeAttribute("active"),a.value!==a.xtag.dragInitVal&&xtag.fireEvent(a,"change"),a.xtag.dragInitVal=null,b.preventDefault()},onKeyDown:function(a){var b=a.keyCode;if(b in o){var c=this.value,d=this.min,e=this.max,f=this.step,g=Math.max(0,e-d),h=Math.max(g/10,f);switch(o[b]){case"LEFT_ARROW":case"DOWN_ARROW":this.value=Math.max(c-f,d);break;case"RIGHT_ARROW":case"UP_ARROW":this.value=Math.min(c+f,e);break;case"HOME":this.value=d;break;case"END":this.value=e;break;case"PAGE_DOWN":this.value=Math.max(c-h,d);break;case"PAGE_UP":this.value=Math.min(c+h,e)}this.value!==c&&xtag.fireEvent(this,"change"),a.preventDefault()}}}}var o={33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT_ARROW",38:"UP_ARROW",39:"RIGHT_ARROW",40:"DOWN_ARROW"},p=0;xtag.register("x-slider",{lifecycle:{created:function(){var a=this;a.xtag.callbackFns=n(a),a.xtag.dragInitVal=null;var c=document.createElement("input");xtag.addClass(c,"input"),c.setAttribute("type","range");var d=b(a,"max")?+a.getAttribute("max"):100,f=b(a,"min")?+a.getAttribute("min"):0,g=b(a,"step")?+a.getAttribute("step"):1;g=g>0?g:1;var h=b(a,"value")?+a.getAttribute("value"):e(f,d,g);c.setAttribute("max",d),c.setAttribute("min",f),c.setAttribute("step",g),c.setAttribute("value",h),a.xtag.rangeInputEl=c,a.appendChild(a.xtag.rangeInputEl);var i=document.createElement("div");xtag.addClass(i,"slider-track"),this.xtag.sliderTrack=i,this.appendChild(i);var j=document.createElement("div");xtag.addClass(j,"slider-progress"),this.xtag.sliderProgress=j,i.appendChild(j);var k=document.createElement("span");xtag.addClass(k,"slider-thumb"),this.xtag.sliderThumb=k,this.appendChild(k),"range"!==c.type||a.hasAttribute("polyfill")?a.setAttribute("polyfill",!0):a.removeAttribute("polyfill"),this.addEventListener("mousedown",a.xtag.callbackFns.onMouseDragStart),this.addEventListener("touchstart",a.xtag.callbackFns.onTouchDragStart),this.addEventListener("keydown",a.xtag.callbackFns.onKeyDown),a.setAttribute("value",h)},inserted:function(){var a=this;xtag.requestFrame(function(){xtag.requestFrame(function(){j(a)})})},attributeChanged:function(a){("min"==a||"max"==a||"step"==a)&&j(this)}},events:{"change:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"change")},"input:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"input")},"focus:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"focus",{},{bubbles:!1})},"blur:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"blur",{},{bubbles:!1})}},accessors:{polyfill:{attribute:{"boolean":!0},set:function(a){this.xtag.callbackFns,a?(this.setAttribute("tabindex",0),this.xtag.rangeInputEl.setAttribute("tabindex",-1),this.xtag.rangeInputEl.setAttribute("readonly",!0),j(this)):(this.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("readonly"))}},vertical:{attribute:{"boolean":!0},set:function(){j(this)}},max:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("max")}},min:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("min")}},step:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("step")}},name:{attribute:{selector:"input[type=range]"},set:function(a){var b=this.xtag.rangeInputEl;null===a||void 0===a?b.removeAttribute("name"):b.setAttribute("name",a)}},value:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.value},set:function(b){a(b)||(b=e(this.min,this.max,this.step)),b=+b;var f=this.min,g=this.max,h=this.step,i=c(b,h,f),k=d(i,f,g,h);this.xtag.rangeInputEl.value=k,j(this)}},inputElem:{get:function(){return this.xtag.rangeInputEl}}},methods:{}})}(),function(){function a(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function b(b){var c=b.getBoundingClientRect(),d=a(),e=d.left,f=d.top;return{left:c.left+e,right:c.right+e,top:c.top+f,bottom:c.bottom+f,width:c.width,height:c.height}}function c(a,b,c){return c.left<=a&&a<=c.right&&c.top<=b&&b<=c.bottom}function d(a){if("x-tabbar"===a.parentNode.nodeName.toLowerCase()){var b=a.targetEvent,c=a.targetSelector?xtag.query(document,a.targetSelector):a.targetElems;c.forEach(function(a){xtag.fireEvent(a,b)})}}xtag.register("x-tabbar",{lifecycle:{created:function(){this.xtag.overallEventToFire="reveal"}},events:{"tap:delegate(x-tabbar-tab)":function(){var a=xtag.query(this.parentNode,"x-tabbar-tab[selected]");a.length&&a.forEach(function(a){a.removeAttribute("selected")}),this.setAttribute("selected",!0)}},accessors:{tabs:{get:function(){return xtag.queryChildren(this,"x-tabbar-tab")}},targetEvent:{attribute:{name:"target-event"},get:function(){return this.xtag.overallEventToFire},set:function(a){this.xtag.overallEventToFire=a}}},methods:{}}),xtag.register("x-tabbar-tab",{lifecycle:{created:function(){this.xtag.targetSelector=null,this.xtag.overrideTargetElems=null,this.xtag.targetEvent=null}},events:{tap:function(a){var e=a.currentTarget;if(a.changedTouches&&a.changedTouches.length>0){var f=a.changedTouches[0],g=b(e);c(f.pageX,f.pageY,g)&&d(e)}else d(e)}},accessors:{targetSelector:{attribute:{name:"target-selector"},get:function(){return this.xtag.targetSelector},set:function(a){this.xtag.targetSelector=a,a&&(this.xtag.overrideTargetElems=null)}},targetElems:{get:function(){return this.targetSelector?xtag.query(document,this.targetSelector):null!==this.xtag.overrideTargetElems?this.xtag.overrideTargetElems:[]},set:function(a){this.removeAttribute("target-selector"),this.xtag.overrideTargetElems=a}},targetEvent:{attribute:{name:"target-event"},get:function(){if(this.xtag.targetEvent)return this.xtag.targetEvent;if("x-tabbar"===this.parentNode.nodeName.toLowerCase())return this.parentNode.targetEvent;throw"tabbar-tab is missing event to fire"},set:function(a){this.xtag.targetEvent=a}}},methods:{}})}(),function(){function a(a){var b=a.xtag.input.form;b?a.removeAttribute("x-toggle-no-form"):a.setAttribute("x-toggle-no-form",""),a.xtag.scope=a.parentNode?b||document:null}function b(a){var b={},c=a==document?"[x-toggle-no-form]":"";xtag.query(a,"x-toggle[name]"+c).forEach(function(d){var e=d.name;if(e&&!b[e]){var f=xtag.query(a,'x-toggle[name="'+e+'"]'+c),g=f.length>1?"radio":"checkbox";f.forEach(function(a){a.xtag&&a.xtag.input&&(a.type=g)}),b[e]=!0}})}function c(a){if(f&&a.group&&"radio"!=a.type){var b=a.groupToggles,c='x-toggle[group="'+a.group+'"][active]',d=a.xtag.scope.querySelector(c);if(d&&a!=d){a.checked=d.checked;var e=d.checked,g=b.indexOf(a),h=b.indexOf(d),i=Math.min(g,h),j=Math.max(g,h);return b.slice(i,j+1).forEach(function(a){a!=d&&(a.checked=e)}),!0}}}function d(a){e(a)||(a.groupToggles.forEach(function(a){a.active=!1}),a.active=!0)}function e(a){return a.parentNode&&"X-TOGGLEBAR"==a.parentNode.nodeName}var f=!1;xtag.addEvents(document,{DOMComponentsLoaded:function(){b(document),xtag.toArray(document.forms).forEach(b)},WebComponentsReady:function(){b(document),xtag.toArray(document.forms).forEach(b)},keydown:function(a){f=a.shiftKey},keyup:function(a){f=a.shiftKey},"focus:delegate(x-toggle)":function(){this.focus=!0,this.xtag.input.focus()},"blur:delegate(x-toggle)":function(){this.focus=!1},"tap:delegate(x-toggle)":function(){var a=this.xtag.input;if("radio"==a.type?!this.checked:!0){a.checked=!a.checked;var b=document.createEvent("Event");b.initEvent("change",!0,!1),a.dispatchEvent(b)}a.focus()},"change:delegate(x-toggle)":function(){this.xtag.input.focus(),(e(this)||!c(this)&&"radio"!=this.type)&&(this.checked=this.xtag.input.checked),d(this)}});var g=xtag.createFragment('<input /><div class="x-toggle-check"></div>');xtag.register("x-toggle",{lifecycle:{created:function(){this.appendChild(g.cloneNode(!0)),this.xtag.input=this.querySelector("input"),this.xtag.checkEl=this.querySelector(".x-toggle-check"),this.type="checkbox",a(this);var b=this.getAttribute("name");b&&(this.xtag.input.name=this.getAttribute("name")),this.hasAttribute("checked")&&(this.checked=!0)},inserted:function(){a(this),this.name&&b(this.xtag.scope)},removed:function(){b(this.xtag.scope),a(this)}},accessors:{noBox:{attribute:{name:"no-box","boolean":!0}},type:{attribute:{},set:function(a){this.xtag.input.type=a}},label:{attribute:{}},focus:{attribute:{"boolean":!0}},active:{attribute:{"boolean":!0}},group:{attribute:{}},groupToggles:{get:function(){return xtag.query(this.xtag.scope,'x-toggle[group="'+this.group+'"]') +}},name:{attribute:{skip:!0},set:function(a){null===a?(this.removeAttribute("name"),this.type="checkbox"):this.setAttribute("name",a),this.xtag.input.name=a,b(this.xtag.scope)}},checked:{get:function(){return this.xtag.input.checked},set:function(a){var b=this.name,c="true"===a||a===!0;if(b){var d=this.xtag.scope==document?"[x-toggle-no-form]":"",e='x-toggle[checked][name="'+b+'"]'+d,f=this.xtag.scope.querySelector(e);f&&f.removeAttribute("checked")}this.xtag.input.checked=c,c?this.setAttribute("checked",""):this.removeAttribute("checked")}},value:{attribute:{},get:function(){return this.xtag.input.value},set:function(a){this.xtag.input.value=a}}}}),xtag.register("x-togglebar",{events:{}})}();
\ No newline at end of file diff --git a/style/readme-1.0.0rc1.txt b/style/readme-1.0.0rc1.txt new file mode 100644 index 0000000..2a2cfa7 --- /dev/null +++ b/style/readme-1.0.0rc1.txt @@ -0,0 +1,16 @@ +Mozilla Brick + +To include Brick in your project, include the bundled stylesheet and script +files in your project's page like any other CSS/JS file. + +To use the provided default font for your components, include the font file in +the same directory as your Brick stylesheet. +(If you move the font file elsewhere, look for the "OpenSans-SemiBold.ttf" in + the @font-face declaration at the start of the included stylesheet and + replace it with the correct path to the file). + +Further documentation can be found at http://mozilla.github.io/brick/ + +If you run into issues with this release of Brick, please file an issue +at https://github.com/mozilla/brick/. We're still in prerelease, so all feedback +is welcome!
\ No newline at end of file |