ngx-text-editor-angular
Version:
WYSIWYG Editor for Angular 2+
777 lines (762 loc) • 41.3 kB
JavaScript
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[39],{
/***/ "./node_modules/@ionic/core/dist/esm-es5/ion-menu_4-ios.entry.js":
/*!***********************************************************************!*\
!*** ./node_modules/@ionic/core/dist/esm-es5/ion-menu_4-ios.entry.js ***!
\***********************************************************************/
/*! exports provided: ion_menu, ion_menu_button, ion_menu_controller, ion_menu_toggle */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ion_menu", function() { return Menu; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ion_menu_button", function() { return MenuButton; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ion_menu_controller", function() { return MenuController; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ion_menu_toggle", function() { return MenuToggle; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
/* harmony import */ var _core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core-ca0488fc.js */ "./node_modules/@ionic/core/dist/esm-es5/core-ca0488fc.js");
/* harmony import */ var _config_3c7f3790_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config-3c7f3790.js */ "./node_modules/@ionic/core/dist/esm-es5/config-3c7f3790.js");
/* harmony import */ var _helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers-46f4a262.js */ "./node_modules/@ionic/core/dist/esm-es5/helpers-46f4a262.js");
/* harmony import */ var _animation_af478fe9_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./animation-af478fe9.js */ "./node_modules/@ionic/core/dist/esm-es5/animation-af478fe9.js");
/* harmony import */ var _index_624eea58_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./index-624eea58.js */ "./node_modules/@ionic/core/dist/esm-es5/index-624eea58.js");
/* harmony import */ var _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./index-1e5940d5.js */ "./node_modules/@ionic/core/dist/esm-es5/index-1e5940d5.js");
/* harmony import */ var _theme_18cbe2cc_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./theme-18cbe2cc.js */ "./node_modules/@ionic/core/dist/esm-es5/theme-18cbe2cc.js");
/* harmony import */ var _cubic_bezier_2812fda3_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./cubic-bezier-2812fda3.js */ "./node_modules/@ionic/core/dist/esm-es5/cubic-bezier-2812fda3.js");
var Menu = /** @class */ (function () {
function class_1(hostRef) {
Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["r"])(this, hostRef);
this.lastOnEnd = 0;
this.blocker = _index_624eea58_js__WEBPACK_IMPORTED_MODULE_5__["GESTURE_CONTROLLER"].createBlocker({ disableScroll: true });
this.mode = Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["d"])(this);
this.isAnimating = false;
this._isOpen = false;
this.isPaneVisible = false;
this.isEndSide = false;
/**
* If `true`, the menu is disabled.
*/
this.disabled = false;
/**
* Which side of the view the menu should be placed.
*/
this.side = 'start';
/**
* If `true`, swiping the menu is enabled.
*/
this.swipeGesture = true;
/**
* The edge threshold for dragging the menu open.
* If a drag/swipe happens over this value, the menu is not triggered.
*/
this.maxEdgeStart = 50;
this.ionWillOpen = Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["c"])(this, "ionWillOpen", 7);
this.ionWillClose = Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["c"])(this, "ionWillClose", 7);
this.ionDidOpen = Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["c"])(this, "ionDidOpen", 7);
this.ionDidClose = Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["c"])(this, "ionDidClose", 7);
this.ionMenuChange = Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["c"])(this, "ionMenuChange", 7);
}
class_1.prototype.typeChanged = function (type, oldType) {
var contentEl = this.contentEl;
if (contentEl) {
if (oldType !== undefined) {
contentEl.classList.remove("menu-content-" + oldType);
}
contentEl.classList.add("menu-content-" + type);
contentEl.removeAttribute('style');
}
if (this.menuInnerEl) {
// Remove effects of previous animations
this.menuInnerEl.removeAttribute('style');
}
this.animation = undefined;
};
class_1.prototype.disabledChanged = function () {
this.updateState();
this.ionMenuChange.emit({
disabled: this.disabled,
open: this._isOpen
});
};
class_1.prototype.sideChanged = function () {
this.isEndSide = Object(_helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__["i"])(this.side);
};
class_1.prototype.swipeGestureChanged = function () {
this.updateState();
};
class_1.prototype.connectedCallback = function () {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
var el, parent, content, _a;
var _this = this;
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_b) {
switch (_b.label) {
case 0:
if (this.type === undefined) {
this.type = _config_3c7f3790_js__WEBPACK_IMPORTED_MODULE_2__["b"].get('menuType', this.mode === 'ios' ? 'reveal' : 'overlay');
}
el = this.el;
parent = el.parentNode;
if (this.contentId === undefined) {
console.warn("[DEPRECATED][ion-menu] Using the [main] attribute is deprecated, please use the \"contentId\" property instead:\nBEFORE:\n <ion-menu>...</ion-menu>\n <div main>...</div>\n\nAFTER:\n <ion-menu contentId=\"my-content\"></ion-menu>\n <div id=\"my-content\">...</div>\n");
}
content = this.contentId !== undefined
? document.getElementById(this.contentId)
: parent && parent.querySelector && parent.querySelector('[main]');
if (!content || !content.tagName) {
// requires content element
console.error('Menu: must have a "content" element to listen for drag events on.');
return [2 /*return*/];
}
this.contentEl = content;
// add menu's content classes
content.classList.add('menu-content');
this.typeChanged(this.type, undefined);
this.sideChanged();
// register this menu with the app's menu controller
_index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"]._register(this);
_a = this;
return [4 /*yield*/, Promise.resolve(/*! import() */).then(__webpack_require__.bind(null, /*! ./index-624eea58.js */ "./node_modules/@ionic/core/dist/esm-es5/index-624eea58.js"))];
case 1:
_a.gesture = (_b.sent()).createGesture({
el: document,
gestureName: 'menu-swipe',
gesturePriority: 30,
threshold: 10,
canStart: function (ev) { return _this.canStart(ev); },
onWillStart: function () { return _this.onWillStart(); },
onStart: function () { return _this.onStart(); },
onMove: function (ev) { return _this.onMove(ev); },
onEnd: function (ev) { return _this.onEnd(ev); },
});
this.updateState();
return [2 /*return*/];
}
});
});
};
class_1.prototype.componentDidLoad = function () {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) {
this.ionMenuChange.emit({ disabled: this.disabled, open: this._isOpen });
this.updateState();
return [2 /*return*/];
});
});
};
class_1.prototype.disconnectedCallback = function () {
this.blocker.destroy();
_index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"]._unregister(this);
if (this.animation) {
this.animation.destroy();
}
if (this.gesture) {
this.gesture.destroy();
this.gesture = undefined;
}
this.animation = undefined;
this.contentEl = this.backdropEl = this.menuInnerEl = undefined;
};
class_1.prototype.onSplitPaneChanged = function (ev) {
this.isPaneVisible = ev.detail.isPane(this.el);
this.updateState();
};
class_1.prototype.onBackdropClick = function (ev) {
if (this._isOpen && this.lastOnEnd < ev.timeStamp - 100) {
var shouldClose = (ev.composedPath)
? !ev.composedPath().includes(this.menuInnerEl)
: false;
if (shouldClose) {
ev.preventDefault();
ev.stopPropagation();
this.close();
}
}
};
/**
* Returns `true` is the menu is open.
*/
class_1.prototype.isOpen = function () {
return Promise.resolve(this._isOpen);
};
/**
* Returns `true` is the menu is active.
*
* A menu is active when it can be opened or closed, meaning it's enabled
* and it's not part of a `ion-split-pane`.
*/
class_1.prototype.isActive = function () {
return Promise.resolve(this._isActive());
};
/**
* Opens the menu. If the menu is already open or it can't be opened,
* it returns `false`.
*/
class_1.prototype.open = function (animated) {
if (animated === void 0) { animated = true; }
return this.setOpen(true, animated);
};
/**
* Closes the menu. If the menu is already closed or it can't be closed,
* it returns `false`.
*/
class_1.prototype.close = function (animated) {
if (animated === void 0) { animated = true; }
return this.setOpen(false, animated);
};
/**
* Toggles the menu. If the menu is already open, it will try to close, otherwise it will try to open it.
* If the operation can't be completed successfully, it returns `false`.
*/
class_1.prototype.toggle = function (animated) {
if (animated === void 0) { animated = true; }
return this.setOpen(!this._isOpen, animated);
};
/**
* Opens or closes the button.
* If the operation can't be completed successfully, it returns `false`.
*/
class_1.prototype.setOpen = function (shouldOpen, animated) {
if (animated === void 0) { animated = true; }
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"]._setOpen(this, shouldOpen, animated);
};
class_1.prototype._setOpen = function (shouldOpen, animated) {
if (animated === void 0) { animated = true; }
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) {
switch (_a.label) {
case 0:
// If the menu is disabled or it is currently being animated, let's do nothing
if (!this._isActive() || this.isAnimating || shouldOpen === this._isOpen) {
return [2 /*return*/, false];
}
this.beforeAnimation(shouldOpen);
return [4 /*yield*/, this.loadAnimation()];
case 1:
_a.sent();
return [4 /*yield*/, this.startAnimation(shouldOpen, animated)];
case 2:
_a.sent();
this.afterAnimation(shouldOpen);
return [2 /*return*/, true];
}
});
});
};
class_1.prototype.loadAnimation = function () {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
var width, _a;
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_b) {
switch (_b.label) {
case 0:
width = this.menuInnerEl.offsetWidth;
if (width === this.width && this.animation !== undefined) {
return [2 /*return*/];
}
this.width = width;
// Destroy existing animation
if (this.animation) {
this.animation.destroy();
this.animation = undefined;
}
// Create new animation
_a = this;
return [4 /*yield*/, _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"]._createAnimation(this.type, this)];
case 1:
// Create new animation
_a.animation = _b.sent();
if (!_config_3c7f3790_js__WEBPACK_IMPORTED_MODULE_2__["b"].getBoolean('animated', true)) {
this.animation.duration(0);
}
this.animation.fill('both');
return [2 /*return*/];
}
});
});
};
class_1.prototype.startAnimation = function (shouldOpen, animated) {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
var isReversed, ani;
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) {
switch (_a.label) {
case 0:
isReversed = !shouldOpen;
ani = this.animation
.direction((isReversed) ? 'reverse' : 'normal')
.easing((isReversed) ? 'cubic-bezier(0.4, 0.0, 0.6, 1)' : 'cubic-bezier(0.0, 0.0, 0.2, 1)');
if (!animated) return [3 /*break*/, 2];
return [4 /*yield*/, ani.playAsync()];
case 1:
_a.sent();
return [3 /*break*/, 3];
case 2:
ani.playSync();
_a.label = 3;
case 3: return [2 /*return*/];
}
});
});
};
class_1.prototype._isActive = function () {
return !this.disabled && !this.isPaneVisible;
};
class_1.prototype.canSwipe = function () {
return this.swipeGesture && !this.isAnimating && this._isActive();
};
class_1.prototype.canStart = function (detail) {
if (!this.canSwipe()) {
return false;
}
if (this._isOpen) {
return true;
// TODO error
}
else if (_index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"]._getOpenSync()) {
return false;
}
return checkEdgeSide(window, detail.currentX, this.isEndSide, this.maxEdgeStart);
};
class_1.prototype.onWillStart = function () {
this.beforeAnimation(!this._isOpen);
return this.loadAnimation();
};
class_1.prototype.onStart = function () {
if (!this.isAnimating || !this.animation) {
Object(_helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__["b"])(false, 'isAnimating has to be true');
return;
}
// the cloned animation should not use an easing curve during seek
this.animation
.direction((this._isOpen) ? 'reverse' : 'normal')
.progressStart(true);
};
class_1.prototype.onMove = function (detail) {
if (!this.isAnimating || !this.animation) {
Object(_helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__["b"])(false, 'isAnimating has to be true');
return;
}
var delta = computeDelta(detail.deltaX, this._isOpen, this.isEndSide);
var stepValue = delta / this.width;
this.animation.progressStep(stepValue);
};
class_1.prototype.onEnd = function (detail) {
var _this = this;
if (!this.isAnimating || !this.animation) {
Object(_helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__["b"])(false, 'isAnimating has to be true');
return;
}
var isOpen = this._isOpen;
var isEndSide = this.isEndSide;
var delta = computeDelta(detail.deltaX, isOpen, isEndSide);
var width = this.width;
var stepValue = delta / width;
var velocity = detail.velocityX;
var z = width / 2.0;
var shouldCompleteRight = velocity >= 0 && (velocity > 0.2 || detail.deltaX > z);
var shouldCompleteLeft = velocity <= 0 && (velocity < -0.2 || detail.deltaX < -z);
var shouldComplete = isOpen
? isEndSide ? shouldCompleteRight : shouldCompleteLeft
: isEndSide ? shouldCompleteLeft : shouldCompleteRight;
var shouldOpen = !isOpen && shouldComplete;
if (isOpen && !shouldComplete) {
shouldOpen = true;
}
this.lastOnEnd = detail.timeStamp;
// Account for rounding errors in JS
var newStepValue = (shouldComplete) ? 0.001 : -0.001;
/**
* TODO: stepValue can sometimes return a negative
* value, but you can't have a negative time value
* for the cubic bezier curve (at least with web animations)
* Not sure if the negative step value is an error or not
*/
var adjustedStepValue = (stepValue <= 0) ? 0.01 : stepValue;
/**
* Animation will be reversed here, so need to
* reverse the easing curve as well
*
* Additionally, we need to account for the time relative
* to the new easing curve, as `stepValue` is going to be given
* in terms of a linear curve.
*/
newStepValue += Object(_cubic_bezier_2812fda3_js__WEBPACK_IMPORTED_MODULE_8__["g"])(new _cubic_bezier_2812fda3_js__WEBPACK_IMPORTED_MODULE_8__["P"](0, 0), new _cubic_bezier_2812fda3_js__WEBPACK_IMPORTED_MODULE_8__["P"](0.4, 0), new _cubic_bezier_2812fda3_js__WEBPACK_IMPORTED_MODULE_8__["P"](0.6, 1), new _cubic_bezier_2812fda3_js__WEBPACK_IMPORTED_MODULE_8__["P"](1, 1), Object(_helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__["c"])(0, adjustedStepValue, 1));
this.animation
.easing('cubic-bezier(0.4, 0.0, 0.6, 1)')
.onFinish(function () { return _this.afterAnimation(shouldOpen); }, { oneTimeCallback: true })
.progressEnd(shouldComplete ? 1 : 0, newStepValue, 300);
};
class_1.prototype.beforeAnimation = function (shouldOpen) {
Object(_helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__["b"])(!this.isAnimating, '_before() should not be called while animating');
// this places the menu into the correct location before it animates in
// this css class doesn't actually kick off any animations
this.el.classList.add(SHOW_MENU);
if (this.backdropEl) {
this.backdropEl.classList.add(SHOW_BACKDROP);
}
this.blocker.block();
this.isAnimating = true;
if (shouldOpen) {
this.ionWillOpen.emit();
}
else {
this.ionWillClose.emit();
}
};
class_1.prototype.afterAnimation = function (isOpen) {
Object(_helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__["b"])(this.isAnimating, '_before() should be called while animating');
// keep opening/closing the menu disabled for a touch more yet
// only add listeners/css if it's enabled and isOpen
// and only remove listeners/css if it's not open
// emit opened/closed events
this._isOpen = isOpen;
this.isAnimating = false;
if (!this._isOpen) {
this.blocker.unblock();
}
if (isOpen) {
// add css class
if (this.contentEl) {
this.contentEl.classList.add(MENU_CONTENT_OPEN);
}
// emit open event
this.ionDidOpen.emit();
}
else {
// remove css classes
this.el.classList.remove(SHOW_MENU);
if (this.contentEl) {
this.contentEl.classList.remove(MENU_CONTENT_OPEN);
}
if (this.backdropEl) {
this.backdropEl.classList.remove(SHOW_BACKDROP);
}
if (this.animation) {
this.animation.stop();
}
// emit close event
this.ionDidClose.emit();
}
};
class_1.prototype.updateState = function () {
var isActive = this._isActive();
if (this.gesture) {
this.gesture.setDisabled(!isActive || !this.swipeGesture);
}
// Close menu immediately
if (!isActive && this._isOpen) {
// close if this menu is open, and should not be enabled
this.forceClosing();
}
if (!this.disabled) {
_index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"]._setActiveMenu(this);
}
Object(_helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__["b"])(!this.isAnimating, 'can not be animating');
};
class_1.prototype.forceClosing = function () {
Object(_helpers_46f4a262_js__WEBPACK_IMPORTED_MODULE_3__["b"])(this._isOpen, 'menu cannot be closed');
this.isAnimating = true;
var ani = this.animation.direction('reverse');
ani.playSync();
this.afterAnimation(false);
};
class_1.prototype.render = function () {
var _a;
var _this = this;
var _b = this, isEndSide = _b.isEndSide, type = _b.type, disabled = _b.disabled, mode = _b.mode, isPaneVisible = _b.isPaneVisible;
return (Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["H"], { role: "navigation", class: (_a = {},
_a[mode] = true,
_a["menu-type-" + type] = true,
_a['menu-enabled'] = !disabled,
_a['menu-side-end'] = isEndSide,
_a['menu-side-start'] = !isEndSide,
_a['menu-pane-visible'] = isPaneVisible,
_a) }, Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])("div", { class: "menu-inner", ref: function (el) { return _this.menuInnerEl = el; } }, Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])("slot", null)), Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])("ion-backdrop", { ref: function (el) { return _this.backdropEl = el; }, class: "menu-backdrop", tappable: false, stopPropagation: false })));
};
Object.defineProperty(class_1.prototype, "el", {
get: function () { return Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["e"])(this); },
enumerable: true,
configurable: true
});
Object.defineProperty(class_1, "watchers", {
get: function () {
return {
"type": ["typeChanged"],
"disabled": ["disabledChanged"],
"side": ["sideChanged"],
"swipeGesture": ["swipeGestureChanged"]
};
},
enumerable: true,
configurable: true
});
Object.defineProperty(class_1, "style", {
get: function () { return ":host{--width:304px;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--background:var(--ion-background-color,#fff);left:0;right:0;top:0;bottom:0;display:none;position:absolute;contain:strict}:host(.show-menu){display:block}.menu-inner{left:0;right:auto;top:0;bottom:0;-webkit-transform:translate3d(-9999px,0,0);transform:translate3d(-9999px,0,0);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);contain:strict}:host-context([dir=rtl]) .menu-inner,[dir=rtl] .menu-inner{left:unset;right:unset;left:auto;right:0;-webkit-transform:translate3d(calc(-1 * -9999px),0,0);transform:translate3d(calc(-1 * -9999px),0,0)}:host(.menu-side-start) .menu-inner{--ion-safe-area-right:0px;right:auto;left:0}:host(.menu-side-end) .menu-inner{--ion-safe-area-left:0px;right:0;left:auto}ion-backdrop{display:none;opacity:.01;z-index:-1}\@media (max-width:340px){.menu-inner{--width:264px}}:host(.menu-type-reveal){z-index:0}:host(.menu-type-reveal.show-menu) .menu-inner{-webkit-transform:translateZ(0);transform:translateZ(0)}:host(.menu-type-overlay){z-index:1000}:host(.menu-type-overlay) .show-backdrop{display:block;cursor:pointer}:host(.menu-pane-visible) .menu-inner{left:0;right:0;width:auto;-webkit-transform:none!important;transform:none!important;-webkit-box-shadow:none!important;box-shadow:none!important}:host(.menu-pane-visible) ion-backdrop{display:hidden!important}:host(.menu-type-push){z-index:1000}:host(.menu-type-push) .show-backdrop{display:block}"; },
enumerable: true,
configurable: true
});
return class_1;
}());
var computeDelta = function (deltaX, isOpen, isEndSide) {
return Math.max(0, isOpen !== isEndSide ? -deltaX : deltaX);
};
var checkEdgeSide = function (win, posX, isEndSide, maxEdgeStart) {
if (isEndSide) {
return posX >= win.innerWidth - maxEdgeStart;
}
else {
return posX <= maxEdgeStart;
}
};
var SHOW_MENU = 'show-menu';
var SHOW_BACKDROP = 'show-backdrop';
var MENU_CONTENT_OPEN = 'menu-content-open';
// Given a menu, return whether or not the menu toggle should be visible
var updateVisibility = function (menu) { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(void 0, void 0, void 0, function () {
var menuEl, _a;
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].get(menu)];
case 1:
menuEl = _b.sent();
_a = menuEl;
if (!_a) return [3 /*break*/, 3];
return [4 /*yield*/, menuEl.isActive()];
case 2:
_a = (_b.sent());
_b.label = 3;
case 3: return [2 /*return*/, !!(_a)];
}
});
}); };
var MenuButton = /** @class */ (function () {
function class_2(hostRef) {
var _this = this;
Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["r"])(this, hostRef);
this.visible = false;
/**
* If `true`, the user cannot interact with the menu button.
*/
this.disabled = false;
/**
* Automatically hides the menu button when the corresponding menu is not active
*/
this.autoHide = true;
/**
* The type of the button.
*/
this.type = 'button';
this.onClick = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(_this, void 0, void 0, function () {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) {
return [2 /*return*/, _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].toggle(this.menu)];
});
}); };
}
class_2.prototype.componentDidLoad = function () {
this.visibilityChanged();
};
class_2.prototype.visibilityChanged = function () {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
var _a;
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_b) {
switch (_b.label) {
case 0:
_a = this;
return [4 /*yield*/, updateVisibility(this.menu)];
case 1:
_a.visible = _b.sent();
return [2 /*return*/];
}
});
});
};
class_2.prototype.render = function () {
var _a;
var _b = this, color = _b.color, disabled = _b.disabled;
var mode = Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["d"])(this);
var menuIcon = _config_3c7f3790_js__WEBPACK_IMPORTED_MODULE_2__["b"].get('menuIcon', 'menu');
var hidden = this.autoHide && !this.visible;
var attrs = {
type: this.type
};
return (Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["H"], { onClick: this.onClick, "aria-disabled": disabled ? 'true' : null, "aria-hidden": hidden ? 'true' : null, class: Object.assign(Object.assign((_a = {}, _a[mode] = true, _a), Object(_theme_18cbe2cc_js__WEBPACK_IMPORTED_MODULE_7__["c"])(color)), { 'button': true, 'menu-button-hidden': hidden, 'menu-button-disabled': disabled, 'ion-activatable': true, 'ion-focusable': true }) }, Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])("button", Object.assign({}, attrs, { disabled: disabled, class: "button-native" }), Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])("slot", null, Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])("ion-icon", { icon: menuIcon, mode: mode, lazy: false })), mode === 'md' && Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])("ion-ripple-effect", { type: "unbounded" }))));
};
Object.defineProperty(class_2, "style", {
get: function () { return ":host{--background:transparent;--color-focused:var(--color);--border-radius:initial;--padding-top:0;--padding-bottom:0;color:var(--color);text-align:center;text-decoration:none;text-overflow:ellipsis;text-transform:none;white-space:nowrap;-webkit-font-kerning:none;font-kerning:none}.button-native{border-radius:var(--border-radius);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:-ms-flexbox;display:flex;position:relative;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%;border:0;outline:none;background:var(--background);line-height:1;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}\@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}ion-icon{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;pointer-events:none}:host(.menu-button-hidden){display:none}:host(.menu-button-disabled){cursor:default;opacity:.5;pointer-events:none}\@media (any-hover:hover){:host(:hover) .button-native{background:var(--background-hover);color:var(--color-hover)}}:host(.ion-focused) .button-native{background:var(--background-focused);color:var(--color-focused)}:host(.ion-color) .button-native{color:var(--ion-color-base)}:host-context(ion-toolbar:not(.ion-color)){color:var(--ion-toolbar-color,var(--color))}:host{--background-focused:rgba(var(--ion-color-primary-rgb,56,128,255),0.1);--border-radius:4px;--color:var(--ion-color-primary,#3880ff);--padding-start:5px;--padding-end:5px;height:32px;font-size:31px}:host(.activated){opacity:.4}\@media (any-hover:hover){:host(:hover){opacity:.6}}:host(.ion-color.ion-focused) .button-native{background:rgba(var(--ion-color-base-rgb),.1)}"; },
enumerable: true,
configurable: true
});
return class_2;
}());
var MenuController = /** @class */ (function () {
function class_3(hostRef) {
Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["r"])(this, hostRef);
}
/**
* Open the menu. If a menu is not provided then it will open the first
* menu found. If the specified menu is `start` or `end`, then it will open
* the enabled menu on that side. Otherwise, it will try to find the menu
* using the menu's `id` property. If a menu is not found then it will
* return `false`.
*
* @param menu The menuId or side of the menu to open.
*/
class_3.prototype.open = function (menu) {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].open(menu);
};
/**
* Close the menu. If a menu is specified, it will close that menu.
* If no menu is specified, then it will close any menu that is open.
* If it does not find any open menus, it will return `false`.
*
* @param menu The menuId or side of the menu to close.
*/
class_3.prototype.close = function (menu) {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].close(menu);
};
/**
* Toggle the menu open or closed. If the menu is already open, it will try to
* close the menu, otherwise it will try to open it. Returns `false` if
* a menu is not found.
*
* @param menu The menuId or side of the menu to toggle.
*/
class_3.prototype.toggle = function (menu) {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].toggle(menu);
};
/**
* Enable or disable a menu. Disabling a menu will not allow gestures
* for that menu or any calls to open it. This is useful when there are
* multiple menus on the same side and only one of them should be allowed
* to open. Enabling a menu will automatically disable all other menus
* on that side.
*
* @param enable If `true`, the menu should be enabled.
* @param menu The menuId or side of the menu to enable or disable.
*/
class_3.prototype.enable = function (enable, menu) {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].enable(enable, menu);
};
/**
* Enable or disable the ability to swipe open the menu.
*
* @param enable If `true`, the menu swipe gesture should be enabled.
* @param menu The menuId or side of the menu to enable or disable the swipe gesture on.
*/
class_3.prototype.swipeGesture = function (enable, menu) {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].swipeGesture(enable, menu);
};
/**
* Get whether or not the menu is open. Returns `true` if the specified
* menu is open. If a menu is not specified, it will return `true` if
* any menu is currently open.
*
* @param menu The menuId or side of the menu that is being checked.
*/
class_3.prototype.isOpen = function (menu) {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].isOpen(menu);
};
/**
* Get whether or not the menu is enabled. Returns `true` if the
* specified menu is enabled. Returns `false` if a menu is disabled
* or not found.
*
* @param menu The menuId or side of the menu that is being checked.
*/
class_3.prototype.isEnabled = function (menu) {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].isEnabled(menu);
};
/**
* Get a menu instance. If a menu is not provided then it will return the first
* menu found. If the specified menu is `start` or `end`, then it will return the
* enabled menu on that side. Otherwise, it will try to find the menu using the menu's
* `id` property. If a menu is not found then it will return `null`.
*
* @param menu The menuId or side of the menu.
*/
class_3.prototype.get = function (menu) {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].get(menu);
};
/**
* Get the instance of the opened menu. Returns `null` if a menu is not found.
*/
class_3.prototype.getOpen = function () {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].getOpen();
};
/**
* Get all menu instances.
*/
class_3.prototype.getMenus = function () {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].getMenus();
};
/**
* Get whether or not a menu is animating. Returns `true` if any
* menu is currently animating.
*/
class_3.prototype.isAnimating = function () {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].isAnimating();
};
/**
* Registers a new animation that can be used with any `ion-menu` by
* passing the name of the animation in its `type` property.
*
* @param name The name of the animation to register.
* @param animation The animation function to register.
*/
class_3.prototype.registerAnimation = function (name, animation) {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) {
return [2 /*return*/, _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].registerAnimation(name, animation)];
});
});
};
return class_3;
}());
var MenuToggle = /** @class */ (function () {
function class_4(hostRef) {
var _this = this;
Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["r"])(this, hostRef);
this.visible = false;
/**
* Automatically hides the content when the corresponding menu is not active.
*
* By default, it's `true`. Change it to `false` in order to
* keep `ion-menu-toggle` always visible regardless the state of the menu.
*/
this.autoHide = true;
this.onClick = function () {
return _index_1e5940d5_js__WEBPACK_IMPORTED_MODULE_6__["m"].toggle(_this.menu);
};
}
class_4.prototype.connectedCallback = function () {
this.visibilityChanged();
};
class_4.prototype.visibilityChanged = function () {
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () {
var _a;
return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_b) {
switch (_b.label) {
case 0:
_a = this;
return [4 /*yield*/, updateVisibility(this.menu)];
case 1:
_a.visible = _b.sent();
return [2 /*return*/];
}
});
});
};
class_4.prototype.render = function () {
var _a;
var mode = Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["d"])(this);
var hidden = this.autoHide && !this.visible;
return (Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["H"], { onClick: this.onClick, "aria-hidden": hidden ? 'true' : null, class: (_a = {},
_a[mode] = true,
_a['menu-toggle-hidden'] = hidden,
_a) }, Object(_core_ca0488fc_js__WEBPACK_IMPORTED_MODULE_1__["h"])("slot", null)));
};
Object.defineProperty(class_4, "style", {
get: function () { return ":host(.menu-toggle-hidden){display:none}"; },
enumerable: true,
configurable: true
});
return class_4;
}());
/***/ })
}]);
//# sourceMappingURL=39.js.map