@aquera/nile-elements 1.9.11 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/demo/nxtgen-dark.css +2265 -0
- package/dist/{index-6832c52b.cjs.js → index-3ca67627.cjs.js} +2 -2
- package/dist/{index-6832c52b.cjs.js.map → index-3ca67627.cjs.js.map} +1 -1
- package/dist/{index-f956f56d.cjs.js → index-403841c7.cjs.js} +2 -2
- package/dist/{index-f956f56d.cjs.js.map → index-403841c7.cjs.js.map} +1 -1
- package/dist/{index-50880eb7.cjs.js → index-c3210a9c.cjs.js} +2 -2
- package/dist/{index-50880eb7.cjs.js.map → index-c3210a9c.cjs.js.map} +1 -1
- package/dist/index-ccff99d6.esm.js +1 -0
- package/dist/index-e43755f5.cjs.js +2 -0
- package/dist/index-e43755f5.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +362 -350
- package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.esm.js +1 -1
- package/dist/nile-calendar/nile-calendar.esm.js +10 -10
- package/dist/nile-carousel/nile-carousel.cjs.js +1 -1
- package/dist/nile-carousel/nile-carousel.cjs.js.map +1 -1
- package/dist/nile-carousel/nile-carousel.esm.js +2 -0
- package/dist/nile-code-editor/extensionSetup.cjs.js +7 -7
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/index.cjs.js +1 -1
- package/dist/nile-code-editor/index.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.esm.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
- package/dist/nile-code-editor/theme.cjs.js +1 -1
- package/dist/nile-code-editor/theme.cjs.js.map +1 -1
- package/dist/nile-code-editor/theme.esm.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.css.cjs.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.css.cjs.js.map +1 -1
- package/dist/nile-color-picker/nile-color-picker.css.esm.js +1 -1
- package/dist/nile-context-menu/index.cjs.js +1 -1
- package/dist/nile-context-menu/nile-context-menu.cjs.js +1 -1
- package/dist/nile-context-submenu/index.cjs.js +1 -1
- package/dist/nile-context-submenu/nile-context-submenu.cjs.js +1 -1
- package/dist/nile-detail/index.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.cjs.js.map +1 -1
- package/dist/nile-drawer/nile-drawer.css.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.css.cjs.js.map +1 -1
- package/dist/nile-drawer/nile-drawer.css.esm.js +2 -1
- package/dist/nile-drawer/nile-drawer.esm.js +1 -1
- package/dist/nile-error-message/nile-error-message.css.cjs.js +1 -1
- package/dist/nile-error-message/nile-error-message.css.cjs.js.map +1 -1
- package/dist/nile-error-message/nile-error-message.css.esm.js +4 -3
- package/dist/nile-error-notification/nile-error-notification.css.cjs.js +1 -1
- package/dist/nile-error-notification/nile-error-notification.css.cjs.js.map +1 -1
- package/dist/nile-error-notification/nile-error-notification.css.esm.js +1 -1
- package/dist/nile-floating-panel/index.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.esm.js +1 -0
- package/dist/nile-lite-tooltip/index.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.css.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.css.cjs.js.map +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.css.esm.js +1 -1
- package/dist/nile-popup/nile-popup.css.cjs.js +1 -1
- package/dist/nile-popup/nile-popup.css.cjs.js.map +1 -1
- package/dist/nile-popup/nile-popup.css.esm.js +5 -4
- package/dist/nile-tooltip/nile-tooltip.css.cjs.js +1 -1
- package/dist/nile-tooltip/nile-tooltip.css.cjs.js.map +1 -1
- package/dist/nile-tooltip/nile-tooltip.css.esm.js +7 -1
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/src/nile-calendar/nile-calendar.css.js +1 -1
- package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.js +4 -4
- package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/dist/src/nile-carousel/nile-carousel.js +2 -0
- package/dist/src/nile-carousel/nile-carousel.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.css.js +2 -2
- package/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.js +4 -3
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-code-editor/theme.d.ts +118 -2
- package/dist/src/nile-code-editor/theme.js +169 -19
- package/dist/src/nile-code-editor/theme.js.map +1 -1
- package/dist/src/nile-color-picker/nile-color-picker.css.js +12 -12
- package/dist/src/nile-color-picker/nile-color-picker.css.js.map +1 -1
- package/dist/src/nile-drawer/nile-drawer.css.js +2 -1
- package/dist/src/nile-drawer/nile-drawer.css.js.map +1 -1
- package/dist/src/nile-drawer/nile-drawer.js +1 -1
- package/dist/src/nile-drawer/nile-drawer.js.map +1 -1
- package/dist/src/nile-error-message/nile-error-message.css.js +2 -1
- package/dist/src/nile-error-message/nile-error-message.css.js.map +1 -1
- package/dist/src/nile-error-notification/nile-error-notification.css.js +1 -1
- package/dist/src/nile-error-notification/nile-error-notification.css.js.map +1 -1
- package/dist/src/nile-hero/nile-hero.css.js +1 -0
- package/dist/src/nile-hero/nile-hero.css.js.map +1 -1
- package/dist/src/nile-lite-tooltip/nile-lite-tooltip.css.js +1 -1
- package/dist/src/nile-lite-tooltip/nile-lite-tooltip.css.js.map +1 -1
- package/dist/src/nile-popup/nile-popup.css.js +3 -2
- package/dist/src/nile-popup/nile-popup.css.js.map +1 -1
- package/dist/src/nile-tooltip/nile-tooltip.css.js +7 -1
- package/dist/src/nile-tooltip/nile-tooltip.css.js.map +1 -1
- package/dist/src/version.js +2 -2
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-calendar/nile-calendar.css.ts +1 -1
- package/src/nile-calendar/nile-calendar.ts +4 -4
- package/src/nile-carousel/nile-carousel.ts +2 -0
- package/src/nile-code-editor/nile-code-editor.css.ts +2 -2
- package/src/nile-code-editor/nile-code-editor.ts +3 -3
- package/src/nile-code-editor/theme.ts +172 -19
- package/src/nile-color-picker/nile-color-picker.css.ts +12 -12
- package/src/nile-drawer/nile-drawer.css.ts +2 -1
- package/src/nile-drawer/nile-drawer.ts +1 -1
- package/src/nile-error-message/nile-error-message.css.ts +2 -1
- package/src/nile-error-notification/nile-error-notification.css.ts +1 -1
- package/src/nile-hero/nile-hero.css.ts +1 -0
- package/src/nile-lite-tooltip/nile-lite-tooltip.css.ts +1 -1
- package/src/nile-popup/nile-popup.css.ts +3 -2
- package/src/nile-tooltip/nile-tooltip.css.ts +7 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-context-menu.css.cjs.js","../internal/nile-element.cjs.js","../nile-floating-panel/nile-floating-panel.cjs.js","../nile-context-menu-group/nile-context-menu-group.cjs.js","../nile-context-menu-item/nile-context-menu-item.cjs.js","../nile-context-submenu/nile-context-submenu.cjs.js","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.cjs.js","../nile-floating-panel/nile-floating-panel.css.cjs.js","../tippy.esm-78baa8f2.cjs.js","../nile-lite-tooltip/utils.cjs.js","../utilities/visibility-manager.cjs.js","../nile-context-menu-group/nile-context-menu-group.css.cjs.js","../nile-context-menu-item/nile-context-menu-item.css.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,n,o,r,h,_templateObject,_c,l,u,a,m,d,p;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var n=0,F=function F(){};return{s:F,n:function(_n){function n(){return _n.apply(this,arguments);}n.toString=function(){return _n.toString();};return n;}(function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]};}),e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){e=_litDecoratorsJs.property;s=_litDecoratorsJs.query;n=_litDecoratorsJs.state;o=_litDecoratorsJs.customElement;},function(_nileContextMenuCssCjsJs){r=_nileContextMenuCssCjsJs.s;},function(_internalNileElementCjsJs){h=_internalNileElementCjsJs.N;},function(_nileFloatingPanelNileFloatingPanelCjsJs){},function(_nileContextMenuGroupNileContextMenuGroupCjsJs){},function(_nileContextMenuItemNileContextMenuItemCjsJs){},function(_nileContextSubmenuNileContextSubmenuCjsJs){},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){},function(_nileFloatingPanelNileFloatingPanelCssCjsJs){},function(_tippyEsm008CjsJs){},function(_nileLiteTooltipUtilsCjsJs){},function(_utilitiesVisibilityManagerCjsJs){},function(_nileContextMenuGroupNileContextMenuGroupCssCjsJs){},function(_nileContextMenuItemNileContextMenuItemCssCjsJs){}],execute:function execute(){l="nile-context-menu-item",u="nile-context-submenu",a="nile-context-menu__menu",m=["value","disabled"];d=0,_export("N",p=_c=/*#__PURE__*/function(_h){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,arguments),_this["for"]="",_this.trigger="right",_this.skipOn="",_this.zIndex=9999,_this.open=!1,_this.items=[],_this._items=[],_this._open=!1,_this._pinned=!1,_this._openContext=null,_this._targetEl=null,_this._previouslyFocused=null,_this._proxyId="nile-context-menu-anchor-"+ ++d,_this._wasDataMode=!1,_this._onPinnedReposition=function(){if(!_this._open||!_this._pinned||!_this._targetEl)return;var t=_this._targetEl.getBoundingClientRect();_this._positionProxyAt(t.left,t.bottom);},_this._menuContainerRef=null,_this._onKeydown=function(t){if(_this._open)switch(t.key){case"Escape":return t.preventDefault(),void _this.close("escape");case"Tab":return void _this.close("programmatic");case"ArrowDown":return t.preventDefault(),void _this._moveFocus(1);case"ArrowUp":return t.preventDefault(),void _this._moveFocus(-1);case"ArrowRight":{var _e$openSubmenu;var _this$_getFocusedItem=_this._getFocusedItemAnyLevel(),_i=_this$_getFocusedItem.item,_e=_i===null||_i===void 0?void 0:_i.querySelector(":scope > ".concat(u));if(!_e)return;return t.preventDefault(),(_e$openSubmenu=_e.openSubmenu)!==null&&_e$openSubmenu!==void 0&&_e$openSubmenu.call(_e),void requestAnimationFrame(function(){var _e$focusFirstItem;(_e$focusFirstItem=_e.focusFirstItem)===null||_e$focusFirstItem===void 0||_e$focusFirstItem.call(_e);});}case"ArrowLeft":{var _s$parentItem,_s$closeSubmenu,_s$parentItem2;var _this$_getFocusedItem2=_this._getFocusedItemAnyLevel(),_i2=_this$_getFocusedItem2.item,_e2=_this$_getFocusedItem2.container;if(!_i2||!_e2)return;var _s=_this._findSubmenuOwning(_e2);if(!_s)return;return t.preventDefault(),(_s$parentItem=_s.parentItem)!==null&&_s$parentItem!==void 0&&_s$parentItem.open||(_s$closeSubmenu=_s.closeSubmenu)!==null&&_s$closeSubmenu!==void 0&&_s$closeSubmenu.call(_s),void((_s$parentItem2=_s.parentItem)===null||_s$parentItem2===void 0?void 0:_s$parentItem2.focus());}case"Enter":case" ":{var _e3$openSubmenu;t.preventDefault();var _this$_getFocusedItem3=_this._getFocusedItemAnyLevel(),_i3=_this$_getFocusedItem3.item;if(!_i3||_i3.disabled)return;var _e3=_i3.querySelector(":scope > ".concat(u));return _e3?((_e3$openSubmenu=_e3.openSubmenu)!==null&&_e3$openSubmenu!==void 0&&_e3$openSubmenu.call(_e3),void requestAnimationFrame(function(){var _e3$shadowRoot;var t=(_e3$shadowRoot=_e3.shadowRoot)===null||_e3$shadowRoot===void 0?void 0:_e3$shadowRoot.querySelector(".".concat(a)),i=t?_this._enabledItemsIn(t)[0]:void 0;i===null||i===void 0||i.focus();})):void _this._selectItem(_i3);}}},_this._onScroll=function(t){if(!_this._open)return;if(_this._pinned)return void _this._onPinnedReposition();var i=t.composedPath();if(!_this._menuContainerRef||!i.includes(_this._menuContainerRef)){var _iterator=_createForOfIteratorHelper(i),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _t$classList;var _t=_step.value;if(_t instanceof HTMLElement&&(_t$classList=_t.classList)!==null&&_t$classList!==void 0&&_t$classList.contains(a))return;}}catch(err){_iterator.e(err);}finally{_iterator.f();}_this.close("programmatic");}},_this._onOutsidePointer=function(t){if(!_this._open)return;var i=t.composedPath();if(!_this._menuContainerRef||!i.includes(_this._menuContainerRef)){var _iterator2=_createForOfIteratorHelper(i),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _t2$classList;var _t2=_step2.value;if(_t2 instanceof HTMLElement&&(_t2$classList=_t2.classList)!==null&&_t2$classList!==void 0&&_t2$classList.contains(a))return;}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}_this.close("outside-click");}},_this._onDescendantSelect=function(t){var _t$detail;"click"===((_t$detail=t.detail)===null||_t$detail===void 0?void 0:_t$detail.type)&&_this.close("select");},_this._onPanelShown=function(t){t.stopPropagation(),_this._openPinnedSubmenus();},_this._onMenuMouseOver=function(t){var i=t.composedPath().find(function(t){return t instanceof HTMLElement&&t.tagName.toLowerCase()===l;});i&&!i.disabled&&i.focus();},_this._onMenuClick=function(t){var i=t.composedPath().find(function(t){return t instanceof HTMLElement&&t.tagName.toLowerCase()===l;});i&&!i.disabled&&(i.querySelector(":scope > ".concat(u))||_this._selectItem(i));};return _this;}_inherits(c,_h);return _createClass(c,[{key:"_isDataMode",get:function get(){return Array.isArray(this.items)&&this.items.length>0;}},{key:"connectedCallback",value:function connectedCallback(){var _this2=this;_superPropGet(c,"connectedCallback",this,3)([]),this._ensureProxy(),this._resolveTarget(),this._attachTriggers(),this._lightObserver=new MutationObserver(function(){_this2._isDataMode||_this2._relocateLightChildren();}),this._lightObserver.observe(this,{childList:!0}),this.open&&!this._open&&this.updateComplete.then(function(){_this2.isConnected&&_this2.open&&!_this2._open&&(_this2._pinned=!0,_this2._openAtTarget());});}},{key:"updated",value:function updated(t){_superPropGet(c,"updated",this,3)([t]),(t.has("for")||t.has("trigger")||t.has("skipOn"))&&this._open&&this.close("programmatic"),t.has("for")?(this._resolveTarget(),this._attachTriggers()):(t.has("trigger")||t.has("skipOn"))&&this._attachTriggers(),t.has("items")&&this._menuContainerRef&&(this._isDataMode?(this._renderDataItems(),this._wasDataMode=!0):this._wasDataMode&&(this._renderDataItems(),this._wasDataMode=!1)),t.has("open")&&(this.open&&!this._open?(this._pinned=!0,this._openAtTarget()):!this.open&&this._open&&this.close("programmatic"));}},{key:"_openAtTarget",value:function _openAtTarget(){var _this$_targetEl,_this$_targetEl2;var t=(_this$_targetEl=this._targetEl)===null||_this$_targetEl===void 0?void 0:_this$_targetEl.getBoundingClientRect();this.openAt({x:t?t.left:0,y:t?t.bottom:0,target:(_this$_targetEl2=this._targetEl)!==null&&_this$_targetEl2!==void 0?_this$_targetEl2:void 0});}},{key:"_resolveTarget",value:function _resolveTarget(){var _this$for,_this$getRootNode;var t=(_this$for=this["for"])===null||_this$for===void 0?void 0:_this$for.trim();if(!t)return void(this._targetEl=null);var i=(_this$getRootNode=this.getRootNode())!==null&&_this$getRootNode!==void 0?_this$getRootNode:document;/^[#.\[:]/.test(t)?this._targetEl=i.querySelector(t):this._targetEl="getElementById"in i?i.getElementById(t):document.getElementById(t);}},{key:"targetElement",get:function get(){return this._targetEl;}},{key:"_attachTriggers",value:function _attachTriggers(){var _this$_detachTriggers,_this3=this;(_this$_detachTriggers=this._detachTriggers)!==null&&_this$_detachTriggers!==void 0&&_this$_detachTriggers.call(this),this._detachTriggers=void 0;var t=this.trigger;if("manual"===t)return;var i=[];if("global"===t){var _this$skipOn$trim,_this$skipOn;var _t3=(_this$skipOn$trim=(_this$skipOn=this.skipOn)===null||_this$skipOn===void 0?void 0:_this$skipOn.trim())!==null&&_this$skipOn$trim!==void 0?_this$skipOn$trim:"",_e4=function _e4(i){return!(!i||!_t3)&&!!i.closest(_t3);},_s2=function _s2(t){var _i$target;var i=t;_e4(i.target)||(i.preventDefault(),_this3._open||_this3.openAt({x:i.clientX,y:i.clientY,target:(_i$target=i.target)!==null&&_i$target!==void 0?_i$target:void 0,originalEvent:i}));};return window.addEventListener("contextmenu",_s2,!0),i.push(function(){return window.removeEventListener("contextmenu",_s2,!0);}),void(this._detachTriggers=function(){return i.forEach(function(t){return t();});});}var e=this._targetEl;if(!e)return;var s="left"===t||"both"===t;if("right"===t||"both"===t){var _t4=function _t4(t){var i=t;i.preventDefault(),_this3.openAt({x:i.clientX,y:i.clientY,target:e,originalEvent:i});};e.addEventListener("contextmenu",_t4),i.push(function(){return e.removeEventListener("contextmenu",_t4);});}if(s){var _t5=function _t5(t){var i=t;_this3.openAt({x:i.clientX,y:i.clientY,target:e,originalEvent:i});};e.addEventListener("click",_t5),i.push(function(){return e.removeEventListener("click",_t5);});}0!==i.length&&(this._detachTriggers=function(){return i.forEach(function(t){return t();});});}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$_detachTriggers2,_this$_lightObserver,_this$_menuObserver,_this$_menuContainerR,_this$_menuContainerR2,_this$_menuContainerR3,_this$_proxyEl;_superPropGet(c,"disconnectedCallback",this,3)([]),_c._openInstances["delete"](this),this._open=!1,(_this$_detachTriggers2=this._detachTriggers)!==null&&_this$_detachTriggers2!==void 0&&_this$_detachTriggers2.call(this),this._detachTriggers=void 0,(_this$_lightObserver=this._lightObserver)!==null&&_this$_lightObserver!==void 0&&_this$_lightObserver.disconnect(),this._lightObserver=void 0,(_this$_menuObserver=this._menuObserver)!==null&&_this$_menuObserver!==void 0&&_this$_menuObserver.disconnect(),this._menuObserver=void 0,(_this$_menuContainerR=this._menuContainerRef)!==null&&_this$_menuContainerR!==void 0&&_this$_menuContainerR.removeEventListener("click",this._onMenuClick),(_this$_menuContainerR2=this._menuContainerRef)!==null&&_this$_menuContainerR2!==void 0&&_this$_menuContainerR2.removeEventListener("mouseover",this._onMenuMouseOver),(_this$_menuContainerR3=this._menuContainerRef)!==null&&_this$_menuContainerR3!==void 0&&_this$_menuContainerR3.removeEventListener("nile-change",this._onDescendantSelect),document.removeEventListener("pointerdown",this._onOutsidePointer,!0),document.removeEventListener("keydown",this._onKeydown,!0),window.removeEventListener("scroll",this._onScroll,!0),window.removeEventListener("resize",this._onPinnedReposition),(_this$_proxyEl=this._proxyEl)!==null&&_this$_proxyEl!==void 0&&_this$_proxyEl.remove(),this._proxyEl=void 0;}},{key:"firstUpdated",value:function firstUpdated(){var _this4=this;this._menuContainerRef=this.renderRoot.querySelector(".nile-context-menu__menu"),this._isDataMode?(this._renderDataItems(),this._wasDataMode=!0):this._relocateLightChildren(),this._menuContainerRef&&(this._menuObserver=new MutationObserver(function(){return _this4._parseChildren();}),this._menuObserver.observe(this._menuContainerRef,{childList:!0,subtree:!0,attributes:!0,attributeFilter:m}),this._menuContainerRef.addEventListener("click",this._onMenuClick),this._menuContainerRef.addEventListener("mouseover",this._onMenuMouseOver),this._menuContainerRef.addEventListener("nile-change",this._onDescendantSelect)),this._parseChildren();}},{key:"_ensureProxy",value:function _ensureProxy(){if(this._proxyEl)return;var t=document.createElement("div");t.id=this._proxyId,t.setAttribute("aria-hidden","true"),t.style.cssText="position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none;",document.body.appendChild(t),this._proxyEl=t;}},{key:"_positionProxyAt",value:function _positionProxyAt(t,i){if(this._proxyEl){if(this._pinned&&this._targetEl){var _t6=this._targetEl.getBoundingClientRect();return this._proxyEl.style.position="absolute",this._proxyEl.style.left="".concat(_t6.left+window.scrollX,"px"),this._proxyEl.style.top="".concat(_t6.top+window.scrollY,"px"),this._proxyEl.style.width="".concat(_t6.width,"px"),void(this._proxyEl.style.height="".concat(_t6.height,"px"));}this._proxyEl.style.position="fixed",this._proxyEl.style.left="".concat(t,"px"),this._proxyEl.style.top="".concat(i,"px"),this._proxyEl.style.width="0",this._proxyEl.style.height="0";}}},{key:"_relocateLightChildren",value:function _relocateLightChildren(){if(!this._menuContainerRef)return;var t=Array.from(this.children);if(0!==t.length){var _iterator3=_createForOfIteratorHelper(t),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _i4=_step3.value;this._menuContainerRef.appendChild(_i4);}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}}},{key:"_renderDataItems",value:function _renderDataItems(){var t=this._menuContainerRef;if(t){for(;t.firstChild;)t.removeChild(t.firstChild);var _iterator4=_createForOfIteratorHelper(this.items),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _i5=_step4.value;var _e5=this._createDataNode(_i5);_e5&&t.appendChild(_e5);}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}}},{key:"_createDataNode",value:function _createDataNode(t){if("group"===t.type){var _t$data;var _i6=document.createElement("nile-context-menu-group");t.name&&(_i6.label=t.name);var _iterator5=_createForOfIteratorHelper((_t$data=t.data)!==null&&_t$data!==void 0?_t$data:[]),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _e6=_step5.value;_i6.appendChild(this._createItemNode(_e6));}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}return _i6;}return null;}},{key:"_createItemNode",value:function _createItemNode(t){var _ref,_t$value;var i=document.createElement("nile-context-menu-item");if(t.id&&(i.id=t.id),i.value=(_ref=(_t$value=t.value)!==null&&_t$value!==void 0?_t$value:t.id)!==null&&_ref!==void 0?_ref:"",t.disabled&&(i.disabled=!0),t.open&&(i.open=!0),t.icon){var _e7=document.createElement("nile-glyph");_e7.setAttribute("slot","icon"),_e7.setAttribute("name",t.icon),t.iconSet&&_e7.setAttribute("set",t.iconSet),t.iconSize&&_e7.setAttribute("size",t.iconSize),t.iconMethod&&_e7.setAttribute("method",t.iconMethod),t.iconColor&&_e7.setAttribute("color",t.iconColor),i.appendChild(_e7);}if(i.appendChild(document.createTextNode(t.label)),t.submenu&&t.submenu.length>0){var _e8=document.createElement("nile-context-submenu");var _iterator6=_createForOfIteratorHelper(t.submenu),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _i7=_step6.value;var _t7=this._createDataNode(_i7);_t7&&_e8.appendChild(_t7);}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}i.appendChild(_e8);}return i;}},{key:"_parseChildren",value:function _parseChildren(){var _this$_menuContainerR4,_this5=this;var t=(_this$_menuContainerR4=this._menuContainerRef)!==null&&_this$_menuContainerR4!==void 0?_this$_menuContainerR4:this,i=Array.from(t.querySelectorAll(l));this._items=i.filter(function(i){return!_this5._isInsideDescendantSubmenu(i,t);});}},{key:"_isInsideDescendantSubmenu",value:function _isInsideDescendantSubmenu(t,i){var e=t.parentElement;for(;e&&e!==i;){if(e.tagName.toLowerCase()===u)return!0;e=e.parentElement;}return!1;}},{key:"menuItems",get:function get(){return this._items;}},{key:"getItemByValue",value:function getItemByValue(t){return this._items.find(function(i){return i.value===t;});}},{key:"isOpen",get:function get(){return this._open;}},{key:"openAt",value:function openAt(t){var _this6=this;if(!this._open){var _t$target,_t$originalEvent;var _iterator7=_createForOfIteratorHelper(_c._openInstances),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _t8=_step7.value;_t8!==this&&_t8.close("programmatic");}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}this._previouslyFocused=document.activeElement,this._openContext={x:t.x,y:t.y,target:(_t$target=t.target)!==null&&_t$target!==void 0?_t$target:null,originalEvent:(_t$originalEvent=t.originalEvent)!==null&&_t$originalEvent!==void 0?_t$originalEvent:null},this._ensureProxy(),this._positionProxyAt(t.x,t.y),this._open=!0,this.open=!0,_c._openInstances.add(this),document.addEventListener("pointerdown",this._onOutsidePointer,!0),document.addEventListener("keydown",this._onKeydown,!0),this._pinned&&window.addEventListener("resize",this._onPinnedReposition),requestAnimationFrame(function(){_this6._open&&window.addEventListener("scroll",_this6._onScroll,!0),requestAnimationFrame(function(){return _this6._openPinnedSubmenus();});}),this.emit("nile-change",_objectSpread({type:"open"},this._openContext));}}},{key:"close",value:function close(){var _this$_menuContainerR5,_this$_previouslyFocu,_this$_previouslyFocu2;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"programmatic";if(!this._open)return;this._open=!1,this.open=!1,this._pinned=!1,this._openContext=null,_c._openInstances["delete"](this);var i=(_this$_menuContainerR5=this._menuContainerRef)===null||_this$_menuContainerR5===void 0?void 0:_this$_menuContainerR5.querySelectorAll(u);i!==null&&i!==void 0&&i.forEach(function(t){var _t$closeSubmenu;return(_t$closeSubmenu=t.closeSubmenu)===null||_t$closeSubmenu===void 0?void 0:_t$closeSubmenu.call(t);}),document.removeEventListener("pointerdown",this._onOutsidePointer,!0),document.removeEventListener("keydown",this._onKeydown,!0),window.removeEventListener("scroll",this._onScroll,!0),window.removeEventListener("resize",this._onPinnedReposition);var e=document.activeElement;(e===this||this._items.some(function(t){var _t$shadowRoot;return t===e||((_t$shadowRoot=t.shadowRoot)===null||_t$shadowRoot===void 0?void 0:_t$shadowRoot.contains(e));}))&&(_this$_previouslyFocu=this._previouslyFocused)!==null&&_this$_previouslyFocu!==void 0&&(_this$_previouslyFocu2=_this$_previouslyFocu.focus)!==null&&_this$_previouslyFocu2!==void 0&&_this$_previouslyFocu2.call(_this$_previouslyFocu),this._previouslyFocused=null,this.emit("nile-change",{type:"close",reason:t});}},{key:"_enabledItems",value:function _enabledItems(){return this._items.filter(function(t){return!t.disabled;});}},{key:"_getFocusedItem",value:function _getFocusedItem(){var t=document.activeElement;var _iterator8=_createForOfIteratorHelper(this._items),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _i8$shadowRoot;var _i8=_step8.value;if(_i8===t||(_i8$shadowRoot=_i8.shadowRoot)!==null&&_i8$shadowRoot!==void 0&&_i8$shadowRoot.contains(t))return _i8;}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}return null;}},{key:"_getFocusedItemAnyLevel",value:function _getFocusedItemAnyLevel(){var t=document.activeElement;for(;t&&((_t$tagName=t.tagName)===null||_t$tagName===void 0?void 0:_t$tagName.toLowerCase())!==l;){var _t$tagName;var _i9=t.getRootNode();t=_i9 instanceof ShadowRoot?_i9.host:t.parentElement;}if(!t)return{item:null,container:null};var i=t.closest(".".concat(a));return{item:t,container:i};}},{key:"_enabledItemsIn",value:function _enabledItemsIn(t){var _this7=this;return Array.from(t.querySelectorAll(l)).filter(function(i){return!i.disabled&&!_this7._isInsideDescendantSubmenu(i,t);});}},{key:"_focusFirstEnabled",value:function _focusFirstEnabled(){var _t$;var t=this._enabledItems();(_t$=t[0])===null||_t$===void 0||_t$.focus();}},{key:"_moveFocus",value:function _moveFocus(t){var _ref2;var _this$_getFocusedItem4=this._getFocusedItemAnyLevel(),i=_this$_getFocusedItem4.item,e=_this$_getFocusedItem4.container,s=(_ref2=e!==null&&e!==void 0?e:this._menuContainerRef)!==null&&_ref2!==void 0?_ref2:this,n=this._enabledItemsIn(s);if(0===n.length)return;var o=i?n.indexOf(i):-1;n[((o+t)%n.length+n.length)%n.length].focus();}},{key:"_findSubmenuOwning",value:function _findSubmenuOwning(t){var _i$findByContainer,_i$findByContainer2;var i=window.customElements.get(u);return(_i$findByContainer=i===null||i===void 0||(_i$findByContainer2=i.findByContainer)===null||_i$findByContainer2===void 0?void 0:_i$findByContainer2.call(i,t))!==null&&_i$findByContainer!==void 0?_i$findByContainer:null;}},{key:"_stop",value:function _stop(t){t.stopPropagation();}},{key:"_openPinnedSubmenus",value:function _openPinnedSubmenus(){if(this._open&&this._menuContainerRef){var _iterator9=_createForOfIteratorHelper(this._items),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _i10$openSubmenu;var _t9=_step9.value;if(!_t9.open||_t9.disabled)continue;var _i10=_t9.querySelector(":scope > ".concat(u));_i10===null||_i10===void 0||(_i10$openSubmenu=_i10.openSubmenu)===null||_i10$openSubmenu===void 0||_i10$openSubmenu.call(_i10);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}}}},{key:"_selectItem",value:function _selectItem(t){var _t$textContent,_this$_openContext$ta,_this$_openContext,_this$_openContext$or,_this$_openContext2;var i={id:t.id,value:t.value,name:((_t$textContent=t.textContent)!==null&&_t$textContent!==void 0?_t$textContent:"").trim(),target:(_this$_openContext$ta=(_this$_openContext=this._openContext)===null||_this$_openContext===void 0?void 0:_this$_openContext.target)!==null&&_this$_openContext$ta!==void 0?_this$_openContext$ta:null,originalEvent:(_this$_openContext$or=(_this$_openContext2=this._openContext)===null||_this$_openContext2===void 0?void 0:_this$_openContext2.originalEvent)!==null&&_this$_openContext$or!==void 0?_this$_openContext$or:null};try{var _t$onSelect;(_t$onSelect=t.onSelect)===null||_t$onSelect===void 0||_t$onSelect.call(t,i);}catch(t){console.error("[nile-context-menu] onSelect callback threw:",t);}this.emit("nile-change",_objectSpread({type:"click"},i)),this.close("select");}},{key:"render",value:function render(){return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-floating-panel\n for=","\n trigger=\"manual\"\n placement=\"bottom-start\"\n panelClass=\"nile-context-menu-panel\"\n .zIndex=","\n ?open=","\n .interactive=","\n .hideOnClick=","\n .closeOnEscape=","\n .arrow=","\n .distance=","\n @nile-init=","\n @nile-destroy=","\n @nile-show=","\n @nile-hide=","\n @nile-after-show=","\n @nile-after-hide=","\n @nile-toggle=","\n @nile-visibility-change=","\n >\n <div class=\"nile-context-menu__menu\" role=\"menu\"></div>\n </nile-floating-panel>\n "])),this._proxyId,this.zIndex,this._open,!0,!1,!1,"none",0,this._stop,this._stop,this._stop,this._stop,this._onPanelShown,this._stop,this._stop,this._stop);}}],[{key:"styles",get:function get(){return[r];}}]);}(h));p._openInstances=new Set(),t([e({attribute:!0,type:String,reflect:!0})],p.prototype,"for",void 0),t([e({attribute:!0,type:String,reflect:!0})],p.prototype,"trigger",void 0),t([e({attribute:!0,type:String,reflect:!0})],p.prototype,"skipOn",void 0),t([e({attribute:!0,type:Number,reflect:!0})],p.prototype,"zIndex",void 0),t([e({attribute:!0,type:Boolean,reflect:!0})],p.prototype,"open",void 0),t([e({attribute:!1})],p.prototype,"items",void 0),t([s("nile-floating-panel")],p.prototype,"_floatingPanel",void 0),t([n()],p.prototype,"_items",void 0),t([n()],p.prototype,"_open",void 0),_export("N",p=_c=t([o("nile-context-menu")],p));}};});
|
|
1
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-context-menu.css.cjs.js","../internal/nile-element.cjs.js","../nile-floating-panel/nile-floating-panel.cjs.js","../nile-context-menu-group/nile-context-menu-group.cjs.js","../nile-context-menu-item/nile-context-menu-item.cjs.js","../nile-context-submenu/nile-context-submenu.cjs.js","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.cjs.js","../nile-floating-panel/nile-floating-panel.css.cjs.js","../tippy.esm-78baa8f2.cjs.js","../nile-lite-tooltip/utils.cjs.js","../utilities/visibility-manager.cjs.js","../nile-context-menu-group/nile-context-menu-group.css.cjs.js","../nile-context-menu-item/nile-context-menu-item.css.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,n,o,r,h,_templateObject,_c,l,u,a,m,d,p;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var n=0,F=function F(){};return{s:F,n:function(_n){function n(){return _n.apply(this,arguments);}n.toString=function(){return _n.toString();};return n;}(function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]};}),e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){e=_litDecoratorsJs.property;s=_litDecoratorsJs.query;n=_litDecoratorsJs.state;o=_litDecoratorsJs.customElement;},function(_nileContextMenuCssCjsJs){r=_nileContextMenuCssCjsJs.s;},function(_internalNileElementCjsJs){h=_internalNileElementCjsJs.N;},function(_nileFloatingPanelNileFloatingPanelCjsJs){},function(_nileContextMenuGroupNileContextMenuGroupCjsJs){},function(_nileContextMenuItemNileContextMenuItemCjsJs){},function(_nileContextSubmenuNileContextSubmenuCjsJs){},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){},function(_nileFloatingPanelNileFloatingPanelCssCjsJs){},function(_tippyEsm009CjsJs){},function(_nileLiteTooltipUtilsCjsJs){},function(_utilitiesVisibilityManagerCjsJs){},function(_nileContextMenuGroupNileContextMenuGroupCssCjsJs){},function(_nileContextMenuItemNileContextMenuItemCssCjsJs){}],execute:function execute(){l="nile-context-menu-item",u="nile-context-submenu",a="nile-context-menu__menu",m=["value","disabled"];d=0,_export("N",p=_c=/*#__PURE__*/function(_h){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,arguments),_this["for"]="",_this.trigger="right",_this.skipOn="",_this.zIndex=9999,_this.open=!1,_this.items=[],_this._items=[],_this._open=!1,_this._pinned=!1,_this._openContext=null,_this._targetEl=null,_this._previouslyFocused=null,_this._proxyId="nile-context-menu-anchor-"+ ++d,_this._wasDataMode=!1,_this._onPinnedReposition=function(){if(!_this._open||!_this._pinned||!_this._targetEl)return;var t=_this._targetEl.getBoundingClientRect();_this._positionProxyAt(t.left,t.bottom);},_this._menuContainerRef=null,_this._onKeydown=function(t){if(_this._open)switch(t.key){case"Escape":return t.preventDefault(),void _this.close("escape");case"Tab":return void _this.close("programmatic");case"ArrowDown":return t.preventDefault(),void _this._moveFocus(1);case"ArrowUp":return t.preventDefault(),void _this._moveFocus(-1);case"ArrowRight":{var _e$openSubmenu;var _this$_getFocusedItem=_this._getFocusedItemAnyLevel(),_i=_this$_getFocusedItem.item,_e=_i===null||_i===void 0?void 0:_i.querySelector(":scope > ".concat(u));if(!_e)return;return t.preventDefault(),(_e$openSubmenu=_e.openSubmenu)!==null&&_e$openSubmenu!==void 0&&_e$openSubmenu.call(_e),void requestAnimationFrame(function(){var _e$focusFirstItem;(_e$focusFirstItem=_e.focusFirstItem)===null||_e$focusFirstItem===void 0||_e$focusFirstItem.call(_e);});}case"ArrowLeft":{var _s$parentItem,_s$closeSubmenu,_s$parentItem2;var _this$_getFocusedItem2=_this._getFocusedItemAnyLevel(),_i2=_this$_getFocusedItem2.item,_e2=_this$_getFocusedItem2.container;if(!_i2||!_e2)return;var _s=_this._findSubmenuOwning(_e2);if(!_s)return;return t.preventDefault(),(_s$parentItem=_s.parentItem)!==null&&_s$parentItem!==void 0&&_s$parentItem.open||(_s$closeSubmenu=_s.closeSubmenu)!==null&&_s$closeSubmenu!==void 0&&_s$closeSubmenu.call(_s),void((_s$parentItem2=_s.parentItem)===null||_s$parentItem2===void 0?void 0:_s$parentItem2.focus());}case"Enter":case" ":{var _e3$openSubmenu;t.preventDefault();var _this$_getFocusedItem3=_this._getFocusedItemAnyLevel(),_i3=_this$_getFocusedItem3.item;if(!_i3||_i3.disabled)return;var _e3=_i3.querySelector(":scope > ".concat(u));return _e3?((_e3$openSubmenu=_e3.openSubmenu)!==null&&_e3$openSubmenu!==void 0&&_e3$openSubmenu.call(_e3),void requestAnimationFrame(function(){var _e3$shadowRoot;var t=(_e3$shadowRoot=_e3.shadowRoot)===null||_e3$shadowRoot===void 0?void 0:_e3$shadowRoot.querySelector(".".concat(a)),i=t?_this._enabledItemsIn(t)[0]:void 0;i===null||i===void 0||i.focus();})):void _this._selectItem(_i3);}}},_this._onScroll=function(t){if(!_this._open)return;if(_this._pinned)return void _this._onPinnedReposition();var i=t.composedPath();if(!_this._menuContainerRef||!i.includes(_this._menuContainerRef)){var _iterator=_createForOfIteratorHelper(i),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _t$classList;var _t=_step.value;if(_t instanceof HTMLElement&&(_t$classList=_t.classList)!==null&&_t$classList!==void 0&&_t$classList.contains(a))return;}}catch(err){_iterator.e(err);}finally{_iterator.f();}_this.close("programmatic");}},_this._onOutsidePointer=function(t){if(!_this._open)return;var i=t.composedPath();if(!_this._menuContainerRef||!i.includes(_this._menuContainerRef)){var _iterator2=_createForOfIteratorHelper(i),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _t2$classList;var _t2=_step2.value;if(_t2 instanceof HTMLElement&&(_t2$classList=_t2.classList)!==null&&_t2$classList!==void 0&&_t2$classList.contains(a))return;}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}_this.close("outside-click");}},_this._onDescendantSelect=function(t){var _t$detail;"click"===((_t$detail=t.detail)===null||_t$detail===void 0?void 0:_t$detail.type)&&_this.close("select");},_this._onPanelShown=function(t){t.stopPropagation(),_this._openPinnedSubmenus();},_this._onMenuMouseOver=function(t){var i=t.composedPath().find(function(t){return t instanceof HTMLElement&&t.tagName.toLowerCase()===l;});i&&!i.disabled&&i.focus();},_this._onMenuClick=function(t){var i=t.composedPath().find(function(t){return t instanceof HTMLElement&&t.tagName.toLowerCase()===l;});i&&!i.disabled&&(i.querySelector(":scope > ".concat(u))||_this._selectItem(i));};return _this;}_inherits(c,_h);return _createClass(c,[{key:"_isDataMode",get:function get(){return Array.isArray(this.items)&&this.items.length>0;}},{key:"connectedCallback",value:function connectedCallback(){var _this2=this;_superPropGet(c,"connectedCallback",this,3)([]),this._ensureProxy(),this._resolveTarget(),this._attachTriggers(),this._lightObserver=new MutationObserver(function(){_this2._isDataMode||_this2._relocateLightChildren();}),this._lightObserver.observe(this,{childList:!0}),this.open&&!this._open&&this.updateComplete.then(function(){_this2.isConnected&&_this2.open&&!_this2._open&&(_this2._pinned=!0,_this2._openAtTarget());});}},{key:"updated",value:function updated(t){_superPropGet(c,"updated",this,3)([t]),(t.has("for")||t.has("trigger")||t.has("skipOn"))&&this._open&&this.close("programmatic"),t.has("for")?(this._resolveTarget(),this._attachTriggers()):(t.has("trigger")||t.has("skipOn"))&&this._attachTriggers(),t.has("items")&&this._menuContainerRef&&(this._isDataMode?(this._renderDataItems(),this._wasDataMode=!0):this._wasDataMode&&(this._renderDataItems(),this._wasDataMode=!1)),t.has("open")&&(this.open&&!this._open?(this._pinned=!0,this._openAtTarget()):!this.open&&this._open&&this.close("programmatic"));}},{key:"_openAtTarget",value:function _openAtTarget(){var _this$_targetEl,_this$_targetEl2;var t=(_this$_targetEl=this._targetEl)===null||_this$_targetEl===void 0?void 0:_this$_targetEl.getBoundingClientRect();this.openAt({x:t?t.left:0,y:t?t.bottom:0,target:(_this$_targetEl2=this._targetEl)!==null&&_this$_targetEl2!==void 0?_this$_targetEl2:void 0});}},{key:"_resolveTarget",value:function _resolveTarget(){var _this$for,_this$getRootNode;var t=(_this$for=this["for"])===null||_this$for===void 0?void 0:_this$for.trim();if(!t)return void(this._targetEl=null);var i=(_this$getRootNode=this.getRootNode())!==null&&_this$getRootNode!==void 0?_this$getRootNode:document;/^[#.\[:]/.test(t)?this._targetEl=i.querySelector(t):this._targetEl="getElementById"in i?i.getElementById(t):document.getElementById(t);}},{key:"targetElement",get:function get(){return this._targetEl;}},{key:"_attachTriggers",value:function _attachTriggers(){var _this$_detachTriggers,_this3=this;(_this$_detachTriggers=this._detachTriggers)!==null&&_this$_detachTriggers!==void 0&&_this$_detachTriggers.call(this),this._detachTriggers=void 0;var t=this.trigger;if("manual"===t)return;var i=[];if("global"===t){var _this$skipOn$trim,_this$skipOn;var _t3=(_this$skipOn$trim=(_this$skipOn=this.skipOn)===null||_this$skipOn===void 0?void 0:_this$skipOn.trim())!==null&&_this$skipOn$trim!==void 0?_this$skipOn$trim:"",_e4=function _e4(i){return!(!i||!_t3)&&!!i.closest(_t3);},_s2=function _s2(t){var _i$target;var i=t;_e4(i.target)||(i.preventDefault(),_this3._open||_this3.openAt({x:i.clientX,y:i.clientY,target:(_i$target=i.target)!==null&&_i$target!==void 0?_i$target:void 0,originalEvent:i}));};return window.addEventListener("contextmenu",_s2,!0),i.push(function(){return window.removeEventListener("contextmenu",_s2,!0);}),void(this._detachTriggers=function(){return i.forEach(function(t){return t();});});}var e=this._targetEl;if(!e)return;var s="left"===t||"both"===t;if("right"===t||"both"===t){var _t4=function _t4(t){var i=t;i.preventDefault(),_this3.openAt({x:i.clientX,y:i.clientY,target:e,originalEvent:i});};e.addEventListener("contextmenu",_t4),i.push(function(){return e.removeEventListener("contextmenu",_t4);});}if(s){var _t5=function _t5(t){var i=t;_this3.openAt({x:i.clientX,y:i.clientY,target:e,originalEvent:i});};e.addEventListener("click",_t5),i.push(function(){return e.removeEventListener("click",_t5);});}0!==i.length&&(this._detachTriggers=function(){return i.forEach(function(t){return t();});});}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$_detachTriggers2,_this$_lightObserver,_this$_menuObserver,_this$_menuContainerR,_this$_menuContainerR2,_this$_menuContainerR3,_this$_proxyEl;_superPropGet(c,"disconnectedCallback",this,3)([]),_c._openInstances["delete"](this),this._open=!1,(_this$_detachTriggers2=this._detachTriggers)!==null&&_this$_detachTriggers2!==void 0&&_this$_detachTriggers2.call(this),this._detachTriggers=void 0,(_this$_lightObserver=this._lightObserver)!==null&&_this$_lightObserver!==void 0&&_this$_lightObserver.disconnect(),this._lightObserver=void 0,(_this$_menuObserver=this._menuObserver)!==null&&_this$_menuObserver!==void 0&&_this$_menuObserver.disconnect(),this._menuObserver=void 0,(_this$_menuContainerR=this._menuContainerRef)!==null&&_this$_menuContainerR!==void 0&&_this$_menuContainerR.removeEventListener("click",this._onMenuClick),(_this$_menuContainerR2=this._menuContainerRef)!==null&&_this$_menuContainerR2!==void 0&&_this$_menuContainerR2.removeEventListener("mouseover",this._onMenuMouseOver),(_this$_menuContainerR3=this._menuContainerRef)!==null&&_this$_menuContainerR3!==void 0&&_this$_menuContainerR3.removeEventListener("nile-change",this._onDescendantSelect),document.removeEventListener("pointerdown",this._onOutsidePointer,!0),document.removeEventListener("keydown",this._onKeydown,!0),window.removeEventListener("scroll",this._onScroll,!0),window.removeEventListener("resize",this._onPinnedReposition),(_this$_proxyEl=this._proxyEl)!==null&&_this$_proxyEl!==void 0&&_this$_proxyEl.remove(),this._proxyEl=void 0;}},{key:"firstUpdated",value:function firstUpdated(){var _this4=this;this._menuContainerRef=this.renderRoot.querySelector(".nile-context-menu__menu"),this._isDataMode?(this._renderDataItems(),this._wasDataMode=!0):this._relocateLightChildren(),this._menuContainerRef&&(this._menuObserver=new MutationObserver(function(){return _this4._parseChildren();}),this._menuObserver.observe(this._menuContainerRef,{childList:!0,subtree:!0,attributes:!0,attributeFilter:m}),this._menuContainerRef.addEventListener("click",this._onMenuClick),this._menuContainerRef.addEventListener("mouseover",this._onMenuMouseOver),this._menuContainerRef.addEventListener("nile-change",this._onDescendantSelect)),this._parseChildren();}},{key:"_ensureProxy",value:function _ensureProxy(){if(this._proxyEl)return;var t=document.createElement("div");t.id=this._proxyId,t.setAttribute("aria-hidden","true"),t.style.cssText="position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none;",document.body.appendChild(t),this._proxyEl=t;}},{key:"_positionProxyAt",value:function _positionProxyAt(t,i){if(this._proxyEl){if(this._pinned&&this._targetEl){var _t6=this._targetEl.getBoundingClientRect();return this._proxyEl.style.position="absolute",this._proxyEl.style.left="".concat(_t6.left+window.scrollX,"px"),this._proxyEl.style.top="".concat(_t6.top+window.scrollY,"px"),this._proxyEl.style.width="".concat(_t6.width,"px"),void(this._proxyEl.style.height="".concat(_t6.height,"px"));}this._proxyEl.style.position="fixed",this._proxyEl.style.left="".concat(t,"px"),this._proxyEl.style.top="".concat(i,"px"),this._proxyEl.style.width="0",this._proxyEl.style.height="0";}}},{key:"_relocateLightChildren",value:function _relocateLightChildren(){if(!this._menuContainerRef)return;var t=Array.from(this.children);if(0!==t.length){var _iterator3=_createForOfIteratorHelper(t),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _i4=_step3.value;this._menuContainerRef.appendChild(_i4);}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}}},{key:"_renderDataItems",value:function _renderDataItems(){var t=this._menuContainerRef;if(t){for(;t.firstChild;)t.removeChild(t.firstChild);var _iterator4=_createForOfIteratorHelper(this.items),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _i5=_step4.value;var _e5=this._createDataNode(_i5);_e5&&t.appendChild(_e5);}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}}},{key:"_createDataNode",value:function _createDataNode(t){if("group"===t.type){var _t$data;var _i6=document.createElement("nile-context-menu-group");t.name&&(_i6.label=t.name);var _iterator5=_createForOfIteratorHelper((_t$data=t.data)!==null&&_t$data!==void 0?_t$data:[]),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _e6=_step5.value;_i6.appendChild(this._createItemNode(_e6));}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}return _i6;}return null;}},{key:"_createItemNode",value:function _createItemNode(t){var _ref,_t$value;var i=document.createElement("nile-context-menu-item");if(t.id&&(i.id=t.id),i.value=(_ref=(_t$value=t.value)!==null&&_t$value!==void 0?_t$value:t.id)!==null&&_ref!==void 0?_ref:"",t.disabled&&(i.disabled=!0),t.open&&(i.open=!0),t.icon){var _e7=document.createElement("nile-glyph");_e7.setAttribute("slot","icon"),_e7.setAttribute("name",t.icon),t.iconSet&&_e7.setAttribute("set",t.iconSet),t.iconSize&&_e7.setAttribute("size",t.iconSize),t.iconMethod&&_e7.setAttribute("method",t.iconMethod),t.iconColor&&_e7.setAttribute("color",t.iconColor),i.appendChild(_e7);}if(i.appendChild(document.createTextNode(t.label)),t.submenu&&t.submenu.length>0){var _e8=document.createElement("nile-context-submenu");var _iterator6=_createForOfIteratorHelper(t.submenu),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _i7=_step6.value;var _t7=this._createDataNode(_i7);_t7&&_e8.appendChild(_t7);}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}i.appendChild(_e8);}return i;}},{key:"_parseChildren",value:function _parseChildren(){var _this$_menuContainerR4,_this5=this;var t=(_this$_menuContainerR4=this._menuContainerRef)!==null&&_this$_menuContainerR4!==void 0?_this$_menuContainerR4:this,i=Array.from(t.querySelectorAll(l));this._items=i.filter(function(i){return!_this5._isInsideDescendantSubmenu(i,t);});}},{key:"_isInsideDescendantSubmenu",value:function _isInsideDescendantSubmenu(t,i){var e=t.parentElement;for(;e&&e!==i;){if(e.tagName.toLowerCase()===u)return!0;e=e.parentElement;}return!1;}},{key:"menuItems",get:function get(){return this._items;}},{key:"getItemByValue",value:function getItemByValue(t){return this._items.find(function(i){return i.value===t;});}},{key:"isOpen",get:function get(){return this._open;}},{key:"openAt",value:function openAt(t){var _this6=this;if(!this._open){var _t$target,_t$originalEvent;var _iterator7=_createForOfIteratorHelper(_c._openInstances),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _t8=_step7.value;_t8!==this&&_t8.close("programmatic");}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}this._previouslyFocused=document.activeElement,this._openContext={x:t.x,y:t.y,target:(_t$target=t.target)!==null&&_t$target!==void 0?_t$target:null,originalEvent:(_t$originalEvent=t.originalEvent)!==null&&_t$originalEvent!==void 0?_t$originalEvent:null},this._ensureProxy(),this._positionProxyAt(t.x,t.y),this._open=!0,this.open=!0,_c._openInstances.add(this),document.addEventListener("pointerdown",this._onOutsidePointer,!0),document.addEventListener("keydown",this._onKeydown,!0),this._pinned&&window.addEventListener("resize",this._onPinnedReposition),requestAnimationFrame(function(){_this6._open&&window.addEventListener("scroll",_this6._onScroll,!0),requestAnimationFrame(function(){return _this6._openPinnedSubmenus();});}),this.emit("nile-change",_objectSpread({type:"open"},this._openContext));}}},{key:"close",value:function close(){var _this$_menuContainerR5,_this$_previouslyFocu,_this$_previouslyFocu2;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"programmatic";if(!this._open)return;this._open=!1,this.open=!1,this._pinned=!1,this._openContext=null,_c._openInstances["delete"](this);var i=(_this$_menuContainerR5=this._menuContainerRef)===null||_this$_menuContainerR5===void 0?void 0:_this$_menuContainerR5.querySelectorAll(u);i!==null&&i!==void 0&&i.forEach(function(t){var _t$closeSubmenu;return(_t$closeSubmenu=t.closeSubmenu)===null||_t$closeSubmenu===void 0?void 0:_t$closeSubmenu.call(t);}),document.removeEventListener("pointerdown",this._onOutsidePointer,!0),document.removeEventListener("keydown",this._onKeydown,!0),window.removeEventListener("scroll",this._onScroll,!0),window.removeEventListener("resize",this._onPinnedReposition);var e=document.activeElement;(e===this||this._items.some(function(t){var _t$shadowRoot;return t===e||((_t$shadowRoot=t.shadowRoot)===null||_t$shadowRoot===void 0?void 0:_t$shadowRoot.contains(e));}))&&(_this$_previouslyFocu=this._previouslyFocused)!==null&&_this$_previouslyFocu!==void 0&&(_this$_previouslyFocu2=_this$_previouslyFocu.focus)!==null&&_this$_previouslyFocu2!==void 0&&_this$_previouslyFocu2.call(_this$_previouslyFocu),this._previouslyFocused=null,this.emit("nile-change",{type:"close",reason:t});}},{key:"_enabledItems",value:function _enabledItems(){return this._items.filter(function(t){return!t.disabled;});}},{key:"_getFocusedItem",value:function _getFocusedItem(){var t=document.activeElement;var _iterator8=_createForOfIteratorHelper(this._items),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _i8$shadowRoot;var _i8=_step8.value;if(_i8===t||(_i8$shadowRoot=_i8.shadowRoot)!==null&&_i8$shadowRoot!==void 0&&_i8$shadowRoot.contains(t))return _i8;}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}return null;}},{key:"_getFocusedItemAnyLevel",value:function _getFocusedItemAnyLevel(){var t=document.activeElement;for(;t&&((_t$tagName=t.tagName)===null||_t$tagName===void 0?void 0:_t$tagName.toLowerCase())!==l;){var _t$tagName;var _i9=t.getRootNode();t=_i9 instanceof ShadowRoot?_i9.host:t.parentElement;}if(!t)return{item:null,container:null};var i=t.closest(".".concat(a));return{item:t,container:i};}},{key:"_enabledItemsIn",value:function _enabledItemsIn(t){var _this7=this;return Array.from(t.querySelectorAll(l)).filter(function(i){return!i.disabled&&!_this7._isInsideDescendantSubmenu(i,t);});}},{key:"_focusFirstEnabled",value:function _focusFirstEnabled(){var _t$;var t=this._enabledItems();(_t$=t[0])===null||_t$===void 0||_t$.focus();}},{key:"_moveFocus",value:function _moveFocus(t){var _ref2;var _this$_getFocusedItem4=this._getFocusedItemAnyLevel(),i=_this$_getFocusedItem4.item,e=_this$_getFocusedItem4.container,s=(_ref2=e!==null&&e!==void 0?e:this._menuContainerRef)!==null&&_ref2!==void 0?_ref2:this,n=this._enabledItemsIn(s);if(0===n.length)return;var o=i?n.indexOf(i):-1;n[((o+t)%n.length+n.length)%n.length].focus();}},{key:"_findSubmenuOwning",value:function _findSubmenuOwning(t){var _i$findByContainer,_i$findByContainer2;var i=window.customElements.get(u);return(_i$findByContainer=i===null||i===void 0||(_i$findByContainer2=i.findByContainer)===null||_i$findByContainer2===void 0?void 0:_i$findByContainer2.call(i,t))!==null&&_i$findByContainer!==void 0?_i$findByContainer:null;}},{key:"_stop",value:function _stop(t){t.stopPropagation();}},{key:"_openPinnedSubmenus",value:function _openPinnedSubmenus(){if(this._open&&this._menuContainerRef){var _iterator9=_createForOfIteratorHelper(this._items),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _i10$openSubmenu;var _t9=_step9.value;if(!_t9.open||_t9.disabled)continue;var _i10=_t9.querySelector(":scope > ".concat(u));_i10===null||_i10===void 0||(_i10$openSubmenu=_i10.openSubmenu)===null||_i10$openSubmenu===void 0||_i10$openSubmenu.call(_i10);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}}}},{key:"_selectItem",value:function _selectItem(t){var _t$textContent,_this$_openContext$ta,_this$_openContext,_this$_openContext$or,_this$_openContext2;var i={id:t.id,value:t.value,name:((_t$textContent=t.textContent)!==null&&_t$textContent!==void 0?_t$textContent:"").trim(),target:(_this$_openContext$ta=(_this$_openContext=this._openContext)===null||_this$_openContext===void 0?void 0:_this$_openContext.target)!==null&&_this$_openContext$ta!==void 0?_this$_openContext$ta:null,originalEvent:(_this$_openContext$or=(_this$_openContext2=this._openContext)===null||_this$_openContext2===void 0?void 0:_this$_openContext2.originalEvent)!==null&&_this$_openContext$or!==void 0?_this$_openContext$or:null};try{var _t$onSelect;(_t$onSelect=t.onSelect)===null||_t$onSelect===void 0||_t$onSelect.call(t,i);}catch(t){console.error("[nile-context-menu] onSelect callback threw:",t);}this.emit("nile-change",_objectSpread({type:"click"},i)),this.close("select");}},{key:"render",value:function render(){return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-floating-panel\n for=","\n trigger=\"manual\"\n placement=\"bottom-start\"\n panelClass=\"nile-context-menu-panel\"\n .zIndex=","\n ?open=","\n .interactive=","\n .hideOnClick=","\n .closeOnEscape=","\n .arrow=","\n .distance=","\n @nile-init=","\n @nile-destroy=","\n @nile-show=","\n @nile-hide=","\n @nile-after-show=","\n @nile-after-hide=","\n @nile-toggle=","\n @nile-visibility-change=","\n >\n <div class=\"nile-context-menu__menu\" role=\"menu\"></div>\n </nile-floating-panel>\n "])),this._proxyId,this.zIndex,this._open,!0,!1,!1,"none",0,this._stop,this._stop,this._stop,this._stop,this._onPanelShown,this._stop,this._stop,this._stop);}}],[{key:"styles",get:function get(){return[r];}}]);}(h));p._openInstances=new Set(),t([e({attribute:!0,type:String,reflect:!0})],p.prototype,"for",void 0),t([e({attribute:!0,type:String,reflect:!0})],p.prototype,"trigger",void 0),t([e({attribute:!0,type:String,reflect:!0})],p.prototype,"skipOn",void 0),t([e({attribute:!0,type:Number,reflect:!0})],p.prototype,"zIndex",void 0),t([e({attribute:!0,type:Boolean,reflect:!0})],p.prototype,"open",void 0),t([e({attribute:!1})],p.prototype,"items",void 0),t([s("nile-floating-panel")],p.prototype,"_floatingPanel",void 0),t([n()],p.prototype,"_items",void 0),t([n()],p.prototype,"_open",void 0),_export("N",p=_c=t([o("nile-context-menu")],p));}};});
|
|
2
2
|
//# sourceMappingURL=nile-context-menu.cjs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["./nile-context-submenu.cjs.js","tslib","lit","lit/decorators.js","../internal/nile-element.cjs.js","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.cjs.js","../nile-floating-panel/nile-floating-panel.cjs.js","../nile-floating-panel/nile-floating-panel.css.cjs.js","../tippy.esm-78baa8f2.cjs.js","../nile-lite-tooltip/utils.cjs.js","../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";return{setters:[function(_nileContextSubmenuCjsJs){_export("NileContextSubmenu",_nileContextSubmenuCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_internalNileElementCjsJs){},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){},function(_nileFloatingPanelNileFloatingPanelCjsJs){},function(_nileFloatingPanelNileFloatingPanelCssCjsJs){},function(
|
|
1
|
+
System.register(["./nile-context-submenu.cjs.js","tslib","lit","lit/decorators.js","../internal/nile-element.cjs.js","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.cjs.js","../nile-floating-panel/nile-floating-panel.cjs.js","../nile-floating-panel/nile-floating-panel.css.cjs.js","../tippy.esm-78baa8f2.cjs.js","../nile-lite-tooltip/utils.cjs.js","../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";return{setters:[function(_nileContextSubmenuCjsJs){_export("NileContextSubmenu",_nileContextSubmenuCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_internalNileElementCjsJs){},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){},function(_nileFloatingPanelNileFloatingPanelCjsJs){},function(_nileFloatingPanelNileFloatingPanelCssCjsJs){},function(_tippyEsm009CjsJs){},function(_nileLiteTooltipUtilsCjsJs){},function(_utilitiesVisibilityManagerCjsJs){}],execute:function execute(){}};});
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","../internal/nile-element.cjs.js","../nile-floating-panel/nile-floating-panel.cjs.js","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.cjs.js","../nile-floating-panel/nile-floating-panel.css.cjs.js","../tippy.esm-78baa8f2.cjs.js","../nile-lite-tooltip/utils.cjs.js","../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";var t,i,s,e,n,h,o,_templateObject,_templateObject2,_r,l,c,u,a;function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var n=0,F=function F(){};return{s:F,n:function(_n){function n(){return _n.apply(this,arguments);}n.toString=function(){return _n.toString();};return n;}(function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]};}),e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.css;s=_lit.html;},function(_litDecoratorsJs){e=_litDecoratorsJs.property;n=_litDecoratorsJs.state;h=_litDecoratorsJs.customElement;},function(_internalNileElementCjsJs){o=_internalNileElementCjsJs.N;},function(_nileFloatingPanelNileFloatingPanelCjsJs){},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){},function(_nileFloatingPanelNileFloatingPanelCssCjsJs){},function(_tippyEsm008CjsJs){},function(_nileLiteTooltipUtilsCjsJs){},function(_utilitiesVisibilityManagerCjsJs){}],execute:function execute(){l="nile-context-menu-item",c="nile-context-submenu";u=0,_export("N",a=_r=/*#__PURE__*/function(_o){function r(){var _this;_classCallCheck(this,r);_this=_callSuper(this,r,arguments),_this.zIndex=9999,_this._open=!1,_this._parentItem=null,_this._proxyId="nile-context-submenu-anchor-"+ ++u,_this._menuContainerRef=null,_this._setupDone=!1,_this._repositionQueued=!1,_this._onParentEnter=function(){var _this$_parentItem;((_this$_parentItem=_this._parentItem)===null||_this$_parentItem===void 0?void 0:_this$_parentItem.disabled)||(_this._clearTimers(),_this._open||(_this._openTimer=window.setTimeout(function(){return _this.openSubmenu();},100)));},_this._onParentLeave=function(){null!=_this._openTimer&&(clearTimeout(_this._openTimer),_this._openTimer=void 0),_this._pinnedOpen||_this._open&&(_this._closeTimer=window.setTimeout(function(){return _this.closeSubmenu();},300));},_this._onParentClick=function(t){var _this$_parentItem2;t.stopPropagation(),((_this$_parentItem2=_this._parentItem)===null||_this$_parentItem2===void 0?void 0:_this$_parentItem2.disabled)||(_this._clearTimers(),_this._open?_this._pinnedOpen||_this.closeSubmenu():_this.openSubmenu());},_this._onPanelEnter=function(){_this._clearTimers();},_this._onReposition=function(){!_this._repositionQueued&&_this._open&&(_this._repositionQueued=!0,requestAnimationFrame(function(){var _this$_floatingPanelE;_this._repositionQueued=!1,_this._open&&(_this._syncProxyToParent(),(_this$_floatingPanelE=_this._floatingPanelEl)===null||_this$_floatingPanelE===void 0?void 0:_this$_floatingPanelE.reposition());}));},_this._onPanelLeave=function(){_this._pinnedOpen||_this._open&&(_this._closeTimer=window.setTimeout(function(){_r.openStack.some(function(t){var _this$_menuContainerR;return t!==_assertThisInitialized(_this)&&((_this$_menuContainerR=_this._menuContainerRef)===null||_this$_menuContainerR===void 0?void 0:_this$_menuContainerR.contains(t));})||_this.closeSubmenu();},300));},_this._onMenuMouseOver=function(t){var i=t.composedPath().find(function(t){return t instanceof HTMLElement&&t.tagName.toLowerCase()===l;});i&&!i.disabled&&i.focus();},_this._onNestedSelect=function(t){var _t$detail;t.target!==_assertThisInitialized(_this)&&"click"===((_t$detail=t.detail)===null||_t$detail===void 0?void 0:_t$detail.type)&&_this.emit("nile-change",t.detail);},_this._onMenuClick=function(t){var _i$textContent;var i=t.composedPath().find(function(t){return t instanceof HTMLElement&&t.tagName.toLowerCase()===l;});if(!i||i.disabled)return;if(i.querySelector(":scope > ".concat(c)))return;var s={id:i.id,value:i.value,name:((_i$textContent=i.textContent)!==null&&_i$textContent!==void 0?_i$textContent:"").trim(),target:null,originalEvent:t};try{var _i$onSelect;(_i$onSelect=i.onSelect)===null||_i$onSelect===void 0||_i$onSelect.call(i,s);}catch(t){console.error("[nile-context-submenu] onSelect callback threw:",t);}_this.emit("nile-change",_objectSpread({type:"click"},s));};return _this;}_inherits(r,_o);return _createClass(r,[{key:"_pinnedOpen",get:function get(){var _this$_parentItem3;return!(!((_this$_parentItem3=this._parentItem)!==null&&_this$_parentItem3!==void 0&&_this$_parentItem3.open)||this._parentItem.disabled);}},{key:"connectedCallback",value:function connectedCallback(){var _this$_parentItem$set,_this$_parentItem4,_this2=this;_superPropGet(r,"connectedCallback",this,3)([]);var t=this.parentElement;for(;t&&t.tagName.toLowerCase()!==l;)t=t.parentElement;this._parentItem=t,this._ensureProxy(),this._parentItem&&((_this$_parentItem$set=(_this$_parentItem4=this._parentItem).setSubmenuExpanded)!==null&&_this$_parentItem$set!==void 0&&_this$_parentItem$set.call(_this$_parentItem4,!1),this._parentItem.addEventListener("mouseenter",this._onParentEnter),this._parentItem.addEventListener("mouseleave",this._onParentLeave),this._parentItem.addEventListener("click",this._onParentClick,!0),this._parentObserver=new MutationObserver(function(){_this2._pinnedOpen?_this2._isParentVisible()&&_this2.openSubmenu():_this2._open&&_this2.closeSubmenu();}),this._parentObserver.observe(this._parentItem,{attributes:!0,attributeFilter:["open"]})),this._ensureBodyPanel();}},{key:"_isParentVisible",value:function _isParentVisible(){var _this$_parentItem5;var t=(_this$_parentItem5=this._parentItem)===null||_this$_parentItem5===void 0?void 0:_this$_parentItem5.getBoundingClientRect();return!!t&&t.width>0&&t.height>0;}},{key:"_ensureProxy",value:function _ensureProxy(){if(this._proxyEl)return;var t=document.createElement("div");t.id=this._proxyId,t.setAttribute("aria-hidden","true"),t.style.cssText="position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none;",document.body.appendChild(t),this._proxyEl=t;}},{key:"_syncProxyToParent",value:function _syncProxyToParent(){if(!this._proxyEl||!this._parentItem)return;var t=this._parentItem.getBoundingClientRect();this._pinnedOpen?(this._proxyEl.style.position="absolute",this._proxyEl.style.left="".concat(t.left+window.scrollX,"px"),this._proxyEl.style.top="".concat(t.top+window.scrollY,"px")):(this._proxyEl.style.position="fixed",this._proxyEl.style.left="".concat(t.left,"px"),this._proxyEl.style.top="".concat(t.top,"px")),this._proxyEl.style.width="".concat(t.width,"px"),this._proxyEl.style.height="".concat(t.height,"px");}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$_parentObserver,_this3=this;_superPropGet(r,"disconnectedCallback",this,3)([]),this._parentItem&&(this._parentItem.removeEventListener("mouseenter",this._onParentEnter),this._parentItem.removeEventListener("mouseleave",this._onParentLeave),this._parentItem.removeEventListener("click",this._onParentClick,!0)),(_this$_parentObserver=this._parentObserver)!==null&&_this$_parentObserver!==void 0&&_this$_parentObserver.disconnect(),this._parentObserver=void 0,this._clearTimers(),this._open&&this.closeSubmenu(),this._teardownBodyArtifacts(),_r.openStack=_r.openStack.filter(function(t){return t!==_this3;});}},{key:"_teardownBodyArtifacts",value:function _teardownBodyArtifacts(){var _this$_floatingPanelE2,_this$_proxyEl;var t=this._menuContainerRef;if(t)for(t.removeEventListener("click",this._onMenuClick),t.removeEventListener("mouseover",this._onMenuMouseOver),t.removeEventListener("mouseenter",this._onPanelEnter),t.removeEventListener("mouseleave",this._onPanelLeave),t.removeEventListener("nile-change",this._onNestedSelect);t.firstChild;)this.appendChild(t.firstChild);(_this$_floatingPanelE2=this._floatingPanelEl)!==null&&_this$_floatingPanelE2!==void 0&&_this$_floatingPanelE2.remove(),this._floatingPanelEl=void 0,this._menuContainerRef=null,this._setupDone=!1,(_this$_proxyEl=this._proxyEl)!==null&&_this$_proxyEl!==void 0&&_this$_proxyEl.remove(),this._proxyEl=void 0;}},{key:"_ensureBodyPanel",value:function _ensureBodyPanel(){if(this._setupDone)return;var t=document.createElement("nile-floating-panel");t.setAttribute("for",this._proxyId),t.setAttribute("trigger","manual"),t.setAttribute("placement","right-start"),t.panelClass="nile-context-menu-panel",t.zIndex=this.zIndex,t.interactive=!0,t.hideOnClick=!1,t.closeOnEscape=!1,t.arrow="none",t.distance=0;var i=document.createElement("div");i.className="nile-context-menu__menu",i.setAttribute("role","menu"),t.appendChild(i),document.body.appendChild(t),this._floatingPanelEl=t,this._menuContainerRef=i,i.addEventListener("click",this._onMenuClick),i.addEventListener("mouseover",this._onMenuMouseOver),i.addEventListener("mouseenter",this._onPanelEnter),i.addEventListener("mouseleave",this._onPanelLeave),i.addEventListener("nile-change",this._onNestedSelect),this._relocateLightChildren(),this._setupDone=!0;}},{key:"firstUpdated",value:function firstUpdated(){this._relocateLightChildren();}},{key:"_relocateLightChildren",value:function _relocateLightChildren(){if(this._menuContainerRef)for(var _i=0,_Array$from=Array.from(this.children);_i<_Array$from.length;_i++){var _t=_Array$from[_i];this._menuContainerRef.appendChild(_t);}}},{key:"_clearTimers",value:function _clearTimers(){null!=this._openTimer&&(clearTimeout(this._openTimer),this._openTimer=void 0),null!=this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=void 0);}},{key:"openSubmenu",value:function openSubmenu(){var _this$_parentItem6,_this4=this,_this$_parentItem7,_this$_parentItem7$se;this._open||((_this$_parentItem6=this._parentItem)===null||_this$_parentItem6===void 0?void 0:_this$_parentItem6.disabled)||(this._closeSiblingSubmenus(),this._ensureProxy(),this._ensureBodyPanel(),this._syncProxyToParent(),this._open=!0,this._floatingPanelEl&&(this._floatingPanelEl.addEventListener("nile-after-show",function(){_this4._open&&_this4._openPinnedDescendants();},{once:!0}),this._floatingPanelEl.open=!0),_r.openStack.push(this),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition),requestAnimationFrame(function(){return requestAnimationFrame(function(){_this4._open&&_this4._openPinnedDescendants();});}),(_this$_parentItem7=this._parentItem)===null||_this$_parentItem7===void 0||(_this$_parentItem7$se=_this$_parentItem7.setSubmenuExpanded)===null||_this$_parentItem7$se===void 0?void 0:_this$_parentItem7$se.call(_this$_parentItem7,!0));}},{key:"_openPinnedDescendants",value:function _openPinnedDescendants(){if(!this._menuContainerRef)return;var t=Array.from(this._menuContainerRef.querySelectorAll(l));for(var _i2=0,_t2=t;_i2<_t2.length;_i2++){var _i3=_t2[_i2];if(!this._isDirectChildItem(_i3))continue;if(!_i3.open||_i3.disabled)continue;var _t3=_i3.querySelector(":scope > ".concat(c));_t3===null||_t3===void 0||_t3.openSubmenu();}}},{key:"_isDirectChildItem",value:function _isDirectChildItem(t){var i=t.parentElement;for(;i&&i!==this._menuContainerRef;){if(i.tagName.toLowerCase()===c)return!1;i=i.parentElement;}return!0;}},{key:"closeSubmenu",value:function closeSubmenu(){var _this5=this;if(this._open){var _this$_parentItem8,_this$_parentItem8$se;for(var _i4=0,_arr=_toConsumableArray(_r.openStack);_i4<_arr.length;_i4++){var _this$_menuContainerR2;var _t4=_arr[_i4];_t4!==this&&((_this$_menuContainerR2=this._menuContainerRef)===null||_this$_menuContainerR2===void 0?void 0:_this$_menuContainerR2.contains(_t4))&&_t4.closeSubmenu();}this._open=!1,this._floatingPanelEl&&(this._floatingPanelEl.open=!1),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),_r.openStack=_r.openStack.filter(function(t){return t!==_this5;}),this._clearTimers(),(_this$_parentItem8=this._parentItem)===null||_this$_parentItem8===void 0||(_this$_parentItem8$se=_this$_parentItem8.setSubmenuExpanded)===null||_this$_parentItem8$se===void 0?void 0:_this$_parentItem8$se.call(_this$_parentItem8,!1);}}},{key:"isOpen",get:function get(){return this._open;}},{key:"parentItem",get:function get(){return this._parentItem;}},{key:"focusFirstItem",value:function focusFirstItem(){if(!this._menuContainerRef)return;var t=Array.from(this._menuContainerRef.querySelectorAll(l));for(var _i5=0,_t5=t;_i5<_t5.length;_i5++){var _i6=_t5[_i5];if(this._isDirectChildItem(_i6)&&!_i6.disabled)return void _i6.focus();}}},{key:"_closeSiblingSubmenus",value:function _closeSiblingSubmenus(){var t=this._parentLevel();for(var _i7=0,_arr2=_toConsumableArray(_r.openStack);_i7<_arr2.length;_i7++){var _i8=_arr2[_i7];_i8!==this&&(_i8._pinnedOpen||_i8._parentLevel()===t&&_i8.closeSubmenu());}}},{key:"_parentLevel",value:function _parentLevel(){var _t$parentElement$clos,_t$parentElement;var t=this._parentItem;return t?(_t$parentElement$clos=(_t$parentElement=t.parentElement)===null||_t$parentElement===void 0?void 0:_t$parentElement.closest(".nile-context-menu__menu"))!==null&&_t$parentElement$clos!==void 0?_t$parentElement$clos:null:null;}},{key:"render",value:function render(){return s(_templateObject||(_templateObject=_taggedTemplateLiteral([""])));}}],[{key:"styles",get:function get(){return[i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n :host { display: contents; }\n "])))];}},{key:"findByContainer",value:function findByContainer(t){var _iterator=_createForOfIteratorHelper(_r.openStack),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _i9=_step.value;if(_i9._menuContainerRef===t)return _i9;}}catch(err){_iterator.e(err);}finally{_iterator.f();}return null;}}]);}(o));a.openStack=[],t([e({attribute:!0,type:Number,reflect:!0})],a.prototype,"zIndex",void 0),t([n()],a.prototype,"_open",void 0),_export("N",a=_r=t([h("nile-context-submenu")],a));}};});
|
|
1
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","../internal/nile-element.cjs.js","../nile-floating-panel/nile-floating-panel.cjs.js","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.cjs.js","../nile-floating-panel/nile-floating-panel.css.cjs.js","../tippy.esm-78baa8f2.cjs.js","../nile-lite-tooltip/utils.cjs.js","../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";var t,i,s,e,n,h,o,_templateObject,_templateObject2,_r,l,c,u,a;function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var n=0,F=function F(){};return{s:F,n:function(_n){function n(){return _n.apply(this,arguments);}n.toString=function(){return _n.toString();};return n;}(function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]};}),e:function e(r){throw r;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.css;s=_lit.html;},function(_litDecoratorsJs){e=_litDecoratorsJs.property;n=_litDecoratorsJs.state;h=_litDecoratorsJs.customElement;},function(_internalNileElementCjsJs){o=_internalNileElementCjsJs.N;},function(_nileFloatingPanelNileFloatingPanelCjsJs){},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){},function(_nileFloatingPanelNileFloatingPanelCssCjsJs){},function(_tippyEsm009CjsJs){},function(_nileLiteTooltipUtilsCjsJs){},function(_utilitiesVisibilityManagerCjsJs){}],execute:function execute(){l="nile-context-menu-item",c="nile-context-submenu";u=0,_export("N",a=_r=/*#__PURE__*/function(_o){function r(){var _this;_classCallCheck(this,r);_this=_callSuper(this,r,arguments),_this.zIndex=9999,_this._open=!1,_this._parentItem=null,_this._proxyId="nile-context-submenu-anchor-"+ ++u,_this._menuContainerRef=null,_this._setupDone=!1,_this._repositionQueued=!1,_this._onParentEnter=function(){var _this$_parentItem;((_this$_parentItem=_this._parentItem)===null||_this$_parentItem===void 0?void 0:_this$_parentItem.disabled)||(_this._clearTimers(),_this._open||(_this._openTimer=window.setTimeout(function(){return _this.openSubmenu();},100)));},_this._onParentLeave=function(){null!=_this._openTimer&&(clearTimeout(_this._openTimer),_this._openTimer=void 0),_this._pinnedOpen||_this._open&&(_this._closeTimer=window.setTimeout(function(){return _this.closeSubmenu();},300));},_this._onParentClick=function(t){var _this$_parentItem2;t.stopPropagation(),((_this$_parentItem2=_this._parentItem)===null||_this$_parentItem2===void 0?void 0:_this$_parentItem2.disabled)||(_this._clearTimers(),_this._open?_this._pinnedOpen||_this.closeSubmenu():_this.openSubmenu());},_this._onPanelEnter=function(){_this._clearTimers();},_this._onReposition=function(){!_this._repositionQueued&&_this._open&&(_this._repositionQueued=!0,requestAnimationFrame(function(){var _this$_floatingPanelE;_this._repositionQueued=!1,_this._open&&(_this._syncProxyToParent(),(_this$_floatingPanelE=_this._floatingPanelEl)===null||_this$_floatingPanelE===void 0?void 0:_this$_floatingPanelE.reposition());}));},_this._onPanelLeave=function(){_this._pinnedOpen||_this._open&&(_this._closeTimer=window.setTimeout(function(){_r.openStack.some(function(t){var _this$_menuContainerR;return t!==_assertThisInitialized(_this)&&((_this$_menuContainerR=_this._menuContainerRef)===null||_this$_menuContainerR===void 0?void 0:_this$_menuContainerR.contains(t));})||_this.closeSubmenu();},300));},_this._onMenuMouseOver=function(t){var i=t.composedPath().find(function(t){return t instanceof HTMLElement&&t.tagName.toLowerCase()===l;});i&&!i.disabled&&i.focus();},_this._onNestedSelect=function(t){var _t$detail;t.target!==_assertThisInitialized(_this)&&"click"===((_t$detail=t.detail)===null||_t$detail===void 0?void 0:_t$detail.type)&&_this.emit("nile-change",t.detail);},_this._onMenuClick=function(t){var _i$textContent;var i=t.composedPath().find(function(t){return t instanceof HTMLElement&&t.tagName.toLowerCase()===l;});if(!i||i.disabled)return;if(i.querySelector(":scope > ".concat(c)))return;var s={id:i.id,value:i.value,name:((_i$textContent=i.textContent)!==null&&_i$textContent!==void 0?_i$textContent:"").trim(),target:null,originalEvent:t};try{var _i$onSelect;(_i$onSelect=i.onSelect)===null||_i$onSelect===void 0||_i$onSelect.call(i,s);}catch(t){console.error("[nile-context-submenu] onSelect callback threw:",t);}_this.emit("nile-change",_objectSpread({type:"click"},s));};return _this;}_inherits(r,_o);return _createClass(r,[{key:"_pinnedOpen",get:function get(){var _this$_parentItem3;return!(!((_this$_parentItem3=this._parentItem)!==null&&_this$_parentItem3!==void 0&&_this$_parentItem3.open)||this._parentItem.disabled);}},{key:"connectedCallback",value:function connectedCallback(){var _this$_parentItem$set,_this$_parentItem4,_this2=this;_superPropGet(r,"connectedCallback",this,3)([]);var t=this.parentElement;for(;t&&t.tagName.toLowerCase()!==l;)t=t.parentElement;this._parentItem=t,this._ensureProxy(),this._parentItem&&((_this$_parentItem$set=(_this$_parentItem4=this._parentItem).setSubmenuExpanded)!==null&&_this$_parentItem$set!==void 0&&_this$_parentItem$set.call(_this$_parentItem4,!1),this._parentItem.addEventListener("mouseenter",this._onParentEnter),this._parentItem.addEventListener("mouseleave",this._onParentLeave),this._parentItem.addEventListener("click",this._onParentClick,!0),this._parentObserver=new MutationObserver(function(){_this2._pinnedOpen?_this2._isParentVisible()&&_this2.openSubmenu():_this2._open&&_this2.closeSubmenu();}),this._parentObserver.observe(this._parentItem,{attributes:!0,attributeFilter:["open"]})),this._ensureBodyPanel();}},{key:"_isParentVisible",value:function _isParentVisible(){var _this$_parentItem5;var t=(_this$_parentItem5=this._parentItem)===null||_this$_parentItem5===void 0?void 0:_this$_parentItem5.getBoundingClientRect();return!!t&&t.width>0&&t.height>0;}},{key:"_ensureProxy",value:function _ensureProxy(){if(this._proxyEl)return;var t=document.createElement("div");t.id=this._proxyId,t.setAttribute("aria-hidden","true"),t.style.cssText="position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none;",document.body.appendChild(t),this._proxyEl=t;}},{key:"_syncProxyToParent",value:function _syncProxyToParent(){if(!this._proxyEl||!this._parentItem)return;var t=this._parentItem.getBoundingClientRect();this._pinnedOpen?(this._proxyEl.style.position="absolute",this._proxyEl.style.left="".concat(t.left+window.scrollX,"px"),this._proxyEl.style.top="".concat(t.top+window.scrollY,"px")):(this._proxyEl.style.position="fixed",this._proxyEl.style.left="".concat(t.left,"px"),this._proxyEl.style.top="".concat(t.top,"px")),this._proxyEl.style.width="".concat(t.width,"px"),this._proxyEl.style.height="".concat(t.height,"px");}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$_parentObserver,_this3=this;_superPropGet(r,"disconnectedCallback",this,3)([]),this._parentItem&&(this._parentItem.removeEventListener("mouseenter",this._onParentEnter),this._parentItem.removeEventListener("mouseleave",this._onParentLeave),this._parentItem.removeEventListener("click",this._onParentClick,!0)),(_this$_parentObserver=this._parentObserver)!==null&&_this$_parentObserver!==void 0&&_this$_parentObserver.disconnect(),this._parentObserver=void 0,this._clearTimers(),this._open&&this.closeSubmenu(),this._teardownBodyArtifacts(),_r.openStack=_r.openStack.filter(function(t){return t!==_this3;});}},{key:"_teardownBodyArtifacts",value:function _teardownBodyArtifacts(){var _this$_floatingPanelE2,_this$_proxyEl;var t=this._menuContainerRef;if(t)for(t.removeEventListener("click",this._onMenuClick),t.removeEventListener("mouseover",this._onMenuMouseOver),t.removeEventListener("mouseenter",this._onPanelEnter),t.removeEventListener("mouseleave",this._onPanelLeave),t.removeEventListener("nile-change",this._onNestedSelect);t.firstChild;)this.appendChild(t.firstChild);(_this$_floatingPanelE2=this._floatingPanelEl)!==null&&_this$_floatingPanelE2!==void 0&&_this$_floatingPanelE2.remove(),this._floatingPanelEl=void 0,this._menuContainerRef=null,this._setupDone=!1,(_this$_proxyEl=this._proxyEl)!==null&&_this$_proxyEl!==void 0&&_this$_proxyEl.remove(),this._proxyEl=void 0;}},{key:"_ensureBodyPanel",value:function _ensureBodyPanel(){if(this._setupDone)return;var t=document.createElement("nile-floating-panel");t.setAttribute("for",this._proxyId),t.setAttribute("trigger","manual"),t.setAttribute("placement","right-start"),t.panelClass="nile-context-menu-panel",t.zIndex=this.zIndex,t.interactive=!0,t.hideOnClick=!1,t.closeOnEscape=!1,t.arrow="none",t.distance=0;var i=document.createElement("div");i.className="nile-context-menu__menu",i.setAttribute("role","menu"),t.appendChild(i),document.body.appendChild(t),this._floatingPanelEl=t,this._menuContainerRef=i,i.addEventListener("click",this._onMenuClick),i.addEventListener("mouseover",this._onMenuMouseOver),i.addEventListener("mouseenter",this._onPanelEnter),i.addEventListener("mouseleave",this._onPanelLeave),i.addEventListener("nile-change",this._onNestedSelect),this._relocateLightChildren(),this._setupDone=!0;}},{key:"firstUpdated",value:function firstUpdated(){this._relocateLightChildren();}},{key:"_relocateLightChildren",value:function _relocateLightChildren(){if(this._menuContainerRef)for(var _i=0,_Array$from=Array.from(this.children);_i<_Array$from.length;_i++){var _t=_Array$from[_i];this._menuContainerRef.appendChild(_t);}}},{key:"_clearTimers",value:function _clearTimers(){null!=this._openTimer&&(clearTimeout(this._openTimer),this._openTimer=void 0),null!=this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=void 0);}},{key:"openSubmenu",value:function openSubmenu(){var _this$_parentItem6,_this4=this,_this$_parentItem7,_this$_parentItem7$se;this._open||((_this$_parentItem6=this._parentItem)===null||_this$_parentItem6===void 0?void 0:_this$_parentItem6.disabled)||(this._closeSiblingSubmenus(),this._ensureProxy(),this._ensureBodyPanel(),this._syncProxyToParent(),this._open=!0,this._floatingPanelEl&&(this._floatingPanelEl.addEventListener("nile-after-show",function(){_this4._open&&_this4._openPinnedDescendants();},{once:!0}),this._floatingPanelEl.open=!0),_r.openStack.push(this),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition),requestAnimationFrame(function(){return requestAnimationFrame(function(){_this4._open&&_this4._openPinnedDescendants();});}),(_this$_parentItem7=this._parentItem)===null||_this$_parentItem7===void 0||(_this$_parentItem7$se=_this$_parentItem7.setSubmenuExpanded)===null||_this$_parentItem7$se===void 0?void 0:_this$_parentItem7$se.call(_this$_parentItem7,!0));}},{key:"_openPinnedDescendants",value:function _openPinnedDescendants(){if(!this._menuContainerRef)return;var t=Array.from(this._menuContainerRef.querySelectorAll(l));for(var _i2=0,_t2=t;_i2<_t2.length;_i2++){var _i3=_t2[_i2];if(!this._isDirectChildItem(_i3))continue;if(!_i3.open||_i3.disabled)continue;var _t3=_i3.querySelector(":scope > ".concat(c));_t3===null||_t3===void 0||_t3.openSubmenu();}}},{key:"_isDirectChildItem",value:function _isDirectChildItem(t){var i=t.parentElement;for(;i&&i!==this._menuContainerRef;){if(i.tagName.toLowerCase()===c)return!1;i=i.parentElement;}return!0;}},{key:"closeSubmenu",value:function closeSubmenu(){var _this5=this;if(this._open){var _this$_parentItem8,_this$_parentItem8$se;for(var _i4=0,_arr=_toConsumableArray(_r.openStack);_i4<_arr.length;_i4++){var _this$_menuContainerR2;var _t4=_arr[_i4];_t4!==this&&((_this$_menuContainerR2=this._menuContainerRef)===null||_this$_menuContainerR2===void 0?void 0:_this$_menuContainerR2.contains(_t4))&&_t4.closeSubmenu();}this._open=!1,this._floatingPanelEl&&(this._floatingPanelEl.open=!1),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),_r.openStack=_r.openStack.filter(function(t){return t!==_this5;}),this._clearTimers(),(_this$_parentItem8=this._parentItem)===null||_this$_parentItem8===void 0||(_this$_parentItem8$se=_this$_parentItem8.setSubmenuExpanded)===null||_this$_parentItem8$se===void 0?void 0:_this$_parentItem8$se.call(_this$_parentItem8,!1);}}},{key:"isOpen",get:function get(){return this._open;}},{key:"parentItem",get:function get(){return this._parentItem;}},{key:"focusFirstItem",value:function focusFirstItem(){if(!this._menuContainerRef)return;var t=Array.from(this._menuContainerRef.querySelectorAll(l));for(var _i5=0,_t5=t;_i5<_t5.length;_i5++){var _i6=_t5[_i5];if(this._isDirectChildItem(_i6)&&!_i6.disabled)return void _i6.focus();}}},{key:"_closeSiblingSubmenus",value:function _closeSiblingSubmenus(){var t=this._parentLevel();for(var _i7=0,_arr2=_toConsumableArray(_r.openStack);_i7<_arr2.length;_i7++){var _i8=_arr2[_i7];_i8!==this&&(_i8._pinnedOpen||_i8._parentLevel()===t&&_i8.closeSubmenu());}}},{key:"_parentLevel",value:function _parentLevel(){var _t$parentElement$clos,_t$parentElement;var t=this._parentItem;return t?(_t$parentElement$clos=(_t$parentElement=t.parentElement)===null||_t$parentElement===void 0?void 0:_t$parentElement.closest(".nile-context-menu__menu"))!==null&&_t$parentElement$clos!==void 0?_t$parentElement$clos:null:null;}},{key:"render",value:function render(){return s(_templateObject||(_templateObject=_taggedTemplateLiteral([""])));}}],[{key:"styles",get:function get(){return[i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n :host { display: contents; }\n "])))];}},{key:"findByContainer",value:function findByContainer(t){var _iterator=_createForOfIteratorHelper(_r.openStack),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _i9=_step.value;if(_i9._menuContainerRef===t)return _i9;}}catch(err){_iterator.e(err);}finally{_iterator.f();}return null;}}]);}(o));a.openStack=[],t([e({attribute:!0,type:Number,reflect:!0})],a.prototype,"zIndex",void 0),t([n()],a.prototype,"_open",void 0),_export("N",a=_r=t([h("nile-context-submenu")],a));}};});
|
|
2
2
|
//# sourceMappingURL=nile-context-submenu.cjs.js.map
|