Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.js 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray';
  2. import _extends from 'babel-runtime/helpers/extends';
  3. import _typeof from 'babel-runtime/helpers/typeof';
  4. import _setImmediate from 'babel-runtime/core-js/set-immediate';
  5. import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
  6. import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
  7. import _createClass from 'babel-runtime/helpers/createClass';
  8. import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
  9. import _get from 'babel-runtime/helpers/get';
  10. import _inherits from 'babel-runtime/helpers/inherits';
  11. import _Object$keys from 'babel-runtime/core-js/object/keys';
  12. /*
  13. Copyright 2013-2015 ASIAL CORPORATION
  14. Licensed under the Apache License, Version 2.0 (the "License");
  15. you may not use this file except in compliance with the License.
  16. You may obtain a copy of the License at
  17. http://www.apache.org/licenses/LICENSE-2.0
  18. Unless required by applicable law or agreed to in writing, software
  19. distributed under the License is distributed on an "AS IS" BASIS,
  20. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. See the License for the specific language governing permissions and
  22. limitations under the License.
  23. */
  24. import onsElements from '../../ons/elements';
  25. import util from '../../ons/util';
  26. import autoStyle from '../../ons/autostyle';
  27. import ModifierUtil from '../../ons/internal/modifier-util';
  28. import AnimatorFactory from '../../ons/internal/animator-factory';
  29. import { PopoverAnimator, IOSFadePopoverAnimator, MDFadePopoverAnimator } from './animator';
  30. import platform from '../../ons/platform';
  31. import iPhoneXPatch from '../../ons/iphonex-patch';
  32. import BaseDialogElement from '../base/base-dialog';
  33. import contentReady from '../../ons/content-ready';
  34. var scheme = {
  35. '.popover': 'popover--*',
  36. '.popover-mask': 'popover-mask--*',
  37. '.popover__content': 'popover--*__content',
  38. '.popover__arrow': 'popover--*__arrow'
  39. };
  40. var _animatorDict = {
  41. 'default': function _default() {
  42. return platform.isAndroid() ? MDFadePopoverAnimator : IOSFadePopoverAnimator;
  43. },
  44. 'none': PopoverAnimator,
  45. 'fade-ios': IOSFadePopoverAnimator,
  46. 'fade-md': MDFadePopoverAnimator
  47. };
  48. var positions = {
  49. up: 'bottom',
  50. left: 'right',
  51. down: 'top',
  52. right: 'left'
  53. };
  54. var directions = _Object$keys(positions);
  55. /**
  56. * @element ons-popover
  57. * @category dialog
  58. * @description
  59. * [en]
  60. * A component that displays a popover next to an element. The popover can be used to display extra information about a component or a tooltip.
  61. *
  62. * To use the element it can either be attached directly to the `<body>` element or dynamically created from a template using the `ons.createPopover(template)` utility function and the `<template>` tag.
  63. *
  64. * Another common way to use the popover is to display a menu when a button on the screen is tapped. For Material Design, popover looks exactly as a dropdown menu.
  65. * [/en]
  66. * [ja]ある要素を対象とするポップオーバーを表示するコンポーネントです。[/ja]
  67. * @codepen ZYYRKo
  68. * @tutorial vanilla/Reference/popover
  69. * @guide theming.html#modifiers [en]More details about the `modifier` attribute[/en][ja]modifier属性の使い方[/ja]
  70. * @example
  71. * <ons-button onclick="showPopover(this)">
  72. * Click me!
  73. * </ons-button>
  74. *
  75. * <ons-popover direction="down" id="popover">
  76. * <p>This is a popover!</p>
  77. * </ons-popover>
  78. *
  79. * <script>
  80. * var showPopover = function(element) {
  81. * var popover = document.getElementById('popover');
  82. * popover.show(element);
  83. * };
  84. * </script>
  85. */
  86. var PopoverElement = function (_BaseDialogElement) {
  87. _inherits(PopoverElement, _BaseDialogElement);
  88. /**
  89. * @event preshow
  90. * @description
  91. * [en]Fired just before the popover is displayed.[/en]
  92. * [ja]ポップオーバーが表示される直前に発火します。[/ja]
  93. * @param {Object} event [en]Event object.[/en]
  94. * @param {Object} event.popover
  95. * [en]Component object.[/en]
  96. * [ja]コンポーネントのオブジェクト。[/ja]
  97. * @param {Function} event.cancel
  98. * [en]Call this function to stop the popover from being shown.[/en]
  99. * [ja]この関数を呼び出すと、ポップオーバーの表示がキャンセルされます。[/ja]
  100. */
  101. /**
  102. * @event postshow
  103. * @description
  104. * [en]Fired just after the popover is displayed.[/en]
  105. * [ja]ポップオーバーが表示された直後に発火します。[/ja]
  106. * @param {Object} event [en]Event object.[/en]
  107. * @param {Object} event.popover
  108. * [en]Component object.[/en]
  109. * [ja]コンポーネントのオブジェクト。[/ja]
  110. */
  111. /**
  112. * @event prehide
  113. * @description
  114. * [en]Fired just before the popover is hidden.[/en]
  115. * [ja]ポップオーバーが隠れる直前に発火します。[/ja]
  116. * @param {Object} event [en]Event object.[/en]
  117. * @param {Object} event.popover
  118. * [en]Component object.[/en]
  119. * [ja]コンポーネントのオブジェクト。[/ja]
  120. * @param {Function} event.cancel
  121. * [en]Call this function to stop the popover from being hidden.[/en]
  122. * [ja]この関数を呼び出すと、ポップオーバーが隠れる処理をキャンセルします。[/ja]
  123. */
  124. /**
  125. * @event posthide
  126. * @description
  127. * [en]Fired just after the popover is hidden.[/en]
  128. * [ja]ポップオーバーが隠れた後に発火します。[/ja]
  129. * @param {Object} event [en]Event object.[/en]
  130. * @param {Object} event.popover
  131. * [en]Component object.[/en]
  132. * [ja]コンポーネントのオブジェクト。[/ja]
  133. */
  134. /**
  135. * @attribute modifier
  136. * @type {String}
  137. * @description
  138. * [en]The appearance of the popover.[/en]
  139. * [ja]ポップオーバーの表現を指定します。[/ja]
  140. */
  141. /**
  142. * @attribute direction
  143. * @type {String}
  144. * @description
  145. * [en]
  146. * A space separated list of directions. If more than one direction is specified,
  147. * it will be chosen automatically. Valid directions are `"up"`, `"down"`, `"left"` and `"right"`.
  148. * [/en]
  149. * [ja]
  150. * ポップオーバーを表示する方向を空白区切りで複数指定できます。
  151. * 指定できる方向は、"up", "down", "left", "right"の4つです。空白区切りで複数指定することもできます。
  152. * 複数指定された場合、対象とする要素に合わせて指定した値から自動的に選択されます。
  153. * [/ja]
  154. */
  155. /**
  156. * @attribute cancelable
  157. * @description
  158. * [en]If this attribute is set the popover can be closed by tapping the background or by pressing the back button.[/en]
  159. * [ja]この属性があると、ポップオーバーが表示された時に、背景やバックボタンをタップした時にをポップオーバー閉じます。[/ja]
  160. */
  161. /**
  162. * @attribute cover-target
  163. * @description
  164. * [en]If set the popover will cover the target on the screen.[/en]
  165. * [ja][/ja]
  166. */
  167. /**
  168. * @attribute animation
  169. * @type {String}
  170. * @description
  171. * [en]The animation used when showing an hiding the popover. Can be either `"none"`, `"default"`, `"fade-ios"` or `"fade-md"`.[/en]
  172. * [ja]ポップオーバーを表示する際のアニメーション名を指定します。[/ja]
  173. */
  174. /**
  175. * @attribute animation-options
  176. * @type {Expression}
  177. * @description
  178. * [en]Specify the animation's duration, timing and delay with an object literal. E.g. `{duration: 0.2, delay: 1, timing: 'ease-in'}`.[/en]
  179. * [ja]アニメーション時のduration, timing, delayをオブジェクトリテラルで指定します。e.g. {duration: 0.2, delay: 1, timing: 'ease-in'}[/ja]
  180. */
  181. /**
  182. * @attribute mask-color
  183. * @type {Color}
  184. * @description
  185. * [en]Color of the background mask. Default is `"rgba(0, 0, 0, 0.2)"`.[/en]
  186. * [ja]背景のマスクの色を指定します。デフォルトは"rgba(0, 0, 0, 0.2)"です。[/ja]
  187. */
  188. function PopoverElement() {
  189. _classCallCheck(this, PopoverElement);
  190. var _this = _possibleConstructorReturn(this, (PopoverElement.__proto__ || _Object$getPrototypeOf(PopoverElement)).call(this));
  191. _this._boundOnChange = _this._onChange.bind(_this);
  192. contentReady(_this, function () {
  193. _this._compile();
  194. _this.style.display = 'none';
  195. });
  196. return _this;
  197. }
  198. _createClass(PopoverElement, [{
  199. key: '_updateAnimatorFactory',
  200. value: function _updateAnimatorFactory() {
  201. return new AnimatorFactory({
  202. animators: _animatorDict,
  203. baseClass: PopoverAnimator,
  204. baseClassName: 'PopoverAnimator',
  205. defaultAnimation: this.getAttribute('animation') || 'default'
  206. });
  207. }
  208. }, {
  209. key: '_toggleStyle',
  210. value: function _toggleStyle(shouldShow) {
  211. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  212. if (shouldShow) {
  213. this.style.display = 'block';
  214. this._currentTarget = options.target;
  215. this._positionPopover(options.target);
  216. } else {
  217. this.style.display = 'none';
  218. this._clearStyles();
  219. }
  220. }
  221. }, {
  222. key: '_positionPopover',
  223. value: function _positionPopover(target) {
  224. var radius = this._radius,
  225. contentElement = this._content,
  226. margin = this._margin;
  227. var safeAreaLengths = iPhoneXPatch.getSafeAreaLengths();
  228. var safeAreaRect = iPhoneXPatch.getSafeAreaDOMRect();
  229. var targetRect = target.getBoundingClientRect();
  230. var isMD = util.hasModifier(this, 'material');
  231. var cover = isMD && this.hasAttribute('cover-target');
  232. var parent = util.findParent(this, 'ons-page') || document.body;
  233. var parentDimensions = parent.getBoundingClientRect();
  234. var maxPositions = {
  235. top: Math.max(parentDimensions.top, safeAreaRect.top),
  236. left: Math.max(parentDimensions.left, safeAreaRect.left),
  237. bottom: Math.min(parentDimensions.bottom, safeAreaRect.bottom),
  238. right: Math.min(parentDimensions.right, safeAreaRect.right)
  239. };
  240. // Distance from each side of the safe area (with margin) to the target element
  241. var targetDistance = {
  242. top: targetRect.top - (maxPositions.top + margin),
  243. left: targetRect.left - (maxPositions.left + margin),
  244. bottom: maxPositions.bottom - margin - targetRect.bottom,
  245. right: maxPositions.right - margin - targetRect.right
  246. };
  247. // Distance from each side of the safe area (with margin) to the geometric center of the target element
  248. var targetCenterDistanceFrom = {
  249. top: targetRect.top + Math.round(targetRect.height / 2) - (maxPositions.top + margin),
  250. left: targetRect.left + Math.round(targetRect.width / 2) - (maxPositions.left + margin),
  251. bottom: maxPositions.bottom - margin - targetRect.bottom + Math.round(targetRect.height / 2),
  252. right: maxPositions.right - margin - targetRect.right + Math.round(targetRect.width / 2)
  253. };
  254. var _calculateDirections2 = this._calculateDirections(targetDistance),
  255. vertical = _calculateDirections2.vertical,
  256. primaryDirection = _calculateDirections2.primary,
  257. secondaryDirection = _calculateDirections2.secondary;
  258. this._currentDirection = primaryDirection;
  259. util.addModifier(this, primaryDirection);
  260. var sizeName = vertical ? 'width' : 'height';
  261. // Get .popover__content size
  262. var contentSize = function (style) {
  263. return {
  264. width: parseInt(style.getPropertyValue('width'), 10),
  265. height: parseInt(style.getPropertyValue('height'), 10)
  266. };
  267. }(window.getComputedStyle(contentElement));
  268. // Setting .popover position.
  269. var targetAndArrowLength = cover ? 0 : (vertical ? targetRect.height : targetRect.width) + (isMD ? 0 : 14);
  270. var primaryOffset = Math.max(safeAreaLengths[primaryDirection] + margin, safeAreaLengths[primaryDirection] + margin + targetDistance[primaryDirection] + targetAndArrowLength);
  271. var secondaryOffset = Math.max(safeAreaLengths[secondaryDirection] + margin, safeAreaLengths[secondaryDirection] + margin + targetCenterDistanceFrom[secondaryDirection] - contentSize[sizeName] / 2);
  272. this._popover.style[primaryDirection] = primaryOffset + 'px';
  273. this._popover.style[secondaryDirection] = secondaryOffset + 'px';
  274. // Setting .popover__arrow position.
  275. this._arrow.style[secondaryDirection] = Math.max(radius, safeAreaLengths[secondaryDirection] + margin + targetCenterDistanceFrom[secondaryDirection] - secondaryOffset) + 'px';
  276. }
  277. }, {
  278. key: '_calculateDirections',
  279. value: function _calculateDirections(distance) {
  280. var options = (this.getAttribute('direction') || 'up down left right').split(/\s+/).map(function (e) {
  281. return positions[e];
  282. });
  283. var primary = options.sort(function (a, b) {
  284. return distance[a] - distance[b];
  285. })[0];
  286. var vertical = 'top' == primary || 'bottom' == primary;
  287. var secondary = void 0;
  288. if (vertical) {
  289. secondary = distance.left < distance.right ? 'left' : 'right';
  290. } else {
  291. secondary = distance.top < distance.bottom ? 'top' : 'bottom';
  292. }
  293. return { vertical: vertical, primary: primary, secondary: secondary };
  294. }
  295. }, {
  296. key: '_clearStyles',
  297. value: function _clearStyles() {
  298. var _this2 = this;
  299. this._currentDirection = null;
  300. ['top', 'bottom', 'left', 'right'].forEach(function (e) {
  301. _this2._arrow.style[e] = _this2._content.style[e] = _this2._popover.style[e] = '';
  302. util.removeModifier(_this2, e);
  303. });
  304. }
  305. }, {
  306. key: '_onChange',
  307. value: function _onChange() {
  308. var _this3 = this;
  309. _setImmediate(function () {
  310. if (_this3._currentTarget) {
  311. _this3._positionPopover(_this3._currentTarget);
  312. }
  313. });
  314. }
  315. }, {
  316. key: '_compile',
  317. value: function _compile() {
  318. autoStyle.prepare(this);
  319. if (this._popover && this._mask) {
  320. return;
  321. }
  322. var hasDefaultContainer = this._popover && this._content;
  323. if (hasDefaultContainer) {
  324. if (!this._mask) {
  325. var mask = document.createElement('div');
  326. mask.classList.add('popover-mask');
  327. this.insertBefore(mask, this.firstChild);
  328. }
  329. if (!this._arrow) {
  330. var arrow = document.createElement('div');
  331. arrow.classList.add('popover__arrow');
  332. this._popover.appendChild(arrow);
  333. }
  334. } else {
  335. var template = util.createFragment('\n <div class="popover-mask"></div>\n <div class="popover">\n <div class="popover__content"></div>\n <div class="popover__arrow"></div>\n </div>\n ');
  336. var content = template.querySelector('.popover__content');
  337. while (this.childNodes[0]) {
  338. content.appendChild(this.childNodes[0]);
  339. }
  340. this.appendChild(template);
  341. }
  342. // FIXME!
  343. if (this.hasAttribute('style')) {
  344. this._popover.setAttribute('style', this.getAttribute('style'));
  345. this.removeAttribute('style');
  346. }
  347. ModifierUtil.initModifier(this, this._scheme);
  348. }
  349. /**
  350. * @method show
  351. * @signature show(target, [options])
  352. * @param {String|Event|HTMLElement} target
  353. * [en]Target element. Can be either a CSS selector, an event object or a DOM element. It can be also provided as 'options.target' instead. [/en]
  354. * [ja]ポップオーバーのターゲットとなる要素を指定します。CSSセレクタかeventオブジェクトかDOM要素のいずれかを渡せます。[/ja]
  355. * @param {Object} [options]
  356. * [en]Parameter object.[/en]
  357. * [ja]オプションを指定するオブジェクト。[/ja]
  358. * @param {String} [options.animation]
  359. * [en]Animation name. Use one of `"fade-ios"`, `"fade-md"`, `"none"` and `"default"`.[/en]
  360. * [ja]アニメーション名を指定します。"fade-ios", "fade-md", "none", "default"のいずれかを指定できます。[/ja]
  361. * @param {String} [options.animationOptions]
  362. * [en]Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.[/en]
  363. * [ja]アニメーション時のduration, delay, timingを指定します。e.g. {duration: 0.2, delay: 0.4, timing: 'ease-in'}[/ja]
  364. * @param {Function} [options.callback]
  365. * [en]This function is called after the popover has been revealed.[/en]
  366. * [ja]ポップオーバーが表示され終わった後に呼び出される関数オブジェクトを指定します。[/ja]
  367. * @description
  368. * [en]Open the popover and point it at a target. The target can be either an event, a CSS selector or a DOM element..[/en]
  369. * [ja]対象とする要素にポップオーバーを表示します。target引数には、$eventオブジェクトやDOMエレメントやCSSセレクタを渡すことが出来ます。[/ja]
  370. * @return {Promise}
  371. * [en]Resolves to the displayed element[/en]
  372. * [ja][/ja]
  373. */
  374. }, {
  375. key: 'show',
  376. value: function show(target) {
  377. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  378. // Copy options and include options.target
  379. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && !(target instanceof Event) && !(target instanceof HTMLElement)) {
  380. options = _extends({}, target);
  381. } else {
  382. options = _extends({}, options, { target: target });
  383. }
  384. if (typeof options.target === 'string') {
  385. options.target = document.querySelector(options.target);
  386. } else if (options.target instanceof Event) {
  387. options.target = options.target.target;
  388. }
  389. if (!(options.target instanceof HTMLElement)) {
  390. util.throw('Invalid target type or undefined');
  391. }
  392. return _get(PopoverElement.prototype.__proto__ || _Object$getPrototypeOf(PopoverElement.prototype), 'show', this).call(this, options);
  393. }
  394. /**
  395. * @method hide
  396. * @signature hide([options])
  397. * @param {Object} [options]
  398. * [en]Parameter object.[/en]
  399. * [ja]オプションを指定するオブジェクト。[/ja]
  400. * @param {String} [options.animation]
  401. * [en]Animation name. Use one of `"fade-ios"`, `"fade-md"`, `"none"` and `"default"`.[/en]
  402. * [ja]アニメーション名を指定します。"fade-ios", "fade-md", "none", "default"のいずれかを指定できます。[/ja]
  403. * @param {String} [options.animationOptions]
  404. * [en]Specify the animation's duration, delay and timing. E.g. `{duration: 0.2, delay: 0.4, timing: 'ease-in'}`.[/en]
  405. * [ja]アニメーション時のduration, delay, timingを指定します。e.g. {duration: 0.2, delay: 0.4, timing: 'ease-in'}[/ja]
  406. * @param {Function} [options.callback]
  407. * [en]This functions is called after the popover has been hidden.[/en]
  408. * [ja]ポップオーバーが隠れた後に呼び出される関数オブジェクトを指定します。[/ja]
  409. * @description
  410. * [en]Close the popover.[/en]
  411. * [ja]ポップオーバーを閉じます。[/ja]
  412. * @return {Promise}
  413. * [en]Resolves to the hidden element[/en]
  414. * [ja][/ja]
  415. */
  416. /**
  417. * @property visible
  418. * @readonly
  419. * @type {Boolean}
  420. * @description
  421. * [en]Whether the element is visible or not.[/en]
  422. * [ja]要素が見える場合に`true`。[/ja]
  423. */
  424. /**
  425. * @property cancelable
  426. * @type {Boolean}
  427. * @description
  428. * [en]
  429. * A boolean value that specifies whether the popover is cancelable or not.
  430. *
  431. * When the popover is cancelable it can be closed by tapping the background or by pressing the back button on Android devices.
  432. * [/en]
  433. * [ja][/ja]
  434. */
  435. /**
  436. * @property onDeviceBackButton
  437. * @type {Object}
  438. * @description
  439. * [en]Back-button handler.[/en]
  440. * [ja]バックボタンハンドラ。[/ja]
  441. */
  442. }, {
  443. key: 'connectedCallback',
  444. value: function connectedCallback() {
  445. var _this4 = this;
  446. _get(PopoverElement.prototype.__proto__ || _Object$getPrototypeOf(PopoverElement.prototype), 'connectedCallback', this).call(this);
  447. window.addEventListener('resize', this._boundOnChange, false);
  448. this._margin = this._margin || parseInt(window.getComputedStyle(this).getPropertyValue('top'));
  449. this._margin = this._margin || 6; // Fix for iframes
  450. contentReady(this, function () {
  451. _this4._radius = parseInt(window.getComputedStyle(_this4._content).getPropertyValue('border-top-left-radius'));
  452. });
  453. }
  454. }, {
  455. key: 'disconnectedCallback',
  456. value: function disconnectedCallback() {
  457. _get(PopoverElement.prototype.__proto__ || _Object$getPrototypeOf(PopoverElement.prototype), 'disconnectedCallback', this).call(this);
  458. window.removeEventListener('resize', this._boundOnChange, false);
  459. }
  460. }, {
  461. key: 'attributeChangedCallback',
  462. value: function attributeChangedCallback(name, last, current) {
  463. if (name === 'direction') {
  464. return this._boundOnChange();
  465. } else if (name === 'modifier') {
  466. this._currentDirection && util.addModifier(this, this._currentDirection);
  467. }
  468. _get(PopoverElement.prototype.__proto__ || _Object$getPrototypeOf(PopoverElement.prototype), 'attributeChangedCallback', this).call(this, name, last, current);
  469. }
  470. /**
  471. * @param {String} name
  472. * @param {PopoverAnimator} Animator
  473. */
  474. }, {
  475. key: '_scheme',
  476. get: function get() {
  477. return scheme;
  478. }
  479. }, {
  480. key: '_mask',
  481. get: function get() {
  482. return util.findChild(this, '.popover-mask');
  483. }
  484. }, {
  485. key: '_popover',
  486. get: function get() {
  487. return util.findChild(this, '.popover');
  488. }
  489. }, {
  490. key: '_content',
  491. get: function get() {
  492. return util.findChild(this._popover, '.popover__content');
  493. }
  494. }, {
  495. key: '_arrow',
  496. get: function get() {
  497. return util.findChild(this._popover, '.popover__arrow');
  498. }
  499. }], [{
  500. key: 'registerAnimator',
  501. value: function registerAnimator(name, Animator) {
  502. if (!(Animator.prototype instanceof PopoverAnimator)) {
  503. util.throwAnimator('Popover');
  504. }
  505. _animatorDict[name] = Animator;
  506. }
  507. }, {
  508. key: 'observedAttributes',
  509. get: function get() {
  510. return [].concat(_toConsumableArray(_get(PopoverElement.__proto__ || _Object$getPrototypeOf(PopoverElement), 'observedAttributes', this)), ['direction']);
  511. }
  512. }, {
  513. key: 'animators',
  514. get: function get() {
  515. return _animatorDict;
  516. }
  517. }, {
  518. key: 'PopoverAnimator',
  519. get: function get() {
  520. return PopoverAnimator;
  521. }
  522. }]);
  523. return PopoverElement;
  524. }(BaseDialogElement);
  525. export default PopoverElement;
  526. onsElements.Popover = PopoverElement;
  527. customElements.define('ons-popover', PopoverElement);