diff --git a/assets/css/main.css b/assets/css/main.css deleted file mode 100644 index 46571c27..00000000 --- a/assets/css/main.css +++ /dev/null @@ -1,2660 +0,0 @@ -:root { - --color-background: #fdfdfd; - --color-text: #222; - --color-text-aside: #707070; - --color-link: #4da6ff; - --color-menu-divider: #eee; - --color-menu-divider-focus: #000; - --color-menu-label: #707070; - --color-panel: #fff; - --color-panel-divider: #eee; - --color-comment-tag: #707070; - --color-comment-tag-text: #fff; - --color-code-background: rgba(0, 0, 0, 0.04); - --color-ts: #9600ff; - --color-ts-interface: #647f1b; - --color-ts-enum: #937210; - --color-ts-class: #0672de; - --color-ts-private: #707070; - --color-toolbar: #fff; - --color-toolbar-text: #333; -} - -/*! normalize.css v1.1.3 | MIT License | git.io/normalize */ -/* ========================================================================== - * * HTML5 display definitions - * * ========================================================================== */ -/** - * * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3. */ -article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { - display: block; -} - -/** - * * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. */ -audio, canvas, video { - display: inline-block; - *display: inline; - *zoom: 1; -} - -/** - * * Prevent modern browsers from displaying `audio` without controls. - * * Remove excess height in iOS 5 devices. */ -audio:not([controls]) { - display: none; - height: 0; -} - -/** - * * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. - * * Known issue: no IE 6 support. */ -[hidden] { - display: none; -} - -/* ========================================================================== - * * Base - * * ========================================================================== */ -/** - * * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using - * * `em` units. - * * 2. Prevent iOS text size adjust after orientation change, without disabling - * * user zoom. */ -html { - font-size: 100%; - /* 1 */ - -ms-text-size-adjust: 100%; - /* 2 */ - -webkit-text-size-adjust: 100%; - /* 2 */ - font-family: sans-serif; -} - -/** - * * Address `font-family` inconsistency between `textarea` and other form - * * elements. */ -button, input, select, textarea { - font-family: sans-serif; -} - -/** - * * Address margins handled incorrectly in IE 6/7. */ -body { - margin: 0; -} - -/* ========================================================================== - * * Links - * * ========================================================================== */ -/** - * * Address `outline` inconsistency between Chrome and other browsers. */ -a:focus { - outline: thin dotted; -} -a:active, a:hover { - outline: 0; -} - -/** - * * Improve readability when focused and also mouse hovered in all browsers. */ -/* ========================================================================== - * * Typography - * * ========================================================================== */ -/** - * * Address font sizes and margins set differently in IE 6/7. - * * Address font sizes within `section` and `article` in Firefox 4+, Safari 5, - * * and Chrome. */ -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -h2 { - font-size: 1.5em; - margin: 0.83em 0; -} - -h3 { - font-size: 1.17em; - margin: 1em 0; -} - -h4, .tsd-index-panel h3 { - font-size: 1em; - margin: 1.33em 0; -} - -h5 { - font-size: 0.83em; - margin: 1.67em 0; -} - -h6 { - font-size: 0.67em; - margin: 2.33em 0; -} - -/** - * * Address styling not present in IE 7/8/9, Safari 5, and Chrome. */ -abbr[title] { - border-bottom: 1px dotted; -} - -/** - * * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome. */ -b, strong { - font-weight: bold; -} - -blockquote { - margin: 1em 40px; -} - -/** - * * Address styling not present in Safari 5 and Chrome. */ -dfn { - font-style: italic; -} - -/** - * * Address differences between Firefox and other browsers. - * * Known issue: no IE 6/7 normalization. */ -hr { - -moz-box-sizing: content-box; - box-sizing: content-box; - height: 0; -} - -/** - * * Address styling not present in IE 6/7/8/9. */ -mark { - background: #ff0; - color: #000; -} - -/** - * * Address margins set differently in IE 6/7. */ -p, pre { - margin: 1em 0; -} - -/** - * * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. */ -code, kbd, pre, samp { - font-family: monospace, serif; - _font-family: "courier new", monospace; - font-size: 1em; -} - -/** - * * Improve readability of pre-formatted text in all browsers. */ -pre { - white-space: pre; - white-space: pre-wrap; - word-wrap: break-word; -} - -/** - * * Address CSS quotes not supported in IE 6/7. */ -q { - quotes: none; -} -q:before, q:after { - content: ""; - content: none; -} - -/** - * * Address `quotes` property not supported in Safari 4. */ -/** - * * Address inconsistent and variable font size in all browsers. */ -small { - font-size: 80%; -} - -/** - * * Prevent `sub` and `sup` affecting `line-height` in all browsers. */ -sub { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -/* ========================================================================== - * * Lists - * * ========================================================================== */ -/** - * * Address margins set differently in IE 6/7. */ -dl, menu, ol, ul { - margin: 1em 0; -} - -dd { - margin: 0 0 0 40px; -} - -/** - * * Address paddings set differently in IE 6/7. */ -menu, ol, ul { - padding: 0 0 0 40px; -} - -/** - * * Correct list images handled incorrectly in IE 7. */ -nav ul, nav ol { - list-style: none; - list-style-image: none; -} - -/* ========================================================================== - * * Embedded content - * * ========================================================================== */ -/** - * * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. - * * 2. Improve image quality when scaled in IE 7. */ -img { - border: 0; - /* 1 */ - -ms-interpolation-mode: bicubic; -} - -/* 2 */ -/** - * * Correct overflow displayed oddly in IE 9. */ -svg:not(:root) { - overflow: hidden; -} - -/* ========================================================================== - * * Figures - * * ========================================================================== */ -/** - * * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. */ -figure, form { - margin: 0; -} - -/* ========================================================================== - * * Forms - * * ========================================================================== */ -/** - * * Correct margin displayed oddly in IE 6/7. */ -/** - * * Define consistent border, margin, and padding. */ -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/** - * * 1. Correct color not being inherited in IE 6/7/8/9. - * * 2. Correct text not wrapping in Firefox 3. - * * 3. Correct alignment displayed oddly in IE 6/7. */ -legend { - border: 0; - /* 1 */ - padding: 0; - white-space: normal; - /* 2 */ - *margin-left: -7px; -} - -/* 3 */ -/** - * * 1. Correct font size not being inherited in all browsers. - * * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, - * * and Chrome. - * * 3. Improve appearance and consistency in all browsers. */ -button, input, select, textarea { - font-size: 100%; - /* 1 */ - margin: 0; - /* 2 */ - vertical-align: baseline; - /* 3 */ - *vertical-align: middle; -} - -/* 3 */ -/** - * * Address Firefox 3+ setting `line-height` on `input` using `!important` in - * * the UA stylesheet. */ -button, input { - line-height: normal; -} - -/** - * * Address inconsistent `text-transform` inheritance for `button` and `select`. - * * All other form control elements do not inherit `text-transform` values. - * * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+. - * * Correct `select` style inheritance in Firefox 4+ and Opera. */ -button, select { - text-transform: none; -} - -/** - * * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * * and `video` controls. - * * 2. Correct inability to style clickable `input` types in iOS. - * * 3. Improve usability and consistency of cursor style between image-type - * * `input` and others. - * * 4. Remove inner spacing in IE 7 without affecting normal text inputs. - * * Known issue: inner spacing remains in IE 6. */ -button, html input[type=button] { - -webkit-appearance: button; - /* 2 */ - cursor: pointer; - /* 3 */ - *overflow: visible; -} - -/* 4 */ -input[type=reset], input[type=submit] { - -webkit-appearance: button; - /* 2 */ - cursor: pointer; - /* 3 */ - *overflow: visible; -} - -/* 4 */ -/** - * * Re-set default cursor for disabled elements. */ -button[disabled], html input[disabled] { - cursor: default; -} - -/** - * * 1. Address box sizing set to content-box in IE 8/9. - * * 2. Remove excess padding in IE 8/9. - * * 3. Remove excess padding in IE 7. - * * Known issue: excess padding remains in IE 6. */ -input { - /* 3 */ -} -input[type=checkbox], input[type=radio] { - box-sizing: border-box; - /* 1 */ - padding: 0; - /* 2 */ - *height: 13px; - /* 3 */ - *width: 13px; -} -input[type=search] { - -webkit-appearance: textfield; - /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; - /* 2 */ - box-sizing: content-box; -} -input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. - * * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome - * * (include `-moz` to future-proof). */ -/** - * * Remove inner padding and search cancel button in Safari 5 and Chrome - * * on OS X. */ -/** - * * Remove inner padding and border in Firefox 3+. */ -button::-moz-focus-inner, input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/** - * * 1. Remove default vertical scrollbar in IE 6/7/8/9. - * * 2. Improve readability and alignment in all browsers. */ -textarea { - overflow: auto; - /* 1 */ - vertical-align: top; -} - -/* 2 */ -/* ========================================================================== - * * Tables - * * ========================================================================== */ -/** - * * Remove most spacing between table cells. */ -table { - border-collapse: collapse; - border-spacing: 0; -} - -ul.tsd-descriptions > li > :first-child, .tsd-panel > :first-child, .col > :first-child, .col-11 > :first-child, .col-10 > :first-child, .col-9 > :first-child, .col-8 > :first-child, .col-7 > :first-child, .col-6 > :first-child, .col-5 > :first-child, .col-4 > :first-child, .col-3 > :first-child, .col-2 > :first-child, .col-1 > :first-child, -ul.tsd-descriptions > li > :first-child > :first-child, -.tsd-panel > :first-child > :first-child, -.col > :first-child > :first-child, -.col-11 > :first-child > :first-child, -.col-10 > :first-child > :first-child, -.col-9 > :first-child > :first-child, -.col-8 > :first-child > :first-child, -.col-7 > :first-child > :first-child, -.col-6 > :first-child > :first-child, -.col-5 > :first-child > :first-child, -.col-4 > :first-child > :first-child, -.col-3 > :first-child > :first-child, -.col-2 > :first-child > :first-child, -.col-1 > :first-child > :first-child, -ul.tsd-descriptions > li > :first-child > :first-child > :first-child, -.tsd-panel > :first-child > :first-child > :first-child, -.col > :first-child > :first-child > :first-child, -.col-11 > :first-child > :first-child > :first-child, -.col-10 > :first-child > :first-child > :first-child, -.col-9 > :first-child > :first-child > :first-child, -.col-8 > :first-child > :first-child > :first-child, -.col-7 > :first-child > :first-child > :first-child, -.col-6 > :first-child > :first-child > :first-child, -.col-5 > :first-child > :first-child > :first-child, -.col-4 > :first-child > :first-child > :first-child, -.col-3 > :first-child > :first-child > :first-child, -.col-2 > :first-child > :first-child > :first-child, -.col-1 > :first-child > :first-child > :first-child { - margin-top: 0; -} -ul.tsd-descriptions > li > :last-child, .tsd-panel > :last-child, .col > :last-child, .col-11 > :last-child, .col-10 > :last-child, .col-9 > :last-child, .col-8 > :last-child, .col-7 > :last-child, .col-6 > :last-child, .col-5 > :last-child, .col-4 > :last-child, .col-3 > :last-child, .col-2 > :last-child, .col-1 > :last-child, -ul.tsd-descriptions > li > :last-child > :last-child, -.tsd-panel > :last-child > :last-child, -.col > :last-child > :last-child, -.col-11 > :last-child > :last-child, -.col-10 > :last-child > :last-child, -.col-9 > :last-child > :last-child, -.col-8 > :last-child > :last-child, -.col-7 > :last-child > :last-child, -.col-6 > :last-child > :last-child, -.col-5 > :last-child > :last-child, -.col-4 > :last-child > :last-child, -.col-3 > :last-child > :last-child, -.col-2 > :last-child > :last-child, -.col-1 > :last-child > :last-child, -ul.tsd-descriptions > li > :last-child > :last-child > :last-child, -.tsd-panel > :last-child > :last-child > :last-child, -.col > :last-child > :last-child > :last-child, -.col-11 > :last-child > :last-child > :last-child, -.col-10 > :last-child > :last-child > :last-child, -.col-9 > :last-child > :last-child > :last-child, -.col-8 > :last-child > :last-child > :last-child, -.col-7 > :last-child > :last-child > :last-child, -.col-6 > :last-child > :last-child > :last-child, -.col-5 > :last-child > :last-child > :last-child, -.col-4 > :last-child > :last-child > :last-child, -.col-3 > :last-child > :last-child > :last-child, -.col-2 > :last-child > :last-child > :last-child, -.col-1 > :last-child > :last-child > :last-child { - margin-bottom: 0; -} - -.container { - max-width: 1200px; - margin: 0 auto; - padding: 0 40px; -} -@media (max-width: 640px) { - .container { - padding: 0 20px; - } -} - -.container-main { - padding-bottom: 200px; -} - -.row { - display: flex; - position: relative; - margin: 0 -10px; -} -.row:after { - visibility: hidden; - display: block; - content: ""; - clear: both; - height: 0; -} - -.col, .col-11, .col-10, .col-9, .col-8, .col-7, .col-6, .col-5, .col-4, .col-3, .col-2, .col-1 { - box-sizing: border-box; - float: left; - padding: 0 10px; -} - -.col-1 { - width: 8.3333333333%; -} - -.offset-1 { - margin-left: 8.3333333333%; -} - -.col-2 { - width: 16.6666666667%; -} - -.offset-2 { - margin-left: 16.6666666667%; -} - -.col-3 { - width: 25%; -} - -.offset-3 { - margin-left: 25%; -} - -.col-4 { - width: 33.3333333333%; -} - -.offset-4 { - margin-left: 33.3333333333%; -} - -.col-5 { - width: 41.6666666667%; -} - -.offset-5 { - margin-left: 41.6666666667%; -} - -.col-6 { - width: 50%; -} - -.offset-6 { - margin-left: 50%; -} - -.col-7 { - width: 58.3333333333%; -} - -.offset-7 { - margin-left: 58.3333333333%; -} - -.col-8 { - width: 66.6666666667%; -} - -.offset-8 { - margin-left: 66.6666666667%; -} - -.col-9 { - width: 75%; -} - -.offset-9 { - margin-left: 75%; -} - -.col-10 { - width: 83.3333333333%; -} - -.offset-10 { - margin-left: 83.3333333333%; -} - -.col-11 { - width: 91.6666666667%; -} - -.offset-11 { - margin-left: 91.6666666667%; -} - -.tsd-kind-icon { - display: block; - position: relative; - padding-left: 20px; - text-indent: -20px; -} -.tsd-kind-icon:before { - content: ""; - display: inline-block; - vertical-align: middle; - width: 17px; - height: 17px; - margin: 0 3px 2px 0; - background-image: url(../images/icons.png); -} -@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { - .tsd-kind-icon:before { - background-image: url(../images/icons@2x.png); - background-size: 238px 204px; - } -} - -.tsd-signature.tsd-kind-icon:before { - background-position: 0 -153px; -} - -.tsd-kind-object-literal > .tsd-kind-icon:before { - background-position: 0px -17px; -} -.tsd-kind-object-literal.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -17px; -} -.tsd-kind-object-literal.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -17px; -} - -.tsd-kind-class > .tsd-kind-icon:before { - background-position: 0px -34px; -} -.tsd-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -34px; -} -.tsd-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -34px; -} - -.tsd-kind-class.tsd-has-type-parameter > .tsd-kind-icon:before { - background-position: 0px -51px; -} -.tsd-kind-class.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -51px; -} -.tsd-kind-class.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -51px; -} - -.tsd-kind-interface > .tsd-kind-icon:before { - background-position: 0px -68px; -} -.tsd-kind-interface.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -68px; -} -.tsd-kind-interface.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -68px; -} - -.tsd-kind-interface.tsd-has-type-parameter > .tsd-kind-icon:before { - background-position: 0px -85px; -} -.tsd-kind-interface.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -85px; -} -.tsd-kind-interface.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -85px; -} - -.tsd-kind-namespace > .tsd-kind-icon:before { - background-position: 0px -102px; -} -.tsd-kind-namespace.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -102px; -} -.tsd-kind-namespace.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -102px; -} - -.tsd-kind-module > .tsd-kind-icon:before { - background-position: 0px -102px; -} -.tsd-kind-module.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -102px; -} -.tsd-kind-module.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -102px; -} - -.tsd-kind-enum > .tsd-kind-icon:before { - background-position: 0px -119px; -} -.tsd-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -119px; -} -.tsd-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -119px; -} - -.tsd-kind-enum-member > .tsd-kind-icon:before { - background-position: 0px -136px; -} -.tsd-kind-enum-member.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -136px; -} -.tsd-kind-enum-member.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -136px; -} - -.tsd-kind-signature > .tsd-kind-icon:before { - background-position: 0px -153px; -} -.tsd-kind-signature.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -153px; -} -.tsd-kind-signature.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -153px; -} - -.tsd-kind-type-alias > .tsd-kind-icon:before { - background-position: 0px -170px; -} -.tsd-kind-type-alias.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -170px; -} -.tsd-kind-type-alias.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -170px; -} - -.tsd-kind-type-alias.tsd-has-type-parameter > .tsd-kind-icon:before { - background-position: 0px -187px; -} -.tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { - background-position: -17px -187px; -} -.tsd-kind-type-alias.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { - background-position: -34px -187px; -} - -.tsd-kind-variable > .tsd-kind-icon:before { - background-position: -136px -0px; -} -.tsd-kind-variable.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -0px; -} -.tsd-kind-variable.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -0px; -} -.tsd-kind-variable.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -0px; -} -.tsd-kind-variable.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -0px; -} -.tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -0px; -} -.tsd-kind-variable.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -0px; -} -.tsd-kind-variable.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -0px; -} -.tsd-kind-variable.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -0px; -} -.tsd-kind-variable.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -0px; -} -.tsd-kind-variable.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -0px; -} -.tsd-kind-variable.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -0px; -} -.tsd-kind-variable.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -0px; -} - -.tsd-kind-property > .tsd-kind-icon:before { - background-position: -136px -0px; -} -.tsd-kind-property.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -0px; -} -.tsd-kind-property.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -0px; -} -.tsd-kind-property.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -0px; -} -.tsd-kind-property.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -0px; -} -.tsd-kind-property.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -0px; -} -.tsd-kind-property.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -0px; -} -.tsd-kind-property.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -0px; -} -.tsd-kind-property.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -0px; -} -.tsd-kind-property.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -0px; -} -.tsd-kind-property.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -0px; -} -.tsd-kind-property.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -0px; -} -.tsd-kind-property.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -0px; -} - -.tsd-kind-get-signature > .tsd-kind-icon:before { - background-position: -136px -17px; -} -.tsd-kind-get-signature.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -17px; -} -.tsd-kind-get-signature.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -17px; -} -.tsd-kind-get-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -17px; -} - -.tsd-kind-set-signature > .tsd-kind-icon:before { - background-position: -136px -34px; -} -.tsd-kind-set-signature.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -34px; -} -.tsd-kind-set-signature.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -34px; -} -.tsd-kind-set-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -34px; -} - -.tsd-kind-accessor > .tsd-kind-icon:before { - background-position: -136px -51px; -} -.tsd-kind-accessor.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -51px; -} -.tsd-kind-accessor.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -51px; -} -.tsd-kind-accessor.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -51px; -} - -.tsd-kind-function > .tsd-kind-icon:before { - background-position: -136px -68px; -} -.tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -68px; -} -.tsd-kind-function.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -68px; -} -.tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -68px; -} -.tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -68px; -} -.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -68px; -} -.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -68px; -} -.tsd-kind-function.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -68px; -} -.tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -68px; -} -.tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -68px; -} -.tsd-kind-function.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -68px; -} -.tsd-kind-function.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -68px; -} -.tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -68px; -} - -.tsd-kind-method > .tsd-kind-icon:before { - background-position: -136px -68px; -} -.tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -68px; -} -.tsd-kind-method.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -68px; -} -.tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -68px; -} -.tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -68px; -} -.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -68px; -} -.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -68px; -} -.tsd-kind-method.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -68px; -} -.tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -68px; -} -.tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -68px; -} -.tsd-kind-method.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -68px; -} -.tsd-kind-method.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -68px; -} -.tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -68px; -} - -.tsd-kind-call-signature > .tsd-kind-icon:before { - background-position: -136px -68px; -} -.tsd-kind-call-signature.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -68px; -} -.tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -68px; -} -.tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -68px; -} - -.tsd-kind-function.tsd-has-type-parameter > .tsd-kind-icon:before { - background-position: -136px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -85px; -} -.tsd-kind-function.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -85px; -} - -.tsd-kind-method.tsd-has-type-parameter > .tsd-kind-icon:before { - background-position: -136px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -85px; -} -.tsd-kind-method.tsd-has-type-parameter.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -85px; -} - -.tsd-kind-constructor > .tsd-kind-icon:before { - background-position: -136px -102px; -} -.tsd-kind-constructor.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -102px; -} -.tsd-kind-constructor.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -102px; -} -.tsd-kind-constructor.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -102px; -} - -.tsd-kind-constructor-signature > .tsd-kind-icon:before { - background-position: -136px -102px; -} -.tsd-kind-constructor-signature.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -102px; -} -.tsd-kind-constructor-signature.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -102px; -} -.tsd-kind-constructor-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -102px; -} - -.tsd-kind-index-signature > .tsd-kind-icon:before { - background-position: -136px -119px; -} -.tsd-kind-index-signature.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -119px; -} -.tsd-kind-index-signature.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -119px; -} -.tsd-kind-index-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -119px; -} - -.tsd-kind-event > .tsd-kind-icon:before { - background-position: -136px -136px; -} -.tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -136px; -} -.tsd-kind-event.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -136px; -} -.tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -136px; -} -.tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -136px; -} -.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -136px; -} -.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -136px; -} -.tsd-kind-event.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -136px; -} -.tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -136px; -} -.tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -136px; -} -.tsd-kind-event.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -136px; -} -.tsd-kind-event.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -136px; -} -.tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -136px; -} - -.tsd-is-static > .tsd-kind-icon:before { - background-position: -136px -153px; -} -.tsd-is-static.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -153px; -} -.tsd-is-static.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -153px; -} -.tsd-is-static.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -153px; -} -.tsd-is-static.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -153px; -} -.tsd-is-static.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -153px; -} -.tsd-is-static.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -153px; -} -.tsd-is-static.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -153px; -} -.tsd-is-static.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -153px; -} -.tsd-is-static.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -153px; -} -.tsd-is-static.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -153px; -} -.tsd-is-static.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -153px; -} -.tsd-is-static.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -153px; -} - -.tsd-is-static.tsd-kind-function > .tsd-kind-icon:before { - background-position: -136px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -170px; -} -.tsd-is-static.tsd-kind-function.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -170px; -} - -.tsd-is-static.tsd-kind-method > .tsd-kind-icon:before { - background-position: -136px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -170px; -} -.tsd-is-static.tsd-kind-method.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -170px; -} - -.tsd-is-static.tsd-kind-call-signature > .tsd-kind-icon:before { - background-position: -136px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -170px; -} -.tsd-is-static.tsd-kind-call-signature.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -170px; -} - -.tsd-is-static.tsd-kind-event > .tsd-kind-icon:before { - background-position: -136px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-is-protected > .tsd-kind-icon:before { - background-position: -153px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-class > .tsd-kind-icon:before { - background-position: -51px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -68px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected > .tsd-kind-icon:before { - background-position: -85px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-protected.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -102px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-class.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-enum > .tsd-kind-icon:before { - background-position: -170px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-protected > .tsd-kind-icon:before { - background-position: -187px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-enum.tsd-is-private > .tsd-kind-icon:before { - background-position: -119px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-interface > .tsd-kind-icon:before { - background-position: -204px -187px; -} -.tsd-is-static.tsd-kind-event.tsd-parent-kind-interface.tsd-is-inherited > .tsd-kind-icon:before { - background-position: -221px -187px; -} - -@keyframes fade-in { - from { - opacity: 0; - } - to { - opacity: 1; - } -} -@keyframes fade-out { - from { - opacity: 1; - visibility: visible; - } - to { - opacity: 0; - } -} -@keyframes fade-in-delayed { - 0% { - opacity: 0; - } - 33% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -@keyframes fade-out-delayed { - 0% { - opacity: 1; - visibility: visible; - } - 66% { - opacity: 0; - } - 100% { - opacity: 0; - } -} -@keyframes shift-to-left { - from { - transform: translate(0, 0); - } - to { - transform: translate(-25%, 0); - } -} -@keyframes unshift-to-left { - from { - transform: translate(-25%, 0); - } - to { - transform: translate(0, 0); - } -} -@keyframes pop-in-from-right { - from { - transform: translate(100%, 0); - } - to { - transform: translate(0, 0); - } -} -@keyframes pop-out-to-right { - from { - transform: translate(0, 0); - visibility: visible; - } - to { - transform: translate(100%, 0); - } -} -body { - background: var(--color-background); - font-family: "Segoe UI", sans-serif; - font-size: 16px; - color: var(--color-text); -} - -a { - color: var(--color-link); - text-decoration: none; -} -a:hover { - text-decoration: underline; -} - -code, pre { - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - padding: 0.2em; - margin: 0; - font-size: 14px; - background-color: var(--color-code-background); -} - -pre { - padding: 10px; -} -pre code { - padding: 0; - font-size: 100%; - background-color: transparent; -} - -blockquote { - margin: 1em 0; - padding-left: 1em; - border-left: 4px solid gray; -} - -.tsd-typography { - line-height: 1.333em; -} -.tsd-typography ul { - list-style: square; - padding: 0 0 0 20px; - margin: 0; -} -.tsd-typography h4, .tsd-typography .tsd-index-panel h3, .tsd-index-panel .tsd-typography h3, .tsd-typography h5, .tsd-typography h6 { - font-size: 1em; - margin: 0; -} -.tsd-typography h5, .tsd-typography h6 { - font-weight: normal; -} -.tsd-typography p, .tsd-typography ul, .tsd-typography ol { - margin: 1em 0; -} - -@media (min-width: 901px) and (max-width: 1024px) { - html.default .col-content { - width: 72%; - } - html.default .col-menu { - width: 28%; - } - html.default .tsd-navigation { - padding-left: 10px; - } -} -@media (max-width: 900px) { - html.default .col-content { - float: none; - width: 100%; - } - html.default .col-menu { - position: fixed !important; - overflow: auto; - -webkit-overflow-scrolling: touch; - z-index: 1024; - top: 0 !important; - bottom: 0 !important; - left: auto !important; - right: 0 !important; - width: 100%; - padding: 20px 20px 0 0; - max-width: 450px; - visibility: hidden; - background-color: var(--color-panel); - transform: translate(100%, 0); - } - html.default .col-menu > *:last-child { - padding-bottom: 20px; - } - html.default .overlay { - content: ""; - display: block; - position: fixed; - z-index: 1023; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: rgba(0, 0, 0, 0.75); - visibility: hidden; - } - html.default.to-has-menu .overlay { - animation: fade-in 0.4s; - } - html.default.to-has-menu header, -html.default.to-has-menu footer, -html.default.to-has-menu .col-content { - animation: shift-to-left 0.4s; - } - html.default.to-has-menu .col-menu { - animation: pop-in-from-right 0.4s; - } - html.default.from-has-menu .overlay { - animation: fade-out 0.4s; - } - html.default.from-has-menu header, -html.default.from-has-menu footer, -html.default.from-has-menu .col-content { - animation: unshift-to-left 0.4s; - } - html.default.from-has-menu .col-menu { - animation: pop-out-to-right 0.4s; - } - html.default.has-menu body { - overflow: hidden; - } - html.default.has-menu .overlay { - visibility: visible; - } - html.default.has-menu header, -html.default.has-menu footer, -html.default.has-menu .col-content { - transform: translate(-25%, 0); - } - html.default.has-menu .col-menu { - visibility: visible; - transform: translate(0, 0); - } -} - -.tsd-page-title { - padding: 70px 0 20px 0; - margin: 0 0 40px 0; - background: var(--color-panel); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.35); -} -.tsd-page-title h1 { - margin: 0; -} - -.tsd-breadcrumb { - margin: 0; - padding: 0; - color: var(--color-text-aside); -} -.tsd-breadcrumb a { - color: var(--color-text-aside); - text-decoration: none; -} -.tsd-breadcrumb a:hover { - text-decoration: underline; -} -.tsd-breadcrumb li { - display: inline; -} -.tsd-breadcrumb li:after { - content: " / "; -} - -html.minimal .container { - margin: 0; -} -html.minimal .container-main { - padding-top: 50px; - padding-bottom: 0; -} -html.minimal .content-wrap { - padding-left: 300px; -} -html.minimal .tsd-navigation { - position: fixed !important; - overflow: auto; - -webkit-overflow-scrolling: touch; - box-sizing: border-box; - z-index: 1; - left: 0; - top: 40px; - bottom: 0; - width: 300px; - padding: 20px; - margin: 0; -} -html.minimal .tsd-member .tsd-member { - margin-left: 0; -} -html.minimal .tsd-page-toolbar { - position: fixed; - z-index: 2; -} -html.minimal #tsd-filter .tsd-filter-group { - right: 0; - transform: none; -} -html.minimal footer { - background-color: transparent; -} -html.minimal footer .container { - padding: 0; -} -html.minimal .tsd-generator { - padding: 0; -} -@media (max-width: 900px) { - html.minimal .tsd-navigation { - display: none; - } - html.minimal .content-wrap { - padding-left: 0; - } -} - -dl.tsd-comment-tags { - overflow: hidden; -} -dl.tsd-comment-tags dt { - float: left; - padding: 1px 5px; - margin: 0 10px 0 0; - border-radius: 4px; - border: 1px solid var(--color-comment-tag); - color: var(--color-comment-tag); - font-size: 0.8em; - font-weight: normal; -} -dl.tsd-comment-tags dd { - margin: 0 0 10px 0; -} -dl.tsd-comment-tags dd:before, dl.tsd-comment-tags dd:after { - display: table; - content: " "; -} -dl.tsd-comment-tags dd pre, dl.tsd-comment-tags dd:after { - clear: both; -} -dl.tsd-comment-tags p { - margin: 0; -} - -.tsd-panel.tsd-comment .lead { - font-size: 1.1em; - line-height: 1.333em; - margin-bottom: 2em; -} -.tsd-panel.tsd-comment .lead:last-child { - margin-bottom: 0; -} - -.toggle-protected .tsd-is-private { - display: none; -} - -.toggle-public .tsd-is-private, -.toggle-public .tsd-is-protected, -.toggle-public .tsd-is-private-protected { - display: none; -} - -.toggle-inherited .tsd-is-inherited { - display: none; -} - -.toggle-externals .tsd-is-external { - display: none; -} - -#tsd-filter { - position: relative; - display: inline-block; - height: 40px; - vertical-align: bottom; -} -.no-filter #tsd-filter { - display: none; -} -#tsd-filter .tsd-filter-group { - display: inline-block; - height: 40px; - vertical-align: bottom; - white-space: nowrap; -} -#tsd-filter input { - display: none; -} -@media (max-width: 900px) { - #tsd-filter .tsd-filter-group { - display: block; - position: absolute; - top: 40px; - right: 20px; - height: auto; - background-color: var(--color-panel); - visibility: hidden; - transform: translate(50%, 0); - box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); - } - .has-options #tsd-filter .tsd-filter-group { - visibility: visible; - } - .to-has-options #tsd-filter .tsd-filter-group { - animation: fade-in 0.2s; - } - .from-has-options #tsd-filter .tsd-filter-group { - animation: fade-out 0.2s; - } - #tsd-filter label, -#tsd-filter .tsd-select { - display: block; - padding-right: 20px; - } -} - -footer { - border-top: 1px solid var(--color-panel-divider); - background-color: var(--color-panel); -} -footer.with-border-bottom { - border-bottom: 1px solid var(--color-panel-divider); -} -footer .tsd-legend-group { - font-size: 0; -} -footer .tsd-legend { - display: inline-block; - width: 25%; - padding: 0; - font-size: 16px; - list-style: none; - line-height: 1.333em; - vertical-align: top; -} -@media (max-width: 900px) { - footer .tsd-legend { - width: 50%; - } -} - -.tsd-hierarchy { - list-style: square; - padding: 0 0 0 20px; - margin: 0; -} -.tsd-hierarchy .target { - font-weight: bold; -} - -.tsd-index-panel .tsd-index-content { - margin-bottom: -30px !important; -} -.tsd-index-panel .tsd-index-section { - margin-bottom: 30px !important; -} -.tsd-index-panel h3 { - margin: 0 -20px 10px -20px; - padding: 0 20px 10px 20px; - border-bottom: 1px solid var(--color-panel-divider); -} -.tsd-index-panel ul.tsd-index-list { - -webkit-column-count: 3; - -moz-column-count: 3; - -ms-column-count: 3; - -o-column-count: 3; - column-count: 3; - -webkit-column-gap: 20px; - -moz-column-gap: 20px; - -ms-column-gap: 20px; - -o-column-gap: 20px; - column-gap: 20px; - padding: 0; - list-style: none; - line-height: 1.333em; -} -@media (max-width: 900px) { - .tsd-index-panel ul.tsd-index-list { - -webkit-column-count: 1; - -moz-column-count: 1; - -ms-column-count: 1; - -o-column-count: 1; - column-count: 1; - } -} -@media (min-width: 901px) and (max-width: 1024px) { - .tsd-index-panel ul.tsd-index-list { - -webkit-column-count: 2; - -moz-column-count: 2; - -ms-column-count: 2; - -o-column-count: 2; - column-count: 2; - } -} -.tsd-index-panel ul.tsd-index-list li { - -webkit-page-break-inside: avoid; - -moz-page-break-inside: avoid; - -ms-page-break-inside: avoid; - -o-page-break-inside: avoid; - page-break-inside: avoid; -} -.tsd-index-panel a, -.tsd-index-panel .tsd-parent-kind-module a { - color: var(--color-ts); -} -.tsd-index-panel .tsd-parent-kind-interface a { - color: var(--color-ts-interface); -} -.tsd-index-panel .tsd-parent-kind-enum a { - color: var(--color-ts-enum); -} -.tsd-index-panel .tsd-parent-kind-class a { - color: var(--color-ts-class); -} -.tsd-index-panel .tsd-kind-module a { - color: var(--color-ts); -} -.tsd-index-panel .tsd-kind-interface a { - color: var(--color-ts-interface); -} -.tsd-index-panel .tsd-kind-enum a { - color: var(--color-ts-enum); -} -.tsd-index-panel .tsd-kind-class a { - color: var(--color-ts-class); -} -.tsd-index-panel .tsd-is-private a { - color: var(--color-ts-private); -} - -.tsd-flag { - display: inline-block; - padding: 1px 5px; - border-radius: 4px; - color: var(--color-comment-tag-text); - background-color: var(--color-comment-tag); - text-indent: 0; - font-size: 14px; - font-weight: normal; -} - -.tsd-anchor { - position: absolute; - top: -100px; -} - -.tsd-member { - position: relative; -} -.tsd-member .tsd-anchor + h3 { - margin-top: 0; - margin-bottom: 0; - border-bottom: none; -} -.tsd-member a[data-tsd-kind] { - color: var(--color-ts); -} -.tsd-member a[data-tsd-kind=Interface] { - color: var(--color-ts-interface); -} -.tsd-member a[data-tsd-kind=Enum] { - color: var(--color-ts-enum); -} -.tsd-member a[data-tsd-kind=Class] { - color: var(--color-ts-class); -} -.tsd-member a[data-tsd-kind=Private] { - color: var(--color-ts-private); -} - -.tsd-navigation { - margin: 0 0 0 40px; -} -.tsd-navigation a { - display: block; - padding-top: 2px; - padding-bottom: 2px; - border-left: 2px solid transparent; - color: var(--color-text); - text-decoration: none; - transition: border-left-color 0.1s; -} -.tsd-navigation a:hover { - text-decoration: underline; -} -.tsd-navigation ul { - margin: 0; - padding: 0; - list-style: none; -} -.tsd-navigation li { - padding: 0; -} - -.tsd-navigation.primary { - padding-bottom: 40px; -} -.tsd-navigation.primary a { - display: block; - padding-top: 6px; - padding-bottom: 6px; -} -.tsd-navigation.primary ul li a { - padding-left: 5px; -} -.tsd-navigation.primary ul li li a { - padding-left: 25px; -} -.tsd-navigation.primary ul li li li a { - padding-left: 45px; -} -.tsd-navigation.primary ul li li li li a { - padding-left: 65px; -} -.tsd-navigation.primary ul li li li li li a { - padding-left: 85px; -} -.tsd-navigation.primary ul li li li li li li a { - padding-left: 105px; -} -.tsd-navigation.primary > ul { - border-bottom: 1px solid var(--color-panel-divider); -} -.tsd-navigation.primary li { - border-top: 1px solid var(--color-panel-divider); -} -.tsd-navigation.primary li.current > a { - font-weight: bold; -} -.tsd-navigation.primary li.label span { - display: block; - padding: 20px 0 6px 5px; - color: var(--color-menu-label); -} -.tsd-navigation.primary li.globals + li > span, .tsd-navigation.primary li.globals + li > a { - padding-top: 20px; -} - -.tsd-navigation.secondary { - max-height: calc(100vh - 1rem - 40px); - overflow: auto; - position: -webkit-sticky; - position: sticky; - top: calc(.5rem + 40px); - transition: 0.3s; -} -.tsd-navigation.secondary.tsd-navigation--toolbar-hide { - max-height: calc(100vh - 1rem); - top: 0.5rem; -} -.tsd-navigation.secondary ul { - transition: opacity 0.2s; -} -.tsd-navigation.secondary ul li a { - padding-left: 25px; -} -.tsd-navigation.secondary ul li li a { - padding-left: 45px; -} -.tsd-navigation.secondary ul li li li a { - padding-left: 65px; -} -.tsd-navigation.secondary ul li li li li a { - padding-left: 85px; -} -.tsd-navigation.secondary ul li li li li li a { - padding-left: 105px; -} -.tsd-navigation.secondary ul li li li li li li a { - padding-left: 125px; -} -.tsd-navigation.secondary ul.current a { - border-left-color: var(--color-panel-divider); -} -.tsd-navigation.secondary li.focus > a, -.tsd-navigation.secondary ul.current li.focus > a { - border-left-color: var(--color-menu-divider-focus); -} -.tsd-navigation.secondary li.current { - margin-top: 20px; - margin-bottom: 20px; - border-left-color: var(--color-panel-divider); -} -.tsd-navigation.secondary li.current > a { - font-weight: bold; -} - -@media (min-width: 901px) { - .menu-sticky-wrap { - position: static; - } -} - -.tsd-panel { - margin: 20px 0; - padding: 20px; - background-color: var(--color-panel); - box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); -} -.tsd-panel:empty { - display: none; -} -.tsd-panel > h1, .tsd-panel > h2, .tsd-panel > h3 { - margin: 1.5em -20px 10px -20px; - padding: 0 20px 10px 20px; - border-bottom: 1px solid var(--color-panel-divider); -} -.tsd-panel > h1.tsd-before-signature, .tsd-panel > h2.tsd-before-signature, .tsd-panel > h3.tsd-before-signature { - margin-bottom: 0; - border-bottom: 0; -} -.tsd-panel table { - display: block; - width: 100%; - overflow: auto; - margin-top: 10px; - word-break: normal; - word-break: keep-all; -} -.tsd-panel table th { - font-weight: bold; -} -.tsd-panel table th, .tsd-panel table td { - padding: 6px 13px; - border: 1px solid #ddd; -} -.tsd-panel table tr { - background-color: #fff; - border-top: 1px solid #ccc; -} -.tsd-panel table tr:nth-child(2n) { - background-color: #f8f8f8; -} - -.tsd-panel-group { - margin: 60px 0; -} -.tsd-panel-group > h1, .tsd-panel-group > h2, .tsd-panel-group > h3 { - padding-left: 20px; - padding-right: 20px; -} - -#tsd-search { - transition: background-color 0.2s; -} -#tsd-search .title { - position: relative; - z-index: 2; -} -#tsd-search .field { - position: absolute; - left: 0; - top: 0; - right: 40px; - height: 40px; -} -#tsd-search .field input { - box-sizing: border-box; - position: relative; - top: -50px; - z-index: 1; - width: 100%; - padding: 0 10px; - opacity: 0; - outline: 0; - border: 0; - background: transparent; - color: var(--color-text); -} -#tsd-search .field label { - position: absolute; - overflow: hidden; - right: -40px; -} -#tsd-search .field input, -#tsd-search .title { - transition: opacity 0.2s; -} -#tsd-search .results { - position: absolute; - visibility: hidden; - top: 40px; - width: 100%; - margin: 0; - padding: 0; - list-style: none; - box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); -} -#tsd-search .results li { - padding: 0 10px; - background-color: var(--color-background); -} -#tsd-search .results li:nth-child(even) { - background-color: var(--color-panel); -} -#tsd-search .results li.state { - display: none; -} -#tsd-search .results li.current, -#tsd-search .results li:hover { - background-color: var(--color-panel-divider); -} -#tsd-search .results a { - display: block; -} -#tsd-search .results a:before { - top: 10px; -} -#tsd-search .results span.parent { - color: var(--color-text-aside); - font-weight: normal; -} -#tsd-search.has-focus { - background-color: var(--color-panel-divider); -} -#tsd-search.has-focus .field input { - top: 0; - opacity: 1; -} -#tsd-search.has-focus .title { - z-index: 0; - opacity: 0; -} -#tsd-search.has-focus .results { - visibility: visible; -} -#tsd-search.loading .results li.state.loading { - display: block; -} -#tsd-search.failure .results li.state.failure { - display: block; -} - -.tsd-signature { - margin: 0 0 1em 0; - padding: 10px; - border: 1px solid var(--color-panel-divider); - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - font-size: 14px; - overflow-x: auto; -} -.tsd-signature.tsd-kind-icon { - padding-left: 30px; -} -.tsd-signature.tsd-kind-icon:before { - top: 10px; - left: 10px; -} -.tsd-panel > .tsd-signature { - margin-left: -20px; - margin-right: -20px; - border-width: 1px 0; -} -.tsd-panel > .tsd-signature.tsd-kind-icon { - padding-left: 40px; -} -.tsd-panel > .tsd-signature.tsd-kind-icon:before { - left: 20px; -} - -.tsd-signature-symbol { - color: var(--color-text-aside); - font-weight: normal; -} - -.tsd-signature-type { - font-style: italic; - font-weight: normal; -} - -.tsd-signatures { - padding: 0; - margin: 0 0 1em 0; - border: 1px solid var(--color-panel-divider); -} -.tsd-signatures .tsd-signature { - margin: 0; - border-width: 1px 0 0 0; - transition: background-color 0.1s; -} -.tsd-signatures .tsd-signature:first-child { - border-top-width: 0; -} -.tsd-signatures .tsd-signature.current { - background-color: var(--color-panel-divider); -} -.tsd-signatures.active > .tsd-signature { - cursor: pointer; -} -.tsd-panel > .tsd-signatures { - margin-left: -20px; - margin-right: -20px; - border-width: 1px 0; -} -.tsd-panel > .tsd-signatures .tsd-signature.tsd-kind-icon { - padding-left: 40px; -} -.tsd-panel > .tsd-signatures .tsd-signature.tsd-kind-icon:before { - left: 20px; -} -.tsd-panel > a.anchor + .tsd-signatures { - border-top-width: 0; - margin-top: -20px; -} - -ul.tsd-descriptions { - position: relative; - overflow: hidden; - padding: 0; - list-style: none; -} -ul.tsd-descriptions.active > .tsd-description { - display: none; -} -ul.tsd-descriptions.active > .tsd-description.current { - display: block; -} -ul.tsd-descriptions.active > .tsd-description.fade-in { - animation: fade-in-delayed 0.3s; -} -ul.tsd-descriptions.active > .tsd-description.fade-out { - animation: fade-out-delayed 0.3s; - position: absolute; - display: block; - top: 0; - left: 0; - right: 0; - opacity: 0; - visibility: hidden; -} -ul.tsd-descriptions h4, ul.tsd-descriptions .tsd-index-panel h3, .tsd-index-panel ul.tsd-descriptions h3 { - font-size: 16px; - margin: 1em 0 0.5em 0; -} - -ul.tsd-parameters, -ul.tsd-type-parameters { - list-style: square; - margin: 0; - padding-left: 20px; -} -ul.tsd-parameters > li.tsd-parameter-signature, -ul.tsd-type-parameters > li.tsd-parameter-signature { - list-style: none; - margin-left: -20px; -} -ul.tsd-parameters h5, -ul.tsd-type-parameters h5 { - font-size: 16px; - margin: 1em 0 0.5em 0; -} -ul.tsd-parameters .tsd-comment, -ul.tsd-type-parameters .tsd-comment { - margin-top: -0.5em; -} - -.tsd-sources { - font-size: 14px; - color: var(--color-text-aside); - margin: 0 0 1em 0; -} -.tsd-sources a { - color: var(--color-text-aside); - text-decoration: underline; -} -.tsd-sources ul, .tsd-sources p { - margin: 0 !important; -} -.tsd-sources ul { - list-style: none; - padding: 0; -} - -.tsd-page-toolbar { - position: fixed; - z-index: 1; - top: 0; - left: 0; - width: 100%; - height: 40px; - color: var(--color-toolbar-text); - background: var(--color-toolbar); - border-bottom: 1px solid var(--color-panel-divider); - transition: transform 0.3s linear; -} -.tsd-page-toolbar a { - color: var(--color-toolbar-text); - text-decoration: none; -} -.tsd-page-toolbar a.title { - font-weight: bold; -} -.tsd-page-toolbar a.title:hover { - text-decoration: underline; -} -.tsd-page-toolbar .table-wrap { - display: table; - width: 100%; - height: 40px; -} -.tsd-page-toolbar .table-cell { - display: table-cell; - position: relative; - white-space: nowrap; - line-height: 40px; -} -.tsd-page-toolbar .table-cell:first-child { - width: 100%; -} - -.tsd-page-toolbar--hide { - transform: translateY(-100%); -} - -.tsd-select .tsd-select-list li:before, .tsd-select .tsd-select-label:before, .tsd-widget:before { - content: ""; - display: inline-block; - width: 40px; - height: 40px; - margin: 0 -8px 0 0; - background-image: url(../images/widgets.png); - background-repeat: no-repeat; - text-indent: -1024px; - vertical-align: bottom; -} -@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { - .tsd-select .tsd-select-list li:before, .tsd-select .tsd-select-label:before, .tsd-widget:before { - background-image: url(../images/widgets@2x.png); - background-size: 320px 40px; - } -} - -.tsd-widget { - display: inline-block; - overflow: hidden; - opacity: 0.6; - height: 40px; - transition: opacity 0.1s, background-color 0.2s; - vertical-align: bottom; - cursor: pointer; -} -.tsd-widget:hover { - opacity: 0.8; -} -.tsd-widget.active { - opacity: 1; - background-color: var(--color-panel-divider); -} -.tsd-widget.no-caption { - width: 40px; -} -.tsd-widget.no-caption:before { - margin: 0; -} -.tsd-widget.search:before { - background-position: 0 0; -} -.tsd-widget.menu:before { - background-position: -40px 0; -} -.tsd-widget.options:before { - background-position: -80px 0; -} -.tsd-widget.options, .tsd-widget.menu { - display: none; -} -@media (max-width: 900px) { - .tsd-widget.options, .tsd-widget.menu { - display: inline-block; - } -} -input[type=checkbox] + .tsd-widget:before { - background-position: -120px 0; -} -input[type=checkbox]:checked + .tsd-widget:before { - background-position: -160px 0; -} - -.tsd-select { - position: relative; - display: inline-block; - height: 40px; - transition: opacity 0.1s, background-color 0.2s; - vertical-align: bottom; - cursor: pointer; -} -.tsd-select .tsd-select-label { - opacity: 0.6; - transition: opacity 0.2s; -} -.tsd-select .tsd-select-label:before { - background-position: -240px 0; -} -.tsd-select.active .tsd-select-label { - opacity: 0.8; -} -.tsd-select.active .tsd-select-list { - visibility: visible; - opacity: 1; - transition-delay: 0s; -} -.tsd-select .tsd-select-list { - position: absolute; - visibility: hidden; - top: 40px; - left: 0; - margin: 0; - padding: 0; - opacity: 0; - list-style: none; - box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); - transition: visibility 0s 0.2s, opacity 0.2s; -} -.tsd-select .tsd-select-list li { - padding: 0 20px 0 0; - background-color: var(--color-background); -} -.tsd-select .tsd-select-list li:before { - background-position: 40px 0; -} -.tsd-select .tsd-select-list li:nth-child(even) { - background-color: var(--color-panel); -} -.tsd-select .tsd-select-list li:hover { - background-color: var(--color-panel-divider); -} -.tsd-select .tsd-select-list li.selected:before { - background-position: -200px 0; -} -@media (max-width: 900px) { - .tsd-select .tsd-select-list { - top: 0; - left: auto; - right: 100%; - margin-right: -5px; - } - .tsd-select .tsd-select-label:before { - background-position: -280px 0; - } -} - -img { - max-width: 100%; -} diff --git a/assets/images/icons.png b/assets/images/icons.png deleted file mode 100644 index 3836d5fe..00000000 Binary files a/assets/images/icons.png and /dev/null differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png deleted file mode 100644 index 5a209e2f..00000000 Binary files a/assets/images/icons@2x.png and /dev/null differ diff --git a/assets/images/widgets.png b/assets/images/widgets.png deleted file mode 100644 index c7380532..00000000 Binary files a/assets/images/widgets.png and /dev/null differ diff --git a/assets/images/widgets@2x.png b/assets/images/widgets@2x.png deleted file mode 100644 index 4bbbd572..00000000 Binary files a/assets/images/widgets@2x.png and /dev/null differ diff --git a/assets/js/main.js b/assets/js/main.js deleted file mode 100644 index dc257a86..00000000 --- a/assets/js/main.js +++ /dev/null @@ -1,248 +0,0 @@ -/* - * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). - * This devtool is not neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). - */ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "../node_modules/lunr/lunr.js": -/*!************************************!*\ - !*** ../node_modules/lunr/lunr.js ***! - \************************************/ -/***/ ((module, exports, __webpack_require__) => { - -eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**\n * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9\n * Copyright (C) 2020 Oliver Nightingale\n * @license MIT\n */\n\n;(function(){\n\n/**\n * A convenience function for configuring and constructing\n * a new lunr Index.\n *\n * A lunr.Builder instance is created and the pipeline setup\n * with a trimmer, stop word filter and stemmer.\n *\n * This builder object is yielded to the configuration function\n * that is passed as a parameter, allowing the list of fields\n * and other builder parameters to be customised.\n *\n * All documents _must_ be added within the passed config function.\n *\n * @example\n * var idx = lunr(function () {\n * this.field('title')\n * this.field('body')\n * this.ref('id')\n *\n * documents.forEach(function (doc) {\n * this.add(doc)\n * }, this)\n * })\n *\n * @see {@link lunr.Builder}\n * @see {@link lunr.Pipeline}\n * @see {@link lunr.trimmer}\n * @see {@link lunr.stopWordFilter}\n * @see {@link lunr.stemmer}\n * @namespace {function} lunr\n */\nvar lunr = function (config) {\n var builder = new lunr.Builder\n\n builder.pipeline.add(\n lunr.trimmer,\n lunr.stopWordFilter,\n lunr.stemmer\n )\n\n builder.searchPipeline.add(\n lunr.stemmer\n )\n\n config.call(builder, builder)\n return builder.build()\n}\n\nlunr.version = \"2.3.9\"\n/*!\n * lunr.utils\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * A namespace containing utils for the rest of the lunr library\n * @namespace lunr.utils\n */\nlunr.utils = {}\n\n/**\n * Print a warning message to the console.\n *\n * @param {String} message The message to be printed.\n * @memberOf lunr.utils\n * @function\n */\nlunr.utils.warn = (function (global) {\n /* eslint-disable no-console */\n return function (message) {\n if (global.console && console.warn) {\n console.warn(message)\n }\n }\n /* eslint-enable no-console */\n})(this)\n\n/**\n * Convert an object to a string.\n *\n * In the case of `null` and `undefined` the function returns\n * the empty string, in all other cases the result of calling\n * `toString` on the passed object is returned.\n *\n * @param {Any} obj The object to convert to a string.\n * @return {String} string representation of the passed object.\n * @memberOf lunr.utils\n */\nlunr.utils.asString = function (obj) {\n if (obj === void 0 || obj === null) {\n return \"\"\n } else {\n return obj.toString()\n }\n}\n\n/**\n * Clones an object.\n *\n * Will create a copy of an existing object such that any mutations\n * on the copy cannot affect the original.\n *\n * Only shallow objects are supported, passing a nested object to this\n * function will cause a TypeError.\n *\n * Objects with primitives, and arrays of primitives are supported.\n *\n * @param {Object} obj The object to clone.\n * @return {Object} a clone of the passed object.\n * @throws {TypeError} when a nested object is passed.\n * @memberOf Utils\n */\nlunr.utils.clone = function (obj) {\n if (obj === null || obj === undefined) {\n return obj\n }\n\n var clone = Object.create(null),\n keys = Object.keys(obj)\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i],\n val = obj[key]\n\n if (Array.isArray(val)) {\n clone[key] = val.slice()\n continue\n }\n\n if (typeof val === 'string' ||\n typeof val === 'number' ||\n typeof val === 'boolean') {\n clone[key] = val\n continue\n }\n\n throw new TypeError(\"clone is not deep and does not support nested objects\")\n }\n\n return clone\n}\nlunr.FieldRef = function (docRef, fieldName, stringValue) {\n this.docRef = docRef\n this.fieldName = fieldName\n this._stringValue = stringValue\n}\n\nlunr.FieldRef.joiner = \"/\"\n\nlunr.FieldRef.fromString = function (s) {\n var n = s.indexOf(lunr.FieldRef.joiner)\n\n if (n === -1) {\n throw \"malformed field ref string\"\n }\n\n var fieldRef = s.slice(0, n),\n docRef = s.slice(n + 1)\n\n return new lunr.FieldRef (docRef, fieldRef, s)\n}\n\nlunr.FieldRef.prototype.toString = function () {\n if (this._stringValue == undefined) {\n this._stringValue = this.fieldName + lunr.FieldRef.joiner + this.docRef\n }\n\n return this._stringValue\n}\n/*!\n * lunr.Set\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * A lunr set.\n *\n * @constructor\n */\nlunr.Set = function (elements) {\n this.elements = Object.create(null)\n\n if (elements) {\n this.length = elements.length\n\n for (var i = 0; i < this.length; i++) {\n this.elements[elements[i]] = true\n }\n } else {\n this.length = 0\n }\n}\n\n/**\n * A complete set that contains all elements.\n *\n * @static\n * @readonly\n * @type {lunr.Set}\n */\nlunr.Set.complete = {\n intersect: function (other) {\n return other\n },\n\n union: function () {\n return this\n },\n\n contains: function () {\n return true\n }\n}\n\n/**\n * An empty set that contains no elements.\n *\n * @static\n * @readonly\n * @type {lunr.Set}\n */\nlunr.Set.empty = {\n intersect: function () {\n return this\n },\n\n union: function (other) {\n return other\n },\n\n contains: function () {\n return false\n }\n}\n\n/**\n * Returns true if this set contains the specified object.\n *\n * @param {object} object - Object whose presence in this set is to be tested.\n * @returns {boolean} - True if this set contains the specified object.\n */\nlunr.Set.prototype.contains = function (object) {\n return !!this.elements[object]\n}\n\n/**\n * Returns a new set containing only the elements that are present in both\n * this set and the specified set.\n *\n * @param {lunr.Set} other - set to intersect with this set.\n * @returns {lunr.Set} a new set that is the intersection of this and the specified set.\n */\n\nlunr.Set.prototype.intersect = function (other) {\n var a, b, elements, intersection = []\n\n if (other === lunr.Set.complete) {\n return this\n }\n\n if (other === lunr.Set.empty) {\n return other\n }\n\n if (this.length < other.length) {\n a = this\n b = other\n } else {\n a = other\n b = this\n }\n\n elements = Object.keys(a.elements)\n\n for (var i = 0; i < elements.length; i++) {\n var element = elements[i]\n if (element in b.elements) {\n intersection.push(element)\n }\n }\n\n return new lunr.Set (intersection)\n}\n\n/**\n * Returns a new set combining the elements of this and the specified set.\n *\n * @param {lunr.Set} other - set to union with this set.\n * @return {lunr.Set} a new set that is the union of this and the specified set.\n */\n\nlunr.Set.prototype.union = function (other) {\n if (other === lunr.Set.complete) {\n return lunr.Set.complete\n }\n\n if (other === lunr.Set.empty) {\n return this\n }\n\n return new lunr.Set(Object.keys(this.elements).concat(Object.keys(other.elements)))\n}\n/**\n * A function to calculate the inverse document frequency for\n * a posting. This is shared between the builder and the index\n *\n * @private\n * @param {object} posting - The posting for a given term\n * @param {number} documentCount - The total number of documents.\n */\nlunr.idf = function (posting, documentCount) {\n var documentsWithTerm = 0\n\n for (var fieldName in posting) {\n if (fieldName == '_index') continue // Ignore the term index, its not a field\n documentsWithTerm += Object.keys(posting[fieldName]).length\n }\n\n var x = (documentCount - documentsWithTerm + 0.5) / (documentsWithTerm + 0.5)\n\n return Math.log(1 + Math.abs(x))\n}\n\n/**\n * A token wraps a string representation of a token\n * as it is passed through the text processing pipeline.\n *\n * @constructor\n * @param {string} [str=''] - The string token being wrapped.\n * @param {object} [metadata={}] - Metadata associated with this token.\n */\nlunr.Token = function (str, metadata) {\n this.str = str || \"\"\n this.metadata = metadata || {}\n}\n\n/**\n * Returns the token string that is being wrapped by this object.\n *\n * @returns {string}\n */\nlunr.Token.prototype.toString = function () {\n return this.str\n}\n\n/**\n * A token update function is used when updating or optionally\n * when cloning a token.\n *\n * @callback lunr.Token~updateFunction\n * @param {string} str - The string representation of the token.\n * @param {Object} metadata - All metadata associated with this token.\n */\n\n/**\n * Applies the given function to the wrapped string token.\n *\n * @example\n * token.update(function (str, metadata) {\n * return str.toUpperCase()\n * })\n *\n * @param {lunr.Token~updateFunction} fn - A function to apply to the token string.\n * @returns {lunr.Token}\n */\nlunr.Token.prototype.update = function (fn) {\n this.str = fn(this.str, this.metadata)\n return this\n}\n\n/**\n * Creates a clone of this token. Optionally a function can be\n * applied to the cloned token.\n *\n * @param {lunr.Token~updateFunction} [fn] - An optional function to apply to the cloned token.\n * @returns {lunr.Token}\n */\nlunr.Token.prototype.clone = function (fn) {\n fn = fn || function (s) { return s }\n return new lunr.Token (fn(this.str, this.metadata), this.metadata)\n}\n/*!\n * lunr.tokenizer\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * A function for splitting a string into tokens ready to be inserted into\n * the search index. Uses `lunr.tokenizer.separator` to split strings, change\n * the value of this property to change how strings are split into tokens.\n *\n * This tokenizer will convert its parameter to a string by calling `toString` and\n * then will split this string on the character in `lunr.tokenizer.separator`.\n * Arrays will have their elements converted to strings and wrapped in a lunr.Token.\n *\n * Optional metadata can be passed to the tokenizer, this metadata will be cloned and\n * added as metadata to every token that is created from the object to be tokenized.\n *\n * @static\n * @param {?(string|object|object[])} obj - The object to convert into tokens\n * @param {?object} metadata - Optional metadata to associate with every token\n * @returns {lunr.Token[]}\n * @see {@link lunr.Pipeline}\n */\nlunr.tokenizer = function (obj, metadata) {\n if (obj == null || obj == undefined) {\n return []\n }\n\n if (Array.isArray(obj)) {\n return obj.map(function (t) {\n return new lunr.Token(\n lunr.utils.asString(t).toLowerCase(),\n lunr.utils.clone(metadata)\n )\n })\n }\n\n var str = obj.toString().toLowerCase(),\n len = str.length,\n tokens = []\n\n for (var sliceEnd = 0, sliceStart = 0; sliceEnd <= len; sliceEnd++) {\n var char = str.charAt(sliceEnd),\n sliceLength = sliceEnd - sliceStart\n\n if ((char.match(lunr.tokenizer.separator) || sliceEnd == len)) {\n\n if (sliceLength > 0) {\n var tokenMetadata = lunr.utils.clone(metadata) || {}\n tokenMetadata[\"position\"] = [sliceStart, sliceLength]\n tokenMetadata[\"index\"] = tokens.length\n\n tokens.push(\n new lunr.Token (\n str.slice(sliceStart, sliceEnd),\n tokenMetadata\n )\n )\n }\n\n sliceStart = sliceEnd + 1\n }\n\n }\n\n return tokens\n}\n\n/**\n * The separator used to split a string into tokens. Override this property to change the behaviour of\n * `lunr.tokenizer` behaviour when tokenizing strings. By default this splits on whitespace and hyphens.\n *\n * @static\n * @see lunr.tokenizer\n */\nlunr.tokenizer.separator = /[\\s\\-]+/\n/*!\n * lunr.Pipeline\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * lunr.Pipelines maintain an ordered list of functions to be applied to all\n * tokens in documents entering the search index and queries being ran against\n * the index.\n *\n * An instance of lunr.Index created with the lunr shortcut will contain a\n * pipeline with a stop word filter and an English language stemmer. Extra\n * functions can be added before or after either of these functions or these\n * default functions can be removed.\n *\n * When run the pipeline will call each function in turn, passing a token, the\n * index of that token in the original list of all tokens and finally a list of\n * all the original tokens.\n *\n * The output of functions in the pipeline will be passed to the next function\n * in the pipeline. To exclude a token from entering the index the function\n * should return undefined, the rest of the pipeline will not be called with\n * this token.\n *\n * For serialisation of pipelines to work, all functions used in an instance of\n * a pipeline should be registered with lunr.Pipeline. Registered functions can\n * then be loaded. If trying to load a serialised pipeline that uses functions\n * that are not registered an error will be thrown.\n *\n * If not planning on serialising the pipeline then registering pipeline functions\n * is not necessary.\n *\n * @constructor\n */\nlunr.Pipeline = function () {\n this._stack = []\n}\n\nlunr.Pipeline.registeredFunctions = Object.create(null)\n\n/**\n * A pipeline function maps lunr.Token to lunr.Token. A lunr.Token contains the token\n * string as well as all known metadata. A pipeline function can mutate the token string\n * or mutate (or add) metadata for a given token.\n *\n * A pipeline function can indicate that the passed token should be discarded by returning\n * null, undefined or an empty string. This token will not be passed to any downstream pipeline\n * functions and will not be added to the index.\n *\n * Multiple tokens can be returned by returning an array of tokens. Each token will be passed\n * to any downstream pipeline functions and all will returned tokens will be added to the index.\n *\n * Any number of pipeline functions may be chained together using a lunr.Pipeline.\n *\n * @interface lunr.PipelineFunction\n * @param {lunr.Token} token - A token from the document being processed.\n * @param {number} i - The index of this token in the complete list of tokens for this document/field.\n * @param {lunr.Token[]} tokens - All tokens for this document/field.\n * @returns {(?lunr.Token|lunr.Token[])}\n */\n\n/**\n * Register a function with the pipeline.\n *\n * Functions that are used in the pipeline should be registered if the pipeline\n * needs to be serialised, or a serialised pipeline needs to be loaded.\n *\n * Registering a function does not add it to a pipeline, functions must still be\n * added to instances of the pipeline for them to be used when running a pipeline.\n *\n * @param {lunr.PipelineFunction} fn - The function to check for.\n * @param {String} label - The label to register this function with\n */\nlunr.Pipeline.registerFunction = function (fn, label) {\n if (label in this.registeredFunctions) {\n lunr.utils.warn('Overwriting existing registered function: ' + label)\n }\n\n fn.label = label\n lunr.Pipeline.registeredFunctions[fn.label] = fn\n}\n\n/**\n * Warns if the function is not registered as a Pipeline function.\n *\n * @param {lunr.PipelineFunction} fn - The function to check for.\n * @private\n */\nlunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {\n var isRegistered = fn.label && (fn.label in this.registeredFunctions)\n\n if (!isRegistered) {\n lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\\n', fn)\n }\n}\n\n/**\n * Loads a previously serialised pipeline.\n *\n * All functions to be loaded must already be registered with lunr.Pipeline.\n * If any function from the serialised data has not been registered then an\n * error will be thrown.\n *\n * @param {Object} serialised - The serialised pipeline to load.\n * @returns {lunr.Pipeline}\n */\nlunr.Pipeline.load = function (serialised) {\n var pipeline = new lunr.Pipeline\n\n serialised.forEach(function (fnName) {\n var fn = lunr.Pipeline.registeredFunctions[fnName]\n\n if (fn) {\n pipeline.add(fn)\n } else {\n throw new Error('Cannot load unregistered function: ' + fnName)\n }\n })\n\n return pipeline\n}\n\n/**\n * Adds new functions to the end of the pipeline.\n *\n * Logs a warning if the function has not been registered.\n *\n * @param {lunr.PipelineFunction[]} functions - Any number of functions to add to the pipeline.\n */\nlunr.Pipeline.prototype.add = function () {\n var fns = Array.prototype.slice.call(arguments)\n\n fns.forEach(function (fn) {\n lunr.Pipeline.warnIfFunctionNotRegistered(fn)\n this._stack.push(fn)\n }, this)\n}\n\n/**\n * Adds a single function after a function that already exists in the\n * pipeline.\n *\n * Logs a warning if the function has not been registered.\n *\n * @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.\n * @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.\n */\nlunr.Pipeline.prototype.after = function (existingFn, newFn) {\n lunr.Pipeline.warnIfFunctionNotRegistered(newFn)\n\n var pos = this._stack.indexOf(existingFn)\n if (pos == -1) {\n throw new Error('Cannot find existingFn')\n }\n\n pos = pos + 1\n this._stack.splice(pos, 0, newFn)\n}\n\n/**\n * Adds a single function before a function that already exists in the\n * pipeline.\n *\n * Logs a warning if the function has not been registered.\n *\n * @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.\n * @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.\n */\nlunr.Pipeline.prototype.before = function (existingFn, newFn) {\n lunr.Pipeline.warnIfFunctionNotRegistered(newFn)\n\n var pos = this._stack.indexOf(existingFn)\n if (pos == -1) {\n throw new Error('Cannot find existingFn')\n }\n\n this._stack.splice(pos, 0, newFn)\n}\n\n/**\n * Removes a function from the pipeline.\n *\n * @param {lunr.PipelineFunction} fn The function to remove from the pipeline.\n */\nlunr.Pipeline.prototype.remove = function (fn) {\n var pos = this._stack.indexOf(fn)\n if (pos == -1) {\n return\n }\n\n this._stack.splice(pos, 1)\n}\n\n/**\n * Runs the current list of functions that make up the pipeline against the\n * passed tokens.\n *\n * @param {Array} tokens The tokens to run through the pipeline.\n * @returns {Array}\n */\nlunr.Pipeline.prototype.run = function (tokens) {\n var stackLength = this._stack.length\n\n for (var i = 0; i < stackLength; i++) {\n var fn = this._stack[i]\n var memo = []\n\n for (var j = 0; j < tokens.length; j++) {\n var result = fn(tokens[j], j, tokens)\n\n if (result === null || result === void 0 || result === '') continue\n\n if (Array.isArray(result)) {\n for (var k = 0; k < result.length; k++) {\n memo.push(result[k])\n }\n } else {\n memo.push(result)\n }\n }\n\n tokens = memo\n }\n\n return tokens\n}\n\n/**\n * Convenience method for passing a string through a pipeline and getting\n * strings out. This method takes care of wrapping the passed string in a\n * token and mapping the resulting tokens back to strings.\n *\n * @param {string} str - The string to pass through the pipeline.\n * @param {?object} metadata - Optional metadata to associate with the token\n * passed to the pipeline.\n * @returns {string[]}\n */\nlunr.Pipeline.prototype.runString = function (str, metadata) {\n var token = new lunr.Token (str, metadata)\n\n return this.run([token]).map(function (t) {\n return t.toString()\n })\n}\n\n/**\n * Resets the pipeline by removing any existing processors.\n *\n */\nlunr.Pipeline.prototype.reset = function () {\n this._stack = []\n}\n\n/**\n * Returns a representation of the pipeline ready for serialisation.\n *\n * Logs a warning if the function has not been registered.\n *\n * @returns {Array}\n */\nlunr.Pipeline.prototype.toJSON = function () {\n return this._stack.map(function (fn) {\n lunr.Pipeline.warnIfFunctionNotRegistered(fn)\n\n return fn.label\n })\n}\n/*!\n * lunr.Vector\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * A vector is used to construct the vector space of documents and queries. These\n * vectors support operations to determine the similarity between two documents or\n * a document and a query.\n *\n * Normally no parameters are required for initializing a vector, but in the case of\n * loading a previously dumped vector the raw elements can be provided to the constructor.\n *\n * For performance reasons vectors are implemented with a flat array, where an elements\n * index is immediately followed by its value. E.g. [index, value, index, value]. This\n * allows the underlying array to be as sparse as possible and still offer decent\n * performance when being used for vector calculations.\n *\n * @constructor\n * @param {Number[]} [elements] - The flat list of element index and element value pairs.\n */\nlunr.Vector = function (elements) {\n this._magnitude = 0\n this.elements = elements || []\n}\n\n\n/**\n * Calculates the position within the vector to insert a given index.\n *\n * This is used internally by insert and upsert. If there are duplicate indexes then\n * the position is returned as if the value for that index were to be updated, but it\n * is the callers responsibility to check whether there is a duplicate at that index\n *\n * @param {Number} insertIdx - The index at which the element should be inserted.\n * @returns {Number}\n */\nlunr.Vector.prototype.positionForIndex = function (index) {\n // For an empty vector the tuple can be inserted at the beginning\n if (this.elements.length == 0) {\n return 0\n }\n\n var start = 0,\n end = this.elements.length / 2,\n sliceLength = end - start,\n pivotPoint = Math.floor(sliceLength / 2),\n pivotIndex = this.elements[pivotPoint * 2]\n\n while (sliceLength > 1) {\n if (pivotIndex < index) {\n start = pivotPoint\n }\n\n if (pivotIndex > index) {\n end = pivotPoint\n }\n\n if (pivotIndex == index) {\n break\n }\n\n sliceLength = end - start\n pivotPoint = start + Math.floor(sliceLength / 2)\n pivotIndex = this.elements[pivotPoint * 2]\n }\n\n if (pivotIndex == index) {\n return pivotPoint * 2\n }\n\n if (pivotIndex > index) {\n return pivotPoint * 2\n }\n\n if (pivotIndex < index) {\n return (pivotPoint + 1) * 2\n }\n}\n\n/**\n * Inserts an element at an index within the vector.\n *\n * Does not allow duplicates, will throw an error if there is already an entry\n * for this index.\n *\n * @param {Number} insertIdx - The index at which the element should be inserted.\n * @param {Number} val - The value to be inserted into the vector.\n */\nlunr.Vector.prototype.insert = function (insertIdx, val) {\n this.upsert(insertIdx, val, function () {\n throw \"duplicate index\"\n })\n}\n\n/**\n * Inserts or updates an existing index within the vector.\n *\n * @param {Number} insertIdx - The index at which the element should be inserted.\n * @param {Number} val - The value to be inserted into the vector.\n * @param {function} fn - A function that is called for updates, the existing value and the\n * requested value are passed as arguments\n */\nlunr.Vector.prototype.upsert = function (insertIdx, val, fn) {\n this._magnitude = 0\n var position = this.positionForIndex(insertIdx)\n\n if (this.elements[position] == insertIdx) {\n this.elements[position + 1] = fn(this.elements[position + 1], val)\n } else {\n this.elements.splice(position, 0, insertIdx, val)\n }\n}\n\n/**\n * Calculates the magnitude of this vector.\n *\n * @returns {Number}\n */\nlunr.Vector.prototype.magnitude = function () {\n if (this._magnitude) return this._magnitude\n\n var sumOfSquares = 0,\n elementsLength = this.elements.length\n\n for (var i = 1; i < elementsLength; i += 2) {\n var val = this.elements[i]\n sumOfSquares += val * val\n }\n\n return this._magnitude = Math.sqrt(sumOfSquares)\n}\n\n/**\n * Calculates the dot product of this vector and another vector.\n *\n * @param {lunr.Vector} otherVector - The vector to compute the dot product with.\n * @returns {Number}\n */\nlunr.Vector.prototype.dot = function (otherVector) {\n var dotProduct = 0,\n a = this.elements, b = otherVector.elements,\n aLen = a.length, bLen = b.length,\n aVal = 0, bVal = 0,\n i = 0, j = 0\n\n while (i < aLen && j < bLen) {\n aVal = a[i], bVal = b[j]\n if (aVal < bVal) {\n i += 2\n } else if (aVal > bVal) {\n j += 2\n } else if (aVal == bVal) {\n dotProduct += a[i + 1] * b[j + 1]\n i += 2\n j += 2\n }\n }\n\n return dotProduct\n}\n\n/**\n * Calculates the similarity between this vector and another vector.\n *\n * @param {lunr.Vector} otherVector - The other vector to calculate the\n * similarity with.\n * @returns {Number}\n */\nlunr.Vector.prototype.similarity = function (otherVector) {\n return this.dot(otherVector) / this.magnitude() || 0\n}\n\n/**\n * Converts the vector to an array of the elements within the vector.\n *\n * @returns {Number[]}\n */\nlunr.Vector.prototype.toArray = function () {\n var output = new Array (this.elements.length / 2)\n\n for (var i = 1, j = 0; i < this.elements.length; i += 2, j++) {\n output[j] = this.elements[i]\n }\n\n return output\n}\n\n/**\n * A JSON serializable representation of the vector.\n *\n * @returns {Number[]}\n */\nlunr.Vector.prototype.toJSON = function () {\n return this.elements\n}\n/* eslint-disable */\n/*!\n * lunr.stemmer\n * Copyright (C) 2020 Oliver Nightingale\n * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt\n */\n\n/**\n * lunr.stemmer is an english language stemmer, this is a JavaScript\n * implementation of the PorterStemmer taken from http://tartarus.org/~martin\n *\n * @static\n * @implements {lunr.PipelineFunction}\n * @param {lunr.Token} token - The string to stem\n * @returns {lunr.Token}\n * @see {@link lunr.Pipeline}\n * @function\n */\nlunr.stemmer = (function(){\n var step2list = {\n \"ational\" : \"ate\",\n \"tional\" : \"tion\",\n \"enci\" : \"ence\",\n \"anci\" : \"ance\",\n \"izer\" : \"ize\",\n \"bli\" : \"ble\",\n \"alli\" : \"al\",\n \"entli\" : \"ent\",\n \"eli\" : \"e\",\n \"ousli\" : \"ous\",\n \"ization\" : \"ize\",\n \"ation\" : \"ate\",\n \"ator\" : \"ate\",\n \"alism\" : \"al\",\n \"iveness\" : \"ive\",\n \"fulness\" : \"ful\",\n \"ousness\" : \"ous\",\n \"aliti\" : \"al\",\n \"iviti\" : \"ive\",\n \"biliti\" : \"ble\",\n \"logi\" : \"log\"\n },\n\n step3list = {\n \"icate\" : \"ic\",\n \"ative\" : \"\",\n \"alize\" : \"al\",\n \"iciti\" : \"ic\",\n \"ical\" : \"ic\",\n \"ful\" : \"\",\n \"ness\" : \"\"\n },\n\n c = \"[^aeiou]\", // consonant\n v = \"[aeiouy]\", // vowel\n C = c + \"[^aeiouy]*\", // consonant sequence\n V = v + \"[aeiou]*\", // vowel sequence\n\n mgr0 = \"^(\" + C + \")?\" + V + C, // [C]VC... is m>0\n meq1 = \"^(\" + C + \")?\" + V + C + \"(\" + V + \")?$\", // [C]VC[V] is m=1\n mgr1 = \"^(\" + C + \")?\" + V + C + V + C, // [C]VCVC... is m>1\n s_v = \"^(\" + C + \")?\" + v; // vowel in stem\n\n var re_mgr0 = new RegExp(mgr0);\n var re_mgr1 = new RegExp(mgr1);\n var re_meq1 = new RegExp(meq1);\n var re_s_v = new RegExp(s_v);\n\n var re_1a = /^(.+?)(ss|i)es$/;\n var re2_1a = /^(.+?)([^s])s$/;\n var re_1b = /^(.+?)eed$/;\n var re2_1b = /^(.+?)(ed|ing)$/;\n var re_1b_2 = /.$/;\n var re2_1b_2 = /(at|bl|iz)$/;\n var re3_1b_2 = new RegExp(\"([^aeiouylsz])\\\\1$\");\n var re4_1b_2 = new RegExp(\"^\" + C + v + \"[^aeiouwxy]$\");\n\n var re_1c = /^(.+?[^aeiou])y$/;\n var re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;\n\n var re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;\n\n var re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;\n var re2_4 = /^(.+?)(s|t)(ion)$/;\n\n var re_5 = /^(.+?)e$/;\n var re_5_1 = /ll$/;\n var re3_5 = new RegExp(\"^\" + C + v + \"[^aeiouwxy]$\");\n\n var porterStemmer = function porterStemmer(w) {\n var stem,\n suffix,\n firstch,\n re,\n re2,\n re3,\n re4;\n\n if (w.length < 3) { return w; }\n\n firstch = w.substr(0,1);\n if (firstch == \"y\") {\n w = firstch.toUpperCase() + w.substr(1);\n }\n\n // Step 1a\n re = re_1a\n re2 = re2_1a;\n\n if (re.test(w)) { w = w.replace(re,\"$1$2\"); }\n else if (re2.test(w)) { w = w.replace(re2,\"$1$2\"); }\n\n // Step 1b\n re = re_1b;\n re2 = re2_1b;\n if (re.test(w)) {\n var fp = re.exec(w);\n re = re_mgr0;\n if (re.test(fp[1])) {\n re = re_1b_2;\n w = w.replace(re,\"\");\n }\n } else if (re2.test(w)) {\n var fp = re2.exec(w);\n stem = fp[1];\n re2 = re_s_v;\n if (re2.test(stem)) {\n w = stem;\n re2 = re2_1b_2;\n re3 = re3_1b_2;\n re4 = re4_1b_2;\n if (re2.test(w)) { w = w + \"e\"; }\n else if (re3.test(w)) { re = re_1b_2; w = w.replace(re,\"\"); }\n else if (re4.test(w)) { w = w + \"e\"; }\n }\n }\n\n // Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say)\n re = re_1c;\n if (re.test(w)) {\n var fp = re.exec(w);\n stem = fp[1];\n w = stem + \"i\";\n }\n\n // Step 2\n re = re_2;\n if (re.test(w)) {\n var fp = re.exec(w);\n stem = fp[1];\n suffix = fp[2];\n re = re_mgr0;\n if (re.test(stem)) {\n w = stem + step2list[suffix];\n }\n }\n\n // Step 3\n re = re_3;\n if (re.test(w)) {\n var fp = re.exec(w);\n stem = fp[1];\n suffix = fp[2];\n re = re_mgr0;\n if (re.test(stem)) {\n w = stem + step3list[suffix];\n }\n }\n\n // Step 4\n re = re_4;\n re2 = re2_4;\n if (re.test(w)) {\n var fp = re.exec(w);\n stem = fp[1];\n re = re_mgr1;\n if (re.test(stem)) {\n w = stem;\n }\n } else if (re2.test(w)) {\n var fp = re2.exec(w);\n stem = fp[1] + fp[2];\n re2 = re_mgr1;\n if (re2.test(stem)) {\n w = stem;\n }\n }\n\n // Step 5\n re = re_5;\n if (re.test(w)) {\n var fp = re.exec(w);\n stem = fp[1];\n re = re_mgr1;\n re2 = re_meq1;\n re3 = re3_5;\n if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) {\n w = stem;\n }\n }\n\n re = re_5_1;\n re2 = re_mgr1;\n if (re.test(w) && re2.test(w)) {\n re = re_1b_2;\n w = w.replace(re,\"\");\n }\n\n // and turn initial Y back to y\n\n if (firstch == \"y\") {\n w = firstch.toLowerCase() + w.substr(1);\n }\n\n return w;\n };\n\n return function (token) {\n return token.update(porterStemmer);\n }\n})();\n\nlunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer')\n/*!\n * lunr.stopWordFilter\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * lunr.generateStopWordFilter builds a stopWordFilter function from the provided\n * list of stop words.\n *\n * The built in lunr.stopWordFilter is built using this generator and can be used\n * to generate custom stopWordFilters for applications or non English languages.\n *\n * @function\n * @param {Array} token The token to pass through the filter\n * @returns {lunr.PipelineFunction}\n * @see lunr.Pipeline\n * @see lunr.stopWordFilter\n */\nlunr.generateStopWordFilter = function (stopWords) {\n var words = stopWords.reduce(function (memo, stopWord) {\n memo[stopWord] = stopWord\n return memo\n }, {})\n\n return function (token) {\n if (token && words[token.toString()] !== token.toString()) return token\n }\n}\n\n/**\n * lunr.stopWordFilter is an English language stop word list filter, any words\n * contained in the list will not be passed through the filter.\n *\n * This is intended to be used in the Pipeline. If the token does not pass the\n * filter then undefined will be returned.\n *\n * @function\n * @implements {lunr.PipelineFunction}\n * @params {lunr.Token} token - A token to check for being a stop word.\n * @returns {lunr.Token}\n * @see {@link lunr.Pipeline}\n */\nlunr.stopWordFilter = lunr.generateStopWordFilter([\n 'a',\n 'able',\n 'about',\n 'across',\n 'after',\n 'all',\n 'almost',\n 'also',\n 'am',\n 'among',\n 'an',\n 'and',\n 'any',\n 'are',\n 'as',\n 'at',\n 'be',\n 'because',\n 'been',\n 'but',\n 'by',\n 'can',\n 'cannot',\n 'could',\n 'dear',\n 'did',\n 'do',\n 'does',\n 'either',\n 'else',\n 'ever',\n 'every',\n 'for',\n 'from',\n 'get',\n 'got',\n 'had',\n 'has',\n 'have',\n 'he',\n 'her',\n 'hers',\n 'him',\n 'his',\n 'how',\n 'however',\n 'i',\n 'if',\n 'in',\n 'into',\n 'is',\n 'it',\n 'its',\n 'just',\n 'least',\n 'let',\n 'like',\n 'likely',\n 'may',\n 'me',\n 'might',\n 'most',\n 'must',\n 'my',\n 'neither',\n 'no',\n 'nor',\n 'not',\n 'of',\n 'off',\n 'often',\n 'on',\n 'only',\n 'or',\n 'other',\n 'our',\n 'own',\n 'rather',\n 'said',\n 'say',\n 'says',\n 'she',\n 'should',\n 'since',\n 'so',\n 'some',\n 'than',\n 'that',\n 'the',\n 'their',\n 'them',\n 'then',\n 'there',\n 'these',\n 'they',\n 'this',\n 'tis',\n 'to',\n 'too',\n 'twas',\n 'us',\n 'wants',\n 'was',\n 'we',\n 'were',\n 'what',\n 'when',\n 'where',\n 'which',\n 'while',\n 'who',\n 'whom',\n 'why',\n 'will',\n 'with',\n 'would',\n 'yet',\n 'you',\n 'your'\n])\n\nlunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter')\n/*!\n * lunr.trimmer\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * lunr.trimmer is a pipeline function for trimming non word\n * characters from the beginning and end of tokens before they\n * enter the index.\n *\n * This implementation may not work correctly for non latin\n * characters and should either be removed or adapted for use\n * with languages with non-latin characters.\n *\n * @static\n * @implements {lunr.PipelineFunction}\n * @param {lunr.Token} token The token to pass through the filter\n * @returns {lunr.Token}\n * @see lunr.Pipeline\n */\nlunr.trimmer = function (token) {\n return token.update(function (s) {\n return s.replace(/^\\W+/, '').replace(/\\W+$/, '')\n })\n}\n\nlunr.Pipeline.registerFunction(lunr.trimmer, 'trimmer')\n/*!\n * lunr.TokenSet\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * A token set is used to store the unique list of all tokens\n * within an index. Token sets are also used to represent an\n * incoming query to the index, this query token set and index\n * token set are then intersected to find which tokens to look\n * up in the inverted index.\n *\n * A token set can hold multiple tokens, as in the case of the\n * index token set, or it can hold a single token as in the\n * case of a simple query token set.\n *\n * Additionally token sets are used to perform wildcard matching.\n * Leading, contained and trailing wildcards are supported, and\n * from this edit distance matching can also be provided.\n *\n * Token sets are implemented as a minimal finite state automata,\n * where both common prefixes and suffixes are shared between tokens.\n * This helps to reduce the space used for storing the token set.\n *\n * @constructor\n */\nlunr.TokenSet = function () {\n this.final = false\n this.edges = {}\n this.id = lunr.TokenSet._nextId\n lunr.TokenSet._nextId += 1\n}\n\n/**\n * Keeps track of the next, auto increment, identifier to assign\n * to a new tokenSet.\n *\n * TokenSets require a unique identifier to be correctly minimised.\n *\n * @private\n */\nlunr.TokenSet._nextId = 1\n\n/**\n * Creates a TokenSet instance from the given sorted array of words.\n *\n * @param {String[]} arr - A sorted array of strings to create the set from.\n * @returns {lunr.TokenSet}\n * @throws Will throw an error if the input array is not sorted.\n */\nlunr.TokenSet.fromArray = function (arr) {\n var builder = new lunr.TokenSet.Builder\n\n for (var i = 0, len = arr.length; i < len; i++) {\n builder.insert(arr[i])\n }\n\n builder.finish()\n return builder.root\n}\n\n/**\n * Creates a token set from a query clause.\n *\n * @private\n * @param {Object} clause - A single clause from lunr.Query.\n * @param {string} clause.term - The query clause term.\n * @param {number} [clause.editDistance] - The optional edit distance for the term.\n * @returns {lunr.TokenSet}\n */\nlunr.TokenSet.fromClause = function (clause) {\n if ('editDistance' in clause) {\n return lunr.TokenSet.fromFuzzyString(clause.term, clause.editDistance)\n } else {\n return lunr.TokenSet.fromString(clause.term)\n }\n}\n\n/**\n * Creates a token set representing a single string with a specified\n * edit distance.\n *\n * Insertions, deletions, substitutions and transpositions are each\n * treated as an edit distance of 1.\n *\n * Increasing the allowed edit distance will have a dramatic impact\n * on the performance of both creating and intersecting these TokenSets.\n * It is advised to keep the edit distance less than 3.\n *\n * @param {string} str - The string to create the token set from.\n * @param {number} editDistance - The allowed edit distance to match.\n * @returns {lunr.Vector}\n */\nlunr.TokenSet.fromFuzzyString = function (str, editDistance) {\n var root = new lunr.TokenSet\n\n var stack = [{\n node: root,\n editsRemaining: editDistance,\n str: str\n }]\n\n while (stack.length) {\n var frame = stack.pop()\n\n // no edit\n if (frame.str.length > 0) {\n var char = frame.str.charAt(0),\n noEditNode\n\n if (char in frame.node.edges) {\n noEditNode = frame.node.edges[char]\n } else {\n noEditNode = new lunr.TokenSet\n frame.node.edges[char] = noEditNode\n }\n\n if (frame.str.length == 1) {\n noEditNode.final = true\n }\n\n stack.push({\n node: noEditNode,\n editsRemaining: frame.editsRemaining,\n str: frame.str.slice(1)\n })\n }\n\n if (frame.editsRemaining == 0) {\n continue\n }\n\n // insertion\n if (\"*\" in frame.node.edges) {\n var insertionNode = frame.node.edges[\"*\"]\n } else {\n var insertionNode = new lunr.TokenSet\n frame.node.edges[\"*\"] = insertionNode\n }\n\n if (frame.str.length == 0) {\n insertionNode.final = true\n }\n\n stack.push({\n node: insertionNode,\n editsRemaining: frame.editsRemaining - 1,\n str: frame.str\n })\n\n // deletion\n // can only do a deletion if we have enough edits remaining\n // and if there are characters left to delete in the string\n if (frame.str.length > 1) {\n stack.push({\n node: frame.node,\n editsRemaining: frame.editsRemaining - 1,\n str: frame.str.slice(1)\n })\n }\n\n // deletion\n // just removing the last character from the str\n if (frame.str.length == 1) {\n frame.node.final = true\n }\n\n // substitution\n // can only do a substitution if we have enough edits remaining\n // and if there are characters left to substitute\n if (frame.str.length >= 1) {\n if (\"*\" in frame.node.edges) {\n var substitutionNode = frame.node.edges[\"*\"]\n } else {\n var substitutionNode = new lunr.TokenSet\n frame.node.edges[\"*\"] = substitutionNode\n }\n\n if (frame.str.length == 1) {\n substitutionNode.final = true\n }\n\n stack.push({\n node: substitutionNode,\n editsRemaining: frame.editsRemaining - 1,\n str: frame.str.slice(1)\n })\n }\n\n // transposition\n // can only do a transposition if there are edits remaining\n // and there are enough characters to transpose\n if (frame.str.length > 1) {\n var charA = frame.str.charAt(0),\n charB = frame.str.charAt(1),\n transposeNode\n\n if (charB in frame.node.edges) {\n transposeNode = frame.node.edges[charB]\n } else {\n transposeNode = new lunr.TokenSet\n frame.node.edges[charB] = transposeNode\n }\n\n if (frame.str.length == 1) {\n transposeNode.final = true\n }\n\n stack.push({\n node: transposeNode,\n editsRemaining: frame.editsRemaining - 1,\n str: charA + frame.str.slice(2)\n })\n }\n }\n\n return root\n}\n\n/**\n * Creates a TokenSet from a string.\n *\n * The string may contain one or more wildcard characters (*)\n * that will allow wildcard matching when intersecting with\n * another TokenSet.\n *\n * @param {string} str - The string to create a TokenSet from.\n * @returns {lunr.TokenSet}\n */\nlunr.TokenSet.fromString = function (str) {\n var node = new lunr.TokenSet,\n root = node\n\n /*\n * Iterates through all characters within the passed string\n * appending a node for each character.\n *\n * When a wildcard character is found then a self\n * referencing edge is introduced to continually match\n * any number of any characters.\n */\n for (var i = 0, len = str.length; i < len; i++) {\n var char = str[i],\n final = (i == len - 1)\n\n if (char == \"*\") {\n node.edges[char] = node\n node.final = final\n\n } else {\n var next = new lunr.TokenSet\n next.final = final\n\n node.edges[char] = next\n node = next\n }\n }\n\n return root\n}\n\n/**\n * Converts this TokenSet into an array of strings\n * contained within the TokenSet.\n *\n * This is not intended to be used on a TokenSet that\n * contains wildcards, in these cases the results are\n * undefined and are likely to cause an infinite loop.\n *\n * @returns {string[]}\n */\nlunr.TokenSet.prototype.toArray = function () {\n var words = []\n\n var stack = [{\n prefix: \"\",\n node: this\n }]\n\n while (stack.length) {\n var frame = stack.pop(),\n edges = Object.keys(frame.node.edges),\n len = edges.length\n\n if (frame.node.final) {\n /* In Safari, at this point the prefix is sometimes corrupted, see:\n * https://github.com/olivernn/lunr.js/issues/279 Calling any\n * String.prototype method forces Safari to \"cast\" this string to what\n * it's supposed to be, fixing the bug. */\n frame.prefix.charAt(0)\n words.push(frame.prefix)\n }\n\n for (var i = 0; i < len; i++) {\n var edge = edges[i]\n\n stack.push({\n prefix: frame.prefix.concat(edge),\n node: frame.node.edges[edge]\n })\n }\n }\n\n return words\n}\n\n/**\n * Generates a string representation of a TokenSet.\n *\n * This is intended to allow TokenSets to be used as keys\n * in objects, largely to aid the construction and minimisation\n * of a TokenSet. As such it is not designed to be a human\n * friendly representation of the TokenSet.\n *\n * @returns {string}\n */\nlunr.TokenSet.prototype.toString = function () {\n // NOTE: Using Object.keys here as this.edges is very likely\n // to enter 'hash-mode' with many keys being added\n //\n // avoiding a for-in loop here as it leads to the function\n // being de-optimised (at least in V8). From some simple\n // benchmarks the performance is comparable, but allowing\n // V8 to optimize may mean easy performance wins in the future.\n\n if (this._str) {\n return this._str\n }\n\n var str = this.final ? '1' : '0',\n labels = Object.keys(this.edges).sort(),\n len = labels.length\n\n for (var i = 0; i < len; i++) {\n var label = labels[i],\n node = this.edges[label]\n\n str = str + label + node.id\n }\n\n return str\n}\n\n/**\n * Returns a new TokenSet that is the intersection of\n * this TokenSet and the passed TokenSet.\n *\n * This intersection will take into account any wildcards\n * contained within the TokenSet.\n *\n * @param {lunr.TokenSet} b - An other TokenSet to intersect with.\n * @returns {lunr.TokenSet}\n */\nlunr.TokenSet.prototype.intersect = function (b) {\n var output = new lunr.TokenSet,\n frame = undefined\n\n var stack = [{\n qNode: b,\n output: output,\n node: this\n }]\n\n while (stack.length) {\n frame = stack.pop()\n\n // NOTE: As with the #toString method, we are using\n // Object.keys and a for loop instead of a for-in loop\n // as both of these objects enter 'hash' mode, causing\n // the function to be de-optimised in V8\n var qEdges = Object.keys(frame.qNode.edges),\n qLen = qEdges.length,\n nEdges = Object.keys(frame.node.edges),\n nLen = nEdges.length\n\n for (var q = 0; q < qLen; q++) {\n var qEdge = qEdges[q]\n\n for (var n = 0; n < nLen; n++) {\n var nEdge = nEdges[n]\n\n if (nEdge == qEdge || qEdge == '*') {\n var node = frame.node.edges[nEdge],\n qNode = frame.qNode.edges[qEdge],\n final = node.final && qNode.final,\n next = undefined\n\n if (nEdge in frame.output.edges) {\n // an edge already exists for this character\n // no need to create a new node, just set the finality\n // bit unless this node is already final\n next = frame.output.edges[nEdge]\n next.final = next.final || final\n\n } else {\n // no edge exists yet, must create one\n // set the finality bit and insert it\n // into the output\n next = new lunr.TokenSet\n next.final = final\n frame.output.edges[nEdge] = next\n }\n\n stack.push({\n qNode: qNode,\n output: next,\n node: node\n })\n }\n }\n }\n }\n\n return output\n}\nlunr.TokenSet.Builder = function () {\n this.previousWord = \"\"\n this.root = new lunr.TokenSet\n this.uncheckedNodes = []\n this.minimizedNodes = {}\n}\n\nlunr.TokenSet.Builder.prototype.insert = function (word) {\n var node,\n commonPrefix = 0\n\n if (word < this.previousWord) {\n throw new Error (\"Out of order word insertion\")\n }\n\n for (var i = 0; i < word.length && i < this.previousWord.length; i++) {\n if (word[i] != this.previousWord[i]) break\n commonPrefix++\n }\n\n this.minimize(commonPrefix)\n\n if (this.uncheckedNodes.length == 0) {\n node = this.root\n } else {\n node = this.uncheckedNodes[this.uncheckedNodes.length - 1].child\n }\n\n for (var i = commonPrefix; i < word.length; i++) {\n var nextNode = new lunr.TokenSet,\n char = word[i]\n\n node.edges[char] = nextNode\n\n this.uncheckedNodes.push({\n parent: node,\n char: char,\n child: nextNode\n })\n\n node = nextNode\n }\n\n node.final = true\n this.previousWord = word\n}\n\nlunr.TokenSet.Builder.prototype.finish = function () {\n this.minimize(0)\n}\n\nlunr.TokenSet.Builder.prototype.minimize = function (downTo) {\n for (var i = this.uncheckedNodes.length - 1; i >= downTo; i--) {\n var node = this.uncheckedNodes[i],\n childKey = node.child.toString()\n\n if (childKey in this.minimizedNodes) {\n node.parent.edges[node.char] = this.minimizedNodes[childKey]\n } else {\n // Cache the key for this node since\n // we know it can't change anymore\n node.child._str = childKey\n\n this.minimizedNodes[childKey] = node.child\n }\n\n this.uncheckedNodes.pop()\n }\n}\n/*!\n * lunr.Index\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * An index contains the built index of all documents and provides a query interface\n * to the index.\n *\n * Usually instances of lunr.Index will not be created using this constructor, instead\n * lunr.Builder should be used to construct new indexes, or lunr.Index.load should be\n * used to load previously built and serialized indexes.\n *\n * @constructor\n * @param {Object} attrs - The attributes of the built search index.\n * @param {Object} attrs.invertedIndex - An index of term/field to document reference.\n * @param {Object} attrs.fieldVectors - Field vectors\n * @param {lunr.TokenSet} attrs.tokenSet - An set of all corpus tokens.\n * @param {string[]} attrs.fields - The names of indexed document fields.\n * @param {lunr.Pipeline} attrs.pipeline - The pipeline to use for search terms.\n */\nlunr.Index = function (attrs) {\n this.invertedIndex = attrs.invertedIndex\n this.fieldVectors = attrs.fieldVectors\n this.tokenSet = attrs.tokenSet\n this.fields = attrs.fields\n this.pipeline = attrs.pipeline\n}\n\n/**\n * A result contains details of a document matching a search query.\n * @typedef {Object} lunr.Index~Result\n * @property {string} ref - The reference of the document this result represents.\n * @property {number} score - A number between 0 and 1 representing how similar this document is to the query.\n * @property {lunr.MatchData} matchData - Contains metadata about this match including which term(s) caused the match.\n */\n\n/**\n * Although lunr provides the ability to create queries using lunr.Query, it also provides a simple\n * query language which itself is parsed into an instance of lunr.Query.\n *\n * For programmatically building queries it is advised to directly use lunr.Query, the query language\n * is best used for human entered text rather than program generated text.\n *\n * At its simplest queries can just be a single term, e.g. `hello`, multiple terms are also supported\n * and will be combined with OR, e.g `hello world` will match documents that contain either 'hello'\n * or 'world', though those that contain both will rank higher in the results.\n *\n * Wildcards can be included in terms to match one or more unspecified characters, these wildcards can\n * be inserted anywhere within the term, and more than one wildcard can exist in a single term. Adding\n * wildcards will increase the number of documents that will be found but can also have a negative\n * impact on query performance, especially with wildcards at the beginning of a term.\n *\n * Terms can be restricted to specific fields, e.g. `title:hello`, only documents with the term\n * hello in the title field will match this query. Using a field not present in the index will lead\n * to an error being thrown.\n *\n * Modifiers can also be added to terms, lunr supports edit distance and boost modifiers on terms. A term\n * boost will make documents matching that term score higher, e.g. `foo^5`. Edit distance is also supported\n * to provide fuzzy matching, e.g. 'hello~2' will match documents with hello with an edit distance of 2.\n * Avoid large values for edit distance to improve query performance.\n *\n * Each term also supports a presence modifier. By default a term's presence in document is optional, however\n * this can be changed to either required or prohibited. For a term's presence to be required in a document the\n * term should be prefixed with a '+', e.g. `+foo bar` is a search for documents that must contain 'foo' and\n * optionally contain 'bar'. Conversely a leading '-' sets the terms presence to prohibited, i.e. it must not\n * appear in a document, e.g. `-foo bar` is a search for documents that do not contain 'foo' but may contain 'bar'.\n *\n * To escape special characters the backslash character '\\' can be used, this allows searches to include\n * characters that would normally be considered modifiers, e.g. `foo\\~2` will search for a term \"foo~2\" instead\n * of attempting to apply a boost of 2 to the search term \"foo\".\n *\n * @typedef {string} lunr.Index~QueryString\n * @example Simple single term query\n * hello\n * @example Multiple term query\n * hello world\n * @example term scoped to a field\n * title:hello\n * @example term with a boost of 10\n * hello^10\n * @example term with an edit distance of 2\n * hello~2\n * @example terms with presence modifiers\n * -foo +bar baz\n */\n\n/**\n * Performs a search against the index using lunr query syntax.\n *\n * Results will be returned sorted by their score, the most relevant results\n * will be returned first. For details on how the score is calculated, please see\n * the {@link https://lunrjs.com/guides/searching.html#scoring|guide}.\n *\n * For more programmatic querying use lunr.Index#query.\n *\n * @param {lunr.Index~QueryString} queryString - A string containing a lunr query.\n * @throws {lunr.QueryParseError} If the passed query string cannot be parsed.\n * @returns {lunr.Index~Result[]}\n */\nlunr.Index.prototype.search = function (queryString) {\n return this.query(function (query) {\n var parser = new lunr.QueryParser(queryString, query)\n parser.parse()\n })\n}\n\n/**\n * A query builder callback provides a query object to be used to express\n * the query to perform on the index.\n *\n * @callback lunr.Index~queryBuilder\n * @param {lunr.Query} query - The query object to build up.\n * @this lunr.Query\n */\n\n/**\n * Performs a query against the index using the yielded lunr.Query object.\n *\n * If performing programmatic queries against the index, this method is preferred\n * over lunr.Index#search so as to avoid the additional query parsing overhead.\n *\n * A query object is yielded to the supplied function which should be used to\n * express the query to be run against the index.\n *\n * Note that although this function takes a callback parameter it is _not_ an\n * asynchronous operation, the callback is just yielded a query object to be\n * customized.\n *\n * @param {lunr.Index~queryBuilder} fn - A function that is used to build the query.\n * @returns {lunr.Index~Result[]}\n */\nlunr.Index.prototype.query = function (fn) {\n // for each query clause\n // * process terms\n // * expand terms from token set\n // * find matching documents and metadata\n // * get document vectors\n // * score documents\n\n var query = new lunr.Query(this.fields),\n matchingFields = Object.create(null),\n queryVectors = Object.create(null),\n termFieldCache = Object.create(null),\n requiredMatches = Object.create(null),\n prohibitedMatches = Object.create(null)\n\n /*\n * To support field level boosts a query vector is created per\n * field. An empty vector is eagerly created to support negated\n * queries.\n */\n for (var i = 0; i < this.fields.length; i++) {\n queryVectors[this.fields[i]] = new lunr.Vector\n }\n\n fn.call(query, query)\n\n for (var i = 0; i < query.clauses.length; i++) {\n /*\n * Unless the pipeline has been disabled for this term, which is\n * the case for terms with wildcards, we need to pass the clause\n * term through the search pipeline. A pipeline returns an array\n * of processed terms. Pipeline functions may expand the passed\n * term, which means we may end up performing multiple index lookups\n * for a single query term.\n */\n var clause = query.clauses[i],\n terms = null,\n clauseMatches = lunr.Set.empty\n\n if (clause.usePipeline) {\n terms = this.pipeline.runString(clause.term, {\n fields: clause.fields\n })\n } else {\n terms = [clause.term]\n }\n\n for (var m = 0; m < terms.length; m++) {\n var term = terms[m]\n\n /*\n * Each term returned from the pipeline needs to use the same query\n * clause object, e.g. the same boost and or edit distance. The\n * simplest way to do this is to re-use the clause object but mutate\n * its term property.\n */\n clause.term = term\n\n /*\n * From the term in the clause we create a token set which will then\n * be used to intersect the indexes token set to get a list of terms\n * to lookup in the inverted index\n */\n var termTokenSet = lunr.TokenSet.fromClause(clause),\n expandedTerms = this.tokenSet.intersect(termTokenSet).toArray()\n\n /*\n * If a term marked as required does not exist in the tokenSet it is\n * impossible for the search to return any matches. We set all the field\n * scoped required matches set to empty and stop examining any further\n * clauses.\n */\n if (expandedTerms.length === 0 && clause.presence === lunr.Query.presence.REQUIRED) {\n for (var k = 0; k < clause.fields.length; k++) {\n var field = clause.fields[k]\n requiredMatches[field] = lunr.Set.empty\n }\n\n break\n }\n\n for (var j = 0; j < expandedTerms.length; j++) {\n /*\n * For each term get the posting and termIndex, this is required for\n * building the query vector.\n */\n var expandedTerm = expandedTerms[j],\n posting = this.invertedIndex[expandedTerm],\n termIndex = posting._index\n\n for (var k = 0; k < clause.fields.length; k++) {\n /*\n * For each field that this query term is scoped by (by default\n * all fields are in scope) we need to get all the document refs\n * that have this term in that field.\n *\n * The posting is the entry in the invertedIndex for the matching\n * term from above.\n */\n var field = clause.fields[k],\n fieldPosting = posting[field],\n matchingDocumentRefs = Object.keys(fieldPosting),\n termField = expandedTerm + \"/\" + field,\n matchingDocumentsSet = new lunr.Set(matchingDocumentRefs)\n\n /*\n * if the presence of this term is required ensure that the matching\n * documents are added to the set of required matches for this clause.\n *\n */\n if (clause.presence == lunr.Query.presence.REQUIRED) {\n clauseMatches = clauseMatches.union(matchingDocumentsSet)\n\n if (requiredMatches[field] === undefined) {\n requiredMatches[field] = lunr.Set.complete\n }\n }\n\n /*\n * if the presence of this term is prohibited ensure that the matching\n * documents are added to the set of prohibited matches for this field,\n * creating that set if it does not yet exist.\n */\n if (clause.presence == lunr.Query.presence.PROHIBITED) {\n if (prohibitedMatches[field] === undefined) {\n prohibitedMatches[field] = lunr.Set.empty\n }\n\n prohibitedMatches[field] = prohibitedMatches[field].union(matchingDocumentsSet)\n\n /*\n * Prohibited matches should not be part of the query vector used for\n * similarity scoring and no metadata should be extracted so we continue\n * to the next field\n */\n continue\n }\n\n /*\n * The query field vector is populated using the termIndex found for\n * the term and a unit value with the appropriate boost applied.\n * Using upsert because there could already be an entry in the vector\n * for the term we are working with. In that case we just add the scores\n * together.\n */\n queryVectors[field].upsert(termIndex, clause.boost, function (a, b) { return a + b })\n\n /**\n * If we've already seen this term, field combo then we've already collected\n * the matching documents and metadata, no need to go through all that again\n */\n if (termFieldCache[termField]) {\n continue\n }\n\n for (var l = 0; l < matchingDocumentRefs.length; l++) {\n /*\n * All metadata for this term/field/document triple\n * are then extracted and collected into an instance\n * of lunr.MatchData ready to be returned in the query\n * results\n */\n var matchingDocumentRef = matchingDocumentRefs[l],\n matchingFieldRef = new lunr.FieldRef (matchingDocumentRef, field),\n metadata = fieldPosting[matchingDocumentRef],\n fieldMatch\n\n if ((fieldMatch = matchingFields[matchingFieldRef]) === undefined) {\n matchingFields[matchingFieldRef] = new lunr.MatchData (expandedTerm, field, metadata)\n } else {\n fieldMatch.add(expandedTerm, field, metadata)\n }\n\n }\n\n termFieldCache[termField] = true\n }\n }\n }\n\n /**\n * If the presence was required we need to update the requiredMatches field sets.\n * We do this after all fields for the term have collected their matches because\n * the clause terms presence is required in _any_ of the fields not _all_ of the\n * fields.\n */\n if (clause.presence === lunr.Query.presence.REQUIRED) {\n for (var k = 0; k < clause.fields.length; k++) {\n var field = clause.fields[k]\n requiredMatches[field] = requiredMatches[field].intersect(clauseMatches)\n }\n }\n }\n\n /**\n * Need to combine the field scoped required and prohibited\n * matching documents into a global set of required and prohibited\n * matches\n */\n var allRequiredMatches = lunr.Set.complete,\n allProhibitedMatches = lunr.Set.empty\n\n for (var i = 0; i < this.fields.length; i++) {\n var field = this.fields[i]\n\n if (requiredMatches[field]) {\n allRequiredMatches = allRequiredMatches.intersect(requiredMatches[field])\n }\n\n if (prohibitedMatches[field]) {\n allProhibitedMatches = allProhibitedMatches.union(prohibitedMatches[field])\n }\n }\n\n var matchingFieldRefs = Object.keys(matchingFields),\n results = [],\n matches = Object.create(null)\n\n /*\n * If the query is negated (contains only prohibited terms)\n * we need to get _all_ fieldRefs currently existing in the\n * index. This is only done when we know that the query is\n * entirely prohibited terms to avoid any cost of getting all\n * fieldRefs unnecessarily.\n *\n * Additionally, blank MatchData must be created to correctly\n * populate the results.\n */\n if (query.isNegated()) {\n matchingFieldRefs = Object.keys(this.fieldVectors)\n\n for (var i = 0; i < matchingFieldRefs.length; i++) {\n var matchingFieldRef = matchingFieldRefs[i]\n var fieldRef = lunr.FieldRef.fromString(matchingFieldRef)\n matchingFields[matchingFieldRef] = new lunr.MatchData\n }\n }\n\n for (var i = 0; i < matchingFieldRefs.length; i++) {\n /*\n * Currently we have document fields that match the query, but we\n * need to return documents. The matchData and scores are combined\n * from multiple fields belonging to the same document.\n *\n * Scores are calculated by field, using the query vectors created\n * above, and combined into a final document score using addition.\n */\n var fieldRef = lunr.FieldRef.fromString(matchingFieldRefs[i]),\n docRef = fieldRef.docRef\n\n if (!allRequiredMatches.contains(docRef)) {\n continue\n }\n\n if (allProhibitedMatches.contains(docRef)) {\n continue\n }\n\n var fieldVector = this.fieldVectors[fieldRef],\n score = queryVectors[fieldRef.fieldName].similarity(fieldVector),\n docMatch\n\n if ((docMatch = matches[docRef]) !== undefined) {\n docMatch.score += score\n docMatch.matchData.combine(matchingFields[fieldRef])\n } else {\n var match = {\n ref: docRef,\n score: score,\n matchData: matchingFields[fieldRef]\n }\n matches[docRef] = match\n results.push(match)\n }\n }\n\n /*\n * Sort the results objects by score, highest first.\n */\n return results.sort(function (a, b) {\n return b.score - a.score\n })\n}\n\n/**\n * Prepares the index for JSON serialization.\n *\n * The schema for this JSON blob will be described in a\n * separate JSON schema file.\n *\n * @returns {Object}\n */\nlunr.Index.prototype.toJSON = function () {\n var invertedIndex = Object.keys(this.invertedIndex)\n .sort()\n .map(function (term) {\n return [term, this.invertedIndex[term]]\n }, this)\n\n var fieldVectors = Object.keys(this.fieldVectors)\n .map(function (ref) {\n return [ref, this.fieldVectors[ref].toJSON()]\n }, this)\n\n return {\n version: lunr.version,\n fields: this.fields,\n fieldVectors: fieldVectors,\n invertedIndex: invertedIndex,\n pipeline: this.pipeline.toJSON()\n }\n}\n\n/**\n * Loads a previously serialized lunr.Index\n *\n * @param {Object} serializedIndex - A previously serialized lunr.Index\n * @returns {lunr.Index}\n */\nlunr.Index.load = function (serializedIndex) {\n var attrs = {},\n fieldVectors = {},\n serializedVectors = serializedIndex.fieldVectors,\n invertedIndex = Object.create(null),\n serializedInvertedIndex = serializedIndex.invertedIndex,\n tokenSetBuilder = new lunr.TokenSet.Builder,\n pipeline = lunr.Pipeline.load(serializedIndex.pipeline)\n\n if (serializedIndex.version != lunr.version) {\n lunr.utils.warn(\"Version mismatch when loading serialised index. Current version of lunr '\" + lunr.version + \"' does not match serialized index '\" + serializedIndex.version + \"'\")\n }\n\n for (var i = 0; i < serializedVectors.length; i++) {\n var tuple = serializedVectors[i],\n ref = tuple[0],\n elements = tuple[1]\n\n fieldVectors[ref] = new lunr.Vector(elements)\n }\n\n for (var i = 0; i < serializedInvertedIndex.length; i++) {\n var tuple = serializedInvertedIndex[i],\n term = tuple[0],\n posting = tuple[1]\n\n tokenSetBuilder.insert(term)\n invertedIndex[term] = posting\n }\n\n tokenSetBuilder.finish()\n\n attrs.fields = serializedIndex.fields\n\n attrs.fieldVectors = fieldVectors\n attrs.invertedIndex = invertedIndex\n attrs.tokenSet = tokenSetBuilder.root\n attrs.pipeline = pipeline\n\n return new lunr.Index(attrs)\n}\n/*!\n * lunr.Builder\n * Copyright (C) 2020 Oliver Nightingale\n */\n\n/**\n * lunr.Builder performs indexing on a set of documents and\n * returns instances of lunr.Index ready for querying.\n *\n * All configuration of the index is done via the builder, the\n * fields to index, the document reference, the text processing\n * pipeline and document scoring parameters are all set on the\n * builder before indexing.\n *\n * @constructor\n * @property {string} _ref - Internal reference to the document reference field.\n * @property {string[]} _fields - Internal reference to the document fields to index.\n * @property {object} invertedIndex - The inverted index maps terms to document fields.\n * @property {object} documentTermFrequencies - Keeps track of document term frequencies.\n * @property {object} documentLengths - Keeps track of the length of documents added to the index.\n * @property {lunr.tokenizer} tokenizer - Function for splitting strings into tokens for indexing.\n * @property {lunr.Pipeline} pipeline - The pipeline performs text processing on tokens before indexing.\n * @property {lunr.Pipeline} searchPipeline - A pipeline for processing search terms before querying the index.\n * @property {number} documentCount - Keeps track of the total number of documents indexed.\n * @property {number} _b - A parameter to control field length normalization, setting this to 0 disabled normalization, 1 fully normalizes field lengths, the default value is 0.75.\n * @property {number} _k1 - A parameter to control how quickly an increase in term frequency results in term frequency saturation, the default value is 1.2.\n * @property {number} termIndex - A counter incremented for each unique term, used to identify a terms position in the vector space.\n * @property {array} metadataWhitelist - A list of metadata keys that have been whitelisted for entry in the index.\n */\nlunr.Builder = function () {\n this._ref = \"id\"\n this._fields = Object.create(null)\n this._documents = Object.create(null)\n this.invertedIndex = Object.create(null)\n this.fieldTermFrequencies = {}\n this.fieldLengths = {}\n this.tokenizer = lunr.tokenizer\n this.pipeline = new lunr.Pipeline\n this.searchPipeline = new lunr.Pipeline\n this.documentCount = 0\n this._b = 0.75\n this._k1 = 1.2\n this.termIndex = 0\n this.metadataWhitelist = []\n}\n\n/**\n * Sets the document field used as the document reference. Every document must have this field.\n * The type of this field in the document should be a string, if it is not a string it will be\n * coerced into a string by calling toString.\n *\n * The default ref is 'id'.\n *\n * The ref should _not_ be changed during indexing, it should be set before any documents are\n * added to the index. Changing it during indexing can lead to inconsistent results.\n *\n * @param {string} ref - The name of the reference field in the document.\n */\nlunr.Builder.prototype.ref = function (ref) {\n this._ref = ref\n}\n\n/**\n * A function that is used to extract a field from a document.\n *\n * Lunr expects a field to be at the top level of a document, if however the field\n * is deeply nested within a document an extractor function can be used to extract\n * the right field for indexing.\n *\n * @callback fieldExtractor\n * @param {object} doc - The document being added to the index.\n * @returns {?(string|object|object[])} obj - The object that will be indexed for this field.\n * @example Extracting a nested field\n * function (doc) { return doc.nested.field }\n */\n\n/**\n * Adds a field to the list of document fields that will be indexed. Every document being\n * indexed should have this field. Null values for this field in indexed documents will\n * not cause errors but will limit the chance of that document being retrieved by searches.\n *\n * All fields should be added before adding documents to the index. Adding fields after\n * a document has been indexed will have no effect on already indexed documents.\n *\n * Fields can be boosted at build time. This allows terms within that field to have more\n * importance when ranking search results. Use a field boost to specify that matches within\n * one field are more important than other fields.\n *\n * @param {string} fieldName - The name of a field to index in all documents.\n * @param {object} attributes - Optional attributes associated with this field.\n * @param {number} [attributes.boost=1] - Boost applied to all terms within this field.\n * @param {fieldExtractor} [attributes.extractor] - Function to extract a field from a document.\n * @throws {RangeError} fieldName cannot contain unsupported characters '/'\n */\nlunr.Builder.prototype.field = function (fieldName, attributes) {\n if (/\\//.test(fieldName)) {\n throw new RangeError (\"Field '\" + fieldName + \"' contains illegal character '/'\")\n }\n\n this._fields[fieldName] = attributes || {}\n}\n\n/**\n * A parameter to tune the amount of field length normalisation that is applied when\n * calculating relevance scores. A value of 0 will completely disable any normalisation\n * and a value of 1 will fully normalise field lengths. The default is 0.75. Values of b\n * will be clamped to the range 0 - 1.\n *\n * @param {number} number - The value to set for this tuning parameter.\n */\nlunr.Builder.prototype.b = function (number) {\n if (number < 0) {\n this._b = 0\n } else if (number > 1) {\n this._b = 1\n } else {\n this._b = number\n }\n}\n\n/**\n * A parameter that controls the speed at which a rise in term frequency results in term\n * frequency saturation. The default value is 1.2. Setting this to a higher value will give\n * slower saturation levels, a lower value will result in quicker saturation.\n *\n * @param {number} number - The value to set for this tuning parameter.\n */\nlunr.Builder.prototype.k1 = function (number) {\n this._k1 = number\n}\n\n/**\n * Adds a document to the index.\n *\n * Before adding fields to the index the index should have been fully setup, with the document\n * ref and all fields to index already having been specified.\n *\n * The document must have a field name as specified by the ref (by default this is 'id') and\n * it should have all fields defined for indexing, though null or undefined values will not\n * cause errors.\n *\n * Entire documents can be boosted at build time. Applying a boost to a document indicates that\n * this document should rank higher in search results than other documents.\n *\n * @param {object} doc - The document to add to the index.\n * @param {object} attributes - Optional attributes associated with this document.\n * @param {number} [attributes.boost=1] - Boost applied to all terms within this document.\n */\nlunr.Builder.prototype.add = function (doc, attributes) {\n var docRef = doc[this._ref],\n fields = Object.keys(this._fields)\n\n this._documents[docRef] = attributes || {}\n this.documentCount += 1\n\n for (var i = 0; i < fields.length; i++) {\n var fieldName = fields[i],\n extractor = this._fields[fieldName].extractor,\n field = extractor ? extractor(doc) : doc[fieldName],\n tokens = this.tokenizer(field, {\n fields: [fieldName]\n }),\n terms = this.pipeline.run(tokens),\n fieldRef = new lunr.FieldRef (docRef, fieldName),\n fieldTerms = Object.create(null)\n\n this.fieldTermFrequencies[fieldRef] = fieldTerms\n this.fieldLengths[fieldRef] = 0\n\n // store the length of this field for this document\n this.fieldLengths[fieldRef] += terms.length\n\n // calculate term frequencies for this field\n for (var j = 0; j < terms.length; j++) {\n var term = terms[j]\n\n if (fieldTerms[term] == undefined) {\n fieldTerms[term] = 0\n }\n\n fieldTerms[term] += 1\n\n // add to inverted index\n // create an initial posting if one doesn't exist\n if (this.invertedIndex[term] == undefined) {\n var posting = Object.create(null)\n posting[\"_index\"] = this.termIndex\n this.termIndex += 1\n\n for (var k = 0; k < fields.length; k++) {\n posting[fields[k]] = Object.create(null)\n }\n\n this.invertedIndex[term] = posting\n }\n\n // add an entry for this term/fieldName/docRef to the invertedIndex\n if (this.invertedIndex[term][fieldName][docRef] == undefined) {\n this.invertedIndex[term][fieldName][docRef] = Object.create(null)\n }\n\n // store all whitelisted metadata about this token in the\n // inverted index\n for (var l = 0; l < this.metadataWhitelist.length; l++) {\n var metadataKey = this.metadataWhitelist[l],\n metadata = term.metadata[metadataKey]\n\n if (this.invertedIndex[term][fieldName][docRef][metadataKey] == undefined) {\n this.invertedIndex[term][fieldName][docRef][metadataKey] = []\n }\n\n this.invertedIndex[term][fieldName][docRef][metadataKey].push(metadata)\n }\n }\n\n }\n}\n\n/**\n * Calculates the average document length for this index\n *\n * @private\n */\nlunr.Builder.prototype.calculateAverageFieldLengths = function () {\n\n var fieldRefs = Object.keys(this.fieldLengths),\n numberOfFields = fieldRefs.length,\n accumulator = {},\n documentsWithField = {}\n\n for (var i = 0; i < numberOfFields; i++) {\n var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),\n field = fieldRef.fieldName\n\n documentsWithField[field] || (documentsWithField[field] = 0)\n documentsWithField[field] += 1\n\n accumulator[field] || (accumulator[field] = 0)\n accumulator[field] += this.fieldLengths[fieldRef]\n }\n\n var fields = Object.keys(this._fields)\n\n for (var i = 0; i < fields.length; i++) {\n var fieldName = fields[i]\n accumulator[fieldName] = accumulator[fieldName] / documentsWithField[fieldName]\n }\n\n this.averageFieldLength = accumulator\n}\n\n/**\n * Builds a vector space model of every document using lunr.Vector\n *\n * @private\n */\nlunr.Builder.prototype.createFieldVectors = function () {\n var fieldVectors = {},\n fieldRefs = Object.keys(this.fieldTermFrequencies),\n fieldRefsLength = fieldRefs.length,\n termIdfCache = Object.create(null)\n\n for (var i = 0; i < fieldRefsLength; i++) {\n var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),\n fieldName = fieldRef.fieldName,\n fieldLength = this.fieldLengths[fieldRef],\n fieldVector = new lunr.Vector,\n termFrequencies = this.fieldTermFrequencies[fieldRef],\n terms = Object.keys(termFrequencies),\n termsLength = terms.length\n\n\n var fieldBoost = this._fields[fieldName].boost || 1,\n docBoost = this._documents[fieldRef.docRef].boost || 1\n\n for (var j = 0; j < termsLength; j++) {\n var term = terms[j],\n tf = termFrequencies[term],\n termIndex = this.invertedIndex[term]._index,\n idf, score, scoreWithPrecision\n\n if (termIdfCache[term] === undefined) {\n idf = lunr.idf(this.invertedIndex[term], this.documentCount)\n termIdfCache[term] = idf\n } else {\n idf = termIdfCache[term]\n }\n\n score = idf * ((this._k1 + 1) * tf) / (this._k1 * (1 - this._b + this._b * (fieldLength / this.averageFieldLength[fieldName])) + tf)\n score *= fieldBoost\n score *= docBoost\n scoreWithPrecision = Math.round(score * 1000) / 1000\n // Converts 1.23456789 to 1.234.\n // Reducing the precision so that the vectors take up less\n // space when serialised. Doing it now so that they behave\n // the same before and after serialisation. Also, this is\n // the fastest approach to reducing a number's precision in\n // JavaScript.\n\n fieldVector.insert(termIndex, scoreWithPrecision)\n }\n\n fieldVectors[fieldRef] = fieldVector\n }\n\n this.fieldVectors = fieldVectors\n}\n\n/**\n * Creates a token set of all tokens in the index using lunr.TokenSet\n *\n * @private\n */\nlunr.Builder.prototype.createTokenSet = function () {\n this.tokenSet = lunr.TokenSet.fromArray(\n Object.keys(this.invertedIndex).sort()\n )\n}\n\n/**\n * Builds the index, creating an instance of lunr.Index.\n *\n * This completes the indexing process and should only be called\n * once all documents have been added to the index.\n *\n * @returns {lunr.Index}\n */\nlunr.Builder.prototype.build = function () {\n this.calculateAverageFieldLengths()\n this.createFieldVectors()\n this.createTokenSet()\n\n return new lunr.Index({\n invertedIndex: this.invertedIndex,\n fieldVectors: this.fieldVectors,\n tokenSet: this.tokenSet,\n fields: Object.keys(this._fields),\n pipeline: this.searchPipeline\n })\n}\n\n/**\n * Applies a plugin to the index builder.\n *\n * A plugin is a function that is called with the index builder as its context.\n * Plugins can be used to customise or extend the behaviour of the index\n * in some way. A plugin is just a function, that encapsulated the custom\n * behaviour that should be applied when building the index.\n *\n * The plugin function will be called with the index builder as its argument, additional\n * arguments can also be passed when calling use. The function will be called\n * with the index builder as its context.\n *\n * @param {Function} plugin The plugin to apply.\n */\nlunr.Builder.prototype.use = function (fn) {\n var args = Array.prototype.slice.call(arguments, 1)\n args.unshift(this)\n fn.apply(this, args)\n}\n/**\n * Contains and collects metadata about a matching document.\n * A single instance of lunr.MatchData is returned as part of every\n * lunr.Index~Result.\n *\n * @constructor\n * @param {string} term - The term this match data is associated with\n * @param {string} field - The field in which the term was found\n * @param {object} metadata - The metadata recorded about this term in this field\n * @property {object} metadata - A cloned collection of metadata associated with this document.\n * @see {@link lunr.Index~Result}\n */\nlunr.MatchData = function (term, field, metadata) {\n var clonedMetadata = Object.create(null),\n metadataKeys = Object.keys(metadata || {})\n\n // Cloning the metadata to prevent the original\n // being mutated during match data combination.\n // Metadata is kept in an array within the inverted\n // index so cloning the data can be done with\n // Array#slice\n for (var i = 0; i < metadataKeys.length; i++) {\n var key = metadataKeys[i]\n clonedMetadata[key] = metadata[key].slice()\n }\n\n this.metadata = Object.create(null)\n\n if (term !== undefined) {\n this.metadata[term] = Object.create(null)\n this.metadata[term][field] = clonedMetadata\n }\n}\n\n/**\n * An instance of lunr.MatchData will be created for every term that matches a\n * document. However only one instance is required in a lunr.Index~Result. This\n * method combines metadata from another instance of lunr.MatchData with this\n * objects metadata.\n *\n * @param {lunr.MatchData} otherMatchData - Another instance of match data to merge with this one.\n * @see {@link lunr.Index~Result}\n */\nlunr.MatchData.prototype.combine = function (otherMatchData) {\n var terms = Object.keys(otherMatchData.metadata)\n\n for (var i = 0; i < terms.length; i++) {\n var term = terms[i],\n fields = Object.keys(otherMatchData.metadata[term])\n\n if (this.metadata[term] == undefined) {\n this.metadata[term] = Object.create(null)\n }\n\n for (var j = 0; j < fields.length; j++) {\n var field = fields[j],\n keys = Object.keys(otherMatchData.metadata[term][field])\n\n if (this.metadata[term][field] == undefined) {\n this.metadata[term][field] = Object.create(null)\n }\n\n for (var k = 0; k < keys.length; k++) {\n var key = keys[k]\n\n if (this.metadata[term][field][key] == undefined) {\n this.metadata[term][field][key] = otherMatchData.metadata[term][field][key]\n } else {\n this.metadata[term][field][key] = this.metadata[term][field][key].concat(otherMatchData.metadata[term][field][key])\n }\n\n }\n }\n }\n}\n\n/**\n * Add metadata for a term/field pair to this instance of match data.\n *\n * @param {string} term - The term this match data is associated with\n * @param {string} field - The field in which the term was found\n * @param {object} metadata - The metadata recorded about this term in this field\n */\nlunr.MatchData.prototype.add = function (term, field, metadata) {\n if (!(term in this.metadata)) {\n this.metadata[term] = Object.create(null)\n this.metadata[term][field] = metadata\n return\n }\n\n if (!(field in this.metadata[term])) {\n this.metadata[term][field] = metadata\n return\n }\n\n var metadataKeys = Object.keys(metadata)\n\n for (var i = 0; i < metadataKeys.length; i++) {\n var key = metadataKeys[i]\n\n if (key in this.metadata[term][field]) {\n this.metadata[term][field][key] = this.metadata[term][field][key].concat(metadata[key])\n } else {\n this.metadata[term][field][key] = metadata[key]\n }\n }\n}\n/**\n * A lunr.Query provides a programmatic way of defining queries to be performed\n * against a {@link lunr.Index}.\n *\n * Prefer constructing a lunr.Query using the {@link lunr.Index#query} method\n * so the query object is pre-initialized with the right index fields.\n *\n * @constructor\n * @property {lunr.Query~Clause[]} clauses - An array of query clauses.\n * @property {string[]} allFields - An array of all available fields in a lunr.Index.\n */\nlunr.Query = function (allFields) {\n this.clauses = []\n this.allFields = allFields\n}\n\n/**\n * Constants for indicating what kind of automatic wildcard insertion will be used when constructing a query clause.\n *\n * This allows wildcards to be added to the beginning and end of a term without having to manually do any string\n * concatenation.\n *\n * The wildcard constants can be bitwise combined to select both leading and trailing wildcards.\n *\n * @constant\n * @default\n * @property {number} wildcard.NONE - The term will have no wildcards inserted, this is the default behaviour\n * @property {number} wildcard.LEADING - Prepend the term with a wildcard, unless a leading wildcard already exists\n * @property {number} wildcard.TRAILING - Append a wildcard to the term, unless a trailing wildcard already exists\n * @see lunr.Query~Clause\n * @see lunr.Query#clause\n * @see lunr.Query#term\n * @example query term with trailing wildcard\n * query.term('foo', { wildcard: lunr.Query.wildcard.TRAILING })\n * @example query term with leading and trailing wildcard\n * query.term('foo', {\n * wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING\n * })\n */\n\nlunr.Query.wildcard = new String (\"*\")\nlunr.Query.wildcard.NONE = 0\nlunr.Query.wildcard.LEADING = 1\nlunr.Query.wildcard.TRAILING = 2\n\n/**\n * Constants for indicating what kind of presence a term must have in matching documents.\n *\n * @constant\n * @enum {number}\n * @see lunr.Query~Clause\n * @see lunr.Query#clause\n * @see lunr.Query#term\n * @example query term with required presence\n * query.term('foo', { presence: lunr.Query.presence.REQUIRED })\n */\nlunr.Query.presence = {\n /**\n * Term's presence in a document is optional, this is the default value.\n */\n OPTIONAL: 1,\n\n /**\n * Term's presence in a document is required, documents that do not contain\n * this term will not be returned.\n */\n REQUIRED: 2,\n\n /**\n * Term's presence in a document is prohibited, documents that do contain\n * this term will not be returned.\n */\n PROHIBITED: 3\n}\n\n/**\n * A single clause in a {@link lunr.Query} contains a term and details on how to\n * match that term against a {@link lunr.Index}.\n *\n * @typedef {Object} lunr.Query~Clause\n * @property {string[]} fields - The fields in an index this clause should be matched against.\n * @property {number} [boost=1] - Any boost that should be applied when matching this clause.\n * @property {number} [editDistance] - Whether the term should have fuzzy matching applied, and how fuzzy the match should be.\n * @property {boolean} [usePipeline] - Whether the term should be passed through the search pipeline.\n * @property {number} [wildcard=lunr.Query.wildcard.NONE] - Whether the term should have wildcards appended or prepended.\n * @property {number} [presence=lunr.Query.presence.OPTIONAL] - The terms presence in any matching documents.\n */\n\n/**\n * Adds a {@link lunr.Query~Clause} to this query.\n *\n * Unless the clause contains the fields to be matched all fields will be matched. In addition\n * a default boost of 1 is applied to the clause.\n *\n * @param {lunr.Query~Clause} clause - The clause to add to this query.\n * @see lunr.Query~Clause\n * @returns {lunr.Query}\n */\nlunr.Query.prototype.clause = function (clause) {\n if (!('fields' in clause)) {\n clause.fields = this.allFields\n }\n\n if (!('boost' in clause)) {\n clause.boost = 1\n }\n\n if (!('usePipeline' in clause)) {\n clause.usePipeline = true\n }\n\n if (!('wildcard' in clause)) {\n clause.wildcard = lunr.Query.wildcard.NONE\n }\n\n if ((clause.wildcard & lunr.Query.wildcard.LEADING) && (clause.term.charAt(0) != lunr.Query.wildcard)) {\n clause.term = \"*\" + clause.term\n }\n\n if ((clause.wildcard & lunr.Query.wildcard.TRAILING) && (clause.term.slice(-1) != lunr.Query.wildcard)) {\n clause.term = \"\" + clause.term + \"*\"\n }\n\n if (!('presence' in clause)) {\n clause.presence = lunr.Query.presence.OPTIONAL\n }\n\n this.clauses.push(clause)\n\n return this\n}\n\n/**\n * A negated query is one in which every clause has a presence of\n * prohibited. These queries require some special processing to return\n * the expected results.\n *\n * @returns boolean\n */\nlunr.Query.prototype.isNegated = function () {\n for (var i = 0; i < this.clauses.length; i++) {\n if (this.clauses[i].presence != lunr.Query.presence.PROHIBITED) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Adds a term to the current query, under the covers this will create a {@link lunr.Query~Clause}\n * to the list of clauses that make up this query.\n *\n * The term is used as is, i.e. no tokenization will be performed by this method. Instead conversion\n * to a token or token-like string should be done before calling this method.\n *\n * The term will be converted to a string by calling `toString`. Multiple terms can be passed as an\n * array, each term in the array will share the same options.\n *\n * @param {object|object[]} term - The term(s) to add to the query.\n * @param {object} [options] - Any additional properties to add to the query clause.\n * @returns {lunr.Query}\n * @see lunr.Query#clause\n * @see lunr.Query~Clause\n * @example adding a single term to a query\n * query.term(\"foo\")\n * @example adding a single term to a query and specifying search fields, term boost and automatic trailing wildcard\n * query.term(\"foo\", {\n * fields: [\"title\"],\n * boost: 10,\n * wildcard: lunr.Query.wildcard.TRAILING\n * })\n * @example using lunr.tokenizer to convert a string to tokens before using them as terms\n * query.term(lunr.tokenizer(\"foo bar\"))\n */\nlunr.Query.prototype.term = function (term, options) {\n if (Array.isArray(term)) {\n term.forEach(function (t) { this.term(t, lunr.utils.clone(options)) }, this)\n return this\n }\n\n var clause = options || {}\n clause.term = term.toString()\n\n this.clause(clause)\n\n return this\n}\nlunr.QueryParseError = function (message, start, end) {\n this.name = \"QueryParseError\"\n this.message = message\n this.start = start\n this.end = end\n}\n\nlunr.QueryParseError.prototype = new Error\nlunr.QueryLexer = function (str) {\n this.lexemes = []\n this.str = str\n this.length = str.length\n this.pos = 0\n this.start = 0\n this.escapeCharPositions = []\n}\n\nlunr.QueryLexer.prototype.run = function () {\n var state = lunr.QueryLexer.lexText\n\n while (state) {\n state = state(this)\n }\n}\n\nlunr.QueryLexer.prototype.sliceString = function () {\n var subSlices = [],\n sliceStart = this.start,\n sliceEnd = this.pos\n\n for (var i = 0; i < this.escapeCharPositions.length; i++) {\n sliceEnd = this.escapeCharPositions[i]\n subSlices.push(this.str.slice(sliceStart, sliceEnd))\n sliceStart = sliceEnd + 1\n }\n\n subSlices.push(this.str.slice(sliceStart, this.pos))\n this.escapeCharPositions.length = 0\n\n return subSlices.join('')\n}\n\nlunr.QueryLexer.prototype.emit = function (type) {\n this.lexemes.push({\n type: type,\n str: this.sliceString(),\n start: this.start,\n end: this.pos\n })\n\n this.start = this.pos\n}\n\nlunr.QueryLexer.prototype.escapeCharacter = function () {\n this.escapeCharPositions.push(this.pos - 1)\n this.pos += 1\n}\n\nlunr.QueryLexer.prototype.next = function () {\n if (this.pos >= this.length) {\n return lunr.QueryLexer.EOS\n }\n\n var char = this.str.charAt(this.pos)\n this.pos += 1\n return char\n}\n\nlunr.QueryLexer.prototype.width = function () {\n return this.pos - this.start\n}\n\nlunr.QueryLexer.prototype.ignore = function () {\n if (this.start == this.pos) {\n this.pos += 1\n }\n\n this.start = this.pos\n}\n\nlunr.QueryLexer.prototype.backup = function () {\n this.pos -= 1\n}\n\nlunr.QueryLexer.prototype.acceptDigitRun = function () {\n var char, charCode\n\n do {\n char = this.next()\n charCode = char.charCodeAt(0)\n } while (charCode > 47 && charCode < 58)\n\n if (char != lunr.QueryLexer.EOS) {\n this.backup()\n }\n}\n\nlunr.QueryLexer.prototype.more = function () {\n return this.pos < this.length\n}\n\nlunr.QueryLexer.EOS = 'EOS'\nlunr.QueryLexer.FIELD = 'FIELD'\nlunr.QueryLexer.TERM = 'TERM'\nlunr.QueryLexer.EDIT_DISTANCE = 'EDIT_DISTANCE'\nlunr.QueryLexer.BOOST = 'BOOST'\nlunr.QueryLexer.PRESENCE = 'PRESENCE'\n\nlunr.QueryLexer.lexField = function (lexer) {\n lexer.backup()\n lexer.emit(lunr.QueryLexer.FIELD)\n lexer.ignore()\n return lunr.QueryLexer.lexText\n}\n\nlunr.QueryLexer.lexTerm = function (lexer) {\n if (lexer.width() > 1) {\n lexer.backup()\n lexer.emit(lunr.QueryLexer.TERM)\n }\n\n lexer.ignore()\n\n if (lexer.more()) {\n return lunr.QueryLexer.lexText\n }\n}\n\nlunr.QueryLexer.lexEditDistance = function (lexer) {\n lexer.ignore()\n lexer.acceptDigitRun()\n lexer.emit(lunr.QueryLexer.EDIT_DISTANCE)\n return lunr.QueryLexer.lexText\n}\n\nlunr.QueryLexer.lexBoost = function (lexer) {\n lexer.ignore()\n lexer.acceptDigitRun()\n lexer.emit(lunr.QueryLexer.BOOST)\n return lunr.QueryLexer.lexText\n}\n\nlunr.QueryLexer.lexEOS = function (lexer) {\n if (lexer.width() > 0) {\n lexer.emit(lunr.QueryLexer.TERM)\n }\n}\n\n// This matches the separator used when tokenising fields\n// within a document. These should match otherwise it is\n// not possible to search for some tokens within a document.\n//\n// It is possible for the user to change the separator on the\n// tokenizer so it _might_ clash with any other of the special\n// characters already used within the search string, e.g. :.\n//\n// This means that it is possible to change the separator in\n// such a way that makes some words unsearchable using a search\n// string.\nlunr.QueryLexer.termSeparator = lunr.tokenizer.separator\n\nlunr.QueryLexer.lexText = function (lexer) {\n while (true) {\n var char = lexer.next()\n\n if (char == lunr.QueryLexer.EOS) {\n return lunr.QueryLexer.lexEOS\n }\n\n // Escape character is '\\'\n if (char.charCodeAt(0) == 92) {\n lexer.escapeCharacter()\n continue\n }\n\n if (char == \":\") {\n return lunr.QueryLexer.lexField\n }\n\n if (char == \"~\") {\n lexer.backup()\n if (lexer.width() > 0) {\n lexer.emit(lunr.QueryLexer.TERM)\n }\n return lunr.QueryLexer.lexEditDistance\n }\n\n if (char == \"^\") {\n lexer.backup()\n if (lexer.width() > 0) {\n lexer.emit(lunr.QueryLexer.TERM)\n }\n return lunr.QueryLexer.lexBoost\n }\n\n // \"+\" indicates term presence is required\n // checking for length to ensure that only\n // leading \"+\" are considered\n if (char == \"+\" && lexer.width() === 1) {\n lexer.emit(lunr.QueryLexer.PRESENCE)\n return lunr.QueryLexer.lexText\n }\n\n // \"-\" indicates term presence is prohibited\n // checking for length to ensure that only\n // leading \"-\" are considered\n if (char == \"-\" && lexer.width() === 1) {\n lexer.emit(lunr.QueryLexer.PRESENCE)\n return lunr.QueryLexer.lexText\n }\n\n if (char.match(lunr.QueryLexer.termSeparator)) {\n return lunr.QueryLexer.lexTerm\n }\n }\n}\n\nlunr.QueryParser = function (str, query) {\n this.lexer = new lunr.QueryLexer (str)\n this.query = query\n this.currentClause = {}\n this.lexemeIdx = 0\n}\n\nlunr.QueryParser.prototype.parse = function () {\n this.lexer.run()\n this.lexemes = this.lexer.lexemes\n\n var state = lunr.QueryParser.parseClause\n\n while (state) {\n state = state(this)\n }\n\n return this.query\n}\n\nlunr.QueryParser.prototype.peekLexeme = function () {\n return this.lexemes[this.lexemeIdx]\n}\n\nlunr.QueryParser.prototype.consumeLexeme = function () {\n var lexeme = this.peekLexeme()\n this.lexemeIdx += 1\n return lexeme\n}\n\nlunr.QueryParser.prototype.nextClause = function () {\n var completedClause = this.currentClause\n this.query.clause(completedClause)\n this.currentClause = {}\n}\n\nlunr.QueryParser.parseClause = function (parser) {\n var lexeme = parser.peekLexeme()\n\n if (lexeme == undefined) {\n return\n }\n\n switch (lexeme.type) {\n case lunr.QueryLexer.PRESENCE:\n return lunr.QueryParser.parsePresence\n case lunr.QueryLexer.FIELD:\n return lunr.QueryParser.parseField\n case lunr.QueryLexer.TERM:\n return lunr.QueryParser.parseTerm\n default:\n var errorMessage = \"expected either a field or a term, found \" + lexeme.type\n\n if (lexeme.str.length >= 1) {\n errorMessage += \" with value '\" + lexeme.str + \"'\"\n }\n\n throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)\n }\n}\n\nlunr.QueryParser.parsePresence = function (parser) {\n var lexeme = parser.consumeLexeme()\n\n if (lexeme == undefined) {\n return\n }\n\n switch (lexeme.str) {\n case \"-\":\n parser.currentClause.presence = lunr.Query.presence.PROHIBITED\n break\n case \"+\":\n parser.currentClause.presence = lunr.Query.presence.REQUIRED\n break\n default:\n var errorMessage = \"unrecognised presence operator'\" + lexeme.str + \"'\"\n throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)\n }\n\n var nextLexeme = parser.peekLexeme()\n\n if (nextLexeme == undefined) {\n var errorMessage = \"expecting term or field, found nothing\"\n throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)\n }\n\n switch (nextLexeme.type) {\n case lunr.QueryLexer.FIELD:\n return lunr.QueryParser.parseField\n case lunr.QueryLexer.TERM:\n return lunr.QueryParser.parseTerm\n default:\n var errorMessage = \"expecting term or field, found '\" + nextLexeme.type + \"'\"\n throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)\n }\n}\n\nlunr.QueryParser.parseField = function (parser) {\n var lexeme = parser.consumeLexeme()\n\n if (lexeme == undefined) {\n return\n }\n\n if (parser.query.allFields.indexOf(lexeme.str) == -1) {\n var possibleFields = parser.query.allFields.map(function (f) { return \"'\" + f + \"'\" }).join(', '),\n errorMessage = \"unrecognised field '\" + lexeme.str + \"', possible fields: \" + possibleFields\n\n throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)\n }\n\n parser.currentClause.fields = [lexeme.str]\n\n var nextLexeme = parser.peekLexeme()\n\n if (nextLexeme == undefined) {\n var errorMessage = \"expecting term, found nothing\"\n throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)\n }\n\n switch (nextLexeme.type) {\n case lunr.QueryLexer.TERM:\n return lunr.QueryParser.parseTerm\n default:\n var errorMessage = \"expecting term, found '\" + nextLexeme.type + \"'\"\n throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)\n }\n}\n\nlunr.QueryParser.parseTerm = function (parser) {\n var lexeme = parser.consumeLexeme()\n\n if (lexeme == undefined) {\n return\n }\n\n parser.currentClause.term = lexeme.str.toLowerCase()\n\n if (lexeme.str.indexOf(\"*\") != -1) {\n parser.currentClause.usePipeline = false\n }\n\n var nextLexeme = parser.peekLexeme()\n\n if (nextLexeme == undefined) {\n parser.nextClause()\n return\n }\n\n switch (nextLexeme.type) {\n case lunr.QueryLexer.TERM:\n parser.nextClause()\n return lunr.QueryParser.parseTerm\n case lunr.QueryLexer.FIELD:\n parser.nextClause()\n return lunr.QueryParser.parseField\n case lunr.QueryLexer.EDIT_DISTANCE:\n return lunr.QueryParser.parseEditDistance\n case lunr.QueryLexer.BOOST:\n return lunr.QueryParser.parseBoost\n case lunr.QueryLexer.PRESENCE:\n parser.nextClause()\n return lunr.QueryParser.parsePresence\n default:\n var errorMessage = \"Unexpected lexeme type '\" + nextLexeme.type + \"'\"\n throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)\n }\n}\n\nlunr.QueryParser.parseEditDistance = function (parser) {\n var lexeme = parser.consumeLexeme()\n\n if (lexeme == undefined) {\n return\n }\n\n var editDistance = parseInt(lexeme.str, 10)\n\n if (isNaN(editDistance)) {\n var errorMessage = \"edit distance must be numeric\"\n throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)\n }\n\n parser.currentClause.editDistance = editDistance\n\n var nextLexeme = parser.peekLexeme()\n\n if (nextLexeme == undefined) {\n parser.nextClause()\n return\n }\n\n switch (nextLexeme.type) {\n case lunr.QueryLexer.TERM:\n parser.nextClause()\n return lunr.QueryParser.parseTerm\n case lunr.QueryLexer.FIELD:\n parser.nextClause()\n return lunr.QueryParser.parseField\n case lunr.QueryLexer.EDIT_DISTANCE:\n return lunr.QueryParser.parseEditDistance\n case lunr.QueryLexer.BOOST:\n return lunr.QueryParser.parseBoost\n case lunr.QueryLexer.PRESENCE:\n parser.nextClause()\n return lunr.QueryParser.parsePresence\n default:\n var errorMessage = \"Unexpected lexeme type '\" + nextLexeme.type + \"'\"\n throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)\n }\n}\n\nlunr.QueryParser.parseBoost = function (parser) {\n var lexeme = parser.consumeLexeme()\n\n if (lexeme == undefined) {\n return\n }\n\n var boost = parseInt(lexeme.str, 10)\n\n if (isNaN(boost)) {\n var errorMessage = \"boost must be numeric\"\n throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)\n }\n\n parser.currentClause.boost = boost\n\n var nextLexeme = parser.peekLexeme()\n\n if (nextLexeme == undefined) {\n parser.nextClause()\n return\n }\n\n switch (nextLexeme.type) {\n case lunr.QueryLexer.TERM:\n parser.nextClause()\n return lunr.QueryParser.parseTerm\n case lunr.QueryLexer.FIELD:\n parser.nextClause()\n return lunr.QueryParser.parseField\n case lunr.QueryLexer.EDIT_DISTANCE:\n return lunr.QueryParser.parseEditDistance\n case lunr.QueryLexer.BOOST:\n return lunr.QueryParser.parseBoost\n case lunr.QueryLexer.PRESENCE:\n parser.nextClause()\n return lunr.QueryParser.parsePresence\n default:\n var errorMessage = \"Unexpected lexeme type '\" + nextLexeme.type + \"'\"\n throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)\n }\n}\n\n /**\n * export the module via AMD, CommonJS or as a browser global\n * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js\n */\n ;(function (root, factory) {\n if (true) {\n // AMD. Register as an anonymous module.\n !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :\n\t\t__WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n } else {}\n }(this, function () {\n /**\n * Just return a value to define the module export.\n * This example returns an object, but the module\n * can return a function as the exported value.\n */\n return lunr\n }))\n})();\n\n\n//# sourceURL=webpack:///../node_modules/lunr/lunr.js?"); - -/***/ }), - -/***/ "./default/assets/css/main.sass": -/*!**************************************!*\ - !*** ./default/assets/css/main.sass ***! - \**************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack:///./default/assets/css/main.sass?"); - -/***/ }), - -/***/ "./default/assets/js/src/bootstrap.ts": -/*!********************************************!*\ - !*** ./default/assets/js/src/bootstrap.ts ***! - \********************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _typedoc_Application__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typedoc/Application */ \"./default/assets/js/src/typedoc/Application.ts\");\n/* harmony import */ var _typedoc_components_MenuHighlight__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./typedoc/components/MenuHighlight */ \"./default/assets/js/src/typedoc/components/MenuHighlight.ts\");\n/* harmony import */ var _typedoc_components_Search__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./typedoc/components/Search */ \"./default/assets/js/src/typedoc/components/Search.ts\");\n/* harmony import */ var _typedoc_components_Signature__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./typedoc/components/Signature */ \"./default/assets/js/src/typedoc/components/Signature.ts\");\n/* harmony import */ var _typedoc_components_Toggle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./typedoc/components/Toggle */ \"./default/assets/js/src/typedoc/components/Toggle.ts\");\n/* harmony import */ var _typedoc_components_Filter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./typedoc/components/Filter */ \"./default/assets/js/src/typedoc/components/Filter.ts\");\n/* harmony import */ var _css_main_sass__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../css/main.sass */ \"./default/assets/css/main.sass\");\n\n\n\n\n\n\n\n(0,_typedoc_components_Search__WEBPACK_IMPORTED_MODULE_2__.initSearch)();\n(0,_typedoc_Application__WEBPACK_IMPORTED_MODULE_0__.registerComponent)(_typedoc_components_MenuHighlight__WEBPACK_IMPORTED_MODULE_1__.MenuHighlight, \".menu-highlight\");\n(0,_typedoc_Application__WEBPACK_IMPORTED_MODULE_0__.registerComponent)(_typedoc_components_Signature__WEBPACK_IMPORTED_MODULE_3__.Signature, \".tsd-signatures\");\n(0,_typedoc_Application__WEBPACK_IMPORTED_MODULE_0__.registerComponent)(_typedoc_components_Toggle__WEBPACK_IMPORTED_MODULE_4__.Toggle, \"a[data-toggle]\");\nif (_typedoc_components_Filter__WEBPACK_IMPORTED_MODULE_5__.Filter.isSupported()) {\n (0,_typedoc_Application__WEBPACK_IMPORTED_MODULE_0__.registerComponent)(_typedoc_components_Filter__WEBPACK_IMPORTED_MODULE_5__.Filter, \"#tsd-filter\");\n}\nelse {\n document.documentElement.classList.add(\"no-filter\");\n}\nvar app = new _typedoc_Application__WEBPACK_IMPORTED_MODULE_0__.Application();\nObject.defineProperty(window, \"app\", { value: app });\n\n\n//# sourceURL=webpack:///./default/assets/js/src/bootstrap.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/Application.ts": -/*!******************************************************!*\ - !*** ./default/assets/js/src/typedoc/Application.ts ***! - \******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"registerComponent\": () => /* binding */ registerComponent,\n/* harmony export */ \"Application\": () => /* binding */ Application\n/* harmony export */ });\n/**\n * List of all known components.\n */\nvar components = [];\n/**\n * Register a new component.\n */\nfunction registerComponent(constructor, selector) {\n components.push({\n selector: selector,\n constructor: constructor,\n });\n}\n/**\n * TypeDoc application class.\n */\nvar Application = /** @class */ (function () {\n /**\n * Create a new Application instance.\n */\n function Application() {\n this.createComponents(document.body);\n }\n /**\n * Create all components beneath the given jQuery element.\n */\n Application.prototype.createComponents = function (context) {\n components.forEach(function (c) {\n context.querySelectorAll(c.selector).forEach(function (el) {\n if (!el.dataset.hasInstance) {\n new c.constructor({ el: el });\n el.dataset.hasInstance = String(true);\n }\n });\n });\n };\n return Application;\n}());\n\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/Application.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/Component.ts": -/*!****************************************************!*\ - !*** ./default/assets/js/src/typedoc/Component.ts ***! - \****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Component\": () => /* binding */ Component\n/* harmony export */ });\n/**\n * TypeDoc component class.\n */\nvar Component = /** @class */ (function () {\n function Component(options) {\n this.el = options.el;\n }\n return Component;\n}());\n\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/Component.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/EventTarget.ts": -/*!******************************************************!*\ - !*** ./default/assets/js/src/typedoc/EventTarget.ts ***! - \******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"EventTarget\": () => /* binding */ EventTarget\n/* harmony export */ });\n/**\n * TypeDoc event target class.\n */\nvar EventTarget = /** @class */ (function () {\n function EventTarget() {\n this.listeners = {};\n }\n EventTarget.prototype.addEventListener = function (type, callback) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n this.listeners[type].push(callback);\n };\n EventTarget.prototype.removeEventListener = function (type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n var stack = this.listeners[type];\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i] === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n };\n EventTarget.prototype.dispatchEvent = function (event) {\n if (!(event.type in this.listeners)) {\n return true;\n }\n var stack = this.listeners[event.type].slice();\n for (var i = 0, l = stack.length; i < l; i++) {\n stack[i].call(this, event);\n }\n return !event.defaultPrevented;\n };\n return EventTarget;\n}());\n\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/EventTarget.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/components/Filter.ts": -/*!************************************************************!*\ - !*** ./default/assets/js/src/typedoc/components/Filter.ts ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Filter\": () => /* binding */ Filter\n/* harmony export */ });\n/* harmony import */ var _Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Component */ \"./default/assets/js/src/typedoc/Component.ts\");\n/* harmony import */ var _utils_pointer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/pointer */ \"./default/assets/js/src/typedoc/utils/pointer.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\nvar FilterItem = /** @class */ (function () {\n function FilterItem(key, value) {\n this.key = key;\n this.value = value;\n this.defaultValue = value;\n this.initialize();\n if (window.localStorage[this.key]) {\n this.setValue(this.fromLocalStorage(window.localStorage[this.key]));\n }\n }\n FilterItem.prototype.initialize = function () { };\n FilterItem.prototype.setValue = function (value) {\n if (this.value == value)\n return;\n var oldValue = this.value;\n this.value = value;\n window.localStorage[this.key] = this.toLocalStorage(value);\n this.handleValueChange(oldValue, value);\n };\n return FilterItem;\n}());\nvar FilterItemCheckbox = /** @class */ (function (_super) {\n __extends(FilterItemCheckbox, _super);\n function FilterItemCheckbox() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FilterItemCheckbox.prototype.initialize = function () {\n var _this = this;\n var checkbox = document.querySelector(\"#tsd-filter-\" + this.key);\n if (!checkbox)\n return;\n this.checkbox = checkbox;\n this.checkbox.addEventListener(\"change\", function () {\n _this.setValue(_this.checkbox.checked);\n });\n };\n FilterItemCheckbox.prototype.handleValueChange = function (oldValue, newValue) {\n if (!this.checkbox)\n return;\n this.checkbox.checked = this.value;\n document.documentElement.classList.toggle(\"toggle-\" + this.key, this.value != this.defaultValue);\n };\n FilterItemCheckbox.prototype.fromLocalStorage = function (value) {\n return value == \"true\";\n };\n FilterItemCheckbox.prototype.toLocalStorage = function (value) {\n return value ? \"true\" : \"false\";\n };\n return FilterItemCheckbox;\n}(FilterItem));\nvar FilterItemSelect = /** @class */ (function (_super) {\n __extends(FilterItemSelect, _super);\n function FilterItemSelect() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FilterItemSelect.prototype.initialize = function () {\n var _this = this;\n document.documentElement.classList.add(\"toggle-\" + this.key + this.value);\n var select = document.querySelector(\"#tsd-filter-\" + this.key);\n if (!select)\n return;\n this.select = select;\n var onActivate = function () {\n _this.select.classList.add(\"active\");\n };\n var onDeactivate = function () {\n _this.select.classList.remove(\"active\");\n };\n this.select.addEventListener(_utils_pointer__WEBPACK_IMPORTED_MODULE_1__.pointerDown, onActivate);\n this.select.addEventListener(\"mouseover\", onActivate);\n this.select.addEventListener(\"mouseleave\", onDeactivate);\n this.select.querySelectorAll(\"li\").forEach(function (el) {\n el.addEventListener(_utils_pointer__WEBPACK_IMPORTED_MODULE_1__.pointerUp, function (e) {\n select.classList.remove(\"active\");\n _this.setValue(e.target.dataset.value || \"\");\n });\n });\n document.addEventListener(_utils_pointer__WEBPACK_IMPORTED_MODULE_1__.pointerDown, function (e) {\n if (_this.select.contains(e.target))\n return;\n _this.select.classList.remove(\"active\");\n });\n };\n FilterItemSelect.prototype.handleValueChange = function (oldValue, newValue) {\n this.select.querySelectorAll(\"li.selected\").forEach(function (el) {\n el.classList.remove(\"selected\");\n });\n var selected = this.select.querySelector('li[data-value=\"' + newValue + '\"]');\n var label = this.select.querySelector(\".tsd-select-label\");\n if (selected && label) {\n selected.classList.add(\"selected\");\n label.textContent = selected.textContent;\n }\n document.documentElement.classList.remove(\"toggle-\" + oldValue);\n document.documentElement.classList.add(\"toggle-\" + newValue);\n };\n FilterItemSelect.prototype.fromLocalStorage = function (value) {\n return value;\n };\n FilterItemSelect.prototype.toLocalStorage = function (value) {\n return value;\n };\n return FilterItemSelect;\n}(FilterItem));\nvar Filter = /** @class */ (function (_super) {\n __extends(Filter, _super);\n function Filter(options) {\n var _this = _super.call(this, options) || this;\n _this.optionVisibility = new FilterItemSelect(\"visibility\", \"private\");\n _this.optionInherited = new FilterItemCheckbox(\"inherited\", true);\n _this.optionExternals = new FilterItemCheckbox(\"externals\", true);\n return _this;\n }\n Filter.isSupported = function () {\n try {\n return typeof window.localStorage != \"undefined\";\n }\n catch (e) {\n return false;\n }\n };\n return Filter;\n}(_Component__WEBPACK_IMPORTED_MODULE_0__.Component));\n\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/components/Filter.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/components/MenuHighlight.ts": -/*!*******************************************************************!*\ - !*** ./default/assets/js/src/typedoc/components/MenuHighlight.ts ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MenuHighlight\": () => /* binding */ MenuHighlight\n/* harmony export */ });\n/* harmony import */ var _Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Component */ \"./default/assets/js/src/typedoc/Component.ts\");\n/* harmony import */ var _services_Viewport__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services/Viewport */ \"./default/assets/js/src/typedoc/services/Viewport.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * Manages the sticky state of the navigation and moves the highlight\n * to the current navigation item.\n */\nvar MenuHighlight = /** @class */ (function (_super) {\n __extends(MenuHighlight, _super);\n /**\n * Create a new MenuHighlight instance.\n *\n * @param options Backbone view constructor options.\n */\n function MenuHighlight(options) {\n var _this = _super.call(this, options) || this;\n /**\n * List of all discovered anchors.\n */\n _this.anchors = [];\n /**\n * Index of the currently highlighted anchor.\n */\n _this.index = -1;\n _services_Viewport__WEBPACK_IMPORTED_MODULE_1__.Viewport.instance.addEventListener(\"resize\", function () { return _this.onResize(); });\n _services_Viewport__WEBPACK_IMPORTED_MODULE_1__.Viewport.instance.addEventListener(\"scroll\", function (e) { return _this.onScroll(e); });\n _this.createAnchors();\n return _this;\n }\n /**\n * Find all anchors on the current page.\n */\n MenuHighlight.prototype.createAnchors = function () {\n var _this = this;\n var base = window.location.href;\n if (base.indexOf(\"#\") != -1) {\n base = base.substr(0, base.indexOf(\"#\"));\n }\n this.el.querySelectorAll(\"a\").forEach(function (el) {\n var href = el.href;\n if (href.indexOf(\"#\") == -1)\n return;\n if (href.substr(0, base.length) != base)\n return;\n var hash = href.substr(href.indexOf(\"#\") + 1);\n var anchor = document.querySelector(\"a.tsd-anchor[name=\" + hash + \"]\");\n var link = el.parentNode;\n if (!anchor || !link)\n return;\n _this.anchors.push({\n link: link,\n anchor: anchor,\n position: 0,\n });\n });\n this.onResize();\n };\n /**\n * Triggered after the viewport was resized.\n */\n MenuHighlight.prototype.onResize = function () {\n var anchor;\n for (var index = 0, count = this.anchors.length; index < count; index++) {\n anchor = this.anchors[index];\n var rect = anchor.anchor.getBoundingClientRect();\n anchor.position = rect.top + document.body.scrollTop;\n }\n this.anchors.sort(function (a, b) {\n return a.position - b.position;\n });\n var event = new CustomEvent(\"scroll\", {\n detail: {\n scrollTop: _services_Viewport__WEBPACK_IMPORTED_MODULE_1__.Viewport.instance.scrollTop,\n },\n });\n this.onScroll(event);\n };\n /**\n * Triggered after the viewport was scrolled.\n *\n * @param event The custom event with the current vertical scroll position.\n */\n MenuHighlight.prototype.onScroll = function (event) {\n var scrollTop = event.detail.scrollTop + 5;\n var anchors = this.anchors;\n var count = anchors.length - 1;\n var index = this.index;\n while (index > -1 && anchors[index].position > scrollTop) {\n index -= 1;\n }\n while (index < count && anchors[index + 1].position < scrollTop) {\n index += 1;\n }\n if (this.index != index) {\n if (this.index > -1)\n this.anchors[this.index].link.classList.remove(\"focus\");\n this.index = index;\n if (this.index > -1)\n this.anchors[this.index].link.classList.add(\"focus\");\n }\n };\n return MenuHighlight;\n}(_Component__WEBPACK_IMPORTED_MODULE_0__.Component));\n\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/components/MenuHighlight.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/components/Search.ts": -/*!************************************************************!*\ - !*** ./default/assets/js/src/typedoc/components/Search.ts ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"initSearch\": () => /* binding */ initSearch\n/* harmony export */ });\n/* harmony import */ var _utils_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/debounce */ \"./default/assets/js/src/typedoc/utils/debounce.ts\");\n/* harmony import */ var lunr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lunr */ \"../node_modules/lunr/lunr.js\");\n/* harmony import */ var lunr__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lunr__WEBPACK_IMPORTED_MODULE_1__);\n\n\nfunction initSearch() {\n var searchEl = document.getElementById(\"tsd-search\");\n if (!searchEl)\n return;\n var searchScript = document.getElementById(\"search-script\");\n searchEl.classList.add(\"loading\");\n if (searchScript) {\n searchScript.addEventListener(\"error\", function () {\n searchEl.classList.remove(\"loading\");\n searchEl.classList.add(\"failure\");\n });\n searchScript.addEventListener(\"load\", function () {\n searchEl.classList.remove(\"loading\");\n searchEl.classList.add(\"ready\");\n });\n if (window.searchData) {\n searchEl.classList.remove(\"loading\");\n }\n }\n var field = document.querySelector(\"#tsd-search-field\");\n var results = document.querySelector(\".results\");\n if (!field || !results) {\n throw new Error(\"The input field or the result list wrapper was not found\");\n }\n var resultClicked = false;\n results.addEventListener(\"mousedown\", function () { return (resultClicked = true); });\n results.addEventListener(\"mouseup\", function () {\n resultClicked = false;\n searchEl.classList.remove(\"has-focus\");\n });\n field.addEventListener(\"focus\", function () { return searchEl.classList.add(\"has-focus\"); });\n field.addEventListener(\"blur\", function () {\n if (!resultClicked) {\n resultClicked = false;\n searchEl.classList.remove(\"has-focus\");\n }\n });\n var state = {\n base: searchEl.dataset.base + \"/\",\n };\n bindEvents(searchEl, results, field, state);\n}\nfunction bindEvents(searchEl, results, field, state) {\n field.addEventListener(\"input\", (0,_utils_debounce__WEBPACK_IMPORTED_MODULE_0__.debounce)(function () {\n updateResults(searchEl, results, field, state);\n }, 200));\n var preventPress = false;\n field.addEventListener(\"keydown\", function (e) {\n preventPress = true;\n if (e.key == \"Enter\") {\n gotoCurrentResult(results, field);\n }\n else if (e.key == \"Escape\") {\n field.blur();\n }\n else if (e.key == \"ArrowUp\") {\n setCurrentResult(results, -1);\n }\n else if (e.key === \"ArrowDown\") {\n setCurrentResult(results, 1);\n }\n else {\n preventPress = false;\n }\n });\n field.addEventListener(\"keypress\", function (e) {\n if (preventPress)\n e.preventDefault();\n });\n /**\n * Start searching by pressing slash.\n */\n document.body.addEventListener(\"keydown\", function (e) {\n if (e.altKey || e.ctrlKey || e.metaKey)\n return;\n if (!field.matches(\":focus\") && e.key === \"/\") {\n field.focus();\n e.preventDefault();\n }\n });\n}\nfunction checkIndex(state, searchEl) {\n if (state.index)\n return;\n if (window.searchData) {\n searchEl.classList.remove(\"loading\");\n searchEl.classList.add(\"ready\");\n state.data = window.searchData;\n state.index = lunr__WEBPACK_IMPORTED_MODULE_1__.Index.load(window.searchData.index);\n }\n}\nfunction updateResults(searchEl, results, query, state) {\n checkIndex(state, searchEl);\n // Don't clear results if loading state is not ready,\n // because loading or error message can be removed.\n if (!state.index || !state.data)\n return;\n results.textContent = \"\";\n var searchText = query.value.trim();\n // Perform a wildcard search\n var res = state.index.search(\"*\" + searchText + \"*\");\n for (var i = 0, c = Math.min(10, res.length); i < c; i++) {\n var row = state.data.rows[Number(res[i].ref)];\n // Bold the matched part of the query in the search results\n var name_1 = boldMatches(row.name, searchText);\n if (row.parent) {\n name_1 = \"\" + boldMatches(row.parent, searchText) + \".\" + name_1;\n }\n var item = document.createElement(\"li\");\n item.classList.value = row.classes;\n var anchor = document.createElement(\"a\");\n anchor.href = state.base + row.url;\n anchor.classList.add(\"tsd-kind-icon\");\n anchor.innerHTML = name_1;\n item.append(anchor);\n results.appendChild(item);\n }\n}\n/**\n * Move the highlight within the result set.\n */\nfunction setCurrentResult(results, dir) {\n var current = results.querySelector(\".current\");\n if (!current) {\n current = results.querySelector(dir == 1 ? \"li:first-child\" : \"li:last-child\");\n if (current) {\n current.classList.add(\"current\");\n }\n }\n else {\n var rel = dir == 1\n ? current.nextElementSibling\n : current.previousElementSibling;\n if (rel) {\n current.classList.remove(\"current\");\n rel.classList.add(\"current\");\n }\n }\n}\n/**\n * Navigate to the highlighted result.\n */\nfunction gotoCurrentResult(results, field) {\n var current = results.querySelector(\".current\");\n if (!current) {\n current = results.querySelector(\"li:first-child\");\n }\n if (current) {\n var link = current.querySelector(\"a\");\n if (link) {\n window.location.href = link.href;\n }\n field.blur();\n }\n}\nfunction boldMatches(text, search) {\n if (search === \"\") {\n return text;\n }\n var lowerText = text.toLocaleLowerCase();\n var lowerSearch = search.toLocaleLowerCase();\n var parts = [];\n var lastIndex = 0;\n var index = lowerText.indexOf(lowerSearch);\n while (index != -1) {\n parts.push(escapeHtml(text.substring(lastIndex, index)), \"\" + escapeHtml(text.substring(index, index + lowerSearch.length)) + \"\");\n lastIndex = index + lowerSearch.length;\n index = lowerText.indexOf(lowerSearch, lastIndex);\n }\n parts.push(escapeHtml(text.substring(lastIndex)));\n return parts.join(\"\");\n}\nvar SPECIAL_HTML = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n \"'\": \"'\",\n '\"': \""\",\n};\nfunction escapeHtml(text) {\n return text.replace(/[&<>\"'\"]/g, function (match) { return SPECIAL_HTML[match]; });\n}\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/components/Search.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/components/Signature.ts": -/*!***************************************************************!*\ - !*** ./default/assets/js/src/typedoc/components/Signature.ts ***! - \***************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Signature\": () => /* binding */ Signature\n/* harmony export */ });\n/* harmony import */ var _Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Component */ \"./default/assets/js/src/typedoc/Component.ts\");\n/* harmony import */ var _services_Viewport__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services/Viewport */ \"./default/assets/js/src/typedoc/services/Viewport.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * Holds a signature and its description.\n */\nvar SignatureGroup = /** @class */ (function () {\n /**\n * Create a new SignatureGroup instance.\n *\n * @param signature The target signature.\n * @param description The description for the signature.\n */\n function SignatureGroup(signature, description) {\n this.signature = signature;\n this.description = description;\n }\n /**\n * Add the given class to all elements of the group.\n *\n * @param className The class name to add.\n */\n SignatureGroup.prototype.addClass = function (className) {\n this.signature.classList.add(className);\n this.description.classList.add(className);\n return this;\n };\n /**\n * Remove the given class from all elements of the group.\n *\n * @param className The class name to remove.\n */\n SignatureGroup.prototype.removeClass = function (className) {\n this.signature.classList.remove(className);\n this.description.classList.remove(className);\n return this;\n };\n return SignatureGroup;\n}());\n/**\n * Controls the tab like behaviour of methods and functions with multiple signatures.\n */\nvar Signature = /** @class */ (function (_super) {\n __extends(Signature, _super);\n /**\n * Create a new Signature instance.\n *\n * @param options Backbone view constructor options.\n */\n function Signature(options) {\n var _this = _super.call(this, options) || this;\n /**\n * List of found signature groups.\n */\n _this.groups = [];\n /**\n * The index of the currently displayed signature.\n */\n _this.index = -1;\n _this.createGroups();\n if (_this.container) {\n _this.el.classList.add(\"active\");\n Array.from(_this.el.children).forEach(function (signature) {\n signature.addEventListener(\"touchstart\", function (event) {\n return _this.onClick(event);\n });\n signature.addEventListener(\"click\", function (event) {\n return _this.onClick(event);\n });\n });\n _this.container.classList.add(\"active\");\n _this.setIndex(0);\n }\n return _this;\n }\n /**\n * Set the index of the active signature.\n *\n * @param index The index of the signature to activate.\n */\n Signature.prototype.setIndex = function (index) {\n if (index < 0)\n index = 0;\n if (index > this.groups.length - 1)\n index = this.groups.length - 1;\n if (this.index == index)\n return;\n var to = this.groups[index];\n if (this.index > -1) {\n var from_1 = this.groups[this.index];\n from_1.removeClass(\"current\").addClass(\"fade-out\");\n to.addClass(\"current\");\n to.addClass(\"fade-in\");\n _services_Viewport__WEBPACK_IMPORTED_MODULE_1__.Viewport.instance.triggerResize();\n setTimeout(function () {\n from_1.removeClass(\"fade-out\");\n to.removeClass(\"fade-in\");\n }, 300);\n }\n else {\n to.addClass(\"current\");\n _services_Viewport__WEBPACK_IMPORTED_MODULE_1__.Viewport.instance.triggerResize();\n }\n this.index = index;\n };\n /**\n * Find all signature/description groups.\n */\n Signature.prototype.createGroups = function () {\n var signatures = this.el.children;\n if (signatures.length < 2)\n return;\n this.container = this.el.nextElementSibling;\n var descriptions = this.container.children;\n this.groups = [];\n for (var index = 0; index < signatures.length; index++) {\n this.groups.push(new SignatureGroup(signatures[index], descriptions[index]));\n }\n };\n /**\n * Triggered when the user clicks onto a signature header.\n *\n * @param e The related event object.\n */\n Signature.prototype.onClick = function (e) {\n var _this = this;\n this.groups.forEach(function (group, index) {\n if (group.signature === e.currentTarget) {\n _this.setIndex(index);\n }\n });\n };\n return Signature;\n}(_Component__WEBPACK_IMPORTED_MODULE_0__.Component));\n\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/components/Signature.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/components/Toggle.ts": -/*!************************************************************!*\ - !*** ./default/assets/js/src/typedoc/components/Toggle.ts ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Toggle\": () => /* binding */ Toggle\n/* harmony export */ });\n/* harmony import */ var _Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Component */ \"./default/assets/js/src/typedoc/Component.ts\");\n/* harmony import */ var _utils_pointer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/pointer */ \"./default/assets/js/src/typedoc/utils/pointer.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\nvar Toggle = /** @class */ (function (_super) {\n __extends(Toggle, _super);\n function Toggle(options) {\n var _this = _super.call(this, options) || this;\n _this.className = _this.el.dataset.toggle || \"\";\n _this.el.addEventListener(_utils_pointer__WEBPACK_IMPORTED_MODULE_1__.pointerUp, function (e) { return _this.onPointerUp(e); });\n _this.el.addEventListener(\"click\", function (e) { return e.preventDefault(); });\n document.addEventListener(_utils_pointer__WEBPACK_IMPORTED_MODULE_1__.pointerDown, function (e) {\n return _this.onDocumentPointerDown(e);\n });\n document.addEventListener(_utils_pointer__WEBPACK_IMPORTED_MODULE_1__.pointerUp, function (e) {\n return _this.onDocumentPointerUp(e);\n });\n return _this;\n }\n Toggle.prototype.setActive = function (value) {\n if (this.active == value)\n return;\n this.active = value;\n document.documentElement.classList.toggle(\"has-\" + this.className, value);\n this.el.classList.toggle(\"active\", value);\n var transition = (this.active ? \"to-has-\" : \"from-has-\") + this.className;\n document.documentElement.classList.add(transition);\n setTimeout(function () { return document.documentElement.classList.remove(transition); }, 500);\n };\n Toggle.prototype.onPointerUp = function (event) {\n if (_utils_pointer__WEBPACK_IMPORTED_MODULE_1__.hasPointerMoved)\n return;\n this.setActive(true);\n event.preventDefault();\n };\n Toggle.prototype.onDocumentPointerDown = function (e) {\n if (this.active) {\n if (e.target.closest(\".col-menu, .tsd-filter-group\")) {\n return;\n }\n this.setActive(false);\n }\n };\n Toggle.prototype.onDocumentPointerUp = function (e) {\n var _this = this;\n if (_utils_pointer__WEBPACK_IMPORTED_MODULE_1__.hasPointerMoved)\n return;\n if (this.active) {\n if (e.target.closest(\".col-menu\")) {\n var link = e.target.closest(\"a\");\n if (link) {\n var href = window.location.href;\n if (href.indexOf(\"#\") != -1) {\n href = href.substr(0, href.indexOf(\"#\"));\n }\n if (link.href.substr(0, href.length) == href) {\n setTimeout(function () { return _this.setActive(false); }, 250);\n }\n }\n }\n }\n };\n return Toggle;\n}(_Component__WEBPACK_IMPORTED_MODULE_0__.Component));\n\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/components/Toggle.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/services/Viewport.ts": -/*!************************************************************!*\ - !*** ./default/assets/js/src/typedoc/services/Viewport.ts ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Viewport\": () => /* binding */ Viewport\n/* harmony export */ });\n/* harmony import */ var _EventTarget__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../EventTarget */ \"./default/assets/js/src/typedoc/EventTarget.ts\");\n/* harmony import */ var _utils_trottle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/trottle */ \"./default/assets/js/src/typedoc/utils/trottle.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n/**\n * A global service that monitors the window size and scroll position.\n */\nvar Viewport = /** @class */ (function (_super) {\n __extends(Viewport, _super);\n /**\n * Create new Viewport instance.\n */\n function Viewport() {\n var _this = _super.call(this) || this;\n /**\n * The current scroll position.\n */\n _this.scrollTop = 0;\n /**\n * The previous scrollTop.\n */\n _this.lastY = 0;\n /**\n * The width of the window.\n */\n _this.width = 0;\n /**\n * The height of the window.\n */\n _this.height = 0;\n /**\n * Boolean indicating whether the toolbar is shown.\n */\n _this.showToolbar = true;\n _this.toolbar = (document.querySelector(\".tsd-page-toolbar\"));\n _this.secondaryNav = (document.querySelector(\".tsd-navigation.secondary\"));\n window.addEventListener(\"scroll\", (0,_utils_trottle__WEBPACK_IMPORTED_MODULE_1__.throttle)(function () { return _this.onScroll(); }, 10));\n window.addEventListener(\"resize\", (0,_utils_trottle__WEBPACK_IMPORTED_MODULE_1__.throttle)(function () { return _this.onResize(); }, 10));\n _this.onResize();\n _this.onScroll();\n return _this;\n }\n /**\n * Trigger a resize event.\n */\n Viewport.prototype.triggerResize = function () {\n var event = new CustomEvent(\"resize\", {\n detail: {\n width: this.width,\n height: this.height,\n },\n });\n this.dispatchEvent(event);\n };\n /**\n * Triggered when the size of the window has changed.\n */\n Viewport.prototype.onResize = function () {\n this.width = window.innerWidth || 0;\n this.height = window.innerHeight || 0;\n var event = new CustomEvent(\"resize\", {\n detail: {\n width: this.width,\n height: this.height,\n },\n });\n this.dispatchEvent(event);\n };\n /**\n * Triggered when the user scrolled the viewport.\n */\n Viewport.prototype.onScroll = function () {\n this.scrollTop = window.scrollY || 0;\n var event = new CustomEvent(\"scroll\", {\n detail: {\n scrollTop: this.scrollTop,\n },\n });\n this.dispatchEvent(event);\n this.hideShowToolbar();\n };\n /**\n * Handle hiding/showing of the toolbar.\n */\n Viewport.prototype.hideShowToolbar = function () {\n var isShown = this.showToolbar;\n this.showToolbar = this.lastY >= this.scrollTop || this.scrollTop <= 0;\n if (isShown !== this.showToolbar) {\n this.toolbar.classList.toggle(\"tsd-page-toolbar--hide\");\n this.secondaryNav.classList.toggle(\"tsd-navigation--toolbar-hide\");\n }\n this.lastY = this.scrollTop;\n };\n Viewport.instance = new Viewport();\n return Viewport;\n}(_EventTarget__WEBPACK_IMPORTED_MODULE_0__.EventTarget));\n\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/services/Viewport.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/utils/debounce.ts": -/*!*********************************************************!*\ - !*** ./default/assets/js/src/typedoc/utils/debounce.ts ***! - \*********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"debounce\": () => /* binding */ debounce\n/* harmony export */ });\nvar debounce = function (fn, wait) {\n if (wait === void 0) { wait = 100; }\n var timeout;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n clearTimeout(timeout);\n timeout = setTimeout(function () { return fn(args); }, wait);\n };\n};\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/utils/debounce.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/utils/pointer.ts": -/*!********************************************************!*\ - !*** ./default/assets/js/src/typedoc/utils/pointer.ts ***! - \********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"pointerDown\": () => /* binding */ pointerDown,\n/* harmony export */ \"pointerMove\": () => /* binding */ pointerMove,\n/* harmony export */ \"pointerUp\": () => /* binding */ pointerUp,\n/* harmony export */ \"pointerDownPosition\": () => /* binding */ pointerDownPosition,\n/* harmony export */ \"preventNextClick\": () => /* binding */ preventNextClick,\n/* harmony export */ \"isPointerDown\": () => /* binding */ isPointerDown,\n/* harmony export */ \"isPointerTouch\": () => /* binding */ isPointerTouch,\n/* harmony export */ \"hasPointerMoved\": () => /* binding */ hasPointerMoved,\n/* harmony export */ \"isMobile\": () => /* binding */ isMobile\n/* harmony export */ });\n/**\n * Event name of the pointer down event.\n */\nvar pointerDown = \"mousedown\";\n/**\n * Event name of the pointer move event.\n */\nvar pointerMove = \"mousemove\";\n/**\n * Event name of the pointer up event.\n */\nvar pointerUp = \"mouseup\";\n/**\n * Position the pointer was pressed at.\n */\nvar pointerDownPosition = { x: 0, y: 0 };\n/**\n * Should the next click on the document be supressed?\n */\nvar preventNextClick = false;\n/**\n * Is the pointer down?\n */\nvar isPointerDown = false;\n/**\n * Is the pointer a touch point?\n */\nvar isPointerTouch = false;\n/**\n * Did the pointer move since the last down event?\n */\nvar hasPointerMoved = false;\n/**\n * Is the user agent a mobile agent?\n */\nvar isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\ndocument.documentElement.classList.add(isMobile ? \"is-mobile\" : \"not-mobile\");\nif (isMobile && \"ontouchstart\" in document.documentElement) {\n isPointerTouch = true;\n pointerDown = \"touchstart\";\n pointerMove = \"touchmove\";\n pointerUp = \"touchend\";\n}\ndocument.addEventListener(pointerDown, function (e) {\n isPointerDown = true;\n hasPointerMoved = false;\n var t = pointerDown == \"touchstart\"\n ? e.targetTouches[0]\n : e;\n pointerDownPosition.y = t.pageY || 0;\n pointerDownPosition.x = t.pageX || 0;\n});\ndocument.addEventListener(pointerMove, function (e) {\n if (!isPointerDown)\n return;\n if (!hasPointerMoved) {\n var t = pointerDown == \"touchstart\"\n ? e.targetTouches[0]\n : e;\n var x = pointerDownPosition.x - (t.pageX || 0);\n var y = pointerDownPosition.y - (t.pageY || 0);\n hasPointerMoved = Math.sqrt(x * x + y * y) > 10;\n }\n});\ndocument.addEventListener(pointerUp, function () {\n isPointerDown = false;\n});\ndocument.addEventListener(\"click\", function (e) {\n if (preventNextClick) {\n e.preventDefault();\n e.stopImmediatePropagation();\n preventNextClick = false;\n }\n});\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/utils/pointer.ts?"); - -/***/ }), - -/***/ "./default/assets/js/src/typedoc/utils/trottle.ts": -/*!********************************************************!*\ - !*** ./default/assets/js/src/typedoc/utils/trottle.ts ***! - \********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"throttle\": () => /* binding */ throttle\n/* harmony export */ });\nvar throttle = function (fn, wait) {\n if (wait === void 0) { wait = 100; }\n var time = Date.now();\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (time + wait - Date.now() < 0) {\n fn.apply(void 0, args);\n time = Date.now();\n }\n };\n};\n\n\n//# sourceURL=webpack:///./default/assets/js/src/typedoc/utils/trottle.ts?"); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => module['default'] : -/******/ () => module; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -/******/ // startup -/******/ // Load entry module -/******/ __webpack_require__("./default/assets/js/src/bootstrap.ts"); -/******/ // This entry module used 'exports' so it can't be inlined -/******/ })() -; \ No newline at end of file diff --git a/assets/js/search.js b/assets/js/search.js deleted file mode 100644 index b5df01e1..00000000 --- a/assets/js/search.js +++ /dev/null @@ -1 +0,0 @@ -window.searchData = {"kinds":{"1":"Module","128":"Class","256":"Interface","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":1,"name":"DockLayout","url":"modules/docklayout.html","classes":"tsd-kind-module"},{"id":1,"kind":256,"name":"LayoutProps","url":"interfaces/docklayout.layoutprops.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockLayout"},{"id":2,"kind":1024,"name":"dockId","url":"interfaces/docklayout.layoutprops.html#dockid","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":3,"kind":1024,"name":"defaultLayout","url":"interfaces/docklayout.layoutprops.html#defaultlayout","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":4,"kind":1024,"name":"layout","url":"interfaces/docklayout.layoutprops.html#layout","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":5,"kind":1024,"name":"groups","url":"interfaces/docklayout.layoutprops.html#groups","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":6,"kind":65536,"name":"__type","url":"interfaces/docklayout.layoutprops.html#__type","classes":"tsd-kind-type-literal tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":7,"kind":2048,"name":"onLayoutChange","url":"interfaces/docklayout.layoutprops.html#onlayoutchange","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":8,"kind":1024,"name":"dropMode","url":"interfaces/docklayout.layoutprops.html#dropmode","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":9,"kind":2048,"name":"saveTab","url":"interfaces/docklayout.layoutprops.html#savetab","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":10,"kind":2048,"name":"loadTab","url":"interfaces/docklayout.layoutprops.html#loadtab","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":11,"kind":2048,"name":"afterPanelSaved","url":"interfaces/docklayout.layoutprops.html#afterpanelsaved","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":12,"kind":2048,"name":"afterPanelLoaded","url":"interfaces/docklayout.layoutprops.html#afterpanelloaded","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":13,"kind":1024,"name":"style","url":"interfaces/docklayout.layoutprops.html#style","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":14,"kind":1024,"name":"maximizeTo","url":"interfaces/docklayout.layoutprops.html#maximizeto","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockLayout.LayoutProps"},{"id":15,"kind":128,"name":"DockLayout","url":"classes/docklayout.docklayout-1.html","classes":"tsd-kind-class tsd-parent-kind-module","parent":"DockLayout"},{"id":16,"kind":2048,"name":"getDerivedStateFromProps","url":"classes/docklayout.docklayout-1.html#getderivedstatefromprops","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"DockLayout.DockLayout"},{"id":17,"kind":512,"name":"constructor","url":"classes/docklayout.docklayout-1.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite","parent":"DockLayout.DockLayout"},{"id":18,"kind":2048,"name":"getGroup","url":"classes/docklayout.docklayout-1.html#getgroup","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":19,"kind":2048,"name":"dockMove","url":"classes/docklayout.docklayout-1.html#dockmove","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":20,"kind":2048,"name":"find","url":"classes/docklayout.docklayout-1.html#find","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":21,"kind":2048,"name":"updateTab","url":"classes/docklayout.docklayout-1.html#updatetab","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":22,"kind":2048,"name":"navigateToPanel","url":"classes/docklayout.docklayout-1.html#navigatetopanel","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":23,"kind":1024,"name":"_onWindowResize","url":"classes/docklayout.docklayout-1.html#_onwindowresize","classes":"tsd-kind-property tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":24,"kind":2048,"name":"setLayout","url":"classes/docklayout.docklayout-1.html#setlayout","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":25,"kind":2048,"name":"getLayout","url":"classes/docklayout.docklayout-1.html#getlayout","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":26,"kind":2048,"name":"saveLayout","url":"classes/docklayout.docklayout-1.html#savelayout","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":27,"kind":2048,"name":"loadLayout","url":"classes/docklayout.docklayout-1.html#loadlayout","classes":"tsd-kind-method tsd-parent-kind-class","parent":"DockLayout.DockLayout"},{"id":28,"kind":1024,"name":"_pendingDestroy","url":"classes/docklayout.docklayout-1.html#_pendingdestroy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited","parent":"DockLayout.DockLayout"},{"id":29,"kind":1024,"name":"_isMounted","url":"classes/docklayout.docklayout-1.html#_ismounted","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-inherited","parent":"DockLayout.DockLayout"},{"id":30,"kind":2048,"name":"destroyRemovedPane","url":"classes/docklayout.docklayout-1.html#destroyremovedpane","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-inherited","parent":"DockLayout.DockLayout"},{"id":31,"kind":1,"name":"DockData","url":"modules/dockdata.html","classes":"tsd-kind-module"},{"id":32,"kind":256,"name":"TabGroup","url":"interfaces/dockdata.tabgroup.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":33,"kind":1024,"name":"floatable","url":"interfaces/dockdata.tabgroup.html#floatable","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":34,"kind":1024,"name":"newWindow","url":"interfaces/dockdata.tabgroup.html#newwindow","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":35,"kind":1024,"name":"disableDock","url":"interfaces/dockdata.tabgroup.html#disabledock","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":36,"kind":1024,"name":"maximizable","url":"interfaces/dockdata.tabgroup.html#maximizable","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":37,"kind":1024,"name":"tabLocked","url":"interfaces/dockdata.tabgroup.html#tablocked","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":38,"kind":1024,"name":"animated","url":"interfaces/dockdata.tabgroup.html#animated","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":39,"kind":1024,"name":"panelExtra","url":"interfaces/dockdata.tabgroup.html#panelextra","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":40,"kind":65536,"name":"__type","url":"interfaces/dockdata.tabgroup.html#__type","classes":"tsd-kind-type-literal tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":41,"kind":1024,"name":"preferredFloatWidth","url":"interfaces/dockdata.tabgroup.html#preferredfloatwidth","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":42,"kind":1024,"name":"preferredFloatHeight","url":"interfaces/dockdata.tabgroup.html#preferredfloatheight","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":43,"kind":1024,"name":"widthFlex","url":"interfaces/dockdata.tabgroup.html#widthflex","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":44,"kind":1024,"name":"heightFlex","url":"interfaces/dockdata.tabgroup.html#heightflex","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":45,"kind":1024,"name":"moreIcon","url":"interfaces/dockdata.tabgroup.html#moreicon","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabGroup"},{"id":46,"kind":4194304,"name":"DockMode","url":"modules/dockdata.html#dockmode","classes":"tsd-kind-type-alias tsd-parent-kind-module","parent":"DockData"},{"id":47,"kind":256,"name":"TabBase","url":"interfaces/dockdata.tabbase.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":48,"kind":1024,"name":"id","url":"interfaces/dockdata.tabbase.html#id","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabBase"},{"id":49,"kind":256,"name":"PanelBase","url":"interfaces/dockdata.panelbase.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":50,"kind":1024,"name":"id","url":"interfaces/dockdata.panelbase.html#id","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":51,"kind":1024,"name":"size","url":"interfaces/dockdata.panelbase.html#size","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":52,"kind":1024,"name":"tabs","url":"interfaces/dockdata.panelbase.html#tabs","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":53,"kind":1024,"name":"activeId","url":"interfaces/dockdata.panelbase.html#activeid","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":54,"kind":1024,"name":"group","url":"interfaces/dockdata.panelbase.html#group","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":55,"kind":1024,"name":"x","url":"interfaces/dockdata.panelbase.html#x","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":56,"kind":1024,"name":"y","url":"interfaces/dockdata.panelbase.html#y","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":57,"kind":1024,"name":"z","url":"interfaces/dockdata.panelbase.html#z","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":58,"kind":1024,"name":"w","url":"interfaces/dockdata.panelbase.html#w","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":59,"kind":1024,"name":"h","url":"interfaces/dockdata.panelbase.html#h","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelBase"},{"id":60,"kind":256,"name":"BoxBase","url":"interfaces/dockdata.boxbase.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":61,"kind":1024,"name":"id","url":"interfaces/dockdata.boxbase.html#id","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.BoxBase"},{"id":62,"kind":1024,"name":"mode","url":"interfaces/dockdata.boxbase.html#mode","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.BoxBase"},{"id":63,"kind":1024,"name":"size","url":"interfaces/dockdata.boxbase.html#size","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.BoxBase"},{"id":64,"kind":1024,"name":"children","url":"interfaces/dockdata.boxbase.html#children","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.BoxBase"},{"id":65,"kind":256,"name":"LayoutBase","url":"interfaces/dockdata.layoutbase.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":66,"kind":1024,"name":"dockbox","url":"interfaces/dockdata.layoutbase.html#dockbox","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.LayoutBase"},{"id":67,"kind":1024,"name":"floatbox","url":"interfaces/dockdata.layoutbase.html#floatbox","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.LayoutBase"},{"id":68,"kind":1024,"name":"windowbox","url":"interfaces/dockdata.layoutbase.html#windowbox","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.LayoutBase"},{"id":69,"kind":1024,"name":"maxbox","url":"interfaces/dockdata.layoutbase.html#maxbox","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.LayoutBase"},{"id":70,"kind":256,"name":"BoxData","url":"interfaces/dockdata.boxdata.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":71,"kind":1024,"name":"mode","url":"interfaces/dockdata.boxdata.html#mode","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite","parent":"DockData.BoxData"},{"id":72,"kind":1024,"name":"children","url":"interfaces/dockdata.boxdata.html#children","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite","parent":"DockData.BoxData"},{"id":73,"kind":1024,"name":"id","url":"interfaces/dockdata.boxdata.html#id","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.BoxData"},{"id":74,"kind":1024,"name":"size","url":"interfaces/dockdata.boxdata.html#size","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.BoxData"},{"id":75,"kind":1024,"name":"parent","url":"interfaces/dockdata.boxdata.html#parent","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.BoxData"},{"id":76,"kind":1024,"name":"widthFlex","url":"interfaces/dockdata.boxdata.html#widthflex","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.BoxData"},{"id":77,"kind":1024,"name":"heightFlex","url":"interfaces/dockdata.boxdata.html#heightflex","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.BoxData"},{"id":78,"kind":1024,"name":"minWidth","url":"interfaces/dockdata.boxdata.html#minwidth","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.BoxData"},{"id":79,"kind":1024,"name":"minHeight","url":"interfaces/dockdata.boxdata.html#minheight","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.BoxData"},{"id":80,"kind":256,"name":"TabData","url":"interfaces/dockdata.tabdata.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":81,"kind":1024,"name":"group","url":"interfaces/dockdata.tabdata.html#group","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabData"},{"id":82,"kind":1024,"name":"title","url":"interfaces/dockdata.tabdata.html#title","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabData"},{"id":83,"kind":1024,"name":"content","url":"interfaces/dockdata.tabdata.html#content","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabData"},{"id":84,"kind":1024,"name":"closable","url":"interfaces/dockdata.tabdata.html#closable","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabData"},{"id":85,"kind":1024,"name":"cached","url":"interfaces/dockdata.tabdata.html#cached","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabData"},{"id":86,"kind":1024,"name":"cacheContext","url":"interfaces/dockdata.tabdata.html#cachecontext","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabData"},{"id":87,"kind":1024,"name":"id","url":"interfaces/dockdata.tabdata.html#id","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.TabData"},{"id":88,"kind":1024,"name":"minWidth","url":"interfaces/dockdata.tabdata.html#minwidth","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.TabData"},{"id":89,"kind":1024,"name":"minHeight","url":"interfaces/dockdata.tabdata.html#minheight","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.TabData"},{"id":90,"kind":256,"name":"PanelData","url":"interfaces/dockdata.paneldata.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":91,"kind":1024,"name":"parent","url":"interfaces/dockdata.paneldata.html#parent","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite","parent":"DockData.PanelData"},{"id":92,"kind":1024,"name":"tabs","url":"interfaces/dockdata.paneldata.html#tabs","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite","parent":"DockData.PanelData"},{"id":93,"kind":1024,"name":"panelLock","url":"interfaces/dockdata.paneldata.html#panellock","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.PanelData"},{"id":94,"kind":1024,"name":"id","url":"interfaces/dockdata.paneldata.html#id","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":95,"kind":1024,"name":"size","url":"interfaces/dockdata.paneldata.html#size","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":96,"kind":1024,"name":"activeId","url":"interfaces/dockdata.paneldata.html#activeid","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":97,"kind":1024,"name":"group","url":"interfaces/dockdata.paneldata.html#group","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":98,"kind":1024,"name":"x","url":"interfaces/dockdata.paneldata.html#x","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":99,"kind":1024,"name":"y","url":"interfaces/dockdata.paneldata.html#y","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":100,"kind":1024,"name":"z","url":"interfaces/dockdata.paneldata.html#z","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":101,"kind":1024,"name":"w","url":"interfaces/dockdata.paneldata.html#w","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":102,"kind":1024,"name":"h","url":"interfaces/dockdata.paneldata.html#h","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":103,"kind":1024,"name":"widthFlex","url":"interfaces/dockdata.paneldata.html#widthflex","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":104,"kind":1024,"name":"heightFlex","url":"interfaces/dockdata.paneldata.html#heightflex","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":105,"kind":1024,"name":"minWidth","url":"interfaces/dockdata.paneldata.html#minwidth","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":106,"kind":1024,"name":"minHeight","url":"interfaces/dockdata.paneldata.html#minheight","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.PanelData"},{"id":107,"kind":256,"name":"TabPaneCache","url":"interfaces/dockdata.tabpanecache.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":108,"kind":1024,"name":"id","url":"interfaces/dockdata.tabpanecache.html#id","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabPaneCache"},{"id":109,"kind":1024,"name":"div","url":"interfaces/dockdata.tabpanecache.html#div","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabPaneCache"},{"id":110,"kind":1024,"name":"owner","url":"interfaces/dockdata.tabpanecache.html#owner","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabPaneCache"},{"id":111,"kind":1024,"name":"portal","url":"interfaces/dockdata.tabpanecache.html#portal","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.TabPaneCache"},{"id":112,"kind":256,"name":"LayoutData","url":"interfaces/dockdata.layoutdata.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":113,"kind":1024,"name":"dockbox","url":"interfaces/dockdata.layoutdata.html#dockbox","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite","parent":"DockData.LayoutData"},{"id":114,"kind":1024,"name":"floatbox","url":"interfaces/dockdata.layoutdata.html#floatbox","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite","parent":"DockData.LayoutData"},{"id":115,"kind":1024,"name":"windowbox","url":"interfaces/dockdata.layoutdata.html#windowbox","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite","parent":"DockData.LayoutData"},{"id":116,"kind":1024,"name":"maxbox","url":"interfaces/dockdata.layoutdata.html#maxbox","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite","parent":"DockData.LayoutData"},{"id":117,"kind":4194304,"name":"DropDirection","url":"modules/dockdata.html#dropdirection","classes":"tsd-kind-type-alias tsd-parent-kind-module","parent":"DockData"},{"id":118,"kind":256,"name":"FloatSize","url":"interfaces/dockdata.floatsize.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":119,"kind":1024,"name":"width","url":"interfaces/dockdata.floatsize.html#width","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.FloatSize"},{"id":120,"kind":1024,"name":"height","url":"interfaces/dockdata.floatsize.html#height","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.FloatSize"},{"id":121,"kind":256,"name":"FloatPosition","url":"interfaces/dockdata.floatposition.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":122,"kind":1024,"name":"left","url":"interfaces/dockdata.floatposition.html#left","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.FloatPosition"},{"id":123,"kind":1024,"name":"top","url":"interfaces/dockdata.floatposition.html#top","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"DockData.FloatPosition"},{"id":124,"kind":1024,"name":"width","url":"interfaces/dockdata.floatposition.html#width","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.FloatPosition"},{"id":125,"kind":1024,"name":"height","url":"interfaces/dockdata.floatposition.html#height","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited","parent":"DockData.FloatPosition"},{"id":126,"kind":4194304,"name":"LayoutSize","url":"modules/dockdata.html#layoutsize","classes":"tsd-kind-type-alias tsd-parent-kind-module","parent":"DockData"},{"id":127,"kind":256,"name":"DockContext","url":"interfaces/dockdata.dockcontext.html","classes":"tsd-kind-interface tsd-parent-kind-module","parent":"DockData"},{"id":128,"kind":2048,"name":"dockMove","url":"interfaces/dockdata.dockcontext.html#dockmove","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockData.DockContext"},{"id":129,"kind":2048,"name":"getGroup","url":"interfaces/dockdata.dockcontext.html#getgroup","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockData.DockContext"},{"id":130,"kind":2048,"name":"find","url":"interfaces/dockdata.dockcontext.html#find","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockData.DockContext"},{"id":131,"kind":2048,"name":"updateTab","url":"interfaces/dockdata.dockcontext.html#updatetab","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockData.DockContext"},{"id":132,"kind":2048,"name":"navigateToPanel","url":"interfaces/dockdata.dockcontext.html#navigatetopanel","classes":"tsd-kind-method tsd-parent-kind-interface","parent":"DockData.DockContext"}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,33.938]],["parent/0",[]],["name/1",[1,44.924]],["parent/1",[0,3.373]],["name/2",[2,44.924]],["parent/2",[3,2.281]],["name/3",[4,44.924]],["parent/3",[3,2.281]],["name/4",[5,44.924]],["parent/4",[3,2.281]],["name/5",[6,44.924]],["parent/5",[3,2.281]],["name/6",[7,39.815]],["parent/6",[3,2.281]],["name/7",[8,44.924]],["parent/7",[3,2.281]],["name/8",[9,44.924]],["parent/8",[3,2.281]],["name/9",[10,44.924]],["parent/9",[3,2.281]],["name/10",[11,44.924]],["parent/10",[3,2.281]],["name/11",[12,44.924]],["parent/11",[3,2.281]],["name/12",[13,44.924]],["parent/12",[3,2.281]],["name/13",[14,44.924]],["parent/13",[3,2.281]],["name/14",[15,44.924]],["parent/14",[3,2.281]],["name/15",[0,33.938]],["parent/15",[0,3.373]],["name/16",[16,44.924]],["parent/16",[17,2.144]],["name/17",[18,44.924]],["parent/17",[17,2.144]],["name/18",[19,39.815]],["parent/18",[17,2.144]],["name/19",[20,39.815]],["parent/19",[17,2.144]],["name/20",[21,39.815]],["parent/20",[17,2.144]],["name/21",[22,39.815]],["parent/21",[17,2.144]],["name/22",[23,39.815]],["parent/22",[17,2.144]],["name/23",[24,44.924]],["parent/23",[17,2.144]],["name/24",[25,44.924]],["parent/24",[17,2.144]],["name/25",[26,44.924]],["parent/25",[17,2.144]],["name/26",[27,44.924]],["parent/26",[17,2.144]],["name/27",[28,44.924]],["parent/27",[17,2.144]],["name/28",[29,44.924]],["parent/28",[17,2.144]],["name/29",[30,44.924]],["parent/29",[17,2.144]],["name/30",[31,44.924]],["parent/30",[17,2.144]],["name/31",[32,20.356]],["parent/31",[]],["name/32",[33,44.924]],["parent/32",[32,2.023]],["name/33",[34,44.924]],["parent/33",[35,2.281]],["name/34",[36,44.924]],["parent/34",[35,2.281]],["name/35",[37,44.924]],["parent/35",[35,2.281]],["name/36",[38,44.924]],["parent/36",[35,2.281]],["name/37",[39,44.924]],["parent/37",[35,2.281]],["name/38",[40,44.924]],["parent/38",[35,2.281]],["name/39",[41,44.924]],["parent/39",[35,2.281]],["name/40",[7,39.815]],["parent/40",[35,2.281]],["name/41",[42,44.924]],["parent/41",[35,2.281]],["name/42",[43,44.924]],["parent/42",[35,2.281]],["name/43",[44,36.451]],["parent/43",[35,2.281]],["name/44",[45,36.451]],["parent/44",[35,2.281]],["name/45",[46,44.924]],["parent/45",[35,2.281]],["name/46",[47,44.924]],["parent/46",[32,2.023]],["name/47",[48,44.924]],["parent/47",[32,2.023]],["name/48",[49,28.829]],["parent/48",[50,4.464]],["name/49",[51,44.924]],["parent/49",[32,2.023]],["name/50",[49,28.829]],["parent/50",[52,2.531]],["name/51",[53,33.938]],["parent/51",[52,2.531]],["name/52",[54,39.815]],["parent/52",[52,2.531]],["name/53",[55,39.815]],["parent/53",[52,2.531]],["name/54",[56,36.451]],["parent/54",[52,2.531]],["name/55",[57,39.815]],["parent/55",[52,2.531]],["name/56",[58,39.815]],["parent/56",[52,2.531]],["name/57",[59,39.815]],["parent/57",[52,2.531]],["name/58",[60,39.815]],["parent/58",[52,2.531]],["name/59",[61,39.815]],["parent/59",[52,2.531]],["name/60",[62,44.924]],["parent/60",[32,2.023]],["name/61",[49,28.829]],["parent/61",[63,3.373]],["name/62",[64,39.815]],["parent/62",[63,3.373]],["name/63",[53,33.938]],["parent/63",[63,3.373]],["name/64",[65,39.815]],["parent/64",[63,3.373]],["name/65",[66,44.924]],["parent/65",[32,2.023]],["name/66",[67,39.815]],["parent/66",[68,3.373]],["name/67",[69,39.815]],["parent/67",[68,3.373]],["name/68",[70,39.815]],["parent/68",[68,3.373]],["name/69",[71,39.815]],["parent/69",[68,3.373]],["name/70",[72,44.924]],["parent/70",[32,2.023]],["name/71",[64,39.815]],["parent/71",[73,2.63]],["name/72",[65,39.815]],["parent/72",[73,2.63]],["name/73",[49,28.829]],["parent/73",[73,2.63]],["name/74",[53,33.938]],["parent/74",[73,2.63]],["name/75",[74,39.815]],["parent/75",[73,2.63]],["name/76",[44,36.451]],["parent/76",[73,2.63]],["name/77",[45,36.451]],["parent/77",[73,2.63]],["name/78",[75,36.451]],["parent/78",[73,2.63]],["name/79",[76,36.451]],["parent/79",[73,2.63]],["name/80",[77,44.924]],["parent/80",[32,2.023]],["name/81",[56,36.451]],["parent/81",[78,2.63]],["name/82",[79,44.924]],["parent/82",[78,2.63]],["name/83",[80,44.924]],["parent/83",[78,2.63]],["name/84",[81,44.924]],["parent/84",[78,2.63]],["name/85",[82,44.924]],["parent/85",[78,2.63]],["name/86",[83,44.924]],["parent/86",[78,2.63]],["name/87",[49,28.829]],["parent/87",[78,2.63]],["name/88",[75,36.451]],["parent/88",[78,2.63]],["name/89",[76,36.451]],["parent/89",[78,2.63]],["name/90",[84,44.924]],["parent/90",[32,2.023]],["name/91",[74,39.815]],["parent/91",[85,2.081]],["name/92",[54,39.815]],["parent/92",[85,2.081]],["name/93",[86,44.924]],["parent/93",[85,2.081]],["name/94",[49,28.829]],["parent/94",[85,2.081]],["name/95",[53,33.938]],["parent/95",[85,2.081]],["name/96",[55,39.815]],["parent/96",[85,2.081]],["name/97",[56,36.451]],["parent/97",[85,2.081]],["name/98",[57,39.815]],["parent/98",[85,2.081]],["name/99",[58,39.815]],["parent/99",[85,2.081]],["name/100",[59,39.815]],["parent/100",[85,2.081]],["name/101",[60,39.815]],["parent/101",[85,2.081]],["name/102",[61,39.815]],["parent/102",[85,2.081]],["name/103",[44,36.451]],["parent/103",[85,2.081]],["name/104",[45,36.451]],["parent/104",[85,2.081]],["name/105",[75,36.451]],["parent/105",[85,2.081]],["name/106",[76,36.451]],["parent/106",[85,2.081]],["name/107",[87,44.924]],["parent/107",[32,2.023]],["name/108",[49,28.829]],["parent/108",[88,3.373]],["name/109",[89,44.924]],["parent/109",[88,3.373]],["name/110",[90,44.924]],["parent/110",[88,3.373]],["name/111",[91,44.924]],["parent/111",[88,3.373]],["name/112",[92,44.924]],["parent/112",[32,2.023]],["name/113",[67,39.815]],["parent/113",[93,3.373]],["name/114",[69,39.815]],["parent/114",[93,3.373]],["name/115",[70,39.815]],["parent/115",[93,3.373]],["name/116",[71,39.815]],["parent/116",[93,3.373]],["name/117",[94,44.924]],["parent/117",[32,2.023]],["name/118",[95,44.924]],["parent/118",[32,2.023]],["name/119",[96,39.815]],["parent/119",[97,3.957]],["name/120",[98,39.815]],["parent/120",[97,3.957]],["name/121",[99,44.924]],["parent/121",[32,2.023]],["name/122",[100,44.924]],["parent/122",[101,3.373]],["name/123",[102,44.924]],["parent/123",[101,3.373]],["name/124",[96,39.815]],["parent/124",[101,3.373]],["name/125",[98,39.815]],["parent/125",[101,3.373]],["name/126",[103,44.924]],["parent/126",[32,2.023]],["name/127",[104,44.924]],["parent/127",[32,2.023]],["name/128",[20,39.815]],["parent/128",[105,3.173]],["name/129",[19,39.815]],["parent/129",[105,3.173]],["name/130",[21,39.815]],["parent/130",[105,3.173]],["name/131",[22,39.815]],["parent/131",[105,3.173]],["name/132",[23,39.815]],["parent/132",[105,3.173]]],"invertedIndex":[["__type",{"_index":7,"name":{"6":{},"40":{}},"parent":{}}],["_ismounted",{"_index":30,"name":{"29":{}},"parent":{}}],["_onwindowresize",{"_index":24,"name":{"23":{}},"parent":{}}],["_pendingdestroy",{"_index":29,"name":{"28":{}},"parent":{}}],["activeid",{"_index":55,"name":{"53":{},"96":{}},"parent":{}}],["afterpanelloaded",{"_index":13,"name":{"12":{}},"parent":{}}],["afterpanelsaved",{"_index":12,"name":{"11":{}},"parent":{}}],["animated",{"_index":40,"name":{"38":{}},"parent":{}}],["boxbase",{"_index":62,"name":{"60":{}},"parent":{}}],["boxdata",{"_index":72,"name":{"70":{}},"parent":{}}],["cachecontext",{"_index":83,"name":{"86":{}},"parent":{}}],["cached",{"_index":82,"name":{"85":{}},"parent":{}}],["children",{"_index":65,"name":{"64":{},"72":{}},"parent":{}}],["closable",{"_index":81,"name":{"84":{}},"parent":{}}],["constructor",{"_index":18,"name":{"17":{}},"parent":{}}],["content",{"_index":80,"name":{"83":{}},"parent":{}}],["defaultlayout",{"_index":4,"name":{"3":{}},"parent":{}}],["destroyremovedpane",{"_index":31,"name":{"30":{}},"parent":{}}],["disabledock",{"_index":37,"name":{"35":{}},"parent":{}}],["div",{"_index":89,"name":{"109":{}},"parent":{}}],["dockbox",{"_index":67,"name":{"66":{},"113":{}},"parent":{}}],["dockcontext",{"_index":104,"name":{"127":{}},"parent":{}}],["dockdata",{"_index":32,"name":{"31":{}},"parent":{"32":{},"46":{},"47":{},"49":{},"60":{},"65":{},"70":{},"80":{},"90":{},"107":{},"112":{},"117":{},"118":{},"121":{},"126":{},"127":{}}}],["dockdata.boxbase",{"_index":63,"name":{},"parent":{"61":{},"62":{},"63":{},"64":{}}}],["dockdata.boxdata",{"_index":73,"name":{},"parent":{"71":{},"72":{},"73":{},"74":{},"75":{},"76":{},"77":{},"78":{},"79":{}}}],["dockdata.dockcontext",{"_index":105,"name":{},"parent":{"128":{},"129":{},"130":{},"131":{},"132":{}}}],["dockdata.floatposition",{"_index":101,"name":{},"parent":{"122":{},"123":{},"124":{},"125":{}}}],["dockdata.floatsize",{"_index":97,"name":{},"parent":{"119":{},"120":{}}}],["dockdata.layoutbase",{"_index":68,"name":{},"parent":{"66":{},"67":{},"68":{},"69":{}}}],["dockdata.layoutdata",{"_index":93,"name":{},"parent":{"113":{},"114":{},"115":{},"116":{}}}],["dockdata.panelbase",{"_index":52,"name":{},"parent":{"50":{},"51":{},"52":{},"53":{},"54":{},"55":{},"56":{},"57":{},"58":{},"59":{}}}],["dockdata.paneldata",{"_index":85,"name":{},"parent":{"91":{},"92":{},"93":{},"94":{},"95":{},"96":{},"97":{},"98":{},"99":{},"100":{},"101":{},"102":{},"103":{},"104":{},"105":{},"106":{}}}],["dockdata.tabbase",{"_index":50,"name":{},"parent":{"48":{}}}],["dockdata.tabdata",{"_index":78,"name":{},"parent":{"81":{},"82":{},"83":{},"84":{},"85":{},"86":{},"87":{},"88":{},"89":{}}}],["dockdata.tabgroup",{"_index":35,"name":{},"parent":{"33":{},"34":{},"35":{},"36":{},"37":{},"38":{},"39":{},"40":{},"41":{},"42":{},"43":{},"44":{},"45":{}}}],["dockdata.tabpanecache",{"_index":88,"name":{},"parent":{"108":{},"109":{},"110":{},"111":{}}}],["dockid",{"_index":2,"name":{"2":{}},"parent":{}}],["docklayout",{"_index":0,"name":{"0":{},"15":{}},"parent":{"1":{},"15":{}}}],["docklayout.docklayout",{"_index":17,"name":{},"parent":{"16":{},"17":{},"18":{},"19":{},"20":{},"21":{},"22":{},"23":{},"24":{},"25":{},"26":{},"27":{},"28":{},"29":{},"30":{}}}],["docklayout.layoutprops",{"_index":3,"name":{},"parent":{"2":{},"3":{},"4":{},"5":{},"6":{},"7":{},"8":{},"9":{},"10":{},"11":{},"12":{},"13":{},"14":{}}}],["dockmode",{"_index":47,"name":{"46":{}},"parent":{}}],["dockmove",{"_index":20,"name":{"19":{},"128":{}},"parent":{}}],["dropdirection",{"_index":94,"name":{"117":{}},"parent":{}}],["dropmode",{"_index":9,"name":{"8":{}},"parent":{}}],["find",{"_index":21,"name":{"20":{},"130":{}},"parent":{}}],["floatable",{"_index":34,"name":{"33":{}},"parent":{}}],["floatbox",{"_index":69,"name":{"67":{},"114":{}},"parent":{}}],["floatposition",{"_index":99,"name":{"121":{}},"parent":{}}],["floatsize",{"_index":95,"name":{"118":{}},"parent":{}}],["getderivedstatefromprops",{"_index":16,"name":{"16":{}},"parent":{}}],["getgroup",{"_index":19,"name":{"18":{},"129":{}},"parent":{}}],["getlayout",{"_index":26,"name":{"25":{}},"parent":{}}],["group",{"_index":56,"name":{"54":{},"81":{},"97":{}},"parent":{}}],["groups",{"_index":6,"name":{"5":{}},"parent":{}}],["h",{"_index":61,"name":{"59":{},"102":{}},"parent":{}}],["height",{"_index":98,"name":{"120":{},"125":{}},"parent":{}}],["heightflex",{"_index":45,"name":{"44":{},"77":{},"104":{}},"parent":{}}],["id",{"_index":49,"name":{"48":{},"50":{},"61":{},"73":{},"87":{},"94":{},"108":{}},"parent":{}}],["layout",{"_index":5,"name":{"4":{}},"parent":{}}],["layoutbase",{"_index":66,"name":{"65":{}},"parent":{}}],["layoutdata",{"_index":92,"name":{"112":{}},"parent":{}}],["layoutprops",{"_index":1,"name":{"1":{}},"parent":{}}],["layoutsize",{"_index":103,"name":{"126":{}},"parent":{}}],["left",{"_index":100,"name":{"122":{}},"parent":{}}],["loadlayout",{"_index":28,"name":{"27":{}},"parent":{}}],["loadtab",{"_index":11,"name":{"10":{}},"parent":{}}],["maxbox",{"_index":71,"name":{"69":{},"116":{}},"parent":{}}],["maximizable",{"_index":38,"name":{"36":{}},"parent":{}}],["maximizeto",{"_index":15,"name":{"14":{}},"parent":{}}],["minheight",{"_index":76,"name":{"79":{},"89":{},"106":{}},"parent":{}}],["minwidth",{"_index":75,"name":{"78":{},"88":{},"105":{}},"parent":{}}],["mode",{"_index":64,"name":{"62":{},"71":{}},"parent":{}}],["moreicon",{"_index":46,"name":{"45":{}},"parent":{}}],["navigatetopanel",{"_index":23,"name":{"22":{},"132":{}},"parent":{}}],["newwindow",{"_index":36,"name":{"34":{}},"parent":{}}],["onlayoutchange",{"_index":8,"name":{"7":{}},"parent":{}}],["owner",{"_index":90,"name":{"110":{}},"parent":{}}],["panelbase",{"_index":51,"name":{"49":{}},"parent":{}}],["paneldata",{"_index":84,"name":{"90":{}},"parent":{}}],["panelextra",{"_index":41,"name":{"39":{}},"parent":{}}],["panellock",{"_index":86,"name":{"93":{}},"parent":{}}],["parent",{"_index":74,"name":{"75":{},"91":{}},"parent":{}}],["portal",{"_index":91,"name":{"111":{}},"parent":{}}],["preferredfloatheight",{"_index":43,"name":{"42":{}},"parent":{}}],["preferredfloatwidth",{"_index":42,"name":{"41":{}},"parent":{}}],["savelayout",{"_index":27,"name":{"26":{}},"parent":{}}],["savetab",{"_index":10,"name":{"9":{}},"parent":{}}],["setlayout",{"_index":25,"name":{"24":{}},"parent":{}}],["size",{"_index":53,"name":{"51":{},"63":{},"74":{},"95":{}},"parent":{}}],["style",{"_index":14,"name":{"13":{}},"parent":{}}],["tabbase",{"_index":48,"name":{"47":{}},"parent":{}}],["tabdata",{"_index":77,"name":{"80":{}},"parent":{}}],["tabgroup",{"_index":33,"name":{"32":{}},"parent":{}}],["tablocked",{"_index":39,"name":{"37":{}},"parent":{}}],["tabpanecache",{"_index":87,"name":{"107":{}},"parent":{}}],["tabs",{"_index":54,"name":{"52":{},"92":{}},"parent":{}}],["title",{"_index":79,"name":{"82":{}},"parent":{}}],["top",{"_index":102,"name":{"123":{}},"parent":{}}],["updatetab",{"_index":22,"name":{"21":{},"131":{}},"parent":{}}],["w",{"_index":60,"name":{"58":{},"101":{}},"parent":{}}],["width",{"_index":96,"name":{"119":{},"124":{}},"parent":{}}],["widthflex",{"_index":44,"name":{"43":{},"76":{},"103":{}},"parent":{}}],["windowbox",{"_index":70,"name":{"68":{},"115":{}},"parent":{}}],["x",{"_index":57,"name":{"55":{},"98":{}},"parent":{}}],["y",{"_index":58,"name":{"56":{},"99":{}},"parent":{}}],["z",{"_index":59,"name":{"57":{},"100":{}},"parent":{}}]],"pipeline":[]}} \ No newline at end of file diff --git a/classes/docklayout.docklayout-1.html b/classes/docklayout.docklayout-1.html deleted file mode 100644 index d8309750..00000000 --- a/classes/docklayout.docklayout-1.html +++ /dev/null @@ -1,625 +0,0 @@ - - - - - - DockLayout | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Class DockLayout

-
-
-
-
-
-
-
-

Hierarchy

-
    -
  • - DockPortalManager -
      -
    • - DockLayout -
    • -
    -
  • -
-
-
-

Implements

- -
-
-

Index

-
- -
-
-
-

Constructors

-
- -

constructor

- - -
-
-
-

Properties

-
- -

_isMounted

-
_isMounted: boolean = false
- -
-
- -

_onWindowResize

-
_onWindowResize: any = ...
- -
-
- -

_pendingDestroy

-
_pendingDestroy: any
- -
-
-
-

Methods

-
- -

destroyRemovedPane

-
    -
  • destroyRemovedPane(): void
  • -
-
    -
  • - -

    Returns void

    -
  • -
-
-
- -

dockMove

- - -
-
- -

find

- - -
-
- -

getGroup

- - -
-
- -

getLayout

- - -
-
- -

loadLayout

- - -
-
- -

navigateToPanel

-
    -
  • navigateToPanel(fromElement?: HTMLElement, direction?: string): void
  • -
-
    -
  • - -
    -
    -

    Move focus to a dockpanel nearby

    -
    -
    -

    Parameters

    -
      -
    • -
      Optional fromElement: HTMLElement
      -
    • -
    • -
      Optional direction: string
      -
      -
      -
    • -
    -

    Returns void

    -
  • -
-
-
- -

saveLayout

- - -
-
- -

setLayout

- - -
-
- -

updateTab

-
    -
  • updateTab(id: string, newTab: TabData, makeActive?: boolean): boolean
  • -
-
    -
  • - -
    -
    -

    Update a tab with new TabData

    -
    -
    -

    Parameters

    -
      -
    • -
      id: string
      -
      -

      tab id to update

      -
      -
    • -
    • -
      newTab: TabData
      -
      -

      new tab data, if newTab is null, it only changes the active tab of parent panel

      -
      -
    • -
    • -
      makeActive: boolean = true
      -
      -

      whether to make the tab the active child of parent panel

      -
      -
    • -
    -

    Returns boolean

    -
  • -
-
-
- -

Static getDerivedStateFromProps

- - -
-
-
- -
-
- -
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/examples/shared-import.js b/examples/shared-import.js index 4888f8ab..c683206f 100644 --- a/examples/shared-import.js +++ b/examples/shared-import.js @@ -736,7 +736,44 @@ function _defineProperty(obj, key, value) { return obj; } -},{}],"EbiA":[function(require,module,exports) { +},{}],"UKeT":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _objectSpread2; + +var _defineProperty = _interopRequireDefault(require("./defineProperty.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { + (0, _defineProperty.default)(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; +} +},{"./defineProperty.js":"gpd2"}],"EbiA":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -922,44 +959,7 @@ function _objectWithoutProperties(source, excluded) { return target; } -},{"./objectWithoutPropertiesLoose.js":"Vabl"}],"UKeT":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _objectSpread2; - -var _defineProperty = _interopRequireDefault(require("./defineProperty.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - enumerableOnly && (symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - })), keys.push.apply(keys, symbols); - } - - return keys; -} - -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] ? arguments[i] : {}; - i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { - (0, _defineProperty.default)(target, key, source[key]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - - return target; -} -},{"./defineProperty.js":"gpd2"}],"qb7c":[function(require,module,exports) { +},{"./objectWithoutPropertiesLoose.js":"Vabl"}],"yl9j":[function(require,module,exports) { var define; /*! Copyright (c) 2018 Jed Watson. @@ -1022,66 +1022,7 @@ var define; } }()); -},{}],"RsE0":[function(require,module,exports) { -/** @license React v16.13.1 - * react-is.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -'use strict';var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? -Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; -function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; -exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; -exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; -exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; - -},{}],"H1RQ":[function(require,module,exports) { -'use strict'; - -if ("production" === 'production') { - module.exports = require('./cjs/react-is.production.min.js'); -} else { - module.exports = require('./cjs/react-is.development.js'); -} -},{"./cjs/react-is.production.min.js":"RsE0"}],"artt":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = toArray; - -var _react = _interopRequireDefault(require("react")); - -var _reactIs = require("react-is"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function toArray(children) { - var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var ret = []; - - _react.default.Children.forEach(children, function (child) { - if ((child === undefined || child === null) && !option.keepEmpty) { - return; - } - - if (Array.isArray(child)) { - ret = ret.concat(toArray(child)); - } else if ((0, _reactIs.isFragment)(child) && child.props) { - ret = ret.concat(toArray(child.props.children, option)); - } else { - ret.push(child); - } - }); - - return ret; -} -},{"react":"n8MK","react-is":"H1RQ"}],"nb8J":[function(require,module,exports) { +},{}],"R6MQ":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -1099,7 +1040,7 @@ var _default = function _default() { }; exports.default = _default; -},{}],"BtBu":[function(require,module,exports) { +},{}],"ssYe":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -1127,7 +1068,7 @@ function useEvent(callback) { }, []); return memoFn; } -},{"react":"n8MK"}],"VhF6":[function(require,module,exports) { +},{"react":"n8MK"}],"s2cK":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -1138,7 +1079,7 @@ exports.default = canUseDom; function canUseDom() { return !!(typeof window !== 'undefined' && window.document && window.document.createElement); } -},{}],"wqHO":[function(require,module,exports) { +},{}],"ZlGx":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -1159,19 +1100,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && /** * Wrap `React.useLayoutEffect` which will not throw warning message in test env */ -var useLayoutEffect = "production" !== 'test' && (0, _canUseDom.default)() ? React.useLayoutEffect : React.useEffect; -var _default = useLayoutEffect; -exports.default = _default; +var useInternalLayoutEffect = "production" !== 'test' && (0, _canUseDom.default)() ? React.useLayoutEffect : React.useEffect; -var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) { +var useLayoutEffect = function useLayoutEffect(callback, deps) { var firstMountRef = React.useRef(true); - useLayoutEffect(function () { - if (!firstMountRef.current) { - return callback(); - } + useInternalLayoutEffect(function () { + return callback(firstMountRef.current); }, deps); // We tell react that first mount has passed - useLayoutEffect(function () { + useInternalLayoutEffect(function () { firstMountRef.current = false; return function () { firstMountRef.current = true; @@ -1179,8 +1116,18 @@ var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) { }, []); }; +var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) { + useLayoutEffect(function (firstMount) { + if (!firstMount) { + return callback(); + } + }, deps); +}; + exports.useLayoutUpdateEffect = useLayoutUpdateEffect; -},{"react":"n8MK","../Dom/canUseDom":"VhF6"}],"OlRb":[function(require,module,exports) { +var _default = useLayoutEffect; +exports.default = _default; +},{"react":"n8MK","../Dom/canUseDom":"s2cK"}],"nSoY":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -1228,7 +1175,7 @@ function useSafeState(defaultValue) { return [value, safeSetState]; } -},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK"}],"zMpY":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK"}],"w0MT":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -1238,29 +1185,15 @@ exports.default = useMergedState; var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); -var React = _interopRequireWildcard(require("react")); - var _useEvent = _interopRequireDefault(require("./useEvent")); -var _useLayoutEffect = _interopRequireWildcard(require("./useLayoutEffect")); - -var _useState3 = _interopRequireDefault(require("./useState")); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _useLayoutEffect = require("./useLayoutEffect"); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _useState5 = _interopRequireDefault(require("./useState")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var Source; - -(function (Source) { - Source[Source["INNER"] = 0] = "INNER"; - Source[Source["PROP"] = 1] = "PROP"; -})(Source || (Source = {})); /** We only think `undefined` is empty */ - - function hasValue(value) { return value !== undefined; } @@ -1278,383 +1211,78 @@ function useMergedState(defaultStateValue, option) { postState = _ref.postState; // ======================= Init ======================= - var _useState = (0, _useState3.default)(function () { - var finalValue = undefined; - var source; - + var _useState = (0, _useState5.default)(function () { if (hasValue(value)) { - finalValue = value; - source = Source.PROP; + return value; } else if (hasValue(defaultValue)) { - finalValue = typeof defaultValue === 'function' ? defaultValue() : defaultValue; - source = Source.PROP; + return typeof defaultValue === 'function' ? defaultValue() : defaultValue; } else { - finalValue = typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue; - source = Source.INNER; + return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue; } - - return [finalValue, source, finalValue]; }), _useState2 = (0, _slicedToArray2.default)(_useState, 2), - mergedValue = _useState2[0], - setMergedValue = _useState2[1]; - - var chosenValue = hasValue(value) ? value : mergedValue[0]; - var postMergedValue = postState ? postState(chosenValue) : chosenValue; // ======================= Sync ======================= - - (0, _useLayoutEffect.useLayoutUpdateEffect)(function () { - setMergedValue(function (_ref2) { - var _ref3 = (0, _slicedToArray2.default)(_ref2, 1), - prevValue = _ref3[0]; - - return [value, Source.PROP, prevValue]; - }); - }, [value]); // ====================== Update ====================== - - var changeEventPrevRef = React.useRef(); - var triggerChange = (0, _useEvent.default)(function (updater, ignoreDestroy) { - setMergedValue(function (prev) { - var _prev = (0, _slicedToArray2.default)(prev, 3), - prevValue = _prev[0], - prevSource = _prev[1], - prevPrevValue = _prev[2]; - - var nextValue = typeof updater === 'function' ? updater(prevValue) : updater; // Do nothing if value not change - - if (nextValue === prevValue) { - return prev; - } // Use prev prev value if is in a batch update to avoid missing data + innerValue = _useState2[0], + setInnerValue = _useState2[1]; - - var overridePrevValue = prevSource === Source.INNER && changeEventPrevRef.current !== prevPrevValue ? prevPrevValue : prevValue; - return [nextValue, Source.INNER, overridePrevValue]; - }, ignoreDestroy); - }); // ====================== Change ====================== + var mergedValue = value !== undefined ? value : innerValue; + var postMergedValue = postState ? postState(mergedValue) : mergedValue; // ====================== Change ====================== var onChangeFn = (0, _useEvent.default)(onChange); - (0, _useLayoutEffect.default)(function () { - var _mergedValue = (0, _slicedToArray2.default)(mergedValue, 3), - current = _mergedValue[0], - source = _mergedValue[1], - prev = _mergedValue[2]; - - if (current !== prev && source === Source.INNER) { - onChangeFn(current, prev); - changeEventPrevRef.current = prev; - } - }, [mergedValue]); - return [postMergedValue, triggerChange]; -} -},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","./useEvent":"BtBu","./useLayoutEffect":"wqHO","./useState":"OlRb"}],"vw6u":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _arrayWithoutHoles; - -var _arrayLikeToArray = _interopRequireDefault(require("./arrayLikeToArray.js")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return (0, _arrayLikeToArray.default)(arr); -} -},{"./arrayLikeToArray.js":"rI22"}],"bG0g":[function(require,module,exports) { -"use strict"; + var _useState3 = (0, _useState5.default)([mergedValue]), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + prevValue = _useState4[0], + setPrevValue = _useState4[1]; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _iterableToArray; + (0, _useLayoutEffect.useLayoutUpdateEffect)(function () { + var prev = prevValue[0]; -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); -} -},{}],"gdEH":[function(require,module,exports) { -"use strict"; + if (innerValue !== prev) { + onChangeFn(innerValue, prev); + } + }, [prevValue]); // Sync value back to `undefined` when it from control to un-control -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _nonIterableSpread; + (0, _useLayoutEffect.useLayoutUpdateEffect)(function () { + if (!hasValue(value)) { + setInnerValue(value); + } + }, [value]); // ====================== Update ====================== -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."); + var triggerChange = (0, _useEvent.default)(function (updater, ignoreDestroy) { + setInnerValue(updater, ignoreDestroy); + setPrevValue([mergedValue], ignoreDestroy); + }); + return [postMergedValue, triggerChange]; } -},{}],"Qv3s":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _toConsumableArray; - -var _arrayWithoutHoles = _interopRequireDefault(require("./arrayWithoutHoles.js")); - -var _iterableToArray = _interopRequireDefault(require("./iterableToArray.js")); - -var _unsupportedIterableToArray = _interopRequireDefault(require("./unsupportedIterableToArray.js")); - -var _nonIterableSpread = _interopRequireDefault(require("./nonIterableSpread.js")); +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","./useEvent":"ssYe","./useLayoutEffect":"ZlGx","./useState":"nSoY"}],"IvPb":[function(require,module,exports) { +/** @license React v0.20.2 + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';var f,g,h,k;if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}} +if("undefined"===typeof window||"function"!==typeof MessageChannel){var t=null,u=null,w=function(){if(null!==t)try{var a=exports.unstable_now();t(!0,a);t=null}catch(b){throw setTimeout(w,0),b;}};f=function(a){null!==t?setTimeout(f,0,a):(t=a,setTimeout(w,0))};g=function(a,b){u=setTimeout(a,b)};h=function(){clearTimeout(u)};exports.unstable_shouldYield=function(){return!1};k=exports.unstable_forceFrameRate=function(){}}else{var x=window.setTimeout,y=window.clearTimeout;if("undefined"!==typeof console){var z= +window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");"function"!==typeof z&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var A=!1,B=null,C=-1,D=5,E=0;exports.unstable_shouldYield=function(){return exports.unstable_now()>= +E};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1; +function T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M)}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else{var b=J(M);null!==b&&g(U,b.startTime-a)}} +function V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if("function"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?O.callback=e:O===J(L)&&K(L);T(b)}else K(L);O=J(L)}if(null!==O)var m=!0;else{var n=J(M);null!==n&&g(U,n.startTime-b);m=!1}return m}finally{O=null,P=c,Q=!1}}var W=k;exports.unstable_IdlePriority=5; +exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V))};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)}; +exports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P}var c=P;P=b;try{return a()}finally{P=c}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=P;P=a;try{return b()}finally{P=c}}; +exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a}; +exports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c}}}; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +},{}],"MDSO":[function(require,module,exports) { +'use strict'; -function _toConsumableArray(arr) { - return (0, _arrayWithoutHoles.default)(arr) || (0, _iterableToArray.default)(arr) || (0, _unsupportedIterableToArray.default)(arr) || (0, _nonIterableSpread.default)(); -} -},{"./arrayWithoutHoles.js":"vw6u","./iterableToArray.js":"bG0g","./unsupportedIterableToArray.js":"AOxl","./nonIterableSpread.js":"gdEH"}],"adDJ":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = wrapperRaf; - -var raf = function raf(callback) { - return +setTimeout(callback, 16); -}; - -var caf = function caf(num) { - return clearTimeout(num); -}; - -if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) { - raf = function raf(callback) { - return window.requestAnimationFrame(callback); - }; - - caf = function caf(handle) { - return window.cancelAnimationFrame(handle); - }; -} - -var rafUUID = 0; -var rafIds = new Map(); - -function cleanup(id) { - rafIds.delete(id); -} - -function wrapperRaf(callback) { - var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - rafUUID += 1; - var id = rafUUID; - - function callRef(leftTimes) { - if (leftTimes === 0) { - // Clean up - cleanup(id); // Trigger - - callback(); - } else { - // Next raf - var realId = raf(function () { - callRef(leftTimes - 1); - }); // Bind real raf id - - rafIds.set(id, realId); - } - } - - callRef(times); - return id; -} - -wrapperRaf.cancel = function (id) { - var realId = rafIds.get(id); - cleanup(realId); - return caf(realId); -}; -},{}],"YOfO":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.call = call; -exports.default = void 0; -exports.note = note; -exports.noteOnce = noteOnce; -exports.resetWarned = resetWarned; -exports.warning = warning; -exports.warningOnce = warningOnce; - -/* eslint-disable no-console */ -var warned = {}; - -function warning(valid, message) { - // Support uglify - if ("production" !== 'production' && !valid && console !== undefined) { - console.error("Warning: ".concat(message)); - } -} - -function note(valid, message) { - // Support uglify - if ("production" !== 'production' && !valid && console !== undefined) { - console.warn("Note: ".concat(message)); - } -} - -function resetWarned() { - warned = {}; -} - -function call(method, valid, message) { - if (!valid && !warned[message]) { - method(false, message); - warned[message] = true; - } -} - -function warningOnce(valid, message) { - call(warning, valid, message); -} - -function noteOnce(valid, message) { - call(note, valid, message); -} - -var _default = warningOnce; -/* eslint-enable */ - -exports.default = _default; -},{}],"HDr6":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = useMemo; - -var React = _interopRequireWildcard(require("react")); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function useMemo(getValue, condition, shouldUpdate) { - var cacheRef = React.useRef({}); - - if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) { - cacheRef.current.value = getValue(); - cacheRef.current.condition = condition; - } - - return cacheRef.current.value; -} -},{"react":"n8MK"}],"AOnv":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.composeRef = composeRef; -exports.fillRef = fillRef; -exports.supportRef = supportRef; -exports.useComposeRef = useComposeRef; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); - -var _reactIs = require("react-is"); - -var _useMemo = _interopRequireDefault(require("./hooks/useMemo")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function fillRef(ref, node) { - if (typeof ref === 'function') { - ref(node); - } else if ((0, _typeof2.default)(ref) === 'object' && ref && 'current' in ref) { - ref.current = node; - } -} -/** - * Merge refs into one ref function to support ref passing. - */ - - -function composeRef() { - for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { - refs[_key] = arguments[_key]; - } - - var refList = refs.filter(function (ref) { - return ref; - }); - - if (refList.length <= 1) { - return refList[0]; - } - - return function (node) { - refs.forEach(function (ref) { - fillRef(ref, node); - }); - }; -} - -function useComposeRef() { - for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - refs[_key2] = arguments[_key2]; - } - - return (0, _useMemo.default)(function () { - return composeRef.apply(void 0, refs); - }, refs, function (prev, next) { - return prev.length === next.length && prev.every(function (ref, i) { - return ref === next[i]; - }); - }); -} - -function supportRef(nodeOrComponent) { - var _type$prototype, _nodeOrComponent$prot; - - var type = (0, _reactIs.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type; // Function component node - - if (typeof type === 'function' && !((_type$prototype = type.prototype) === null || _type$prototype === void 0 ? void 0 : _type$prototype.render)) { - return false; - } // Class component - - - if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) === null || _nodeOrComponent$prot === void 0 ? void 0 : _nodeOrComponent$prot.render)) { - return false; - } - - return true; -} -/* eslint-enable */ -},{"@babel/runtime/helpers/esm/typeof":"xLw6","react-is":"H1RQ","./hooks/useMemo":"HDr6"}],"IvPb":[function(require,module,exports) { -/** @license React v0.20.2 - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -'use strict';var f,g,h,k;if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}} -if("undefined"===typeof window||"function"!==typeof MessageChannel){var t=null,u=null,w=function(){if(null!==t)try{var a=exports.unstable_now();t(!0,a);t=null}catch(b){throw setTimeout(w,0),b;}};f=function(a){null!==t?setTimeout(f,0,a):(t=a,setTimeout(w,0))};g=function(a,b){u=setTimeout(a,b)};h=function(){clearTimeout(u)};exports.unstable_shouldYield=function(){return!1};k=exports.unstable_forceFrameRate=function(){}}else{var x=window.setTimeout,y=window.clearTimeout;if("undefined"!==typeof console){var z= -window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");"function"!==typeof z&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var A=!1,B=null,C=-1,D=5,E=0;exports.unstable_shouldYield=function(){return exports.unstable_now()>= -E};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1; -function T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M)}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else{var b=J(M);null!==b&&g(U,b.startTime-a)}} -function V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if("function"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?O.callback=e:O===J(L)&&K(L);T(b)}else K(L);O=J(L)}if(null!==O)var m=!0;else{var n=J(M);null!==n&&g(U,n.startTime-b);m=!1}return m}finally{O=null,P=c,Q=!1}}var W=k;exports.unstable_IdlePriority=5; -exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V))};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)}; -exports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P}var c=P;P=b;try{return a()}finally{P=c}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=P;P=a;try{return b()}finally{P=c}}; -exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a}; -exports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c}}}; - -},{}],"MDSO":[function(require,module,exports) { -'use strict'; - -if ("production" === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); -} else { - module.exports = require('./cjs/scheduler.development.js'); +if ("production" === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); +} else { + module.exports = require('./cjs/scheduler.development.js'); } },{"./cjs/scheduler.production.min.js":"IvPb"}],"i17t":[function(require,module,exports) { /** @license React v17.0.2 @@ -1993,7 +1621,7 @@ if ("production" === 'production') { } else { module.exports = require('./cjs/react-dom.development.js'); } -},{"./cjs/react-dom.production.min.js":"i17t"}],"beML":[function(require,module,exports) { +},{"./cjs/react-dom.production.min.js":"i17t"}],"JHqZ":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -2015,1493 +1643,1122 @@ function findDOMNode(node) { return _reactDom.default.findDOMNode(node); } -},{"react-dom":"NKHc"}],"C4qV":[function(require,module,exports) { -var global = arguments[3]; -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -/** - * A collection of shims that provide minimal functionality of the ES6 collections. - * - * These implementations are not meant to be used outside of the ResizeObserver - * modules as they cover only a limited range of use cases. +},{"react-dom":"NKHc"}],"FIdW":[function(require,module,exports) { +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -/* eslint-disable require-jsdoc, valid-jsdoc */ -var MapShim = function () { - if (typeof Map !== 'undefined') { - return Map; - } - /** - * Returns index in provided array that matches the specified key. - * - * @param {Array} arr - * @param {*} key - * @returns {number} - */ - - - function getIndex(arr, key) { - var result = -1; - arr.some(function (entry, index) { - if (entry[0] === key) { - result = index; - return true; - } +'use strict';var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? +Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; +function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; +exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; +exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; - return false; - }); - return result; - } +},{}],"z10R":[function(require,module,exports) { +'use strict'; - return ( - /** @class */ - function () { - function class_1() { - this.__entries__ = []; - } +if ("production" === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} +},{"./cjs/react-is.production.min.js":"FIdW"}],"YcSF":[function(require,module,exports) { +"use strict"; - Object.defineProperty(class_1.prototype, "size", { - /** - * @returns {boolean} - */ - get: function () { - return this.__entries__.length; - }, - enumerable: true, - configurable: true - }); - /** - * @param {*} key - * @returns {*} - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = useMemo; - class_1.prototype.get = function (key) { - var index = getIndex(this.__entries__, key); - var entry = this.__entries__[index]; - return entry && entry[1]; - }; - /** - * @param {*} key - * @param {*} value - * @returns {void} - */ +var React = _interopRequireWildcard(require("react")); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - class_1.prototype.set = function (key, value) { - var index = getIndex(this.__entries__, key); +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - if (~index) { - this.__entries__[index][1] = value; - } else { - this.__entries__.push([key, value]); - } - }; - /** - * @param {*} key - * @returns {void} - */ +function useMemo(getValue, condition, shouldUpdate) { + var cacheRef = React.useRef({}); + if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) { + cacheRef.current.value = getValue(); + cacheRef.current.condition = condition; + } - class_1.prototype.delete = function (key) { - var entries = this.__entries__; - var index = getIndex(entries, key); + return cacheRef.current.value; +} +},{"react":"n8MK"}],"HPrS":[function(require,module,exports) { +"use strict"; - if (~index) { - entries.splice(index, 1); - } - }; - /** - * @param {*} key - * @returns {void} - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.composeRef = composeRef; +exports.fillRef = fillRef; +exports.supportRef = supportRef; +exports.useComposeRef = useComposeRef; +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); - class_1.prototype.has = function (key) { - return !!~getIndex(this.__entries__, key); - }; - /** - * @returns {void} - */ +var _reactIs = require("react-is"); +var _useMemo = _interopRequireDefault(require("./hooks/useMemo")); - class_1.prototype.clear = function () { - this.__entries__.splice(0); - }; - /** - * @param {Function} callback - * @param {*} [ctx=null] - * @returns {void} - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function fillRef(ref, node) { + if (typeof ref === 'function') { + ref(node); + } else if ((0, _typeof2.default)(ref) === 'object' && ref && 'current' in ref) { + ref.current = node; + } +} +/** + * Merge refs into one ref function to support ref passing. + */ - class_1.prototype.forEach = function (callback, ctx) { - if (ctx === void 0) { - ctx = null; - } - for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) { - var entry = _a[_i]; - callback.call(ctx, entry[1], entry[0]); - } - }; +function composeRef() { + for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { + refs[_key] = arguments[_key]; + } - return class_1; - }() - ); -}(); -/** - * Detects whether window and document objects are available in current environment. - */ + var refList = refs.filter(function (ref) { + return ref; + }); + if (refList.length <= 1) { + return refList[0]; + } -var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document; // Returns global object of a current environment. + return function (node) { + refs.forEach(function (ref) { + fillRef(ref, node); + }); + }; +} -var global$1 = function () { - if (typeof global !== 'undefined' && global.Math === Math) { - return global; +function useComposeRef() { + for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + refs[_key2] = arguments[_key2]; } - if (typeof self !== 'undefined' && self.Math === Math) { - return self; - } + return (0, _useMemo.default)(function () { + return composeRef.apply(void 0, refs); + }, refs, function (prev, next) { + return prev.length === next.length && prev.every(function (ref, i) { + return ref === next[i]; + }); + }); +} - if (typeof window !== 'undefined' && window.Math === Math) { - return window; - } // eslint-disable-next-line no-new-func +function supportRef(nodeOrComponent) { + var _type$prototype, _nodeOrComponent$prot; + var type = (0, _reactIs.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type; // Function component node - return Function('return this')(); -}(); -/** - * A shim for the requestAnimationFrame which falls back to the setTimeout if - * first one is not supported. - * - * @returns {number} Requests' identifier. - */ + if (typeof type === 'function' && !((_type$prototype = type.prototype) === null || _type$prototype === void 0 ? void 0 : _type$prototype.render)) { + return false; + } // Class component -var requestAnimationFrame$1 = function () { - if (typeof requestAnimationFrame === 'function') { - // It's required to use a bounded function because IE sometimes throws - // an "Invalid calling object" error if rAF is invoked without the global - // object on the left hand side. - return requestAnimationFrame.bind(global$1); + if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) === null || _nodeOrComponent$prot === void 0 ? void 0 : _nodeOrComponent$prot.render)) { + return false; } - return function (callback) { - return setTimeout(function () { - return callback(Date.now()); - }, 1000 / 60); - }; -}(); // Defines minimum timeout before adding a trailing call. + return true; +} +/* eslint-enable */ +},{"@babel/runtime/helpers/esm/typeof":"xLw6","react-is":"z10R","./hooks/useMemo":"YcSF"}],"EzWK":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Context = void 0; +exports.default = MotionProvider; -var trailingTimeout = 2; -/** - * Creates a wrapper function which ensures that provided callback will be - * invoked only once during the specified delay period. - * - * @param {Function} callback - Function to be invoked after the delay period. - * @param {number} delay - Delay after which to invoke callback. - * @returns {Function} - */ - -function throttle(callback, delay) { - var leadingCall = false, - trailingCall = false, - lastCallTime = 0; - /** - * Invokes the original callback function and schedules new invocation if - * the "proxy" was called during current request. - * - * @returns {void} - */ - - function resolvePending() { - if (leadingCall) { - leadingCall = false; - callback(); - } - - if (trailingCall) { - proxy(); - } - } - /** - * Callback invoked after the specified delay. It will further postpone - * invocation of the original function delegating it to the - * requestAnimationFrame. - * - * @returns {void} - */ +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); +var React = _interopRequireWildcard(require("react")); - function timeoutCallback() { - requestAnimationFrame$1(resolvePending); - } - /** - * Schedules invocation of the original function. - * - * @returns {void} - */ +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - function proxy() { - var timeStamp = Date.now(); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - if (leadingCall) { - // Reject immediately following calls. - if (timeStamp - lastCallTime < trailingTimeout) { - return; - } // Schedule new call to be in invoked when the pending one is resolved. - // This is important for "transitions" which never actually start - // immediately so there is a chance that we might miss one if change - // happens amids the pending invocation. +var _excluded = ["children"]; +var Context = /*#__PURE__*/React.createContext({}); +exports.Context = Context; +function MotionProvider(_ref) { + var children = _ref.children, + props = (0, _objectWithoutProperties2.default)(_ref, _excluded); + return /*#__PURE__*/React.createElement(Context.Provider, { + value: props + }, children); +} +},{"@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK"}],"VEjx":[function(require,module,exports) { +"use strict"; - trailingCall = true; - } else { - leadingCall = true; - trailingCall = false; - setTimeout(timeoutCallback, delay); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _classCallCheck; - lastCallTime = timeStamp; +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); } +} +},{}],"l5p4":[function(require,module,exports) { +"use strict"; - return proxy; -} // Minimum delay before invoking the update of observers. +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _createClass; +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} -var REFRESH_DELAY = 20; // A list of substrings of CSS properties used to find transition events that -// might affect dimensions of observed elements. +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; +} +},{}],"hewo":[function(require,module,exports) { +"use strict"; -var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight']; // Check if MutationObserver is available. +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _setPrototypeOf; -var mutationObserverSupported = typeof MutationObserver !== 'undefined'; -/** - * Singleton controller class which handles updates of ResizeObserver instances. - */ +function _setPrototypeOf(o, p) { + exports.default = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); +} +},{}],"NT06":[function(require,module,exports) { +"use strict"; -var ResizeObserverController = -/** @class */ -function () { - /** - * Creates a new instance of ResizeObserverController. - * - * @private - */ - function ResizeObserverController() { - /** - * Indicates whether DOM listeners have been added. - * - * @private {boolean} - */ - this.connected_ = false; - /** - * Tells that controller has subscribed for Mutation Events. - * - * @private {boolean} - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _inherits; - this.mutationEventsAdded_ = false; - /** - * Keeps reference to the instance of MutationObserver. - * - * @private {MutationObserver} - */ +var _setPrototypeOf = _interopRequireDefault(require("./setPrototypeOf.js")); - this.mutationsObserver_ = null; - /** - * A list of connected observers. - * - * @private {Array} - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - this.observers_ = []; - this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); - this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY); +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); } - /** - * Adds observer to observers list. - * - * @param {ResizeObserverSPI} observer - Observer to be added. - * @returns {void} - */ - - ResizeObserverController.prototype.addObserver = function (observer) { - if (!~this.observers_.indexOf(observer)) { - this.observers_.push(observer); - } // Add listeners if they haven't been added yet. + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) (0, _setPrototypeOf.default)(subClass, superClass); +} +},{"./setPrototypeOf.js":"hewo"}],"QQCW":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _getPrototypeOf; - if (!this.connected_) { - this.connect_(); - } +function _getPrototypeOf(o) { + exports.default = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); }; - /** - * Removes observer from observers list. - * - * @param {ResizeObserverSPI} observer - Observer to be removed. - * @returns {void} - */ + return _getPrototypeOf(o); +} +},{}],"h1Zy":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _isNativeReflectConstruct; - ResizeObserverController.prototype.removeObserver = function (observer) { - var observers = this.observers_; - var index = observers.indexOf(observer); // Remove observer if it's present in registry. +function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; - if (~index) { - observers.splice(index, 1); - } // Remove listeners if controller has no connected observers. + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } +} +},{}],"bk0i":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _assertThisInitialized; - if (!observers.length && this.connected_) { - this.disconnect_(); - } - }; - /** - * Invokes the update of observers. It will continue running updates insofar - * it detects changes. - * - * @returns {void} - */ +function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return self; +} +},{}],"aBEI":[function(require,module,exports) { +"use strict"; - ResizeObserverController.prototype.refresh = function () { - var changesDetected = this.updateObservers_(); // Continue running updates if changes have been detected as there might - // be future ones caused by CSS transitions. +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _possibleConstructorReturn; - if (changesDetected) { - this.refresh(); - } - }; - /** - * Updates every observer from observers list and notifies them of queued - * entries. - * - * @private - * @returns {boolean} Returns "true" if any observer has detected changes in - * dimensions of it's elements. - */ +var _typeof2 = _interopRequireDefault(require("./typeof.js")); +var _assertThisInitialized = _interopRequireDefault(require("./assertThisInitialized.js")); - ResizeObserverController.prototype.updateObservers_ = function () { - // Collect observers that have active observations. - var activeObservers = this.observers_.filter(function (observer) { - return observer.gatherActive(), observer.hasActive(); - }); // Deliver notifications in a separate cycle in order to avoid any - // collisions between observers, e.g. when multiple instances of - // ResizeObserver are tracking the same element and the callback of one - // of them changes content dimensions of the observed target. Sometimes - // this may result in notifications being blocked for the rest of observers. +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - activeObservers.forEach(function (observer) { - return observer.broadcastActive(); - }); - return activeObservers.length > 0; - }; - /** - * Initializes DOM listeners. - * - * @private - * @returns {void} - */ +function _possibleConstructorReturn(self, call) { + if (call && ((0, _typeof2.default)(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + return (0, _assertThisInitialized.default)(self); +} +},{"./typeof.js":"xLw6","./assertThisInitialized.js":"bk0i"}],"m5aa":[function(require,module,exports) { +"use strict"; - ResizeObserverController.prototype.connect_ = function () { - // Do nothing if running in a non-browser environment or if listeners - // have been already added. - if (!isBrowser || this.connected_) { - return; - } // Subscription to the "Transitionend" event is used as a workaround for - // delayed transitions. This way it's possible to capture at least the - // final state of an element. +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _createSuper; +var _getPrototypeOf = _interopRequireDefault(require("./getPrototypeOf.js")); - document.addEventListener('transitionend', this.onTransitionEnd_); - window.addEventListener('resize', this.refresh); +var _isNativeReflectConstruct = _interopRequireDefault(require("./isNativeReflectConstruct.js")); - if (mutationObserverSupported) { - this.mutationsObserver_ = new MutationObserver(this.refresh); - this.mutationsObserver_.observe(document, { - attributes: true, - childList: true, - characterData: true, - subtree: true - }); - } else { - document.addEventListener('DOMSubtreeModified', this.refresh); - this.mutationEventsAdded_ = true; - } +var _possibleConstructorReturn = _interopRequireDefault(require("./possibleConstructorReturn.js")); - this.connected_ = true; - }; - /** - * Removes DOM listeners. - * - * @private - * @returns {void} - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _createSuper(Derived) { + var hasNativeReflectConstruct = (0, _isNativeReflectConstruct.default)(); + return function _createSuperInternal() { + var Super = (0, _getPrototypeOf.default)(Derived), + result; - ResizeObserverController.prototype.disconnect_ = function () { - // Do nothing if running in a non-browser environment or if listeners - // have been already removed. - if (!isBrowser || !this.connected_) { - return; + if (hasNativeReflectConstruct) { + var NewTarget = (0, _getPrototypeOf.default)(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); } - document.removeEventListener('transitionend', this.onTransitionEnd_); - window.removeEventListener('resize', this.refresh); + return (0, _possibleConstructorReturn.default)(this, result); + }; +} +},{"./getPrototypeOf.js":"QQCW","./isNativeReflectConstruct.js":"h1Zy","./possibleConstructorReturn.js":"aBEI"}],"uOw9":[function(require,module,exports) { +"use strict"; - if (this.mutationsObserver_) { - this.mutationsObserver_.disconnect(); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - if (this.mutationEventsAdded_) { - document.removeEventListener('DOMSubtreeModified', this.refresh); - } +var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck")); - this.mutationsObserver_ = null; - this.mutationEventsAdded_ = false; - this.connected_ = false; - }; - /** - * "Transitionend" event handler. - * - * @private - * @param {TransitionEvent} event - * @returns {void} - */ +var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass")); +var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits")); - ResizeObserverController.prototype.onTransitionEnd_ = function (_a) { - var _b = _a.propertyName, - propertyName = _b === void 0 ? '' : _b; // Detect whether transition may affect dimensions of an element. +var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper")); - var isReflowProperty = transitionKeys.some(function (key) { - return !!~propertyName.indexOf(key); - }); +var React = _interopRequireWildcard(require("react")); - if (isReflowProperty) { - this.refresh(); - } - }; - /** - * Returns instance of the ResizeObserverController. - * - * @returns {ResizeObserverController} - */ +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - ResizeObserverController.getInstance = function () { - if (!this.instance_) { - this.instance_ = new ResizeObserverController(); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - return this.instance_; - }; - /** - * Holds reference to the controller's instance. - * - * @private {ResizeObserverController} - */ +var DomWrapper = /*#__PURE__*/function (_React$Component) { + (0, _inherits2.default)(DomWrapper, _React$Component); + var _super = (0, _createSuper2.default)(DomWrapper); - ResizeObserverController.instance_ = null; - return ResizeObserverController; -}(); -/** - * Defines non-writable/enumerable properties of the provided target object. - * - * @param {Object} target - Object for which to define properties. - * @param {Object} props - Properties to be defined. - * @returns {Object} Target object. - */ + function DomWrapper() { + (0, _classCallCheck2.default)(this, DomWrapper); + return _super.apply(this, arguments); + } + (0, _createClass2.default)(DomWrapper, [{ + key: "render", + value: function render() { + return this.props.children; + } + }]); + return DomWrapper; +}(React.Component); -var defineConfigurable = function (target, props) { - for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) { - var key = _a[_i]; - Object.defineProperty(target, key, { - value: props[key], - enumerable: false, - writable: false, - configurable: true - }); - } +var _default = DomWrapper; +exports.default = _default; +},{"@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","react":"n8MK"}],"pSvJ":[function(require,module,exports) { +"use strict"; - return target; -}; -/** - * Returns the global object associated with provided element. - * - * @param {Object} target - * @returns {Object} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.STEP_START = exports.STEP_PREPARED = exports.STEP_PREPARE = exports.STEP_NONE = exports.STEP_ACTIVE = exports.STEP_ACTIVATED = exports.STATUS_NONE = exports.STATUS_LEAVE = exports.STATUS_ENTER = exports.STATUS_APPEAR = void 0; +var STATUS_NONE = 'none'; +exports.STATUS_NONE = STATUS_NONE; +var STATUS_APPEAR = 'appear'; +exports.STATUS_APPEAR = STATUS_APPEAR; +var STATUS_ENTER = 'enter'; +exports.STATUS_ENTER = STATUS_ENTER; +var STATUS_LEAVE = 'leave'; +exports.STATUS_LEAVE = STATUS_LEAVE; +var STEP_NONE = 'none'; +exports.STEP_NONE = STEP_NONE; +var STEP_PREPARE = 'prepare'; +exports.STEP_PREPARE = STEP_PREPARE; +var STEP_START = 'start'; +exports.STEP_START = STEP_START; +var STEP_ACTIVE = 'active'; +exports.STEP_ACTIVE = STEP_ACTIVE; +var STEP_ACTIVATED = 'end'; +/** + * Used for disabled motion case. + * Prepare stage will still work but start & active will be skipped. */ +exports.STEP_ACTIVATED = STEP_ACTIVATED; +var STEP_PREPARED = 'prepared'; +exports.STEP_PREPARED = STEP_PREPARED; +},{}],"rGbI":[function(require,module,exports) { +"use strict"; -var getWindowOf = function (target) { - // Assume that the element is an instance of Node, which means that it - // has the "ownerDocument" property from which we can retrieve a - // corresponding global object. - var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; // Return the local global object if it's not possible extract one from - // provided element. +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.animationEndName = void 0; +exports.getTransitionName = getTransitionName; +exports.getVendorPrefixedEventName = getVendorPrefixedEventName; +exports.getVendorPrefixes = getVendorPrefixes; +exports.transitionEndName = exports.supportTransition = void 0; - return ownerGlobal || global$1; -}; // Placeholder of an empty content rectangle. +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); +var _canUseDom = _interopRequireDefault(require("rc-util/es/Dom/canUseDom")); -var emptyRect = createRectInit(0, 0, 0, 0); -/** - * Converts provided string to a number. - * - * @param {number|string} value - * @returns {number} - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function toFloat(value) { - return parseFloat(value) || 0; -} -/** - * Extracts borders size from provided styles. - * - * @param {CSSStyleDeclaration} styles - * @param {...string} positions - Borders positions (top, right, ...) - * @returns {number} - */ - - -function getBordersSize(styles) { - var positions = []; - - for (var _i = 1; _i < arguments.length; _i++) { - positions[_i - 1] = arguments[_i]; - } - - return positions.reduce(function (size, position) { - var value = styles['border-' + position + '-width']; - return size + toFloat(value); - }, 0); +// ================= Transition ================= +// Event wrapper. Copy from react source code +function makePrefixMap(styleProp, eventName) { + var prefixes = {}; + prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); + prefixes["Webkit".concat(styleProp)] = "webkit".concat(eventName); + prefixes["Moz".concat(styleProp)] = "moz".concat(eventName); + prefixes["ms".concat(styleProp)] = "MS".concat(eventName); + prefixes["O".concat(styleProp)] = "o".concat(eventName.toLowerCase()); + return prefixes; } -/** - * Extracts paddings sizes from provided styles. - * - * @param {CSSStyleDeclaration} styles - * @returns {Object} Paddings box. - */ +function getVendorPrefixes(domSupport, win) { + var prefixes = { + animationend: makePrefixMap('Animation', 'AnimationEnd'), + transitionend: makePrefixMap('Transition', 'TransitionEnd') + }; -function getPaddings(styles) { - var positions = ['top', 'right', 'bottom', 'left']; - var paddings = {}; + if (domSupport) { + if (!('AnimationEvent' in win)) { + delete prefixes.animationend.animation; + } - for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { - var position = positions_1[_i]; - var value = styles['padding-' + position]; - paddings[position] = toFloat(value); + if (!('TransitionEvent' in win)) { + delete prefixes.transitionend.transition; + } } - return paddings; + return prefixes; } -/** - * Calculates content rectangle of provided SVG element. - * - * @param {SVGGraphicsElement} target - Element content rectangle of which needs - * to be calculated. - * @returns {DOMRectInit} - */ +var vendorPrefixes = getVendorPrefixes((0, _canUseDom.default)(), typeof window !== 'undefined' ? window : {}); +var style = {}; + +if ((0, _canUseDom.default)()) { + var _document$createEleme = document.createElement('div'); -function getSVGContentRect(target) { - var bbox = target.getBBox(); - return createRectInit(0, 0, bbox.width, bbox.height); + style = _document$createEleme.style; } -/** - * Calculates content rectangle of provided HTMLElement. - * - * @param {HTMLElement} target - Element for which to calculate the content rectangle. - * @returns {DOMRectInit} - */ - -function getHTMLElementContentRect(target) { - // Client width & height properties can't be - // used exclusively as they provide rounded values. - var clientWidth = target.clientWidth, - clientHeight = target.clientHeight; // By this condition we can catch all non-replaced inline, hidden and - // detached elements. Though elements with width & height properties less - // than 0.5 will be discarded as well. - // - // Without it we would need to implement separate methods for each of - // those cases and it's not possible to perform a precise and performance - // effective test for hidden elements. E.g. even jQuery's ':visible' filter - // gives wrong results for elements with width & height less than 0.5. +var prefixedEventNames = {}; - if (!clientWidth && !clientHeight) { - return emptyRect; +function getVendorPrefixedEventName(eventName) { + if (prefixedEventNames[eventName]) { + return prefixedEventNames[eventName]; } - var styles = getWindowOf(target).getComputedStyle(target); - var paddings = getPaddings(styles); - var horizPad = paddings.left + paddings.right; - var vertPad = paddings.top + paddings.bottom; // Computed styles of width & height are being used because they are the - // only dimensions available to JS that contain non-rounded values. It could - // be possible to utilize the getBoundingClientRect if only it's data wasn't - // affected by CSS transformations let alone paddings, borders and scroll bars. + var prefixMap = vendorPrefixes[eventName]; - var width = toFloat(styles.width), - height = toFloat(styles.height); // Width & height include paddings and borders when the 'border-box' box - // model is applied (except for IE). + if (prefixMap) { + var stylePropList = Object.keys(prefixMap); + var len = stylePropList.length; - if (styles.boxSizing === 'border-box') { - // Following conditions are required to handle Internet Explorer which - // doesn't include paddings and borders to computed CSS dimensions. - // - // We can say that if CSS dimensions + paddings are equal to the "client" - // properties then it's either IE, and thus we don't need to subtract - // anything, or an element merely doesn't have paddings/borders styles. - if (Math.round(width + horizPad) !== clientWidth) { - width -= getBordersSize(styles, 'left', 'right') + horizPad; - } + for (var i = 0; i < len; i += 1) { + var styleProp = stylePropList[i]; - if (Math.round(height + vertPad) !== clientHeight) { - height -= getBordersSize(styles, 'top', 'bottom') + vertPad; + if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in style) { + prefixedEventNames[eventName] = prefixMap[styleProp]; + return prefixedEventNames[eventName]; + } } - } // Following steps can't be applied to the document's root element as its - // client[Width/Height] properties represent viewport area of the window. - // Besides, it's as well not necessary as the itself neither has - // rendered scroll bars nor it can be clipped. + } + return ''; +} - if (!isDocumentElement(target)) { - // In some browsers (only in Firefox, actually) CSS width & height - // include scroll bars size which can be removed at this step as scroll - // bars are the only difference between rounded dimensions + paddings - // and "client" properties, though that is not always true in Chrome. - var vertScrollbar = Math.round(width + horizPad) - clientWidth; - var horizScrollbar = Math.round(height + vertPad) - clientHeight; // Chrome has a rather weird rounding of "client" properties. - // E.g. for an element with content width of 314.2px it sometimes gives - // the client width of 315px and for the width of 314.7px it may give - // 314px. And it doesn't happen all the time. So just ignore this delta - // as a non-relevant. +var internalAnimationEndName = getVendorPrefixedEventName('animationend'); +var internalTransitionEndName = getVendorPrefixedEventName('transitionend'); +var supportTransition = !!(internalAnimationEndName && internalTransitionEndName); +exports.supportTransition = supportTransition; +var animationEndName = internalAnimationEndName || 'animationend'; +exports.animationEndName = animationEndName; +var transitionEndName = internalTransitionEndName || 'transitionend'; +exports.transitionEndName = transitionEndName; - if (Math.abs(vertScrollbar) !== 1) { - width -= vertScrollbar; - } +function getTransitionName(transitionName, transitionType) { + if (!transitionName) return null; - if (Math.abs(horizScrollbar) !== 1) { - height -= horizScrollbar; - } + if ((0, _typeof2.default)(transitionName) === 'object') { + var type = transitionType.replace(/-\w/g, function (match) { + return match[1].toUpperCase(); + }); + return transitionName[type]; } - return createRectInit(paddings.left, paddings.top, width, height); + return "".concat(transitionName, "-").concat(transitionType); } -/** - * Checks whether provided element is an instance of the SVGGraphicsElement. - * - * @param {Element} target - Element to be checked. - * @returns {boolean} - */ +},{"@babel/runtime/helpers/esm/typeof":"xLw6","rc-util/es/Dom/canUseDom":"s2cK"}],"l4OM":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; -var isSVGGraphicsElement = function () { - // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement - // interface. - if (typeof SVGGraphicsElement !== 'undefined') { - return function (target) { - return target instanceof getWindowOf(target).SVGGraphicsElement; - }; - } // If it's so, then check that element is at least an instance of the - // SVGElement and that it has the "getBBox" method. - // eslint-disable-next-line no-extra-parens +var React = _interopRequireWildcard(require("react")); +var _motion = require("../util/motion"); - return function (target) { - return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === 'function'; - }; -}(); -/** - * Checks whether provided element is a document element (). - * - * @param {Element} target - Element to be checked. - * @returns {boolean} - */ +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -function isDocumentElement(target) { - return target === getWindowOf(target).document.documentElement; -} -/** - * Calculates an appropriate content rectangle for provided html or svg element. - * - * @param {Element} target - Element content rectangle of which needs to be calculated. - * @returns {DOMRectInit} - */ +var _default = function _default(callback) { + var cacheElementRef = (0, React.useRef)(); // Cache callback + var callbackRef = (0, React.useRef)(callback); + callbackRef.current = callback; // Internal motion event handler -function getContentRect(target) { - if (!isBrowser) { - return emptyRect; - } + var onInternalMotionEnd = React.useCallback(function (event) { + callbackRef.current(event); + }, []); // Remove events - if (isSVGGraphicsElement(target)) { - return getSVGContentRect(target); - } + function removeMotionEvents(element) { + if (element) { + element.removeEventListener(_motion.transitionEndName, onInternalMotionEnd); + element.removeEventListener(_motion.animationEndName, onInternalMotionEnd); + } + } // Patch events - return getHTMLElementContentRect(target); -} -/** - * Creates rectangle with an interface of the DOMRectReadOnly. - * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly - * - * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions. - * @returns {DOMRectReadOnly} - */ + function patchMotionEvents(element) { + if (cacheElementRef.current && cacheElementRef.current !== element) { + removeMotionEvents(cacheElementRef.current); + } -function createReadOnlyRect(_a) { - var x = _a.x, - y = _a.y, - width = _a.width, - height = _a.height; // If DOMRectReadOnly is available use it as a prototype for the rectangle. + if (element && element !== cacheElementRef.current) { + element.addEventListener(_motion.transitionEndName, onInternalMotionEnd); + element.addEventListener(_motion.animationEndName, onInternalMotionEnd); // Save as cache in case dom removed trigger by `motionDeadline` - var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object; - var rect = Object.create(Constr.prototype); // Rectangle's properties are not writable and non-enumerable. + cacheElementRef.current = element; + } + } // Clean up when removed - defineConfigurable(rect, { - x: x, - y: y, - width: width, - height: height, - top: y, - right: x + width, - bottom: height + y, - left: x - }); - return rect; -} -/** - * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates. - * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit - * - * @param {number} x - X coordinate. - * @param {number} y - Y coordinate. - * @param {number} width - Rectangle's width. - * @param {number} height - Rectangle's height. - * @returns {DOMRectInit} - */ + React.useEffect(function () { + return function () { + removeMotionEvents(cacheElementRef.current); + }; + }, []); + return [patchMotionEvents, removeMotionEvents]; +}; -function createRectInit(x, y, width, height) { - return { - x: x, - y: y, - width: width, - height: height - }; -} -/** - * Class that is responsible for computations of the content rectangle of - * provided DOM element and for keeping track of it's changes. - */ +exports.default = _default; +},{"react":"n8MK","../util/motion":"rGbI"}],"hYGK":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; -var ResizeObservation = -/** @class */ -function () { - /** - * Creates an instance of ResizeObservation. - * - * @param {Element} target - Element to be observed. - */ - function ResizeObservation(target) { - /** - * Broadcasted width of content rectangle. - * - * @type {number} - */ - this.broadcastWidth = 0; - /** - * Broadcasted height of content rectangle. - * - * @type {number} - */ +var _canUseDom = _interopRequireDefault(require("rc-util/es/Dom/canUseDom")); - this.broadcastHeight = 0; - /** - * Reference to the last observed content rectangle. - * - * @private {DOMRectInit} - */ +var _react = require("react"); - this.contentRect_ = createRectInit(0, 0, 0, 0); - this.target = target; - } - /** - * Updates content rectangle and tells whether it's width or height properties - * have changed since the last broadcast. - * - * @returns {boolean} - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +// It's safe to use `useLayoutEffect` but the warning is annoying +var useIsomorphicLayoutEffect = (0, _canUseDom.default)() ? _react.useLayoutEffect : _react.useEffect; +var _default = useIsomorphicLayoutEffect; +exports.default = _default; +},{"rc-util/es/Dom/canUseDom":"s2cK","react":"n8MK"}],"mM6N":[function(require,module,exports) { +"use strict"; - ResizeObservation.prototype.isActive = function () { - var rect = getContentRect(this.target); - this.contentRect_ = rect; - return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight; - }; - /** - * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data - * from the corresponding properties of the last observed content rectangle. - * - * @returns {DOMRectInit} Last observed content rectangle. - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = wrapperRaf; +var raf = function raf(callback) { + return +setTimeout(callback, 16); +}; - ResizeObservation.prototype.broadcastRect = function () { - var rect = this.contentRect_; - this.broadcastWidth = rect.width; - this.broadcastHeight = rect.height; - return rect; +var caf = function caf(num) { + return clearTimeout(num); +}; + +if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) { + raf = function raf(callback) { + return window.requestAnimationFrame(callback); }; - return ResizeObservation; -}(); + caf = function caf(handle) { + return window.cancelAnimationFrame(handle); + }; +} -var ResizeObserverEntry = -/** @class */ -function () { - /** - * Creates an instance of ResizeObserverEntry. - * - * @param {Element} target - Element that is being observed. - * @param {DOMRectInit} rectInit - Data of the element's content rectangle. - */ - function ResizeObserverEntry(target, rectInit) { - var contentRect = createReadOnlyRect(rectInit); // According to the specification following properties are not writable - // and are also not enumerable in the native implementation. - // - // Property accessors are not being used as they'd require to define a - // private WeakMap storage which may cause memory leaks in browsers that - // don't support this type of collections. +var rafUUID = 0; +var rafIds = new Map(); - defineConfigurable(this, { - target: target, - contentRect: contentRect - }); - } +function cleanup(id) { + rafIds.delete(id); +} - return ResizeObserverEntry; -}(); +function wrapperRaf(callback) { + var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + rafUUID += 1; + var id = rafUUID; -var ResizeObserverSPI = -/** @class */ -function () { - /** - * Creates a new instance of ResizeObserver. - * - * @param {ResizeObserverCallback} callback - Callback function that is invoked - * when one of the observed elements changes it's content dimensions. - * @param {ResizeObserverController} controller - Controller instance which - * is responsible for the updates of observer. - * @param {ResizeObserver} callbackCtx - Reference to the public - * ResizeObserver instance which will be passed to callback function. - */ - function ResizeObserverSPI(callback, controller, callbackCtx) { - /** - * Collection of resize observations that have detected changes in dimensions - * of elements. - * - * @private {Array} - */ - this.activeObservations_ = []; - /** - * Registry of the ResizeObservation instances. - * - * @private {Map} - */ + function callRef(leftTimes) { + if (leftTimes === 0) { + // Clean up + cleanup(id); // Trigger - this.observations_ = new MapShim(); + callback(); + } else { + // Next raf + var realId = raf(function () { + callRef(leftTimes - 1); + }); // Bind real raf id - if (typeof callback !== 'function') { - throw new TypeError('The callback provided as parameter 1 is not a function.'); + rafIds.set(id, realId); } - - this.callback_ = callback; - this.controller_ = controller; - this.callbackCtx_ = callbackCtx; } - /** - * Starts observing provided element. - * - * @param {Element} target - Element to be observed. - * @returns {void} - */ - - ResizeObserverSPI.prototype.observe = function (target) { - if (!arguments.length) { - throw new TypeError('1 argument required, but only 0 present.'); - } // Do nothing if current environment doesn't have the Element interface. + callRef(times); + return id; +} +wrapperRaf.cancel = function (id) { + var realId = rafIds.get(id); + cleanup(realId); + return caf(realId); +}; +},{}],"BUHO":[function(require,module,exports) { +"use strict"; - if (typeof Element === 'undefined' || !(Element instanceof Object)) { - return; - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - if (!(target instanceof getWindowOf(target).Element)) { - throw new TypeError('parameter 1 is not of type "Element".'); - } +var _raf = _interopRequireDefault(require("rc-util/es/raf")); - var observations = this.observations_; // Do nothing if element is already being observed. +var React = _interopRequireWildcard(require("react")); - if (observations.has(target)) { - return; - } +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - observations.set(target, new ResizeObservation(target)); - this.controller_.addObserver(this); // Force the update of observations. +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - this.controller_.refresh(); - }; - /** - * Stops observing provided element. - * - * @param {Element} target - Element to stop observing. - * @returns {void} - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _default = function _default() { + var nextFrameRef = React.useRef(null); - ResizeObserverSPI.prototype.unobserve = function (target) { - if (!arguments.length) { - throw new TypeError('1 argument required, but only 0 present.'); - } // Do nothing if current environment doesn't have the Element interface. - - - if (typeof Element === 'undefined' || !(Element instanceof Object)) { - return; - } - - if (!(target instanceof getWindowOf(target).Element)) { - throw new TypeError('parameter 1 is not of type "Element".'); - } - - var observations = this.observations_; // Do nothing if element is not being observed. - - if (!observations.has(target)) { - return; - } - - observations.delete(target); - - if (!observations.size) { - this.controller_.removeObserver(this); - } - }; - /** - * Stops observing all elements. - * - * @returns {void} - */ - - - ResizeObserverSPI.prototype.disconnect = function () { - this.clearActive(); - this.observations_.clear(); - this.controller_.removeObserver(this); - }; - /** - * Collects observation instances the associated element of which has changed - * it's content rectangle. - * - * @returns {void} - */ - - - ResizeObserverSPI.prototype.gatherActive = function () { - var _this = this; + function cancelNextFrame() { + _raf.default.cancel(nextFrameRef.current); + } - this.clearActive(); - this.observations_.forEach(function (observation) { - if (observation.isActive()) { - _this.activeObservations_.push(observation); + function nextFrame(callback) { + var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; + cancelNextFrame(); + var nextFrameId = (0, _raf.default)(function () { + if (delay <= 1) { + callback({ + isCanceled: function isCanceled() { + return nextFrameId !== nextFrameRef.current; + } + }); + } else { + nextFrame(callback, delay - 1); } }); - }; - /** - * Invokes initial callback function with a list of ResizeObserverEntry - * instances collected from active resize observations. - * - * @returns {void} - */ + nextFrameRef.current = nextFrameId; + } + React.useEffect(function () { + return function () { + cancelNextFrame(); + }; + }, []); + return [nextFrame, cancelNextFrame]; +}; - ResizeObserverSPI.prototype.broadcastActive = function () { - // Do nothing if observer doesn't have active observations. - if (!this.hasActive()) { - return; - } +exports.default = _default; +},{"rc-util/es/raf":"mM6N","react":"n8MK"}],"HO5D":[function(require,module,exports) { +"use strict"; - var ctx = this.callbackCtx_; // Create ResizeObserverEntry instance for every active observation. +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.SkipStep = exports.DoStep = void 0; +exports.isActive = isActive; - var entries = this.activeObservations_.map(function (observation) { - return new ResizeObserverEntry(observation.target, observation.broadcastRect()); - }); - this.callback_.call(ctx, entries, ctx); - this.clearActive(); - }; - /** - * Clears the collection of active observations. - * - * @returns {void} - */ +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +var _useState3 = _interopRequireDefault(require("rc-util/es/hooks/useState")); - ResizeObserverSPI.prototype.clearActive = function () { - this.activeObservations_.splice(0); - }; - /** - * Tells whether observer has active observations. - * - * @returns {boolean} - */ +var React = _interopRequireWildcard(require("react")); +var _interface = require("../interface"); - ResizeObserverSPI.prototype.hasActive = function () { - return this.activeObservations_.length > 0; - }; +var _useIsomorphicLayoutEffect = _interopRequireDefault(require("./useIsomorphicLayoutEffect")); - return ResizeObserverSPI; -}(); // Registry of internal observers. If WeakMap is not available use current shim -// for the Map collection as it has all required methods and because WeakMap -// can't be fully polyfilled anyway. +var _useNextFrame3 = _interopRequireDefault(require("./useNextFrame")); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } -var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim(); -/** - * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation - * exposing only those methods and properties that are defined in the spec. - */ +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -var ResizeObserver = -/** @class */ -function () { - /** - * Creates a new instance of ResizeObserver. - * - * @param {ResizeObserverCallback} callback - Callback that is invoked when - * dimensions of the observed elements change. - */ - function ResizeObserver(callback) { - if (!(this instanceof ResizeObserver)) { - throw new TypeError('Cannot call a class as a function.'); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - if (!arguments.length) { - throw new TypeError('1 argument required, but only 0 present.'); - } +var FULL_STEP_QUEUE = [_interface.STEP_PREPARE, _interface.STEP_START, _interface.STEP_ACTIVE, _interface.STEP_ACTIVATED]; +var SIMPLE_STEP_QUEUE = [_interface.STEP_PREPARE, _interface.STEP_PREPARED]; +/** Skip current step */ - var controller = ResizeObserverController.getInstance(); - var observer = new ResizeObserverSPI(callback, controller, this); - observers.set(this, observer); - } +var SkipStep = false; +/** Current step should be update in */ - return ResizeObserver; -}(); // Expose public methods of ResizeObserver. +exports.SkipStep = SkipStep; +var DoStep = true; +exports.DoStep = DoStep; +function isActive(step) { + return step === _interface.STEP_ACTIVE || step === _interface.STEP_ACTIVATED; +} -['observe', 'unobserve', 'disconnect'].forEach(function (method) { - ResizeObserver.prototype[method] = function () { - var _a; +var _default = function _default(status, prepareOnly, callback) { + var _useState = (0, _useState3.default)(_interface.STEP_NONE), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + step = _useState2[0], + setStep = _useState2[1]; - return (_a = observers.get(this))[method].apply(_a, arguments); - }; -}); + var _useNextFrame = (0, _useNextFrame3.default)(), + _useNextFrame2 = (0, _slicedToArray2.default)(_useNextFrame, 2), + nextFrame = _useNextFrame2[0], + cancelNextFrame = _useNextFrame2[1]; -var index = function () { - // Export existing implementation if available. - if (typeof global$1.ResizeObserver !== 'undefined') { - return global$1.ResizeObserver; + function startQueue() { + setStep(_interface.STEP_PREPARE, true); } - return ResizeObserver; -}(); + var STEP_QUEUE = prepareOnly ? SIMPLE_STEP_QUEUE : FULL_STEP_QUEUE; + (0, _useIsomorphicLayoutEffect.default)(function () { + if (step !== _interface.STEP_NONE && step !== _interface.STEP_ACTIVATED) { + var index = STEP_QUEUE.indexOf(step); + var nextStep = STEP_QUEUE[index + 1]; + var result = callback(step); + + if (result === SkipStep) { + // Skip when no needed + setStep(nextStep, true); + } else if (nextStep) { + // Do as frame for step update + nextFrame(function (info) { + function doNext() { + // Skip since current queue is ood + if (info.isCanceled()) return; + setStep(nextStep, true); + } + + if (result === true) { + doNext(); + } else { + // Only promise should be async + Promise.resolve(result).then(doNext); + } + }); + } + } + }, [status, step]); + React.useEffect(function () { + return function () { + cancelNextFrame(); + }; + }, []); + return [startQueue, step]; +}; -var _default = index; exports.default = _default; -},{}],"aRxH":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","rc-util/es/hooks/useState":"nSoY","react":"n8MK","../interface":"pSvJ","./useIsomorphicLayoutEffect":"hYGK","./useNextFrame":"BUHO"}],"ICIf":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports._rs = exports._el = void 0; -exports.observe = observe; -exports.unobserve = unobserve; +exports.default = useStatus; -var _resizeObserverPolyfill = _interopRequireDefault(require("resize-observer-polyfill")); +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); -// =============================== Const =============================== -var elementListeners = new Map(); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); -function onResize(entities) { - entities.forEach(function (entity) { - var _elementListeners$get; +var _useState7 = _interopRequireDefault(require("rc-util/es/hooks/useState")); - var target = entity.target; - (_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 ? void 0 : _elementListeners$get.forEach(function (listener) { - return listener(target); - }); - }); -} // Note: ResizeObserver polyfill not support option to measure border-box resize +var React = _interopRequireWildcard(require("react")); +var _interface = require("../interface"); -var resizeObserver = new _resizeObserverPolyfill.default(onResize); // Dev env only +var _useDomMotionEvents3 = _interopRequireDefault(require("./useDomMotionEvents")); -var _el = "production" !== 'production' ? elementListeners : null; // eslint-disable-line +var _useIsomorphicLayoutEffect = _interopRequireDefault(require("./useIsomorphicLayoutEffect")); +var _useStepQueue3 = _interopRequireWildcard(require("./useStepQueue")); -exports._el = _el; +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } -var _rs = "production" !== 'production' ? onResize : null; // eslint-disable-line -// ============================== Observe ============================== +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -exports._rs = _rs; +function useStatus(supportMotion, visible, getElement, _ref) { + var _ref$motionEnter = _ref.motionEnter, + motionEnter = _ref$motionEnter === void 0 ? true : _ref$motionEnter, + _ref$motionAppear = _ref.motionAppear, + motionAppear = _ref$motionAppear === void 0 ? true : _ref$motionAppear, + _ref$motionLeave = _ref.motionLeave, + motionLeave = _ref$motionLeave === void 0 ? true : _ref$motionLeave, + motionDeadline = _ref.motionDeadline, + motionLeaveImmediately = _ref.motionLeaveImmediately, + onAppearPrepare = _ref.onAppearPrepare, + onEnterPrepare = _ref.onEnterPrepare, + onLeavePrepare = _ref.onLeavePrepare, + onAppearStart = _ref.onAppearStart, + onEnterStart = _ref.onEnterStart, + onLeaveStart = _ref.onLeaveStart, + onAppearActive = _ref.onAppearActive, + onEnterActive = _ref.onEnterActive, + onLeaveActive = _ref.onLeaveActive, + onAppearEnd = _ref.onAppearEnd, + onEnterEnd = _ref.onEnterEnd, + onLeaveEnd = _ref.onLeaveEnd, + onVisibleChanged = _ref.onVisibleChanged; // Used for outer render usage to avoid `visible: false & status: none` to render nothing -function observe(element, callback) { - if (!elementListeners.has(element)) { - elementListeners.set(element, new Set()); - resizeObserver.observe(element); - } + var _useState = (0, _useState7.default)(), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + asyncVisible = _useState2[0], + setAsyncVisible = _useState2[1]; - elementListeners.get(element).add(callback); -} + var _useState3 = (0, _useState7.default)(_interface.STATUS_NONE), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + status = _useState4[0], + setStatus = _useState4[1]; -function unobserve(element, callback) { - if (elementListeners.has(element)) { - elementListeners.get(element).delete(callback); + var _useState5 = (0, _useState7.default)(null), + _useState6 = (0, _slicedToArray2.default)(_useState5, 2), + style = _useState6[0], + setStyle = _useState6[1]; - if (!elementListeners.get(element).size) { - resizeObserver.unobserve(element); - elementListeners.delete(element); - } - } -} -},{"resize-observer-polyfill":"C4qV"}],"VEjx":[function(require,module,exports) { -"use strict"; + var mountedRef = (0, React.useRef)(false); + var deadlineRef = (0, React.useRef)(null); // =========================== Dom Node =========================== -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _classCallCheck; + function getDomElement() { + return getElement(); + } // ========================== Motion End ========================== -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} -},{}],"l5p4":[function(require,module,exports) { -"use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _createClass; + var activeRef = (0, React.useRef)(false); + /** + * Clean up status & style + */ -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); + function updateMotionEndStatus() { + setStatus(_interface.STATUS_NONE, true); + setStyle(null, true); } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - writable: false - }); - return Constructor; -} -},{}],"hewo":[function(require,module,exports) { -"use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _setPrototypeOf; + function onInternalMotionEnd(event) { + var element = getDomElement(); -function _setPrototypeOf(o, p) { - exports.default = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - return _setPrototypeOf(o, p); -} -},{}],"NT06":[function(require,module,exports) { -"use strict"; + if (event && !event.deadline && event.target !== element) { + // event exists + // not initiated by deadline + // transitionEnd not fired by inner elements + return; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _inherits; + var currentActive = activeRef.current; + var canEnd; -var _setPrototypeOf = _interopRequireDefault(require("./setPrototypeOf.js")); + if (status === _interface.STATUS_APPEAR && currentActive) { + canEnd = onAppearEnd === null || onAppearEnd === void 0 ? void 0 : onAppearEnd(element, event); + } else if (status === _interface.STATUS_ENTER && currentActive) { + canEnd = onEnterEnd === null || onEnterEnd === void 0 ? void 0 : onEnterEnd(element, event); + } else if (status === _interface.STATUS_LEAVE && currentActive) { + canEnd = onLeaveEnd === null || onLeaveEnd === void 0 ? void 0 : onLeaveEnd(element, event); + } // Only update status when `canEnd` and not destroyed -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + if (status !== _interface.STATUS_NONE && currentActive && canEnd !== false) { + updateMotionEndStatus(); + } } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - Object.defineProperty(subClass, "prototype", { - writable: false - }); - if (superClass) (0, _setPrototypeOf.default)(subClass, superClass); -} -},{"./setPrototypeOf.js":"hewo"}],"QQCW":[function(require,module,exports) { -"use strict"; + var _useDomMotionEvents = (0, _useDomMotionEvents3.default)(onInternalMotionEnd), + _useDomMotionEvents2 = (0, _slicedToArray2.default)(_useDomMotionEvents, 1), + patchMotionEvents = _useDomMotionEvents2[0]; // ============================= Step ============================= -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _getPrototypeOf; -function _getPrototypeOf(o) { - exports.default = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} -},{}],"h1Zy":[function(require,module,exports) { -"use strict"; + var getEventHandlers = function getEventHandlers(targetStatus) { + var _ref2, _ref3, _ref4; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _isNativeReflectConstruct; + switch (targetStatus) { + case _interface.STATUS_APPEAR: + return _ref2 = {}, (0, _defineProperty2.default)(_ref2, _interface.STEP_PREPARE, onAppearPrepare), (0, _defineProperty2.default)(_ref2, _interface.STEP_START, onAppearStart), (0, _defineProperty2.default)(_ref2, _interface.STEP_ACTIVE, onAppearActive), _ref2; -function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; + case _interface.STATUS_ENTER: + return _ref3 = {}, (0, _defineProperty2.default)(_ref3, _interface.STEP_PREPARE, onEnterPrepare), (0, _defineProperty2.default)(_ref3, _interface.STEP_START, onEnterStart), (0, _defineProperty2.default)(_ref3, _interface.STEP_ACTIVE, onEnterActive), _ref3; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} -},{}],"bk0i":[function(require,module,exports) { -"use strict"; + case _interface.STATUS_LEAVE: + return _ref4 = {}, (0, _defineProperty2.default)(_ref4, _interface.STEP_PREPARE, onLeavePrepare), (0, _defineProperty2.default)(_ref4, _interface.STEP_START, onLeaveStart), (0, _defineProperty2.default)(_ref4, _interface.STEP_ACTIVE, onLeaveActive), _ref4; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _assertThisInitialized; + default: + return {}; + } + }; -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } + var eventHandlers = React.useMemo(function () { + return getEventHandlers(status); + }, [status]); - return self; -} -},{}],"aBEI":[function(require,module,exports) { -"use strict"; + var _useStepQueue = (0, _useStepQueue3.default)(status, !supportMotion, function (newStep) { + // Only prepare step can be skip + if (newStep === _interface.STEP_PREPARE) { + var onPrepare = eventHandlers[_interface.STEP_PREPARE]; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _possibleConstructorReturn; + if (!onPrepare) { + return _useStepQueue3.SkipStep; + } -var _typeof2 = _interopRequireDefault(require("./typeof.js")); + return onPrepare(getDomElement()); + } // Rest step is sync update -var _assertThisInitialized = _interopRequireDefault(require("./assertThisInitialized.js")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (step in eventHandlers) { + var _eventHandlers$step; -function _possibleConstructorReturn(self, call) { - if (call && ((0, _typeof2.default)(call) === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } + setStyle(((_eventHandlers$step = eventHandlers[step]) === null || _eventHandlers$step === void 0 ? void 0 : _eventHandlers$step.call(eventHandlers, getDomElement(), null)) || null); + } - return (0, _assertThisInitialized.default)(self); -} -},{"./typeof.js":"xLw6","./assertThisInitialized.js":"bk0i"}],"m5aa":[function(require,module,exports) { -"use strict"; + if (step === _interface.STEP_ACTIVE) { + // Patch events when motion needed + patchMotionEvents(getDomElement()); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = _createSuper; + if (motionDeadline > 0) { + clearTimeout(deadlineRef.current); + deadlineRef.current = setTimeout(function () { + onInternalMotionEnd({ + deadline: true + }); + }, motionDeadline); + } + } -var _getPrototypeOf = _interopRequireDefault(require("./getPrototypeOf.js")); + if (step === _interface.STEP_PREPARED) { + updateMotionEndStatus(); + } -var _isNativeReflectConstruct = _interopRequireDefault(require("./isNativeReflectConstruct.js")); - -var _possibleConstructorReturn = _interopRequireDefault(require("./possibleConstructorReturn.js")); + return _useStepQueue3.DoStep; + }), + _useStepQueue2 = (0, _slicedToArray2.default)(_useStepQueue, 2), + startStep = _useStepQueue2[0], + step = _useStepQueue2[1]; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var active = (0, _useStepQueue3.isActive)(step); + activeRef.current = active; // ============================ Status ============================ + // Update with new status -function _createSuper(Derived) { - var hasNativeReflectConstruct = (0, _isNativeReflectConstruct.default)(); - return function _createSuperInternal() { - var Super = (0, _getPrototypeOf.default)(Derived), - result; + (0, _useIsomorphicLayoutEffect.default)(function () { + setAsyncVisible(visible); + var isMounted = mountedRef.current; + mountedRef.current = true; // if (!supportMotion) { + // return; + // } - if (hasNativeReflectConstruct) { - var NewTarget = (0, _getPrototypeOf.default)(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } + var nextStatus; // Appear - return (0, _possibleConstructorReturn.default)(this, result); - }; -} -},{"./getPrototypeOf.js":"QQCW","./isNativeReflectConstruct.js":"h1Zy","./possibleConstructorReturn.js":"aBEI"}],"uLNA":[function(require,module,exports) { -"use strict"; + if (!isMounted && visible && motionAppear) { + nextStatus = _interface.STATUS_APPEAR; + } // Enter -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck")); + if (isMounted && visible && motionEnter) { + nextStatus = _interface.STATUS_ENTER; + } // Leave -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass")); -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits")); + if (isMounted && !visible && motionLeave || !isMounted && motionLeaveImmediately && !visible && motionLeave) { + nextStatus = _interface.STATUS_LEAVE; + } -var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper")); + var nextEventHandlers = getEventHandlers(nextStatus); // Update to next status -var React = _interopRequireWildcard(require("react")); + if (nextStatus && (supportMotion || nextEventHandlers[_interface.STEP_PREPARE])) { + setStatus(nextStatus); + startStep(); + } else { + // Set back in case no motion but prev status has prepare step + setStatus(_interface.STATUS_NONE); + } + }, [visible]); // ============================ Effect ============================ + // Reset when motion changed -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + (0, React.useEffect)(function () { + if ( // Cancel appear + status === _interface.STATUS_APPEAR && !motionAppear || // Cancel enter + status === _interface.STATUS_ENTER && !motionEnter || // Cancel leave + status === _interface.STATUS_LEAVE && !motionLeave) { + setStatus(_interface.STATUS_NONE); + } + }, [motionAppear, motionEnter, motionLeave]); + (0, React.useEffect)(function () { + return function () { + mountedRef.current = false; + clearTimeout(deadlineRef.current); + }; + }, []); // Trigger `onVisibleChanged` -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + var firstMountChangeRef = React.useRef(false); + (0, React.useEffect)(function () { + // [visible & motion not end] => [!visible & motion end] still need trigger onVisibleChanged + if (asyncVisible) { + firstMountChangeRef.current = true; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (asyncVisible !== undefined && status === _interface.STATUS_NONE) { + // Skip first render is invisible since it's nothing changed + if (firstMountChangeRef.current || asyncVisible) { + onVisibleChanged === null || onVisibleChanged === void 0 ? void 0 : onVisibleChanged(asyncVisible); + } -/** - * Fallback to findDOMNode if origin ref do not provide any dom element - */ -var DomWrapper = /*#__PURE__*/function (_React$Component) { - (0, _inherits2.default)(DomWrapper, _React$Component); + firstMountChangeRef.current = true; + } + }, [asyncVisible, status]); // ============================ Styles ============================ - var _super = (0, _createSuper2.default)(DomWrapper); + var mergedStyle = style; - function DomWrapper() { - (0, _classCallCheck2.default)(this, DomWrapper); - return _super.apply(this, arguments); + if (eventHandlers[_interface.STEP_PREPARE] && step === _interface.STEP_START) { + mergedStyle = (0, _objectSpread2.default)({ + transition: 'none' + }, mergedStyle); } - (0, _createClass2.default)(DomWrapper, [{ - key: "render", - value: function render() { - return this.props.children; - } - }]); - return DomWrapper; -}(React.Component); - -exports.default = DomWrapper; -},{"@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","react":"n8MK"}],"Aa6e":[function(require,module,exports) { + return [status, step, mergedStyle, asyncVisible !== null && asyncVisible !== void 0 ? asyncVisible : visible]; +} +},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/slicedToArray":"T12H","rc-util/es/hooks/useState":"nSoY","react":"n8MK","../interface":"pSvJ","./useDomMotionEvents":"l4OM","./useIsomorphicLayoutEffect":"hYGK","./useStepQueue":"HO5D"}],"IrYG":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Collection = Collection; -exports.CollectionContext = void 0; - -var React = _interopRequireWildcard(require("react")); +exports.default = void 0; +exports.genCSSMotion = genCSSMotion; -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var CollectionContext = /*#__PURE__*/React.createContext(null); -/** - * Collect all the resize event from children ResizeObserver - */ +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); -exports.CollectionContext = CollectionContext; +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); -function Collection(_ref) { - var children = _ref.children, - onBatchResize = _ref.onBatchResize; - var resizeIdRef = React.useRef(0); - var resizeInfosRef = React.useRef([]); - var onCollectionResize = React.useContext(CollectionContext); - var onResize = React.useCallback(function (size, element, data) { - resizeIdRef.current += 1; - var currentId = resizeIdRef.current; - resizeInfosRef.current.push({ - size: size, - element: element, - data: data - }); - Promise.resolve().then(function () { - if (currentId === resizeIdRef.current) { - onBatchResize === null || onBatchResize === void 0 ? void 0 : onBatchResize(resizeInfosRef.current); - resizeInfosRef.current = []; - } - }); // Continue bubbling if parent exist +var _classnames = _interopRequireDefault(require("classnames")); - onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(size, element, data); - }, [onBatchResize, onCollectionResize]); - return /*#__PURE__*/React.createElement(CollectionContext.Provider, { - value: onResize - }, children); -} -},{"react":"n8MK"}],"bO8N":[function(require,module,exports) { -"use strict"; +var _findDOMNode = _interopRequireDefault(require("rc-util/es/Dom/findDOMNode")); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = SingleObserver; +var _ref2 = require("rc-util/es/ref"); -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); +var React = _interopRequireWildcard(require("react")); -var _ref = require("rc-util/es/ref"); +var _context = require("./context"); -var React = _interopRequireWildcard(require("react")); +var _DomWrapper = _interopRequireDefault(require("./DomWrapper")); -var _findDOMNode = _interopRequireDefault(require("rc-util/es/Dom/findDOMNode")); +var _useStatus3 = _interopRequireDefault(require("./hooks/useStatus")); -var _observerUtil = require("../utils/observerUtil"); +var _useStepQueue = require("./hooks/useStepQueue"); -var _DomWrapper = _interopRequireDefault(require("./DomWrapper")); +var _interface = require("./interface"); -var _Collection = require("../Collection"); +var _motion = require("./util/motion"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -3509,2000 +2766,2052 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function SingleObserver(props) { - var children = props.children, - disabled = props.disabled; - var elementRef = React.useRef(null); - var wrapperRef = React.useRef(null); - var onCollectionResize = React.useContext(_Collection.CollectionContext); // =========================== Children =========================== - - var isRenderProps = typeof children === 'function'; - var mergedChildren = isRenderProps ? children(elementRef) : children; // ============================= Size ============================= - - var sizeRef = React.useRef({ - width: -1, - height: -1, - offsetWidth: -1, - offsetHeight: -1 - }); // ============================= Ref ============================== +/* eslint-disable react/default-props-match-prop-types, react/no-multi-comp, react/prop-types */ - var canRef = !isRenderProps && /*#__PURE__*/React.isValidElement(mergedChildren) && (0, _ref.supportRef)(mergedChildren); - var originRef = canRef ? mergedChildren.ref : null; - var mergedRef = React.useMemo(function () { - return (0, _ref.composeRef)(originRef, elementRef); - }, [originRef, elementRef]); // =========================== Observe ============================ +/** + * `transitionSupport` is used for none transition test case. + * Default we use browser transition event support check. + */ +function genCSSMotion(config) { + var transitionSupport = config; - var propsRef = React.useRef(props); - propsRef.current = props; // Handler + if ((0, _typeof2.default)(config) === 'object') { + transitionSupport = config.transitionSupport; + } - var onInternalResize = React.useCallback(function (target) { - var _propsRef$current = propsRef.current, - onResize = _propsRef$current.onResize, - data = _propsRef$current.data; + function isSupportTransition(props, contextMotion) { + return !!(props.motionName && transitionSupport && contextMotion !== false); + } - var _target$getBoundingCl = target.getBoundingClientRect(), - width = _target$getBoundingCl.width, - height = _target$getBoundingCl.height; + var CSSMotion = /*#__PURE__*/React.forwardRef(function (props, ref) { + var _props$visible = props.visible, + visible = _props$visible === void 0 ? true : _props$visible, + _props$removeOnLeave = props.removeOnLeave, + removeOnLeave = _props$removeOnLeave === void 0 ? true : _props$removeOnLeave, + forceRender = props.forceRender, + children = props.children, + motionName = props.motionName, + leavedClassName = props.leavedClassName, + eventProps = props.eventProps; - var offsetWidth = target.offsetWidth, - offsetHeight = target.offsetHeight; - /** - * Resize observer trigger when content size changed. - * In most case we just care about element size, - * let's use `boundary` instead of `contentRect` here to avoid shaking. - */ + var _React$useContext = React.useContext(_context.Context), + contextMotion = _React$useContext.motion; - var fixedWidth = Math.floor(width); - var fixedHeight = Math.floor(height); + var supportMotion = isSupportTransition(props, contextMotion); // Ref to the react node, it may be a HTMLElement - if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) { - var size = { - width: fixedWidth, - height: fixedHeight, - offsetWidth: offsetWidth, - offsetHeight: offsetHeight - }; - sizeRef.current = size; // IE is strange, right? + var nodeRef = (0, React.useRef)(); // Ref to the dom wrapper in case ref can not pass to HTMLElement - var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth; - var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight; - var sizeInfo = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, size), {}, { - offsetWidth: mergedOffsetWidth, - offsetHeight: mergedOffsetHeight - }); // Let collection know what happened + var wrapperNodeRef = (0, React.useRef)(); - onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(sizeInfo, target, data); - - if (onResize) { - // defer the callback but not defer to next frame - Promise.resolve().then(function () { - onResize(sizeInfo, target); - }); + function getDomElement() { + try { + // Here we're avoiding call for findDOMNode since it's deprecated + // in strict mode. We're calling it only when node ref is not + // an instance of DOM HTMLElement. Otherwise use + // findDOMNode as a final resort + return nodeRef.current instanceof HTMLElement ? nodeRef.current : (0, _findDOMNode.default)(wrapperNodeRef.current); + } catch (e) { + // Only happen when `motionDeadline` trigger but element removed. + return null; } } - }, []); // Dynamic observe - - React.useEffect(function () { - var currentElement = (0, _findDOMNode.default)(elementRef.current) || (0, _findDOMNode.default)(wrapperRef.current); - - if (currentElement && !disabled) { - (0, _observerUtil.observe)(currentElement, onInternalResize); - } - return function () { - return (0, _observerUtil.unobserve)(currentElement, onInternalResize); - }; - }, [elementRef.current, disabled]); // ============================ Render ============================ + var _useStatus = (0, _useStatus3.default)(supportMotion, visible, getDomElement, props), + _useStatus2 = (0, _slicedToArray2.default)(_useStatus, 4), + status = _useStatus2[0], + statusStep = _useStatus2[1], + statusStyle = _useStatus2[2], + mergedVisible = _useStatus2[3]; // Record whether content has rendered + // Will return null for un-rendered even when `removeOnLeave={false}` - return /*#__PURE__*/React.createElement(_DomWrapper.default, { - ref: wrapperRef - }, canRef ? /*#__PURE__*/React.cloneElement(mergedChildren, { - ref: mergedRef - }) : mergedChildren); -} -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","rc-util/es/ref":"AOnv","react":"n8MK","rc-util/es/Dom/findDOMNode":"beML","../utils/observerUtil":"aRxH","./DomWrapper":"uLNA","../Collection":"Aa6e"}],"q9L5":[function(require,module,exports) { -"use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; + var renderedRef = React.useRef(mergedVisible); -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + if (mergedVisible) { + renderedRef.current = true; + } // ====================== Refs ====================== -var React = _interopRequireWildcard(require("react")); -var _toArray = _interopRequireDefault(require("rc-util/es/Children/toArray")); + var setNodeRef = React.useCallback(function (node) { + nodeRef.current = node; + (0, _ref2.fillRef)(ref, node); + }, [ref]); // ===================== Render ===================== -var _warning = require("rc-util/es/warning"); + var motionChildren; + var mergedProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, eventProps), {}, { + visible: visible + }); -var _SingleObserver = _interopRequireDefault(require("./SingleObserver")); + if (!children) { + // No children + motionChildren = null; + } else if (status === _interface.STATUS_NONE) { + // Stable children + if (mergedVisible) { + motionChildren = children((0, _objectSpread2.default)({}, mergedProps), setNodeRef); + } else if (!removeOnLeave && renderedRef.current && leavedClassName) { + motionChildren = children((0, _objectSpread2.default)((0, _objectSpread2.default)({}, mergedProps), {}, { + className: leavedClassName + }), setNodeRef); + } else if (forceRender || !removeOnLeave && !leavedClassName) { + motionChildren = children((0, _objectSpread2.default)((0, _objectSpread2.default)({}, mergedProps), {}, { + style: { + display: 'none' + } + }), setNodeRef); + } else { + motionChildren = null; + } + } else { + var _classNames; // In motion -var _Collection = require("./Collection"); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + var statusSuffix; -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + if (statusStep === _interface.STEP_PREPARE) { + statusSuffix = 'prepare'; + } else if ((0, _useStepQueue.isActive)(statusStep)) { + statusSuffix = 'active'; + } else if (statusStep === _interface.STEP_START) { + statusSuffix = 'start'; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var motionCls = (0, _motion.getTransitionName)(motionName, "".concat(status, "-").concat(statusSuffix)); + motionChildren = children((0, _objectSpread2.default)((0, _objectSpread2.default)({}, mergedProps), {}, { + className: (0, _classnames.default)((0, _motion.getTransitionName)(motionName, status), (_classNames = {}, (0, _defineProperty2.default)(_classNames, motionCls, motionCls && statusSuffix), (0, _defineProperty2.default)(_classNames, motionName, typeof motionName === 'string'), _classNames)), + style: statusStyle + }), setNodeRef); + } // Auto inject ref if child node not have `ref` props -var INTERNAL_PREFIX_KEY = 'rc-observer-key'; -function ResizeObserver(props) { - var children = props.children; - var childNodes = typeof children === 'function' ? [children] : (0, _toArray.default)(children); + if ( /*#__PURE__*/React.isValidElement(motionChildren) && (0, _ref2.supportRef)(motionChildren)) { + var _ref = motionChildren, + originNodeRef = _ref.ref; - if ("production" !== 'production') { - if (childNodes.length > 1) { - (0, _warning.warning)(false, 'Find more than one child node with `children` in ResizeObserver. Please use ResizeObserver.Collection instead.'); - } else if (childNodes.length === 0) { - (0, _warning.warning)(false, '`children` of ResizeObserver is empty. Nothing is in observe.'); + if (!originNodeRef) { + motionChildren = /*#__PURE__*/React.cloneElement(motionChildren, { + ref: setNodeRef + }); + } } - } - return childNodes.map(function (child, index) { - var key = (child === null || child === void 0 ? void 0 : child.key) || "".concat(INTERNAL_PREFIX_KEY, "-").concat(index); - return /*#__PURE__*/React.createElement(_SingleObserver.default, (0, _extends2.default)({}, props, { - key: key - }), child); + return /*#__PURE__*/React.createElement(_DomWrapper.default, { + ref: wrapperNodeRef + }, motionChildren); }); + CSSMotion.displayName = 'CSSMotion'; + return CSSMotion; } -ResizeObserver.Collection = _Collection.Collection; -var _default = ResizeObserver; +var _default = genCSSMotion(_motion.supportTransition); + exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","react":"n8MK","rc-util/es/Children/toArray":"artt","rc-util/es/warning":"YOfO","./SingleObserver":"bO8N","./Collection":"Aa6e"}],"LCWf":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/typeof":"xLw6","classnames":"yl9j","rc-util/es/Dom/findDOMNode":"JHqZ","rc-util/es/ref":"HPrS","react":"n8MK","./context":"EzWK","./DomWrapper":"uOw9","./hooks/useStatus":"ICIf","./hooks/useStepQueue":"HO5D","./interface":"pSvJ","./util/motion":"rGbI"}],"eyEg":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = useRaf; -exports.useRafState = useRafState; - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +exports.STATUS_REMOVED = exports.STATUS_REMOVE = exports.STATUS_KEEP = exports.STATUS_ADD = void 0; +exports.diffKeys = diffKeys; +exports.parseKeys = parseKeys; +exports.wrapKeyToObject = wrapKeyToObject; -var _react = require("react"); +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var _raf = _interopRequireDefault(require("rc-util/es/raf")); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function useRaf(callback) { - var rafRef = (0, _react.useRef)(); - var removedRef = (0, _react.useRef)(false); - - function trigger() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } +var STATUS_ADD = 'add'; +exports.STATUS_ADD = STATUS_ADD; +var STATUS_KEEP = 'keep'; +exports.STATUS_KEEP = STATUS_KEEP; +var STATUS_REMOVE = 'remove'; +exports.STATUS_REMOVE = STATUS_REMOVE; +var STATUS_REMOVED = 'removed'; +exports.STATUS_REMOVED = STATUS_REMOVED; - if (!removedRef.current) { - _raf.default.cancel(rafRef.current); +function wrapKeyToObject(key) { + var keyObj; - rafRef.current = (0, _raf.default)(function () { - callback.apply(void 0, args); - }); - } + if (key && (0, _typeof2.default)(key) === 'object' && 'key' in key) { + keyObj = key; + } else { + keyObj = { + key: key + }; } - (0, _react.useEffect)(function () { - //be compatible with react 18 StrictMode in dev - removedRef.current = false; - return function () { - removedRef.current = true; + return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, keyObj), {}, { + key: String(keyObj.key) + }); +} - _raf.default.cancel(rafRef.current); - }; - }, []); - return trigger; +function parseKeys() { + var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + return keys.map(wrapKeyToObject); } -function useRafState(defaultState) { - var batchRef = (0, _react.useRef)([]); +function diffKeys() { + var prevKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + var currentKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var list = []; + var currentIndex = 0; + var currentLen = currentKeys.length; + var prevKeyObjects = parseKeys(prevKeys); + var currentKeyObjects = parseKeys(currentKeys); // Check prev keys to insert or keep - var _useState = (0, _react.useState)({}), - _useState2 = (0, _slicedToArray2.default)(_useState, 2), - forceUpdate = _useState2[1]; + prevKeyObjects.forEach(function (keyObj) { + var hit = false; - var state = (0, _react.useRef)(typeof defaultState === 'function' ? defaultState() : defaultState); - var flushUpdate = useRaf(function () { - var current = state.current; - batchRef.current.forEach(function (callback) { - current = callback(current); - }); - batchRef.current = []; - state.current = current; - forceUpdate({}); - }); + for (var i = currentIndex; i < currentLen; i += 1) { + var currentKeyObj = currentKeyObjects[i]; - function updater(callback) { - batchRef.current.push(callback); - flushUpdate(); - } + if (currentKeyObj.key === keyObj.key) { + // New added keys should add before current key + if (currentIndex < i) { + list = list.concat(currentKeyObjects.slice(currentIndex, i).map(function (obj) { + return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, obj), {}, { + status: STATUS_ADD + }); + })); + currentIndex = i; + } - return [state.current, updater]; -} -},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/raf":"adDJ"}],"Imvn":[function(require,module,exports) { -"use strict"; + list.push((0, _objectSpread2.default)((0, _objectSpread2.default)({}, currentKeyObj), {}, { + status: STATUS_KEEP + })); + currentIndex += 1; + hit = true; + break; + } + } // If not hit, it means key is removed -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -/** - * @ignore - * some key-codes definition and utils from closure-library - * @author yiminghe@gmail.com - */ -var KeyCode = { - /** - * MAC_ENTER - */ - MAC_ENTER: 3, + if (!hit) { + list.push((0, _objectSpread2.default)((0, _objectSpread2.default)({}, keyObj), {}, { + status: STATUS_REMOVE + })); + } + }); // Add rest to the list + if (currentIndex < currentLen) { + list = list.concat(currentKeyObjects.slice(currentIndex).map(function (obj) { + return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, obj), {}, { + status: STATUS_ADD + }); + })); + } /** - * BACKSPACE + * Merge same key when it remove and add again: + * [1 - add, 2 - keep, 1 - remove] -> [1 - keep, 2 - keep] */ - BACKSPACE: 8, - /** - * TAB - */ - TAB: 9, - /** - * NUMLOCK on FF/Safari Mac - */ - NUM_CENTER: 12, - - /** - * ENTER - */ - ENTER: 13, + var keys = {}; + list.forEach(function (_ref) { + var key = _ref.key; + keys[key] = (keys[key] || 0) + 1; + }); + var duplicatedKeys = Object.keys(keys).filter(function (key) { + return keys[key] > 1; + }); + duplicatedKeys.forEach(function (matchKey) { + // Remove `STATUS_REMOVE` node. + list = list.filter(function (_ref2) { + var key = _ref2.key, + status = _ref2.status; + return key !== matchKey || status !== STATUS_REMOVE; + }); // Update `STATUS_ADD` to `STATUS_KEEP` - /** - * SHIFT - */ - SHIFT: 16, + list.forEach(function (node) { + if (node.key === matchKey) { + // eslint-disable-next-line no-param-reassign + node.status = STATUS_KEEP; + } + }); + }); + return list; +} +},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/typeof":"xLw6"}],"gQ2C":[function(require,module,exports) { +"use strict"; - /** - * CTRL - */ - CTRL: 17, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +exports.genCSSMotionList = genCSSMotionList; - /** - * ALT - */ - ALT: 18, +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); - /** - * PAUSE - */ - PAUSE: 19, +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); - /** - * CAPS_LOCK - */ - CAPS_LOCK: 20, +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); - /** - * ESC - */ - ESC: 27, +var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck")); - /** - * SPACE - */ - SPACE: 32, +var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass")); - /** - * PAGE_UP - */ - PAGE_UP: 33, +var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/assertThisInitialized")); - /** - * PAGE_DOWN - */ - PAGE_DOWN: 34, +var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits")); - /** - * END - */ - END: 35, +var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper")); - /** - * HOME - */ - HOME: 36, +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); - /** - * LEFT - */ - LEFT: 37, +var React = _interopRequireWildcard(require("react")); - /** - * UP - */ - UP: 38, +var _CSSMotion = _interopRequireDefault(require("./CSSMotion")); - /** - * RIGHT - */ - RIGHT: 39, +var _diff = require("./util/diff"); - /** - * DOWN - */ - DOWN: 40, +var _motion = require("./util/motion"); - /** - * PRINT_SCREEN - */ - PRINT_SCREEN: 44, +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - /** - * INSERT - */ - INSERT: 45, +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - /** - * DELETE - */ - DELETE: 46, +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - /** - * ZERO - */ - ZERO: 48, +var _excluded = ["component", "children", "onVisibleChanged", "onAllRemoved"], + _excluded2 = ["status"]; +/* eslint react/prop-types: 0 */ - /** - * ONE - */ - ONE: 49, +var MOTION_PROP_NAMES = ['eventProps', 'visible', 'children', 'motionName', 'motionAppear', 'motionEnter', 'motionLeave', 'motionLeaveImmediately', 'motionDeadline', 'removeOnLeave', 'leavedClassName', 'onAppearPrepare', 'onAppearStart', 'onAppearActive', 'onAppearEnd', 'onEnterStart', 'onEnterActive', 'onEnterEnd', 'onLeaveStart', 'onLeaveActive', 'onLeaveEnd']; +/** + * Generate a CSSMotionList component with config + * @param transitionSupport No need since CSSMotionList no longer depends on transition support + * @param CSSMotion CSSMotion component + */ - /** - * TWO - */ - TWO: 50, +function genCSSMotionList(transitionSupport) { + var CSSMotion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _CSSMotion.default; - /** - * THREE - */ - THREE: 51, + var CSSMotionList = /*#__PURE__*/function (_React$Component) { + (0, _inherits2.default)(CSSMotionList, _React$Component); - /** - * FOUR - */ - FOUR: 52, + var _super = (0, _createSuper2.default)(CSSMotionList); - /** - * FIVE - */ - FIVE: 53, + function CSSMotionList() { + var _this; - /** - * SIX - */ - SIX: 54, + (0, _classCallCheck2.default)(this, CSSMotionList); - /** - * SEVEN - */ - SEVEN: 55, + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } - /** - * EIGHT - */ - EIGHT: 56, + _this = _super.call.apply(_super, [this].concat(args)); + (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", { + keyEntities: [] + }); // ZombieJ: Return the count of rest keys. It's safe to refactor if need more info. - /** - * NINE - */ - NINE: 57, + (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "removeKey", function (removeKey) { + var keyEntities = _this.state.keyEntities; + var nextKeyEntities = keyEntities.map(function (entity) { + if (entity.key !== removeKey) return entity; + return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, entity), {}, { + status: _diff.STATUS_REMOVED + }); + }); - /** - * QUESTION_MARK - */ - QUESTION_MARK: 63, + _this.setState({ + keyEntities: nextKeyEntities + }); - /** - * A - */ - A: 65, + return nextKeyEntities.filter(function (_ref) { + var status = _ref.status; + return status !== _diff.STATUS_REMOVED; + }).length; + }); + return _this; + } - /** - * B - */ - B: 66, + (0, _createClass2.default)(CSSMotionList, [{ + key: "render", + value: function render() { + var _this2 = this; - /** - * C - */ - C: 67, + var keyEntities = this.state.keyEntities; + var _this$props = this.props, + component = _this$props.component, + children = _this$props.children, + _onVisibleChanged = _this$props.onVisibleChanged, + onAllRemoved = _this$props.onAllRemoved, + restProps = (0, _objectWithoutProperties2.default)(_this$props, _excluded); + var Component = component || React.Fragment; + var motionProps = {}; + MOTION_PROP_NAMES.forEach(function (prop) { + motionProps[prop] = restProps[prop]; + delete restProps[prop]; + }); + delete restProps.keys; + return /*#__PURE__*/React.createElement(Component, restProps, keyEntities.map(function (_ref2, index) { + var status = _ref2.status, + eventProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2); + var visible = status === _diff.STATUS_ADD || status === _diff.STATUS_KEEP; + return /*#__PURE__*/React.createElement(CSSMotion, (0, _extends2.default)({}, motionProps, { + key: eventProps.key, + visible: visible, + eventProps: eventProps, + onVisibleChanged: function onVisibleChanged(changedVisible) { + _onVisibleChanged === null || _onVisibleChanged === void 0 ? void 0 : _onVisibleChanged(changedVisible, { + key: eventProps.key + }); - /** - * D - */ - D: 68, + if (!changedVisible) { + var restKeysCount = _this2.removeKey(eventProps.key); - /** - * E - */ - E: 69, + if (restKeysCount === 0 && onAllRemoved) { + onAllRemoved(); + } + } + } + }), function (props, ref) { + return children((0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, { + index: index + }), ref); + }); + })); + } + }], [{ + key: "getDerivedStateFromProps", + value: function getDerivedStateFromProps(_ref3, _ref4) { + var keys = _ref3.keys; + var keyEntities = _ref4.keyEntities; + var parsedKeyObjects = (0, _diff.parseKeys)(keys); + var mixedKeyEntities = (0, _diff.diffKeys)(keyEntities, parsedKeyObjects); + return { + keyEntities: mixedKeyEntities.filter(function (entity) { + var prevEntity = keyEntities.find(function (_ref5) { + var key = _ref5.key; + return entity.key === key; + }); // Remove if already mark as removed - /** - * F - */ - F: 70, + if (prevEntity && prevEntity.status === _diff.STATUS_REMOVED && entity.status === _diff.STATUS_REMOVE) { + return false; + } - /** - * G - */ - G: 71, + return true; + }) + }; + } + }]); + return CSSMotionList; + }(React.Component); - /** - * H - */ - H: 72, + (0, _defineProperty2.default)(CSSMotionList, "defaultProps", { + component: 'div' + }); + return CSSMotionList; +} - /** - * I - */ - I: 73, +var _default = genCSSMotionList(_motion.supportTransition); - /** - * J - */ - J: 74, +exports.default = _default; +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/assertThisInitialized":"bk0i","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","@babel/runtime/helpers/esm/defineProperty":"gpd2","react":"n8MK","./CSSMotion":"IrYG","./util/diff":"eyEg","./util/motion":"rGbI"}],"Gmdd":[function(require,module,exports) { +"use strict"; - /** - * K - */ - K: 75, +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "CSSMotionList", { + enumerable: true, + get: function () { + return _CSSMotionList.default; + } +}); +Object.defineProperty(exports, "Provider", { + enumerable: true, + get: function () { + return _context.default; + } +}); +exports.default = void 0; - /** - * L - */ - L: 76, +var _CSSMotion = _interopRequireDefault(require("./CSSMotion")); - /** - * M - */ - M: 77, +var _CSSMotionList = _interopRequireDefault(require("./CSSMotionList")); - /** - * N - */ - N: 78, +var _context = _interopRequireDefault(require("./context")); - /** - * O - */ - O: 79, +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - /** - * P - */ - P: 80, +var _default = _CSSMotion.default; +exports.default = _default; +},{"./CSSMotion":"IrYG","./CSSMotionList":"gQ2C","./context":"EzWK"}],"vHWa":[function(require,module,exports) { +"use strict"; - /** - * Q - */ - Q: 81, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - /** - * R - */ - R: 82, +var _react = require("react"); - /** - * S - */ - S: 83, +var _default = /*#__PURE__*/(0, _react.createContext)(null); - /** - * T - */ - T: 84, +exports.default = _default; +},{"react":"n8MK"}],"Fb5J":[function(require,module,exports) { +"use strict"; - /** - * U - */ - U: 85, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - /** - * V - */ - V: 86, +var React = _interopRequireWildcard(require("react")); - /** - * W - */ - W: 87, +var _classnames = _interopRequireDefault(require("classnames")); - /** - * X - */ - X: 88, +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - /** - * Y - */ - Y: 89, +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - /** - * Z - */ - Z: 90, +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - /** - * META - */ - META: 91, +var TabPane = /*#__PURE__*/React.forwardRef(function (_ref, ref) { + var prefixCls = _ref.prefixCls, + className = _ref.className, + style = _ref.style, + id = _ref.id, + active = _ref.active, + tabKey = _ref.tabKey, + children = _ref.children; + return /*#__PURE__*/React.createElement("div", { + id: id && "".concat(id, "-panel-").concat(tabKey), + role: "tabpanel", + tabIndex: active ? 0 : -1, + "aria-labelledby": id && "".concat(id, "-tab-").concat(tabKey), + "aria-hidden": !active, + style: style, + className: (0, _classnames.default)(prefixCls, active && "".concat(prefixCls, "-active"), className), + ref: ref + }, children); +}); - /** - * WIN_KEY_RIGHT - */ - WIN_KEY_RIGHT: 92, +if ("production" !== 'production') { + TabPane.displayName = 'TabPane'; +} - /** - * CONTEXT_MENU - */ - CONTEXT_MENU: 93, +var _default = TabPane; +exports.default = _default; +},{"react":"n8MK","classnames":"yl9j"}],"om2l":[function(require,module,exports) { +"use strict"; - /** - * NUM_ZERO - */ - NUM_ZERO: 96, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = TabPanelList; - /** - * NUM_ONE - */ - NUM_ONE: 97, +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); - /** - * NUM_TWO - */ - NUM_TWO: 98, +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); - /** - * NUM_THREE - */ - NUM_THREE: 99, +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); - /** - * NUM_FOUR - */ - NUM_FOUR: 100, +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); - /** - * NUM_FIVE - */ - NUM_FIVE: 101, +var React = _interopRequireWildcard(require("react")); - /** - * NUM_SIX - */ - NUM_SIX: 102, +var _classnames = _interopRequireDefault(require("classnames")); - /** - * NUM_SEVEN - */ - NUM_SEVEN: 103, +var _rcMotion = _interopRequireDefault(require("rc-motion")); - /** - * NUM_EIGHT - */ - NUM_EIGHT: 104, +var _TabContext = _interopRequireDefault(require("../TabContext")); - /** - * NUM_NINE - */ - NUM_NINE: 105, +var _TabPane = _interopRequireDefault(require("./TabPane")); - /** - * NUM_MULTIPLY - */ - NUM_MULTIPLY: 106, +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - /** - * NUM_PLUS - */ - NUM_PLUS: 107, +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - /** - * NUM_MINUS - */ - NUM_MINUS: 109, +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - /** - * NUM_PERIOD - */ - NUM_PERIOD: 110, +var _excluded = ["key", "forceRender", "style", "className"]; - /** - * NUM_DIVISION - */ - NUM_DIVISION: 111, +function TabPanelList(_ref) { + var id = _ref.id, + activeKey = _ref.activeKey, + animated = _ref.animated, + tabPosition = _ref.tabPosition, + destroyInactiveTabPane = _ref.destroyInactiveTabPane; - /** - * F1 - */ - F1: 112, + var _React$useContext = React.useContext(_TabContext.default), + prefixCls = _React$useContext.prefixCls, + tabs = _React$useContext.tabs; - /** - * F2 - */ - F2: 113, + var tabPaneAnimated = animated.tabPane; + var tabPanePrefixCls = "".concat(prefixCls, "-tabpane"); + return /*#__PURE__*/React.createElement("div", { + className: (0, _classnames.default)("".concat(prefixCls, "-content-holder")) + }, /*#__PURE__*/React.createElement("div", { + className: (0, _classnames.default)("".concat(prefixCls, "-content"), "".concat(prefixCls, "-content-").concat(tabPosition), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-content-animated"), tabPaneAnimated)) + }, tabs.map(function (_ref2) { + var key = _ref2.key, + forceRender = _ref2.forceRender, + paneStyle = _ref2.style, + paneClassName = _ref2.className, + restTabProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded); + var active = key === activeKey; + return /*#__PURE__*/React.createElement(_rcMotion.default, (0, _extends2.default)({ + key: key, + visible: active, + forceRender: forceRender, + removeOnLeave: !!destroyInactiveTabPane, + leavedClassName: "".concat(tabPanePrefixCls, "-hidden") + }, animated.tabPaneMotion), function (_ref3, ref) { + var motionStyle = _ref3.style, + motionClassName = _ref3.className; + return /*#__PURE__*/React.createElement(_TabPane.default, (0, _extends2.default)({}, restTabProps, { + prefixCls: tabPanePrefixCls, + id: id, + tabKey: key, + animated: tabPaneAnimated, + active: active, + style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, paneStyle), motionStyle), + className: (0, _classnames.default)(paneClassName, motionClassName), + ref: ref + })); + }); + }))); +} +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/defineProperty":"gpd2","react":"n8MK","classnames":"yl9j","rc-motion":"Gmdd","../TabContext":"vHWa","./TabPane":"Fb5J"}],"vw6u":[function(require,module,exports) { +"use strict"; - /** - * F3 - */ - F3: 114, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _arrayWithoutHoles; - /** - * F4 - */ - F4: 115, +var _arrayLikeToArray = _interopRequireDefault(require("./arrayLikeToArray.js")); - /** - * F5 - */ - F5: 116, +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - /** - * F6 - */ - F6: 117, +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return (0, _arrayLikeToArray.default)(arr); +} +},{"./arrayLikeToArray.js":"rI22"}],"bG0g":[function(require,module,exports) { +"use strict"; - /** - * F7 - */ - F7: 118, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _iterableToArray; - /** - * F8 - */ - F8: 119, +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); +} +},{}],"gdEH":[function(require,module,exports) { +"use strict"; - /** - * F9 - */ - F9: 120, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _nonIterableSpread; - /** - * F10 - */ - F10: 121, +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."); +} +},{}],"Qv3s":[function(require,module,exports) { +"use strict"; - /** - * F11 - */ - F11: 122, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = _toConsumableArray; - /** - * F12 - */ - F12: 123, +var _arrayWithoutHoles = _interopRequireDefault(require("./arrayWithoutHoles.js")); - /** - * NUMLOCK - */ - NUMLOCK: 144, +var _iterableToArray = _interopRequireDefault(require("./iterableToArray.js")); - /** - * SEMICOLON - */ - SEMICOLON: 186, +var _unsupportedIterableToArray = _interopRequireDefault(require("./unsupportedIterableToArray.js")); - /** - * DASH - */ - DASH: 189, +var _nonIterableSpread = _interopRequireDefault(require("./nonIterableSpread.js")); - /** - * EQUALS - */ - EQUALS: 187, +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - /** - * COMMA - */ - COMMA: 188, +function _toConsumableArray(arr) { + return (0, _arrayWithoutHoles.default)(arr) || (0, _iterableToArray.default)(arr) || (0, _unsupportedIterableToArray.default)(arr) || (0, _nonIterableSpread.default)(); +} +},{"./arrayWithoutHoles.js":"vw6u","./iterableToArray.js":"bG0g","./unsupportedIterableToArray.js":"AOxl","./nonIterableSpread.js":"gdEH"}],"H1RQ":[function(require,module,exports) { +'use strict'; - /** - * PERIOD - */ - PERIOD: 190, +if ("production" === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} +},{"./cjs/react-is.production.min.js":"FIdW"}],"artt":[function(require,module,exports) { +"use strict"; - /** - * SLASH - */ - SLASH: 191, +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = toArray; - /** - * APOSTROPHE - */ - APOSTROPHE: 192, +var _react = _interopRequireDefault(require("react")); - /** - * SINGLE_QUOTE - */ - SINGLE_QUOTE: 222, +var _reactIs = require("react-is"); - /** - * OPEN_SQUARE_BRACKET - */ - OPEN_SQUARE_BRACKET: 219, +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - /** - * BACKSLASH - */ - BACKSLASH: 220, +function toArray(children) { + var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var ret = []; - /** - * CLOSE_SQUARE_BRACKET - */ - CLOSE_SQUARE_BRACKET: 221, + _react.default.Children.forEach(children, function (child) { + if ((child === undefined || child === null) && !option.keepEmpty) { + return; + } - /** - * WIN_KEY - */ - WIN_KEY: 224, + if (Array.isArray(child)) { + ret = ret.concat(toArray(child)); + } else if ((0, _reactIs.isFragment)(child) && child.props) { + ret = ret.concat(toArray(child.props.children, option)); + } else { + ret.push(child); + } + }); - /** - * MAC_FF_META - */ - MAC_FF_META: 224, + return ret; +} +},{"react":"n8MK","react-is":"H1RQ"}],"YOfO":[function(require,module,exports) { +"use strict"; - /** - * WIN_IME - */ - WIN_IME: 229, - // ======================== Function ======================== +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.call = call; +exports.default = void 0; +exports.note = note; +exports.noteOnce = noteOnce; +exports.resetWarned = resetWarned; +exports.warning = warning; +exports.warningOnce = warningOnce; - /** - * whether text and modified key is entered at the same time. - */ - isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) { - var keyCode = e.keyCode; +/* eslint-disable no-console */ +var warned = {}; - if (e.altKey && !e.ctrlKey || e.metaKey || // Function keys don't generate text - keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { - return false; - } // The following keys are quite harmless, even in combination with - // CTRL, ALT or SHIFT. +function warning(valid, message) { + // Support uglify + if ("production" !== 'production' && !valid && console !== undefined) { + console.error("Warning: ".concat(message)); + } +} +function note(valid, message) { + // Support uglify + if ("production" !== 'production' && !valid && console !== undefined) { + console.warn("Note: ".concat(message)); + } +} - switch (keyCode) { - case KeyCode.ALT: - case KeyCode.CAPS_LOCK: - case KeyCode.CONTEXT_MENU: - case KeyCode.CTRL: - case KeyCode.DOWN: - case KeyCode.END: - case KeyCode.ESC: - case KeyCode.HOME: - case KeyCode.INSERT: - case KeyCode.LEFT: - case KeyCode.MAC_FF_META: - case KeyCode.META: - case KeyCode.NUMLOCK: - case KeyCode.NUM_CENTER: - case KeyCode.PAGE_DOWN: - case KeyCode.PAGE_UP: - case KeyCode.PAUSE: - case KeyCode.PRINT_SCREEN: - case KeyCode.RIGHT: - case KeyCode.SHIFT: - case KeyCode.UP: - case KeyCode.WIN_KEY: - case KeyCode.WIN_KEY_RIGHT: - return false; - - default: - return true; - } - }, - - /** - * whether character is entered. - */ - isCharacterKey: function isCharacterKey(keyCode) { - if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { - return true; - } - - if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { - return true; - } +function resetWarned() { + warned = {}; +} - if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { - return true; - } // Safari sends zero key code for non-latin characters. +function call(method, valid, message) { + if (!valid && !warned[message]) { + method(false, message); + warned[message] = true; + } +} +function warningOnce(valid, message) { + call(warning, valid, message); +} - if (window.navigator.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { - return true; - } +function noteOnce(valid, message) { + call(note, valid, message); +} - switch (keyCode) { - case KeyCode.SPACE: - case KeyCode.QUESTION_MARK: - case KeyCode.NUM_PLUS: - case KeyCode.NUM_MINUS: - case KeyCode.NUM_PERIOD: - case KeyCode.NUM_DIVISION: - case KeyCode.SEMICOLON: - case KeyCode.DASH: - case KeyCode.EQUALS: - case KeyCode.COMMA: - case KeyCode.PERIOD: - case KeyCode.SLASH: - case KeyCode.APOSTROPHE: - case KeyCode.SINGLE_QUOTE: - case KeyCode.OPEN_SQUARE_BRACKET: - case KeyCode.BACKSLASH: - case KeyCode.CLOSE_SQUARE_BRACKET: - return true; +var _default = warningOnce; +/* eslint-enable */ - default: - return false; - } - } -}; -var _default = KeyCode; exports.default = _default; -},{}],"VleC":[function(require,module,exports) { +},{}],"AOnv":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); - -var React = _interopRequireWildcard(require("react")); - -var _classnames = _interopRequireDefault(require("classnames")); +exports.composeRef = composeRef; +exports.fillRef = fillRef; +exports.supportRef = supportRef; +exports.useComposeRef = useComposeRef; -var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _reactIs = require("react-is"); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _useMemo = _interopRequireDefault(require("./hooks/useMemo")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function TabNode(_ref, ref) { - var _classNames; - - var prefixCls = _ref.prefixCls, - id = _ref.id, - active = _ref.active, - _ref$tab = _ref.tab, - key = _ref$tab.key, - tab = _ref$tab.tab, - disabled = _ref$tab.disabled, - closeIcon = _ref$tab.closeIcon, - closable = _ref.closable, - renderWrapper = _ref.renderWrapper, - removeAriaLabel = _ref.removeAriaLabel, - editable = _ref.editable, - onClick = _ref.onClick, - onRemove = _ref.onRemove, - onFocus = _ref.onFocus, - style = _ref.style; - var tabPrefix = "".concat(prefixCls, "-tab"); - React.useEffect(function () { - return onRemove; - }, []); - var removable = editable && closable !== false && !disabled; - - function onInternalClick(e) { - if (disabled) { - return; - } - - onClick(e); - } - - function onRemoveTab(event) { - event.preventDefault(); - event.stopPropagation(); - editable.onEdit('remove', { - key: key, - event: event - }); +function fillRef(ref, node) { + if (typeof ref === 'function') { + ref(node); + } else if ((0, _typeof2.default)(ref) === 'object' && ref && 'current' in ref) { + ref.current = node; } - - var node = /*#__PURE__*/React.createElement("div", { - key: key, - ref: ref, - className: (0, _classnames.default)(tabPrefix, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(tabPrefix, "-with-remove"), removable), (0, _defineProperty2.default)(_classNames, "".concat(tabPrefix, "-active"), active), (0, _defineProperty2.default)(_classNames, "".concat(tabPrefix, "-disabled"), disabled), _classNames)), - style: style, - onClick: onInternalClick - }, /*#__PURE__*/React.createElement("div", { - role: "tab", - "aria-selected": active, - id: id && "".concat(id, "-tab-").concat(key), - className: "".concat(tabPrefix, "-btn"), - "aria-controls": id && "".concat(id, "-panel-").concat(key), - "aria-disabled": disabled, - tabIndex: disabled ? null : 0, - onClick: function onClick(e) { - e.stopPropagation(); - onInternalClick(e); - }, - onKeyDown: function onKeyDown(e) { - if ([_KeyCode.default.SPACE, _KeyCode.default.ENTER].includes(e.which)) { - e.preventDefault(); - onInternalClick(e); - } - }, - onFocus: onFocus - }, tab), removable && /*#__PURE__*/React.createElement("button", { - type: "button", - "aria-label": removeAriaLabel || 'remove', - tabIndex: 0, - className: "".concat(tabPrefix, "-remove"), - onClick: function onClick(e) { - e.stopPropagation(); - onRemoveTab(e); - } - }, closeIcon || editable.removeIcon || '×')); - return renderWrapper ? renderWrapper(node) : node; } +/** + * Merge refs into one ref function to support ref passing. + */ -var _default = /*#__PURE__*/React.forwardRef(TabNode); - -exports.default = _default; -},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","react":"n8MK","classnames":"qb7c","rc-util/es/KeyCode":"Imvn"}],"uhKO":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = useOffsets; - -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var _react = require("react"); +function composeRef() { + for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { + refs[_key] = arguments[_key]; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var refList = refs.filter(function (ref) { + return ref; + }); -var DEFAULT_SIZE = { - width: 0, - height: 0, - left: 0, - top: 0 -}; + if (refList.length <= 1) { + return refList[0]; + } -function useOffsets(tabs, tabSizes, holderScrollWidth) { - return (0, _react.useMemo)(function () { - var _tabs$; + return function (node) { + refs.forEach(function (ref) { + fillRef(ref, node); + }); + }; +} - var map = new Map(); - var lastOffset = tabSizes.get((_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.key) || DEFAULT_SIZE; - var rightOffset = lastOffset.left + lastOffset.width; +function useComposeRef() { + for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + refs[_key2] = arguments[_key2]; + } - for (var i = 0; i < tabs.length; i += 1) { - var key = tabs[i].key; - var data = tabSizes.get(key); // Reuse last one when not exist yet + return (0, _useMemo.default)(function () { + return composeRef.apply(void 0, refs); + }, refs, function (prev, next) { + return prev.length === next.length && prev.every(function (ref, i) { + return ref === next[i]; + }); + }); +} - if (!data) { - var _tabs; +function supportRef(nodeOrComponent) { + var _type$prototype, _nodeOrComponent$prot; - data = tabSizes.get((_tabs = tabs[i - 1]) === null || _tabs === void 0 ? void 0 : _tabs.key) || DEFAULT_SIZE; - } + var type = (0, _reactIs.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type; // Function component node - var entity = map.get(key) || (0, _objectSpread2.default)({}, data); // Right + if (typeof type === 'function' && !((_type$prototype = type.prototype) === null || _type$prototype === void 0 ? void 0 : _type$prototype.render)) { + return false; + } // Class component - entity.right = rightOffset - entity.left - entity.width; // Update entity - map.set(key, entity); - } + if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) === null || _nodeOrComponent$prot === void 0 ? void 0 : _nodeOrComponent$prot.render)) { + return false; + } - return map; - }, [tabs.map(function (tab) { - return tab.key; - }).join('_'), tabSizes, holderScrollWidth]); + return true; } -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK"}],"eQ4Y":[function(require,module,exports) { +/* eslint-enable */ +},{"@babel/runtime/helpers/esm/typeof":"xLw6","react-is":"H1RQ","./hooks/useMemo":"YcSF"}],"C4qV":[function(require,module,exports) { +var global = arguments[3]; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = useVisibleRange; - -var _react = require("react"); - -var DEFAULT_SIZE = { - width: 0, - height: 0, - left: 0, - top: 0, - right: 0 -}; +exports.default = void 0; -function useVisibleRange(tabOffsets, containerSize, tabContentNodeSize, addNodeSize, _ref) { - var tabs = _ref.tabs, - tabPosition = _ref.tabPosition, - rtl = _ref.rtl; - var unit; - var position; - var transformSize; +/** + * A collection of shims that provide minimal functionality of the ES6 collections. + * + * These implementations are not meant to be used outside of the ResizeObserver + * modules as they cover only a limited range of use cases. + */ - if (['top', 'bottom'].includes(tabPosition)) { - unit = 'width'; - position = rtl ? 'right' : 'left'; - transformSize = Math.abs(containerSize.left); - } else { - unit = 'height'; - position = 'top'; - transformSize = -containerSize.top; +/* eslint-disable require-jsdoc, valid-jsdoc */ +var MapShim = function () { + if (typeof Map !== 'undefined') { + return Map; } + /** + * Returns index in provided array that matches the specified key. + * + * @param {Array} arr + * @param {*} key + * @returns {number} + */ - var basicSize = containerSize[unit]; - var tabContentSize = tabContentNodeSize[unit]; - var addSize = addNodeSize[unit]; - var mergedBasicSize = basicSize; - if (tabContentSize + addSize > basicSize && tabContentSize < basicSize) { - mergedBasicSize = basicSize - addSize; + function getIndex(arr, key) { + var result = -1; + arr.some(function (entry, index) { + if (entry[0] === key) { + result = index; + return true; + } + + return false; + }); + return result; } - return (0, _react.useMemo)(function () { - if (!tabs.length) { - return [0, 0]; - } + return ( + /** @class */ + function () { + function class_1() { + this.__entries__ = []; + } - var len = tabs.length; - var endIndex = len; + Object.defineProperty(class_1.prototype, "size", { + /** + * @returns {boolean} + */ + get: function () { + return this.__entries__.length; + }, + enumerable: true, + configurable: true + }); + /** + * @param {*} key + * @returns {*} + */ - for (var i = 0; i < len; i += 1) { - var offset = tabOffsets.get(tabs[i].key) || DEFAULT_SIZE; + class_1.prototype.get = function (key) { + var index = getIndex(this.__entries__, key); + var entry = this.__entries__[index]; + return entry && entry[1]; + }; + /** + * @param {*} key + * @param {*} value + * @returns {void} + */ - if (offset[position] + offset[unit] > transformSize + mergedBasicSize) { - endIndex = i - 1; - break; - } - } - var startIndex = 0; + class_1.prototype.set = function (key, value) { + var index = getIndex(this.__entries__, key); - for (var _i = len - 1; _i >= 0; _i -= 1) { - var _offset = tabOffsets.get(tabs[_i].key) || DEFAULT_SIZE; + if (~index) { + this.__entries__[index][1] = value; + } else { + this.__entries__.push([key, value]); + } + }; + /** + * @param {*} key + * @returns {void} + */ - if (_offset[position] < transformSize) { - startIndex = _i + 1; - break; - } - } - return [startIndex, endIndex]; - }, [tabOffsets, transformSize, mergedBasicSize, tabPosition, tabs.map(function (tab) { - return tab.key; - }).join('_'), rtl]); -} -},{"react":"n8MK"}],"pz6A":[function(require,module,exports) { -// + class_1.prototype.delete = function (key) { + var entries = this.__entries__; + var index = getIndex(entries, key); -module.exports = function shallowEqual(objA, objB, compare, compareContext) { - var ret = compare ? compare.call(compareContext, objA, objB) : void 0; + if (~index) { + entries.splice(index, 1); + } + }; + /** + * @param {*} key + * @returns {void} + */ - if (ret !== void 0) { - return !!ret; - } - if (objA === objB) { - return true; - } + class_1.prototype.has = function (key) { + return !!~getIndex(this.__entries__, key); + }; + /** + * @returns {void} + */ - if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) { - return false; - } - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); + class_1.prototype.clear = function () { + this.__entries__.splice(0); + }; + /** + * @param {Function} callback + * @param {*} [ctx=null] + * @returns {void} + */ - if (keysA.length !== keysB.length) { - return false; - } - var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); + class_1.prototype.forEach = function (callback, ctx) { + if (ctx === void 0) { + ctx = null; + } - // Test for A's keys different from B. - for (var idx = 0; idx < keysA.length; idx++) { - var key = keysA[idx]; + for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) { + var entry = _a[_i]; + callback.call(ctx, entry[1], entry[0]); + } + }; - if (!bHasOwnProperty(key)) { - return false; - } + return class_1; + }() + ); +}(); +/** + * Detects whether window and document objects are available in current environment. + */ - var valueA = objA[key]; - var valueB = objB[key]; - ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; +var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document; // Returns global object of a current environment. - if (ret === false || (ret === void 0 && valueA !== valueB)) { - return false; - } +var global$1 = function () { + if (typeof global !== 'undefined' && global.Math === Math) { + return global; } - return true; -}; + if (typeof self !== 'undefined' && self.Math === Math) { + return self; + } -},{}],"Hqa3":[function(require,module,exports) { -"use strict"; + if (typeof window !== 'undefined' && window.Math === Math) { + return window; + } // eslint-disable-next-line no-new-func -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + return Function('return this')(); +}(); +/** + * A shim for the requestAnimationFrame which falls back to the setTimeout if + * first one is not supported. + * + * @returns {number} Requests' identifier. + */ -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); +var requestAnimationFrame$1 = function () { + if (typeof requestAnimationFrame === 'function') { + // It's required to use a bounded function because IE sometimes throws + // an "Invalid calling object" error if rAF is invoked without the global + // object on the left hand side. + return requestAnimationFrame.bind(global$1); + } -var React = _interopRequireWildcard(require("react")); + return function (callback) { + return setTimeout(function () { + return callback(Date.now()); + }, 1000 / 60); + }; +}(); // Defines minimum timeout before adding a trailing call. -var _classnames = _interopRequireDefault(require("classnames")); -var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer")); +var trailingTimeout = 2; +/** + * Creates a wrapper function which ensures that provided callback will be + * invoked only once during the specified delay period. + * + * @param {Function} callback - Function to be invoked after the delay period. + * @param {number} delay - Delay after which to invoke callback. + * @returns {Function} + */ -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function throttle(callback, delay) { + var leadingCall = false, + trailingCall = false, + lastCallTime = 0; + /** + * Invokes the original callback function and schedules new invocation if + * the "proxy" was called during current request. + * + * @returns {void} + */ -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + function resolvePending() { + if (leadingCall) { + leadingCall = false; + callback(); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (trailingCall) { + proxy(); + } + } + /** + * Callback invoked after the specified delay. It will further postpone + * invocation of the original function delegating it to the + * requestAnimationFrame. + * + * @returns {void} + */ -var _excluded = ["prefixCls", "invalidate", "item", "renderItem", "responsive", "responsiveDisabled", "registerSize", "itemKey", "className", "style", "children", "display", "order", "component"]; -// Use shared variable to save bundle size -var UNDEFINED = undefined; -function InternalItem(props, ref) { - var prefixCls = props.prefixCls, - invalidate = props.invalidate, - item = props.item, - renderItem = props.renderItem, - responsive = props.responsive, - responsiveDisabled = props.responsiveDisabled, - registerSize = props.registerSize, - itemKey = props.itemKey, - className = props.className, - style = props.style, - children = props.children, - display = props.display, - order = props.order, - _props$component = props.component, - Component = _props$component === void 0 ? 'div' : _props$component, - restProps = (0, _objectWithoutProperties2.default)(props, _excluded); - var mergedHidden = responsive && !display; // ================================ Effect ================================ - - function internalRegisterSize(width) { - registerSize(itemKey, width); + function timeoutCallback() { + requestAnimationFrame$1(resolvePending); } + /** + * Schedules invocation of the original function. + * + * @returns {void} + */ - React.useEffect(function () { - return function () { - internalRegisterSize(null); - }; - }, []); // ================================ Render ================================ - - var childNode = renderItem && item !== UNDEFINED ? renderItem(item) : children; - var overflowStyle; - if (!invalidate) { - overflowStyle = { - opacity: mergedHidden ? 0 : 1, - height: mergedHidden ? 0 : UNDEFINED, - overflowY: mergedHidden ? 'hidden' : UNDEFINED, - order: responsive ? order : UNDEFINED, - pointerEvents: mergedHidden ? 'none' : UNDEFINED, - position: mergedHidden ? 'absolute' : UNDEFINED - }; - } + function proxy() { + var timeStamp = Date.now(); - var overflowProps = {}; + if (leadingCall) { + // Reject immediately following calls. + if (timeStamp - lastCallTime < trailingTimeout) { + return; + } // Schedule new call to be in invoked when the pending one is resolved. + // This is important for "transitions" which never actually start + // immediately so there is a chance that we might miss one if change + // happens amids the pending invocation. - if (mergedHidden) { - overflowProps['aria-hidden'] = true; - } - var itemNode = /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({ - className: (0, _classnames.default)(!invalidate && prefixCls, className), - style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, overflowStyle), style) - }, overflowProps, restProps, { - ref: ref - }), childNode); + trailingCall = true; + } else { + leadingCall = true; + trailingCall = false; + setTimeout(timeoutCallback, delay); + } - if (responsive) { - itemNode = /*#__PURE__*/React.createElement(_rcResizeObserver.default, { - onResize: function onResize(_ref) { - var offsetWidth = _ref.offsetWidth; - internalRegisterSize(offsetWidth); - }, - disabled: responsiveDisabled - }, itemNode); + lastCallTime = timeStamp; } - return itemNode; -} - -var Item = /*#__PURE__*/React.forwardRef(InternalItem); -Item.displayName = 'Item'; -var _default = Item; -exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"qb7c","rc-resize-observer":"q9L5"}],"Xajk":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useBatchFrameState = useBatchFrameState; - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); - -var _react = require("react"); + return proxy; +} // Minimum delay before invoking the update of observers. -var _raf = _interopRequireDefault(require("rc-util/es/raf")); -var _useState3 = _interopRequireDefault(require("rc-util/es/hooks/useState")); +var REFRESH_DELAY = 20; // A list of substrings of CSS properties used to find transition events that +// might affect dimensions of observed elements. -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight']; // Check if MutationObserver is available. -/** - * State generate. Return a `setState` but it will flush all state with one render to save perf. - * This is not a realization of `unstable_batchedUpdates`. +var mutationObserverSupported = typeof MutationObserver !== 'undefined'; +/** + * Singleton controller class which handles updates of ResizeObserver instances. */ -function useBatchFrameState() { - var _useState = (0, _useState3.default)({}), - _useState2 = (0, _slicedToArray2.default)(_useState, 2), - forceUpdate = _useState2[1]; - - var statesRef = (0, _react.useRef)([]); - var walkingIndex = 0; - var beforeFrameId = 0; - function createState(defaultValue) { - var myIndex = walkingIndex; - walkingIndex += 1; // Fill value if not exist yet +var ResizeObserverController = +/** @class */ +function () { + /** + * Creates a new instance of ResizeObserverController. + * + * @private + */ + function ResizeObserverController() { + /** + * Indicates whether DOM listeners have been added. + * + * @private {boolean} + */ + this.connected_ = false; + /** + * Tells that controller has subscribed for Mutation Events. + * + * @private {boolean} + */ - if (statesRef.current.length < myIndex + 1) { - statesRef.current[myIndex] = defaultValue; - } // Return filled as `setState` + this.mutationEventsAdded_ = false; + /** + * Keeps reference to the instance of MutationObserver. + * + * @private {MutationObserver} + */ + this.mutationsObserver_ = null; + /** + * A list of connected observers. + * + * @private {Array} + */ - var value = statesRef.current[myIndex]; + this.observers_ = []; + this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); + this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY); + } + /** + * Adds observer to observers list. + * + * @param {ResizeObserverSPI} observer - Observer to be added. + * @returns {void} + */ - function setValue(val) { - statesRef.current[myIndex] = typeof val === 'function' ? val(statesRef.current[myIndex]) : val; - _raf.default.cancel(beforeFrameId); // Flush with batch + ResizeObserverController.prototype.addObserver = function (observer) { + if (!~this.observers_.indexOf(observer)) { + this.observers_.push(observer); + } // Add listeners if they haven't been added yet. - beforeFrameId = (0, _raf.default)(function () { - forceUpdate({}, true); - }); + if (!this.connected_) { + this.connect_(); } + }; + /** + * Removes observer from observers list. + * + * @param {ResizeObserverSPI} observer - Observer to be removed. + * @returns {void} + */ - return [value, setValue]; - } - - return createState; -} -},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/raf":"adDJ","rc-util/es/hooks/useState":"OlRb"}],"dmCC":[function(require,module,exports) { -"use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; + ResizeObserverController.prototype.removeObserver = function (observer) { + var observers = this.observers_; + var index = observers.indexOf(observer); // Remove observer if it's present in registry. -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + if (~index) { + observers.splice(index, 1); + } // Remove listeners if controller has no connected observers. -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); -var React = _interopRequireWildcard(require("react")); + if (!observers.length && this.connected_) { + this.disconnect_(); + } + }; + /** + * Invokes the update of observers. It will continue running updates insofar + * it detects changes. + * + * @returns {void} + */ -var _classnames = _interopRequireDefault(require("classnames")); -var _Item = _interopRequireDefault(require("./Item")); + ResizeObserverController.prototype.refresh = function () { + var changesDetected = this.updateObservers_(); // Continue running updates if changes have been detected as there might + // be future ones caused by CSS transitions. -var _Overflow = require("./Overflow"); + if (changesDetected) { + this.refresh(); + } + }; + /** + * Updates every observer from observers list and notifies them of queued + * entries. + * + * @private + * @returns {boolean} Returns "true" if any observer has detected changes in + * dimensions of it's elements. + */ -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + ResizeObserverController.prototype.updateObservers_ = function () { + // Collect observers that have active observations. + var activeObservers = this.observers_.filter(function (observer) { + return observer.gatherActive(), observer.hasActive(); + }); // Deliver notifications in a separate cycle in order to avoid any + // collisions between observers, e.g. when multiple instances of + // ResizeObserver are tracking the same element and the callback of one + // of them changes content dimensions of the observed target. Sometimes + // this may result in notifications being blocked for the rest of observers. -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + activeObservers.forEach(function (observer) { + return observer.broadcastActive(); + }); + return activeObservers.length > 0; + }; + /** + * Initializes DOM listeners. + * + * @private + * @returns {void} + */ -var _excluded = ["component"], - _excluded2 = ["className"], - _excluded3 = ["className"]; -var InternalRawItem = function InternalRawItem(props, ref) { - var context = React.useContext(_Overflow.OverflowContext); // Render directly when context not provided + ResizeObserverController.prototype.connect_ = function () { + // Do nothing if running in a non-browser environment or if listeners + // have been already added. + if (!isBrowser || this.connected_) { + return; + } // Subscription to the "Transitionend" event is used as a workaround for + // delayed transitions. This way it's possible to capture at least the + // final state of an element. - if (!context) { - var _props$component = props.component, - Component = _props$component === void 0 ? 'div' : _props$component, - _restProps = (0, _objectWithoutProperties2.default)(props, _excluded); - return /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({}, _restProps, { - ref: ref - })); - } + document.addEventListener('transitionend', this.onTransitionEnd_); + window.addEventListener('resize', this.refresh); - var contextClassName = context.className, - restContext = (0, _objectWithoutProperties2.default)(context, _excluded2); - var className = props.className, - restProps = (0, _objectWithoutProperties2.default)(props, _excluded3); // Do not pass context to sub item to avoid multiple measure + if (mutationObserverSupported) { + this.mutationsObserver_ = new MutationObserver(this.refresh); + this.mutationsObserver_.observe(document, { + attributes: true, + childList: true, + characterData: true, + subtree: true + }); + } else { + document.addEventListener('DOMSubtreeModified', this.refresh); + this.mutationEventsAdded_ = true; + } - return /*#__PURE__*/React.createElement(_Overflow.OverflowContext.Provider, { - value: null - }, /*#__PURE__*/React.createElement(_Item.default, (0, _extends2.default)({ - ref: ref, - className: (0, _classnames.default)(contextClassName, className) - }, restContext, restProps))); -}; + this.connected_ = true; + }; + /** + * Removes DOM listeners. + * + * @private + * @returns {void} + */ -var RawItem = /*#__PURE__*/React.forwardRef(InternalRawItem); -RawItem.displayName = 'RawItem'; -var _default = RawItem; -exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"qb7c","./Item":"Hqa3","./Overflow":"lyHO"}],"lyHO":[function(require,module,exports) { -"use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = exports.OverflowContext = void 0; + ResizeObserverController.prototype.disconnect_ = function () { + // Do nothing if running in a non-browser environment or if listeners + // have been already removed. + if (!isBrowser || !this.connected_) { + return; + } -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + document.removeEventListener('transitionend', this.onTransitionEnd_); + window.removeEventListener('resize', this.refresh); -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + if (this.mutationsObserver_) { + this.mutationsObserver_.disconnect(); + } -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + if (this.mutationEventsAdded_) { + document.removeEventListener('DOMSubtreeModified', this.refresh); + } -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + this.mutationsObserver_ = null; + this.mutationEventsAdded_ = false; + this.connected_ = false; + }; + /** + * "Transitionend" event handler. + * + * @private + * @param {TransitionEvent} event + * @returns {void} + */ -var React = _interopRequireWildcard(require("react")); -var _classnames = _interopRequireDefault(require("classnames")); + ResizeObserverController.prototype.onTransitionEnd_ = function (_a) { + var _b = _a.propertyName, + propertyName = _b === void 0 ? '' : _b; // Detect whether transition may affect dimensions of an element. -var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer")); + var isReflowProperty = transitionKeys.some(function (key) { + return !!~propertyName.indexOf(key); + }); -var _useLayoutEffect = _interopRequireDefault(require("rc-util/es/hooks/useLayoutEffect")); + if (isReflowProperty) { + this.refresh(); + } + }; + /** + * Returns instance of the ResizeObserverController. + * + * @returns {ResizeObserverController} + */ -var _Item = _interopRequireDefault(require("./Item")); -var _useBatchFrameState = require("./hooks/useBatchFrameState"); + ResizeObserverController.getInstance = function () { + if (!this.instance_) { + this.instance_ = new ResizeObserverController(); + } -var _RawItem = _interopRequireDefault(require("./RawItem")); + return this.instance_; + }; + /** + * Holds reference to the controller's instance. + * + * @private {ResizeObserverController} + */ -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + ResizeObserverController.instance_ = null; + return ResizeObserverController; +}(); +/** + * Defines non-writable/enumerable properties of the provided target object. + * + * @param {Object} target - Object for which to define properties. + * @param {Object} props - Properties to be defined. + * @returns {Object} Target object. + */ -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _excluded = ["prefixCls", "data", "renderItem", "renderRawItem", "itemKey", "itemWidth", "ssr", "style", "className", "maxCount", "renderRest", "renderRawRest", "suffix", "component", "itemComponent", "onVisibleChange"]; -var OverflowContext = /*#__PURE__*/React.createContext(null); -exports.OverflowContext = OverflowContext; -var RESPONSIVE = 'responsive'; -var INVALIDATE = 'invalidate'; +var defineConfigurable = function (target, props) { + for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) { + var key = _a[_i]; + Object.defineProperty(target, key, { + value: props[key], + enumerable: false, + writable: false, + configurable: true + }); + } -function defaultRenderRest(omittedItems) { - return "+ ".concat(omittedItems.length, " ..."); -} + return target; +}; +/** + * Returns the global object associated with provided element. + * + * @param {Object} target + * @returns {Object} + */ -function Overflow(props, ref) { - var _props$prefixCls = props.prefixCls, - prefixCls = _props$prefixCls === void 0 ? 'rc-overflow' : _props$prefixCls, - _props$data = props.data, - data = _props$data === void 0 ? [] : _props$data, - renderItem = props.renderItem, - renderRawItem = props.renderRawItem, - itemKey = props.itemKey, - _props$itemWidth = props.itemWidth, - itemWidth = _props$itemWidth === void 0 ? 10 : _props$itemWidth, - ssr = props.ssr, - style = props.style, - className = props.className, - maxCount = props.maxCount, - renderRest = props.renderRest, - renderRawRest = props.renderRawRest, - suffix = props.suffix, - _props$component = props.component, - Component = _props$component === void 0 ? 'div' : _props$component, - itemComponent = props.itemComponent, - onVisibleChange = props.onVisibleChange, - restProps = (0, _objectWithoutProperties2.default)(props, _excluded); - var createUseState = (0, _useBatchFrameState.useBatchFrameState)(); - var fullySSR = ssr === 'full'; - var _createUseState = createUseState(null), - _createUseState2 = (0, _slicedToArray2.default)(_createUseState, 2), - containerWidth = _createUseState2[0], - setContainerWidth = _createUseState2[1]; +var getWindowOf = function (target) { + // Assume that the element is an instance of Node, which means that it + // has the "ownerDocument" property from which we can retrieve a + // corresponding global object. + var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; // Return the local global object if it's not possible extract one from + // provided element. - var mergedContainerWidth = containerWidth || 0; + return ownerGlobal || global$1; +}; // Placeholder of an empty content rectangle. - var _createUseState3 = createUseState(new Map()), - _createUseState4 = (0, _slicedToArray2.default)(_createUseState3, 2), - itemWidths = _createUseState4[0], - setItemWidths = _createUseState4[1]; - var _createUseState5 = createUseState(0), - _createUseState6 = (0, _slicedToArray2.default)(_createUseState5, 2), - prevRestWidth = _createUseState6[0], - setPrevRestWidth = _createUseState6[1]; +var emptyRect = createRectInit(0, 0, 0, 0); +/** + * Converts provided string to a number. + * + * @param {number|string} value + * @returns {number} + */ - var _createUseState7 = createUseState(0), - _createUseState8 = (0, _slicedToArray2.default)(_createUseState7, 2), - restWidth = _createUseState8[0], - setRestWidth = _createUseState8[1]; +function toFloat(value) { + return parseFloat(value) || 0; +} +/** + * Extracts borders size from provided styles. + * + * @param {CSSStyleDeclaration} styles + * @param {...string} positions - Borders positions (top, right, ...) + * @returns {number} + */ - var _createUseState9 = createUseState(0), - _createUseState10 = (0, _slicedToArray2.default)(_createUseState9, 2), - suffixWidth = _createUseState10[0], - setSuffixWidth = _createUseState10[1]; - var _useState = (0, React.useState)(null), - _useState2 = (0, _slicedToArray2.default)(_useState, 2), - suffixFixedStart = _useState2[0], - setSuffixFixedStart = _useState2[1]; +function getBordersSize(styles) { + var positions = []; - var _useState3 = (0, React.useState)(null), - _useState4 = (0, _slicedToArray2.default)(_useState3, 2), - displayCount = _useState4[0], - setDisplayCount = _useState4[1]; + for (var _i = 1; _i < arguments.length; _i++) { + positions[_i - 1] = arguments[_i]; + } - var mergedDisplayCount = React.useMemo(function () { - if (displayCount === null && fullySSR) { - return Number.MAX_SAFE_INTEGER; - } + return positions.reduce(function (size, position) { + var value = styles['border-' + position + '-width']; + return size + toFloat(value); + }, 0); +} +/** + * Extracts paddings sizes from provided styles. + * + * @param {CSSStyleDeclaration} styles + * @returns {Object} Paddings box. + */ - return displayCount || 0; - }, [displayCount, containerWidth]); - var _useState5 = (0, React.useState)(false), - _useState6 = (0, _slicedToArray2.default)(_useState5, 2), - restReady = _useState6[0], - setRestReady = _useState6[1]; +function getPaddings(styles) { + var positions = ['top', 'right', 'bottom', 'left']; + var paddings = {}; - var itemPrefixCls = "".concat(prefixCls, "-item"); // Always use the max width to avoid blink + for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { + var position = positions_1[_i]; + var value = styles['padding-' + position]; + paddings[position] = toFloat(value); + } - var mergedRestWidth = Math.max(prevRestWidth, restWidth); // ================================= Data ================================= + return paddings; +} +/** + * Calculates content rectangle of provided SVG element. + * + * @param {SVGGraphicsElement} target - Element content rectangle of which needs + * to be calculated. + * @returns {DOMRectInit} + */ - var isResponsive = maxCount === RESPONSIVE; - var shouldResponsive = data.length && isResponsive; - var invalidate = maxCount === INVALIDATE; - /** - * When is `responsive`, we will always render rest node to get the real width of it for calculation - */ - var showRest = shouldResponsive || typeof maxCount === 'number' && data.length > maxCount; - var mergedData = (0, React.useMemo)(function () { - var items = data; +function getSVGContentRect(target) { + var bbox = target.getBBox(); + return createRectInit(0, 0, bbox.width, bbox.height); +} +/** + * Calculates content rectangle of provided HTMLElement. + * + * @param {HTMLElement} target - Element for which to calculate the content rectangle. + * @returns {DOMRectInit} + */ - if (shouldResponsive) { - if (containerWidth === null && fullySSR) { - items = data; - } else { - items = data.slice(0, Math.min(data.length, mergedContainerWidth / itemWidth)); - } - } else if (typeof maxCount === 'number') { - items = data.slice(0, maxCount); - } - return items; - }, [data, itemWidth, containerWidth, maxCount, shouldResponsive]); - var omittedItems = (0, React.useMemo)(function () { - if (shouldResponsive) { - return data.slice(mergedDisplayCount + 1); - } +function getHTMLElementContentRect(target) { + // Client width & height properties can't be + // used exclusively as they provide rounded values. + var clientWidth = target.clientWidth, + clientHeight = target.clientHeight; // By this condition we can catch all non-replaced inline, hidden and + // detached elements. Though elements with width & height properties less + // than 0.5 will be discarded as well. + // + // Without it we would need to implement separate methods for each of + // those cases and it's not possible to perform a precise and performance + // effective test for hidden elements. E.g. even jQuery's ':visible' filter + // gives wrong results for elements with width & height less than 0.5. - return data.slice(mergedData.length); - }, [data, mergedData, shouldResponsive, mergedDisplayCount]); // ================================= Item ================================= + if (!clientWidth && !clientHeight) { + return emptyRect; + } - var getKey = (0, React.useCallback)(function (item, index) { - var _ref; + var styles = getWindowOf(target).getComputedStyle(target); + var paddings = getPaddings(styles); + var horizPad = paddings.left + paddings.right; + var vertPad = paddings.top + paddings.bottom; // Computed styles of width & height are being used because they are the + // only dimensions available to JS that contain non-rounded values. It could + // be possible to utilize the getBoundingClientRect if only it's data wasn't + // affected by CSS transformations let alone paddings, borders and scroll bars. - if (typeof itemKey === 'function') { - return itemKey(item); - } + var width = toFloat(styles.width), + height = toFloat(styles.height); // Width & height include paddings and borders when the 'border-box' box + // model is applied (except for IE). - return (_ref = itemKey && (item === null || item === void 0 ? void 0 : item[itemKey])) !== null && _ref !== void 0 ? _ref : index; - }, [itemKey]); - var mergedRenderItem = (0, React.useCallback)(renderItem || function (item) { - return item; - }, [renderItem]); + if (styles.boxSizing === 'border-box') { + // Following conditions are required to handle Internet Explorer which + // doesn't include paddings and borders to computed CSS dimensions. + // + // We can say that if CSS dimensions + paddings are equal to the "client" + // properties then it's either IE, and thus we don't need to subtract + // anything, or an element merely doesn't have paddings/borders styles. + if (Math.round(width + horizPad) !== clientWidth) { + width -= getBordersSize(styles, 'left', 'right') + horizPad; + } - function updateDisplayCount(count, suffixFixedStartVal, notReady) { - // React 18 will sync render even when the value is same in some case. - // We take `mergedData` as deps which may cause dead loop if it's dynamic generate. - // ref: https://github.com/ant-design/ant-design/issues/36559 - if (displayCount === count && (suffixFixedStartVal === undefined || suffixFixedStartVal === suffixFixedStart)) { - return; + if (Math.round(height + vertPad) !== clientHeight) { + height -= getBordersSize(styles, 'top', 'bottom') + vertPad; } + } // Following steps can't be applied to the document's root element as its + // client[Width/Height] properties represent viewport area of the window. + // Besides, it's as well not necessary as the itself neither has + // rendered scroll bars nor it can be clipped. - setDisplayCount(count); - if (!notReady) { - setRestReady(count < data.length - 1); - onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(count); - } + if (!isDocumentElement(target)) { + // In some browsers (only in Firefox, actually) CSS width & height + // include scroll bars size which can be removed at this step as scroll + // bars are the only difference between rounded dimensions + paddings + // and "client" properties, though that is not always true in Chrome. + var vertScrollbar = Math.round(width + horizPad) - clientWidth; + var horizScrollbar = Math.round(height + vertPad) - clientHeight; // Chrome has a rather weird rounding of "client" properties. + // E.g. for an element with content width of 314.2px it sometimes gives + // the client width of 315px and for the width of 314.7px it may give + // 314px. And it doesn't happen all the time. So just ignore this delta + // as a non-relevant. - if (suffixFixedStartVal !== undefined) { - setSuffixFixedStart(suffixFixedStartVal); + if (Math.abs(vertScrollbar) !== 1) { + width -= vertScrollbar; } - } // ================================= Size ================================= - - function onOverflowResize(_, element) { - setContainerWidth(element.clientWidth); + if (Math.abs(horizScrollbar) !== 1) { + height -= horizScrollbar; + } } - function registerSize(key, width) { - setItemWidths(function (origin) { - var clone = new Map(origin); + return createRectInit(paddings.left, paddings.top, width, height); +} +/** + * Checks whether provided element is an instance of the SVGGraphicsElement. + * + * @param {Element} target - Element to be checked. + * @returns {boolean} + */ - if (width === null) { - clone.delete(key); - } else { - clone.set(key, width); - } - return clone; - }); - } +var isSVGGraphicsElement = function () { + // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement + // interface. + if (typeof SVGGraphicsElement !== 'undefined') { + return function (target) { + return target instanceof getWindowOf(target).SVGGraphicsElement; + }; + } // If it's so, then check that element is at least an instance of the + // SVGElement and that it has the "getBBox" method. + // eslint-disable-next-line no-extra-parens - function registerOverflowSize(_, width) { - setRestWidth(width); - setPrevRestWidth(restWidth); - } - function registerSuffixSize(_, width) { - setSuffixWidth(width); - } // ================================ Effect ================================ + return function (target) { + return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === 'function'; + }; +}(); +/** + * Checks whether provided element is a document element (). + * + * @param {Element} target - Element to be checked. + * @returns {boolean} + */ - function getItemWidth(index) { - return itemWidths.get(getKey(mergedData[index], index)); - } +function isDocumentElement(target) { + return target === getWindowOf(target).document.documentElement; +} +/** + * Calculates an appropriate content rectangle for provided html or svg element. + * + * @param {Element} target - Element content rectangle of which needs to be calculated. + * @returns {DOMRectInit} + */ - (0, _useLayoutEffect.default)(function () { - if (mergedContainerWidth && mergedRestWidth && mergedData) { - var totalWidth = suffixWidth; - var len = mergedData.length; - var lastIndex = len - 1; // When data count change to 0, reset this since not loop will reach - if (!len) { - updateDisplayCount(0, null); - return; - } +function getContentRect(target) { + if (!isBrowser) { + return emptyRect; + } - for (var i = 0; i < len; i += 1) { - var currentItemWidth = getItemWidth(i); // Fully will always render + if (isSVGGraphicsElement(target)) { + return getSVGContentRect(target); + } - if (fullySSR) { - currentItemWidth = currentItemWidth || 0; - } // Break since data not ready + return getHTMLElementContentRect(target); +} +/** + * Creates rectangle with an interface of the DOMRectReadOnly. + * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly + * + * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions. + * @returns {DOMRectReadOnly} + */ - if (currentItemWidth === undefined) { - updateDisplayCount(i - 1, undefined, true); - break; - } // Find best match +function createReadOnlyRect(_a) { + var x = _a.x, + y = _a.y, + width = _a.width, + height = _a.height; // If DOMRectReadOnly is available use it as a prototype for the rectangle. + var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object; + var rect = Object.create(Constr.prototype); // Rectangle's properties are not writable and non-enumerable. - totalWidth += currentItemWidth; + defineConfigurable(rect, { + x: x, + y: y, + width: width, + height: height, + top: y, + right: x + width, + bottom: height + y, + left: x + }); + return rect; +} +/** + * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates. + * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit + * + * @param {number} x - X coordinate. + * @param {number} y - Y coordinate. + * @param {number} width - Rectangle's width. + * @param {number} height - Rectangle's height. + * @returns {DOMRectInit} + */ - if ( // Only one means `totalWidth` is the final width - lastIndex === 0 && totalWidth <= mergedContainerWidth || // Last two width will be the final width - i === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth) { - // Additional check if match the end - updateDisplayCount(lastIndex, null); - break; - } else if (totalWidth + mergedRestWidth > mergedContainerWidth) { - // Can not hold all the content to show rest - updateDisplayCount(i - 1, totalWidth - currentItemWidth - suffixWidth + restWidth); - break; - } - } - if (suffix && getItemWidth(0) + suffixWidth > mergedContainerWidth) { - setSuffixFixedStart(null); - } - } - }, [mergedContainerWidth, itemWidths, restWidth, suffixWidth, getKey, mergedData]); // ================================ Render ================================ +function createRectInit(x, y, width, height) { + return { + x: x, + y: y, + width: width, + height: height + }; +} +/** + * Class that is responsible for computations of the content rectangle of + * provided DOM element and for keeping track of it's changes. + */ - var displayRest = restReady && !!omittedItems.length; - var suffixStyle = {}; - if (suffixFixedStart !== null && shouldResponsive) { - suffixStyle = { - position: 'absolute', - left: suffixFixedStart, - top: 0 - }; +var ResizeObservation = +/** @class */ +function () { + /** + * Creates an instance of ResizeObservation. + * + * @param {Element} target - Element to be observed. + */ + function ResizeObservation(target) { + /** + * Broadcasted width of content rectangle. + * + * @type {number} + */ + this.broadcastWidth = 0; + /** + * Broadcasted height of content rectangle. + * + * @type {number} + */ + + this.broadcastHeight = 0; + /** + * Reference to the last observed content rectangle. + * + * @private {DOMRectInit} + */ + + this.contentRect_ = createRectInit(0, 0, 0, 0); + this.target = target; } + /** + * Updates content rectangle and tells whether it's width or height properties + * have changed since the last broadcast. + * + * @returns {boolean} + */ - var itemSharedProps = { - prefixCls: itemPrefixCls, - responsive: shouldResponsive, - component: itemComponent, - invalidate: invalidate - }; // >>>>> Choice render fun by `renderRawItem` - var internalRenderItemNode = renderRawItem ? function (item, index) { - var key = getKey(item, index); - return /*#__PURE__*/React.createElement(OverflowContext.Provider, { - key: key, - value: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemSharedProps), {}, { - order: index, - item: item, - itemKey: key, - registerSize: registerSize, - display: index <= mergedDisplayCount - }) - }, renderRawItem(item, index)); - } : function (item, index) { - var key = getKey(item, index); - return /*#__PURE__*/React.createElement(_Item.default, (0, _extends2.default)({}, itemSharedProps, { - order: index, - key: key, - item: item, - renderItem: mergedRenderItem, - itemKey: key, - registerSize: registerSize, - display: index <= mergedDisplayCount - })); - }; // >>>>> Rest node + ResizeObservation.prototype.isActive = function () { + var rect = getContentRect(this.target); + this.contentRect_ = rect; + return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight; + }; + /** + * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data + * from the corresponding properties of the last observed content rectangle. + * + * @returns {DOMRectInit} Last observed content rectangle. + */ - var restNode; - var restContextProps = { - order: displayRest ? mergedDisplayCount : Number.MAX_SAFE_INTEGER, - className: "".concat(itemPrefixCls, "-rest"), - registerSize: registerOverflowSize, - display: displayRest + + ResizeObservation.prototype.broadcastRect = function () { + var rect = this.contentRect_; + this.broadcastWidth = rect.width; + this.broadcastHeight = rect.height; + return rect; }; - if (!renderRawRest) { - var mergedRenderRest = renderRest || defaultRenderRest; - restNode = /*#__PURE__*/React.createElement(_Item.default, (0, _extends2.default)({}, itemSharedProps, restContextProps), typeof mergedRenderRest === 'function' ? mergedRenderRest(omittedItems) : mergedRenderRest); - } else if (renderRawRest) { - restNode = /*#__PURE__*/React.createElement(OverflowContext.Provider, { - value: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemSharedProps), restContextProps) - }, renderRawRest(omittedItems)); - } + return ResizeObservation; +}(); - var overflowNode = /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({ - className: (0, _classnames.default)(!invalidate && prefixCls, className), - style: style, - ref: ref - }, restProps), mergedData.map(internalRenderItemNode), showRest ? restNode : null, suffix && /*#__PURE__*/React.createElement(_Item.default, (0, _extends2.default)({}, itemSharedProps, { - responsive: isResponsive, - responsiveDisabled: !shouldResponsive, - order: mergedDisplayCount, - className: "".concat(itemPrefixCls, "-suffix"), - registerSize: registerSuffixSize, - display: true, - style: suffixStyle - }), suffix)); +var ResizeObserverEntry = +/** @class */ +function () { + /** + * Creates an instance of ResizeObserverEntry. + * + * @param {Element} target - Element that is being observed. + * @param {DOMRectInit} rectInit - Data of the element's content rectangle. + */ + function ResizeObserverEntry(target, rectInit) { + var contentRect = createReadOnlyRect(rectInit); // According to the specification following properties are not writable + // and are also not enumerable in the native implementation. + // + // Property accessors are not being used as they'd require to define a + // private WeakMap storage which may cause memory leaks in browsers that + // don't support this type of collections. - if (isResponsive) { - overflowNode = /*#__PURE__*/React.createElement(_rcResizeObserver.default, { - onResize: onOverflowResize, - disabled: !shouldResponsive - }, overflowNode); + defineConfigurable(this, { + target: target, + contentRect: contentRect + }); } - return overflowNode; -} - -var ForwardOverflow = /*#__PURE__*/React.forwardRef(Overflow); -ForwardOverflow.displayName = 'Overflow'; -ForwardOverflow.Item = _RawItem.default; -ForwardOverflow.RESPONSIVE = RESPONSIVE; -ForwardOverflow.INVALIDATE = INVALIDATE; // Convert to generic type + return ResizeObserverEntry; +}(); -var _default = ForwardOverflow; -exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"qb7c","rc-resize-observer":"q9L5","rc-util/es/hooks/useLayoutEffect":"wqHO","./Item":"Hqa3","./hooks/useBatchFrameState":"Xajk","./RawItem":"dmCC"}],"H6C2":[function(require,module,exports) { -"use strict"; +var ResizeObserverSPI = +/** @class */ +function () { + /** + * Creates a new instance of ResizeObserver. + * + * @param {ResizeObserverCallback} callback - Callback function that is invoked + * when one of the observed elements changes it's content dimensions. + * @param {ResizeObserverController} controller - Controller instance which + * is responsible for the updates of observer. + * @param {ResizeObserver} callbackCtx - Reference to the public + * ResizeObserver instance which will be passed to callback function. + */ + function ResizeObserverSPI(callback, controller, callbackCtx) { + /** + * Collection of resize observations that have detected changes in dimensions + * of elements. + * + * @private {Array} + */ + this.activeObservations_ = []; + /** + * Registry of the ResizeObservation instances. + * + * @private {Map} + */ -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; + this.observations_ = new MapShim(); -var _Overflow = _interopRequireDefault(require("./Overflow")); + if (typeof callback !== 'function') { + throw new TypeError('The callback provided as parameter 1 is not a function.'); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + this.callback_ = callback; + this.controller_ = controller; + this.callbackCtx_ = callbackCtx; + } + /** + * Starts observing provided element. + * + * @param {Element} target - Element to be observed. + * @returns {void} + */ -var _default = _Overflow.default; -exports.default = _default; -},{"./Overflow":"lyHO"}],"P8ML":[function(require,module,exports) { -"use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = omit; + ResizeObserverSPI.prototype.observe = function (target) { + if (!arguments.length) { + throw new TypeError('1 argument required, but only 0 present.'); + } // Do nothing if current environment doesn't have the Element interface. -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (typeof Element === 'undefined' || !(Element instanceof Object)) { + return; + } -function omit(obj, fields) { - var clone = (0, _objectSpread2.default)({}, obj); + if (!(target instanceof getWindowOf(target).Element)) { + throw new TypeError('parameter 1 is not of type "Element".'); + } - if (Array.isArray(fields)) { - fields.forEach(function (key) { - delete clone[key]; - }); - } + var observations = this.observations_; // Do nothing if element is already being observed. - return clone; -} -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT"}],"WRUc":[function(require,module,exports) { -"use strict"; + if (observations.has(target)) { + return; + } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.MenuContext = void 0; -exports.default = InheritableContextProvider; + observations.set(target, new ResizeObservation(target)); + this.controller_.addObserver(this); // Force the update of observations. -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + this.controller_.refresh(); + }; + /** + * Stops observing provided element. + * + * @param {Element} target - Element to stop observing. + * @returns {void} + */ -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var React = _interopRequireWildcard(require("react")); + ResizeObserverSPI.prototype.unobserve = function (target) { + if (!arguments.length) { + throw new TypeError('1 argument required, but only 0 present.'); + } // Do nothing if current environment doesn't have the Element interface. -var _useMemo = _interopRequireDefault(require("rc-util/es/hooks/useMemo")); -var _shallowequal = _interopRequireDefault(require("shallowequal")); + if (typeof Element === 'undefined' || !(Element instanceof Object)) { + return; + } -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + if (!(target instanceof getWindowOf(target).Element)) { + throw new TypeError('parameter 1 is not of type "Element".'); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var observations = this.observations_; // Do nothing if element is not being observed. -var _excluded = ["children", "locked"]; -var MenuContext = /*#__PURE__*/React.createContext(null); -exports.MenuContext = MenuContext; + if (!observations.has(target)) { + return; + } -function mergeProps(origin, target) { - var clone = (0, _objectSpread2.default)({}, origin); - Object.keys(target).forEach(function (key) { - var value = target[key]; + observations.delete(target); - if (value !== undefined) { - clone[key] = value; + if (!observations.size) { + this.controller_.removeObserver(this); } - }); - return clone; -} - -function InheritableContextProvider(_ref) { - var children = _ref.children, - locked = _ref.locked, - restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); - var context = React.useContext(MenuContext); - var inheritableContext = (0, _useMemo.default)(function () { - return mergeProps(context, restProps); - }, [context, restProps], function (prev, next) { - return !locked && (prev[0] !== next[0] || !(0, _shallowequal.default)(prev[1], next[1])); - }); - return /*#__PURE__*/React.createElement(MenuContext.Provider, { - value: inheritableContext - }, children); -} -},{"@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK","rc-util/es/hooks/useMemo":"HDr6","shallowequal":"pz6A"}],"LQKT":[function(require,module,exports) { -"use strict"; + }; + /** + * Stops observing all elements. + * + * @returns {void} + */ -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = useActive; -var React = _interopRequireWildcard(require("react")); + ResizeObserverSPI.prototype.disconnect = function () { + this.clearActive(); + this.observations_.clear(); + this.controller_.removeObserver(this); + }; + /** + * Collects observation instances the associated element of which has changed + * it's content rectangle. + * + * @returns {void} + */ -var _MenuContext = require("../context/MenuContext"); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + ResizeObserverSPI.prototype.gatherActive = function () { + var _this = this; -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + this.clearActive(); + this.observations_.forEach(function (observation) { + if (observation.isActive()) { + _this.activeObservations_.push(observation); + } + }); + }; + /** + * Invokes initial callback function with a list of ResizeObserverEntry + * instances collected from active resize observations. + * + * @returns {void} + */ -function useActive(eventKey, disabled, onMouseEnter, onMouseLeave) { - var _React$useContext = React.useContext(_MenuContext.MenuContext), - activeKey = _React$useContext.activeKey, - onActive = _React$useContext.onActive, - onInactive = _React$useContext.onInactive; - var ret = { - active: activeKey === eventKey - }; // Skip when disabled + ResizeObserverSPI.prototype.broadcastActive = function () { + // Do nothing if observer doesn't have active observations. + if (!this.hasActive()) { + return; + } - if (!disabled) { - ret.onMouseEnter = function (domEvent) { - onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter({ - key: eventKey, - domEvent: domEvent - }); - onActive(eventKey); - }; + var ctx = this.callbackCtx_; // Create ResizeObserverEntry instance for every active observation. - ret.onMouseLeave = function (domEvent) { - onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({ - key: eventKey, - domEvent: domEvent - }); - onInactive(eventKey); - }; - } + var entries = this.activeObservations_.map(function (observation) { + return new ResizeObserverEntry(observation.target, observation.broadcastRect()); + }); + this.callback_.call(ctx, entries, ctx); + this.clearActive(); + }; + /** + * Clears the collection of active observations. + * + * @returns {void} + */ - return ret; -} -},{"react":"n8MK","../context/MenuContext":"WRUc"}],"cvmo":[function(require,module,exports) { -"use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.warnItemProp = warnItemProp; + ResizeObserverSPI.prototype.clearActive = function () { + this.activeObservations_.splice(0); + }; + /** + * Tells whether observer has active observations. + * + * @returns {boolean} + */ -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); -var _warning = _interopRequireDefault(require("rc-util/es/warning")); + ResizeObserverSPI.prototype.hasActive = function () { + return this.activeObservations_.length > 0; + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + return ResizeObserverSPI; +}(); // Registry of internal observers. If WeakMap is not available use current shim +// for the Map collection as it has all required methods and because WeakMap +// can't be fully polyfilled anyway. -var _excluded = ["item"]; -/** - * `onClick` event return `info.item` which point to react node directly. - * We should warning this since it will not work on FC. +var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim(); +/** + * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation + * exposing only those methods and properties that are defined in the spec. */ -function warnItemProp(_ref) { - var item = _ref.item, - restInfo = (0, _objectWithoutProperties2.default)(_ref, _excluded); - Object.defineProperty(restInfo, 'item', { - get: function get() { - (0, _warning.default)(false, '`info.item` is deprecated since we will move to function component that not provides React Node instance in future.'); - return item; - } - }); - return restInfo; -} -},{"@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","rc-util/es/warning":"YOfO"}],"E0zE":[function(require,module,exports) { -"use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = Icon; +var ResizeObserver = +/** @class */ +function () { + /** + * Creates a new instance of ResizeObserver. + * + * @param {ResizeObserverCallback} callback - Callback that is invoked when + * dimensions of the observed elements change. + */ + function ResizeObserver(callback) { + if (!(this instanceof ResizeObserver)) { + throw new TypeError('Cannot call a class as a function.'); + } -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + if (!arguments.length) { + throw new TypeError('1 argument required, but only 0 present.'); + } -var React = _interopRequireWildcard(require("react")); + var controller = ResizeObserverController.getInstance(); + var observer = new ResizeObserverSPI(callback, controller, this); + observers.set(this, observer); + } -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + return ResizeObserver; +}(); // Expose public methods of ResizeObserver. -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +['observe', 'unobserve', 'disconnect'].forEach(function (method) { + ResizeObserver.prototype[method] = function () { + var _a; -function Icon(_ref) { - var icon = _ref.icon, - props = _ref.props, - children = _ref.children; - var iconNode; + return (_a = observers.get(this))[method].apply(_a, arguments); + }; +}); - if (typeof icon === 'function') { - iconNode = /*#__PURE__*/React.createElement(icon, (0, _objectSpread2.default)({}, props)); - } else { - // Compatible for origin definition - iconNode = icon; +var index = function () { + // Export existing implementation if available. + if (typeof global$1.ResizeObserver !== 'undefined') { + return global$1.ResizeObserver; } - return iconNode || children || null; -} -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK"}],"Pnmu":[function(require,module,exports) { + return ResizeObserver; +}(); + +var _default = index; +exports.default = _default; +},{}],"aRxH":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = useDirectionStyle; +exports._rs = exports._el = void 0; +exports.observe = observe; +exports.unobserve = unobserve; -var React = _interopRequireWildcard(require("react")); +var _resizeObserverPolyfill = _interopRequireDefault(require("resize-observer-polyfill")); -var _MenuContext = require("../context/MenuContext"); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +// =============================== Const =============================== +var elementListeners = new Map(); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function onResize(entities) { + entities.forEach(function (entity) { + var _elementListeners$get; -function useDirectionStyle(level) { - var _React$useContext = React.useContext(_MenuContext.MenuContext), - mode = _React$useContext.mode, - rtl = _React$useContext.rtl, - inlineIndent = _React$useContext.inlineIndent; + var target = entity.target; + (_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 ? void 0 : _elementListeners$get.forEach(function (listener) { + return listener(target); + }); + }); +} // Note: ResizeObserver polyfill not support option to measure border-box resize - if (mode !== 'inline') { - return null; - } - var len = level; - return rtl ? { - paddingRight: len * inlineIndent - } : { - paddingLeft: len * inlineIndent - }; -} -},{"react":"n8MK","../context/MenuContext":"WRUc"}],"thAF":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.PathUserContext = exports.PathTrackerContext = exports.PathRegisterContext = void 0; -exports.useFullPath = useFullPath; -exports.useMeasure = useMeasure; +var resizeObserver = new _resizeObserverPolyfill.default(onResize); // Dev env only -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); +var _el = "production" !== 'production' ? elementListeners : null; // eslint-disable-line -var React = _interopRequireWildcard(require("react")); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +exports._el = _el; -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _rs = "production" !== 'production' ? onResize : null; // eslint-disable-line +// ============================== Observe ============================== -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var EmptyList = []; -var PathRegisterContext = /*#__PURE__*/React.createContext(null); -exports.PathRegisterContext = PathRegisterContext; +exports._rs = _rs; -function useMeasure() { - return React.useContext(PathRegisterContext); -} // ========================= Path Tracker ========================== +function observe(element, callback) { + if (!elementListeners.has(element)) { + elementListeners.set(element, new Set()); + resizeObserver.observe(element); + } + elementListeners.get(element).add(callback); +} -var PathTrackerContext = /*#__PURE__*/React.createContext(EmptyList); -exports.PathTrackerContext = PathTrackerContext; +function unobserve(element, callback) { + if (elementListeners.has(element)) { + elementListeners.get(element).delete(callback); -function useFullPath(eventKey) { - var parentKeyPath = React.useContext(PathTrackerContext); - return React.useMemo(function () { - return eventKey !== undefined ? [].concat((0, _toConsumableArray2.default)(parentKeyPath), [eventKey]) : parentKeyPath; - }, [parentKeyPath, eventKey]); + if (!elementListeners.get(element).size) { + resizeObserver.unobserve(element); + elementListeners.delete(element); + } + } } - -var PathUserContext = /*#__PURE__*/React.createContext(null); -exports.PathUserContext = PathUserContext; -},{"@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","react":"n8MK"}],"VB3D":[function(require,module,exports) { +},{"resize-observer-polyfill":"C4qV"}],"uLNA":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.IdContext = void 0; -exports.getMenuId = getMenuId; -exports.useMenuId = useMenuId; +exports.default = void 0; + +var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck")); + +var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass")); + +var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits")); + +var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper")); var React = _interopRequireWildcard(require("react")); @@ -5510,32 +4819,39 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -var IdContext = /*#__PURE__*/React.createContext(null); -exports.IdContext = IdContext; - -function getMenuId(uuid, eventKey) { - if (uuid === undefined) { - return null; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - return "".concat(uuid, "-").concat(eventKey); -} /** - * Get `data-menu-id` + * Fallback to findDOMNode if origin ref do not provide any dom element */ +var DomWrapper = /*#__PURE__*/function (_React$Component) { + (0, _inherits2.default)(DomWrapper, _React$Component); + var _super = (0, _createSuper2.default)(DomWrapper); -function useMenuId(eventKey) { - var id = React.useContext(IdContext); - return getMenuId(id, eventKey); -} -},{"react":"n8MK"}],"V73O":[function(require,module,exports) { + function DomWrapper() { + (0, _classCallCheck2.default)(this, DomWrapper); + return _super.apply(this, arguments); + } + + (0, _createClass2.default)(DomWrapper, [{ + key: "render", + value: function render() { + return this.props.children; + } + }]); + return DomWrapper; +}(React.Component); + +exports.default = DomWrapper; +},{"@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","react":"n8MK"}],"Aa6e":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; +exports.Collection = Collection; +exports.CollectionContext = void 0; var React = _interopRequireWildcard(require("react")); @@ -5543,753 +4859,843 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -var PrivateContext = /*#__PURE__*/React.createContext({}); -var _default = PrivateContext; -exports.default = _default; -},{"react":"n8MK"}],"NeBp":[function(require,module,exports) { +var CollectionContext = /*#__PURE__*/React.createContext(null); +/** + * Collect all the resize event from children ResizeObserver + */ + +exports.CollectionContext = CollectionContext; + +function Collection(_ref) { + var children = _ref.children, + onBatchResize = _ref.onBatchResize; + var resizeIdRef = React.useRef(0); + var resizeInfosRef = React.useRef([]); + var onCollectionResize = React.useContext(CollectionContext); + var onResize = React.useCallback(function (size, element, data) { + resizeIdRef.current += 1; + var currentId = resizeIdRef.current; + resizeInfosRef.current.push({ + size: size, + element: element, + data: data + }); + Promise.resolve().then(function () { + if (currentId === resizeIdRef.current) { + onBatchResize === null || onBatchResize === void 0 ? void 0 : onBatchResize(resizeInfosRef.current); + resizeInfosRef.current = []; + } + }); // Continue bubbling if parent exist + + onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(size, element, data); + }, [onBatchResize, onCollectionResize]); + return /*#__PURE__*/React.createElement(CollectionContext.Provider, { + value: onResize + }, children); +} +},{"react":"n8MK"}],"bO8N":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); +exports.default = SingleObserver; var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); +var _ref = require("rc-util/es/ref"); -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); +var React = _interopRequireWildcard(require("react")); -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); +var _findDOMNode = _interopRequireDefault(require("rc-util/es/Dom/findDOMNode")); -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck")); +var _observerUtil = require("../utils/observerUtil"); -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass")); +var _DomWrapper = _interopRequireDefault(require("./DomWrapper")); -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits")); +var _Collection = require("../Collection"); -var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper")); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } -var React = _interopRequireWildcard(require("react")); +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -var _classnames = _interopRequireDefault(require("classnames")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _rcOverflow = _interopRequireDefault(require("rc-overflow")); +function SingleObserver(props) { + var children = props.children, + disabled = props.disabled; + var elementRef = React.useRef(null); + var wrapperRef = React.useRef(null); + var onCollectionResize = React.useContext(_Collection.CollectionContext); // =========================== Children =========================== -var _warning = _interopRequireDefault(require("rc-util/es/warning")); + var isRenderProps = typeof children === 'function'; + var mergedChildren = isRenderProps ? children(elementRef) : children; // ============================= Size ============================= -var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); + var sizeRef = React.useRef({ + width: -1, + height: -1, + offsetWidth: -1, + offsetHeight: -1 + }); // ============================= Ref ============================== -var _omit = _interopRequireDefault(require("rc-util/es/omit")); + var canRef = !isRenderProps && /*#__PURE__*/React.isValidElement(mergedChildren) && (0, _ref.supportRef)(mergedChildren); + var originRef = canRef ? mergedChildren.ref : null; + var mergedRef = React.useMemo(function () { + return (0, _ref.composeRef)(originRef, elementRef); + }, [originRef, elementRef]); // =========================== Observe ============================ -var _MenuContext = require("./context/MenuContext"); + var propsRef = React.useRef(props); + propsRef.current = props; // Handler -var _useActive2 = _interopRequireDefault(require("./hooks/useActive")); + var onInternalResize = React.useCallback(function (target) { + var _propsRef$current = propsRef.current, + onResize = _propsRef$current.onResize, + data = _propsRef$current.data; -var _warnUtil = require("./utils/warnUtil"); + var _target$getBoundingCl = target.getBoundingClientRect(), + width = _target$getBoundingCl.width, + height = _target$getBoundingCl.height; -var _Icon = _interopRequireDefault(require("./Icon")); + var offsetWidth = target.offsetWidth, + offsetHeight = target.offsetHeight; + /** + * Resize observer trigger when content size changed. + * In most case we just care about element size, + * let's use `boundary` instead of `contentRect` here to avoid shaking. + */ -var _useDirectionStyle = _interopRequireDefault(require("./hooks/useDirectionStyle")); + var fixedWidth = Math.floor(width); + var fixedHeight = Math.floor(height); -var _PathContext = require("./context/PathContext"); + if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) { + var size = { + width: fixedWidth, + height: fixedHeight, + offsetWidth: offsetWidth, + offsetHeight: offsetHeight + }; + sizeRef.current = size; // IE is strange, right? -var _IdContext = require("./context/IdContext"); + var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth; + var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight; + var sizeInfo = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, size), {}, { + offsetWidth: mergedOffsetWidth, + offsetHeight: mergedOffsetHeight + }); // Let collection know what happened -var _PrivateContext = _interopRequireDefault(require("./context/PrivateContext")); + onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(sizeInfo, target, data); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + if (onResize) { + // defer the callback but not defer to next frame + Promise.resolve().then(function () { + onResize(sizeInfo, target); + }); + } + } + }, []); // Dynamic observe -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + React.useEffect(function () { + var currentElement = (0, _findDOMNode.default)(elementRef.current) || (0, _findDOMNode.default)(wrapperRef.current); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (currentElement && !disabled) { + (0, _observerUtil.observe)(currentElement, onInternalResize); + } -var _excluded = ["title", "attribute", "elementRef"], - _excluded2 = ["style", "className", "eventKey", "warnKey", "disabled", "itemIcon", "children", "role", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "onFocus"], - _excluded3 = ["active"]; + return function () { + return (0, _observerUtil.unobserve)(currentElement, onInternalResize); + }; + }, [elementRef.current, disabled]); // ============================ Render ============================ -// Since Menu event provide the `info.item` which point to the MenuItem node instance. -// We have to use class component here. -// This should be removed from doc & api in future. -var LegacyMenuItem = /*#__PURE__*/function (_React$Component) { - (0, _inherits2.default)(LegacyMenuItem, _React$Component); - - var _super = (0, _createSuper2.default)(LegacyMenuItem); + return /*#__PURE__*/React.createElement(_DomWrapper.default, { + ref: wrapperRef + }, canRef ? /*#__PURE__*/React.cloneElement(mergedChildren, { + ref: mergedRef + }) : mergedChildren); +} +},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","rc-util/es/ref":"AOnv","react":"n8MK","rc-util/es/Dom/findDOMNode":"JHqZ","../utils/observerUtil":"aRxH","./DomWrapper":"uLNA","../Collection":"Aa6e"}],"q9L5":[function(require,module,exports) { +"use strict"; - function LegacyMenuItem() { - (0, _classCallCheck2.default)(this, LegacyMenuItem); - return _super.apply(this, arguments); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - (0, _createClass2.default)(LegacyMenuItem, [{ - key: "render", - value: function render() { - var _this$props = this.props, - title = _this$props.title, - attribute = _this$props.attribute, - elementRef = _this$props.elementRef, - restProps = (0, _objectWithoutProperties2.default)(_this$props, _excluded); - var passedProps = (0, _omit.default)(restProps, ['eventKey']); - (0, _warning.default)(!attribute, '`attribute` of Menu.Item is deprecated. Please pass attribute directly.'); - return /*#__PURE__*/React.createElement(_rcOverflow.default.Item, (0, _extends2.default)({}, attribute, { - title: typeof title === 'string' ? title : undefined - }, passedProps, { - ref: elementRef - })); - } - }]); - return LegacyMenuItem; -}(React.Component); -/** - * Real Menu Item component - */ +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); +var React = _interopRequireWildcard(require("react")); -var InternalMenuItem = function InternalMenuItem(props) { - var _classNames; +var _toArray = _interopRequireDefault(require("rc-util/es/Children/toArray")); - var style = props.style, - className = props.className, - eventKey = props.eventKey, - warnKey = props.warnKey, - disabled = props.disabled, - itemIcon = props.itemIcon, - children = props.children, - role = props.role, - onMouseEnter = props.onMouseEnter, - onMouseLeave = props.onMouseLeave, - onClick = props.onClick, - onKeyDown = props.onKeyDown, - onFocus = props.onFocus, - restProps = (0, _objectWithoutProperties2.default)(props, _excluded2); - var domDataId = (0, _IdContext.useMenuId)(eventKey); +var _warning = require("rc-util/es/warning"); - var _React$useContext = React.useContext(_MenuContext.MenuContext), - prefixCls = _React$useContext.prefixCls, - onItemClick = _React$useContext.onItemClick, - contextDisabled = _React$useContext.disabled, - overflowDisabled = _React$useContext.overflowDisabled, - contextItemIcon = _React$useContext.itemIcon, - selectedKeys = _React$useContext.selectedKeys, - onActive = _React$useContext.onActive; +var _SingleObserver = _interopRequireDefault(require("./SingleObserver")); - var _React$useContext2 = React.useContext(_PrivateContext.default), - _internalRenderMenuItem = _React$useContext2._internalRenderMenuItem; +var _Collection = require("./Collection"); - var itemCls = "".concat(prefixCls, "-item"); - var legacyMenuItemRef = React.useRef(); - var elementRef = React.useRef(); - var mergedDisabled = contextDisabled || disabled; - var connectedKeys = (0, _PathContext.useFullPath)(eventKey); // ================================ Warn ================================ +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - if ("production" !== 'production' && warnKey) { - (0, _warning.default)(false, 'MenuItem should not leave undefined `key`.'); - } // ============================= Info ============================= +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var getEventInfo = function getEventInfo(e) { - return { - key: eventKey, - // Note: For legacy code is reversed which not like other antd component - keyPath: (0, _toConsumableArray2.default)(connectedKeys).reverse(), - item: legacyMenuItemRef.current, - domEvent: e - }; - }; // ============================= Icon ============================= +var INTERNAL_PREFIX_KEY = 'rc-observer-key'; +function ResizeObserver(props) { + var children = props.children; + var childNodes = typeof children === 'function' ? [children] : (0, _toArray.default)(children); - var mergedItemIcon = itemIcon || contextItemIcon; // ============================ Active ============================ + if ("production" !== 'production') { + if (childNodes.length > 1) { + (0, _warning.warning)(false, 'Find more than one child node with `children` in ResizeObserver. Please use ResizeObserver.Collection instead.'); + } else if (childNodes.length === 0) { + (0, _warning.warning)(false, '`children` of ResizeObserver is empty. Nothing is in observe.'); + } + } - var _useActive = (0, _useActive2.default)(eventKey, mergedDisabled, onMouseEnter, onMouseLeave), - active = _useActive.active, - activeProps = (0, _objectWithoutProperties2.default)(_useActive, _excluded3); // ============================ Select ============================ + return childNodes.map(function (child, index) { + var key = (child === null || child === void 0 ? void 0 : child.key) || "".concat(INTERNAL_PREFIX_KEY, "-").concat(index); + return /*#__PURE__*/React.createElement(_SingleObserver.default, (0, _extends2.default)({}, props, { + key: key + }), child); + }); +} +ResizeObserver.Collection = _Collection.Collection; +var _default = ResizeObserver; +exports.default = _default; +},{"@babel/runtime/helpers/esm/extends":"SpjQ","react":"n8MK","rc-util/es/Children/toArray":"artt","rc-util/es/warning":"YOfO","./SingleObserver":"bO8N","./Collection":"Aa6e"}],"dtu8":[function(require,module,exports) { +"use strict"; - var selected = selectedKeys.includes(eventKey); // ======================== DirectionStyle ======================== +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - var directionStyle = (0, _useDirectionStyle.default)(connectedKeys.length); // ============================ Events ============================ +var raf = function raf(callback) { + return +setTimeout(callback, 16); +}; - var onInternalClick = function onInternalClick(e) { - if (mergedDisabled) { - return; - } +var caf = function caf(num) { + return clearTimeout(num); +}; - var info = getEventInfo(e); - onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); - onItemClick(info); +if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) { + raf = function raf(callback) { + return window.requestAnimationFrame(callback); }; - var onInternalKeyDown = function onInternalKeyDown(e) { - onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e); - - if (e.which === _KeyCode.default.ENTER) { - var info = getEventInfo(e); // Legacy. Key will also trigger click event - - onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); - onItemClick(info); - } + caf = function caf(handle) { + return window.cancelAnimationFrame(handle); }; - /** - * Used for accessibility. Helper will focus element without key board. - * We should manually trigger an active - */ - +} - var onInternalFocus = function onInternalFocus(e) { - onActive(eventKey); - onFocus === null || onFocus === void 0 ? void 0 : onFocus(e); - }; // ============================ Render ============================ +var rafUUID = 0; +var rafIds = new Map(); +function cleanup(id) { + rafIds.delete(id); +} - var optionRoleProps = {}; +var wrapperRaf = function wrapperRaf(callback) { + var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + rafUUID += 1; + var id = rafUUID; - if (props.role === 'option') { - optionRoleProps['aria-selected'] = selected; - } + function callRef(leftTimes) { + if (leftTimes === 0) { + // Clean up + cleanup(id); // Trigger - var renderNode = /*#__PURE__*/React.createElement(LegacyMenuItem, (0, _extends2.default)({ - ref: legacyMenuItemRef, - elementRef: elementRef, - role: role === null ? 'none' : role || 'menuitem', - tabIndex: disabled ? null : -1, - "data-menu-id": overflowDisabled && domDataId ? null : domDataId - }, restProps, activeProps, optionRoleProps, { - component: "li", - "aria-disabled": disabled, - style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, directionStyle), style), - className: (0, _classnames.default)(itemCls, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(itemCls, "-active"), active), (0, _defineProperty2.default)(_classNames, "".concat(itemCls, "-selected"), selected), (0, _defineProperty2.default)(_classNames, "".concat(itemCls, "-disabled"), mergedDisabled), _classNames), className), - onClick: onInternalClick, - onKeyDown: onInternalKeyDown, - onFocus: onInternalFocus - }), children, /*#__PURE__*/React.createElement(_Icon.default, { - props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, { - isSelected: selected - }), - icon: mergedItemIcon - })); + callback(); + } else { + // Next raf + var realId = raf(function () { + callRef(leftTimes - 1); + }); // Bind real raf id - if (_internalRenderMenuItem) { - renderNode = _internalRenderMenuItem(renderNode, props, { - selected: selected - }); + rafIds.set(id, realId); + } } - return renderNode; + callRef(times); + return id; }; -function MenuItem(props) { - var eventKey = props.eventKey; // ==================== Record KeyPath ==================== - - var measure = (0, _PathContext.useMeasure)(); - var connectedKeyPath = (0, _PathContext.useFullPath)(eventKey); // eslint-disable-next-line consistent-return +wrapperRaf.cancel = function (id) { + var realId = rafIds.get(id); + cleanup(id); + return caf(realId); +}; - React.useEffect(function () { - if (measure) { - measure.registerPath(eventKey, connectedKeyPath); - return function () { - measure.unregisterPath(eventKey, connectedKeyPath); - }; - } - }, [connectedKeyPath]); +if ("production" !== 'production') { + wrapperRaf.ids = function () { + return rafIds; + }; +} - if (measure) { - return null; - } // ======================== Render ======================== +var _default = wrapperRaf; +exports.default = _default; +},{}],"XbWx":[function(require,module,exports) { +/** + * @license React + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict';var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference"); +function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m; +exports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p}; +exports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v; +},{}],"N5Ym":[function(require,module,exports) { +'use strict'; - return /*#__PURE__*/React.createElement(InternalMenuItem, props); +if ("production" === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); } - -var _default = MenuItem; -exports.default = _default; -},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","react":"n8MK","classnames":"qb7c","rc-overflow":"H6C2","rc-util/es/warning":"YOfO","rc-util/es/KeyCode":"Imvn","rc-util/es/omit":"P8ML","./context/MenuContext":"WRUc","./hooks/useActive":"LQKT","./utils/warnUtil":"cvmo","./Icon":"E0zE","./hooks/useDirectionStyle":"Pnmu","./context/PathContext":"thAF","./context/IdContext":"VB3D","./context/PrivateContext":"V73O"}],"T1Gl":[function(require,module,exports) { +},{"./cjs/react-is.production.min.js":"XbWx"}],"lrsr":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseChildren = parseChildren; -exports.parseItems = parseItems; - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); - -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); +exports.composeRef = composeRef; +exports.fillRef = fillRef; +exports.supportNodeRef = supportNodeRef; +exports.supportRef = supportRef; +exports.useComposeRef = useComposeRef; var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); - -var React = _interopRequireWildcard(require("react")); - -var _toArray = _interopRequireDefault(require("rc-util/es/Children/toArray")); - -var _ = require(".."); +var _react = require("react"); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _reactIs = require("react-is"); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _useMemo = _interopRequireDefault(require("./hooks/useMemo")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _excluded = ["label", "children", "key", "type"]; +/* eslint-disable no-param-reassign */ +function fillRef(ref, node) { + if (typeof ref === 'function') { + ref(node); + } else if ((0, _typeof2.default)(ref) === 'object' && ref && 'current' in ref) { + ref.current = node; + } +} +/** + * Merge refs into one ref function to support ref passing. + */ -function parseChildren(children, keyPath) { - return (0, _toArray.default)(children).map(function (child, index) { - if ( /*#__PURE__*/React.isValidElement(child)) { - var _child$props$eventKey, _child$props; - var key = child.key; - var eventKey = (_child$props$eventKey = (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.eventKey) !== null && _child$props$eventKey !== void 0 ? _child$props$eventKey : key; - var emptyKey = eventKey === null || eventKey === undefined; +function composeRef() { + for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { + refs[_key] = arguments[_key]; + } - if (emptyKey) { - eventKey = "tmp_key-".concat([].concat((0, _toConsumableArray2.default)(keyPath), [index]).join('-')); - } + var refList = refs.filter(function (ref) { + return ref; + }); - var cloneProps = { - key: eventKey, - eventKey: eventKey - }; + if (refList.length <= 1) { + return refList[0]; + } - if ("production" !== 'production' && emptyKey) { - cloneProps.warnKey = true; - } + return function (node) { + refs.forEach(function (ref) { + fillRef(ref, node); + }); + }; +} - return /*#__PURE__*/React.cloneElement(child, cloneProps); - } +function useComposeRef() { + for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + refs[_key2] = arguments[_key2]; + } - return child; + return (0, _useMemo.default)(function () { + return composeRef.apply(void 0, refs); + }, refs, function (prev, next) { + return prev.length !== next.length || prev.every(function (ref, i) { + return ref !== next[i]; + }); }); } -function convertItemsToNodes(list) { - return (list || []).map(function (opt, index) { - if (opt && (0, _typeof2.default)(opt) === 'object') { - var label = opt.label, - children = opt.children, - key = opt.key, - type = opt.type, - restProps = (0, _objectWithoutProperties2.default)(opt, _excluded); - var mergedKey = key !== null && key !== void 0 ? key : "tmp-".concat(index); // MenuItemGroup & SubMenuItem - - if (children || type === 'group') { - if (type === 'group') { - // Group - return /*#__PURE__*/React.createElement(_.MenuItemGroup, (0, _extends2.default)({ - key: mergedKey - }, restProps, { - title: label - }), convertItemsToNodes(children)); - } // Sub Menu - +function supportRef(nodeOrComponent) { + var _type$prototype, _nodeOrComponent$prot; - return /*#__PURE__*/React.createElement(_.SubMenu, (0, _extends2.default)({ - key: mergedKey - }, restProps, { - title: label - }), convertItemsToNodes(children)); - } // MenuItem & Divider + var type = (0, _reactIs.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type; // Function component node + if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== _reactIs.ForwardRef) { + return false; + } // Class component - if (type === 'divider') { - return /*#__PURE__*/React.createElement(_.Divider, (0, _extends2.default)({ - key: mergedKey - }, restProps)); - } - return /*#__PURE__*/React.createElement(_.MenuItem, (0, _extends2.default)({ - key: mergedKey - }, restProps), label); - } + if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== _reactIs.ForwardRef) { + return false; + } - return null; - }).filter(function (opt) { - return opt; - }); + return true; } -function parseItems(children, items, keyPath) { - var childNodes = children; +function supportNodeRef(node) { + if (! /*#__PURE__*/(0, _react.isValidElement)(node)) { + return false; + } - if (items) { - childNodes = convertItemsToNodes(items); + if ((0, _reactIs.isFragment)(node)) { + return false; } - return parseChildren(childNodes, keyPath); + return supportRef(node); } -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/typeof":"xLw6","@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","react":"n8MK","rc-util/es/Children/toArray":"artt","..":"VH7R"}],"vAIo":[function(require,module,exports) { +/* eslint-enable */ +},{"@babel/runtime/helpers/esm/typeof":"xLw6","react":"n8MK","react-is":"N5Ym","./hooks/useMemo":"YcSF"}],"uhKO":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = useMemoCallback; +exports.default = useOffsets; -var React = _interopRequireWildcard(require("react")); +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _react = require("react"); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/** - * Cache callback function that always return same ref instead. - * This is used for context optimization. - */ -function useMemoCallback(func) { - var funRef = React.useRef(func); - funRef.current = func; - var callback = React.useCallback(function () { - var _funRef$current; +var DEFAULT_SIZE = { + width: 0, + height: 0, + left: 0, + top: 0 +}; - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; +function useOffsets(tabs, tabSizes, holderScrollWidth) { + return (0, _react.useMemo)(function () { + var _tabs$; + + var map = new Map(); + var lastOffset = tabSizes.get((_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.key) || DEFAULT_SIZE; + var rightOffset = lastOffset.left + lastOffset.width; + + for (var i = 0; i < tabs.length; i += 1) { + var key = tabs[i].key; + var data = tabSizes.get(key); // Reuse last one when not exist yet + + if (!data) { + var _tabs; + + data = tabSizes.get((_tabs = tabs[i - 1]) === null || _tabs === void 0 ? void 0 : _tabs.key) || DEFAULT_SIZE; + } + + var entity = map.get(key) || (0, _objectSpread2.default)({}, data); // Right + + entity.right = rightOffset - entity.left - entity.width; // Update entity + + map.set(key, entity); } - return (_funRef$current = funRef.current) === null || _funRef$current === void 0 ? void 0 : _funRef$current.call.apply(_funRef$current, [funRef].concat(args)); - }, []); - return func ? callback : undefined; + return map; + }, [tabs.map(function (tab) { + return tab.key; + }).join('_'), tabSizes, holderScrollWidth]); } -},{"react":"n8MK"}],"imhB":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK"}],"AAQN":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); +exports.default = useSyncState; -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); var React = _interopRequireWildcard(require("react")); -var _classnames = _interopRequireDefault(require("classnames")); - -var _MenuContext = require("../context/MenuContext"); - function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _excluded = ["className", "children"]; - -var InternalSubMenuList = function InternalSubMenuList(_ref, ref) { - var className = _ref.className, - children = _ref.children, - restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); - - var _React$useContext = React.useContext(_MenuContext.MenuContext), - prefixCls = _React$useContext.prefixCls, - mode = _React$useContext.mode, - rtl = _React$useContext.rtl; - - return /*#__PURE__*/React.createElement("ul", (0, _extends2.default)({ - className: (0, _classnames.default)(prefixCls, rtl && "".concat(prefixCls, "-rtl"), "".concat(prefixCls, "-sub"), "".concat(prefixCls, "-").concat(mode === 'inline' ? 'inline' : 'vertical'), className) - }, restProps, { - "data-menu-list": true, - ref: ref - }), children); -}; - -var SubMenuList = /*#__PURE__*/React.forwardRef(InternalSubMenuList); -SubMenuList.displayName = 'SubMenuList'; -var _default = SubMenuList; -exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"qb7c","../context/MenuContext":"WRUc"}],"asZT":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = contains; - -function contains(root, n) { - if (!root) { - return false; - } // Use native if support - - - if (root.contains) { - return root.contains(n); - } // `document.contains` not support with IE11 +function useSyncState(defaultState, onChange) { + var stateRef = React.useRef(defaultState); + var _React$useState = React.useState({}), + _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), + forceUpdate = _React$useState2[1]; - var node = n; + function setState(updater) { + var newValue = typeof updater === 'function' ? updater(stateRef.current) : updater; - while (node) { - if (node === root) { - return true; + if (newValue !== stateRef.current) { + onChange(newValue, stateRef.current); } - node = node.parentNode; + stateRef.current = newValue; + forceUpdate({}); } - return false; + return [stateRef.current, setState]; } -},{}],"v9LT":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK"}],"MZjt":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = addEventListenerWrap; +exports.default = useTouchMove; -var _reactDom = _interopRequireDefault(require("react-dom")); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var React = _interopRequireWildcard(require("react")); -function addEventListenerWrap(target, eventType, cb, option) { - /* eslint camelcase: 2 */ - var callback = _reactDom.default.unstable_batchedUpdates ? function run(e) { - _reactDom.default.unstable_batchedUpdates(cb, e); - } : cb; +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - if (target.addEventListener) { - target.addEventListener(eventType, callback, option); - } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - return { - remove: function remove() { - if (target.removeEventListener) { - target.removeEventListener(eventType, callback, option); - } - } - }; -} -},{"react-dom":"NKHc"}],"LoYh":[function(require,module,exports) { -"use strict"; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; +var MIN_SWIPE_DISTANCE = 0.1; +var STOP_SWIPE_DISTANCE = 0.01; +var REFRESH_INTERVAL = 20; +var SPEED_OFF_MULTIPLE = Math.pow(0.995, REFRESH_INTERVAL); // ================================= Hook ================================= -var _react = require("react"); +function useTouchMove(ref, onOffset) { + var _useState = (0, React.useState)(), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + touchPosition = _useState2[0], + setTouchPosition = _useState2[1]; -var _reactDom = _interopRequireDefault(require("react-dom")); + var _useState3 = (0, React.useState)(0), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + lastTimestamp = _useState4[0], + setLastTimestamp = _useState4[1]; -var _canUseDom = _interopRequireDefault(require("./Dom/canUseDom")); + var _useState5 = (0, React.useState)(0), + _useState6 = (0, _slicedToArray2.default)(_useState5, 2), + lastTimeDiff = _useState6[0], + setLastTimeDiff = _useState6[1]; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + var _useState7 = (0, React.useState)(), + _useState8 = (0, _slicedToArray2.default)(_useState7, 2), + lastOffset = _useState8[0], + setLastOffset = _useState8[1]; -var Portal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) { - var didUpdate = props.didUpdate, - getContainer = props.getContainer, - children = props.children; - var parentRef = (0, _react.useRef)(); - var containerRef = (0, _react.useRef)(); // Ref return nothing, only for wrapper check exist + var motionRef = (0, React.useRef)(); // ========================= Events ========================= + // >>> Touch events - (0, _react.useImperativeHandle)(ref, function () { - return {}; - }); // Create container in client side with sync to avoid useEffect not get ref + function onTouchStart(e) { + var _e$touches$ = e.touches[0], + screenX = _e$touches$.screenX, + screenY = _e$touches$.screenY; + setTouchPosition({ + x: screenX, + y: screenY + }); + window.clearInterval(motionRef.current); + } - var initRef = (0, _react.useRef)(false); + function onTouchMove(e) { + if (!touchPosition) return; + e.preventDefault(); + var _e$touches$2 = e.touches[0], + screenX = _e$touches$2.screenX, + screenY = _e$touches$2.screenY; + setTouchPosition({ + x: screenX, + y: screenY + }); + var offsetX = screenX - touchPosition.x; + var offsetY = screenY - touchPosition.y; + onOffset(offsetX, offsetY); + var now = Date.now(); + setLastTimestamp(now); + setLastTimeDiff(now - lastTimestamp); + setLastOffset({ + x: offsetX, + y: offsetY + }); + } - if (!initRef.current && (0, _canUseDom.default)()) { - containerRef.current = getContainer(); - parentRef.current = containerRef.current.parentNode; - initRef.current = true; - } // [Legacy] Used by `rc-trigger` + function onTouchEnd() { + if (!touchPosition) return; + setTouchPosition(null); + setLastOffset(null); // Swipe if needed + if (lastOffset) { + var distanceX = lastOffset.x / lastTimeDiff; + var distanceY = lastOffset.y / lastTimeDiff; + var absX = Math.abs(distanceX); + var absY = Math.abs(distanceY); // Skip swipe if low distance - (0, _react.useEffect)(function () { - didUpdate === null || didUpdate === void 0 ? void 0 : didUpdate(props); - }); - (0, _react.useEffect)(function () { - // Restore container to original place - // React 18 StrictMode will unmount first and mount back for effect test: - // https://reactjs.org/blog/2022/03/29/react-v18.html#new-strict-mode-behaviors - if (containerRef.current.parentNode === null && parentRef.current !== null) { - parentRef.current.appendChild(containerRef.current); - } + if (Math.max(absX, absY) < MIN_SWIPE_DISTANCE) return; + var currentX = distanceX; + var currentY = distanceY; + motionRef.current = window.setInterval(function () { + if (Math.abs(currentX) < STOP_SWIPE_DISTANCE && Math.abs(currentY) < STOP_SWIPE_DISTANCE) { + window.clearInterval(motionRef.current); + return; + } - return function () { - var _containerRef$current, _containerRef$current2; // [Legacy] This should not be handle by Portal but parent PortalWrapper instead. - // Since some component use `Portal` directly, we have to keep the logic here. + currentX *= SPEED_OFF_MULTIPLE; + currentY *= SPEED_OFF_MULTIPLE; + onOffset(currentX * REFRESH_INTERVAL, currentY * REFRESH_INTERVAL); + }, REFRESH_INTERVAL); + } + } // >>> Wheel event - (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.parentNode) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.removeChild(containerRef.current); - }; - }, []); - return containerRef.current ? /*#__PURE__*/_reactDom.default.createPortal(children, containerRef.current) : null; -}); -var _default = Portal; -exports.default = _default; -},{"react":"n8MK","react-dom":"NKHc","./Dom/canUseDom":"VhF6"}],"Hyzp":[function(require,module,exports) { -"use strict"; + var lastWheelDirectionRef = (0, React.useRef)(); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getAlignFromPlacement = getAlignFromPlacement; -exports.getAlignPopupClassName = getAlignPopupClassName; + function onWheel(e) { + var deltaX = e.deltaX, + deltaY = e.deltaY; // Convert both to x & y since wheel only happened on PC -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + var mixed = 0; + var absX = Math.abs(deltaX); + var absY = Math.abs(deltaY); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (absX === absY) { + mixed = lastWheelDirectionRef.current === 'x' ? deltaX : deltaY; + } else if (absX > absY) { + mixed = deltaX; + lastWheelDirectionRef.current = 'x'; + } else { + mixed = deltaY; + lastWheelDirectionRef.current = 'y'; + } -function isPointsEq(a1, a2, isAlignPoint) { - if (isAlignPoint) { - return a1[0] === a2[0]; - } + if (onOffset(-mixed, -mixed)) { + e.preventDefault(); + } + } // ========================= Effect ========================= - return a1[0] === a2[0] && a1[1] === a2[1]; -} -function getAlignFromPlacement(builtinPlacements, placementStr, align) { - var baseAlign = builtinPlacements[placementStr] || {}; - return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, baseAlign), align); -} + var touchEventsRef = (0, React.useRef)(null); + touchEventsRef.current = { + onTouchStart: onTouchStart, + onTouchMove: onTouchMove, + onTouchEnd: onTouchEnd, + onWheel: onWheel + }; + React.useEffect(function () { + function onProxyTouchStart(e) { + touchEventsRef.current.onTouchStart(e); + } -function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) { - var points = align.points; - var placements = Object.keys(builtinPlacements); + function onProxyTouchMove(e) { + touchEventsRef.current.onTouchMove(e); + } - for (var i = 0; i < placements.length; i += 1) { - var placement = placements[i]; + function onProxyTouchEnd(e) { + touchEventsRef.current.onTouchEnd(e); + } - if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) { - return "".concat(prefixCls, "-placement-").concat(placement); + function onProxyWheel(e) { + touchEventsRef.current.onWheel(e); } - } - return ''; + document.addEventListener('touchmove', onProxyTouchMove, { + passive: false + }); + document.addEventListener('touchend', onProxyTouchEnd, { + passive: false + }); // No need to clean up since element removed + + ref.current.addEventListener('touchstart', onProxyTouchStart, { + passive: false + }); + ref.current.addEventListener('wheel', onProxyWheel); + return function () { + document.removeEventListener('touchmove', onProxyTouchMove); + document.removeEventListener('touchend', onProxyTouchEnd); + }; + }, []); } -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT"}],"m1Rl":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK"}],"yzOp":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.animationEndName = void 0; -exports.getTransitionName = getTransitionName; -exports.getVendorPrefixedEventName = getVendorPrefixedEventName; -exports.getVendorPrefixes = getVendorPrefixes; -exports.transitionEndName = exports.supportTransition = void 0; +exports.default = useUpdate; +exports.useUpdateState = useUpdateState; -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); -var _canUseDom = _interopRequireDefault(require("rc-util/es/Dom/canUseDom")); +var _useLayoutEffect = require("rc-util/es/hooks/useLayoutEffect"); + +var _react = require("react"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -// ================= Transition ================= -// Event wrapper. Copy from react source code -function makePrefixMap(styleProp, eventName) { - var prefixes = {}; - prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); - prefixes["Webkit".concat(styleProp)] = "webkit".concat(eventName); - prefixes["Moz".concat(styleProp)] = "moz".concat(eventName); - prefixes["ms".concat(styleProp)] = "MS".concat(eventName); - prefixes["O".concat(styleProp)] = "o".concat(eventName.toLowerCase()); - return prefixes; -} +/** + * Help to merge callback with `useLayoutEffect`. + * One time will only trigger once. + */ +function useUpdate(callback) { + var _useState = (0, _react.useState)(0), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + count = _useState2[0], + setCount = _useState2[1]; -function getVendorPrefixes(domSupport, win) { - var prefixes = { - animationend: makePrefixMap('Animation', 'AnimationEnd'), - transitionend: makePrefixMap('Transition', 'TransitionEnd') - }; + var effectRef = (0, _react.useRef)(0); + var callbackRef = (0, _react.useRef)(); + callbackRef.current = callback; // Trigger on `useLayoutEffect` - if (domSupport) { - if (!('AnimationEvent' in win)) { - delete prefixes.animationend.animation; - } + (0, _useLayoutEffect.useLayoutUpdateEffect)(function () { + var _callbackRef$current; - if (!('TransitionEvent' in win)) { - delete prefixes.transitionend.transition; + (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef); + }, [count]); // Trigger to update count + + return function () { + if (effectRef.current !== count) { + return; } - } - return prefixes; + effectRef.current += 1; + setCount(effectRef.current); + }; } -var vendorPrefixes = getVendorPrefixes((0, _canUseDom.default)(), typeof window !== 'undefined' ? window : {}); -var style = {}; +function useUpdateState(defaultState) { + var batchRef = (0, _react.useRef)([]); -if ((0, _canUseDom.default)()) { - var _document$createEleme = document.createElement('div'); + var _useState3 = (0, _react.useState)({}), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + forceUpdate = _useState4[1]; - style = _document$createEleme.style; + var state = (0, _react.useRef)(typeof defaultState === 'function' ? defaultState() : defaultState); + var flushUpdate = useUpdate(function () { + var current = state.current; + batchRef.current.forEach(function (callback) { + current = callback(current); + }); + batchRef.current = []; + state.current = current; + forceUpdate({}); + }); + + function updater(callback) { + batchRef.current.push(callback); + flushUpdate(); + } + + return [state.current, updater]; } +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","rc-util/es/hooks/useLayoutEffect":"ZlGx","react":"n8MK"}],"eQ4Y":[function(require,module,exports) { +"use strict"; -var prefixedEventNames = {}; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = useVisibleRange; -function getVendorPrefixedEventName(eventName) { - if (prefixedEventNames[eventName]) { - return prefixedEventNames[eventName]; +var _react = require("react"); + +var DEFAULT_SIZE = { + width: 0, + height: 0, + left: 0, + top: 0, + right: 0 +}; + +function useVisibleRange(tabOffsets, visibleTabContentValue, transform, tabContentSizeValue, addNodeSizeValue, operationNodeSizeValue, _ref) { + var tabs = _ref.tabs, + tabPosition = _ref.tabPosition, + rtl = _ref.rtl; + var charUnit; + var position; + var transformSize; + + if (['top', 'bottom'].includes(tabPosition)) { + charUnit = 'width'; + position = rtl ? 'right' : 'left'; + transformSize = Math.abs(transform); + } else { + charUnit = 'height'; + position = 'top'; + transformSize = -transform; } - var prefixMap = vendorPrefixes[eventName]; + return (0, _react.useMemo)(function () { + if (!tabs.length) { + return [0, 0]; + } - if (prefixMap) { - var stylePropList = Object.keys(prefixMap); - var len = stylePropList.length; + var len = tabs.length; + var endIndex = len; for (var i = 0; i < len; i += 1) { - var styleProp = stylePropList[i]; + var offset = tabOffsets.get(tabs[i].key) || DEFAULT_SIZE; - if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in style) { - prefixedEventNames[eventName] = prefixMap[styleProp]; - return prefixedEventNames[eventName]; + if (offset[position] + offset[charUnit] > transformSize + visibleTabContentValue) { + endIndex = i - 1; + break; } } - } - return ''; -} - -var internalAnimationEndName = getVendorPrefixedEventName('animationend'); -var internalTransitionEndName = getVendorPrefixedEventName('transitionend'); -var supportTransition = !!(internalAnimationEndName && internalTransitionEndName); -exports.supportTransition = supportTransition; -var animationEndName = internalAnimationEndName || 'animationend'; -exports.animationEndName = animationEndName; -var transitionEndName = internalTransitionEndName || 'transitionend'; -exports.transitionEndName = transitionEndName; + var startIndex = 0; -function getTransitionName(transitionName, transitionType) { - if (!transitionName) return null; + for (var _i = len - 1; _i >= 0; _i -= 1) { + var _offset = tabOffsets.get(tabs[_i].key) || DEFAULT_SIZE; - if ((0, _typeof2.default)(transitionName) === 'object') { - var type = transitionType.replace(/-\w/g, function (match) { - return match[1].toUpperCase(); - }); - return transitionName[type]; - } + if (_offset[position] < transformSize) { + startIndex = _i + 1; + break; + } + } - return "".concat(transitionName, "-").concat(transitionType); + return [startIndex, endIndex]; + }, [tabOffsets, visibleTabContentValue, tabContentSizeValue, addNodeSizeValue, operationNodeSizeValue, transformSize, tabPosition, tabs.map(function (tab) { + return tab.key; + }).join('_'), rtl]); } -},{"@babel/runtime/helpers/esm/typeof":"xLw6","rc-util/es/Dom/canUseDom":"VhF6"}],"JzRG":[function(require,module,exports) { +},{"react":"n8MK"}],"CUlO":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.STEP_START = exports.STEP_PREPARE = exports.STEP_NONE = exports.STEP_ACTIVE = exports.STEP_ACTIVATED = exports.STATUS_NONE = exports.STATUS_LEAVE = exports.STATUS_ENTER = exports.STATUS_APPEAR = void 0; -var STATUS_NONE = 'none'; -exports.STATUS_NONE = STATUS_NONE; -var STATUS_APPEAR = 'appear'; -exports.STATUS_APPEAR = STATUS_APPEAR; -var STATUS_ENTER = 'enter'; -exports.STATUS_ENTER = STATUS_ENTER; -var STATUS_LEAVE = 'leave'; -exports.STATUS_LEAVE = STATUS_LEAVE; -var STEP_NONE = 'none'; -exports.STEP_NONE = STEP_NONE; -var STEP_PREPARE = 'prepare'; -exports.STEP_PREPARE = STEP_PREPARE; -var STEP_START = 'start'; -exports.STEP_START = STEP_START; -var STEP_ACTIVE = 'active'; -exports.STEP_ACTIVE = STEP_ACTIVE; -var STEP_ACTIVATED = 'end'; -exports.STEP_ACTIVATED = STEP_ACTIVATED; -},{}],"LIDo":[function(require,module,exports) { +exports.genDataNodeKey = genDataNodeKey; +exports.stringify = stringify; + +/** + * We trade Map as deps which may change with same value but different ref object. + * We should make it as hash for deps + * */ +function stringify(obj) { + var tgt; + + if (obj instanceof Map) { + tgt = {}; + obj.forEach(function (v, k) { + tgt[k] = v; + }); + } else { + tgt = obj; + } + + return JSON.stringify(tgt); +} + +var RC_TABS_DOUBLE_QUOTE = 'TABS_DQ'; + +function genDataNodeKey(key) { + return String(key).replace(/"/g, RC_TABS_DOUBLE_QUOTE); +} +},{}],"kT7Q":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6299,48 +5705,38 @@ exports.default = void 0; var React = _interopRequireWildcard(require("react")); -var _raf = _interopRequireDefault(require("rc-util/es/raf")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -var _default = function _default() { - var nextFrameRef = React.useRef(null); +function AddButton(_ref, ref) { + var prefixCls = _ref.prefixCls, + editable = _ref.editable, + locale = _ref.locale, + style = _ref.style; - function cancelNextFrame() { - _raf.default.cancel(nextFrameRef.current); + if (!editable || editable.showAdd === false) { + return null; } - function nextFrame(callback) { - var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; - cancelNextFrame(); - var nextFrameId = (0, _raf.default)(function () { - if (delay <= 1) { - callback({ - isCanceled: function isCanceled() { - return nextFrameId !== nextFrameRef.current; - } - }); - } else { - nextFrame(callback, delay - 1); - } - }); - nextFrameRef.current = nextFrameId; - } + return /*#__PURE__*/React.createElement("button", { + ref: ref, + type: "button", + className: "".concat(prefixCls, "-nav-add"), + style: style, + "aria-label": (locale === null || locale === void 0 ? void 0 : locale.addAriaLabel) || 'Add tab', + onClick: function onClick(event) { + editable.onEdit('add', { + event: event + }); + } + }, editable.addIcon || '+'); +} - React.useEffect(function () { - return function () { - cancelNextFrame(); - }; - }, []); - return [nextFrame, cancelNextFrame]; -}; +var _default = /*#__PURE__*/React.forwardRef(AddButton); exports.default = _default; -},{"react":"n8MK","rc-util/es/raf":"adDJ"}],"szcY":[function(require,module,exports) { +},{"react":"n8MK"}],"Btc5":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6348,110 +5744,113 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _react = require("react"); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); -var _canUseDom = _interopRequireDefault(require("rc-util/es/Dom/canUseDom")); +var React = _interopRequireWildcard(require("react")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -// It's safe to use `useLayoutEffect` but the warning is annoying -var useIsomorphicLayoutEffect = (0, _canUseDom.default)() ? _react.useLayoutEffect : _react.useEffect; -var _default = useIsomorphicLayoutEffect; +var ExtraContent = /*#__PURE__*/React.forwardRef(function (_ref, ref) { + var position = _ref.position, + prefixCls = _ref.prefixCls, + extra = _ref.extra; + if (!extra) return null; + var content; // Parse extra + + var assertExtra = {}; + + if ((0, _typeof2.default)(extra) === 'object' && ! /*#__PURE__*/React.isValidElement(extra)) { + assertExtra = extra; + } else { + assertExtra.right = extra; + } + + if (position === 'right') { + content = assertExtra.right; + } + + if (position === 'left') { + content = assertExtra.left; + } + + return content ? /*#__PURE__*/React.createElement("div", { + className: "".concat(prefixCls, "-extra-content"), + ref: ref + }, content) : null; +}); + +if ("production" !== 'production') { + ExtraContent.displayName = 'ExtraContent'; +} + +var _default = ExtraContent; exports.default = _default; -},{"react":"n8MK","rc-util/es/Dom/canUseDom":"VhF6"}],"hnmF":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/typeof":"xLw6","react":"n8MK"}],"asZT":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = exports.SkipStep = exports.DoStep = void 0; -exports.isActive = isActive; +exports.default = contains; -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +function contains(root, n) { + if (!root) { + return false; + } // Use native if support -var React = _interopRequireWildcard(require("react")); -var _useState3 = _interopRequireDefault(require("rc-util/es/hooks/useState")); + if (root.contains) { + return root.contains(n); + } // `document.contains` not support with IE11 -var _interface = require("../interface"); -var _useNextFrame3 = _interopRequireDefault(require("./useNextFrame")); + var node = n; -var _useIsomorphicLayoutEffect = _interopRequireDefault(require("./useIsomorphicLayoutEffect")); + while (node) { + if (node === root) { + return true; + } -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + node = node.parentNode; + } -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + return false; +} +},{}],"v9LT":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = addEventListenerWrap; + +var _reactDom = _interopRequireDefault(require("react-dom")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var STEP_QUEUE = [_interface.STEP_PREPARE, _interface.STEP_START, _interface.STEP_ACTIVE, _interface.STEP_ACTIVATED]; -/** Skip current step */ - -var SkipStep = false; -/** Current step should be update in */ - -exports.SkipStep = SkipStep; -var DoStep = true; -exports.DoStep = DoStep; - -function isActive(step) { - return step === _interface.STEP_ACTIVE || step === _interface.STEP_ACTIVATED; -} - -var _default = function _default(status, callback) { - var _useState = (0, _useState3.default)(_interface.STEP_NONE), - _useState2 = (0, _slicedToArray2.default)(_useState, 2), - step = _useState2[0], - setStep = _useState2[1]; - - var _useNextFrame = (0, _useNextFrame3.default)(), - _useNextFrame2 = (0, _slicedToArray2.default)(_useNextFrame, 2), - nextFrame = _useNextFrame2[0], - cancelNextFrame = _useNextFrame2[1]; +function addEventListenerWrap(target, eventType, cb, option) { + /* eslint camelcase: 2 */ + var callback = _reactDom.default.unstable_batchedUpdates ? function run(e) { + _reactDom.default.unstable_batchedUpdates(cb, e); + } : cb; - function startQueue() { - setStep(_interface.STEP_PREPARE, true); + if (target.addEventListener) { + target.addEventListener(eventType, callback, option); } - (0, _useIsomorphicLayoutEffect.default)(function () { - if (step !== _interface.STEP_NONE && step !== _interface.STEP_ACTIVATED) { - var index = STEP_QUEUE.indexOf(step); - var nextStep = STEP_QUEUE[index + 1]; - var result = callback(step); - - if (result === SkipStep) { - // Skip when no needed - setStep(nextStep, true); - } else { - // Do as frame for step update - nextFrame(function (info) { - function doNext() { - // Skip since current queue is ood - if (info.isCanceled()) return; - setStep(nextStep, true); - } - - if (result === true) { - doNext(); - } else { - // Only promise should be async - Promise.resolve(result).then(doNext); - } - }); + return { + remove: function remove() { + if (target.removeEventListener) { + target.removeEventListener(eventType, callback, option); } } - }, [status, step]); - React.useEffect(function () { - return function () { - cancelNextFrame(); - }; - }, []); - return [startQueue, step]; -}; - -exports.default = _default; -},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/hooks/useState":"OlRb","../interface":"JzRG","./useNextFrame":"LIDo","./useIsomorphicLayoutEffect":"szcY"}],"UjUO":[function(require,module,exports) { + }; +} +},{"react-dom":"NKHc"}],"LoYh":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6459,306 +5858,390 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var React = _interopRequireWildcard(require("react")); +var _react = require("react"); -var _motion = require("../util/motion"); +var _reactDom = _interopRequireDefault(require("react-dom")); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _canUseDom = _interopRequireDefault(require("./Dom/canUseDom")); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _default = function _default(callback) { - var cacheElementRef = (0, React.useRef)(); // Cache callback +var Portal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) { + var didUpdate = props.didUpdate, + getContainer = props.getContainer, + children = props.children; + var parentRef = (0, _react.useRef)(); + var containerRef = (0, _react.useRef)(); // Ref return nothing, only for wrapper check exist - var callbackRef = (0, React.useRef)(callback); - callbackRef.current = callback; // Internal motion event handler + (0, _react.useImperativeHandle)(ref, function () { + return {}; + }); // Create container in client side with sync to avoid useEffect not get ref - var onInternalMotionEnd = React.useCallback(function (event) { - callbackRef.current(event); - }, []); // Remove events + var initRef = (0, _react.useRef)(false); - function removeMotionEvents(element) { - if (element) { - element.removeEventListener(_motion.transitionEndName, onInternalMotionEnd); - element.removeEventListener(_motion.animationEndName, onInternalMotionEnd); - } - } // Patch events + if (!initRef.current && (0, _canUseDom.default)()) { + containerRef.current = getContainer(); + parentRef.current = containerRef.current.parentNode; + initRef.current = true; + } // [Legacy] Used by `rc-trigger` - function patchMotionEvents(element) { - if (cacheElementRef.current && cacheElementRef.current !== element) { - removeMotionEvents(cacheElementRef.current); + (0, _react.useEffect)(function () { + didUpdate === null || didUpdate === void 0 ? void 0 : didUpdate(props); + }); + (0, _react.useEffect)(function () { + // Restore container to original place + // React 18 StrictMode will unmount first and mount back for effect test: + // https://reactjs.org/blog/2022/03/29/react-v18.html#new-strict-mode-behaviors + if (containerRef.current.parentNode === null && parentRef.current !== null) { + parentRef.current.appendChild(containerRef.current); } - if (element && element !== cacheElementRef.current) { - element.addEventListener(_motion.transitionEndName, onInternalMotionEnd); - element.addEventListener(_motion.animationEndName, onInternalMotionEnd); // Save as cache in case dom removed trigger by `motionDeadline` - - cacheElementRef.current = element; - } - } // Clean up when removed + return function () { + var _containerRef$current, _containerRef$current2; // [Legacy] This should not be handle by Portal but parent PortalWrapper instead. + // Since some component use `Portal` directly, we have to keep the logic here. - React.useEffect(function () { - return function () { - removeMotionEvents(cacheElementRef.current); + (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.parentNode) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.removeChild(containerRef.current); }; }, []); - return [patchMotionEvents, removeMotionEvents]; -}; - + return containerRef.current ? /*#__PURE__*/_reactDom.default.createPortal(children, containerRef.current) : null; +}); +var _default = Portal; exports.default = _default; -},{"react":"n8MK","../util/motion":"m1Rl"}],"mvOU":[function(require,module,exports) { +},{"react":"n8MK","react-dom":"NKHc","./Dom/canUseDom":"s2cK"}],"Hyzp":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = useStatus; +exports.getAlignFromPlacement = getAlignFromPlacement; +exports.getAlignPopupClassName = getAlignPopupClassName; var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +function isPointsEq(a1, a2, isAlignPoint) { + if (isAlignPoint) { + return a1[0] === a2[0]; + } -var React = _interopRequireWildcard(require("react")); + return a1[0] === a2[0] && a1[1] === a2[1]; +} -var _useState7 = _interopRequireDefault(require("rc-util/es/hooks/useState")); +function getAlignFromPlacement(builtinPlacements, placementStr, align) { + var baseAlign = builtinPlacements[placementStr] || {}; + return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, baseAlign), align); +} -var _interface = require("../interface"); +function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) { + var points = align.points; + var placements = Object.keys(builtinPlacements); -var _useStepQueue3 = _interopRequireWildcard(require("./useStepQueue")); + for (var i = 0; i < placements.length; i += 1) { + var placement = placements[i]; -var _useDomMotionEvents3 = _interopRequireDefault(require("./useDomMotionEvents")); + if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) { + return "".concat(prefixCls, "-placement-").concat(placement); + } + } -var _useIsomorphicLayoutEffect = _interopRequireDefault(require("./useIsomorphicLayoutEffect")); + return ''; +} +},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT"}],"m1Rl":[function(require,module,exports) { +"use strict"; -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.animationEndName = void 0; +exports.getTransitionName = getTransitionName; +exports.getVendorPrefixedEventName = getVendorPrefixedEventName; +exports.getVendorPrefixes = getVendorPrefixes; +exports.transitionEndName = exports.supportTransition = void 0; -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); + +var _canUseDom = _interopRequireDefault(require("rc-util/es/Dom/canUseDom")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function useStatus(supportMotion, visible, getElement, _ref) { - var _ref$motionEnter = _ref.motionEnter, - motionEnter = _ref$motionEnter === void 0 ? true : _ref$motionEnter, - _ref$motionAppear = _ref.motionAppear, - motionAppear = _ref$motionAppear === void 0 ? true : _ref$motionAppear, - _ref$motionLeave = _ref.motionLeave, - motionLeave = _ref$motionLeave === void 0 ? true : _ref$motionLeave, - motionDeadline = _ref.motionDeadline, - motionLeaveImmediately = _ref.motionLeaveImmediately, - onAppearPrepare = _ref.onAppearPrepare, - onEnterPrepare = _ref.onEnterPrepare, - onLeavePrepare = _ref.onLeavePrepare, - onAppearStart = _ref.onAppearStart, - onEnterStart = _ref.onEnterStart, - onLeaveStart = _ref.onLeaveStart, - onAppearActive = _ref.onAppearActive, - onEnterActive = _ref.onEnterActive, - onLeaveActive = _ref.onLeaveActive, - onAppearEnd = _ref.onAppearEnd, - onEnterEnd = _ref.onEnterEnd, - onLeaveEnd = _ref.onLeaveEnd, - onVisibleChanged = _ref.onVisibleChanged; // Used for outer render usage to avoid `visible: false & status: none` to render nothing +// ================= Transition ================= +// Event wrapper. Copy from react source code +function makePrefixMap(styleProp, eventName) { + var prefixes = {}; + prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); + prefixes["Webkit".concat(styleProp)] = "webkit".concat(eventName); + prefixes["Moz".concat(styleProp)] = "moz".concat(eventName); + prefixes["ms".concat(styleProp)] = "MS".concat(eventName); + prefixes["O".concat(styleProp)] = "o".concat(eventName.toLowerCase()); + return prefixes; +} - var _useState = (0, _useState7.default)(), - _useState2 = (0, _slicedToArray2.default)(_useState, 2), - asyncVisible = _useState2[0], - setAsyncVisible = _useState2[1]; +function getVendorPrefixes(domSupport, win) { + var prefixes = { + animationend: makePrefixMap('Animation', 'AnimationEnd'), + transitionend: makePrefixMap('Transition', 'TransitionEnd') + }; - var _useState3 = (0, _useState7.default)(_interface.STATUS_NONE), - _useState4 = (0, _slicedToArray2.default)(_useState3, 2), - status = _useState4[0], - setStatus = _useState4[1]; + if (domSupport) { + if (!('AnimationEvent' in win)) { + delete prefixes.animationend.animation; + } - var _useState5 = (0, _useState7.default)(null), - _useState6 = (0, _slicedToArray2.default)(_useState5, 2), - style = _useState6[0], - setStyle = _useState6[1]; + if (!('TransitionEvent' in win)) { + delete prefixes.transitionend.transition; + } + } - var mountedRef = (0, React.useRef)(false); - var deadlineRef = (0, React.useRef)(null); // =========================== Dom Node =========================== + return prefixes; +} - function getDomElement() { - return getElement(); - } // ========================== Motion End ========================== +var vendorPrefixes = getVendorPrefixes((0, _canUseDom.default)(), typeof window !== 'undefined' ? window : {}); +var style = {}; +if ((0, _canUseDom.default)()) { + var _document$createEleme = document.createElement('div'); - var activeRef = (0, React.useRef)(false); + style = _document$createEleme.style; +} - function onInternalMotionEnd(event) { - var element = getDomElement(); +var prefixedEventNames = {}; - if (event && !event.deadline && event.target !== element) { - // event exists - // not initiated by deadline - // transitionEnd not fired by inner elements - return; - } +function getVendorPrefixedEventName(eventName) { + if (prefixedEventNames[eventName]) { + return prefixedEventNames[eventName]; + } - var currentActive = activeRef.current; - var canEnd; + var prefixMap = vendorPrefixes[eventName]; - if (status === _interface.STATUS_APPEAR && currentActive) { - canEnd = onAppearEnd === null || onAppearEnd === void 0 ? void 0 : onAppearEnd(element, event); - } else if (status === _interface.STATUS_ENTER && currentActive) { - canEnd = onEnterEnd === null || onEnterEnd === void 0 ? void 0 : onEnterEnd(element, event); - } else if (status === _interface.STATUS_LEAVE && currentActive) { - canEnd = onLeaveEnd === null || onLeaveEnd === void 0 ? void 0 : onLeaveEnd(element, event); - } // Only update status when `canEnd` and not destroyed + if (prefixMap) { + var stylePropList = Object.keys(prefixMap); + var len = stylePropList.length; + for (var i = 0; i < len; i += 1) { + var styleProp = stylePropList[i]; - if (status !== _interface.STATUS_NONE && currentActive && canEnd !== false) { - setStatus(_interface.STATUS_NONE, true); - setStyle(null, true); + if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in style) { + prefixedEventNames[eventName] = prefixMap[styleProp]; + return prefixedEventNames[eventName]; + } } } - var _useDomMotionEvents = (0, _useDomMotionEvents3.default)(onInternalMotionEnd), - _useDomMotionEvents2 = (0, _slicedToArray2.default)(_useDomMotionEvents, 1), - patchMotionEvents = _useDomMotionEvents2[0]; // ============================= Step ============================= + return ''; +} +var internalAnimationEndName = getVendorPrefixedEventName('animationend'); +var internalTransitionEndName = getVendorPrefixedEventName('transitionend'); +var supportTransition = !!(internalAnimationEndName && internalTransitionEndName); +exports.supportTransition = supportTransition; +var animationEndName = internalAnimationEndName || 'animationend'; +exports.animationEndName = animationEndName; +var transitionEndName = internalTransitionEndName || 'transitionend'; +exports.transitionEndName = transitionEndName; - var eventHandlers = React.useMemo(function () { - var _ref2, _ref3, _ref4; +function getTransitionName(transitionName, transitionType) { + if (!transitionName) return null; - switch (status) { - case _interface.STATUS_APPEAR: - return _ref2 = {}, (0, _defineProperty2.default)(_ref2, _interface.STEP_PREPARE, onAppearPrepare), (0, _defineProperty2.default)(_ref2, _interface.STEP_START, onAppearStart), (0, _defineProperty2.default)(_ref2, _interface.STEP_ACTIVE, onAppearActive), _ref2; + if ((0, _typeof2.default)(transitionName) === 'object') { + var type = transitionType.replace(/-\w/g, function (match) { + return match[1].toUpperCase(); + }); + return transitionName[type]; + } - case _interface.STATUS_ENTER: - return _ref3 = {}, (0, _defineProperty2.default)(_ref3, _interface.STEP_PREPARE, onEnterPrepare), (0, _defineProperty2.default)(_ref3, _interface.STEP_START, onEnterStart), (0, _defineProperty2.default)(_ref3, _interface.STEP_ACTIVE, onEnterActive), _ref3; + return "".concat(transitionName, "-").concat(transitionType); +} +},{"@babel/runtime/helpers/esm/typeof":"xLw6","rc-util/es/Dom/canUseDom":"s2cK"}],"JzRG":[function(require,module,exports) { +"use strict"; - case _interface.STATUS_LEAVE: - return _ref4 = {}, (0, _defineProperty2.default)(_ref4, _interface.STEP_PREPARE, onLeavePrepare), (0, _defineProperty2.default)(_ref4, _interface.STEP_START, onLeaveStart), (0, _defineProperty2.default)(_ref4, _interface.STEP_ACTIVE, onLeaveActive), _ref4; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.STEP_START = exports.STEP_PREPARE = exports.STEP_NONE = exports.STEP_ACTIVE = exports.STEP_ACTIVATED = exports.STATUS_NONE = exports.STATUS_LEAVE = exports.STATUS_ENTER = exports.STATUS_APPEAR = void 0; +var STATUS_NONE = 'none'; +exports.STATUS_NONE = STATUS_NONE; +var STATUS_APPEAR = 'appear'; +exports.STATUS_APPEAR = STATUS_APPEAR; +var STATUS_ENTER = 'enter'; +exports.STATUS_ENTER = STATUS_ENTER; +var STATUS_LEAVE = 'leave'; +exports.STATUS_LEAVE = STATUS_LEAVE; +var STEP_NONE = 'none'; +exports.STEP_NONE = STEP_NONE; +var STEP_PREPARE = 'prepare'; +exports.STEP_PREPARE = STEP_PREPARE; +var STEP_START = 'start'; +exports.STEP_START = STEP_START; +var STEP_ACTIVE = 'active'; +exports.STEP_ACTIVE = STEP_ACTIVE; +var STEP_ACTIVATED = 'end'; +exports.STEP_ACTIVATED = STEP_ACTIVATED; +},{}],"LIDo":[function(require,module,exports) { +"use strict"; - default: - return {}; - } - }, [status]); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - var _useStepQueue = (0, _useStepQueue3.default)(status, function (newStep) { - // Only prepare step can be skip - if (newStep === _interface.STEP_PREPARE) { - var onPrepare = eventHandlers[_interface.STEP_PREPARE]; +var React = _interopRequireWildcard(require("react")); - if (!onPrepare) { - return _useStepQueue3.SkipStep; - } +var _raf = _interopRequireDefault(require("rc-util/es/raf")); - return onPrepare(getDomElement()); - } // Rest step is sync update - // Rest step is sync update +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - if (step in eventHandlers) { - var _eventHandlers$step; +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - setStyle(((_eventHandlers$step = eventHandlers[step]) === null || _eventHandlers$step === void 0 ? void 0 : _eventHandlers$step.call(eventHandlers, getDomElement(), null)) || null); - } +var _default = function _default() { + var nextFrameRef = React.useRef(null); - if (step === _interface.STEP_ACTIVE) { - // Patch events when motion needed - patchMotionEvents(getDomElement()); + function cancelNextFrame() { + _raf.default.cancel(nextFrameRef.current); + } - if (motionDeadline > 0) { - clearTimeout(deadlineRef.current); - deadlineRef.current = setTimeout(function () { - onInternalMotionEnd({ - deadline: true - }); - }, motionDeadline); + function nextFrame(callback) { + var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; + cancelNextFrame(); + var nextFrameId = (0, _raf.default)(function () { + if (delay <= 1) { + callback({ + isCanceled: function isCanceled() { + return nextFrameId !== nextFrameRef.current; + } + }); + } else { + nextFrame(callback, delay - 1); } - } + }); + nextFrameRef.current = nextFrameId; + } - return _useStepQueue3.DoStep; - }), - _useStepQueue2 = (0, _slicedToArray2.default)(_useStepQueue, 2), - startStep = _useStepQueue2[0], - step = _useStepQueue2[1]; + React.useEffect(function () { + return function () { + cancelNextFrame(); + }; + }, []); + return [nextFrame, cancelNextFrame]; +}; - var active = (0, _useStepQueue3.isActive)(step); - activeRef.current = active; // ============================ Status ============================ - // Update with new status +exports.default = _default; +},{"react":"n8MK","rc-util/es/raf":"mM6N"}],"szcY":[function(require,module,exports) { +"use strict"; - (0, _useIsomorphicLayoutEffect.default)(function () { - setAsyncVisible(visible); - var isMounted = mountedRef.current; - mountedRef.current = true; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - if (!supportMotion) { - return; - } +var _react = require("react"); - var nextStatus; // Appear +var _canUseDom = _interopRequireDefault(require("rc-util/es/Dom/canUseDom")); - if (!isMounted && visible && motionAppear) { - nextStatus = _interface.STATUS_APPEAR; - } // Enter +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +// It's safe to use `useLayoutEffect` but the warning is annoying +var useIsomorphicLayoutEffect = (0, _canUseDom.default)() ? _react.useLayoutEffect : _react.useEffect; +var _default = useIsomorphicLayoutEffect; +exports.default = _default; +},{"react":"n8MK","rc-util/es/Dom/canUseDom":"s2cK"}],"hnmF":[function(require,module,exports) { +"use strict"; - if (isMounted && visible && motionEnter) { - nextStatus = _interface.STATUS_ENTER; - } // Leave +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = exports.SkipStep = exports.DoStep = void 0; +exports.isActive = isActive; +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); - if (isMounted && !visible && motionLeave || !isMounted && motionLeaveImmediately && !visible && motionLeave) { - nextStatus = _interface.STATUS_LEAVE; - } // Update to next status +var React = _interopRequireWildcard(require("react")); +var _useState3 = _interopRequireDefault(require("rc-util/es/hooks/useState")); - if (nextStatus) { - setStatus(nextStatus); - startStep(); - } - }, [visible]); // ============================ Effect ============================ - // Reset when motion changed +var _interface = require("../interface"); - (0, React.useEffect)(function () { - if ( // Cancel appear - status === _interface.STATUS_APPEAR && !motionAppear || // Cancel enter - status === _interface.STATUS_ENTER && !motionEnter || // Cancel leave - status === _interface.STATUS_LEAVE && !motionLeave) { - setStatus(_interface.STATUS_NONE); - } - }, [motionAppear, motionEnter, motionLeave]); - (0, React.useEffect)(function () { - return function () { - mountedRef.current = false; - clearTimeout(deadlineRef.current); - }; - }, []); // Trigger `onVisibleChanged` +var _useNextFrame3 = _interopRequireDefault(require("./useNextFrame")); - var firstMountChangeRef = React.useRef(false); - (0, React.useEffect)(function () { - // [visible & motion not end] => [!visible & motion end] still need trigger onVisibleChanged - if (asyncVisible) { - firstMountChangeRef.current = true; - } +var _useIsomorphicLayoutEffect = _interopRequireDefault(require("./useIsomorphicLayoutEffect")); - if (asyncVisible !== undefined && status === _interface.STATUS_NONE) { - // Skip first render is invisible since it's nothing changed - if (firstMountChangeRef.current || asyncVisible) { - onVisibleChanged === null || onVisibleChanged === void 0 ? void 0 : onVisibleChanged(asyncVisible); - } +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - firstMountChangeRef.current = true; - } - }, [asyncVisible, status]); // ============================ Styles ============================ +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - var mergedStyle = style; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - if (eventHandlers[_interface.STEP_PREPARE] && step === _interface.STEP_START) { - mergedStyle = (0, _objectSpread2.default)({ - transition: 'none' - }, mergedStyle); - } +var STEP_QUEUE = [_interface.STEP_PREPARE, _interface.STEP_START, _interface.STEP_ACTIVE, _interface.STEP_ACTIVATED]; +/** Skip current step */ - return [status, step, mergedStyle, asyncVisible !== null && asyncVisible !== void 0 ? asyncVisible : visible]; +var SkipStep = false; +/** Current step should be update in */ + +exports.SkipStep = SkipStep; +var DoStep = true; +exports.DoStep = DoStep; + +function isActive(step) { + return step === _interface.STEP_ACTIVE || step === _interface.STEP_ACTIVATED; } -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/hooks/useState":"OlRb","../interface":"JzRG","./useStepQueue":"hnmF","./useDomMotionEvents":"UjUO","./useIsomorphicLayoutEffect":"szcY"}],"FYGt":[function(require,module,exports) { + +var _default = function _default(status, callback) { + var _useState = (0, _useState3.default)(_interface.STEP_NONE), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + step = _useState2[0], + setStep = _useState2[1]; + + var _useNextFrame = (0, _useNextFrame3.default)(), + _useNextFrame2 = (0, _slicedToArray2.default)(_useNextFrame, 2), + nextFrame = _useNextFrame2[0], + cancelNextFrame = _useNextFrame2[1]; + + function startQueue() { + setStep(_interface.STEP_PREPARE, true); + } + + (0, _useIsomorphicLayoutEffect.default)(function () { + if (step !== _interface.STEP_NONE && step !== _interface.STEP_ACTIVATED) { + var index = STEP_QUEUE.indexOf(step); + var nextStep = STEP_QUEUE[index + 1]; + var result = callback(step); + + if (result === SkipStep) { + // Skip when no needed + setStep(nextStep, true); + } else { + // Do as frame for step update + nextFrame(function (info) { + function doNext() { + // Skip since current queue is ood + if (info.isCanceled()) return; + setStep(nextStep, true); + } + + if (result === true) { + doNext(); + } else { + // Only promise should be async + Promise.resolve(result).then(doNext); + } + }); + } + } + }, [status, step]); + React.useEffect(function () { + return function () { + cancelNextFrame(); + }; + }, []); + return [startQueue, step]; +}; + +exports.default = _default; +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/hooks/useState":"nSoY","../interface":"JzRG","./useNextFrame":"LIDo","./useIsomorphicLayoutEffect":"szcY"}],"UjUO":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -6766,77 +6249,80 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck")); +var React = _interopRequireWildcard(require("react")); -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass")); +var _motion = require("../util/motion"); -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits")); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } -var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper")); +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -var React = _interopRequireWildcard(require("react")); +var _default = function _default(callback) { + var cacheElementRef = (0, React.useRef)(); // Cache callback -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + var callbackRef = (0, React.useRef)(callback); + callbackRef.current = callback; // Internal motion event handler -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + var onInternalMotionEnd = React.useCallback(function (event) { + callbackRef.current(event); + }, []); // Remove events -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function removeMotionEvents(element) { + if (element) { + element.removeEventListener(_motion.transitionEndName, onInternalMotionEnd); + element.removeEventListener(_motion.animationEndName, onInternalMotionEnd); + } + } // Patch events -var DomWrapper = /*#__PURE__*/function (_React$Component) { - (0, _inherits2.default)(DomWrapper, _React$Component); - var _super = (0, _createSuper2.default)(DomWrapper); + function patchMotionEvents(element) { + if (cacheElementRef.current && cacheElementRef.current !== element) { + removeMotionEvents(cacheElementRef.current); + } - function DomWrapper() { - (0, _classCallCheck2.default)(this, DomWrapper); - return _super.apply(this, arguments); - } + if (element && element !== cacheElementRef.current) { + element.addEventListener(_motion.transitionEndName, onInternalMotionEnd); + element.addEventListener(_motion.animationEndName, onInternalMotionEnd); // Save as cache in case dom removed trigger by `motionDeadline` - (0, _createClass2.default)(DomWrapper, [{ - key: "render", - value: function render() { - return this.props.children; + cacheElementRef.current = element; } - }]); - return DomWrapper; -}(React.Component); + } // Clean up when removed + + + React.useEffect(function () { + return function () { + removeMotionEvents(cacheElementRef.current); + }; + }, []); + return [patchMotionEvents, removeMotionEvents]; +}; -var _default = DomWrapper; exports.default = _default; -},{"@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","react":"n8MK"}],"LFCw":[function(require,module,exports) { +},{"react":"n8MK","../util/motion":"m1Rl"}],"mvOU":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; -exports.genCSSMotion = genCSSMotion; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); +exports.default = useStatus; var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); var React = _interopRequireWildcard(require("react")); -var _findDOMNode = _interopRequireDefault(require("rc-util/es/Dom/findDOMNode")); - -var _ref = require("rc-util/es/ref"); - -var _classnames = _interopRequireDefault(require("classnames")); - -var _motion = require("./util/motion"); +var _useState7 = _interopRequireDefault(require("rc-util/es/hooks/useState")); -var _interface = require("./interface"); +var _interface = require("../interface"); -var _useStatus3 = _interopRequireDefault(require("./hooks/useStatus")); +var _useStepQueue3 = _interopRequireWildcard(require("./useStepQueue")); -var _DomWrapper = _interopRequireDefault(require("./DomWrapper")); +var _useDomMotionEvents3 = _interopRequireDefault(require("./useDomMotionEvents")); -var _useStepQueue = require("./hooks/useStepQueue"); +var _useIsomorphicLayoutEffect = _interopRequireDefault(require("./useIsomorphicLayoutEffect")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -6844,65 +6330,324 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/* eslint-disable react/default-props-match-prop-types, react/no-multi-comp, react/prop-types */ +function useStatus(supportMotion, visible, getElement, _ref) { + var _ref$motionEnter = _ref.motionEnter, + motionEnter = _ref$motionEnter === void 0 ? true : _ref$motionEnter, + _ref$motionAppear = _ref.motionAppear, + motionAppear = _ref$motionAppear === void 0 ? true : _ref$motionAppear, + _ref$motionLeave = _ref.motionLeave, + motionLeave = _ref$motionLeave === void 0 ? true : _ref$motionLeave, + motionDeadline = _ref.motionDeadline, + motionLeaveImmediately = _ref.motionLeaveImmediately, + onAppearPrepare = _ref.onAppearPrepare, + onEnterPrepare = _ref.onEnterPrepare, + onLeavePrepare = _ref.onLeavePrepare, + onAppearStart = _ref.onAppearStart, + onEnterStart = _ref.onEnterStart, + onLeaveStart = _ref.onLeaveStart, + onAppearActive = _ref.onAppearActive, + onEnterActive = _ref.onEnterActive, + onLeaveActive = _ref.onLeaveActive, + onAppearEnd = _ref.onAppearEnd, + onEnterEnd = _ref.onEnterEnd, + onLeaveEnd = _ref.onLeaveEnd, + onVisibleChanged = _ref.onVisibleChanged; // Used for outer render usage to avoid `visible: false & status: none` to render nothing -/** - * `transitionSupport` is used for none transition test case. - * Default we use browser transition event support check. - */ -function genCSSMotion(config) { - var transitionSupport = config; + var _useState = (0, _useState7.default)(), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + asyncVisible = _useState2[0], + setAsyncVisible = _useState2[1]; - if ((0, _typeof2.default)(config) === 'object') { - transitionSupport = config.transitionSupport; - } + var _useState3 = (0, _useState7.default)(_interface.STATUS_NONE), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + status = _useState4[0], + setStatus = _useState4[1]; - function isSupportTransition(props) { - return !!(props.motionName && transitionSupport); - } + var _useState5 = (0, _useState7.default)(null), + _useState6 = (0, _slicedToArray2.default)(_useState5, 2), + style = _useState6[0], + setStyle = _useState6[1]; - var CSSMotion = /*#__PURE__*/React.forwardRef(function (props, ref) { - var _props$visible = props.visible, - visible = _props$visible === void 0 ? true : _props$visible, - _props$removeOnLeave = props.removeOnLeave, - removeOnLeave = _props$removeOnLeave === void 0 ? true : _props$removeOnLeave, - forceRender = props.forceRender, - children = props.children, - motionName = props.motionName, - leavedClassName = props.leavedClassName, - eventProps = props.eventProps; - var supportMotion = isSupportTransition(props); // Ref to the react node, it may be a HTMLElement + var mountedRef = (0, React.useRef)(false); + var deadlineRef = (0, React.useRef)(null); // =========================== Dom Node =========================== - var nodeRef = (0, React.useRef)(); // Ref to the dom wrapper in case ref can not pass to HTMLElement + function getDomElement() { + return getElement(); + } // ========================== Motion End ========================== - var wrapperNodeRef = (0, React.useRef)(); - function getDomElement() { - try { - // Here we're avoiding call for findDOMNode since it's deprecated - // in strict mode. We're calling it only when node ref is not - // an instance of DOM HTMLElement. Otherwise use - // findDOMNode as a final resort - return nodeRef.current instanceof HTMLElement ? nodeRef.current : (0, _findDOMNode.default)(wrapperNodeRef.current); - } catch (e) { - // Only happen when `motionDeadline` trigger but element removed. - return null; - } + var activeRef = (0, React.useRef)(false); + + function onInternalMotionEnd(event) { + var element = getDomElement(); + + if (event && !event.deadline && event.target !== element) { + // event exists + // not initiated by deadline + // transitionEnd not fired by inner elements + return; } - var _useStatus = (0, _useStatus3.default)(supportMotion, visible, getDomElement, props), - _useStatus2 = (0, _slicedToArray2.default)(_useStatus, 4), - status = _useStatus2[0], - statusStep = _useStatus2[1], - statusStyle = _useStatus2[2], - mergedVisible = _useStatus2[3]; // Record whether content has rendered - // Will return null for un-rendered even when `removeOnLeave={false}` + var currentActive = activeRef.current; + var canEnd; + if (status === _interface.STATUS_APPEAR && currentActive) { + canEnd = onAppearEnd === null || onAppearEnd === void 0 ? void 0 : onAppearEnd(element, event); + } else if (status === _interface.STATUS_ENTER && currentActive) { + canEnd = onEnterEnd === null || onEnterEnd === void 0 ? void 0 : onEnterEnd(element, event); + } else if (status === _interface.STATUS_LEAVE && currentActive) { + canEnd = onLeaveEnd === null || onLeaveEnd === void 0 ? void 0 : onLeaveEnd(element, event); + } // Only update status when `canEnd` and not destroyed - var renderedRef = React.useRef(mergedVisible); - if (mergedVisible) { - renderedRef.current = true; + if (status !== _interface.STATUS_NONE && currentActive && canEnd !== false) { + setStatus(_interface.STATUS_NONE, true); + setStyle(null, true); + } + } + + var _useDomMotionEvents = (0, _useDomMotionEvents3.default)(onInternalMotionEnd), + _useDomMotionEvents2 = (0, _slicedToArray2.default)(_useDomMotionEvents, 1), + patchMotionEvents = _useDomMotionEvents2[0]; // ============================= Step ============================= + + + var eventHandlers = React.useMemo(function () { + var _ref2, _ref3, _ref4; + + switch (status) { + case _interface.STATUS_APPEAR: + return _ref2 = {}, (0, _defineProperty2.default)(_ref2, _interface.STEP_PREPARE, onAppearPrepare), (0, _defineProperty2.default)(_ref2, _interface.STEP_START, onAppearStart), (0, _defineProperty2.default)(_ref2, _interface.STEP_ACTIVE, onAppearActive), _ref2; + + case _interface.STATUS_ENTER: + return _ref3 = {}, (0, _defineProperty2.default)(_ref3, _interface.STEP_PREPARE, onEnterPrepare), (0, _defineProperty2.default)(_ref3, _interface.STEP_START, onEnterStart), (0, _defineProperty2.default)(_ref3, _interface.STEP_ACTIVE, onEnterActive), _ref3; + + case _interface.STATUS_LEAVE: + return _ref4 = {}, (0, _defineProperty2.default)(_ref4, _interface.STEP_PREPARE, onLeavePrepare), (0, _defineProperty2.default)(_ref4, _interface.STEP_START, onLeaveStart), (0, _defineProperty2.default)(_ref4, _interface.STEP_ACTIVE, onLeaveActive), _ref4; + + default: + return {}; + } + }, [status]); + + var _useStepQueue = (0, _useStepQueue3.default)(status, function (newStep) { + // Only prepare step can be skip + if (newStep === _interface.STEP_PREPARE) { + var onPrepare = eventHandlers[_interface.STEP_PREPARE]; + + if (!onPrepare) { + return _useStepQueue3.SkipStep; + } + + return onPrepare(getDomElement()); + } // Rest step is sync update + // Rest step is sync update + + + if (step in eventHandlers) { + var _eventHandlers$step; + + setStyle(((_eventHandlers$step = eventHandlers[step]) === null || _eventHandlers$step === void 0 ? void 0 : _eventHandlers$step.call(eventHandlers, getDomElement(), null)) || null); + } + + if (step === _interface.STEP_ACTIVE) { + // Patch events when motion needed + patchMotionEvents(getDomElement()); + + if (motionDeadline > 0) { + clearTimeout(deadlineRef.current); + deadlineRef.current = setTimeout(function () { + onInternalMotionEnd({ + deadline: true + }); + }, motionDeadline); + } + } + + return _useStepQueue3.DoStep; + }), + _useStepQueue2 = (0, _slicedToArray2.default)(_useStepQueue, 2), + startStep = _useStepQueue2[0], + step = _useStepQueue2[1]; + + var active = (0, _useStepQueue3.isActive)(step); + activeRef.current = active; // ============================ Status ============================ + // Update with new status + + (0, _useIsomorphicLayoutEffect.default)(function () { + setAsyncVisible(visible); + var isMounted = mountedRef.current; + mountedRef.current = true; + + if (!supportMotion) { + return; + } + + var nextStatus; // Appear + + if (!isMounted && visible && motionAppear) { + nextStatus = _interface.STATUS_APPEAR; + } // Enter + + + if (isMounted && visible && motionEnter) { + nextStatus = _interface.STATUS_ENTER; + } // Leave + + + if (isMounted && !visible && motionLeave || !isMounted && motionLeaveImmediately && !visible && motionLeave) { + nextStatus = _interface.STATUS_LEAVE; + } // Update to next status + + + if (nextStatus) { + setStatus(nextStatus); + startStep(); + } + }, [visible]); // ============================ Effect ============================ + // Reset when motion changed + + (0, React.useEffect)(function () { + if ( // Cancel appear + status === _interface.STATUS_APPEAR && !motionAppear || // Cancel enter + status === _interface.STATUS_ENTER && !motionEnter || // Cancel leave + status === _interface.STATUS_LEAVE && !motionLeave) { + setStatus(_interface.STATUS_NONE); + } + }, [motionAppear, motionEnter, motionLeave]); + (0, React.useEffect)(function () { + return function () { + mountedRef.current = false; + clearTimeout(deadlineRef.current); + }; + }, []); // Trigger `onVisibleChanged` + + var firstMountChangeRef = React.useRef(false); + (0, React.useEffect)(function () { + // [visible & motion not end] => [!visible & motion end] still need trigger onVisibleChanged + if (asyncVisible) { + firstMountChangeRef.current = true; + } + + if (asyncVisible !== undefined && status === _interface.STATUS_NONE) { + // Skip first render is invisible since it's nothing changed + if (firstMountChangeRef.current || asyncVisible) { + onVisibleChanged === null || onVisibleChanged === void 0 ? void 0 : onVisibleChanged(asyncVisible); + } + + firstMountChangeRef.current = true; + } + }, [asyncVisible, status]); // ============================ Styles ============================ + + var mergedStyle = style; + + if (eventHandlers[_interface.STEP_PREPARE] && step === _interface.STEP_START) { + mergedStyle = (0, _objectSpread2.default)({ + transition: 'none' + }, mergedStyle); + } + + return [status, step, mergedStyle, asyncVisible !== null && asyncVisible !== void 0 ? asyncVisible : visible]; +} +},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/hooks/useState":"nSoY","../interface":"JzRG","./useStepQueue":"hnmF","./useDomMotionEvents":"UjUO","./useIsomorphicLayoutEffect":"szcY"}],"LFCw":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +exports.genCSSMotion = genCSSMotion; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); + +var React = _interopRequireWildcard(require("react")); + +var _findDOMNode = _interopRequireDefault(require("rc-util/es/Dom/findDOMNode")); + +var _ref = require("rc-util/es/ref"); + +var _classnames = _interopRequireDefault(require("classnames")); + +var _motion = require("./util/motion"); + +var _interface = require("./interface"); + +var _useStatus3 = _interopRequireDefault(require("./hooks/useStatus")); + +var _DomWrapper = _interopRequireDefault(require("./DomWrapper")); + +var _useStepQueue = require("./hooks/useStepQueue"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* eslint-disable react/default-props-match-prop-types, react/no-multi-comp, react/prop-types */ + +/** + * `transitionSupport` is used for none transition test case. + * Default we use browser transition event support check. + */ +function genCSSMotion(config) { + var transitionSupport = config; + + if ((0, _typeof2.default)(config) === 'object') { + transitionSupport = config.transitionSupport; + } + + function isSupportTransition(props) { + return !!(props.motionName && transitionSupport); + } + + var CSSMotion = /*#__PURE__*/React.forwardRef(function (props, ref) { + var _props$visible = props.visible, + visible = _props$visible === void 0 ? true : _props$visible, + _props$removeOnLeave = props.removeOnLeave, + removeOnLeave = _props$removeOnLeave === void 0 ? true : _props$removeOnLeave, + forceRender = props.forceRender, + children = props.children, + motionName = props.motionName, + leavedClassName = props.leavedClassName, + eventProps = props.eventProps; + var supportMotion = isSupportTransition(props); // Ref to the react node, it may be a HTMLElement + + var nodeRef = (0, React.useRef)(); // Ref to the dom wrapper in case ref can not pass to HTMLElement + + var wrapperNodeRef = (0, React.useRef)(); + + function getDomElement() { + try { + // Here we're avoiding call for findDOMNode since it's deprecated + // in strict mode. We're calling it only when node ref is not + // an instance of DOM HTMLElement. Otherwise use + // findDOMNode as a final resort + return nodeRef.current instanceof HTMLElement ? nodeRef.current : (0, _findDOMNode.default)(wrapperNodeRef.current); + } catch (e) { + // Only happen when `motionDeadline` trigger but element removed. + return null; + } + } + + var _useStatus = (0, _useStatus3.default)(supportMotion, visible, getDomElement, props), + _useStatus2 = (0, _slicedToArray2.default)(_useStatus, 4), + status = _useStatus2[0], + statusStep = _useStatus2[1], + statusStyle = _useStatus2[2], + mergedVisible = _useStatus2[3]; // Record whether content has rendered + // Will return null for un-rendered even when `removeOnLeave={false}` + + + var renderedRef = React.useRef(mergedVisible); + + if (mergedVisible) { + renderedRef.current = true; } // ====================== Refs ====================== @@ -6979,144 +6724,16 @@ function genCSSMotion(config) { var _default = genCSSMotion(_motion.supportTransition); exports.default = _default; -},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/typeof":"xLw6","react":"n8MK","rc-util/es/Dom/findDOMNode":"beML","rc-util/es/ref":"AOnv","classnames":"qb7c","./util/motion":"m1Rl","./interface":"JzRG","./hooks/useStatus":"mvOU","./DomWrapper":"FYGt","./hooks/useStepQueue":"hnmF"}],"cJs0":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/typeof":"xLw6","react":"n8MK","rc-util/es/Dom/findDOMNode":"JHqZ","rc-util/es/ref":"AOnv","classnames":"yl9j","./util/motion":"m1Rl","./interface":"JzRG","./hooks/useStatus":"mvOU","./DomWrapper":"uOw9","./hooks/useStepQueue":"hnmF"}],"sbm5":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.STATUS_REMOVED = exports.STATUS_REMOVE = exports.STATUS_KEEP = exports.STATUS_ADD = void 0; -exports.diffKeys = diffKeys; -exports.parseKeys = parseKeys; -exports.wrapKeyToObject = wrapKeyToObject; +exports.default = void 0; +exports.genCSSMotionList = genCSSMotionList; -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var STATUS_ADD = 'add'; -exports.STATUS_ADD = STATUS_ADD; -var STATUS_KEEP = 'keep'; -exports.STATUS_KEEP = STATUS_KEEP; -var STATUS_REMOVE = 'remove'; -exports.STATUS_REMOVE = STATUS_REMOVE; -var STATUS_REMOVED = 'removed'; -exports.STATUS_REMOVED = STATUS_REMOVED; - -function wrapKeyToObject(key) { - var keyObj; - - if (key && (0, _typeof2.default)(key) === 'object' && 'key' in key) { - keyObj = key; - } else { - keyObj = { - key: key - }; - } - - return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, keyObj), {}, { - key: String(keyObj.key) - }); -} - -function parseKeys() { - var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - return keys.map(wrapKeyToObject); -} - -function diffKeys() { - var prevKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var currentKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - var list = []; - var currentIndex = 0; - var currentLen = currentKeys.length; - var prevKeyObjects = parseKeys(prevKeys); - var currentKeyObjects = parseKeys(currentKeys); // Check prev keys to insert or keep - - prevKeyObjects.forEach(function (keyObj) { - var hit = false; - - for (var i = currentIndex; i < currentLen; i += 1) { - var currentKeyObj = currentKeyObjects[i]; - - if (currentKeyObj.key === keyObj.key) { - // New added keys should add before current key - if (currentIndex < i) { - list = list.concat(currentKeyObjects.slice(currentIndex, i).map(function (obj) { - return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, obj), {}, { - status: STATUS_ADD - }); - })); - currentIndex = i; - } - - list.push((0, _objectSpread2.default)((0, _objectSpread2.default)({}, currentKeyObj), {}, { - status: STATUS_KEEP - })); - currentIndex += 1; - hit = true; - break; - } - } // If not hit, it means key is removed - - - if (!hit) { - list.push((0, _objectSpread2.default)((0, _objectSpread2.default)({}, keyObj), {}, { - status: STATUS_REMOVE - })); - } - }); // Add rest to the list - - if (currentIndex < currentLen) { - list = list.concat(currentKeyObjects.slice(currentIndex).map(function (obj) { - return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, obj), {}, { - status: STATUS_ADD - }); - })); - } - /** - * Merge same key when it remove and add again: - * [1 - add, 2 - keep, 1 - remove] -> [1 - keep, 2 - keep] - */ - - - var keys = {}; - list.forEach(function (_ref) { - var key = _ref.key; - keys[key] = (keys[key] || 0) + 1; - }); - var duplicatedKeys = Object.keys(keys).filter(function (key) { - return keys[key] > 1; - }); - duplicatedKeys.forEach(function (matchKey) { - // Remove `STATUS_REMOVE` node. - list = list.filter(function (_ref2) { - var key = _ref2.key, - status = _ref2.status; - return key !== matchKey || status !== STATUS_REMOVE; - }); // Update `STATUS_ADD` to `STATUS_KEEP` - - list.forEach(function (node) { - if (node.key === matchKey) { - // eslint-disable-next-line no-param-reassign - node.status = STATUS_KEEP; - } - }); - }); - return list; -} -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/typeof":"xLw6"}],"sbm5":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -exports.genCSSMotionList = genCSSMotionList; - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); @@ -7278,7 +6895,7 @@ function genCSSMotionList(transitionSupport) { var _default = genCSSMotionList(_motion.supportTransition); exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","react":"n8MK","./CSSMotion":"LFCw","./util/motion":"m1Rl","./util/diff":"cJs0"}],"VTMl":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","react":"n8MK","./CSSMotion":"LFCw","./util/motion":"m1Rl","./util/diff":"eyEg"}],"VTMl":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -7397,7 +7014,7 @@ function Mask(props) { }); }); } -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK","classnames":"qb7c","rc-motion":"VTMl","../utils/legacyUtil":"uFoq"}],"dPHJ":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK","classnames":"yl9j","rc-motion":"VTMl","../utils/legacyUtil":"uFoq"}],"dPHJ":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -11620,7 +11237,49 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de // export this package's api var _default = _Align.default; exports.default = _default; -},{"./Align":"He3b"}],"vf0F":[function(require,module,exports) { +},{"./Align":"He3b"}],"wqHO":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useLayoutUpdateEffect = exports.default = void 0; + +var React = _interopRequireWildcard(require("react")); + +var _canUseDom = _interopRequireDefault(require("../Dom/canUseDom")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +/** + * Wrap `React.useLayoutEffect` which will not throw warning message in test env + */ +var useLayoutEffect = "production" !== 'test' && (0, _canUseDom.default)() ? React.useLayoutEffect : React.useEffect; +var _default = useLayoutEffect; +exports.default = _default; + +var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) { + var firstMountRef = React.useRef(true); + useLayoutEffect(function () { + if (!firstMountRef.current) { + return callback(); + } + }, deps); // We tell react that first mount has passed + + useLayoutEffect(function () { + firstMountRef.current = false; + return function () { + firstMountRef.current = true; + }; + }, []); +}; + +exports.useLayoutUpdateEffect = useLayoutUpdateEffect; +},{"react":"n8MK","../Dom/canUseDom":"s2cK"}],"vf0F":[function(require,module,exports) { var define; "use strict"; @@ -12134,7 +11793,7 @@ var _default = function _default(visible, doMeasure) { }; exports.default = _default; -},{"@babel/runtime/helpers/esm/regeneratorRuntime":"vf0F","@babel/runtime/helpers/esm/asyncToGenerator":"vCa3","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/raf":"adDJ","rc-util/es/hooks/useState":"OlRb"}],"sDvT":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/regeneratorRuntime":"vf0F","@babel/runtime/helpers/esm/asyncToGenerator":"vCa3","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/raf":"mM6N","rc-util/es/hooks/useState":"nSoY"}],"sDvT":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -12437,7 +12096,7 @@ var PopupInner = /*#__PURE__*/React.forwardRef(function (props, ref) { PopupInner.displayName = 'PopupInner'; var _default = PopupInner; exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-align":"AVA2","rc-util/es/hooks/useLayoutEffect":"wqHO","rc-motion":"VTMl","classnames":"qb7c","./useVisibleStatus":"rCyv","../utils/legacyUtil":"uFoq","./useStretchStyle":"sDvT"}],"NMjy":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-align":"AVA2","rc-util/es/hooks/useLayoutEffect":"wqHO","rc-motion":"VTMl","classnames":"yl9j","./useVisibleStatus":"rCyv","../utils/legacyUtil":"uFoq","./useStretchStyle":"sDvT"}],"NMjy":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -12520,7 +12179,7 @@ var MobilePopupInner = /*#__PURE__*/React.forwardRef(function (props, ref) { MobilePopupInner.displayName = 'MobilePopupInner'; var _default = MobilePopupInner; exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK","rc-motion":"VTMl","classnames":"qb7c"}],"Pprj":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK","rc-motion":"VTMl","classnames":"yl9j"}],"Pprj":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -12592,7 +12251,7 @@ var Popup = /*#__PURE__*/React.forwardRef(function (_ref, ref) { Popup.displayName = 'Popup'; var _default = Popup; exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","rc-util/es/isMobile":"nb8J","./Mask":"haQR","./PopupInner":"r56U","./MobilePopupInner":"NMjy"}],"f2pu":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","rc-util/es/isMobile":"R6MQ","./Mask":"haQR","./PopupInner":"r56U","./MobilePopupInner":"NMjy"}],"f2pu":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -13462,620 +13121,691 @@ function generateTrigger(PortalComponent) { var _default = generateTrigger(_Portal.default); exports.default = _default; -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/assertThisInitialized":"bk0i","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","react":"n8MK","react-dom":"NKHc","rc-util/es/raf":"adDJ","rc-util/es/Dom/contains":"asZT","rc-util/es/Dom/findDOMNode":"beML","rc-util/es/ref":"AOnv","rc-util/es/Dom/addEventListener":"v9LT","rc-util/es/Portal":"LoYh","classnames":"qb7c","./utils/alignUtil":"Hyzp","./Popup":"Pprj","./context":"f2pu"}],"OUxT":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/assertThisInitialized":"bk0i","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","react":"n8MK","react-dom":"NKHc","rc-util/es/raf":"mM6N","rc-util/es/Dom/contains":"asZT","rc-util/es/Dom/findDOMNode":"JHqZ","rc-util/es/ref":"AOnv","rc-util/es/Dom/addEventListener":"v9LT","rc-util/es/Portal":"LoYh","classnames":"yl9j","./utils/alignUtil":"Hyzp","./Popup":"Pprj","./context":"f2pu"}],"GgDZ":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.placementsRtl = exports.placements = exports.default = void 0; +exports.default = void 0; var autoAdjustOverflow = { adjustX: 1, adjustY: 1 }; +var targetOffset = [0, 0]; var placements = { topLeft: { points: ['bl', 'tl'], overflow: autoAdjustOverflow, - offset: [0, -7] - }, - bottomLeft: { - points: ['tl', 'bl'], - overflow: autoAdjustOverflow, - offset: [0, 7] + offset: [0, -4], + targetOffset: targetOffset }, - leftTop: { - points: ['tr', 'tl'], + topCenter: { + points: ['bc', 'tc'], overflow: autoAdjustOverflow, - offset: [-4, 0] + offset: [0, -4], + targetOffset: targetOffset }, - rightTop: { - points: ['tl', 'tr'], - overflow: autoAdjustOverflow, - offset: [4, 0] - } -}; -exports.placements = placements; -var placementsRtl = { - topLeft: { - points: ['bl', 'tl'], + topRight: { + points: ['br', 'tr'], overflow: autoAdjustOverflow, - offset: [0, -7] + offset: [0, -4], + targetOffset: targetOffset }, bottomLeft: { points: ['tl', 'bl'], overflow: autoAdjustOverflow, - offset: [0, 7] + offset: [0, 4], + targetOffset: targetOffset }, - rightTop: { - points: ['tr', 'tl'], + bottomCenter: { + points: ['tc', 'bc'], overflow: autoAdjustOverflow, - offset: [-4, 0] + offset: [0, 4], + targetOffset: targetOffset }, - leftTop: { - points: ['tl', 'tr'], + bottomRight: { + points: ['tr', 'br'], overflow: autoAdjustOverflow, - offset: [4, 0] + offset: [0, 4], + targetOffset: targetOffset } }; -exports.placementsRtl = placementsRtl; var _default = placements; exports.default = _default; -},{}],"fjqJ":[function(require,module,exports) { +},{}],"Imvn":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getMotion = getMotion; +exports.default = void 0; -function getMotion(mode, motion, defaultMotions) { - if (motion) { - return motion; - } +/** + * @ignore + * some key-codes definition and utils from closure-library + * @author yiminghe@gmail.com + */ +var KeyCode = { + /** + * MAC_ENTER + */ + MAC_ENTER: 3, - if (defaultMotions) { - return defaultMotions[mode] || defaultMotions.other; - } + /** + * BACKSPACE + */ + BACKSPACE: 8, - return undefined; -} -},{}],"hvs0":[function(require,module,exports) { -"use strict"; + /** + * TAB + */ + TAB: 9, -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = PopupTrigger; + /** + * NUMLOCK on FF/Safari Mac + */ + NUM_CENTER: 12, -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); - -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + /** + * ENTER + */ + ENTER: 13, -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + /** + * SHIFT + */ + SHIFT: 16, -var React = _interopRequireWildcard(require("react")); + /** + * CTRL + */ + CTRL: 17, -var _rcTrigger = _interopRequireDefault(require("rc-trigger")); + /** + * ALT + */ + ALT: 18, -var _classnames = _interopRequireDefault(require("classnames")); + /** + * PAUSE + */ + PAUSE: 19, -var _raf = _interopRequireDefault(require("rc-util/es/raf")); + /** + * CAPS_LOCK + */ + CAPS_LOCK: 20, -var _MenuContext = require("../context/MenuContext"); + /** + * ESC + */ + ESC: 27, -var _placements = require("../placements"); + /** + * SPACE + */ + SPACE: 32, -var _motionUtil = require("../utils/motionUtil"); + /** + * PAGE_UP + */ + PAGE_UP: 33, -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + /** + * PAGE_DOWN + */ + PAGE_DOWN: 34, -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + /** + * END + */ + END: 35, -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * HOME + */ + HOME: 36, -var popupPlacementMap = { - horizontal: 'bottomLeft', - vertical: 'rightTop', - 'vertical-left': 'rightTop', - 'vertical-right': 'leftTop' -}; + /** + * LEFT + */ + LEFT: 37, -function PopupTrigger(_ref) { - var prefixCls = _ref.prefixCls, - visible = _ref.visible, - children = _ref.children, - popup = _ref.popup, - popupClassName = _ref.popupClassName, - popupOffset = _ref.popupOffset, - disabled = _ref.disabled, - mode = _ref.mode, - onVisibleChange = _ref.onVisibleChange; + /** + * UP + */ + UP: 38, - var _React$useContext = React.useContext(_MenuContext.MenuContext), - getPopupContainer = _React$useContext.getPopupContainer, - rtl = _React$useContext.rtl, - subMenuOpenDelay = _React$useContext.subMenuOpenDelay, - subMenuCloseDelay = _React$useContext.subMenuCloseDelay, - builtinPlacements = _React$useContext.builtinPlacements, - triggerSubMenuAction = _React$useContext.triggerSubMenuAction, - forceSubMenuRender = _React$useContext.forceSubMenuRender, - rootClassName = _React$useContext.rootClassName, - motion = _React$useContext.motion, - defaultMotions = _React$useContext.defaultMotions; + /** + * RIGHT + */ + RIGHT: 39, - var _React$useState = React.useState(false), - _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), - innerVisible = _React$useState2[0], - setInnerVisible = _React$useState2[1]; + /** + * DOWN + */ + DOWN: 40, - var placement = rtl ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _placements.placementsRtl), builtinPlacements) : (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _placements.placements), builtinPlacements); - var popupPlacement = popupPlacementMap[mode]; - var targetMotion = (0, _motionUtil.getMotion)(mode, motion, defaultMotions); - var mergedMotion = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, targetMotion), {}, { - leavedClassName: "".concat(prefixCls, "-hidden"), - removeOnLeave: false, - motionAppear: true - }); // Delay to change visible + /** + * PRINT_SCREEN + */ + PRINT_SCREEN: 44, - var visibleRef = React.useRef(); - React.useEffect(function () { - visibleRef.current = (0, _raf.default)(function () { - setInnerVisible(visible); - }); - return function () { - _raf.default.cancel(visibleRef.current); - }; - }, [visible]); - return /*#__PURE__*/React.createElement(_rcTrigger.default, { - prefixCls: prefixCls, - popupClassName: (0, _classnames.default)("".concat(prefixCls, "-popup"), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-rtl"), rtl), popupClassName, rootClassName), - stretch: mode === 'horizontal' ? 'minWidth' : null, - getPopupContainer: getPopupContainer, - builtinPlacements: placement, - popupPlacement: popupPlacement, - popupVisible: innerVisible, - popup: popup, - popupAlign: popupOffset && { - offset: popupOffset - }, - action: disabled ? [] : [triggerSubMenuAction], - mouseEnterDelay: subMenuOpenDelay, - mouseLeaveDelay: subMenuCloseDelay, - onPopupVisibleChange: onVisibleChange, - forceRender: forceSubMenuRender, - popupMotion: mergedMotion - }, children); -} -},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-trigger":"PZMl","classnames":"qb7c","rc-util/es/raf":"adDJ","../context/MenuContext":"WRUc","../placements":"OUxT","../utils/motionUtil":"fjqJ"}],"l2u9":[function(require,module,exports) { -"use strict"; + /** + * INSERT + */ + INSERT: 45, -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = InlineSubMenuList; + /** + * DELETE + */ + DELETE: 46, -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + /** + * ZERO + */ + ZERO: 48, -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + /** + * ONE + */ + ONE: 49, -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + /** + * TWO + */ + TWO: 50, -var React = _interopRequireWildcard(require("react")); + /** + * THREE + */ + THREE: 51, -var _rcMotion = _interopRequireDefault(require("rc-motion")); + /** + * FOUR + */ + FOUR: 52, -var _motionUtil = require("../utils/motionUtil"); + /** + * FIVE + */ + FIVE: 53, -var _MenuContext = _interopRequireWildcard(require("../context/MenuContext")); + /** + * SIX + */ + SIX: 54, -var _SubMenuList = _interopRequireDefault(require("./SubMenuList")); + /** + * SEVEN + */ + SEVEN: 55, -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + /** + * EIGHT + */ + EIGHT: 56, -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + /** + * NINE + */ + NINE: 57, -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * QUESTION_MARK + */ + QUESTION_MARK: 63, -function InlineSubMenuList(_ref) { - var id = _ref.id, - open = _ref.open, - keyPath = _ref.keyPath, - children = _ref.children; - var fixedMode = 'inline'; + /** + * A + */ + A: 65, - var _React$useContext = React.useContext(_MenuContext.MenuContext), - prefixCls = _React$useContext.prefixCls, - forceSubMenuRender = _React$useContext.forceSubMenuRender, - motion = _React$useContext.motion, - defaultMotions = _React$useContext.defaultMotions, - mode = _React$useContext.mode; // Always use latest mode check + /** + * B + */ + B: 66, + /** + * C + */ + C: 67, - var sameModeRef = React.useRef(false); - sameModeRef.current = mode === fixedMode; // We record `destroy` mark here since when mode change from `inline` to others. - // The inline list should remove when motion end. + /** + * D + */ + D: 68, - var _React$useState = React.useState(!sameModeRef.current), - _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), - destroy = _React$useState2[0], - setDestroy = _React$useState2[1]; + /** + * E + */ + E: 69, - var mergedOpen = sameModeRef.current ? open : false; // ================================= Effect ================================= - // Reset destroy state when mode change back + /** + * F + */ + F: 70, - React.useEffect(function () { - if (sameModeRef.current) { - setDestroy(false); - } - }, [mode]); // ================================= Render ================================= + /** + * G + */ + G: 71, - var mergedMotion = (0, _objectSpread2.default)({}, (0, _motionUtil.getMotion)(fixedMode, motion, defaultMotions)); // No need appear since nest inlineCollapse changed + /** + * H + */ + H: 72, - if (keyPath.length > 1) { - mergedMotion.motionAppear = false; - } // Hide inline list when mode changed and motion end + /** + * I + */ + I: 73, + /** + * J + */ + J: 74, - var originOnVisibleChanged = mergedMotion.onVisibleChanged; + /** + * K + */ + K: 75, - mergedMotion.onVisibleChanged = function (newVisible) { - if (!sameModeRef.current && !newVisible) { - setDestroy(true); - } + /** + * L + */ + L: 76, - return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible); - }; + /** + * M + */ + M: 77, - if (destroy) { - return null; - } + /** + * N + */ + N: 78, - return /*#__PURE__*/React.createElement(_MenuContext.default, { - mode: fixedMode, - locked: !sameModeRef.current - }, /*#__PURE__*/React.createElement(_rcMotion.default, (0, _extends2.default)({ - visible: mergedOpen - }, mergedMotion, { - forceRender: forceSubMenuRender, - removeOnLeave: false, - leavedClassName: "".concat(prefixCls, "-hidden") - }), function (_ref2) { - var motionClassName = _ref2.className, - motionStyle = _ref2.style; - return /*#__PURE__*/React.createElement(_SubMenuList.default, { - id: id, - className: motionClassName, - style: motionStyle - }, children); - })); -} -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-motion":"VTMl","../utils/motionUtil":"fjqJ","../context/MenuContext":"WRUc","./SubMenuList":"imhB"}],"lVAn":[function(require,module,exports) { -"use strict"; + /** + * O + */ + O: 79, -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = SubMenu; + /** + * P + */ + P: 80, -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); + /** + * Q + */ + Q: 81, -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + /** + * R + */ + R: 82, -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + /** + * S + */ + S: 83, -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + /** + * T + */ + T: 84, -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + /** + * U + */ + U: 85, -var React = _interopRequireWildcard(require("react")); + /** + * V + */ + V: 86, -var _classnames = _interopRequireDefault(require("classnames")); + /** + * W + */ + W: 87, -var _rcOverflow = _interopRequireDefault(require("rc-overflow")); + /** + * X + */ + X: 88, -var _warning = _interopRequireDefault(require("rc-util/es/warning")); + /** + * Y + */ + Y: 89, -var _SubMenuList = _interopRequireDefault(require("./SubMenuList")); + /** + * Z + */ + Z: 90, -var _nodeUtil = require("../utils/nodeUtil"); + /** + * META + */ + META: 91, -var _MenuContext = _interopRequireWildcard(require("../context/MenuContext")); + /** + * WIN_KEY_RIGHT + */ + WIN_KEY_RIGHT: 92, -var _useMemoCallback = _interopRequireDefault(require("../hooks/useMemoCallback")); + /** + * CONTEXT_MENU + */ + CONTEXT_MENU: 93, -var _PopupTrigger = _interopRequireDefault(require("./PopupTrigger")); + /** + * NUM_ZERO + */ + NUM_ZERO: 96, -var _Icon = _interopRequireDefault(require("../Icon")); + /** + * NUM_ONE + */ + NUM_ONE: 97, -var _useActive2 = _interopRequireDefault(require("../hooks/useActive")); + /** + * NUM_TWO + */ + NUM_TWO: 98, -var _warnUtil = require("../utils/warnUtil"); + /** + * NUM_THREE + */ + NUM_THREE: 99, -var _useDirectionStyle = _interopRequireDefault(require("../hooks/useDirectionStyle")); + /** + * NUM_FOUR + */ + NUM_FOUR: 100, -var _InlineSubMenuList = _interopRequireDefault(require("./InlineSubMenuList")); + /** + * NUM_FIVE + */ + NUM_FIVE: 101, -var _PathContext = require("../context/PathContext"); + /** + * NUM_SIX + */ + NUM_SIX: 102, -var _IdContext = require("../context/IdContext"); + /** + * NUM_SEVEN + */ + NUM_SEVEN: 103, -var _PrivateContext = _interopRequireDefault(require("../context/PrivateContext")); + /** + * NUM_EIGHT + */ + NUM_EIGHT: 104, -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + /** + * NUM_NINE + */ + NUM_NINE: 105, -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + /** + * NUM_MULTIPLY + */ + NUM_MULTIPLY: 106, -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * NUM_PLUS + */ + NUM_PLUS: 107, -var _excluded = ["style", "className", "title", "eventKey", "warnKey", "disabled", "internalPopupClose", "children", "itemIcon", "expandIcon", "popupClassName", "popupOffset", "onClick", "onMouseEnter", "onMouseLeave", "onTitleClick", "onTitleMouseEnter", "onTitleMouseLeave"], - _excluded2 = ["active"]; + /** + * NUM_MINUS + */ + NUM_MINUS: 109, -var InternalSubMenu = function InternalSubMenu(props) { - var _classNames; + /** + * NUM_PERIOD + */ + NUM_PERIOD: 110, - var style = props.style, - className = props.className, - title = props.title, - eventKey = props.eventKey, - warnKey = props.warnKey, - disabled = props.disabled, - internalPopupClose = props.internalPopupClose, - children = props.children, - itemIcon = props.itemIcon, - expandIcon = props.expandIcon, - popupClassName = props.popupClassName, - popupOffset = props.popupOffset, - onClick = props.onClick, - onMouseEnter = props.onMouseEnter, - onMouseLeave = props.onMouseLeave, - onTitleClick = props.onTitleClick, - onTitleMouseEnter = props.onTitleMouseEnter, - onTitleMouseLeave = props.onTitleMouseLeave, - restProps = (0, _objectWithoutProperties2.default)(props, _excluded); - var domDataId = (0, _IdContext.useMenuId)(eventKey); + /** + * NUM_DIVISION + */ + NUM_DIVISION: 111, - var _React$useContext = React.useContext(_MenuContext.MenuContext), - prefixCls = _React$useContext.prefixCls, - mode = _React$useContext.mode, - openKeys = _React$useContext.openKeys, - contextDisabled = _React$useContext.disabled, - overflowDisabled = _React$useContext.overflowDisabled, - activeKey = _React$useContext.activeKey, - selectedKeys = _React$useContext.selectedKeys, - contextItemIcon = _React$useContext.itemIcon, - contextExpandIcon = _React$useContext.expandIcon, - onItemClick = _React$useContext.onItemClick, - onOpenChange = _React$useContext.onOpenChange, - onActive = _React$useContext.onActive; - - var _React$useContext2 = React.useContext(_PrivateContext.default), - _internalRenderSubMenuItem = _React$useContext2._internalRenderSubMenuItem; - - var _React$useContext3 = React.useContext(_PathContext.PathUserContext), - isSubPathKey = _React$useContext3.isSubPathKey; - - var connectedPath = (0, _PathContext.useFullPath)(); - var subMenuPrefixCls = "".concat(prefixCls, "-submenu"); - var mergedDisabled = contextDisabled || disabled; - var elementRef = React.useRef(); - var popupRef = React.useRef(); // ================================ Warn ================================ + /** + * F1 + */ + F1: 112, - if ("production" !== 'production' && warnKey) { - (0, _warning.default)(false, 'SubMenu should not leave undefined `key`.'); - } // ================================ Icon ================================ + /** + * F2 + */ + F2: 113, + /** + * F3 + */ + F3: 114, - var mergedItemIcon = itemIcon || contextItemIcon; - var mergedExpandIcon = expandIcon || contextExpandIcon; // ================================ Open ================================ + /** + * F4 + */ + F4: 115, - var originOpen = openKeys.includes(eventKey); - var open = !overflowDisabled && originOpen; // =============================== Select =============================== + /** + * F5 + */ + F5: 116, - var childrenSelected = isSubPathKey(selectedKeys, eventKey); // =============================== Active =============================== + /** + * F6 + */ + F6: 117, - var _useActive = (0, _useActive2.default)(eventKey, mergedDisabled, onTitleMouseEnter, onTitleMouseLeave), - active = _useActive.active, - activeProps = (0, _objectWithoutProperties2.default)(_useActive, _excluded2); // Fallback of active check to avoid hover on menu title or disabled item + /** + * F7 + */ + F7: 118, + /** + * F8 + */ + F8: 119, - var _React$useState = React.useState(false), - _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), - childrenActive = _React$useState2[0], - setChildrenActive = _React$useState2[1]; + /** + * F9 + */ + F9: 120, - var triggerChildrenActive = function triggerChildrenActive(newActive) { - if (!mergedDisabled) { - setChildrenActive(newActive); - } - }; + /** + * F10 + */ + F10: 121, - var onInternalMouseEnter = function onInternalMouseEnter(domEvent) { - triggerChildrenActive(true); - onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter({ - key: eventKey, - domEvent: domEvent - }); - }; + /** + * F11 + */ + F11: 122, - var onInternalMouseLeave = function onInternalMouseLeave(domEvent) { - triggerChildrenActive(false); - onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({ - key: eventKey, - domEvent: domEvent - }); - }; + /** + * F12 + */ + F12: 123, - var mergedActive = React.useMemo(function () { - if (active) { - return active; - } + /** + * NUMLOCK + */ + NUMLOCK: 144, - if (mode !== 'inline') { - return childrenActive || isSubPathKey([activeKey], eventKey); - } + /** + * SEMICOLON + */ + SEMICOLON: 186, - return false; - }, [mode, active, activeKey, childrenActive, eventKey, isSubPathKey]); // ========================== DirectionStyle ========================== + /** + * DASH + */ + DASH: 189, - var directionStyle = (0, _useDirectionStyle.default)(connectedPath.length); // =============================== Events =============================== - // >>>> Title click + /** + * EQUALS + */ + EQUALS: 187, - var onInternalTitleClick = function onInternalTitleClick(e) { - // Skip if disabled - if (mergedDisabled) { - return; - } + /** + * COMMA + */ + COMMA: 188, - onTitleClick === null || onTitleClick === void 0 ? void 0 : onTitleClick({ - key: eventKey, - domEvent: e - }); // Trigger open by click when mode is `inline` + /** + * PERIOD + */ + PERIOD: 190, - if (mode === 'inline') { - onOpenChange(eventKey, !originOpen); - } - }; // >>>> Context for children click + /** + * SLASH + */ + SLASH: 191, + /** + * APOSTROPHE + */ + APOSTROPHE: 192, - var onMergedItemClick = (0, _useMemoCallback.default)(function (info) { - onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); - onItemClick(info); - }); // >>>>> Visible change + /** + * SINGLE_QUOTE + */ + SINGLE_QUOTE: 222, - var onPopupVisibleChange = function onPopupVisibleChange(newVisible) { - if (mode !== 'inline') { - onOpenChange(eventKey, newVisible); - } - }; /** - * Used for accessibility. Helper will focus element without key board. - * We should manually trigger an active + * OPEN_SQUARE_BRACKET */ + OPEN_SQUARE_BRACKET: 219, + /** + * BACKSLASH + */ + BACKSLASH: 220, - var onInternalFocus = function onInternalFocus() { - onActive(eventKey); - }; // =============================== Render =============================== + /** + * CLOSE_SQUARE_BRACKET + */ + CLOSE_SQUARE_BRACKET: 221, + /** + * WIN_KEY + */ + WIN_KEY: 224, - var popupId = domDataId && "".concat(domDataId, "-popup"); // >>>>> Title + /** + * MAC_FF_META + */ + MAC_FF_META: 224, - var titleNode = /*#__PURE__*/React.createElement("div", (0, _extends2.default)({ - role: "menuitem", - style: directionStyle, - className: "".concat(subMenuPrefixCls, "-title"), - tabIndex: mergedDisabled ? null : -1, - ref: elementRef, - title: typeof title === 'string' ? title : null, - "data-menu-id": overflowDisabled && domDataId ? null : domDataId, - "aria-expanded": open, - "aria-haspopup": true, - "aria-controls": popupId, - "aria-disabled": mergedDisabled, - onClick: onInternalTitleClick, - onFocus: onInternalFocus - }, activeProps), title, /*#__PURE__*/React.createElement(_Icon.default, { - icon: mode !== 'horizontal' ? mergedExpandIcon : null, - props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, { - isOpen: open, - // [Legacy] Not sure why need this mark - isSubMenu: true - }) - }, /*#__PURE__*/React.createElement("i", { - className: "".concat(subMenuPrefixCls, "-arrow") - }))); // Cache mode if it change to `inline` which do not have popup motion + /** + * WIN_IME + */ + WIN_IME: 229, + // ======================== Function ======================== - var triggerModeRef = React.useRef(mode); + /** + * whether text and modified key is entered at the same time. + */ + isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) { + var keyCode = e.keyCode; - if (mode !== 'inline') { - triggerModeRef.current = connectedPath.length > 1 ? 'vertical' : mode; - } + if (e.altKey && !e.ctrlKey || e.metaKey || // Function keys don't generate text + keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { + return false; + } // The following keys are quite harmless, even in combination with + // CTRL, ALT or SHIFT. - if (!overflowDisabled) { - var triggerMode = triggerModeRef.current; // Still wrap with Trigger here since we need avoid react re-mount dom node - // Which makes motion failed - titleNode = /*#__PURE__*/React.createElement(_PopupTrigger.default, { - mode: triggerMode, - prefixCls: subMenuPrefixCls, - visible: !internalPopupClose && open && mode !== 'inline', - popupClassName: popupClassName, - popupOffset: popupOffset, - popup: /*#__PURE__*/React.createElement(_MenuContext.default // Special handle of horizontal mode - , { - mode: triggerMode === 'horizontal' ? 'vertical' : triggerMode - }, /*#__PURE__*/React.createElement(_SubMenuList.default, { - id: popupId, - ref: popupRef - }, children)), - disabled: mergedDisabled, - onVisibleChange: onPopupVisibleChange - }, titleNode); - } // >>>>> List node + switch (keyCode) { + case KeyCode.ALT: + case KeyCode.CAPS_LOCK: + case KeyCode.CONTEXT_MENU: + case KeyCode.CTRL: + case KeyCode.DOWN: + case KeyCode.END: + case KeyCode.ESC: + case KeyCode.HOME: + case KeyCode.INSERT: + case KeyCode.LEFT: + case KeyCode.MAC_FF_META: + case KeyCode.META: + case KeyCode.NUMLOCK: + case KeyCode.NUM_CENTER: + case KeyCode.PAGE_DOWN: + case KeyCode.PAGE_UP: + case KeyCode.PAUSE: + case KeyCode.PRINT_SCREEN: + case KeyCode.RIGHT: + case KeyCode.SHIFT: + case KeyCode.UP: + case KeyCode.WIN_KEY: + case KeyCode.WIN_KEY_RIGHT: + return false; + default: + return true; + } + }, - var listNode = /*#__PURE__*/React.createElement(_rcOverflow.default.Item, (0, _extends2.default)({ - role: "none" - }, restProps, { - component: "li", - style: style, - className: (0, _classnames.default)(subMenuPrefixCls, "".concat(subMenuPrefixCls, "-").concat(mode), className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-open"), open), (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-active"), mergedActive), (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-selected"), childrenSelected), (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-disabled"), mergedDisabled), _classNames)), - onMouseEnter: onInternalMouseEnter, - onMouseLeave: onInternalMouseLeave - }), titleNode, !overflowDisabled && /*#__PURE__*/React.createElement(_InlineSubMenuList.default, { - id: popupId, - open: open, - keyPath: connectedPath - }, children)); + /** + * whether character is entered. + */ + isCharacterKey: function isCharacterKey(keyCode) { + if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { + return true; + } - if (_internalRenderSubMenuItem) { - listNode = _internalRenderSubMenuItem(listNode, props, { - selected: childrenSelected, - active: mergedActive, - open: open, - disabled: mergedDisabled - }); - } // >>>>> Render + if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { + return true; + } + if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { + return true; + } // Safari sends zero key code for non-latin characters. - return /*#__PURE__*/React.createElement(_MenuContext.default, { - onItemClick: onMergedItemClick, - mode: mode === 'horizontal' ? 'vertical' : mode, - itemIcon: mergedItemIcon, - expandIcon: mergedExpandIcon - }, listNode); -}; -function SubMenu(props) { - var eventKey = props.eventKey, - children = props.children; - var connectedKeyPath = (0, _PathContext.useFullPath)(eventKey); - var childList = (0, _nodeUtil.parseChildren)(children, connectedKeyPath); // ==================== Record KeyPath ==================== + if (window.navigator.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { + return true; + } - var measure = (0, _PathContext.useMeasure)(); // eslint-disable-next-line consistent-return + switch (keyCode) { + case KeyCode.SPACE: + case KeyCode.QUESTION_MARK: + case KeyCode.NUM_PLUS: + case KeyCode.NUM_MINUS: + case KeyCode.NUM_PERIOD: + case KeyCode.NUM_DIVISION: + case KeyCode.SEMICOLON: + case KeyCode.DASH: + case KeyCode.EQUALS: + case KeyCode.COMMA: + case KeyCode.PERIOD: + case KeyCode.SLASH: + case KeyCode.APOSTROPHE: + case KeyCode.SINGLE_QUOTE: + case KeyCode.OPEN_SQUARE_BRACKET: + case KeyCode.BACKSLASH: + case KeyCode.CLOSE_SQUARE_BRACKET: + return true; - React.useEffect(function () { - if (measure) { - measure.registerPath(eventKey, connectedKeyPath); - return function () { - measure.unregisterPath(eventKey, connectedKeyPath); - }; + default: + return false; } - }, [connectedKeyPath]); - var renderNode; // ======================== Render ======================== - - if (measure) { - renderNode = childList; - } else { - renderNode = /*#__PURE__*/React.createElement(InternalSubMenu, props, childList); } - - return /*#__PURE__*/React.createElement(_PathContext.PathTrackerContext.Provider, { - value: connectedKeyPath - }, renderNode); -} -},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"qb7c","rc-overflow":"H6C2","rc-util/es/warning":"YOfO","./SubMenuList":"imhB","../utils/nodeUtil":"T1Gl","../context/MenuContext":"WRUc","../hooks/useMemoCallback":"vAIo","./PopupTrigger":"hvs0","../Icon":"E0zE","../hooks/useActive":"LQKT","../utils/warnUtil":"cvmo","../hooks/useDirectionStyle":"Pnmu","./InlineSubMenuList":"l2u9","../context/PathContext":"thAF","../context/IdContext":"VB3D","../context/PrivateContext":"V73O"}],"Dfmp":[function(require,module,exports) { +}; +var _default = KeyCode; +exports.default = _default; +},{}],"Dfmp":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -14179,7 +13909,7 @@ function limitTabRange(node, e) { } } } -},{"@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","./isVisible":"dPHJ"}],"g0Ae":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","./isVisible":"dPHJ"}],"FshY":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -14187,8 +13917,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = useAccessibility; -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); - var React = _interopRequireWildcard(require("react")); var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); @@ -14197,309 +13925,362 @@ var _raf = _interopRequireDefault(require("rc-util/es/raf")); var _focus = require("rc-util/es/Dom/focus"); -var _IdContext = require("../context/IdContext"); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// destruct to reduce minify size -var LEFT = _KeyCode.default.LEFT, - RIGHT = _KeyCode.default.RIGHT, - UP = _KeyCode.default.UP, - DOWN = _KeyCode.default.DOWN, - ENTER = _KeyCode.default.ENTER, - ESC = _KeyCode.default.ESC, - HOME = _KeyCode.default.HOME, - END = _KeyCode.default.END; -var ArrowKeys = [UP, DOWN, LEFT, RIGHT]; +var ESC = _KeyCode.default.ESC, + TAB = _KeyCode.default.TAB; -function getOffset(mode, isRootLevel, isRtl, which) { - var _inline, _horizontal, _vertical, _offsets; +function useAccessibility(_ref) { + var visible = _ref.visible, + setTriggerVisible = _ref.setTriggerVisible, + triggerRef = _ref.triggerRef, + onVisibleChange = _ref.onVisibleChange, + autoFocus = _ref.autoFocus; + var focusMenuRef = React.useRef(false); - var prev = 'prev'; - var next = 'next'; - var children = 'children'; - var parent = 'parent'; // Inline enter is special that we use unique operation + var handleCloseMenuAndReturnFocus = function handleCloseMenuAndReturnFocus() { + if (visible && triggerRef.current) { + var _triggerRef$current, _triggerRef$current$t, _triggerRef$current$t2, _triggerRef$current$t3; - if (mode === 'inline' && which === ENTER) { - return { - inlineTrigger: true - }; - } + (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : (_triggerRef$current$t = _triggerRef$current.triggerRef) === null || _triggerRef$current$t === void 0 ? void 0 : (_triggerRef$current$t2 = _triggerRef$current$t.current) === null || _triggerRef$current$t2 === void 0 ? void 0 : (_triggerRef$current$t3 = _triggerRef$current$t2.focus) === null || _triggerRef$current$t3 === void 0 ? void 0 : _triggerRef$current$t3.call(_triggerRef$current$t2); + setTriggerVisible(false); - var inline = (_inline = {}, (0, _defineProperty2.default)(_inline, UP, prev), (0, _defineProperty2.default)(_inline, DOWN, next), _inline); - var horizontal = (_horizontal = {}, (0, _defineProperty2.default)(_horizontal, LEFT, isRtl ? next : prev), (0, _defineProperty2.default)(_horizontal, RIGHT, isRtl ? prev : next), (0, _defineProperty2.default)(_horizontal, DOWN, children), (0, _defineProperty2.default)(_horizontal, ENTER, children), _horizontal); - var vertical = (_vertical = {}, (0, _defineProperty2.default)(_vertical, UP, prev), (0, _defineProperty2.default)(_vertical, DOWN, next), (0, _defineProperty2.default)(_vertical, ENTER, children), (0, _defineProperty2.default)(_vertical, ESC, parent), (0, _defineProperty2.default)(_vertical, LEFT, isRtl ? children : parent), (0, _defineProperty2.default)(_vertical, RIGHT, isRtl ? parent : children), _vertical); - var offsets = { - inline: inline, - horizontal: horizontal, - vertical: vertical, - inlineSub: inline, - horizontalSub: vertical, - verticalSub: vertical + if (typeof onVisibleChange === 'function') { + onVisibleChange(false); + } + } }; - var type = (_offsets = offsets["".concat(mode).concat(isRootLevel ? '' : 'Sub')]) === null || _offsets === void 0 ? void 0 : _offsets[which]; - - switch (type) { - case prev: - return { - offset: -1, - sibling: true - }; - - case next: - return { - offset: 1, - sibling: true - }; - - case parent: - return { - offset: -1, - sibling: false - }; - - case children: - return { - offset: 1, - sibling: false - }; - default: - return null; - } -} + var focusMenu = function focusMenu() { + var _triggerRef$current2, _triggerRef$current2$, _triggerRef$current2$2, _triggerRef$current2$3; -function findContainerUL(element) { - var current = element; + var elements = (0, _focus.getFocusNodeList)((_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : (_triggerRef$current2$ = _triggerRef$current2.popupRef) === null || _triggerRef$current2$ === void 0 ? void 0 : (_triggerRef$current2$2 = _triggerRef$current2$.current) === null || _triggerRef$current2$2 === void 0 ? void 0 : (_triggerRef$current2$3 = _triggerRef$current2$2.getElement) === null || _triggerRef$current2$3 === void 0 ? void 0 : _triggerRef$current2$3.call(_triggerRef$current2$2)); + var firstElement = elements[0]; - while (current) { - if (current.getAttribute('data-menu-list')) { - return current; + if (firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus) { + firstElement.focus(); + focusMenuRef.current = true; + return true; } - current = current.parentElement; - } // Normally should not reach this line - - /* istanbul ignore next */ + return false; + }; + var handleKeyDown = function handleKeyDown(event) { + switch (event.keyCode) { + case ESC: + handleCloseMenuAndReturnFocus(); + break; - return null; -} -/** - * Find focused element within element set provided - */ + case TAB: + { + var focusResult = false; + if (!focusMenuRef.current) { + focusResult = focusMenu(); + } -function getFocusElement(activeElement, elements) { - var current = activeElement || document.activeElement; + if (focusResult) { + event.preventDefault(); + } else { + handleCloseMenuAndReturnFocus(); + } - while (current) { - if (elements.has(current)) { - return current; + break; + } } + }; - current = current.parentElement; - } + React.useEffect(function () { + if (visible) { + window.addEventListener('keydown', handleKeyDown); - return null; -} -/** - * Get focusable elements from the element set under provided container - */ + if (autoFocus) { + // FIXME: hack with raf + (0, _raf.default)(focusMenu, 3); + } + return function () { + window.removeEventListener('keydown', handleKeyDown); + focusMenuRef.current = false; + }; + } -function getFocusableElements(container, elements) { - var list = (0, _focus.getFocusNodeList)(container, true); - return list.filter(function (ele) { - return elements.has(ele); - }); + return function () { + focusMenuRef.current = false; + }; + }, [visible]); // eslint-disable-line react-hooks/exhaustive-deps } +},{"react":"n8MK","rc-util/es/KeyCode":"Imvn","rc-util/es/raf":"mM6N","rc-util/es/Dom/focus":"Dfmp"}],"rgdw":[function(require,module,exports) { +"use strict"; -function getNextFocusElement(parentQueryContainer, elements, focusMenuElement) { - var offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; // Key on the menu item will not get validate parent container - - if (!parentQueryContainer) { - return null; - } // List current level menu item elements +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); - var sameLevelFocusableMenuElementList = getFocusableElements(parentQueryContainer, elements); // Find next focus index +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); - var count = sameLevelFocusableMenuElementList.length; - var focusIndex = sameLevelFocusableMenuElementList.findIndex(function (ele) { - return focusMenuElement === ele; - }); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); - if (offset < 0) { - if (focusIndex === -1) { - focusIndex = count - 1; - } else { - focusIndex -= 1; - } - } else if (offset > 0) { - focusIndex += 1; - } +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); - focusIndex = (focusIndex + count) % count; // Focus menu item +var React = _interopRequireWildcard(require("react")); - return sameLevelFocusableMenuElementList[focusIndex]; -} +var _rcTrigger = _interopRequireDefault(require("rc-trigger")); -function useAccessibility(mode, activeKey, isRtl, id, containerRef, getKeys, getKeyPath, triggerActiveKey, triggerAccessibilityOpen, originOnKeyDown) { - var rafRef = React.useRef(); - var activeRef = React.useRef(); - activeRef.current = activeKey; +var _classnames = _interopRequireDefault(require("classnames")); - var cleanRaf = function cleanRaf() { - _raf.default.cancel(rafRef.current); - }; +var _placements = _interopRequireDefault(require("./placements")); - React.useEffect(function () { - return function () { - cleanRaf(); - }; - }, []); - return function (e) { - var which = e.which; +var _useAccessibility = _interopRequireDefault(require("./hooks/useAccessibility")); - if ([].concat(ArrowKeys, [ENTER, ESC, HOME, END]).includes(which)) { - // Convert key to elements - var elements; - var key2element; - var element2key; // >>> Wrap as function since we use raf for some case +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - var refreshElements = function refreshElements() { - elements = new Set(); - key2element = new Map(); - element2key = new Map(); - var keys = getKeys(); - keys.forEach(function (key) { - var element = document.querySelector("[data-menu-id='".concat((0, _IdContext.getMenuId)(id, key), "']")); +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - if (element) { - elements.add(element); - element2key.set(element, key); - key2element.set(key, element); - } - }); - return elements; - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - refreshElements(); // First we should find current focused MenuItem/SubMenu element +var _excluded = ["arrow", "prefixCls", "transitionName", "animation", "align", "placement", "placements", "getPopupContainer", "showAction", "hideAction", "overlayClassName", "overlayStyle", "visible", "trigger", "autoFocus"]; - var activeElement = key2element.get(activeKey); - var focusMenuElement = getFocusElement(activeElement, elements); - var focusMenuKey = element2key.get(focusMenuElement); - var offsetObj = getOffset(mode, getKeyPath(focusMenuKey, true).length === 1, isRtl, which); // Some mode do not have fully arrow operation like inline +function Dropdown(props, ref) { + var _props$arrow = props.arrow, + arrow = _props$arrow === void 0 ? false : _props$arrow, + _props$prefixCls = props.prefixCls, + prefixCls = _props$prefixCls === void 0 ? 'rc-dropdown' : _props$prefixCls, + transitionName = props.transitionName, + animation = props.animation, + align = props.align, + _props$placement = props.placement, + placement = _props$placement === void 0 ? 'bottomLeft' : _props$placement, + _props$placements = props.placements, + placements = _props$placements === void 0 ? _placements.default : _props$placements, + getPopupContainer = props.getPopupContainer, + showAction = props.showAction, + hideAction = props.hideAction, + overlayClassName = props.overlayClassName, + overlayStyle = props.overlayStyle, + visible = props.visible, + _props$trigger = props.trigger, + trigger = _props$trigger === void 0 ? ['hover'] : _props$trigger, + autoFocus = props.autoFocus, + otherProps = (0, _objectWithoutProperties2.default)(props, _excluded); - if (!offsetObj && which !== HOME && which !== END) { - return; - } // Arrow prevent default to avoid page scroll + var _React$useState = React.useState(), + _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), + triggerVisible = _React$useState2[0], + setTriggerVisible = _React$useState2[1]; + var mergedVisible = 'visible' in props ? visible : triggerVisible; + var triggerRef = React.useRef(null); + React.useImperativeHandle(ref, function () { + return triggerRef.current; + }); + (0, _useAccessibility.default)({ + visible: mergedVisible, + setTriggerVisible: setTriggerVisible, + triggerRef: triggerRef, + onVisibleChange: props.onVisibleChange, + autoFocus: autoFocus + }); - if (ArrowKeys.includes(which) || [HOME, END].includes(which)) { - e.preventDefault(); - } + var getOverlayElement = function getOverlayElement() { + var overlay = props.overlay; + var overlayElement; - var tryFocus = function tryFocus(menuElement) { - if (menuElement) { - var focusTargetElement = menuElement; // Focus to link instead of menu item if possible + if (typeof overlay === 'function') { + overlayElement = overlay(); + } else { + overlayElement = overlay; + } - var link = menuElement.querySelector('a'); + return overlayElement; + }; - if (link === null || link === void 0 ? void 0 : link.getAttribute('href')) { - focusTargetElement = link; - } + var onClick = function onClick(e) { + var onOverlayClick = props.onOverlayClick; + setTriggerVisible(false); - var targetKey = element2key.get(menuElement); - triggerActiveKey(targetKey); - /** - * Do not `useEffect` here since `tryFocus` may trigger async - * which makes React sync update the `activeKey` - * that force render before `useRef` set the next activeKey - */ + if (onOverlayClick) { + onOverlayClick(e); + } + }; - cleanRaf(); - rafRef.current = (0, _raf.default)(function () { - if (activeRef.current === targetKey) { - focusTargetElement.focus(); - } - }); - } - }; + var onVisibleChange = function onVisibleChange(newVisible) { + var onVisibleChangeProp = props.onVisibleChange; + setTriggerVisible(newVisible); - if ([HOME, END].includes(which) || offsetObj.sibling || !focusMenuElement) { - // ========================== Sibling ========================== - // Find walkable focus menu element container - var parentQueryContainer; + if (typeof onVisibleChangeProp === 'function') { + onVisibleChangeProp(newVisible); + } + }; - if (!focusMenuElement || mode === 'inline') { - parentQueryContainer = containerRef.current; - } else { - parentQueryContainer = findContainerUL(focusMenuElement); - } // Get next focus element + var getMenuElement = function getMenuElement() { + var overlayElement = getOverlayElement(); + return /*#__PURE__*/React.createElement(React.Fragment, null, arrow && /*#__PURE__*/React.createElement("div", { + className: "".concat(prefixCls, "-arrow") + }), overlayElement); + }; + var getMenuElementOrLambda = function getMenuElementOrLambda() { + var overlay = props.overlay; - var targetElement; - var focusableElements = getFocusableElements(parentQueryContainer, elements); + if (typeof overlay === 'function') { + return getMenuElement; + } - if (which === HOME) { - targetElement = focusableElements[0]; - } else if (which === END) { - targetElement = focusableElements[focusableElements.length - 1]; - } else { - targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset); - } // Focus menu item + return getMenuElement(); + }; + var getMinOverlayWidthMatchTrigger = function getMinOverlayWidthMatchTrigger() { + var minOverlayWidthMatchTrigger = props.minOverlayWidthMatchTrigger, + alignPoint = props.alignPoint; - tryFocus(targetElement); // ======================= InlineTrigger ======================= - } else if (offsetObj.inlineTrigger) { - // Inline trigger no need switch to sub menu item - triggerAccessibilityOpen(focusMenuKey); // =========================== Level =========================== - } else if (offsetObj.offset > 0) { - triggerAccessibilityOpen(focusMenuKey, true); - cleanRaf(); - rafRef.current = (0, _raf.default)(function () { - // Async should resync elements - refreshElements(); - var controlId = focusMenuElement.getAttribute('aria-controls'); - var subQueryContainer = document.getElementById(controlId); // Get sub focusable menu item + if ('minOverlayWidthMatchTrigger' in props) { + return minOverlayWidthMatchTrigger; + } - var targetElement = getNextFocusElement(subQueryContainer, elements); // Focus menu item + return !alignPoint; + }; - tryFocus(targetElement); - }, 5); - } else if (offsetObj.offset < 0) { - var keyPath = getKeyPath(focusMenuKey, true); - var parentKey = keyPath[keyPath.length - 2]; - var parentMenuElement = key2element.get(parentKey); // Focus menu item + var getOpenClassName = function getOpenClassName() { + var openClassName = props.openClassName; - triggerAccessibilityOpen(parentKey, false); - tryFocus(parentMenuElement); - } - } // Pass origin key down event + if (openClassName !== undefined) { + return openClassName; + } + return "".concat(prefixCls, "-open"); + }; - originOnKeyDown === null || originOnKeyDown === void 0 ? void 0 : originOnKeyDown(e); + var renderChildren = function renderChildren() { + var children = props.children; + var childrenProps = children.props ? children.props : {}; + var childClassName = (0, _classnames.default)(childrenProps.className, getOpenClassName()); + return mergedVisible && children ? /*#__PURE__*/React.cloneElement(children, { + className: childClassName + }) : children; }; + + var triggerHideAction = hideAction; + + if (!triggerHideAction && trigger.indexOf('contextMenu') !== -1) { + triggerHideAction = ['click']; + } + + return /*#__PURE__*/React.createElement(_rcTrigger.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({ + builtinPlacements: placements + }, otherProps), {}, { + prefixCls: prefixCls, + ref: triggerRef, + popupClassName: (0, _classnames.default)(overlayClassName, (0, _defineProperty2.default)({}, "".concat(prefixCls, "-show-arrow"), arrow)), + popupStyle: overlayStyle, + action: trigger, + showAction: showAction, + hideAction: triggerHideAction || [], + popupPlacement: placement, + popupAlign: align, + popupTransitionName: transitionName, + popupAnimation: animation, + popupVisible: mergedVisible, + stretch: getMinOverlayWidthMatchTrigger() ? 'minWidth' : '', + popup: getMenuElementOrLambda(), + onPopupVisibleChange: onVisibleChange, + onPopupClick: onClick, + getPopupContainer: getPopupContainer + }), renderChildren()); } -},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","react":"n8MK","rc-util/es/KeyCode":"Imvn","rc-util/es/raf":"adDJ","rc-util/es/Dom/focus":"Dfmp","../context/IdContext":"VB3D"}],"nOjm":[function(require,module,exports) { + +var _default = /*#__PURE__*/React.forwardRef(Dropdown); + +exports.default = _default; +},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","rc-trigger":"PZMl","classnames":"yl9j","./placements":"GgDZ","./hooks/useAccessibility":"FshY"}],"SyQB":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = useUUID; +exports.default = void 0; -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +var _Dropdown = _interopRequireDefault(require("./Dropdown")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _default = _Dropdown.default; +exports.default = _default; +},{"./Dropdown":"rgdw"}],"akeE":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useLayoutUpdateEffect = exports.default = void 0; var React = _interopRequireWildcard(require("react")); -var _useMergedState3 = _interopRequireDefault(require("rc-util/es/hooks/useMergedState")); +var _canUseDom = _interopRequireDefault(require("../Dom/canUseDom")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +/** + * Wrap `React.useLayoutEffect` which will not throw warning message in test env + */ +var useInternalLayoutEffect = "production" !== 'test' && (0, _canUseDom.default)() ? React.useLayoutEffect : React.useEffect; + +var useLayoutEffect = function useLayoutEffect(callback, deps) { + var firstMountRef = React.useRef(true); + useInternalLayoutEffect(function () { + return callback(firstMountRef.current); + }, deps); // We tell react that first mount has passed + + useInternalLayoutEffect(function () { + firstMountRef.current = false; + return function () { + firstMountRef.current = true; + }; + }, []); +}; + +var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) { + useLayoutEffect(function (firstMount) { + if (!firstMount) { + return callback(); + } + }, deps); +}; + +exports.useLayoutUpdateEffect = useLayoutUpdateEffect; +var _default = useLayoutEffect; +exports.default = _default; +},{"react":"n8MK","../Dom/canUseDom":"s2cK"}],"Hqa3":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + +var React = _interopRequireWildcard(require("react")); + +var _classnames = _interopRequireDefault(require("classnames")); + +var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -14507,54 +14288,126 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var uniquePrefix = Math.random().toFixed(5).toString().slice(2); -var internalId = 0; +var _excluded = ["prefixCls", "invalidate", "item", "renderItem", "responsive", "responsiveDisabled", "registerSize", "itemKey", "className", "style", "children", "display", "order", "component"]; +// Use shared variable to save bundle size +var UNDEFINED = undefined; -function useUUID(id) { - var _useMergedState = (0, _useMergedState3.default)(id, { - value: id - }), - _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2), - uuid = _useMergedState2[0], - setUUID = _useMergedState2[1]; +function InternalItem(props, ref) { + var prefixCls = props.prefixCls, + invalidate = props.invalidate, + item = props.item, + renderItem = props.renderItem, + responsive = props.responsive, + responsiveDisabled = props.responsiveDisabled, + registerSize = props.registerSize, + itemKey = props.itemKey, + className = props.className, + style = props.style, + children = props.children, + display = props.display, + order = props.order, + _props$component = props.component, + Component = _props$component === void 0 ? 'div' : _props$component, + restProps = (0, _objectWithoutProperties2.default)(props, _excluded); + var mergedHidden = responsive && !display; // ================================ Effect ================================ + + function internalRegisterSize(width) { + registerSize(itemKey, width); + } React.useEffect(function () { - internalId += 1; - var newId = "production" === 'test' ? 'test' : "".concat(uniquePrefix, "-").concat(internalId); - setUUID("rc-menu-uuid-".concat(newId)); - }, []); - return uuid; + return function () { + internalRegisterSize(null); + }; + }, []); // ================================ Render ================================ + + var childNode = renderItem && item !== UNDEFINED ? renderItem(item) : children; + var overflowStyle; + + if (!invalidate) { + overflowStyle = { + opacity: mergedHidden ? 0 : 1, + height: mergedHidden ? 0 : UNDEFINED, + overflowY: mergedHidden ? 'hidden' : UNDEFINED, + order: responsive ? order : UNDEFINED, + pointerEvents: mergedHidden ? 'none' : UNDEFINED, + position: mergedHidden ? 'absolute' : UNDEFINED + }; + } + + var overflowProps = {}; + + if (mergedHidden) { + overflowProps['aria-hidden'] = true; + } + + var itemNode = /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({ + className: (0, _classnames.default)(!invalidate && prefixCls, className), + style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, overflowStyle), style) + }, overflowProps, restProps, { + ref: ref + }), childNode); + + if (responsive) { + itemNode = /*#__PURE__*/React.createElement(_rcResizeObserver.default, { + onResize: function onResize(_ref) { + var offsetWidth = _ref.offsetWidth; + internalRegisterSize(offsetWidth); + }, + disabled: responsiveDisabled + }, itemNode); + } + + return itemNode; } -},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/hooks/useMergedState":"zMpY"}],"sR1M":[function(require,module,exports) { + +var Item = /*#__PURE__*/React.forwardRef(InternalItem); +Item.displayName = 'Item'; +var _default = Item; +exports.default = _default; +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"yl9j","rc-resize-observer":"q9L5"}],"Bec3":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.nextSlice = nextSlice; +exports.default = channelUpdate; -function nextSlice(callback) { - /* istanbul ignore next */ - Promise.resolve().then(callback); +var _raf = _interopRequireDefault(require("rc-util/es/raf")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function channelUpdate(callback) { + if (typeof MessageChannel === 'undefined') { + (0, _raf.default)(callback); + } else { + var channel = new MessageChannel(); + + channel.port1.onmessage = function () { + return callback(); + }; + + channel.port2.postMessage(undefined); + } } -},{}],"FDUp":[function(require,module,exports) { +},{"rc-util/es/raf":"dtu8"}],"aMyL":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.OVERFLOW_KEY = void 0; -exports.default = useKeyRecords; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); +exports.default = useEffectState; +exports.useBatcher = useBatcher; var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +var _useEvent = _interopRequireDefault(require("rc-util/es/hooks/useEvent")); + var React = _interopRequireWildcard(require("react")); -var _warning = _interopRequireDefault(require("rc-util/es/warning")); +var _reactDom = require("react-dom"); -var _timeUtil = require("../utils/timeUtil"); +var _channelUpdate = _interopRequireDefault(require("./channelUpdate")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -14562,126 +14415,67 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var PATH_SPLIT = '__RC_UTIL_PATH_SPLIT__'; +/** + * Batcher for record any `useEffectState` need update. + */ +function useBatcher() { + // Updater Trigger + var updateFuncRef = React.useRef(null); // Notify update + + var notifyEffectUpdate = function notifyEffectUpdate(callback) { + if (!updateFuncRef.current) { + updateFuncRef.current = []; + (0, _channelUpdate.default)(function () { + (0, _reactDom.unstable_batchedUpdates)(function () { + updateFuncRef.current.forEach(function (fn) { + fn(); + }); + updateFuncRef.current = null; + }); + }); + } -var getPathStr = function getPathStr(keyPath) { - return keyPath.join(PATH_SPLIT); -}; + updateFuncRef.current.push(callback); + }; -var getPathKeys = function getPathKeys(keyPathStr) { - return keyPathStr.split(PATH_SPLIT); -}; + return notifyEffectUpdate; +} +/** + * Trigger state update by `useLayoutEffect` to save perf. + */ -var OVERFLOW_KEY = 'rc-menu-more'; -exports.OVERFLOW_KEY = OVERFLOW_KEY; -function useKeyRecords() { - var _React$useState = React.useState({}), +function useEffectState(notifyEffectUpdate, defaultValue) { + // Value + var _React$useState = React.useState(defaultValue), _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), - internalForceUpdate = _React$useState2[1]; + stateValue = _React$useState2[0], + setStateValue = _React$useState2[1]; // Set State - var key2pathRef = (0, React.useRef)(new Map()); - var path2keyRef = (0, React.useRef)(new Map()); - var _React$useState3 = React.useState([]), - _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2), - overflowKeys = _React$useState4[0], - setOverflowKeys = _React$useState4[1]; + var setEffectVal = (0, _useEvent.default)(function (nextValue) { + notifyEffectUpdate(function () { + setStateValue(nextValue); + }); + }); + return [stateValue, setEffectVal]; +} +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","rc-util/es/hooks/useEvent":"ssYe","react":"n8MK","react-dom":"NKHc","./channelUpdate":"Bec3"}],"Os65":[function(require,module,exports) { +"use strict"; - var updateRef = (0, React.useRef)(0); - var destroyRef = (0, React.useRef)(false); - - var forceUpdate = function forceUpdate() { - if (!destroyRef.current) { - internalForceUpdate({}); - } - }; - - var registerPath = (0, React.useCallback)(function (key, keyPath) { - // Warning for invalidate or duplicated `key` - if ("production" !== 'production') { - (0, _warning.default)(!key2pathRef.current.has(key), "Duplicated key '".concat(key, "' used in Menu by path [").concat(keyPath.join(' > '), "]")); - } // Fill map - - - var connectedPath = getPathStr(keyPath); - path2keyRef.current.set(connectedPath, key); - key2pathRef.current.set(key, connectedPath); - updateRef.current += 1; - var id = updateRef.current; - (0, _timeUtil.nextSlice)(function () { - if (id === updateRef.current) { - forceUpdate(); - } - }); - }, []); - var unregisterPath = (0, React.useCallback)(function (key, keyPath) { - var connectedPath = getPathStr(keyPath); - path2keyRef.current.delete(connectedPath); - key2pathRef.current.delete(key); - }, []); - var refreshOverflowKeys = (0, React.useCallback)(function (keys) { - setOverflowKeys(keys); - }, []); - var getKeyPath = (0, React.useCallback)(function (eventKey, includeOverflow) { - var fullPath = key2pathRef.current.get(eventKey) || ''; - var keys = getPathKeys(fullPath); - - if (includeOverflow && overflowKeys.includes(keys[0])) { - keys.unshift(OVERFLOW_KEY); - } - - return keys; - }, [overflowKeys]); - var isSubPathKey = (0, React.useCallback)(function (pathKeys, eventKey) { - return pathKeys.some(function (pathKey) { - var pathKeyList = getKeyPath(pathKey, true); - return pathKeyList.includes(eventKey); - }); - }, [getKeyPath]); - - var getKeys = function getKeys() { - var keys = (0, _toConsumableArray2.default)(key2pathRef.current.keys()); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.OverflowContext = void 0; - if (overflowKeys.length) { - keys.push(OVERFLOW_KEY); - } +var _react = _interopRequireDefault(require("react")); - return keys; - }; - /** - * Find current key related child path keys - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var OverflowContext = /*#__PURE__*/_react.default.createContext(null); - var getSubPathKeys = (0, React.useCallback)(function (key) { - var connectedPath = "".concat(key2pathRef.current.get(key)).concat(PATH_SPLIT); - var pathKeys = new Set(); - (0, _toConsumableArray2.default)(path2keyRef.current.keys()).forEach(function (pathKey) { - if (pathKey.startsWith(connectedPath)) { - pathKeys.add(path2keyRef.current.get(pathKey)); - } - }); - return pathKeys; - }, []); - React.useEffect(function () { - return function () { - destroyRef.current = true; - }; - }, []); - return { - // Register - registerPath: registerPath, - unregisterPath: unregisterPath, - refreshOverflowKeys: refreshOverflowKeys, - // Util - isSubPathKey: isSubPathKey, - getKeyPath: getKeyPath, - getKeys: getKeys, - getSubPathKeys: getSubPathKeys - }; -} -},{"@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/warning":"YOfO","../utils/timeUtil":"sR1M"}],"JLqT":[function(require,module,exports) { +exports.OverflowContext = OverflowContext; +},{"react":"n8MK"}],"dmCC":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -14691,51 +14485,93 @@ exports.default = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); +var React = _interopRequireWildcard(require("react")); -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); +var _classnames = _interopRequireDefault(require("classnames")); -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +var _Item = _interopRequireDefault(require("./Item")); -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); +var _context = require("./context"); -var React = _interopRequireWildcard(require("react")); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } -var _classnames = _interopRequireDefault(require("classnames")); +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -var _shallowequal = _interopRequireDefault(require("shallowequal")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _useMergedState7 = _interopRequireDefault(require("rc-util/es/hooks/useMergedState")); +var _excluded = ["component"], + _excluded2 = ["className"], + _excluded3 = ["className"]; -var _warning = _interopRequireDefault(require("rc-util/es/warning")); +var InternalRawItem = function InternalRawItem(props, ref) { + var context = React.useContext(_context.OverflowContext); // Render directly when context not provided -var _rcOverflow = _interopRequireDefault(require("rc-overflow")); + if (!context) { + var _props$component = props.component, + Component = _props$component === void 0 ? 'div' : _props$component, + _restProps = (0, _objectWithoutProperties2.default)(props, _excluded); -var _MenuItem = _interopRequireDefault(require("./MenuItem")); + return /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({}, _restProps, { + ref: ref + })); + } -var _nodeUtil = require("./utils/nodeUtil"); + var contextClassName = context.className, + restContext = (0, _objectWithoutProperties2.default)(context, _excluded2); + var className = props.className, + restProps = (0, _objectWithoutProperties2.default)(props, _excluded3); // Do not pass context to sub item to avoid multiple measure -var _MenuContext = _interopRequireDefault(require("./context/MenuContext")); + return /*#__PURE__*/React.createElement(_context.OverflowContext.Provider, { + value: null + }, /*#__PURE__*/React.createElement(_Item.default, (0, _extends2.default)({ + ref: ref, + className: (0, _classnames.default)(contextClassName, className) + }, restContext, restProps))); +}; -var _useMemoCallback = _interopRequireDefault(require("./hooks/useMemoCallback")); +var RawItem = /*#__PURE__*/React.forwardRef(InternalRawItem); +RawItem.displayName = 'RawItem'; +var _default = RawItem; +exports.default = _default; +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"yl9j","./Item":"Hqa3","./context":"Os65"}],"lyHO":[function(require,module,exports) { +"use strict"; -var _warnUtil = require("./utils/warnUtil"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "OverflowContext", { + enumerable: true, + get: function () { + return _context.OverflowContext; + } +}); +exports.default = void 0; -var _SubMenu = _interopRequireDefault(require("./SubMenu")); +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); -var _useAccessibility = _interopRequireDefault(require("./hooks/useAccessibility")); +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var _useUUID = _interopRequireDefault(require("./hooks/useUUID")); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); -var _PathContext = require("./context/PathContext"); +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); -var _useKeyRecords2 = _interopRequireWildcard(require("./hooks/useKeyRecords")); +var React = _interopRequireWildcard(require("react")); -var _IdContext = require("./context/IdContext"); +var _classnames = _interopRequireDefault(require("classnames")); -var _PrivateContext = _interopRequireDefault(require("./context/PrivateContext")); +var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer")); + +var _useLayoutEffect = _interopRequireDefault(require("rc-util/es/hooks/useLayoutEffect")); + +var _Item = _interopRequireDefault(require("./Item")); + +var _useEffectState11 = _interopRequireWildcard(require("./hooks/useEffectState")); + +var _RawItem = _interopRequireDefault(require("./RawItem")); + +var _context = require("./context"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -14743,792 +14579,698 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _excluded = ["prefixCls", "rootClassName", "style", "className", "tabIndex", "items", "children", "direction", "id", "mode", "inlineCollapsed", "disabled", "disabledOverflow", "subMenuOpenDelay", "subMenuCloseDelay", "forceSubMenuRender", "defaultOpenKeys", "openKeys", "activeKey", "defaultActiveFirst", "selectable", "multiple", "defaultSelectedKeys", "selectedKeys", "onSelect", "onDeselect", "inlineIndent", "motion", "defaultMotions", "triggerSubMenuAction", "builtinPlacements", "itemIcon", "expandIcon", "overflowedIndicator", "overflowedIndicatorPopupClassName", "getPopupContainer", "onClick", "onOpenChange", "onKeyDown", "openAnimation", "openTransitionName", "_internalRenderMenuItem", "_internalRenderSubMenuItem"]; +var _excluded = ["prefixCls", "data", "renderItem", "renderRawItem", "itemKey", "itemWidth", "ssr", "style", "className", "maxCount", "renderRest", "renderRawRest", "suffix", "component", "itemComponent", "onVisibleChange"]; +var RESPONSIVE = 'responsive'; +var INVALIDATE = 'invalidate'; -/** - * Menu modify after refactor: - * ## Add - * - disabled - * - * ## Remove - * - openTransitionName - * - openAnimation - * - onDestroy - * - siderCollapsed: Seems antd do not use this prop (Need test in antd) - * - collapsedWidth: Seems this logic should be handle by antd Layout.Sider - */ -// optimize for render -var EMPTY_LIST = []; -var Menu = /*#__PURE__*/React.forwardRef(function (props, ref) { - var _childList$, _classNames; +function defaultRenderRest(omittedItems) { + return "+ ".concat(omittedItems.length, " ..."); +} +function Overflow(props, ref) { var _props$prefixCls = props.prefixCls, - prefixCls = _props$prefixCls === void 0 ? 'rc-menu' : _props$prefixCls, - rootClassName = props.rootClassName, + prefixCls = _props$prefixCls === void 0 ? 'rc-overflow' : _props$prefixCls, + _props$data = props.data, + data = _props$data === void 0 ? [] : _props$data, + renderItem = props.renderItem, + renderRawItem = props.renderRawItem, + itemKey = props.itemKey, + _props$itemWidth = props.itemWidth, + itemWidth = _props$itemWidth === void 0 ? 10 : _props$itemWidth, + ssr = props.ssr, style = props.style, className = props.className, - _props$tabIndex = props.tabIndex, - tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex, - items = props.items, - children = props.children, - direction = props.direction, - id = props.id, - _props$mode = props.mode, - mode = _props$mode === void 0 ? 'vertical' : _props$mode, - inlineCollapsed = props.inlineCollapsed, - disabled = props.disabled, - disabledOverflow = props.disabledOverflow, - _props$subMenuOpenDel = props.subMenuOpenDelay, - subMenuOpenDelay = _props$subMenuOpenDel === void 0 ? 0.1 : _props$subMenuOpenDel, - _props$subMenuCloseDe = props.subMenuCloseDelay, - subMenuCloseDelay = _props$subMenuCloseDe === void 0 ? 0.1 : _props$subMenuCloseDe, - forceSubMenuRender = props.forceSubMenuRender, - defaultOpenKeys = props.defaultOpenKeys, - openKeys = props.openKeys, - activeKey = props.activeKey, - defaultActiveFirst = props.defaultActiveFirst, - _props$selectable = props.selectable, - selectable = _props$selectable === void 0 ? true : _props$selectable, - _props$multiple = props.multiple, - multiple = _props$multiple === void 0 ? false : _props$multiple, - defaultSelectedKeys = props.defaultSelectedKeys, - selectedKeys = props.selectedKeys, - onSelect = props.onSelect, - onDeselect = props.onDeselect, - _props$inlineIndent = props.inlineIndent, - inlineIndent = _props$inlineIndent === void 0 ? 24 : _props$inlineIndent, - motion = props.motion, - defaultMotions = props.defaultMotions, - _props$triggerSubMenu = props.triggerSubMenuAction, - triggerSubMenuAction = _props$triggerSubMenu === void 0 ? 'hover' : _props$triggerSubMenu, - builtinPlacements = props.builtinPlacements, - itemIcon = props.itemIcon, - expandIcon = props.expandIcon, - _props$overflowedIndi = props.overflowedIndicator, - overflowedIndicator = _props$overflowedIndi === void 0 ? '...' : _props$overflowedIndi, - overflowedIndicatorPopupClassName = props.overflowedIndicatorPopupClassName, - getPopupContainer = props.getPopupContainer, - onClick = props.onClick, - onOpenChange = props.onOpenChange, - onKeyDown = props.onKeyDown, - openAnimation = props.openAnimation, - openTransitionName = props.openTransitionName, - _internalRenderMenuItem = props._internalRenderMenuItem, - _internalRenderSubMenuItem = props._internalRenderSubMenuItem, + maxCount = props.maxCount, + renderRest = props.renderRest, + renderRawRest = props.renderRawRest, + suffix = props.suffix, + _props$component = props.component, + Component = _props$component === void 0 ? 'div' : _props$component, + itemComponent = props.itemComponent, + onVisibleChange = props.onVisibleChange, restProps = (0, _objectWithoutProperties2.default)(props, _excluded); - var childList = React.useMemo(function () { - return (0, _nodeUtil.parseItems)(children, items, EMPTY_LIST); - }, [children, items]); - - var _React$useState = React.useState(false), - _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), - mounted = _React$useState2[0], - setMounted = _React$useState2[1]; + var fullySSR = ssr === 'full'; + var notifyEffectUpdate = (0, _useEffectState11.useBatcher)(); - var containerRef = React.useRef(); - var uuid = (0, _useUUID.default)(id); - var isRtl = direction === 'rtl'; // ========================= Warn ========================= + var _useEffectState = (0, _useEffectState11.default)(notifyEffectUpdate, null), + _useEffectState2 = (0, _slicedToArray2.default)(_useEffectState, 2), + containerWidth = _useEffectState2[0], + setContainerWidth = _useEffectState2[1]; - if ("production" !== 'production') { - (0, _warning.default)(!openAnimation && !openTransitionName, '`openAnimation` and `openTransitionName` is removed. Please use `motion` or `defaultMotion` instead.'); - } // ========================= Mode ========================= + var mergedContainerWidth = containerWidth || 0; + var _useEffectState3 = (0, _useEffectState11.default)(notifyEffectUpdate, new Map()), + _useEffectState4 = (0, _slicedToArray2.default)(_useEffectState3, 2), + itemWidths = _useEffectState4[0], + setItemWidths = _useEffectState4[1]; - var _React$useMemo = React.useMemo(function () { - if ((mode === 'inline' || mode === 'vertical') && inlineCollapsed) { - return ['vertical', inlineCollapsed]; - } + var _useEffectState5 = (0, _useEffectState11.default)(notifyEffectUpdate, 0), + _useEffectState6 = (0, _slicedToArray2.default)(_useEffectState5, 2), + prevRestWidth = _useEffectState6[0], + setPrevRestWidth = _useEffectState6[1]; - return [mode, false]; - }, [mode, inlineCollapsed]), - _React$useMemo2 = (0, _slicedToArray2.default)(_React$useMemo, 2), - mergedMode = _React$useMemo2[0], - mergedInlineCollapsed = _React$useMemo2[1]; // ====================== Responsive ====================== + var _useEffectState7 = (0, _useEffectState11.default)(notifyEffectUpdate, 0), + _useEffectState8 = (0, _slicedToArray2.default)(_useEffectState7, 2), + restWidth = _useEffectState8[0], + setRestWidth = _useEffectState8[1]; + var _useEffectState9 = (0, _useEffectState11.default)(notifyEffectUpdate, 0), + _useEffectState10 = (0, _slicedToArray2.default)(_useEffectState9, 2), + suffixWidth = _useEffectState10[0], + setSuffixWidth = _useEffectState10[1]; - var _React$useState3 = React.useState(0), - _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2), - lastVisibleIndex = _React$useState4[0], - setLastVisibleIndex = _React$useState4[1]; + var _useState = (0, React.useState)(null), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + suffixFixedStart = _useState2[0], + setSuffixFixedStart = _useState2[1]; - var allVisible = lastVisibleIndex >= childList.length - 1 || mergedMode !== 'horizontal' || disabledOverflow; // ========================= Open ========================= + var _useState3 = (0, React.useState)(null), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + displayCount = _useState4[0], + setDisplayCount = _useState4[1]; - var _useMergedState = (0, _useMergedState7.default)(defaultOpenKeys, { - value: openKeys, - postState: function postState(keys) { - return keys || EMPTY_LIST; + var mergedDisplayCount = React.useMemo(function () { + if (displayCount === null && fullySSR) { + return Number.MAX_SAFE_INTEGER; } - }), - _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2), - mergedOpenKeys = _useMergedState2[0], - setMergedOpenKeys = _useMergedState2[1]; - var triggerOpenKeys = function triggerOpenKeys(keys) { - setMergedOpenKeys(keys); - onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(keys); - }; // >>>>> Cache & Reset open keys when inlineCollapsed changed + return displayCount || 0; + }, [displayCount, containerWidth]); + var _useState5 = (0, React.useState)(false), + _useState6 = (0, _slicedToArray2.default)(_useState5, 2), + restReady = _useState6[0], + setRestReady = _useState6[1]; - var _React$useState5 = React.useState(mergedOpenKeys), - _React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2), - inlineCacheOpenKeys = _React$useState6[0], - setInlineCacheOpenKeys = _React$useState6[1]; + var itemPrefixCls = "".concat(prefixCls, "-item"); // Always use the max width to avoid blink - var isInlineMode = mergedMode === 'inline'; - var mountRef = React.useRef(false); // Cache + var mergedRestWidth = Math.max(prevRestWidth, restWidth); // ================================= Data ================================= - React.useEffect(function () { - if (isInlineMode) { - setInlineCacheOpenKeys(mergedOpenKeys); - } - }, [mergedOpenKeys]); // Restore + var isResponsive = maxCount === RESPONSIVE; + var shouldResponsive = data.length && isResponsive; + var invalidate = maxCount === INVALIDATE; + /** + * When is `responsive`, we will always render rest node to get the real width of it for calculation + */ - React.useEffect(function () { - if (!mountRef.current) { - return; - } + var showRest = shouldResponsive || typeof maxCount === 'number' && data.length > maxCount; + var mergedData = (0, React.useMemo)(function () { + var items = data; - if (isInlineMode) { - setMergedOpenKeys(inlineCacheOpenKeys); - } else { - // Trigger open event in case its in control - triggerOpenKeys(EMPTY_LIST); + if (shouldResponsive) { + if (containerWidth === null && fullySSR) { + items = data; + } else { + items = data.slice(0, Math.min(data.length, mergedContainerWidth / itemWidth)); + } + } else if (typeof maxCount === 'number') { + items = data.slice(0, maxCount); } - }, [isInlineMode]); - React.useEffect(function () { - mountRef.current = true; - return function () { - mountRef.current = false; - }; - }, []); // ========================= Path ========================= - - var _useKeyRecords = (0, _useKeyRecords2.default)(), - registerPath = _useKeyRecords.registerPath, - unregisterPath = _useKeyRecords.unregisterPath, - refreshOverflowKeys = _useKeyRecords.refreshOverflowKeys, - isSubPathKey = _useKeyRecords.isSubPathKey, - getKeyPath = _useKeyRecords.getKeyPath, - getKeys = _useKeyRecords.getKeys, - getSubPathKeys = _useKeyRecords.getSubPathKeys; - var registerPathContext = React.useMemo(function () { - return { - registerPath: registerPath, - unregisterPath: unregisterPath - }; - }, [registerPath, unregisterPath]); - var pathUserContext = React.useMemo(function () { - return { - isSubPathKey: isSubPathKey - }; - }, [isSubPathKey]); - React.useEffect(function () { - refreshOverflowKeys(allVisible ? EMPTY_LIST : childList.slice(lastVisibleIndex + 1).map(function (child) { - return child.key; - })); - }, [lastVisibleIndex, allVisible]); // ======================== Active ======================== + return items; + }, [data, itemWidth, containerWidth, maxCount, shouldResponsive]); + var omittedItems = (0, React.useMemo)(function () { + if (shouldResponsive) { + return data.slice(mergedDisplayCount + 1); + } - var _useMergedState3 = (0, _useMergedState7.default)(activeKey || defaultActiveFirst && ((_childList$ = childList[0]) === null || _childList$ === void 0 ? void 0 : _childList$.key), { - value: activeKey - }), - _useMergedState4 = (0, _slicedToArray2.default)(_useMergedState3, 2), - mergedActiveKey = _useMergedState4[0], - setMergedActiveKey = _useMergedState4[1]; + return data.slice(mergedData.length); + }, [data, mergedData, shouldResponsive, mergedDisplayCount]); // ================================= Item ================================= - var onActive = (0, _useMemoCallback.default)(function (key) { - setMergedActiveKey(key); - }); - var onInactive = (0, _useMemoCallback.default)(function () { - setMergedActiveKey(undefined); - }); - (0, React.useImperativeHandle)(ref, function () { - return { - list: containerRef.current, - focus: function focus(options) { - var _childList$find; + var getKey = (0, React.useCallback)(function (item, index) { + var _ref; - var shouldFocusKey = mergedActiveKey !== null && mergedActiveKey !== void 0 ? mergedActiveKey : (_childList$find = childList.find(function (node) { - return !node.props.disabled; - })) === null || _childList$find === void 0 ? void 0 : _childList$find.key; + if (typeof itemKey === 'function') { + return itemKey(item); + } - if (shouldFocusKey) { - var _containerRef$current, _containerRef$current2, _containerRef$current3; + return (_ref = itemKey && (item === null || item === void 0 ? void 0 : item[itemKey])) !== null && _ref !== void 0 ? _ref : index; + }, [itemKey]); + var mergedRenderItem = (0, React.useCallback)(renderItem || function (item) { + return item; + }, [renderItem]); - (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.querySelector("li[data-menu-id='".concat((0, _IdContext.getMenuId)(uuid, shouldFocusKey), "']"))) === null || _containerRef$current2 === void 0 ? void 0 : (_containerRef$current3 = _containerRef$current2.focus) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.call(_containerRef$current2, options); - } - } - }; - }); // ======================== Select ======================== - // >>>>> Select keys + function updateDisplayCount(count, suffixFixedStartVal, notReady) { + // React 18 will sync render even when the value is same in some case. + // We take `mergedData` as deps which may cause dead loop if it's dynamic generate. + // ref: https://github.com/ant-design/ant-design/issues/36559 + if (displayCount === count && (suffixFixedStartVal === undefined || suffixFixedStartVal === suffixFixedStart)) { + return; + } - var _useMergedState5 = (0, _useMergedState7.default)(defaultSelectedKeys || [], { - value: selectedKeys, - // Legacy convert key to array - postState: function postState(keys) { - if (Array.isArray(keys)) { - return keys; - } + setDisplayCount(count); - if (keys === null || keys === undefined) { - return EMPTY_LIST; - } + if (!notReady) { + setRestReady(count < data.length - 1); + onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(count); + } - return [keys]; + if (suffixFixedStartVal !== undefined) { + setSuffixFixedStart(suffixFixedStartVal); } - }), - _useMergedState6 = (0, _slicedToArray2.default)(_useMergedState5, 2), - mergedSelectKeys = _useMergedState6[0], - setMergedSelectKeys = _useMergedState6[1]; // >>>>> Trigger select + } // ================================= Size ================================= - var triggerSelection = function triggerSelection(info) { - if (selectable) { - // Insert or Remove - var targetKey = info.key; - var exist = mergedSelectKeys.includes(targetKey); - var newSelectKeys; + function onOverflowResize(_, element) { + setContainerWidth(element.clientWidth); + } - if (multiple) { - if (exist) { - newSelectKeys = mergedSelectKeys.filter(function (key) { - return key !== targetKey; - }); - } else { - newSelectKeys = [].concat((0, _toConsumableArray2.default)(mergedSelectKeys), [targetKey]); - } + function registerSize(key, width) { + setItemWidths(function (origin) { + var clone = new Map(origin); + + if (width === null) { + clone.delete(key); } else { - newSelectKeys = [targetKey]; + clone.set(key, width); } - setMergedSelectKeys(newSelectKeys); // Trigger event + return clone; + }); + } - var selectInfo = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, info), {}, { - selectedKeys: newSelectKeys - }); + function registerOverflowSize(_, width) { + setRestWidth(width); + setPrevRestWidth(restWidth); + } - if (exist) { - onDeselect === null || onDeselect === void 0 ? void 0 : onDeselect(selectInfo); - } else { - onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectInfo); - } - } // Whatever selectable, always close it + function registerSuffixSize(_, width) { + setSuffixWidth(width); + } // ================================ Effect ================================ - if (!multiple && mergedOpenKeys.length && mergedMode !== 'inline') { - triggerOpenKeys(EMPTY_LIST); - } - }; // ========================= Open ========================= + function getItemWidth(index) { + return itemWidths.get(getKey(mergedData[index], index)); + } - /** - * Click for item. SubMenu do not have selection status - */ + (0, _useLayoutEffect.default)(function () { + if (mergedContainerWidth && typeof mergedRestWidth === 'number' && mergedData) { + var totalWidth = suffixWidth; + var len = mergedData.length; + var lastIndex = len - 1; // When data count change to 0, reset this since not loop will reach + if (!len) { + updateDisplayCount(0, null); + return; + } - var onInternalClick = (0, _useMemoCallback.default)(function (info) { - onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); - triggerSelection(info); - }); - var onInternalOpenChange = (0, _useMemoCallback.default)(function (key, open) { - var newOpenKeys = mergedOpenKeys.filter(function (k) { - return k !== key; - }); + for (var i = 0; i < len; i += 1) { + var currentItemWidth = getItemWidth(i); // Fully will always render - if (open) { - newOpenKeys.push(key); - } else if (mergedMode !== 'inline') { - // We need find all related popup to close - var subPathKeys = getSubPathKeys(key); - newOpenKeys = newOpenKeys.filter(function (k) { - return !subPathKeys.has(k); - }); - } + if (fullySSR) { + currentItemWidth = currentItemWidth || 0; + } // Break since data not ready - if (!(0, _shallowequal.default)(mergedOpenKeys, newOpenKeys)) { - triggerOpenKeys(newOpenKeys); - } - }); - var getInternalPopupContainer = (0, _useMemoCallback.default)(getPopupContainer); // ==================== Accessibility ===================== - var triggerAccessibilityOpen = function triggerAccessibilityOpen(key, open) { - var nextOpen = open !== null && open !== void 0 ? open : !mergedOpenKeys.includes(key); - onInternalOpenChange(key, nextOpen); - }; + if (currentItemWidth === undefined) { + updateDisplayCount(i - 1, undefined, true); + break; + } // Find best match - var onInternalKeyDown = (0, _useAccessibility.default)(mergedMode, mergedActiveKey, isRtl, uuid, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown); // ======================== Effect ======================== - React.useEffect(function () { - setMounted(true); - }, []); // ======================= Context ======================== + totalWidth += currentItemWidth; - var privateContext = React.useMemo(function () { - return { - _internalRenderMenuItem: _internalRenderMenuItem, - _internalRenderSubMenuItem: _internalRenderSubMenuItem + if ( // Only one means `totalWidth` is the final width + lastIndex === 0 && totalWidth <= mergedContainerWidth || // Last two width will be the final width + i === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth) { + // Additional check if match the end + updateDisplayCount(lastIndex, null); + break; + } else if (totalWidth + mergedRestWidth > mergedContainerWidth) { + // Can not hold all the content to show rest + updateDisplayCount(i - 1, totalWidth - currentItemWidth - suffixWidth + restWidth); + break; + } + } + + if (suffix && getItemWidth(0) + suffixWidth > mergedContainerWidth) { + setSuffixFixedStart(null); + } + } + }, [mergedContainerWidth, itemWidths, restWidth, suffixWidth, getKey, mergedData]); // ================================ Render ================================ + + var displayRest = restReady && !!omittedItems.length; + var suffixStyle = {}; + + if (suffixFixedStart !== null && shouldResponsive) { + suffixStyle = { + position: 'absolute', + left: suffixFixedStart, + top: 0 }; - }, [_internalRenderMenuItem, _internalRenderSubMenuItem]); // ======================== Render ======================== - // >>>>> Children + } - var wrappedChildList = mergedMode !== 'horizontal' || disabledOverflow ? childList : // Need wrap for overflow dropdown that do not response for open - childList.map(function (child, index) { - return ( - /*#__PURE__*/ - // Always wrap provider to avoid sub node re-mount - React.createElement(_MenuContext.default, { - key: child.key, - overflowDisabled: index > lastVisibleIndex - }, child) - ); - }); // >>>>> Container + var itemSharedProps = { + prefixCls: itemPrefixCls, + responsive: shouldResponsive, + component: itemComponent, + invalidate: invalidate + }; // >>>>> Choice render fun by `renderRawItem` - var container = /*#__PURE__*/React.createElement(_rcOverflow.default, (0, _extends2.default)({ - id: id, - ref: containerRef, - prefixCls: "".concat(prefixCls, "-overflow"), - component: "ul", - itemComponent: _MenuItem.default, - className: (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(mergedMode), className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-inline-collapsed"), mergedInlineCollapsed), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-rtl"), isRtl), _classNames), rootClassName), - dir: direction, + var internalRenderItemNode = renderRawItem ? function (item, index) { + var key = getKey(item, index); + return /*#__PURE__*/React.createElement(_context.OverflowContext.Provider, { + key: key, + value: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemSharedProps), {}, { + order: index, + item: item, + itemKey: key, + registerSize: registerSize, + display: index <= mergedDisplayCount + }) + }, renderRawItem(item, index)); + } : function (item, index) { + var key = getKey(item, index); + return /*#__PURE__*/React.createElement(_Item.default, (0, _extends2.default)({}, itemSharedProps, { + order: index, + key: key, + item: item, + renderItem: mergedRenderItem, + itemKey: key, + registerSize: registerSize, + display: index <= mergedDisplayCount + })); + }; // >>>>> Rest node + + var restNode; + var restContextProps = { + order: displayRest ? mergedDisplayCount : Number.MAX_SAFE_INTEGER, + className: "".concat(itemPrefixCls, "-rest"), + registerSize: registerOverflowSize, + display: displayRest + }; + + if (!renderRawRest) { + var mergedRenderRest = renderRest || defaultRenderRest; + restNode = /*#__PURE__*/React.createElement(_Item.default, (0, _extends2.default)({}, itemSharedProps, restContextProps), typeof mergedRenderRest === 'function' ? mergedRenderRest(omittedItems) : mergedRenderRest); + } else if (renderRawRest) { + restNode = /*#__PURE__*/React.createElement(_context.OverflowContext.Provider, { + value: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemSharedProps), restContextProps) + }, renderRawRest(omittedItems)); + } + + var overflowNode = /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({ + className: (0, _classnames.default)(!invalidate && prefixCls, className), style: style, - role: "menu", - tabIndex: tabIndex, - data: wrappedChildList, - renderRawItem: function renderRawItem(node) { - return node; - }, - renderRawRest: function renderRawRest(omitItems) { - // We use origin list since wrapped list use context to prevent open - var len = omitItems.length; - var originOmitItems = len ? childList.slice(-len) : null; - return /*#__PURE__*/React.createElement(_SubMenu.default, { - eventKey: _useKeyRecords2.OVERFLOW_KEY, - title: overflowedIndicator, - disabled: allVisible, - internalPopupClose: len === 0, - popupClassName: overflowedIndicatorPopupClassName - }, originOmitItems); - }, - maxCount: mergedMode !== 'horizontal' || disabledOverflow ? _rcOverflow.default.INVALIDATE : _rcOverflow.default.RESPONSIVE, - ssr: "full", - "data-menu-list": true, - onVisibleChange: function onVisibleChange(newLastIndex) { - setLastVisibleIndex(newLastIndex); - }, - onKeyDown: onInternalKeyDown - }, restProps)); // >>>>> Render + ref: ref + }, restProps), mergedData.map(internalRenderItemNode), showRest ? restNode : null, suffix && /*#__PURE__*/React.createElement(_Item.default, (0, _extends2.default)({}, itemSharedProps, { + responsive: isResponsive, + responsiveDisabled: !shouldResponsive, + order: mergedDisplayCount, + className: "".concat(itemPrefixCls, "-suffix"), + registerSize: registerSuffixSize, + display: true, + style: suffixStyle + }), suffix)); - return /*#__PURE__*/React.createElement(_PrivateContext.default.Provider, { - value: privateContext - }, /*#__PURE__*/React.createElement(_IdContext.IdContext.Provider, { - value: uuid - }, /*#__PURE__*/React.createElement(_MenuContext.default, { - prefixCls: prefixCls, - rootClassName: rootClassName, - mode: mergedMode, - openKeys: mergedOpenKeys, - rtl: isRtl // Disabled - , - disabled: disabled // Motion - , - motion: mounted ? motion : null, - defaultMotions: mounted ? defaultMotions : null // Active - , - activeKey: mergedActiveKey, - onActive: onActive, - onInactive: onInactive // Selection - , - selectedKeys: mergedSelectKeys // Level - , - inlineIndent: inlineIndent // Popup - , - subMenuOpenDelay: subMenuOpenDelay, - subMenuCloseDelay: subMenuCloseDelay, - forceSubMenuRender: forceSubMenuRender, - builtinPlacements: builtinPlacements, - triggerSubMenuAction: triggerSubMenuAction, - getPopupContainer: getInternalPopupContainer // Icon - , - itemIcon: itemIcon, - expandIcon: expandIcon // Events - , - onItemClick: onInternalClick, - onOpenChange: onInternalOpenChange - }, /*#__PURE__*/React.createElement(_PathContext.PathUserContext.Provider, { - value: pathUserContext - }, container), /*#__PURE__*/React.createElement("div", { - style: { - display: 'none' - }, - "aria-hidden": true - }, /*#__PURE__*/React.createElement(_PathContext.PathRegisterContext.Provider, { - value: registerPathContext - }, childList))))); -}); -var _default = Menu; + if (isResponsive) { + overflowNode = /*#__PURE__*/React.createElement(_rcResizeObserver.default, { + onResize: onOverflowResize, + disabled: !shouldResponsive + }, overflowNode); + } + + return overflowNode; +} + +var ForwardOverflow = /*#__PURE__*/React.forwardRef(Overflow); +ForwardOverflow.displayName = 'Overflow'; +ForwardOverflow.Item = _RawItem.default; +ForwardOverflow.RESPONSIVE = RESPONSIVE; +ForwardOverflow.INVALIDATE = INVALIDATE; // Convert to generic type + +var _default = ForwardOverflow; exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"qb7c","shallowequal":"pz6A","rc-util/es/hooks/useMergedState":"zMpY","rc-util/es/warning":"YOfO","rc-overflow":"H6C2","./MenuItem":"NeBp","./utils/nodeUtil":"T1Gl","./context/MenuContext":"WRUc","./hooks/useMemoCallback":"vAIo","./utils/warnUtil":"cvmo","./SubMenu":"lVAn","./hooks/useAccessibility":"g0Ae","./hooks/useUUID":"nOjm","./context/PathContext":"thAF","./hooks/useKeyRecords":"FDUp","./context/IdContext":"VB3D","./context/PrivateContext":"V73O"}],"vrf4":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"yl9j","rc-resize-observer":"q9L5","rc-util/es/hooks/useLayoutEffect":"akeE","./Item":"Hqa3","./hooks/useEffectState":"aMyL","./RawItem":"dmCC","./context":"Os65"}],"H6C2":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = MenuItemGroup; - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); +exports.default = void 0; -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); +var _Overflow = _interopRequireDefault(require("./Overflow")); -var React = _interopRequireWildcard(require("react")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _classnames = _interopRequireDefault(require("classnames")); +var _default = _Overflow.default; +exports.default = _default; +},{"./Overflow":"lyHO"}],"RFRG":[function(require,module,exports) { +"use strict"; -var _omit = _interopRequireDefault(require("rc-util/es/omit")); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.useLayoutUpdateEffect = exports.default = void 0; -var _nodeUtil = require("./utils/nodeUtil"); +var React = _interopRequireWildcard(require("react")); -var _MenuContext = require("./context/MenuContext"); +var _canUseDom = _interopRequireDefault(require("../Dom/canUseDom")); -var _PathContext = require("./context/PathContext"); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var _excluded = ["className", "title", "eventKey", "children"], - _excluded2 = ["children"]; - -var InternalMenuItemGroup = function InternalMenuItemGroup(_ref) { - var className = _ref.className, - title = _ref.title, - eventKey = _ref.eventKey, - children = _ref.children, - restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); +/** + * Wrap `React.useLayoutEffect` which will not throw warning message in test env + */ +var useInternalLayoutEffect = "production" !== 'test' && (0, _canUseDom.default)() ? React.useLayoutEffect : React.useEffect; - var _React$useContext = React.useContext(_MenuContext.MenuContext), - prefixCls = _React$useContext.prefixCls; +var useLayoutEffect = function useLayoutEffect(callback, deps) { + var firstMountRef = React.useRef(true); + useInternalLayoutEffect(function () { + return callback(firstMountRef.current); + }, deps); // We tell react that first mount has passed - var groupPrefixCls = "".concat(prefixCls, "-item-group"); - return /*#__PURE__*/React.createElement("li", (0, _extends2.default)({}, restProps, { - onClick: function onClick(e) { - return e.stopPropagation(); - }, - className: (0, _classnames.default)(groupPrefixCls, className) - }), /*#__PURE__*/React.createElement("div", { - className: "".concat(groupPrefixCls, "-title"), - title: typeof title === 'string' ? title : undefined - }, title), /*#__PURE__*/React.createElement("ul", { - className: "".concat(groupPrefixCls, "-list") - }, children)); + useInternalLayoutEffect(function () { + firstMountRef.current = false; + return function () { + firstMountRef.current = true; + }; + }, []); }; -function MenuItemGroup(_ref2) { - var children = _ref2.children, - props = (0, _objectWithoutProperties2.default)(_ref2, _excluded2); - var connectedKeyPath = (0, _PathContext.useFullPath)(props.eventKey); - var childList = (0, _nodeUtil.parseChildren)(children, connectedKeyPath); - var measure = (0, _PathContext.useMeasure)(); - - if (measure) { - return childList; - } +var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) { + useLayoutEffect(function (firstMount) { + if (!firstMount) { + return callback(); + } + }, deps); +}; - return /*#__PURE__*/React.createElement(InternalMenuItemGroup, (0, _omit.default)(props, ['warnKey']), childList); -} -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"qb7c","rc-util/es/omit":"P8ML","./utils/nodeUtil":"T1Gl","./context/MenuContext":"WRUc","./context/PathContext":"thAF"}],"hlbq":[function(require,module,exports) { +exports.useLayoutUpdateEffect = useLayoutUpdateEffect; +var _default = useLayoutEffect; +exports.default = _default; +},{"react":"n8MK","../Dom/canUseDom":"s2cK"}],"UovL":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = Divider; +exports.default = useMergedState; -var React = _interopRequireWildcard(require("react")); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); -var _classnames = _interopRequireDefault(require("classnames")); +var _useEvent = _interopRequireDefault(require("./useEvent")); -var _MenuContext = require("./context/MenuContext"); +var _useLayoutEffect = require("./useLayoutEffect"); -var _PathContext = require("./context/PathContext"); +var _useState5 = _interopRequireDefault(require("./useState")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +/** We only think `undefined` is empty */ +function hasValue(value) { + return value !== undefined; +} +/** + * Similar to `useState` but will use props value if provided. + * Note that internal use rc-util `useState` hook. + */ -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -function Divider(_ref) { - var className = _ref.className, - style = _ref.style; +function useMergedState(defaultStateValue, option) { + var _ref = option || {}, + defaultValue = _ref.defaultValue, + value = _ref.value, + onChange = _ref.onChange, + postState = _ref.postState; // ======================= Init ======================= - var _React$useContext = React.useContext(_MenuContext.MenuContext), - prefixCls = _React$useContext.prefixCls; - var measure = (0, _PathContext.useMeasure)(); + var _useState = (0, _useState5.default)(function () { + if (hasValue(value)) { + return value; + } else if (hasValue(defaultValue)) { + return typeof defaultValue === 'function' ? defaultValue() : defaultValue; + } else { + return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue; + } + }), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + innerValue = _useState2[0], + setInnerValue = _useState2[1]; - if (measure) { - return null; - } + var mergedValue = value !== undefined ? value : innerValue; + var postMergedValue = postState ? postState(mergedValue) : mergedValue; // ====================== Change ====================== - return /*#__PURE__*/React.createElement("li", { - className: (0, _classnames.default)("".concat(prefixCls, "-item-divider"), className), - style: style + var onChangeFn = (0, _useEvent.default)(onChange); + + var _useState3 = (0, _useState5.default)([mergedValue]), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + prevValue = _useState4[0], + setPrevValue = _useState4[1]; + + (0, _useLayoutEffect.useLayoutUpdateEffect)(function () { + var prev = prevValue[0]; + + if (innerValue !== prev) { + onChangeFn(innerValue, prev); + } + }, [prevValue]); // Sync value back to `undefined` when it from control to un-control + + (0, _useLayoutEffect.useLayoutUpdateEffect)(function () { + if (!hasValue(value)) { + setInnerValue(value); + } + }, [value]); // ====================== Update ====================== + + var triggerChange = (0, _useEvent.default)(function (updater, ignoreDestroy) { + setInnerValue(updater, ignoreDestroy); + setPrevValue([mergedValue], ignoreDestroy); }); + return [postMergedValue, triggerChange]; } -},{"react":"n8MK","classnames":"qb7c","./context/MenuContext":"WRUc","./context/PathContext":"thAF"}],"VH7R":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","./useEvent":"ssYe","./useLayoutEffect":"RFRG","./useState":"nSoY"}],"orzV":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -Object.defineProperty(exports, "Divider", { - enumerable: true, - get: function () { - return _Divider.default; - } -}); -Object.defineProperty(exports, "Item", { - enumerable: true, - get: function () { - return _MenuItem.default; - } -}); -Object.defineProperty(exports, "ItemGroup", { - enumerable: true, - get: function () { - return _MenuItemGroup.default; - } -}); -Object.defineProperty(exports, "MenuItem", { - enumerable: true, - get: function () { - return _MenuItem.default; - } -}); -Object.defineProperty(exports, "MenuItemGroup", { - enumerable: true, - get: function () { - return _MenuItemGroup.default; - } -}); -Object.defineProperty(exports, "SubMenu", { - enumerable: true, - get: function () { - return _SubMenu.default; - } -}); +exports.call = call; exports.default = void 0; -Object.defineProperty(exports, "useFullPath", { - enumerable: true, - get: function () { - return _PathContext.useFullPath; +exports.note = note; +exports.noteOnce = noteOnce; +exports.preMessage = void 0; +exports.resetWarned = resetWarned; +exports.warning = warning; +exports.warningOnce = warningOnce; + +/* eslint-disable no-console */ +var warned = {}; +var preWarningFns = []; +/** + * Pre warning enable you to parse content before console.error. + * Modify to null will prevent warning. + */ + +var preMessage = function preMessage(fn) { + preWarningFns.push(fn); +}; +/** + * Warning if condition not match. + * @param valid Condition + * @param message Warning message + * @example + * ```js + * warning(false, 'some error'); // print some error + * warning(true, 'some error'); // print nothing + * warning(1 === 2, 'some error'); // print some error + * ``` + */ + + +exports.preMessage = preMessage; + +function warning(valid, message) { + if ("production" !== 'production' && !valid && console !== undefined) { + var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) { + return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'warning'); + }, message); + + if (finalMessage) { + console.error("Warning: ".concat(finalMessage)); + } } -}); +} +/** @see Similar to {@link warning} */ -var _Menu = _interopRequireDefault(require("./Menu")); -var _MenuItem = _interopRequireDefault(require("./MenuItem")); +function note(valid, message) { + if ("production" !== 'production' && !valid && console !== undefined) { + var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) { + return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'note'); + }, message); -var _SubMenu = _interopRequireDefault(require("./SubMenu")); + if (finalMessage) { + console.warn("Note: ".concat(finalMessage)); + } + } +} -var _MenuItemGroup = _interopRequireDefault(require("./MenuItemGroup")); +function resetWarned() { + warned = {}; +} -var _PathContext = require("./context/PathContext"); +function call(method, valid, message) { + if (!valid && !warned[message]) { + method(false, message); + warned[message] = true; + } +} +/** @see Same as {@link warning}, but only warn once for the same message */ -var _Divider = _interopRequireDefault(require("./Divider")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function warningOnce(valid, message) { + call(warning, valid, message); +} +/** @see Same as {@link warning}, but only warn once for the same message */ -var ExportMenu = _Menu.default; -ExportMenu.Item = _MenuItem.default; -ExportMenu.SubMenu = _SubMenu.default; -ExportMenu.ItemGroup = _MenuItemGroup.default; -ExportMenu.Divider = _Divider.default; -var _default = ExportMenu; + +function noteOnce(valid, message) { + call(note, valid, message); +} + +warningOnce.preMessage = preMessage; +warningOnce.resetWarned = resetWarned; +warningOnce.noteOnce = noteOnce; +var _default = warningOnce; exports.default = _default; -},{"./Menu":"JLqT","./MenuItem":"NeBp","./SubMenu":"lVAn","./MenuItemGroup":"vrf4","./context/PathContext":"thAF","./Divider":"hlbq"}],"K12W":[function(require,module,exports) { +},{}],"n49D":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; -var autoAdjustOverflow = { - adjustX: 1, - adjustY: 1 -}; -var targetOffset = [0, 0]; -var placements = { - topLeft: { - points: ['bl', 'tl'], - overflow: autoAdjustOverflow, - offset: [0, -4], - targetOffset: targetOffset - }, - topCenter: { - points: ['bc', 'tc'], - overflow: autoAdjustOverflow, - offset: [0, -4], - targetOffset: targetOffset - }, - topRight: { - points: ['br', 'tr'], - overflow: autoAdjustOverflow, - offset: [0, -4], - targetOffset: targetOffset - }, - bottomLeft: { - points: ['tl', 'bl'], - overflow: autoAdjustOverflow, - offset: [0, 4], - targetOffset: targetOffset - }, - bottomCenter: { - points: ['tc', 'bc'], - overflow: autoAdjustOverflow, - offset: [0, 4], - targetOffset: targetOffset - }, - bottomRight: { - points: ['tr', 'br'], - overflow: autoAdjustOverflow, - offset: [0, 4], - targetOffset: targetOffset - } -}; -var _default = placements; -exports.default = _default; -},{}],"LIX0":[function(require,module,exports) { -"use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = useAccessibility; +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); -var React = _interopRequireWildcard(require("react")); +var _warning = _interopRequireDefault(require("./warning")); -var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _raf = _interopRequireDefault(require("rc-util/es/raf")); +/** + * Deeply compares two object literals. + * @param obj1 object 1 + * @param obj2 object 2 + * @param shallow shallow compare + * @returns + */ +function isEqual(obj1, obj2) { + var shallow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; // https://github.com/mapbox/mapbox-gl-js/pull/5979/files#diff-fde7145050c47cc3a306856efd5f9c3016e86e859de9afbd02c879be5067e58f -var _focus = require("rc-util/es/Dom/focus"); + var refSet = new Set(); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function deepEqual(a, b) { + var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + var circular = refSet.has(a); + (0, _warning.default)(!circular, 'Warning: There may be circular references'); -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + if (circular) { + return false; + } -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + if (a === b) { + return true; + } -var ESC = _KeyCode.default.ESC, - TAB = _KeyCode.default.TAB; + if (shallow && level > 1) { + return false; + } -function useAccessibility(_ref) { - var visible = _ref.visible, - setTriggerVisible = _ref.setTriggerVisible, - triggerRef = _ref.triggerRef, - onVisibleChange = _ref.onVisibleChange, - autoFocus = _ref.autoFocus; - var focusMenuRef = React.useRef(false); + refSet.add(a); + var newLevel = level + 1; - var handleCloseMenuAndReturnFocus = function handleCloseMenuAndReturnFocus() { - if (visible && triggerRef.current) { - var _triggerRef$current, _triggerRef$current$t, _triggerRef$current$t2, _triggerRef$current$t3; + if (Array.isArray(a)) { + if (!Array.isArray(b) || a.length !== b.length) { + return false; + } - (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : (_triggerRef$current$t = _triggerRef$current.triggerRef) === null || _triggerRef$current$t === void 0 ? void 0 : (_triggerRef$current$t2 = _triggerRef$current$t.current) === null || _triggerRef$current$t2 === void 0 ? void 0 : (_triggerRef$current$t3 = _triggerRef$current$t2.focus) === null || _triggerRef$current$t3 === void 0 ? void 0 : _triggerRef$current$t3.call(_triggerRef$current$t2); - setTriggerVisible(false); - - if (typeof onVisibleChange === 'function') { - onVisibleChange(false); + for (var i = 0; i < a.length; i++) { + if (!deepEqual(a[i], b[i], newLevel)) { + return false; + } } + + return true; } - }; - var focusMenu = function focusMenu() { - var _triggerRef$current2, _triggerRef$current2$, _triggerRef$current2$2, _triggerRef$current2$3; + if (a && b && (0, _typeof2.default)(a) === 'object' && (0, _typeof2.default)(b) === 'object') { + var keys = Object.keys(a); - var elements = (0, _focus.getFocusNodeList)((_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : (_triggerRef$current2$ = _triggerRef$current2.popupRef) === null || _triggerRef$current2$ === void 0 ? void 0 : (_triggerRef$current2$2 = _triggerRef$current2$.current) === null || _triggerRef$current2$2 === void 0 ? void 0 : (_triggerRef$current2$3 = _triggerRef$current2$2.getElement) === null || _triggerRef$current2$3 === void 0 ? void 0 : _triggerRef$current2$3.call(_triggerRef$current2$2)); - var firstElement = elements[0]; + if (keys.length !== Object.keys(b).length) { + return false; + } + + return keys.every(function (key) { + return deepEqual(a[key], b[key], newLevel); + }); + } // other - if (firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus) { - firstElement.focus(); - focusMenuRef.current = true; - return true; - } return false; - }; + } - var handleKeyDown = function handleKeyDown(event) { - switch (event.keyCode) { - case ESC: - handleCloseMenuAndReturnFocus(); - break; + return deepEqual(obj1, obj2); +} - case TAB: - { - var focusResult = false; +var _default = isEqual; +exports.default = _default; +},{"@babel/runtime/helpers/esm/typeof":"xLw6","./warning":"orzV"}],"VB3D":[function(require,module,exports) { +"use strict"; - if (!focusMenuRef.current) { - focusResult = focusMenu(); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.IdContext = void 0; +exports.getMenuId = getMenuId; +exports.useMenuId = useMenuId; - if (focusResult) { - event.preventDefault(); - } else { - handleCloseMenuAndReturnFocus(); - } +var React = _interopRequireWildcard(require("react")); - break; - } - } - }; +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - React.useEffect(function () { - if (visible) { - window.addEventListener('keydown', handleKeyDown); +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - if (autoFocus) { - // FIXME: hack with raf - (0, _raf.default)(focusMenu, 3); - } +var IdContext = /*#__PURE__*/React.createContext(null); +exports.IdContext = IdContext; - return function () { - window.removeEventListener('keydown', handleKeyDown); - focusMenuRef.current = false; - }; - } +function getMenuId(uuid, eventKey) { + if (uuid === undefined) { + return null; + } - return function () { - focusMenuRef.current = false; - }; - }, [visible]); // eslint-disable-line react-hooks/exhaustive-deps + return "".concat(uuid, "-").concat(eventKey); +} +/** + * Get `data-menu-id` + */ + + +function useMenuId(eventKey) { + var id = React.useContext(IdContext); + return getMenuId(id, eventKey); } -},{"react":"n8MK","rc-util/es/KeyCode":"Imvn","rc-util/es/raf":"adDJ","rc-util/es/Dom/focus":"Dfmp"}],"WPA7":[function(require,module,exports) { +},{"react":"n8MK"}],"WRUc":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; +exports.MenuContext = void 0; +exports.default = InheritableContextProvider; -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); - -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); - var React = _interopRequireWildcard(require("react")); -var _rcTrigger = _interopRequireDefault(require("rc-trigger")); - -var _classnames = _interopRequireDefault(require("classnames")); - -var _placements = _interopRequireDefault(require("./placements")); +var _useMemo = _interopRequireDefault(require("rc-util/es/hooks/useMemo")); -var _useAccessibility = _interopRequireDefault(require("./hooks/useAccessibility")); +var _isEqual = _interopRequireDefault(require("rc-util/es/isEqual")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -15536,160 +15278,97 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _excluded = ["arrow", "prefixCls", "transitionName", "animation", "align", "placement", "placements", "getPopupContainer", "showAction", "hideAction", "overlayClassName", "overlayStyle", "visible", "trigger", "autoFocus"]; - -function Dropdown(props, ref) { - var _props$arrow = props.arrow, - arrow = _props$arrow === void 0 ? false : _props$arrow, - _props$prefixCls = props.prefixCls, - prefixCls = _props$prefixCls === void 0 ? 'rc-dropdown' : _props$prefixCls, - transitionName = props.transitionName, - animation = props.animation, - align = props.align, - _props$placement = props.placement, - placement = _props$placement === void 0 ? 'bottomLeft' : _props$placement, - _props$placements = props.placements, - placements = _props$placements === void 0 ? _placements.default : _props$placements, - getPopupContainer = props.getPopupContainer, - showAction = props.showAction, - hideAction = props.hideAction, - overlayClassName = props.overlayClassName, - overlayStyle = props.overlayStyle, - visible = props.visible, - _props$trigger = props.trigger, - trigger = _props$trigger === void 0 ? ['hover'] : _props$trigger, - autoFocus = props.autoFocus, - otherProps = (0, _objectWithoutProperties2.default)(props, _excluded); +var _excluded = ["children", "locked"]; +var MenuContext = /*#__PURE__*/React.createContext(null); +exports.MenuContext = MenuContext; - var _React$useState = React.useState(), - _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), - triggerVisible = _React$useState2[0], - setTriggerVisible = _React$useState2[1]; +function mergeProps(origin, target) { + var clone = (0, _objectSpread2.default)({}, origin); + Object.keys(target).forEach(function (key) { + var value = target[key]; - var mergedVisible = 'visible' in props ? visible : triggerVisible; - var triggerRef = React.useRef(null); - React.useImperativeHandle(ref, function () { - return triggerRef.current; + if (value !== undefined) { + clone[key] = value; + } }); - (0, _useAccessibility.default)({ - visible: mergedVisible, - setTriggerVisible: setTriggerVisible, - triggerRef: triggerRef, - onVisibleChange: props.onVisibleChange, - autoFocus: autoFocus + return clone; +} + +function InheritableContextProvider(_ref) { + var children = _ref.children, + locked = _ref.locked, + restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); + var context = React.useContext(MenuContext); + var inheritableContext = (0, _useMemo.default)(function () { + return mergeProps(context, restProps); + }, [context, restProps], function (prev, next) { + return !locked && (prev[0] !== next[0] || !(0, _isEqual.default)(prev[1], next[1], true)); }); + return /*#__PURE__*/React.createElement(MenuContext.Provider, { + value: inheritableContext + }, children); +} +},{"@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK","rc-util/es/hooks/useMemo":"YcSF","rc-util/es/isEqual":"n49D"}],"thAF":[function(require,module,exports) { +"use strict"; - var getOverlayElement = function getOverlayElement() { - var overlay = props.overlay; - var overlayElement; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PathUserContext = exports.PathTrackerContext = exports.PathRegisterContext = void 0; +exports.useFullPath = useFullPath; +exports.useMeasure = useMeasure; - if (typeof overlay === 'function') { - overlayElement = overlay(); - } else { - overlayElement = overlay; - } +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); - return overlayElement; - }; +var React = _interopRequireWildcard(require("react")); - var onClick = function onClick(e) { - var onOverlayClick = props.onOverlayClick; - setTriggerVisible(false); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - if (onOverlayClick) { - onOverlayClick(e); - } - }; +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - var onVisibleChange = function onVisibleChange(newVisible) { - var onVisibleChangeProp = props.onVisibleChange; - setTriggerVisible(newVisible); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - if (typeof onVisibleChangeProp === 'function') { - onVisibleChangeProp(newVisible); - } - }; +var EmptyList = []; // ========================= Path Register ========================= - var getMenuElement = function getMenuElement() { - var overlayElement = getOverlayElement(); - return /*#__PURE__*/React.createElement(React.Fragment, null, arrow && /*#__PURE__*/React.createElement("div", { - className: "".concat(prefixCls, "-arrow") - }), overlayElement); - }; +var PathRegisterContext = /*#__PURE__*/React.createContext(null); +exports.PathRegisterContext = PathRegisterContext; - var getMenuElementOrLambda = function getMenuElementOrLambda() { - var overlay = props.overlay; +function useMeasure() { + return React.useContext(PathRegisterContext); +} // ========================= Path Tracker ========================== - if (typeof overlay === 'function') { - return getMenuElement; - } - return getMenuElement(); - }; +var PathTrackerContext = /*#__PURE__*/React.createContext(EmptyList); +exports.PathTrackerContext = PathTrackerContext; - var getMinOverlayWidthMatchTrigger = function getMinOverlayWidthMatchTrigger() { - var minOverlayWidthMatchTrigger = props.minOverlayWidthMatchTrigger, - alignPoint = props.alignPoint; +function useFullPath(eventKey) { + var parentKeyPath = React.useContext(PathTrackerContext); + return React.useMemo(function () { + return eventKey !== undefined ? [].concat((0, _toConsumableArray2.default)(parentKeyPath), [eventKey]) : parentKeyPath; + }, [parentKeyPath, eventKey]); +} // =========================== Path User =========================== - if ('minOverlayWidthMatchTrigger' in props) { - return minOverlayWidthMatchTrigger; - } - return !alignPoint; - }; +var PathUserContext = /*#__PURE__*/React.createContext(null); +exports.PathUserContext = PathUserContext; +},{"@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","react":"n8MK"}],"V73O":[function(require,module,exports) { +"use strict"; - var getOpenClassName = function getOpenClassName() { - var openClassName = props.openClassName; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - if (openClassName !== undefined) { - return openClassName; - } +var React = _interopRequireWildcard(require("react")); - return "".concat(prefixCls, "-open"); - }; +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - var renderChildren = function renderChildren() { - var children = props.children; - var childrenProps = children.props ? children.props : {}; - var childClassName = (0, _classnames.default)(childrenProps.className, getOpenClassName()); - return mergedVisible && children ? /*#__PURE__*/React.cloneElement(children, { - className: childClassName - }) : children; - }; - - var triggerHideAction = hideAction; - - if (!triggerHideAction && trigger.indexOf('contextMenu') !== -1) { - triggerHideAction = ['click']; - } - - return /*#__PURE__*/React.createElement(_rcTrigger.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({ - builtinPlacements: placements - }, otherProps), {}, { - prefixCls: prefixCls, - ref: triggerRef, - popupClassName: (0, _classnames.default)(overlayClassName, (0, _defineProperty2.default)({}, "".concat(prefixCls, "-show-arrow"), arrow)), - popupStyle: overlayStyle, - action: trigger, - showAction: showAction, - hideAction: triggerHideAction || [], - popupPlacement: placement, - popupAlign: align, - popupTransitionName: transitionName, - popupAnimation: animation, - popupVisible: mergedVisible, - stretch: getMinOverlayWidthMatchTrigger() ? 'minWidth' : '', - popup: getMenuElementOrLambda(), - onPopupVisibleChange: onVisibleChange, - onPopupClick: onClick, - getPopupContainer: getPopupContainer - }), renderChildren()); -} - -var _default = /*#__PURE__*/React.forwardRef(Dropdown); +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var PrivateContext = /*#__PURE__*/React.createContext({}); +var _default = PrivateContext; exports.default = _default; -},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","rc-trigger":"PZMl","classnames":"qb7c","./placements":"K12W","./hooks/useAccessibility":"LIX0"}],"LcOg":[function(require,module,exports) { +},{"react":"n8MK"}],"lynM":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -15697,509 +15376,3236 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _Dropdown = _interopRequireDefault(require("./Dropdown")); +/** + * @ignore + * some key-codes definition and utils from closure-library + * @author yiminghe@gmail.com + */ +var KeyCode = { + /** + * MAC_ENTER + */ + MAC_ENTER: 3, -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * BACKSPACE + */ + BACKSPACE: 8, -var _default = _Dropdown.default; -exports.default = _default; -},{"./Dropdown":"WPA7"}],"kT7Q":[function(require,module,exports) { -"use strict"; + /** + * TAB + */ + TAB: 9, -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; + /** + * NUMLOCK on FF/Safari Mac + */ + NUM_CENTER: 12, + // NUMLOCK on FF/Safari Mac -var React = _interopRequireWildcard(require("react")); + /** + * ENTER + */ + ENTER: 13, -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + /** + * SHIFT + */ + SHIFT: 16, -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + /** + * CTRL + */ + CTRL: 17, -function AddButton(_ref, ref) { - var prefixCls = _ref.prefixCls, - editable = _ref.editable, - locale = _ref.locale, - style = _ref.style; + /** + * ALT + */ + ALT: 18, - if (!editable || editable.showAdd === false) { - return null; - } + /** + * PAUSE + */ + PAUSE: 19, - return /*#__PURE__*/React.createElement("button", { - ref: ref, - type: "button", - className: "".concat(prefixCls, "-nav-add"), - style: style, - "aria-label": (locale === null || locale === void 0 ? void 0 : locale.addAriaLabel) || 'Add tab', - onClick: function onClick(event) { - editable.onEdit('add', { - event: event - }); - } - }, editable.addIcon || '+'); -} + /** + * CAPS_LOCK + */ + CAPS_LOCK: 20, -var _default = /*#__PURE__*/React.forwardRef(AddButton); + /** + * ESC + */ + ESC: 27, -exports.default = _default; -},{"react":"n8MK"}],"MhTA":[function(require,module,exports) { -"use strict"; + /** + * SPACE + */ + SPACE: 32, -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; + /** + * PAGE_UP + */ + PAGE_UP: 33, + // also NUM_NORTH_EAST -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); + /** + * PAGE_DOWN + */ + PAGE_DOWN: 34, + // also NUM_SOUTH_EAST -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + /** + * END + */ + END: 35, + // also NUM_SOUTH_WEST -var React = _interopRequireWildcard(require("react")); + /** + * HOME + */ + HOME: 36, + // also NUM_NORTH_WEST -var _classnames = _interopRequireDefault(require("classnames")); + /** + * LEFT + */ + LEFT: 37, + // also NUM_WEST -var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); + /** + * UP + */ + UP: 38, + // also NUM_NORTH -var _rcMenu = _interopRequireWildcard(require("rc-menu")); + /** + * RIGHT + */ + RIGHT: 39, + // also NUM_EAST -var _rcDropdown = _interopRequireDefault(require("rc-dropdown")); + /** + * DOWN + */ + DOWN: 40, + // also NUM_SOUTH -var _AddButton = _interopRequireDefault(require("./AddButton")); + /** + * PRINT_SCREEN + */ + PRINT_SCREEN: 44, -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + /** + * INSERT + */ + INSERT: 45, + // also NUM_INSERT -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + /** + * DELETE + */ + DELETE: 46, + // also NUM_DELETE -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * ZERO + */ + ZERO: 48, -function OperationNode(_ref, ref) { - var prefixCls = _ref.prefixCls, - id = _ref.id, - tabs = _ref.tabs, - locale = _ref.locale, - mobile = _ref.mobile, - _ref$moreIcon = _ref.moreIcon, - moreIcon = _ref$moreIcon === void 0 ? 'More' : _ref$moreIcon, - moreTransitionName = _ref.moreTransitionName, - style = _ref.style, - className = _ref.className, - editable = _ref.editable, - tabBarGutter = _ref.tabBarGutter, - rtl = _ref.rtl, - removeAriaLabel = _ref.removeAriaLabel, - onTabClick = _ref.onTabClick, - getPopupContainer = _ref.getPopupContainer, - popupClassName = _ref.popupClassName; // ======================== Dropdown ======================== + /** + * ONE + */ + ONE: 49, - var _useState = (0, React.useState)(false), - _useState2 = (0, _slicedToArray2.default)(_useState, 2), - open = _useState2[0], - setOpen = _useState2[1]; + /** + * TWO + */ + TWO: 50, - var _useState3 = (0, React.useState)(null), - _useState4 = (0, _slicedToArray2.default)(_useState3, 2), - selectedKey = _useState4[0], - setSelectedKey = _useState4[1]; + /** + * THREE + */ + THREE: 51, - var popupId = "".concat(id, "-more-popup"); - var dropdownPrefix = "".concat(prefixCls, "-dropdown"); - var selectedItemId = selectedKey !== null ? "".concat(popupId, "-").concat(selectedKey) : null; - var dropdownAriaLabel = locale === null || locale === void 0 ? void 0 : locale.dropdownAriaLabel; + /** + * FOUR + */ + FOUR: 52, - function onRemoveTab(event, key) { - event.preventDefault(); - event.stopPropagation(); - editable.onEdit('remove', { - key: key, - event: event - }); - } + /** + * FIVE + */ + FIVE: 53, - var menu = /*#__PURE__*/React.createElement(_rcMenu.default, { - onClick: function onClick(_ref2) { - var key = _ref2.key, - domEvent = _ref2.domEvent; - onTabClick(key, domEvent); - setOpen(false); - }, - prefixCls: "".concat(dropdownPrefix, "-menu"), - id: popupId, - tabIndex: -1, - role: "listbox", - "aria-activedescendant": selectedItemId, - selectedKeys: [selectedKey], - "aria-label": dropdownAriaLabel !== undefined ? dropdownAriaLabel : 'expanded dropdown' - }, tabs.map(function (tab) { - var removable = editable && tab.closable !== false && !tab.disabled; - return /*#__PURE__*/React.createElement(_rcMenu.MenuItem, { - key: tab.key, - id: "".concat(popupId, "-").concat(tab.key), - role: "option", - "aria-controls": id && "".concat(id, "-panel-").concat(tab.key), - disabled: tab.disabled - }, /*#__PURE__*/React.createElement("span", null, tab.tab), removable && /*#__PURE__*/React.createElement("button", { - type: "button", - "aria-label": removeAriaLabel || 'remove', - tabIndex: 0, - className: "".concat(dropdownPrefix, "-menu-item-remove"), - onClick: function onClick(e) { - e.stopPropagation(); - onRemoveTab(e, tab.key); - } - }, tab.closeIcon || editable.removeIcon || '×')); - })); + /** + * SIX + */ + SIX: 54, - function selectOffset(offset) { - var enabledTabs = tabs.filter(function (tab) { - return !tab.disabled; - }); - var selectedIndex = enabledTabs.findIndex(function (tab) { - return tab.key === selectedKey; - }) || 0; - var len = enabledTabs.length; + /** + * SEVEN + */ + SEVEN: 55, - for (var i = 0; i < len; i += 1) { - selectedIndex = (selectedIndex + offset + len) % len; - var tab = enabledTabs[selectedIndex]; + /** + * EIGHT + */ + EIGHT: 56, - if (!tab.disabled) { - setSelectedKey(tab.key); - return; - } - } - } + /** + * NINE + */ + NINE: 57, - function onKeyDown(e) { - var which = e.which; + /** + * QUESTION_MARK + */ + QUESTION_MARK: 63, + // needs localization - if (!open) { - if ([_KeyCode.default.DOWN, _KeyCode.default.SPACE, _KeyCode.default.ENTER].includes(which)) { - setOpen(true); - e.preventDefault(); - } + /** + * A + */ + A: 65, - return; - } + /** + * B + */ + B: 66, - switch (which) { - case _KeyCode.default.UP: - selectOffset(-1); - e.preventDefault(); - break; + /** + * C + */ + C: 67, - case _KeyCode.default.DOWN: - selectOffset(1); - e.preventDefault(); - break; + /** + * D + */ + D: 68, - case _KeyCode.default.ESC: - setOpen(false); - break; + /** + * E + */ + E: 69, - case _KeyCode.default.SPACE: - case _KeyCode.default.ENTER: - if (selectedKey !== null) onTabClick(selectedKey, e); - break; - } - } // ========================= Effect ========================= + /** + * F + */ + F: 70, + /** + * G + */ + G: 71, - (0, React.useEffect)(function () { - // We use query element here to avoid React strict warning - var ele = document.getElementById(selectedItemId); + /** + * H + */ + H: 72, - if (ele && ele.scrollIntoView) { - ele.scrollIntoView(false); - } - }, [selectedKey]); - (0, React.useEffect)(function () { - if (!open) { - setSelectedKey(null); - } - }, [open]); // ========================= Render ========================= + /** + * I + */ + I: 73, - var moreStyle = (0, _defineProperty2.default)({}, rtl ? 'marginRight' : 'marginLeft', tabBarGutter); + /** + * J + */ + J: 74, - if (!tabs.length) { - moreStyle.visibility = 'hidden'; - moreStyle.order = 1; - } + /** + * K + */ + K: 75, - var overlayClassName = (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(dropdownPrefix, "-rtl"), rtl)); - var moreNode = mobile ? null : /*#__PURE__*/React.createElement(_rcDropdown.default, { - prefixCls: dropdownPrefix, - overlay: menu, - trigger: ['hover'], - visible: tabs.length ? open : false, - transitionName: moreTransitionName, - onVisibleChange: setOpen, - overlayClassName: (0, _classnames.default)(overlayClassName, popupClassName), - mouseEnterDelay: 0.1, - mouseLeaveDelay: 0.1, - getPopupContainer: getPopupContainer - }, /*#__PURE__*/React.createElement("button", { - type: "button", - className: "".concat(prefixCls, "-nav-more"), - style: moreStyle, - tabIndex: -1, - "aria-hidden": "true", - "aria-haspopup": "listbox", - "aria-controls": popupId, - id: "".concat(id, "-more"), - "aria-expanded": open, - onKeyDown: onKeyDown - }, moreIcon)); - return /*#__PURE__*/React.createElement("div", { - className: (0, _classnames.default)("".concat(prefixCls, "-nav-operations"), className), - style: style, - ref: ref - }, moreNode, /*#__PURE__*/React.createElement(_AddButton.default, { - prefixCls: prefixCls, - locale: locale, - editable: editable - })); -} + /** + * L + */ + L: 76, -var _default = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(OperationNode), function (_, next) { - return (// https://github.com/ant-design/ant-design/issues/32544 - // We'd better remove syntactic sugar in `rc-menu` since this has perf issue - next.tabMoving - ); -}); + /** + * M + */ + M: 77, -exports.default = _default; -},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","classnames":"qb7c","rc-util/es/KeyCode":"Imvn","rc-menu":"VH7R","rc-dropdown":"LcOg","./AddButton":"kT7Q"}],"vHWa":[function(require,module,exports) { -"use strict"; + /** + * N + */ + N: 78, -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; + /** + * O + */ + O: 79, -var _react = require("react"); + /** + * P + */ + P: 80, -var _default = /*#__PURE__*/(0, _react.createContext)(null); + /** + * Q + */ + Q: 81, -exports.default = _default; -},{"react":"n8MK"}],"MZjt":[function(require,module,exports) { -"use strict"; + /** + * R + */ + R: 82, -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = useTouchMove; + /** + * S + */ + S: 83, -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + /** + * T + */ + T: 84, -var React = _interopRequireWildcard(require("react")); + /** + * U + */ + U: 85, -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + /** + * V + */ + V: 86, -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + /** + * W + */ + W: 87, + + /** + * X + */ + X: 88, + + /** + * Y + */ + Y: 89, + + /** + * Z + */ + Z: 90, + + /** + * META + */ + META: 91, + // WIN_KEY_LEFT + + /** + * WIN_KEY_RIGHT + */ + WIN_KEY_RIGHT: 92, + + /** + * CONTEXT_MENU + */ + CONTEXT_MENU: 93, + + /** + * NUM_ZERO + */ + NUM_ZERO: 96, + + /** + * NUM_ONE + */ + NUM_ONE: 97, + + /** + * NUM_TWO + */ + NUM_TWO: 98, + + /** + * NUM_THREE + */ + NUM_THREE: 99, + + /** + * NUM_FOUR + */ + NUM_FOUR: 100, + + /** + * NUM_FIVE + */ + NUM_FIVE: 101, + + /** + * NUM_SIX + */ + NUM_SIX: 102, + + /** + * NUM_SEVEN + */ + NUM_SEVEN: 103, + + /** + * NUM_EIGHT + */ + NUM_EIGHT: 104, + + /** + * NUM_NINE + */ + NUM_NINE: 105, + + /** + * NUM_MULTIPLY + */ + NUM_MULTIPLY: 106, + + /** + * NUM_PLUS + */ + NUM_PLUS: 107, + + /** + * NUM_MINUS + */ + NUM_MINUS: 109, + + /** + * NUM_PERIOD + */ + NUM_PERIOD: 110, + + /** + * NUM_DIVISION + */ + NUM_DIVISION: 111, + + /** + * F1 + */ + F1: 112, + + /** + * F2 + */ + F2: 113, + + /** + * F3 + */ + F3: 114, + + /** + * F4 + */ + F4: 115, + + /** + * F5 + */ + F5: 116, + + /** + * F6 + */ + F6: 117, + + /** + * F7 + */ + F7: 118, + + /** + * F8 + */ + F8: 119, + + /** + * F9 + */ + F9: 120, + + /** + * F10 + */ + F10: 121, + + /** + * F11 + */ + F11: 122, + + /** + * F12 + */ + F12: 123, + + /** + * NUMLOCK + */ + NUMLOCK: 144, + + /** + * SEMICOLON + */ + SEMICOLON: 186, + // needs localization + + /** + * DASH + */ + DASH: 189, + // needs localization + + /** + * EQUALS + */ + EQUALS: 187, + // needs localization + + /** + * COMMA + */ + COMMA: 188, + // needs localization + + /** + * PERIOD + */ + PERIOD: 190, + // needs localization + + /** + * SLASH + */ + SLASH: 191, + // needs localization + + /** + * APOSTROPHE + */ + APOSTROPHE: 192, + // needs localization + + /** + * SINGLE_QUOTE + */ + SINGLE_QUOTE: 222, + // needs localization + + /** + * OPEN_SQUARE_BRACKET + */ + OPEN_SQUARE_BRACKET: 219, + // needs localization + + /** + * BACKSLASH + */ + BACKSLASH: 220, + // needs localization + + /** + * CLOSE_SQUARE_BRACKET + */ + CLOSE_SQUARE_BRACKET: 221, + // needs localization + + /** + * WIN_KEY + */ + WIN_KEY: 224, + + /** + * MAC_FF_META + */ + MAC_FF_META: 224, + // Firefox (Gecko) fires this for the meta key instead of 91 + + /** + * WIN_IME + */ + WIN_IME: 229, + // ======================== Function ======================== + + /** + * whether text and modified key is entered at the same time. + */ + isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) { + var keyCode = e.keyCode; + + if (e.altKey && !e.ctrlKey || e.metaKey || // Function keys don't generate text + keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { + return false; + } // The following keys are quite harmless, even in combination with + // CTRL, ALT or SHIFT. + + + switch (keyCode) { + case KeyCode.ALT: + case KeyCode.CAPS_LOCK: + case KeyCode.CONTEXT_MENU: + case KeyCode.CTRL: + case KeyCode.DOWN: + case KeyCode.END: + case KeyCode.ESC: + case KeyCode.HOME: + case KeyCode.INSERT: + case KeyCode.LEFT: + case KeyCode.MAC_FF_META: + case KeyCode.META: + case KeyCode.NUMLOCK: + case KeyCode.NUM_CENTER: + case KeyCode.PAGE_DOWN: + case KeyCode.PAGE_UP: + case KeyCode.PAUSE: + case KeyCode.PRINT_SCREEN: + case KeyCode.RIGHT: + case KeyCode.SHIFT: + case KeyCode.UP: + case KeyCode.WIN_KEY: + case KeyCode.WIN_KEY_RIGHT: + return false; + + default: + return true; + } + }, + + /** + * whether character is entered. + */ + isCharacterKey: function isCharacterKey(keyCode) { + if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { + return true; + } + + if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { + return true; + } + + if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { + return true; + } // Safari sends zero key code for non-latin characters. + + + if (window.navigator.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { + return true; + } + + switch (keyCode) { + case KeyCode.SPACE: + case KeyCode.QUESTION_MARK: + case KeyCode.NUM_PLUS: + case KeyCode.NUM_MINUS: + case KeyCode.NUM_PERIOD: + case KeyCode.NUM_DIVISION: + case KeyCode.SEMICOLON: + case KeyCode.DASH: + case KeyCode.EQUALS: + case KeyCode.COMMA: + case KeyCode.PERIOD: + case KeyCode.SLASH: + case KeyCode.APOSTROPHE: + case KeyCode.SINGLE_QUOTE: + case KeyCode.OPEN_SQUARE_BRACKET: + case KeyCode.BACKSLASH: + case KeyCode.CLOSE_SQUARE_BRACKET: + return true; + + default: + return false; + } + } +}; +var _default = KeyCode; +exports.default = _default; +},{}],"VGD3":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _default = function _default(element) { + if (!element) { + return false; + } + + if (element instanceof Element) { + if (element.offsetParent) { + return true; + } + + if (element.getBBox) { + var _getBBox = element.getBBox(), + width = _getBBox.width, + height = _getBBox.height; + + if (width || height) { + return true; + } + } + + if (element.getBoundingClientRect) { + var _element$getBoundingC = element.getBoundingClientRect(), + _width = _element$getBoundingC.width, + _height = _element$getBoundingC.height; + + if (_width || _height) { + return true; + } + } + } + + return false; +}; + +exports.default = _default; +},{}],"sObw":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.backLastFocusNode = backLastFocusNode; +exports.clearLastFocusNode = clearLastFocusNode; +exports.getFocusNodeList = getFocusNodeList; +exports.limitTabRange = limitTabRange; +exports.saveLastFocusNode = saveLastFocusNode; + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); + +var _isVisible = _interopRequireDefault(require("./isVisible")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function focusable(node) { + var includePositive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if ((0, _isVisible.default)(node)) { + var nodeName = node.nodeName.toLowerCase(); + var isFocusableElement = // Focusable element + ['input', 'select', 'textarea', 'button'].includes(nodeName) || // Editable element + node.isContentEditable || // Anchor with href element + nodeName === 'a' && !!node.getAttribute('href'); // Get tabIndex + + var tabIndexAttr = node.getAttribute('tabindex'); + var tabIndexNum = Number(tabIndexAttr); // Parse as number if validate + + var tabIndex = null; + + if (tabIndexAttr && !Number.isNaN(tabIndexNum)) { + tabIndex = tabIndexNum; + } else if (isFocusableElement && tabIndex === null) { + tabIndex = 0; + } // Block focusable if disabled + + + if (isFocusableElement && node.disabled) { + tabIndex = null; + } + + return tabIndex !== null && (tabIndex >= 0 || includePositive && tabIndex < 0); + } + + return false; +} + +function getFocusNodeList(node) { + var includePositive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var res = (0, _toConsumableArray2.default)(node.querySelectorAll('*')).filter(function (child) { + return focusable(child, includePositive); + }); + + if (focusable(node, includePositive)) { + res.unshift(node); + } + + return res; +} + +var lastFocusElement = null; +/** @deprecated Do not use since this may failed when used in async */ + +function saveLastFocusNode() { + lastFocusElement = document.activeElement; +} +/** @deprecated Do not use since this may failed when used in async */ + + +function clearLastFocusNode() { + lastFocusElement = null; +} +/** @deprecated Do not use since this may failed when used in async */ + + +function backLastFocusNode() { + if (lastFocusElement) { + try { + // 元素可能已经被移动了 + lastFocusElement.focus(); + /* eslint-disable no-empty */ + } catch (e) {// empty + } + /* eslint-enable no-empty */ + + } +} + +function limitTabRange(node, e) { + if (e.keyCode === 9) { + var tabNodeList = getFocusNodeList(node); + var lastTabNode = tabNodeList[e.shiftKey ? 0 : tabNodeList.length - 1]; + var leavingTab = lastTabNode === document.activeElement || node === document.activeElement; + + if (leavingTab) { + var target = tabNodeList[e.shiftKey ? tabNodeList.length - 1 : 0]; + target.focus(); + e.preventDefault(); + } + } +} +},{"@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","./isVisible":"VGD3"}],"g0Ae":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = useAccessibility; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); + +var React = _interopRequireWildcard(require("react")); + +var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); + +var _raf = _interopRequireDefault(require("rc-util/es/raf")); + +var _focus = require("rc-util/es/Dom/focus"); + +var _IdContext = require("../context/IdContext"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// destruct to reduce minify size +var LEFT = _KeyCode.default.LEFT, + RIGHT = _KeyCode.default.RIGHT, + UP = _KeyCode.default.UP, + DOWN = _KeyCode.default.DOWN, + ENTER = _KeyCode.default.ENTER, + ESC = _KeyCode.default.ESC, + HOME = _KeyCode.default.HOME, + END = _KeyCode.default.END; +var ArrowKeys = [UP, DOWN, LEFT, RIGHT]; + +function getOffset(mode, isRootLevel, isRtl, which) { + var _inline, _horizontal, _vertical, _offsets; + + var prev = 'prev'; + var next = 'next'; + var children = 'children'; + var parent = 'parent'; // Inline enter is special that we use unique operation + + if (mode === 'inline' && which === ENTER) { + return { + inlineTrigger: true + }; + } + + var inline = (_inline = {}, (0, _defineProperty2.default)(_inline, UP, prev), (0, _defineProperty2.default)(_inline, DOWN, next), _inline); + var horizontal = (_horizontal = {}, (0, _defineProperty2.default)(_horizontal, LEFT, isRtl ? next : prev), (0, _defineProperty2.default)(_horizontal, RIGHT, isRtl ? prev : next), (0, _defineProperty2.default)(_horizontal, DOWN, children), (0, _defineProperty2.default)(_horizontal, ENTER, children), _horizontal); + var vertical = (_vertical = {}, (0, _defineProperty2.default)(_vertical, UP, prev), (0, _defineProperty2.default)(_vertical, DOWN, next), (0, _defineProperty2.default)(_vertical, ENTER, children), (0, _defineProperty2.default)(_vertical, ESC, parent), (0, _defineProperty2.default)(_vertical, LEFT, isRtl ? children : parent), (0, _defineProperty2.default)(_vertical, RIGHT, isRtl ? parent : children), _vertical); + var offsets = { + inline: inline, + horizontal: horizontal, + vertical: vertical, + inlineSub: inline, + horizontalSub: vertical, + verticalSub: vertical + }; + var type = (_offsets = offsets["".concat(mode).concat(isRootLevel ? '' : 'Sub')]) === null || _offsets === void 0 ? void 0 : _offsets[which]; + + switch (type) { + case prev: + return { + offset: -1, + sibling: true + }; + + case next: + return { + offset: 1, + sibling: true + }; + + case parent: + return { + offset: -1, + sibling: false + }; + + case children: + return { + offset: 1, + sibling: false + }; + + default: + return null; + } +} + +function findContainerUL(element) { + var current = element; + + while (current) { + if (current.getAttribute('data-menu-list')) { + return current; + } + + current = current.parentElement; + } // Normally should not reach this line + + /* istanbul ignore next */ + + + return null; +} +/** + * Find focused element within element set provided + */ + + +function getFocusElement(activeElement, elements) { + var current = activeElement || document.activeElement; + + while (current) { + if (elements.has(current)) { + return current; + } + + current = current.parentElement; + } + + return null; +} +/** + * Get focusable elements from the element set under provided container + */ + + +function getFocusableElements(container, elements) { + var list = (0, _focus.getFocusNodeList)(container, true); + return list.filter(function (ele) { + return elements.has(ele); + }); +} + +function getNextFocusElement(parentQueryContainer, elements, focusMenuElement) { + var offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; // Key on the menu item will not get validate parent container + + if (!parentQueryContainer) { + return null; + } // List current level menu item elements + + + var sameLevelFocusableMenuElementList = getFocusableElements(parentQueryContainer, elements); // Find next focus index + + var count = sameLevelFocusableMenuElementList.length; + var focusIndex = sameLevelFocusableMenuElementList.findIndex(function (ele) { + return focusMenuElement === ele; + }); + + if (offset < 0) { + if (focusIndex === -1) { + focusIndex = count - 1; + } else { + focusIndex -= 1; + } + } else if (offset > 0) { + focusIndex += 1; + } + + focusIndex = (focusIndex + count) % count; // Focus menu item + + return sameLevelFocusableMenuElementList[focusIndex]; +} + +function useAccessibility(mode, activeKey, isRtl, id, containerRef, getKeys, getKeyPath, triggerActiveKey, triggerAccessibilityOpen, originOnKeyDown) { + var rafRef = React.useRef(); + var activeRef = React.useRef(); + activeRef.current = activeKey; + + var cleanRaf = function cleanRaf() { + _raf.default.cancel(rafRef.current); + }; + + React.useEffect(function () { + return function () { + cleanRaf(); + }; + }, []); + return function (e) { + var which = e.which; + + if ([].concat(ArrowKeys, [ENTER, ESC, HOME, END]).includes(which)) { + // Convert key to elements + var elements; + var key2element; + var element2key; // >>> Wrap as function since we use raf for some case + + var refreshElements = function refreshElements() { + elements = new Set(); + key2element = new Map(); + element2key = new Map(); + var keys = getKeys(); + keys.forEach(function (key) { + var element = document.querySelector("[data-menu-id='".concat((0, _IdContext.getMenuId)(id, key), "']")); + + if (element) { + elements.add(element); + element2key.set(element, key); + key2element.set(key, element); + } + }); + return elements; + }; + + refreshElements(); // First we should find current focused MenuItem/SubMenu element + + var activeElement = key2element.get(activeKey); + var focusMenuElement = getFocusElement(activeElement, elements); + var focusMenuKey = element2key.get(focusMenuElement); + var offsetObj = getOffset(mode, getKeyPath(focusMenuKey, true).length === 1, isRtl, which); // Some mode do not have fully arrow operation like inline + + if (!offsetObj && which !== HOME && which !== END) { + return; + } // Arrow prevent default to avoid page scroll + + + if (ArrowKeys.includes(which) || [HOME, END].includes(which)) { + e.preventDefault(); + } + + var tryFocus = function tryFocus(menuElement) { + if (menuElement) { + var focusTargetElement = menuElement; // Focus to link instead of menu item if possible + + var link = menuElement.querySelector('a'); + + if (link !== null && link !== void 0 && link.getAttribute('href')) { + focusTargetElement = link; + } + + var targetKey = element2key.get(menuElement); + triggerActiveKey(targetKey); + /** + * Do not `useEffect` here since `tryFocus` may trigger async + * which makes React sync update the `activeKey` + * that force render before `useRef` set the next activeKey + */ + + cleanRaf(); + rafRef.current = (0, _raf.default)(function () { + if (activeRef.current === targetKey) { + focusTargetElement.focus(); + } + }); + } + }; + + if ([HOME, END].includes(which) || offsetObj.sibling || !focusMenuElement) { + // ========================== Sibling ========================== + // Find walkable focus menu element container + var parentQueryContainer; + + if (!focusMenuElement || mode === 'inline') { + parentQueryContainer = containerRef.current; + } else { + parentQueryContainer = findContainerUL(focusMenuElement); + } // Get next focus element + + + var targetElement; + var focusableElements = getFocusableElements(parentQueryContainer, elements); + + if (which === HOME) { + targetElement = focusableElements[0]; + } else if (which === END) { + targetElement = focusableElements[focusableElements.length - 1]; + } else { + targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset); + } // Focus menu item + + + tryFocus(targetElement); // ======================= InlineTrigger ======================= + } else if (offsetObj.inlineTrigger) { + // Inline trigger no need switch to sub menu item + triggerAccessibilityOpen(focusMenuKey); // =========================== Level =========================== + } else if (offsetObj.offset > 0) { + triggerAccessibilityOpen(focusMenuKey, true); + cleanRaf(); + rafRef.current = (0, _raf.default)(function () { + // Async should resync elements + refreshElements(); + var controlId = focusMenuElement.getAttribute('aria-controls'); + var subQueryContainer = document.getElementById(controlId); // Get sub focusable menu item + + var targetElement = getNextFocusElement(subQueryContainer, elements); // Focus menu item + + tryFocus(targetElement); + }, 5); + } else if (offsetObj.offset < 0) { + var keyPath = getKeyPath(focusMenuKey, true); + var parentKey = keyPath[keyPath.length - 2]; + var parentMenuElement = key2element.get(parentKey); // Focus menu item + + triggerAccessibilityOpen(parentKey, false); + tryFocus(parentMenuElement); + } + } // Pass origin key down event + + + originOnKeyDown === null || originOnKeyDown === void 0 ? void 0 : originOnKeyDown(e); + }; +} +},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","react":"n8MK","rc-util/es/KeyCode":"lynM","rc-util/es/raf":"dtu8","rc-util/es/Dom/focus":"sObw","../context/IdContext":"VB3D"}],"sR1M":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.nextSlice = nextSlice; + +function nextSlice(callback) { + /* istanbul ignore next */ + Promise.resolve().then(callback); +} +},{}],"FDUp":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.OVERFLOW_KEY = void 0; +exports.default = useKeyRecords; + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + +var React = _interopRequireWildcard(require("react")); + +var _warning = _interopRequireDefault(require("rc-util/es/warning")); + +var _timeUtil = require("../utils/timeUtil"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var PATH_SPLIT = '__RC_UTIL_PATH_SPLIT__'; + +var getPathStr = function getPathStr(keyPath) { + return keyPath.join(PATH_SPLIT); +}; + +var getPathKeys = function getPathKeys(keyPathStr) { + return keyPathStr.split(PATH_SPLIT); +}; + +var OVERFLOW_KEY = 'rc-menu-more'; +exports.OVERFLOW_KEY = OVERFLOW_KEY; + +function useKeyRecords() { + var _React$useState = React.useState({}), + _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), + internalForceUpdate = _React$useState2[1]; + + var key2pathRef = (0, React.useRef)(new Map()); + var path2keyRef = (0, React.useRef)(new Map()); + + var _React$useState3 = React.useState([]), + _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2), + overflowKeys = _React$useState4[0], + setOverflowKeys = _React$useState4[1]; + + var updateRef = (0, React.useRef)(0); + var destroyRef = (0, React.useRef)(false); + + var forceUpdate = function forceUpdate() { + if (!destroyRef.current) { + internalForceUpdate({}); + } + }; + + var registerPath = (0, React.useCallback)(function (key, keyPath) { + // Warning for invalidate or duplicated `key` + if ("production" !== 'production') { + (0, _warning.default)(!key2pathRef.current.has(key), "Duplicated key '".concat(key, "' used in Menu by path [").concat(keyPath.join(' > '), "]")); + } // Fill map + + + var connectedPath = getPathStr(keyPath); + path2keyRef.current.set(connectedPath, key); + key2pathRef.current.set(key, connectedPath); + updateRef.current += 1; + var id = updateRef.current; + (0, _timeUtil.nextSlice)(function () { + if (id === updateRef.current) { + forceUpdate(); + } + }); + }, []); + var unregisterPath = (0, React.useCallback)(function (key, keyPath) { + var connectedPath = getPathStr(keyPath); + path2keyRef.current.delete(connectedPath); + key2pathRef.current.delete(key); + }, []); + var refreshOverflowKeys = (0, React.useCallback)(function (keys) { + setOverflowKeys(keys); + }, []); + var getKeyPath = (0, React.useCallback)(function (eventKey, includeOverflow) { + var fullPath = key2pathRef.current.get(eventKey) || ''; + var keys = getPathKeys(fullPath); + + if (includeOverflow && overflowKeys.includes(keys[0])) { + keys.unshift(OVERFLOW_KEY); + } + + return keys; + }, [overflowKeys]); + var isSubPathKey = (0, React.useCallback)(function (pathKeys, eventKey) { + return pathKeys.some(function (pathKey) { + var pathKeyList = getKeyPath(pathKey, true); + return pathKeyList.includes(eventKey); + }); + }, [getKeyPath]); + + var getKeys = function getKeys() { + var keys = (0, _toConsumableArray2.default)(key2pathRef.current.keys()); + + if (overflowKeys.length) { + keys.push(OVERFLOW_KEY); + } + + return keys; + }; + /** + * Find current key related child path keys + */ + + + var getSubPathKeys = (0, React.useCallback)(function (key) { + var connectedPath = "".concat(key2pathRef.current.get(key)).concat(PATH_SPLIT); + var pathKeys = new Set(); + (0, _toConsumableArray2.default)(path2keyRef.current.keys()).forEach(function (pathKey) { + if (pathKey.startsWith(connectedPath)) { + pathKeys.add(path2keyRef.current.get(pathKey)); + } + }); + return pathKeys; + }, []); + React.useEffect(function () { + return function () { + destroyRef.current = true; + }; + }, []); + return { + // Register + registerPath: registerPath, + unregisterPath: unregisterPath, + refreshOverflowKeys: refreshOverflowKeys, + // Util + isSubPathKey: isSubPathKey, + getKeyPath: getKeyPath, + getKeys: getKeys, + getSubPathKeys: getSubPathKeys + }; +} +},{"@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/warning":"orzV","../utils/timeUtil":"sR1M"}],"vAIo":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = useMemoCallback; + +var React = _interopRequireWildcard(require("react")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +/** + * Cache callback function that always return same ref instead. + * This is used for context optimization. + */ +function useMemoCallback(func) { + var funRef = React.useRef(func); + funRef.current = func; + var callback = React.useCallback(function () { + var _funRef$current; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return (_funRef$current = funRef.current) === null || _funRef$current === void 0 ? void 0 : _funRef$current.call.apply(_funRef$current, [funRef].concat(args)); + }, []); + return func ? callback : undefined; +} +},{"react":"n8MK"}],"nOjm":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = useUUID; + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + +var React = _interopRequireWildcard(require("react")); + +var _useMergedState3 = _interopRequireDefault(require("rc-util/es/hooks/useMergedState")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var uniquePrefix = Math.random().toFixed(5).toString().slice(2); +var internalId = 0; + +function useUUID(id) { + var _useMergedState = (0, _useMergedState3.default)(id, { + value: id + }), + _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2), + uuid = _useMergedState2[0], + setUUID = _useMergedState2[1]; + + React.useEffect(function () { + internalId += 1; + var newId = "production" === 'test' ? 'test' : "".concat(uniquePrefix, "-").concat(internalId); + setUUID("rc-menu-uuid-".concat(newId)); + }, []); + return uuid; +} +},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-util/es/hooks/useMergedState":"UovL"}],"FTix":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = omit; + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function omit(obj, fields) { + var clone = (0, _objectSpread2.default)({}, obj); + + if (Array.isArray(fields)) { + fields.forEach(function (key) { + delete clone[key]; + }); + } + + return clone; +} +},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT"}],"aD5v":[function(require,module,exports) { +'use strict'; + +if ("production" === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} +},{"./cjs/react-is.production.min.js":"XbWx"}],"cFFP":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.composeRef = composeRef; +exports.fillRef = fillRef; +exports.supportNodeRef = supportNodeRef; +exports.supportRef = supportRef; +exports.useComposeRef = useComposeRef; + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); + +var _react = require("react"); + +var _reactIs = require("react-is"); + +var _useMemo = _interopRequireDefault(require("./hooks/useMemo")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* eslint-disable no-param-reassign */ +function fillRef(ref, node) { + if (typeof ref === 'function') { + ref(node); + } else if ((0, _typeof2.default)(ref) === 'object' && ref && 'current' in ref) { + ref.current = node; + } +} +/** + * Merge refs into one ref function to support ref passing. + */ + + +function composeRef() { + for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { + refs[_key] = arguments[_key]; + } + + var refList = refs.filter(function (ref) { + return ref; + }); + + if (refList.length <= 1) { + return refList[0]; + } + + return function (node) { + refs.forEach(function (ref) { + fillRef(ref, node); + }); + }; +} + +function useComposeRef() { + for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + refs[_key2] = arguments[_key2]; + } + + return (0, _useMemo.default)(function () { + return composeRef.apply(void 0, refs); + }, refs, function (prev, next) { + return prev.length !== next.length || prev.every(function (ref, i) { + return ref !== next[i]; + }); + }); +} + +function supportRef(nodeOrComponent) { + var _type$prototype, _nodeOrComponent$prot; + + var type = (0, _reactIs.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type; // Function component node + + if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== _reactIs.ForwardRef) { + return false; + } // Class component + + + if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== _reactIs.ForwardRef) { + return false; + } + + return true; +} + +function supportNodeRef(node) { + if (! /*#__PURE__*/(0, _react.isValidElement)(node)) { + return false; + } + + if ((0, _reactIs.isFragment)(node)) { + return false; + } + + return supportRef(node); +} +/* eslint-enable */ +},{"@babel/runtime/helpers/esm/typeof":"xLw6","react":"n8MK","react-is":"aD5v","./hooks/useMemo":"YcSF"}],"LQKT":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = useActive; + +var React = _interopRequireWildcard(require("react")); + +var _MenuContext = require("../context/MenuContext"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function useActive(eventKey, disabled, onMouseEnter, onMouseLeave) { + var _React$useContext = React.useContext(_MenuContext.MenuContext), + activeKey = _React$useContext.activeKey, + onActive = _React$useContext.onActive, + onInactive = _React$useContext.onInactive; + + var ret = { + active: activeKey === eventKey + }; // Skip when disabled + + if (!disabled) { + ret.onMouseEnter = function (domEvent) { + onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter({ + key: eventKey, + domEvent: domEvent + }); + onActive(eventKey); + }; + + ret.onMouseLeave = function (domEvent) { + onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({ + key: eventKey, + domEvent: domEvent + }); + onInactive(eventKey); + }; + } + + return ret; +} +},{"react":"n8MK","../context/MenuContext":"WRUc"}],"Pnmu":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = useDirectionStyle; + +var React = _interopRequireWildcard(require("react")); + +var _MenuContext = require("../context/MenuContext"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function useDirectionStyle(level) { + var _React$useContext = React.useContext(_MenuContext.MenuContext), + mode = _React$useContext.mode, + rtl = _React$useContext.rtl, + inlineIndent = _React$useContext.inlineIndent; + + if (mode !== 'inline') { + return null; + } + + var len = level; + return rtl ? { + paddingRight: len * inlineIndent + } : { + paddingLeft: len * inlineIndent + }; +} +},{"react":"n8MK","../context/MenuContext":"WRUc"}],"E0zE":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = Icon; + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + +var React = _interopRequireWildcard(require("react")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function Icon(_ref) { + var icon = _ref.icon, + props = _ref.props, + children = _ref.children; + var iconNode; + + if (typeof icon === 'function') { + iconNode = /*#__PURE__*/React.createElement(icon, (0, _objectSpread2.default)({}, props)); + } else { + // Compatible for origin definition + iconNode = icon; + } + + return iconNode || children || null; +} +},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK"}],"cvmo":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.warnItemProp = warnItemProp; + +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + +var _warning = _interopRequireDefault(require("rc-util/es/warning")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _excluded = ["item"]; + +/** + * `onClick` event return `info.item` which point to react node directly. + * We should warning this since it will not work on FC. + */ +function warnItemProp(_ref) { + var item = _ref.item, + restInfo = (0, _objectWithoutProperties2.default)(_ref, _excluded); + Object.defineProperty(restInfo, 'item', { + get: function get() { + (0, _warning.default)(false, '`info.item` is deprecated since we will move to function component that not provides React Node instance in future.'); + return item; + } + }); + return restInfo; +} +},{"@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","rc-util/es/warning":"orzV"}],"NeBp":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + +var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck")); + +var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass")); + +var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inherits")); + +var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createSuper")); + +var _classnames = _interopRequireDefault(require("classnames")); + +var _rcOverflow = _interopRequireDefault(require("rc-overflow")); + +var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); + +var _omit = _interopRequireDefault(require("rc-util/es/omit")); + +var _ref = require("rc-util/es/ref"); + +var _warning = _interopRequireDefault(require("rc-util/es/warning")); + +var React = _interopRequireWildcard(require("react")); + +var _IdContext = require("./context/IdContext"); + +var _MenuContext = require("./context/MenuContext"); + +var _PathContext = require("./context/PathContext"); + +var _PrivateContext = _interopRequireDefault(require("./context/PrivateContext")); + +var _useActive2 = _interopRequireDefault(require("./hooks/useActive")); + +var _useDirectionStyle = _interopRequireDefault(require("./hooks/useDirectionStyle")); + +var _Icon = _interopRequireDefault(require("./Icon")); + +var _warnUtil = require("./utils/warnUtil"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _excluded = ["title", "attribute", "elementRef"], + _excluded2 = ["style", "className", "eventKey", "warnKey", "disabled", "itemIcon", "children", "role", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "onFocus"], + _excluded3 = ["active"]; + +// Since Menu event provide the `info.item` which point to the MenuItem node instance. +// We have to use class component here. +// This should be removed from doc & api in future. +var LegacyMenuItem = /*#__PURE__*/function (_React$Component) { + (0, _inherits2.default)(LegacyMenuItem, _React$Component); + + var _super = (0, _createSuper2.default)(LegacyMenuItem); + + function LegacyMenuItem() { + (0, _classCallCheck2.default)(this, LegacyMenuItem); + return _super.apply(this, arguments); + } + + (0, _createClass2.default)(LegacyMenuItem, [{ + key: "render", + value: function render() { + var _this$props = this.props, + title = _this$props.title, + attribute = _this$props.attribute, + elementRef = _this$props.elementRef, + restProps = (0, _objectWithoutProperties2.default)(_this$props, _excluded); // Here the props are eventually passed to the DOM element. + // React does not recognize non-standard attributes. + // Therefore, remove the props that is not used here. + // ref: https://github.com/ant-design/ant-design/issues/41395 + + var passedProps = (0, _omit.default)(restProps, ['eventKey', 'popupClassName', 'popupOffset', 'onTitleClick']); + (0, _warning.default)(!attribute, '`attribute` of Menu.Item is deprecated. Please pass attribute directly.'); + return /*#__PURE__*/React.createElement(_rcOverflow.default.Item, (0, _extends2.default)({}, attribute, { + title: typeof title === 'string' ? title : undefined + }, passedProps, { + ref: elementRef + })); + } + }]); + return LegacyMenuItem; +}(React.Component); +/** + * Real Menu Item component + */ + + +var InternalMenuItem = /*#__PURE__*/React.forwardRef(function (props, ref) { + var _classNames; + + var style = props.style, + className = props.className, + eventKey = props.eventKey, + warnKey = props.warnKey, + disabled = props.disabled, + itemIcon = props.itemIcon, + children = props.children, + role = props.role, + onMouseEnter = props.onMouseEnter, + onMouseLeave = props.onMouseLeave, + onClick = props.onClick, + onKeyDown = props.onKeyDown, + onFocus = props.onFocus, + restProps = (0, _objectWithoutProperties2.default)(props, _excluded2); + var domDataId = (0, _IdContext.useMenuId)(eventKey); + + var _React$useContext = React.useContext(_MenuContext.MenuContext), + prefixCls = _React$useContext.prefixCls, + onItemClick = _React$useContext.onItemClick, + contextDisabled = _React$useContext.disabled, + overflowDisabled = _React$useContext.overflowDisabled, + contextItemIcon = _React$useContext.itemIcon, + selectedKeys = _React$useContext.selectedKeys, + onActive = _React$useContext.onActive; + + var _React$useContext2 = React.useContext(_PrivateContext.default), + _internalRenderMenuItem = _React$useContext2._internalRenderMenuItem; + + var itemCls = "".concat(prefixCls, "-item"); + var legacyMenuItemRef = React.useRef(); + var elementRef = React.useRef(); + var mergedDisabled = contextDisabled || disabled; + var mergedEleRef = (0, _ref.useComposeRef)(ref, elementRef); + var connectedKeys = (0, _PathContext.useFullPath)(eventKey); // ================================ Warn ================================ + + if ("production" !== 'production' && warnKey) { + (0, _warning.default)(false, 'MenuItem should not leave undefined `key`.'); + } // ============================= Info ============================= + + + var getEventInfo = function getEventInfo(e) { + return { + key: eventKey, + // Note: For legacy code is reversed which not like other antd component + keyPath: (0, _toConsumableArray2.default)(connectedKeys).reverse(), + item: legacyMenuItemRef.current, + domEvent: e + }; + }; // ============================= Icon ============================= + + + var mergedItemIcon = itemIcon || contextItemIcon; // ============================ Active ============================ + + var _useActive = (0, _useActive2.default)(eventKey, mergedDisabled, onMouseEnter, onMouseLeave), + active = _useActive.active, + activeProps = (0, _objectWithoutProperties2.default)(_useActive, _excluded3); // ============================ Select ============================ + + + var selected = selectedKeys.includes(eventKey); // ======================== DirectionStyle ======================== + + var directionStyle = (0, _useDirectionStyle.default)(connectedKeys.length); // ============================ Events ============================ + + var onInternalClick = function onInternalClick(e) { + if (mergedDisabled) { + return; + } + + var info = getEventInfo(e); + onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); + onItemClick(info); + }; + + var onInternalKeyDown = function onInternalKeyDown(e) { + onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e); + + if (e.which === _KeyCode.default.ENTER) { + var info = getEventInfo(e); // Legacy. Key will also trigger click event + + onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); + onItemClick(info); + } + }; + /** + * Used for accessibility. Helper will focus element without key board. + * We should manually trigger an active + */ + + + var onInternalFocus = function onInternalFocus(e) { + onActive(eventKey); + onFocus === null || onFocus === void 0 ? void 0 : onFocus(e); + }; // ============================ Render ============================ + + + var optionRoleProps = {}; + + if (props.role === 'option') { + optionRoleProps['aria-selected'] = selected; + } + + var renderNode = /*#__PURE__*/React.createElement(LegacyMenuItem, (0, _extends2.default)({ + ref: legacyMenuItemRef, + elementRef: mergedEleRef, + role: role === null ? 'none' : role || 'menuitem', + tabIndex: disabled ? null : -1, + "data-menu-id": overflowDisabled && domDataId ? null : domDataId + }, restProps, activeProps, optionRoleProps, { + component: "li", + "aria-disabled": disabled, + style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, directionStyle), style), + className: (0, _classnames.default)(itemCls, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(itemCls, "-active"), active), (0, _defineProperty2.default)(_classNames, "".concat(itemCls, "-selected"), selected), (0, _defineProperty2.default)(_classNames, "".concat(itemCls, "-disabled"), mergedDisabled), _classNames), className), + onClick: onInternalClick, + onKeyDown: onInternalKeyDown, + onFocus: onInternalFocus + }), children, /*#__PURE__*/React.createElement(_Icon.default, { + props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, { + isSelected: selected + }), + icon: mergedItemIcon + })); + + if (_internalRenderMenuItem) { + renderNode = _internalRenderMenuItem(renderNode, props, { + selected: selected + }); + } + + return renderNode; +}); + +function MenuItem(props, ref) { + var eventKey = props.eventKey; // ==================== Record KeyPath ==================== + + var measure = (0, _PathContext.useMeasure)(); + var connectedKeyPath = (0, _PathContext.useFullPath)(eventKey); // eslint-disable-next-line consistent-return + + React.useEffect(function () { + if (measure) { + measure.registerPath(eventKey, connectedKeyPath); + return function () { + measure.unregisterPath(eventKey, connectedKeyPath); + }; + } + }, [connectedKeyPath]); + + if (measure) { + return null; + } // ======================== Render ======================== + + + return /*#__PURE__*/React.createElement(InternalMenuItem, (0, _extends2.default)({}, props, { + ref: ref + })); +} + +var _default = /*#__PURE__*/React.forwardRef(MenuItem); + +exports.default = _default; +},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/classCallCheck":"VEjx","@babel/runtime/helpers/esm/createClass":"l5p4","@babel/runtime/helpers/esm/inherits":"NT06","@babel/runtime/helpers/esm/createSuper":"m5aa","classnames":"yl9j","rc-overflow":"H6C2","rc-util/es/KeyCode":"lynM","rc-util/es/omit":"FTix","rc-util/es/ref":"cFFP","rc-util/es/warning":"orzV","react":"n8MK","./context/IdContext":"VB3D","./context/MenuContext":"WRUc","./context/PathContext":"thAF","./context/PrivateContext":"V73O","./hooks/useActive":"LQKT","./hooks/useDirectionStyle":"Pnmu","./Icon":"E0zE","./utils/warnUtil":"cvmo"}],"imhB":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + +var React = _interopRequireWildcard(require("react")); + +var _classnames = _interopRequireDefault(require("classnames")); + +var _MenuContext = require("../context/MenuContext"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _excluded = ["className", "children"]; + +var InternalSubMenuList = function InternalSubMenuList(_ref, ref) { + var className = _ref.className, + children = _ref.children, + restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); + + var _React$useContext = React.useContext(_MenuContext.MenuContext), + prefixCls = _React$useContext.prefixCls, + mode = _React$useContext.mode, + rtl = _React$useContext.rtl; + + return /*#__PURE__*/React.createElement("ul", (0, _extends2.default)({ + className: (0, _classnames.default)(prefixCls, rtl && "".concat(prefixCls, "-rtl"), "".concat(prefixCls, "-sub"), "".concat(prefixCls, "-").concat(mode === 'inline' ? 'inline' : 'vertical'), className), + role: "menu" + }, restProps, { + "data-menu-list": true, + ref: ref + }), children); +}; + +var SubMenuList = /*#__PURE__*/React.forwardRef(InternalSubMenuList); +SubMenuList.displayName = 'SubMenuList'; +var _default = SubMenuList; +exports.default = _default; +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"yl9j","../context/MenuContext":"WRUc"}],"FJJO":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = toArray; + +var _react = _interopRequireDefault(require("react")); + +var _reactIs = require("react-is"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function toArray(children) { + var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var ret = []; + + _react.default.Children.forEach(children, function (child) { + if ((child === undefined || child === null) && !option.keepEmpty) { + return; + } + + if (Array.isArray(child)) { + ret = ret.concat(toArray(child)); + } else if ((0, _reactIs.isFragment)(child) && child.props) { + ret = ret.concat(toArray(child.props.children, option)); + } else { + ret.push(child); + } + }); + + return ret; +} +},{"react":"n8MK","react-is":"aD5v"}],"T1Gl":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.parseChildren = parseChildren; +exports.parseItems = parseItems; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); + +var React = _interopRequireWildcard(require("react")); + +var _toArray = _interopRequireDefault(require("rc-util/es/Children/toArray")); + +var _ = require(".."); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _excluded = ["label", "children", "key", "type"]; + +function parseChildren(children, keyPath) { + return (0, _toArray.default)(children).map(function (child, index) { + if ( /*#__PURE__*/React.isValidElement(child)) { + var _eventKey, _child$props; + + var key = child.key; + var eventKey = (_eventKey = (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.eventKey) !== null && _eventKey !== void 0 ? _eventKey : key; + var emptyKey = eventKey === null || eventKey === undefined; + + if (emptyKey) { + eventKey = "tmp_key-".concat([].concat((0, _toConsumableArray2.default)(keyPath), [index]).join('-')); + } + + var cloneProps = { + key: eventKey, + eventKey: eventKey + }; + + if ("production" !== 'production' && emptyKey) { + cloneProps.warnKey = true; + } + + return /*#__PURE__*/React.cloneElement(child, cloneProps); + } + + return child; + }); +} + +function convertItemsToNodes(list) { + return (list || []).map(function (opt, index) { + if (opt && (0, _typeof2.default)(opt) === 'object') { + var _ref = opt, + label = _ref.label, + children = _ref.children, + key = _ref.key, + type = _ref.type, + restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); + var mergedKey = key !== null && key !== void 0 ? key : "tmp-".concat(index); // MenuItemGroup & SubMenuItem + + if (children || type === 'group') { + if (type === 'group') { + // Group + return /*#__PURE__*/React.createElement(_.MenuItemGroup, (0, _extends2.default)({ + key: mergedKey + }, restProps, { + title: label + }), convertItemsToNodes(children)); + } // Sub Menu + + + return /*#__PURE__*/React.createElement(_.SubMenu, (0, _extends2.default)({ + key: mergedKey + }, restProps, { + title: label + }), convertItemsToNodes(children)); + } // MenuItem & Divider + + + if (type === 'divider') { + return /*#__PURE__*/React.createElement(_.Divider, (0, _extends2.default)({ + key: mergedKey + }, restProps)); + } + + return /*#__PURE__*/React.createElement(_.MenuItem, (0, _extends2.default)({ + key: mergedKey + }, restProps), label); + } + + return null; + }).filter(function (opt) { + return opt; + }); +} + +function parseItems(children, items, keyPath) { + var childNodes = children; + + if (items) { + childNodes = convertItemsToNodes(items); + } + + return parseChildren(childNodes, keyPath); +} +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/typeof":"xLw6","@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","react":"n8MK","rc-util/es/Children/toArray":"FJJO","..":"VH7R"}],"OUxT":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.placementsRtl = exports.placements = exports.default = void 0; +var autoAdjustOverflow = { + adjustX: 1, + adjustY: 1 +}; +var placements = { + topLeft: { + points: ['bl', 'tl'], + overflow: autoAdjustOverflow, + offset: [0, -7] + }, + bottomLeft: { + points: ['tl', 'bl'], + overflow: autoAdjustOverflow, + offset: [0, 7] + }, + leftTop: { + points: ['tr', 'tl'], + overflow: autoAdjustOverflow, + offset: [-4, 0] + }, + rightTop: { + points: ['tl', 'tr'], + overflow: autoAdjustOverflow, + offset: [4, 0] + } +}; +exports.placements = placements; +var placementsRtl = { + topLeft: { + points: ['bl', 'tl'], + overflow: autoAdjustOverflow, + offset: [0, -7] + }, + bottomLeft: { + points: ['tl', 'bl'], + overflow: autoAdjustOverflow, + offset: [0, 7] + }, + rightTop: { + points: ['tr', 'tl'], + overflow: autoAdjustOverflow, + offset: [-4, 0] + }, + leftTop: { + points: ['tl', 'tr'], + overflow: autoAdjustOverflow, + offset: [4, 0] + } +}; +exports.placementsRtl = placementsRtl; +var _default = placements; +exports.default = _default; +},{}],"fjqJ":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getMotion = getMotion; + +function getMotion(mode, motion, defaultMotions) { + if (motion) { + return motion; + } + + if (defaultMotions) { + return defaultMotions[mode] || defaultMotions.other; + } + + return undefined; +} +},{}],"hvs0":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = PopupTrigger; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + +var React = _interopRequireWildcard(require("react")); + +var _rcTrigger = _interopRequireDefault(require("rc-trigger")); + +var _classnames = _interopRequireDefault(require("classnames")); + +var _raf = _interopRequireDefault(require("rc-util/es/raf")); + +var _MenuContext = require("../context/MenuContext"); + +var _placements = require("../placements"); + +var _motionUtil = require("../utils/motionUtil"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var popupPlacementMap = { + horizontal: 'bottomLeft', + vertical: 'rightTop', + 'vertical-left': 'rightTop', + 'vertical-right': 'leftTop' +}; + +function PopupTrigger(_ref) { + var prefixCls = _ref.prefixCls, + visible = _ref.visible, + children = _ref.children, + popup = _ref.popup, + popupClassName = _ref.popupClassName, + popupOffset = _ref.popupOffset, + disabled = _ref.disabled, + mode = _ref.mode, + onVisibleChange = _ref.onVisibleChange; + + var _React$useContext = React.useContext(_MenuContext.MenuContext), + getPopupContainer = _React$useContext.getPopupContainer, + rtl = _React$useContext.rtl, + subMenuOpenDelay = _React$useContext.subMenuOpenDelay, + subMenuCloseDelay = _React$useContext.subMenuCloseDelay, + builtinPlacements = _React$useContext.builtinPlacements, + triggerSubMenuAction = _React$useContext.triggerSubMenuAction, + forceSubMenuRender = _React$useContext.forceSubMenuRender, + rootClassName = _React$useContext.rootClassName, + motion = _React$useContext.motion, + defaultMotions = _React$useContext.defaultMotions; + + var _React$useState = React.useState(false), + _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), + innerVisible = _React$useState2[0], + setInnerVisible = _React$useState2[1]; + + var placement = rtl ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _placements.placementsRtl), builtinPlacements) : (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _placements.placements), builtinPlacements); + var popupPlacement = popupPlacementMap[mode]; + var targetMotion = (0, _motionUtil.getMotion)(mode, motion, defaultMotions); + var targetMotionRef = React.useRef(targetMotion); + + if (mode !== 'inline') { + /** + * PopupTrigger is only used for vertical and horizontal types. + * When collapsed is unfolded, the inline animation will destroy the vertical animation. + */ + targetMotionRef.current = targetMotion; + } + + var mergedMotion = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, targetMotionRef.current), {}, { + leavedClassName: "".concat(prefixCls, "-hidden"), + removeOnLeave: false, + motionAppear: true + }); // Delay to change visible + + var visibleRef = React.useRef(); + React.useEffect(function () { + visibleRef.current = (0, _raf.default)(function () { + setInnerVisible(visible); + }); + return function () { + _raf.default.cancel(visibleRef.current); + }; + }, [visible]); + return /*#__PURE__*/React.createElement(_rcTrigger.default, { + prefixCls: prefixCls, + popupClassName: (0, _classnames.default)("".concat(prefixCls, "-popup"), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-rtl"), rtl), popupClassName, rootClassName), + stretch: mode === 'horizontal' ? 'minWidth' : null, + getPopupContainer: getPopupContainer, + builtinPlacements: placement, + popupPlacement: popupPlacement, + popupVisible: innerVisible, + popup: popup, + popupAlign: popupOffset && { + offset: popupOffset + }, + action: disabled ? [] : [triggerSubMenuAction], + mouseEnterDelay: subMenuOpenDelay, + mouseLeaveDelay: subMenuCloseDelay, + onPopupVisibleChange: onVisibleChange, + forceRender: forceSubMenuRender, + popupMotion: mergedMotion + }, children); +} +},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-trigger":"PZMl","classnames":"yl9j","rc-util/es/raf":"dtu8","../context/MenuContext":"WRUc","../placements":"OUxT","../utils/motionUtil":"fjqJ"}],"l2u9":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = InlineSubMenuList; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + +var React = _interopRequireWildcard(require("react")); + +var _rcMotion = _interopRequireDefault(require("rc-motion")); + +var _motionUtil = require("../utils/motionUtil"); + +var _MenuContext = _interopRequireWildcard(require("../context/MenuContext")); + +var _SubMenuList = _interopRequireDefault(require("./SubMenuList")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function InlineSubMenuList(_ref) { + var id = _ref.id, + open = _ref.open, + keyPath = _ref.keyPath, + children = _ref.children; + var fixedMode = 'inline'; + + var _React$useContext = React.useContext(_MenuContext.MenuContext), + prefixCls = _React$useContext.prefixCls, + forceSubMenuRender = _React$useContext.forceSubMenuRender, + motion = _React$useContext.motion, + defaultMotions = _React$useContext.defaultMotions, + mode = _React$useContext.mode; // Always use latest mode check + + + var sameModeRef = React.useRef(false); + sameModeRef.current = mode === fixedMode; // We record `destroy` mark here since when mode change from `inline` to others. + // The inline list should remove when motion end. + + var _React$useState = React.useState(!sameModeRef.current), + _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), + destroy = _React$useState2[0], + setDestroy = _React$useState2[1]; + + var mergedOpen = sameModeRef.current ? open : false; // ================================= Effect ================================= + // Reset destroy state when mode change back + + React.useEffect(function () { + if (sameModeRef.current) { + setDestroy(false); + } + }, [mode]); // ================================= Render ================================= + + var mergedMotion = (0, _objectSpread2.default)({}, (0, _motionUtil.getMotion)(fixedMode, motion, defaultMotions)); // No need appear since nest inlineCollapse changed + + if (keyPath.length > 1) { + mergedMotion.motionAppear = false; + } // Hide inline list when mode changed and motion end + + + var originOnVisibleChanged = mergedMotion.onVisibleChanged; + + mergedMotion.onVisibleChanged = function (newVisible) { + if (!sameModeRef.current && !newVisible) { + setDestroy(true); + } + + return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible); + }; + + if (destroy) { + return null; + } + + return /*#__PURE__*/React.createElement(_MenuContext.default, { + mode: fixedMode, + locked: !sameModeRef.current + }, /*#__PURE__*/React.createElement(_rcMotion.default, (0, _extends2.default)({ + visible: mergedOpen + }, mergedMotion, { + forceRender: forceSubMenuRender, + removeOnLeave: false, + leavedClassName: "".concat(prefixCls, "-hidden") + }), function (_ref2) { + var motionClassName = _ref2.className, + motionStyle = _ref2.style; + return /*#__PURE__*/React.createElement(_SubMenuList.default, { + id: id, + className: motionClassName, + style: motionStyle + }, children); + })); +} +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","rc-motion":"VTMl","../utils/motionUtil":"fjqJ","../context/MenuContext":"WRUc","./SubMenuList":"imhB"}],"lVAn":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = SubMenu; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + +var React = _interopRequireWildcard(require("react")); + +var _classnames = _interopRequireDefault(require("classnames")); + +var _rcOverflow = _interopRequireDefault(require("rc-overflow")); + +var _warning = _interopRequireDefault(require("rc-util/es/warning")); + +var _SubMenuList = _interopRequireDefault(require("./SubMenuList")); + +var _nodeUtil = require("../utils/nodeUtil"); + +var _MenuContext = _interopRequireWildcard(require("../context/MenuContext")); + +var _useMemoCallback = _interopRequireDefault(require("../hooks/useMemoCallback")); + +var _PopupTrigger = _interopRequireDefault(require("./PopupTrigger")); + +var _Icon = _interopRequireDefault(require("../Icon")); + +var _useActive2 = _interopRequireDefault(require("../hooks/useActive")); + +var _warnUtil = require("../utils/warnUtil"); + +var _useDirectionStyle = _interopRequireDefault(require("../hooks/useDirectionStyle")); + +var _InlineSubMenuList = _interopRequireDefault(require("./InlineSubMenuList")); + +var _PathContext = require("../context/PathContext"); + +var _IdContext = require("../context/IdContext"); + +var _PrivateContext = _interopRequireDefault(require("../context/PrivateContext")); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _excluded = ["style", "className", "title", "eventKey", "warnKey", "disabled", "internalPopupClose", "children", "itemIcon", "expandIcon", "popupClassName", "popupOffset", "onClick", "onMouseEnter", "onMouseLeave", "onTitleClick", "onTitleMouseEnter", "onTitleMouseLeave"], + _excluded2 = ["active"]; + +var InternalSubMenu = function InternalSubMenu(props) { + var _classNames; + + var style = props.style, + className = props.className, + title = props.title, + eventKey = props.eventKey, + warnKey = props.warnKey, + disabled = props.disabled, + internalPopupClose = props.internalPopupClose, + children = props.children, + itemIcon = props.itemIcon, + expandIcon = props.expandIcon, + popupClassName = props.popupClassName, + popupOffset = props.popupOffset, + onClick = props.onClick, + onMouseEnter = props.onMouseEnter, + onMouseLeave = props.onMouseLeave, + onTitleClick = props.onTitleClick, + onTitleMouseEnter = props.onTitleMouseEnter, + onTitleMouseLeave = props.onTitleMouseLeave, + restProps = (0, _objectWithoutProperties2.default)(props, _excluded); + var domDataId = (0, _IdContext.useMenuId)(eventKey); + + var _React$useContext = React.useContext(_MenuContext.MenuContext), + prefixCls = _React$useContext.prefixCls, + mode = _React$useContext.mode, + openKeys = _React$useContext.openKeys, + contextDisabled = _React$useContext.disabled, + overflowDisabled = _React$useContext.overflowDisabled, + activeKey = _React$useContext.activeKey, + selectedKeys = _React$useContext.selectedKeys, + contextItemIcon = _React$useContext.itemIcon, + contextExpandIcon = _React$useContext.expandIcon, + onItemClick = _React$useContext.onItemClick, + onOpenChange = _React$useContext.onOpenChange, + onActive = _React$useContext.onActive; + + var _React$useContext2 = React.useContext(_PrivateContext.default), + _internalRenderSubMenuItem = _React$useContext2._internalRenderSubMenuItem; + + var _React$useContext3 = React.useContext(_PathContext.PathUserContext), + isSubPathKey = _React$useContext3.isSubPathKey; + + var connectedPath = (0, _PathContext.useFullPath)(); + var subMenuPrefixCls = "".concat(prefixCls, "-submenu"); + var mergedDisabled = contextDisabled || disabled; + var elementRef = React.useRef(); + var popupRef = React.useRef(); // ================================ Warn ================================ + + if ("production" !== 'production' && warnKey) { + (0, _warning.default)(false, 'SubMenu should not leave undefined `key`.'); + } // ================================ Icon ================================ + + + var mergedItemIcon = itemIcon || contextItemIcon; + var mergedExpandIcon = expandIcon || contextExpandIcon; // ================================ Open ================================ + + var originOpen = openKeys.includes(eventKey); + var open = !overflowDisabled && originOpen; // =============================== Select =============================== + + var childrenSelected = isSubPathKey(selectedKeys, eventKey); // =============================== Active =============================== + + var _useActive = (0, _useActive2.default)(eventKey, mergedDisabled, onTitleMouseEnter, onTitleMouseLeave), + active = _useActive.active, + activeProps = (0, _objectWithoutProperties2.default)(_useActive, _excluded2); // Fallback of active check to avoid hover on menu title or disabled item + + + var _React$useState = React.useState(false), + _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), + childrenActive = _React$useState2[0], + setChildrenActive = _React$useState2[1]; + + var triggerChildrenActive = function triggerChildrenActive(newActive) { + if (!mergedDisabled) { + setChildrenActive(newActive); + } + }; + + var onInternalMouseEnter = function onInternalMouseEnter(domEvent) { + triggerChildrenActive(true); + onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter({ + key: eventKey, + domEvent: domEvent + }); + }; + + var onInternalMouseLeave = function onInternalMouseLeave(domEvent) { + triggerChildrenActive(false); + onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({ + key: eventKey, + domEvent: domEvent + }); + }; + + var mergedActive = React.useMemo(function () { + if (active) { + return active; + } + + if (mode !== 'inline') { + return childrenActive || isSubPathKey([activeKey], eventKey); + } + + return false; + }, [mode, active, activeKey, childrenActive, eventKey, isSubPathKey]); // ========================== DirectionStyle ========================== + + var directionStyle = (0, _useDirectionStyle.default)(connectedPath.length); // =============================== Events =============================== + // >>>> Title click + + var onInternalTitleClick = function onInternalTitleClick(e) { + // Skip if disabled + if (mergedDisabled) { + return; + } + + onTitleClick === null || onTitleClick === void 0 ? void 0 : onTitleClick({ + key: eventKey, + domEvent: e + }); // Trigger open by click when mode is `inline` + + if (mode === 'inline') { + onOpenChange(eventKey, !originOpen); + } + }; // >>>> Context for children click + + + var onMergedItemClick = (0, _useMemoCallback.default)(function (info) { + onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); + onItemClick(info); + }); // >>>>> Visible change + + var onPopupVisibleChange = function onPopupVisibleChange(newVisible) { + if (mode !== 'inline') { + onOpenChange(eventKey, newVisible); + } + }; + /** + * Used for accessibility. Helper will focus element without key board. + * We should manually trigger an active + */ + + + var onInternalFocus = function onInternalFocus() { + onActive(eventKey); + }; // =============================== Render =============================== + + + var popupId = domDataId && "".concat(domDataId, "-popup"); // >>>>> Title + + var titleNode = /*#__PURE__*/React.createElement("div", (0, _extends2.default)({ + role: "menuitem", + style: directionStyle, + className: "".concat(subMenuPrefixCls, "-title"), + tabIndex: mergedDisabled ? null : -1, + ref: elementRef, + title: typeof title === 'string' ? title : null, + "data-menu-id": overflowDisabled && domDataId ? null : domDataId, + "aria-expanded": open, + "aria-haspopup": true, + "aria-controls": popupId, + "aria-disabled": mergedDisabled, + onClick: onInternalTitleClick, + onFocus: onInternalFocus + }, activeProps), title, /*#__PURE__*/React.createElement(_Icon.default, { + icon: mode !== 'horizontal' ? mergedExpandIcon : null, + props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, { + isOpen: open, + // [Legacy] Not sure why need this mark + isSubMenu: true + }) + }, /*#__PURE__*/React.createElement("i", { + className: "".concat(subMenuPrefixCls, "-arrow") + }))); // Cache mode if it change to `inline` which do not have popup motion + + var triggerModeRef = React.useRef(mode); + + if (mode !== 'inline' && connectedPath.length > 1) { + triggerModeRef.current = 'vertical'; + } else { + triggerModeRef.current = mode; + } + + if (!overflowDisabled) { + var triggerMode = triggerModeRef.current; // Still wrap with Trigger here since we need avoid react re-mount dom node + // Which makes motion failed + + titleNode = /*#__PURE__*/React.createElement(_PopupTrigger.default, { + mode: triggerMode, + prefixCls: subMenuPrefixCls, + visible: !internalPopupClose && open && mode !== 'inline', + popupClassName: popupClassName, + popupOffset: popupOffset, + popup: /*#__PURE__*/React.createElement(_MenuContext.default // Special handle of horizontal mode + , { + mode: triggerMode === 'horizontal' ? 'vertical' : triggerMode + }, /*#__PURE__*/React.createElement(_SubMenuList.default, { + id: popupId, + ref: popupRef + }, children)), + disabled: mergedDisabled, + onVisibleChange: onPopupVisibleChange + }, titleNode); + } // >>>>> List node + + + var listNode = /*#__PURE__*/React.createElement(_rcOverflow.default.Item, (0, _extends2.default)({ + role: "none" + }, restProps, { + component: "li", + style: style, + className: (0, _classnames.default)(subMenuPrefixCls, "".concat(subMenuPrefixCls, "-").concat(mode), className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-open"), open), (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-active"), mergedActive), (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-selected"), childrenSelected), (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-disabled"), mergedDisabled), _classNames)), + onMouseEnter: onInternalMouseEnter, + onMouseLeave: onInternalMouseLeave + }), titleNode, !overflowDisabled && /*#__PURE__*/React.createElement(_InlineSubMenuList.default, { + id: popupId, + open: open, + keyPath: connectedPath + }, children)); + + if (_internalRenderSubMenuItem) { + listNode = _internalRenderSubMenuItem(listNode, props, { + selected: childrenSelected, + active: mergedActive, + open: open, + disabled: mergedDisabled + }); + } // >>>>> Render + + + return /*#__PURE__*/React.createElement(_MenuContext.default, { + onItemClick: onMergedItemClick, + mode: mode === 'horizontal' ? 'vertical' : mode, + itemIcon: mergedItemIcon, + expandIcon: mergedExpandIcon + }, listNode); +}; + +function SubMenu(props) { + var eventKey = props.eventKey, + children = props.children; + var connectedKeyPath = (0, _PathContext.useFullPath)(eventKey); + var childList = (0, _nodeUtil.parseChildren)(children, connectedKeyPath); // ==================== Record KeyPath ==================== + + var measure = (0, _PathContext.useMeasure)(); // eslint-disable-next-line consistent-return + + React.useEffect(function () { + if (measure) { + measure.registerPath(eventKey, connectedKeyPath); + return function () { + measure.unregisterPath(eventKey, connectedKeyPath); + }; + } + }, [connectedKeyPath]); + var renderNode; // ======================== Render ======================== + + if (measure) { + renderNode = childList; + } else { + renderNode = /*#__PURE__*/React.createElement(InternalSubMenu, props, childList); + } + + return /*#__PURE__*/React.createElement(_PathContext.PathTrackerContext.Provider, { + value: connectedKeyPath + }, renderNode); +} +},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"yl9j","rc-overflow":"H6C2","rc-util/es/warning":"orzV","./SubMenuList":"imhB","../utils/nodeUtil":"T1Gl","../context/MenuContext":"WRUc","../hooks/useMemoCallback":"vAIo","./PopupTrigger":"hvs0","../Icon":"E0zE","../hooks/useActive":"LQKT","../utils/warnUtil":"cvmo","../hooks/useDirectionStyle":"Pnmu","./InlineSubMenuList":"l2u9","../context/PathContext":"thAF","../context/IdContext":"VB3D","../context/PrivateContext":"V73O"}],"JLqT":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); + +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); + +var _classnames = _interopRequireDefault(require("classnames")); + +var _rcOverflow = _interopRequireDefault(require("rc-overflow")); + +var _useMergedState7 = _interopRequireDefault(require("rc-util/es/hooks/useMergedState")); + +var _warning = _interopRequireDefault(require("rc-util/es/warning")); + +var React = _interopRequireWildcard(require("react")); + +var _reactDom = require("react-dom"); + +var _isEqual = _interopRequireDefault(require("rc-util/es/isEqual")); + +var _IdContext = require("./context/IdContext"); + +var _MenuContext = _interopRequireDefault(require("./context/MenuContext")); + +var _PathContext = require("./context/PathContext"); + +var _PrivateContext = _interopRequireDefault(require("./context/PrivateContext")); + +var _useAccessibility = _interopRequireDefault(require("./hooks/useAccessibility")); + +var _useKeyRecords2 = _interopRequireWildcard(require("./hooks/useKeyRecords")); + +var _useMemoCallback = _interopRequireDefault(require("./hooks/useMemoCallback")); + +var _useUUID = _interopRequireDefault(require("./hooks/useUUID")); + +var _MenuItem = _interopRequireDefault(require("./MenuItem")); + +var _SubMenu = _interopRequireDefault(require("./SubMenu")); + +var _nodeUtil = require("./utils/nodeUtil"); + +var _warnUtil = require("./utils/warnUtil"); + +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } + +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var MIN_SWIPE_DISTANCE = 0.1; -var STOP_SWIPE_DISTANCE = 0.01; -var REFRESH_INTERVAL = 20; -var SPEED_OFF_MULTIPLE = Math.pow(0.995, REFRESH_INTERVAL); // ================================= Hook ================================= +var _excluded = ["prefixCls", "rootClassName", "style", "className", "tabIndex", "items", "children", "direction", "id", "mode", "inlineCollapsed", "disabled", "disabledOverflow", "subMenuOpenDelay", "subMenuCloseDelay", "forceSubMenuRender", "defaultOpenKeys", "openKeys", "activeKey", "defaultActiveFirst", "selectable", "multiple", "defaultSelectedKeys", "selectedKeys", "onSelect", "onDeselect", "inlineIndent", "motion", "defaultMotions", "triggerSubMenuAction", "builtinPlacements", "itemIcon", "expandIcon", "overflowedIndicator", "overflowedIndicatorPopupClassName", "getPopupContainer", "onClick", "onOpenChange", "onKeyDown", "openAnimation", "openTransitionName", "_internalRenderMenuItem", "_internalRenderSubMenuItem"]; -function useTouchMove(ref, onOffset) { - var _useState = (0, React.useState)(), - _useState2 = (0, _slicedToArray2.default)(_useState, 2), - touchPosition = _useState2[0], - setTouchPosition = _useState2[1]; +/** + * Menu modify after refactor: + * ## Add + * - disabled + * + * ## Remove + * - openTransitionName + * - openAnimation + * - onDestroy + * - siderCollapsed: Seems antd do not use this prop (Need test in antd) + * - collapsedWidth: Seems this logic should be handle by antd Layout.Sider + */ +// optimize for render +var EMPTY_LIST = []; +var Menu = /*#__PURE__*/React.forwardRef(function (props, ref) { + var _childList$, _classNames; + + var _ref = props, + _ref$prefixCls = _ref.prefixCls, + prefixCls = _ref$prefixCls === void 0 ? 'rc-menu' : _ref$prefixCls, + rootClassName = _ref.rootClassName, + style = _ref.style, + className = _ref.className, + _ref$tabIndex = _ref.tabIndex, + tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex, + items = _ref.items, + children = _ref.children, + direction = _ref.direction, + id = _ref.id, + _ref$mode = _ref.mode, + mode = _ref$mode === void 0 ? 'vertical' : _ref$mode, + inlineCollapsed = _ref.inlineCollapsed, + disabled = _ref.disabled, + disabledOverflow = _ref.disabledOverflow, + _ref$subMenuOpenDelay = _ref.subMenuOpenDelay, + subMenuOpenDelay = _ref$subMenuOpenDelay === void 0 ? 0.1 : _ref$subMenuOpenDelay, + _ref$subMenuCloseDela = _ref.subMenuCloseDelay, + subMenuCloseDelay = _ref$subMenuCloseDela === void 0 ? 0.1 : _ref$subMenuCloseDela, + forceSubMenuRender = _ref.forceSubMenuRender, + defaultOpenKeys = _ref.defaultOpenKeys, + openKeys = _ref.openKeys, + activeKey = _ref.activeKey, + defaultActiveFirst = _ref.defaultActiveFirst, + _ref$selectable = _ref.selectable, + selectable = _ref$selectable === void 0 ? true : _ref$selectable, + _ref$multiple = _ref.multiple, + multiple = _ref$multiple === void 0 ? false : _ref$multiple, + defaultSelectedKeys = _ref.defaultSelectedKeys, + selectedKeys = _ref.selectedKeys, + onSelect = _ref.onSelect, + onDeselect = _ref.onDeselect, + _ref$inlineIndent = _ref.inlineIndent, + inlineIndent = _ref$inlineIndent === void 0 ? 24 : _ref$inlineIndent, + motion = _ref.motion, + defaultMotions = _ref.defaultMotions, + _ref$triggerSubMenuAc = _ref.triggerSubMenuAction, + triggerSubMenuAction = _ref$triggerSubMenuAc === void 0 ? 'hover' : _ref$triggerSubMenuAc, + builtinPlacements = _ref.builtinPlacements, + itemIcon = _ref.itemIcon, + expandIcon = _ref.expandIcon, + _ref$overflowedIndica = _ref.overflowedIndicator, + overflowedIndicator = _ref$overflowedIndica === void 0 ? '...' : _ref$overflowedIndica, + overflowedIndicatorPopupClassName = _ref.overflowedIndicatorPopupClassName, + getPopupContainer = _ref.getPopupContainer, + onClick = _ref.onClick, + onOpenChange = _ref.onOpenChange, + onKeyDown = _ref.onKeyDown, + openAnimation = _ref.openAnimation, + openTransitionName = _ref.openTransitionName, + _internalRenderMenuItem = _ref._internalRenderMenuItem, + _internalRenderSubMenuItem = _ref._internalRenderSubMenuItem, + restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); + var childList = React.useMemo(function () { + return (0, _nodeUtil.parseItems)(children, items, EMPTY_LIST); + }, [children, items]); + + var _React$useState = React.useState(false), + _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), + mounted = _React$useState2[0], + setMounted = _React$useState2[1]; + + var containerRef = React.useRef(); + var uuid = (0, _useUUID.default)(id); + var isRtl = direction === 'rtl'; // ========================= Warn ========================= + + if ("production" !== 'production') { + (0, _warning.default)(!openAnimation && !openTransitionName, '`openAnimation` and `openTransitionName` is removed. Please use `motion` or `defaultMotion` instead.'); + } // ========================= Open ========================= + + + var _useMergedState = (0, _useMergedState7.default)(defaultOpenKeys, { + value: openKeys, + postState: function postState(keys) { + return keys || EMPTY_LIST; + } + }), + _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2), + mergedOpenKeys = _useMergedState2[0], + setMergedOpenKeys = _useMergedState2[1]; // React 18 will merge mouse event which means we open key will not sync + // ref: https://github.com/ant-design/ant-design/issues/38818 + + + var triggerOpenKeys = function triggerOpenKeys(keys) { + var forceFlush = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + function doUpdate() { + setMergedOpenKeys(keys); + onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(keys); + } + + if (forceFlush) { + (0, _reactDom.flushSync)(doUpdate); + } else { + doUpdate(); + } + }; // >>>>> Cache & Reset open keys when inlineCollapsed changed + + + var _React$useState3 = React.useState(mergedOpenKeys), + _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2), + inlineCacheOpenKeys = _React$useState4[0], + setInlineCacheOpenKeys = _React$useState4[1]; + + var mountRef = React.useRef(false); // ========================= Mode ========================= + + var _React$useMemo = React.useMemo(function () { + if ((mode === 'inline' || mode === 'vertical') && inlineCollapsed) { + return ['vertical', inlineCollapsed]; + } + + return [mode, false]; + }, [mode, inlineCollapsed]), + _React$useMemo2 = (0, _slicedToArray2.default)(_React$useMemo, 2), + mergedMode = _React$useMemo2[0], + mergedInlineCollapsed = _React$useMemo2[1]; + + var isInlineMode = mergedMode === 'inline'; + + var _React$useState5 = React.useState(mergedMode), + _React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2), + internalMode = _React$useState6[0], + setInternalMode = _React$useState6[1]; + + var _React$useState7 = React.useState(mergedInlineCollapsed), + _React$useState8 = (0, _slicedToArray2.default)(_React$useState7, 2), + internalInlineCollapsed = _React$useState8[0], + setInternalInlineCollapsed = _React$useState8[1]; + + React.useEffect(function () { + setInternalMode(mergedMode); + setInternalInlineCollapsed(mergedInlineCollapsed); + + if (!mountRef.current) { + return; + } // Synchronously update MergedOpenKeys + + + if (isInlineMode) { + setMergedOpenKeys(inlineCacheOpenKeys); + } else { + // Trigger open event in case its in control + triggerOpenKeys(EMPTY_LIST); + } + }, [mergedMode, mergedInlineCollapsed]); // ====================== Responsive ====================== + + var _React$useState9 = React.useState(0), + _React$useState10 = (0, _slicedToArray2.default)(_React$useState9, 2), + lastVisibleIndex = _React$useState10[0], + setLastVisibleIndex = _React$useState10[1]; + + var allVisible = lastVisibleIndex >= childList.length - 1 || internalMode !== 'horizontal' || disabledOverflow; // Cache + + React.useEffect(function () { + if (isInlineMode) { + setInlineCacheOpenKeys(mergedOpenKeys); + } + }, [mergedOpenKeys]); + React.useEffect(function () { + mountRef.current = true; + return function () { + mountRef.current = false; + }; + }, []); // ========================= Path ========================= + + var _useKeyRecords = (0, _useKeyRecords2.default)(), + registerPath = _useKeyRecords.registerPath, + unregisterPath = _useKeyRecords.unregisterPath, + refreshOverflowKeys = _useKeyRecords.refreshOverflowKeys, + isSubPathKey = _useKeyRecords.isSubPathKey, + getKeyPath = _useKeyRecords.getKeyPath, + getKeys = _useKeyRecords.getKeys, + getSubPathKeys = _useKeyRecords.getSubPathKeys; + + var registerPathContext = React.useMemo(function () { + return { + registerPath: registerPath, + unregisterPath: unregisterPath + }; + }, [registerPath, unregisterPath]); + var pathUserContext = React.useMemo(function () { + return { + isSubPathKey: isSubPathKey + }; + }, [isSubPathKey]); + React.useEffect(function () { + refreshOverflowKeys(allVisible ? EMPTY_LIST : childList.slice(lastVisibleIndex + 1).map(function (child) { + return child.key; + })); + }, [lastVisibleIndex, allVisible]); // ======================== Active ======================== + + var _useMergedState3 = (0, _useMergedState7.default)(activeKey || defaultActiveFirst && ((_childList$ = childList[0]) === null || _childList$ === void 0 ? void 0 : _childList$.key), { + value: activeKey + }), + _useMergedState4 = (0, _slicedToArray2.default)(_useMergedState3, 2), + mergedActiveKey = _useMergedState4[0], + setMergedActiveKey = _useMergedState4[1]; + + var onActive = (0, _useMemoCallback.default)(function (key) { + setMergedActiveKey(key); + }); + var onInactive = (0, _useMemoCallback.default)(function () { + setMergedActiveKey(undefined); + }); + (0, React.useImperativeHandle)(ref, function () { + return { + list: containerRef.current, + focus: function focus(options) { + var _childList$find; + + var shouldFocusKey = mergedActiveKey !== null && mergedActiveKey !== void 0 ? mergedActiveKey : (_childList$find = childList.find(function (node) { + return !node.props.disabled; + })) === null || _childList$find === void 0 ? void 0 : _childList$find.key; + + if (shouldFocusKey) { + var _containerRef$current, _containerRef$current2, _containerRef$current3; + + (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.querySelector("li[data-menu-id='".concat((0, _IdContext.getMenuId)(uuid, shouldFocusKey), "']"))) === null || _containerRef$current2 === void 0 ? void 0 : (_containerRef$current3 = _containerRef$current2.focus) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.call(_containerRef$current2, options); + } + } + }; + }); // ======================== Select ======================== + // >>>>> Select keys + + var _useMergedState5 = (0, _useMergedState7.default)(defaultSelectedKeys || [], { + value: selectedKeys, + // Legacy convert key to array + postState: function postState(keys) { + if (Array.isArray(keys)) { + return keys; + } - var _useState3 = (0, React.useState)(0), - _useState4 = (0, _slicedToArray2.default)(_useState3, 2), - lastTimestamp = _useState4[0], - setLastTimestamp = _useState4[1]; + if (keys === null || keys === undefined) { + return EMPTY_LIST; + } - var _useState5 = (0, React.useState)(0), - _useState6 = (0, _slicedToArray2.default)(_useState5, 2), - lastTimeDiff = _useState6[0], - setLastTimeDiff = _useState6[1]; + return [keys]; + } + }), + _useMergedState6 = (0, _slicedToArray2.default)(_useMergedState5, 2), + mergedSelectKeys = _useMergedState6[0], + setMergedSelectKeys = _useMergedState6[1]; // >>>>> Trigger select - var _useState7 = (0, React.useState)(), - _useState8 = (0, _slicedToArray2.default)(_useState7, 2), - lastOffset = _useState8[0], - setLastOffset = _useState8[1]; - var motionRef = (0, React.useRef)(); // ========================= Events ========================= - // >>> Touch events + var triggerSelection = function triggerSelection(info) { + if (selectable) { + // Insert or Remove + var targetKey = info.key; + var exist = mergedSelectKeys.includes(targetKey); + var newSelectKeys; - function onTouchStart(e) { - var _e$touches$ = e.touches[0], - screenX = _e$touches$.screenX, - screenY = _e$touches$.screenY; - setTouchPosition({ - x: screenX, - y: screenY - }); - window.clearInterval(motionRef.current); - } + if (multiple) { + if (exist) { + newSelectKeys = mergedSelectKeys.filter(function (key) { + return key !== targetKey; + }); + } else { + newSelectKeys = [].concat((0, _toConsumableArray2.default)(mergedSelectKeys), [targetKey]); + } + } else { + newSelectKeys = [targetKey]; + } - function onTouchMove(e) { - if (!touchPosition) return; - e.preventDefault(); - var _e$touches$2 = e.touches[0], - screenX = _e$touches$2.screenX, - screenY = _e$touches$2.screenY; - setTouchPosition({ - x: screenX, - y: screenY - }); - var offsetX = screenX - touchPosition.x; - var offsetY = screenY - touchPosition.y; - onOffset(offsetX, offsetY); - var now = Date.now(); - setLastTimestamp(now); - setLastTimeDiff(now - lastTimestamp); - setLastOffset({ - x: offsetX, - y: offsetY - }); - } + setMergedSelectKeys(newSelectKeys); // Trigger event - function onTouchEnd() { - if (!touchPosition) return; - setTouchPosition(null); - setLastOffset(null); // Swipe if needed + var selectInfo = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, info), {}, { + selectedKeys: newSelectKeys + }); - if (lastOffset) { - var distanceX = lastOffset.x / lastTimeDiff; - var distanceY = lastOffset.y / lastTimeDiff; - var absX = Math.abs(distanceX); - var absY = Math.abs(distanceY); // Skip swipe if low distance + if (exist) { + onDeselect === null || onDeselect === void 0 ? void 0 : onDeselect(selectInfo); + } else { + onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectInfo); + } + } // Whatever selectable, always close it - if (Math.max(absX, absY) < MIN_SWIPE_DISTANCE) return; - var currentX = distanceX; - var currentY = distanceY; - motionRef.current = window.setInterval(function () { - if (Math.abs(currentX) < STOP_SWIPE_DISTANCE && Math.abs(currentY) < STOP_SWIPE_DISTANCE) { - window.clearInterval(motionRef.current); - return; - } - currentX *= SPEED_OFF_MULTIPLE; - currentY *= SPEED_OFF_MULTIPLE; - onOffset(currentX * REFRESH_INTERVAL, currentY * REFRESH_INTERVAL); - }, REFRESH_INTERVAL); + if (!multiple && mergedOpenKeys.length && internalMode !== 'inline') { + triggerOpenKeys(EMPTY_LIST); } - } // >>> Wheel event - + }; // ========================= Open ========================= - var lastWheelDirectionRef = (0, React.useRef)(); + /** + * Click for item. SubMenu do not have selection status + */ - function onWheel(e) { - var deltaX = e.deltaX, - deltaY = e.deltaY; // Convert both to x & y since wheel only happened on PC - var mixed = 0; - var absX = Math.abs(deltaX); - var absY = Math.abs(deltaY); + var onInternalClick = (0, _useMemoCallback.default)(function (info) { + onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); + triggerSelection(info); + }); + var onInternalOpenChange = (0, _useMemoCallback.default)(function (key, open) { + var newOpenKeys = mergedOpenKeys.filter(function (k) { + return k !== key; + }); - if (absX === absY) { - mixed = lastWheelDirectionRef.current === 'x' ? deltaX : deltaY; - } else if (absX > absY) { - mixed = deltaX; - lastWheelDirectionRef.current = 'x'; - } else { - mixed = deltaY; - lastWheelDirectionRef.current = 'y'; + if (open) { + newOpenKeys.push(key); + } else if (internalMode !== 'inline') { + // We need find all related popup to close + var subPathKeys = getSubPathKeys(key); + newOpenKeys = newOpenKeys.filter(function (k) { + return !subPathKeys.has(k); + }); } - if (onOffset(-mixed, -mixed)) { - e.preventDefault(); + if (!(0, _isEqual.default)(mergedOpenKeys, newOpenKeys, true)) { + triggerOpenKeys(newOpenKeys, true); } - } // ========================= Effect ========================= - + }); + var getInternalPopupContainer = (0, _useMemoCallback.default)(getPopupContainer); // ==================== Accessibility ===================== - var touchEventsRef = (0, React.useRef)(null); - touchEventsRef.current = { - onTouchStart: onTouchStart, - onTouchMove: onTouchMove, - onTouchEnd: onTouchEnd, - onWheel: onWheel + var triggerAccessibilityOpen = function triggerAccessibilityOpen(key, open) { + var nextOpen = open !== null && open !== void 0 ? open : !mergedOpenKeys.includes(key); + onInternalOpenChange(key, nextOpen); }; - React.useEffect(function () { - function onProxyTouchStart(e) { - touchEventsRef.current.onTouchStart(e); - } - function onProxyTouchMove(e) { - touchEventsRef.current.onTouchMove(e); - } + var onInternalKeyDown = (0, _useAccessibility.default)(internalMode, mergedActiveKey, isRtl, uuid, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown); // ======================== Effect ======================== - function onProxyTouchEnd(e) { - touchEventsRef.current.onTouchEnd(e); - } + React.useEffect(function () { + setMounted(true); + }, []); // ======================= Context ======================== - function onProxyWheel(e) { - touchEventsRef.current.onWheel(e); - } + var privateContext = React.useMemo(function () { + return { + _internalRenderMenuItem: _internalRenderMenuItem, + _internalRenderSubMenuItem: _internalRenderSubMenuItem + }; + }, [_internalRenderMenuItem, _internalRenderSubMenuItem]); // ======================== Render ======================== + // >>>>> Children - document.addEventListener('touchmove', onProxyTouchMove, { - passive: false - }); - document.addEventListener('touchend', onProxyTouchEnd, { - passive: false - }); // No need to clean up since element removed + var wrappedChildList = internalMode !== 'horizontal' || disabledOverflow ? childList : // Need wrap for overflow dropdown that do not response for open + childList.map(function (child, index) { + return ( + /*#__PURE__*/ + // Always wrap provider to avoid sub node re-mount + React.createElement(_MenuContext.default, { + key: child.key, + overflowDisabled: index > lastVisibleIndex + }, child) + ); + }); // >>>>> Container - ref.current.addEventListener('touchstart', onProxyTouchStart, { - passive: false - }); - ref.current.addEventListener('wheel', onProxyWheel); - return function () { - document.removeEventListener('touchmove', onProxyTouchMove); - document.removeEventListener('touchend', onProxyTouchEnd); - }; - }, []); -} -},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK"}],"Sb61":[function(require,module,exports) { + var container = /*#__PURE__*/React.createElement(_rcOverflow.default, (0, _extends2.default)({ + id: id, + ref: containerRef, + prefixCls: "".concat(prefixCls, "-overflow"), + component: "ul", + itemComponent: _MenuItem.default, + className: (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(internalMode), className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-inline-collapsed"), internalInlineCollapsed), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-rtl"), isRtl), _classNames), rootClassName), + dir: direction, + style: style, + role: "menu", + tabIndex: tabIndex, + data: wrappedChildList, + renderRawItem: function renderRawItem(node) { + return node; + }, + renderRawRest: function renderRawRest(omitItems) { + // We use origin list since wrapped list use context to prevent open + var len = omitItems.length; + var originOmitItems = len ? childList.slice(-len) : null; + return /*#__PURE__*/React.createElement(_SubMenu.default, { + eventKey: _useKeyRecords2.OVERFLOW_KEY, + title: overflowedIndicator, + disabled: allVisible, + internalPopupClose: len === 0, + popupClassName: overflowedIndicatorPopupClassName + }, originOmitItems); + }, + maxCount: internalMode !== 'horizontal' || disabledOverflow ? _rcOverflow.default.INVALIDATE : _rcOverflow.default.RESPONSIVE, + ssr: "full", + "data-menu-list": true, + onVisibleChange: function onVisibleChange(newLastIndex) { + setLastVisibleIndex(newLastIndex); + }, + onKeyDown: onInternalKeyDown + }, restProps)); // >>>>> Render + + return /*#__PURE__*/React.createElement(_PrivateContext.default.Provider, { + value: privateContext + }, /*#__PURE__*/React.createElement(_IdContext.IdContext.Provider, { + value: uuid + }, /*#__PURE__*/React.createElement(_MenuContext.default, { + prefixCls: prefixCls, + rootClassName: rootClassName, + mode: internalMode, + openKeys: mergedOpenKeys, + rtl: isRtl // Disabled + , + disabled: disabled // Motion + , + motion: mounted ? motion : null, + defaultMotions: mounted ? defaultMotions : null // Active + , + activeKey: mergedActiveKey, + onActive: onActive, + onInactive: onInactive // Selection + , + selectedKeys: mergedSelectKeys // Level + , + inlineIndent: inlineIndent // Popup + , + subMenuOpenDelay: subMenuOpenDelay, + subMenuCloseDelay: subMenuCloseDelay, + forceSubMenuRender: forceSubMenuRender, + builtinPlacements: builtinPlacements, + triggerSubMenuAction: triggerSubMenuAction, + getPopupContainer: getInternalPopupContainer // Icon + , + itemIcon: itemIcon, + expandIcon: expandIcon // Events + , + onItemClick: onInternalClick, + onOpenChange: onInternalOpenChange + }, /*#__PURE__*/React.createElement(_PathContext.PathUserContext.Provider, { + value: pathUserContext + }, container), /*#__PURE__*/React.createElement("div", { + style: { + display: 'none' + }, + "aria-hidden": true + }, /*#__PURE__*/React.createElement(_PathContext.PathRegisterContext.Provider, { + value: registerPathContext + }, childList))))); +}); +var _default = Menu; +exports.default = _default; +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","classnames":"yl9j","rc-overflow":"H6C2","rc-util/es/hooks/useMergedState":"UovL","rc-util/es/warning":"orzV","react":"n8MK","react-dom":"NKHc","rc-util/es/isEqual":"n49D","./context/IdContext":"VB3D","./context/MenuContext":"WRUc","./context/PathContext":"thAF","./context/PrivateContext":"V73O","./hooks/useAccessibility":"g0Ae","./hooks/useKeyRecords":"FDUp","./hooks/useMemoCallback":"vAIo","./hooks/useUUID":"nOjm","./MenuItem":"NeBp","./SubMenu":"lVAn","./utils/nodeUtil":"T1Gl","./utils/warnUtil":"cvmo"}],"vrf4":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = useRefs; - -var React = _interopRequireWildcard(require("react")); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +exports.default = MenuItemGroup; -function useRefs() { - var cacheRefs = (0, React.useRef)(new Map()); +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); - function getRef(key) { - if (!cacheRefs.current.has(key)) { - cacheRefs.current.set(key, /*#__PURE__*/React.createRef()); - } +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); - return cacheRefs.current.get(key); - } +var _classnames = _interopRequireDefault(require("classnames")); - function removeRef(key) { - cacheRefs.current.delete(key); - } +var _omit = _interopRequireDefault(require("rc-util/es/omit")); - return [getRef, removeRef]; -} -},{"react":"n8MK"}],"AAQN":[function(require,module,exports) { -"use strict"; +var React = _interopRequireWildcard(require("react")); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = useSyncState; +var _MenuContext = require("./context/MenuContext"); -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +var _PathContext = require("./context/PathContext"); -var React = _interopRequireWildcard(require("react")); +var _nodeUtil = require("./utils/nodeUtil"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -16207,627 +18613,404 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function useSyncState(defaultState, onChange) { - var stateRef = React.useRef(defaultState); +var _excluded = ["className", "title", "eventKey", "children"], + _excluded2 = ["children"]; - var _React$useState = React.useState({}), - _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), - forceUpdate = _React$useState2[1]; +var InternalMenuItemGroup = function InternalMenuItemGroup(_ref) { + var className = _ref.className, + title = _ref.title, + eventKey = _ref.eventKey, + children = _ref.children, + restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); - function setState(updater) { - var newValue = typeof updater === 'function' ? updater(stateRef.current) : updater; + var _React$useContext = React.useContext(_MenuContext.MenuContext), + prefixCls = _React$useContext.prefixCls; - if (newValue !== stateRef.current) { - onChange(newValue, stateRef.current); - } + var groupPrefixCls = "".concat(prefixCls, "-item-group"); + return /*#__PURE__*/React.createElement("li", (0, _extends2.default)({ + role: "presentation" + }, restProps, { + onClick: function onClick(e) { + return e.stopPropagation(); + }, + className: (0, _classnames.default)(groupPrefixCls, className) + }), /*#__PURE__*/React.createElement("div", { + role: "presentation", + className: "".concat(groupPrefixCls, "-title"), + title: typeof title === 'string' ? title : undefined + }, title), /*#__PURE__*/React.createElement("ul", { + role: "group", + className: "".concat(groupPrefixCls, "-list") + }, children)); +}; - stateRef.current = newValue; - forceUpdate({}); +function MenuItemGroup(_ref2) { + var children = _ref2.children, + props = (0, _objectWithoutProperties2.default)(_ref2, _excluded2); + var connectedKeyPath = (0, _PathContext.useFullPath)(props.eventKey); + var childList = (0, _nodeUtil.parseChildren)(children, connectedKeyPath); + var measure = (0, _PathContext.useMeasure)(); + + if (measure) { + return childList; } - return [stateRef.current, setState]; + return /*#__PURE__*/React.createElement(InternalMenuItemGroup, (0, _omit.default)(props, ['warnKey']), childList); } -},{"@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK"}],"Piyq":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","classnames":"yl9j","rc-util/es/omit":"FTix","react":"n8MK","./context/MenuContext":"WRUc","./context/PathContext":"thAF","./utils/nodeUtil":"T1Gl"}],"hlbq":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); - -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); +exports.default = Divider; var React = _interopRequireWildcard(require("react")); var _classnames = _interopRequireDefault(require("classnames")); -var _raf = _interopRequireDefault(require("rc-util/es/raf")); - -var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer")); - -var _useRaf = _interopRequireWildcard(require("../hooks/useRaf")); - -var _TabNode = _interopRequireDefault(require("./TabNode")); - -var _useOffsets = _interopRequireDefault(require("../hooks/useOffsets")); - -var _useVisibleRange3 = _interopRequireDefault(require("../hooks/useVisibleRange")); - -var _OperationNode = _interopRequireDefault(require("./OperationNode")); - -var _TabContext = _interopRequireDefault(require("../TabContext")); - -var _useTouchMove = _interopRequireDefault(require("../hooks/useTouchMove")); - -var _useRefs3 = _interopRequireDefault(require("../hooks/useRefs")); - -var _AddButton = _interopRequireDefault(require("./AddButton")); - -var _useSyncState5 = _interopRequireDefault(require("../hooks/useSyncState")); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var ExtraContent = function ExtraContent(_ref) { - var position = _ref.position, - prefixCls = _ref.prefixCls, - extra = _ref.extra; - if (!extra) return null; - var content; // Parse extra - - var assertExtra = {}; - - if (extra && (0, _typeof2.default)(extra) === 'object' && ! /*#__PURE__*/React.isValidElement(extra)) { - assertExtra = extra; - } else { - assertExtra.right = extra; - } - - if (position === 'right') { - content = assertExtra.right; - } - - if (position === 'left') { - content = assertExtra.left; - } - - return content ? /*#__PURE__*/React.createElement("div", { - className: "".concat(prefixCls, "-extra-content") - }, content) : null; -}; - -function TabNavList(props, ref) { - var _classNames; - - var _React$useContext = React.useContext(_TabContext.default), - prefixCls = _React$useContext.prefixCls, - tabs = _React$useContext.tabs; - - var className = props.className, - style = props.style, - id = props.id, - animated = props.animated, - activeKey = props.activeKey, - rtl = props.rtl, - extra = props.extra, - editable = props.editable, - locale = props.locale, - tabPosition = props.tabPosition, - tabBarGutter = props.tabBarGutter, - children = props.children, - onTabClick = props.onTabClick, - onTabScroll = props.onTabScroll; - var tabsWrapperRef = (0, React.useRef)(); - var tabListRef = (0, React.useRef)(); - var operationsRef = (0, React.useRef)(); - var innerAddButtonRef = (0, React.useRef)(); - - var _useRefs = (0, _useRefs3.default)(), - _useRefs2 = (0, _slicedToArray2.default)(_useRefs, 2), - getBtnRef = _useRefs2[0], - removeBtnRef = _useRefs2[1]; - - var tabPositionTopOrBottom = tabPosition === 'top' || tabPosition === 'bottom'; - - var _useSyncState = (0, _useSyncState5.default)(0, function (next, prev) { - if (tabPositionTopOrBottom && onTabScroll) { - onTabScroll({ - direction: next > prev ? 'left' : 'right' - }); - } - }), - _useSyncState2 = (0, _slicedToArray2.default)(_useSyncState, 2), - transformLeft = _useSyncState2[0], - setTransformLeft = _useSyncState2[1]; - - var _useSyncState3 = (0, _useSyncState5.default)(0, function (next, prev) { - if (!tabPositionTopOrBottom && onTabScroll) { - onTabScroll({ - direction: next > prev ? 'top' : 'bottom' - }); - } - }), - _useSyncState4 = (0, _slicedToArray2.default)(_useSyncState3, 2), - transformTop = _useSyncState4[0], - setTransformTop = _useSyncState4[1]; - - var _useState = (0, React.useState)(0), - _useState2 = (0, _slicedToArray2.default)(_useState, 2), - wrapperScrollWidth = _useState2[0], - setWrapperScrollWidth = _useState2[1]; - - var _useState3 = (0, React.useState)(0), - _useState4 = (0, _slicedToArray2.default)(_useState3, 2), - wrapperScrollHeight = _useState4[0], - setWrapperScrollHeight = _useState4[1]; - - var _useState5 = (0, React.useState)(null), - _useState6 = (0, _slicedToArray2.default)(_useState5, 2), - wrapperWidth = _useState6[0], - setWrapperWidth = _useState6[1]; - - var _useState7 = (0, React.useState)(null), - _useState8 = (0, _slicedToArray2.default)(_useState7, 2), - wrapperHeight = _useState8[0], - setWrapperHeight = _useState8[1]; - - var _useState9 = (0, React.useState)(0), - _useState10 = (0, _slicedToArray2.default)(_useState9, 2), - addWidth = _useState10[0], - setAddWidth = _useState10[1]; - - var _useState11 = (0, React.useState)(0), - _useState12 = (0, _slicedToArray2.default)(_useState11, 2), - addHeight = _useState12[0], - setAddHeight = _useState12[1]; - - var _useRafState = (0, _useRaf.useRafState)(new Map()), - _useRafState2 = (0, _slicedToArray2.default)(_useRafState, 2), - tabSizes = _useRafState2[0], - setTabSizes = _useRafState2[1]; - - var tabOffsets = (0, _useOffsets.default)(tabs, tabSizes, wrapperScrollWidth); // ========================== Util ========================= - - var operationsHiddenClassName = "".concat(prefixCls, "-nav-operations-hidden"); - var transformMin = 0; - var transformMax = 0; - - if (!tabPositionTopOrBottom) { - transformMin = Math.min(0, wrapperHeight - wrapperScrollHeight); - transformMax = 0; - } else if (rtl) { - transformMin = 0; - transformMax = Math.max(0, wrapperScrollWidth - wrapperWidth); - } else { - transformMin = Math.min(0, wrapperWidth - wrapperScrollWidth); - transformMax = 0; - } +var _MenuContext = require("./context/MenuContext"); - function alignInRange(value) { - if (value < transformMin) { - return transformMin; - } +var _PathContext = require("./context/PathContext"); - if (value > transformMax) { - return transformMax; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - return value; - } // ========================= Mobile ======================== +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - var touchMovingRef = (0, React.useRef)(); +function Divider(_ref) { + var className = _ref.className, + style = _ref.style; - var _useState13 = (0, React.useState)(), - _useState14 = (0, _slicedToArray2.default)(_useState13, 2), - lockAnimation = _useState14[0], - setLockAnimation = _useState14[1]; + var _React$useContext = React.useContext(_MenuContext.MenuContext), + prefixCls = _React$useContext.prefixCls; - function doLockAnimation() { - setLockAnimation(Date.now()); + var measure = (0, _PathContext.useMeasure)(); + + if (measure) { + return null; } - function clearTouchMoving() { - window.clearTimeout(touchMovingRef.current); + return /*#__PURE__*/React.createElement("li", { + className: (0, _classnames.default)("".concat(prefixCls, "-item-divider"), className), + style: style + }); +} +},{"react":"n8MK","classnames":"yl9j","./context/MenuContext":"WRUc","./context/PathContext":"thAF"}],"VH7R":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Divider", { + enumerable: true, + get: function () { + return _Divider.default; + } +}); +Object.defineProperty(exports, "Item", { + enumerable: true, + get: function () { + return _MenuItem.default; + } +}); +Object.defineProperty(exports, "ItemGroup", { + enumerable: true, + get: function () { + return _MenuItemGroup.default; + } +}); +Object.defineProperty(exports, "MenuItem", { + enumerable: true, + get: function () { + return _MenuItem.default; + } +}); +Object.defineProperty(exports, "MenuItemGroup", { + enumerable: true, + get: function () { + return _MenuItemGroup.default; + } +}); +Object.defineProperty(exports, "SubMenu", { + enumerable: true, + get: function () { + return _SubMenu.default; + } +}); +exports.default = void 0; +Object.defineProperty(exports, "useFullPath", { + enumerable: true, + get: function () { + return _PathContext.useFullPath; } +}); - (0, _useTouchMove.default)(tabsWrapperRef, function (offsetX, offsetY) { - function doMove(setState, offset) { - setState(function (value) { - var newValue = alignInRange(value + offset); - return newValue; - }); - } +var _Menu = _interopRequireDefault(require("./Menu")); - if (tabPositionTopOrBottom) { - // Skip scroll if place is enough - if (wrapperWidth >= wrapperScrollWidth) { - return false; - } +var _MenuItem = _interopRequireDefault(require("./MenuItem")); - doMove(setTransformLeft, offsetX); - } else { - if (wrapperHeight >= wrapperScrollHeight) { - return false; - } +var _SubMenu = _interopRequireDefault(require("./SubMenu")); - doMove(setTransformTop, offsetY); - } +var _MenuItemGroup = _interopRequireDefault(require("./MenuItemGroup")); - clearTouchMoving(); - doLockAnimation(); - return true; - }); - (0, React.useEffect)(function () { - clearTouchMoving(); +var _PathContext = require("./context/PathContext"); - if (lockAnimation) { - touchMovingRef.current = window.setTimeout(function () { - setLockAnimation(0); - }, 100); - } +var _Divider = _interopRequireDefault(require("./Divider")); - return clearTouchMoving; - }, [lockAnimation]); // ========================= Scroll ======================== +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function scrollToTab() { - var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : activeKey; - var tabOffset = tabOffsets.get(key) || { - width: 0, - height: 0, - left: 0, - right: 0, - top: 0 - }; +var ExportMenu = _Menu.default; +ExportMenu.Item = _MenuItem.default; +ExportMenu.SubMenu = _SubMenu.default; +ExportMenu.ItemGroup = _MenuItemGroup.default; +ExportMenu.Divider = _Divider.default; +var _default = ExportMenu; +exports.default = _default; +},{"./Menu":"JLqT","./MenuItem":"NeBp","./SubMenu":"lVAn","./MenuItemGroup":"vrf4","./context/PathContext":"thAF","./Divider":"hlbq"}],"MhTA":[function(require,module,exports) { +"use strict"; - if (tabPositionTopOrBottom) { - // ============ Align with top & bottom ============ - var newTransform = transformLeft; // RTL +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; - if (rtl) { - if (tabOffset.right < transformLeft) { - newTransform = tabOffset.right; - } else if (tabOffset.right + tabOffset.width > transformLeft + wrapperWidth) { - newTransform = tabOffset.right + tabOffset.width - wrapperWidth; - } - } // LTR - else if (tabOffset.left < -transformLeft) { - newTransform = -tabOffset.left; - } else if (tabOffset.left + tabOffset.width > -transformLeft + wrapperWidth) { - newTransform = -(tabOffset.left + tabOffset.width - wrapperWidth); - } +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); - setTransformTop(0); - setTransformLeft(alignInRange(newTransform)); - } else { - // ============ Align with left & right ============ - var _newTransform = transformTop; +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); - if (tabOffset.top < -transformTop) { - _newTransform = -tabOffset.top; - } else if (tabOffset.top + tabOffset.height > -transformTop + wrapperHeight) { - _newTransform = -(tabOffset.top + tabOffset.height - wrapperHeight); - } +var _classnames = _interopRequireDefault(require("classnames")); - setTransformLeft(0); - setTransformTop(alignInRange(_newTransform)); - } - } // ========================== Tab ========================== - // Render tab node & collect tab offset +var _rcDropdown = _interopRequireDefault(require("rc-dropdown")); +var _rcMenu = _interopRequireWildcard(require("rc-menu")); - var _useVisibleRange = (0, _useVisibleRange3.default)(tabOffsets, { - width: wrapperWidth, - height: wrapperHeight, - left: transformLeft, - top: transformTop - }, { - width: wrapperScrollWidth, - height: wrapperScrollHeight - }, { - width: addWidth, - height: addHeight - }, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, { - tabs: tabs - })), - _useVisibleRange2 = (0, _slicedToArray2.default)(_useVisibleRange, 2), - visibleStart = _useVisibleRange2[0], - visibleEnd = _useVisibleRange2[1]; +var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); - var tabNodeStyle = {}; +var React = _interopRequireWildcard(require("react")); - if (tabPosition === 'top' || tabPosition === 'bottom') { - tabNodeStyle[rtl ? 'marginRight' : 'marginLeft'] = tabBarGutter; - } else { - tabNodeStyle.marginTop = tabBarGutter; - } +var _AddButton = _interopRequireDefault(require("./AddButton")); - var tabNodes = tabs.map(function (tab, i) { - var key = tab.key; - return /*#__PURE__*/React.createElement(_TabNode.default, { - id: id, - prefixCls: prefixCls, - key: key, - tab: tab - /* first node should not have margin left */ - , - style: i === 0 ? undefined : tabNodeStyle, - closable: tab.closable, - editable: editable, - active: key === activeKey, - renderWrapper: children, - removeAriaLabel: locale === null || locale === void 0 ? void 0 : locale.removeAriaLabel, - ref: getBtnRef(key), - onClick: function onClick(e) { - onTabClick(key, e); - }, - onRemove: function onRemove() { - removeBtnRef(key); - }, - onFocus: function onFocus() { - scrollToTab(key); - doLockAnimation(); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - if (!tabsWrapperRef.current) { - return; - } // Focus element will make scrollLeft change which we should reset back +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - if (!rtl) { - tabsWrapperRef.current.scrollLeft = 0; - } +function OperationNode(_ref, ref) { + var prefixCls = _ref.prefixCls, + id = _ref.id, + tabs = _ref.tabs, + locale = _ref.locale, + mobile = _ref.mobile, + _ref$moreIcon = _ref.moreIcon, + moreIcon = _ref$moreIcon === void 0 ? 'More' : _ref$moreIcon, + moreTransitionName = _ref.moreTransitionName, + style = _ref.style, + className = _ref.className, + editable = _ref.editable, + tabBarGutter = _ref.tabBarGutter, + rtl = _ref.rtl, + removeAriaLabel = _ref.removeAriaLabel, + onTabClick = _ref.onTabClick, + getPopupContainer = _ref.getPopupContainer, + popupClassName = _ref.popupClassName; // ======================== Dropdown ======================== - tabsWrapperRef.current.scrollTop = 0; + var _useState = (0, React.useState)(false), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + open = _useState2[0], + setOpen = _useState2[1]; + + var _useState3 = (0, React.useState)(null), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + selectedKey = _useState4[0], + setSelectedKey = _useState4[1]; + + var popupId = "".concat(id, "-more-popup"); + var dropdownPrefix = "".concat(prefixCls, "-dropdown"); + var selectedItemId = selectedKey !== null ? "".concat(popupId, "-").concat(selectedKey) : null; + var dropdownAriaLabel = locale === null || locale === void 0 ? void 0 : locale.dropdownAriaLabel; + + function onRemoveTab(event, key) { + event.preventDefault(); + event.stopPropagation(); + editable.onEdit('remove', { + key: key, + event: event + }); + } + + var menu = /*#__PURE__*/React.createElement(_rcMenu.default, { + onClick: function onClick(_ref2) { + var key = _ref2.key, + domEvent = _ref2.domEvent; + onTabClick(key, domEvent); + setOpen(false); + }, + prefixCls: "".concat(dropdownPrefix, "-menu"), + id: popupId, + tabIndex: -1, + role: "listbox", + "aria-activedescendant": selectedItemId, + selectedKeys: [selectedKey], + "aria-label": dropdownAriaLabel !== undefined ? dropdownAriaLabel : 'expanded dropdown' + }, tabs.map(function (tab) { + var removable = editable && tab.closable !== false && !tab.disabled; + return /*#__PURE__*/React.createElement(_rcMenu.MenuItem, { + key: tab.key, + id: "".concat(popupId, "-").concat(tab.key), + role: "option", + "aria-controls": id && "".concat(id, "-panel-").concat(tab.key), + disabled: tab.disabled + }, /*#__PURE__*/React.createElement("span", null, tab.label), removable && /*#__PURE__*/React.createElement("button", { + type: "button", + "aria-label": removeAriaLabel || 'remove', + tabIndex: 0, + className: "".concat(dropdownPrefix, "-menu-item-remove"), + onClick: function onClick(e) { + e.stopPropagation(); + onRemoveTab(e, tab.key); } - }); - }); - var onListHolderResize = (0, _useRaf.default)(function () { - var _tabsWrapperRef$curre, _tabsWrapperRef$curre2, _innerAddButtonRef$cu, _innerAddButtonRef$cu2, _tabListRef$current, _tabListRef$current2; // Update wrapper records - - - var offsetWidth = ((_tabsWrapperRef$curre = tabsWrapperRef.current) === null || _tabsWrapperRef$curre === void 0 ? void 0 : _tabsWrapperRef$curre.offsetWidth) || 0; - var offsetHeight = ((_tabsWrapperRef$curre2 = tabsWrapperRef.current) === null || _tabsWrapperRef$curre2 === void 0 ? void 0 : _tabsWrapperRef$curre2.offsetHeight) || 0; - var newAddWidth = ((_innerAddButtonRef$cu = innerAddButtonRef.current) === null || _innerAddButtonRef$cu === void 0 ? void 0 : _innerAddButtonRef$cu.offsetWidth) || 0; - var newAddHeight = ((_innerAddButtonRef$cu2 = innerAddButtonRef.current) === null || _innerAddButtonRef$cu2 === void 0 ? void 0 : _innerAddButtonRef$cu2.offsetHeight) || 0; - setWrapperWidth(offsetWidth); - setWrapperHeight(offsetHeight); - setAddWidth(newAddWidth); - setAddHeight(newAddHeight); - var newWrapperScrollWidth = (((_tabListRef$current = tabListRef.current) === null || _tabListRef$current === void 0 ? void 0 : _tabListRef$current.offsetWidth) || 0) - newAddWidth; - var newWrapperScrollHeight = (((_tabListRef$current2 = tabListRef.current) === null || _tabListRef$current2 === void 0 ? void 0 : _tabListRef$current2.offsetHeight) || 0) - newAddHeight; - setWrapperScrollWidth(newWrapperScrollWidth); - setWrapperScrollHeight(newWrapperScrollHeight); // Update buttons records - - setTabSizes(function () { - var newSizes = new Map(); - tabs.forEach(function (_ref2) { - var key = _ref2.key; - var btnNode = getBtnRef(key).current; + }, tab.closeIcon || editable.removeIcon || '×')); + })); - if (btnNode) { - newSizes.set(key, { - width: btnNode.offsetWidth, - height: btnNode.offsetHeight, - left: btnNode.offsetLeft, - top: btnNode.offsetTop - }); - } - }); - return newSizes; + function selectOffset(offset) { + var enabledTabs = tabs.filter(function (tab) { + return !tab.disabled; }); - }); // ======================== Dropdown ======================= + var selectedIndex = enabledTabs.findIndex(function (tab) { + return tab.key === selectedKey; + }) || 0; + var len = enabledTabs.length; - var startHiddenTabs = tabs.slice(0, visibleStart); - var endHiddenTabs = tabs.slice(visibleEnd + 1); - var hiddenTabs = [].concat((0, _toConsumableArray2.default)(startHiddenTabs), (0, _toConsumableArray2.default)(endHiddenTabs)); // =================== Link & Operations =================== + for (var i = 0; i < len; i += 1) { + selectedIndex = (selectedIndex + offset + len) % len; + var tab = enabledTabs[selectedIndex]; - var _useState15 = (0, React.useState)(), - _useState16 = (0, _slicedToArray2.default)(_useState15, 2), - inkStyle = _useState16[0], - setInkStyle = _useState16[1]; + if (!tab.disabled) { + setSelectedKey(tab.key); + return; + } + } + } - var activeTabOffset = tabOffsets.get(activeKey); // Delay set ink style to avoid remove tab blink + function onKeyDown(e) { + var which = e.which; - var inkBarRafRef = (0, React.useRef)(); + if (!open) { + if ([_KeyCode.default.DOWN, _KeyCode.default.SPACE, _KeyCode.default.ENTER].includes(which)) { + setOpen(true); + e.preventDefault(); + } - function cleanInkBarRaf() { - _raf.default.cancel(inkBarRafRef.current); - } + return; + } - (0, React.useEffect)(function () { - var newInkStyle = {}; + switch (which) { + case _KeyCode.default.UP: + selectOffset(-1); + e.preventDefault(); + break; - if (activeTabOffset) { - if (tabPositionTopOrBottom) { - if (rtl) { - newInkStyle.right = activeTabOffset.right; - } else { - newInkStyle.left = activeTabOffset.left; - } + case _KeyCode.default.DOWN: + selectOffset(1); + e.preventDefault(); + break; - newInkStyle.width = activeTabOffset.width; - } else { - newInkStyle.top = activeTabOffset.top; - newInkStyle.height = activeTabOffset.height; - } + case _KeyCode.default.ESC: + setOpen(false); + break; + + case _KeyCode.default.SPACE: + case _KeyCode.default.ENTER: + if (selectedKey !== null) onTabClick(selectedKey, e); + break; } + } // ========================= Effect ========================= - cleanInkBarRaf(); - inkBarRafRef.current = (0, _raf.default)(function () { - setInkStyle(newInkStyle); - }); - return cleanInkBarRaf; - }, [activeTabOffset, tabPositionTopOrBottom, rtl]); // ========================= Effect ======================== (0, React.useEffect)(function () { - scrollToTab(); - }, [activeKey, activeTabOffset, tabOffsets, tabPositionTopOrBottom]); // Should recalculate when rtl changed + // We use query element here to avoid React strict warning + var ele = document.getElementById(selectedItemId); + if (ele && ele.scrollIntoView) { + ele.scrollIntoView(false); + } + }, [selectedKey]); (0, React.useEffect)(function () { - onListHolderResize(); - }, [rtl, tabBarGutter, activeKey, tabs.map(function (tab) { - return tab.key; - }).join('_')]); // ========================= Render ======================== + if (!open) { + setSelectedKey(null); + } + }, [open]); // ========================= Render ========================= - var hasDropdown = !!hiddenTabs.length; - var wrapPrefix = "".concat(prefixCls, "-nav-wrap"); - var pingLeft; - var pingRight; - var pingTop; - var pingBottom; + var moreStyle = (0, _defineProperty2.default)({}, rtl ? 'marginRight' : 'marginLeft', tabBarGutter); - if (tabPositionTopOrBottom) { - if (rtl) { - pingRight = transformLeft > 0; - pingLeft = transformLeft + wrapperWidth < wrapperScrollWidth; - } else { - pingLeft = transformLeft < 0; - pingRight = -transformLeft + wrapperWidth < wrapperScrollWidth; - } - } else { - pingTop = transformTop < 0; - pingBottom = -transformTop + wrapperHeight < wrapperScrollHeight; + if (!tabs.length) { + moreStyle.visibility = 'hidden'; + moreStyle.order = 1; } + var overlayClassName = (0, _classnames.default)((0, _defineProperty2.default)({}, "".concat(dropdownPrefix, "-rtl"), rtl)); + var moreNode = mobile ? null : /*#__PURE__*/React.createElement(_rcDropdown.default, { + prefixCls: dropdownPrefix, + overlay: menu, + trigger: ['hover'], + visible: tabs.length ? open : false, + transitionName: moreTransitionName, + onVisibleChange: setOpen, + overlayClassName: (0, _classnames.default)(overlayClassName, popupClassName), + mouseEnterDelay: 0.1, + mouseLeaveDelay: 0.1, + getPopupContainer: getPopupContainer + }, /*#__PURE__*/React.createElement("button", { + type: "button", + className: "".concat(prefixCls, "-nav-more"), + style: moreStyle, + tabIndex: -1, + "aria-hidden": "true", + "aria-haspopup": "listbox", + "aria-controls": popupId, + id: "".concat(id, "-more"), + "aria-expanded": open, + onKeyDown: onKeyDown + }, moreIcon)); return /*#__PURE__*/React.createElement("div", { - ref: ref, - role: "tablist", - className: (0, _classnames.default)("".concat(prefixCls, "-nav"), className), + className: (0, _classnames.default)("".concat(prefixCls, "-nav-operations"), className), style: style, - onKeyDown: function onKeyDown() { - // No need animation when use keyboard - doLockAnimation(); - } - }, /*#__PURE__*/React.createElement(ExtraContent, { - position: "left", - extra: extra, - prefixCls: prefixCls - }), /*#__PURE__*/React.createElement(_rcResizeObserver.default, { - onResize: onListHolderResize - }, /*#__PURE__*/React.createElement("div", { - className: (0, _classnames.default)(wrapPrefix, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(wrapPrefix, "-ping-left"), pingLeft), (0, _defineProperty2.default)(_classNames, "".concat(wrapPrefix, "-ping-right"), pingRight), (0, _defineProperty2.default)(_classNames, "".concat(wrapPrefix, "-ping-top"), pingTop), (0, _defineProperty2.default)(_classNames, "".concat(wrapPrefix, "-ping-bottom"), pingBottom), _classNames)), - ref: tabsWrapperRef - }, /*#__PURE__*/React.createElement(_rcResizeObserver.default, { - onResize: onListHolderResize - }, /*#__PURE__*/React.createElement("div", { - ref: tabListRef, - className: "".concat(prefixCls, "-nav-list"), - style: { - transform: "translate(".concat(transformLeft, "px, ").concat(transformTop, "px)"), - transition: lockAnimation ? 'none' : undefined - } - }, tabNodes, /*#__PURE__*/React.createElement(_AddButton.default, { - ref: innerAddButtonRef, + ref: ref + }, moreNode, /*#__PURE__*/React.createElement(_AddButton.default, { prefixCls: prefixCls, locale: locale, - editable: editable, - style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, tabNodes.length === 0 ? undefined : tabNodeStyle), {}, { - visibility: hasDropdown ? 'hidden' : null - }) - }), /*#__PURE__*/React.createElement("div", { - className: (0, _classnames.default)("".concat(prefixCls, "-ink-bar"), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-ink-bar-animated"), animated.inkBar)), - style: inkStyle - }))))), /*#__PURE__*/React.createElement(_OperationNode.default, (0, _extends2.default)({}, props, { - removeAriaLabel: locale === null || locale === void 0 ? void 0 : locale.removeAriaLabel, - ref: operationsRef, - prefixCls: prefixCls, - tabs: hiddenTabs, - className: !hasDropdown && operationsHiddenClassName, - tabMoving: !!lockAnimation - })), /*#__PURE__*/React.createElement(ExtraContent, { - position: "right", - extra: extra, - prefixCls: prefixCls + editable: editable })); - /* eslint-enable */ } -var _default = /*#__PURE__*/React.forwardRef(TabNavList); - -exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/typeof":"xLw6","react":"n8MK","classnames":"qb7c","rc-util/es/raf":"adDJ","rc-resize-observer":"q9L5","../hooks/useRaf":"LCWf","./TabNode":"VleC","../hooks/useOffsets":"uhKO","../hooks/useVisibleRange":"eQ4Y","./OperationNode":"MhTA","../TabContext":"vHWa","../hooks/useTouchMove":"MZjt","../hooks/useRefs":"Sb61","./AddButton":"kT7Q","../hooks/useSyncState":"AAQN"}],"om2l":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true +var _default = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(OperationNode), function (_, next) { + return (// https://github.com/ant-design/ant-design/issues/32544 + // We'd better remove syntactic sugar in `rc-menu` since this has perf issue + next.tabMoving + ); }); -exports.default = TabPanelList; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); - -var React = _interopRequireWildcard(require("react")); - -var _classnames = _interopRequireDefault(require("classnames")); - -var _TabContext = _interopRequireDefault(require("../TabContext")); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function TabPanelList(_ref) { - var id = _ref.id, - activeKey = _ref.activeKey, - animated = _ref.animated, - tabPosition = _ref.tabPosition, - rtl = _ref.rtl, - destroyInactiveTabPane = _ref.destroyInactiveTabPane; - - var _React$useContext = React.useContext(_TabContext.default), - prefixCls = _React$useContext.prefixCls, - tabs = _React$useContext.tabs; - - var tabPaneAnimated = animated.tabPane; - var activeIndex = tabs.findIndex(function (tab) { - return tab.key === activeKey; - }); - return /*#__PURE__*/React.createElement("div", { - className: (0, _classnames.default)("".concat(prefixCls, "-content-holder")) - }, /*#__PURE__*/React.createElement("div", { - className: (0, _classnames.default)("".concat(prefixCls, "-content"), "".concat(prefixCls, "-content-").concat(tabPosition), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-content-animated"), tabPaneAnimated)), - style: activeIndex && tabPaneAnimated ? (0, _defineProperty2.default)({}, rtl ? 'marginRight' : 'marginLeft', "-".concat(activeIndex, "00%")) : null - }, tabs.map(function (tab) { - return /*#__PURE__*/React.cloneElement(tab.node, { - key: tab.key, - prefixCls: prefixCls, - tabKey: tab.key, - id: id, - animated: tabPaneAnimated, - active: tab.key === activeKey, - destroyInactiveTabPane: destroyInactiveTabPane - }); - }))); -} -},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","react":"n8MK","classnames":"qb7c","../TabContext":"vHWa"}],"Fb5J":[function(require,module,exports) { + +exports.default = _default; +},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/slicedToArray":"T12H","classnames":"yl9j","rc-dropdown":"SyQB","rc-menu":"VH7R","rc-util/es/KeyCode":"lynM","react":"n8MK","./AddButton":"kT7Q"}],"VleC":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = TabPane; +exports.default = void 0; -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +var _classnames = _interopRequireDefault(require("classnames")); + +var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); var React = _interopRequireWildcard(require("react")); -var _classnames = _interopRequireDefault(require("classnames")); +var _util = require("../util"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -16835,53 +19018,86 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function TabPane(_ref) { +function TabNode(_ref) { + var _classNames; + var prefixCls = _ref.prefixCls, - forceRender = _ref.forceRender, - className = _ref.className, - style = _ref.style, id = _ref.id, active = _ref.active, - animated = _ref.animated, - destroyInactiveTabPane = _ref.destroyInactiveTabPane, - tabKey = _ref.tabKey, - children = _ref.children; - - var _React$useState = React.useState(forceRender), - _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), - visited = _React$useState2[0], - setVisited = _React$useState2[1]; + _ref$tab = _ref.tab, + key = _ref$tab.key, + label = _ref$tab.label, + disabled = _ref$tab.disabled, + closeIcon = _ref$tab.closeIcon, + closable = _ref.closable, + renderWrapper = _ref.renderWrapper, + removeAriaLabel = _ref.removeAriaLabel, + editable = _ref.editable, + onClick = _ref.onClick, + onFocus = _ref.onFocus, + style = _ref.style; + var tabPrefix = "".concat(prefixCls, "-tab"); + var removable = editable && closable !== false && !disabled; - React.useEffect(function () { - if (active) { - setVisited(true); - } else if (destroyInactiveTabPane) { - setVisited(false); + function onInternalClick(e) { + if (disabled) { + return; } - }, [active, destroyInactiveTabPane]); - var mergedStyle = {}; - if (!active) { - if (animated) { - mergedStyle.visibility = 'hidden'; - mergedStyle.height = 0; - mergedStyle.overflowY = 'hidden'; - } else { - mergedStyle.display = 'none'; - } + onClick(e); } - return /*#__PURE__*/React.createElement("div", { - id: id && "".concat(id, "-panel-").concat(tabKey), - role: "tabpanel", - tabIndex: active ? 0 : -1, - "aria-labelledby": id && "".concat(id, "-tab-").concat(tabKey), - "aria-hidden": !active, - style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, mergedStyle), style), - className: (0, _classnames.default)("".concat(prefixCls, "-tabpane"), active && "".concat(prefixCls, "-tabpane-active"), className) - }, (active || visited || forceRender) && children); + function onRemoveTab(event) { + event.preventDefault(); + event.stopPropagation(); + editable.onEdit('remove', { + key: key, + event: event + }); + } + + var node = /*#__PURE__*/React.createElement("div", { + key: key // ref={ref} + , + "data-node-key": (0, _util.genDataNodeKey)(key), + className: (0, _classnames.default)(tabPrefix, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(tabPrefix, "-with-remove"), removable), (0, _defineProperty2.default)(_classNames, "".concat(tabPrefix, "-active"), active), (0, _defineProperty2.default)(_classNames, "".concat(tabPrefix, "-disabled"), disabled), _classNames)), + style: style, + onClick: onInternalClick + }, /*#__PURE__*/React.createElement("div", { + role: "tab", + "aria-selected": active, + id: id && "".concat(id, "-tab-").concat(key), + className: "".concat(tabPrefix, "-btn"), + "aria-controls": id && "".concat(id, "-panel-").concat(key), + "aria-disabled": disabled, + tabIndex: disabled ? null : 0, + onClick: function onClick(e) { + e.stopPropagation(); + onInternalClick(e); + }, + onKeyDown: function onKeyDown(e) { + if ([_KeyCode.default.SPACE, _KeyCode.default.ENTER].includes(e.which)) { + e.preventDefault(); + onInternalClick(e); + } + }, + onFocus: onFocus + }, label), removable && /*#__PURE__*/React.createElement("button", { + type: "button", + "aria-label": removeAriaLabel || 'remove', + tabIndex: 0, + className: "".concat(tabPrefix, "-remove"), + onClick: function onClick(e) { + e.stopPropagation(); + onRemoveTab(e); + } + }, closeIcon || editable.removeIcon || '×')); + return renderWrapper ? renderWrapper(node) : node; } -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","react":"n8MK","classnames":"qb7c"}],"zJYA":[function(require,module,exports) { + +var _default = TabNode; +exports.default = _default; +},{"@babel/runtime/helpers/esm/defineProperty":"gpd2","classnames":"yl9j","rc-util/es/KeyCode":"lynM","react":"n8MK","../util":"CUlO"}],"Piyq":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -16893,31 +19109,45 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/exten var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray")); + +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); +var _classnames = _interopRequireDefault(require("classnames")); -var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); +var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer")); -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); +var _useEvent = _interopRequireDefault(require("rc-util/es/hooks/useEvent")); + +var _raf = _interopRequireDefault(require("rc-util/es/raf")); + +var _ref3 = require("rc-util/es/ref"); var React = _interopRequireWildcard(require("react")); -var _classnames = _interopRequireDefault(require("classnames")); +var _useOffsets = _interopRequireDefault(require("../hooks/useOffsets")); -var _toArray = _interopRequireDefault(require("rc-util/es/Children/toArray")); +var _useSyncState5 = _interopRequireDefault(require("../hooks/useSyncState")); -var _isMobile = _interopRequireDefault(require("rc-util/es/isMobile")); +var _useTouchMove = _interopRequireDefault(require("../hooks/useTouchMove")); -var _useMergedState5 = _interopRequireDefault(require("rc-util/es/hooks/useMergedState")); +var _useUpdate = _interopRequireWildcard(require("../hooks/useUpdate")); -var _TabNavList = _interopRequireDefault(require("./TabNavList")); +var _useVisibleRange3 = _interopRequireDefault(require("../hooks/useVisibleRange")); -var _TabPanelList = _interopRequireDefault(require("./TabPanelList")); +var _TabContext = _interopRequireDefault(require("../TabContext")); -var _TabPane = _interopRequireDefault(require("./TabPanelList/TabPane")); +var _util = require("../util"); -var _TabContext = _interopRequireDefault(require("./TabContext")); +var _AddButton = _interopRequireDefault(require("./AddButton")); + +var _ExtraContent = _interopRequireDefault(require("./ExtraContent")); + +var _OperationNode = _interopRequireDefault(require("./OperationNode")); + +var _TabNode = _interopRequireDefault(require("./TabNode")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } @@ -16925,338 +19155,576 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _excluded = ["id", "prefixCls", "className", "children", "direction", "activeKey", "defaultActiveKey", "editable", "animated", "tabPosition", "tabBarGutter", "tabBarStyle", "tabBarExtraContent", "locale", "moreIcon", "moreTransitionName", "destroyInactiveTabPane", "renderTabBar", "onChange", "onTabClick", "onTabScroll", "getPopupContainer", "popupClassName"]; // Accessibility https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Tab_Role +var getSize = function getSize(refObj) { + var _ref = refObj.current || {}, + _ref$offsetWidth = _ref.offsetWidth, + offsetWidth = _ref$offsetWidth === void 0 ? 0 : _ref$offsetWidth, + _ref$offsetHeight = _ref.offsetHeight, + offsetHeight = _ref$offsetHeight === void 0 ? 0 : _ref$offsetHeight; + return [offsetWidth, offsetHeight]; +}; /** - * Should added antd: - * - type - * - * Removed: - * - onNextClick - * - onPrevClick - * - keyboard + * Convert `SizeInfo` to unit value. Such as [123, 456] with `top` position get `123` */ -// Used for accessibility -var uuid = 0; -function parseTabList(children) { - return (0, _toArray.default)(children).map(function (node) { - if ( /*#__PURE__*/React.isValidElement(node)) { - var key = node.key !== undefined ? String(node.key) : undefined; - return (0, _objectSpread2.default)((0, _objectSpread2.default)({ - key: key - }, node.props), {}, { - node: node - }); + +var getUnitValue = function getUnitValue(size, tabPositionTopOrBottom) { + return size[tabPositionTopOrBottom ? 0 : 1]; +}; + +function TabNavList(props, ref) { + var _classNames; + + var _React$useContext = React.useContext(_TabContext.default), + prefixCls = _React$useContext.prefixCls, + tabs = _React$useContext.tabs; + + var className = props.className, + style = props.style, + id = props.id, + animated = props.animated, + activeKey = props.activeKey, + rtl = props.rtl, + extra = props.extra, + editable = props.editable, + locale = props.locale, + tabPosition = props.tabPosition, + tabBarGutter = props.tabBarGutter, + children = props.children, + onTabClick = props.onTabClick, + onTabScroll = props.onTabScroll; + var containerRef = (0, React.useRef)(); + var extraLeftRef = (0, React.useRef)(); + var extraRightRef = (0, React.useRef)(); + var tabsWrapperRef = (0, React.useRef)(); + var tabListRef = (0, React.useRef)(); + var operationsRef = (0, React.useRef)(); + var innerAddButtonRef = (0, React.useRef)(); // const [getBtnRef, removeBtnRef] = useRefs(); + + var tabPositionTopOrBottom = tabPosition === 'top' || tabPosition === 'bottom'; + + var _useSyncState = (0, _useSyncState5.default)(0, function (next, prev) { + if (tabPositionTopOrBottom && onTabScroll) { + onTabScroll({ + direction: next > prev ? 'left' : 'right' + }); + } + }), + _useSyncState2 = (0, _slicedToArray2.default)(_useSyncState, 2), + transformLeft = _useSyncState2[0], + setTransformLeft = _useSyncState2[1]; + + var _useSyncState3 = (0, _useSyncState5.default)(0, function (next, prev) { + if (!tabPositionTopOrBottom && onTabScroll) { + onTabScroll({ + direction: next > prev ? 'top' : 'bottom' + }); + } + }), + _useSyncState4 = (0, _slicedToArray2.default)(_useSyncState3, 2), + transformTop = _useSyncState4[0], + setTransformTop = _useSyncState4[1]; + + var _useState = (0, React.useState)([0, 0]), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + containerExcludeExtraSize = _useState2[0], + setContainerExcludeExtraSize = _useState2[1]; + + var _useState3 = (0, React.useState)([0, 0]), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + tabContentSize = _useState4[0], + setTabContentSize = _useState4[1]; + + var _useState5 = (0, React.useState)([0, 0]), + _useState6 = (0, _slicedToArray2.default)(_useState5, 2), + addSize = _useState6[0], + setAddSize = _useState6[1]; + + var _useState7 = (0, React.useState)([0, 0]), + _useState8 = (0, _slicedToArray2.default)(_useState7, 2), + operationSize = _useState8[0], + setOperationSize = _useState8[1]; + + var _useUpdateState = (0, _useUpdate.useUpdateState)(new Map()), + _useUpdateState2 = (0, _slicedToArray2.default)(_useUpdateState, 2), + tabSizes = _useUpdateState2[0], + setTabSizes = _useUpdateState2[1]; + + var tabOffsets = (0, _useOffsets.default)(tabs, tabSizes, tabContentSize[0]); // ========================== Unit ========================= + + var containerExcludeExtraSizeValue = getUnitValue(containerExcludeExtraSize, tabPositionTopOrBottom); + var tabContentSizeValue = getUnitValue(tabContentSize, tabPositionTopOrBottom); + var addSizeValue = getUnitValue(addSize, tabPositionTopOrBottom); + var operationSizeValue = getUnitValue(operationSize, tabPositionTopOrBottom); + var needScroll = containerExcludeExtraSizeValue < tabContentSizeValue + addSizeValue; + var visibleTabContentValue = needScroll ? containerExcludeExtraSizeValue - operationSizeValue : containerExcludeExtraSizeValue - addSizeValue; // ========================== Util ========================= + + var operationsHiddenClassName = "".concat(prefixCls, "-nav-operations-hidden"); + var transformMin = 0; + var transformMax = 0; + + if (!tabPositionTopOrBottom) { + transformMin = Math.min(0, visibleTabContentValue - tabContentSizeValue); + transformMax = 0; + } else if (rtl) { + transformMin = 0; + transformMax = Math.max(0, tabContentSizeValue - visibleTabContentValue); + } else { + transformMin = Math.min(0, visibleTabContentValue - tabContentSizeValue); + transformMax = 0; + } + + function alignInRange(value) { + if (value < transformMin) { + return transformMin; + } + + if (value > transformMax) { + return transformMax; + } + + return value; + } // ========================= Mobile ======================== + + + var touchMovingRef = (0, React.useRef)(); + + var _useState9 = (0, React.useState)(), + _useState10 = (0, _slicedToArray2.default)(_useState9, 2), + lockAnimation = _useState10[0], + setLockAnimation = _useState10[1]; + + function doLockAnimation() { + setLockAnimation(Date.now()); + } + + function clearTouchMoving() { + window.clearTimeout(touchMovingRef.current); + } + + (0, _useTouchMove.default)(tabsWrapperRef, function (offsetX, offsetY) { + function doMove(setState, offset) { + setState(function (value) { + var newValue = alignInRange(value + offset); + return newValue; + }); + } // Skip scroll if place is enough + + + if (!needScroll) { + return false; + } + + if (tabPositionTopOrBottom) { + doMove(setTransformLeft, offsetX); + } else { + doMove(setTransformTop, offsetY); + } + + clearTouchMoving(); + doLockAnimation(); + return true; + }); + (0, React.useEffect)(function () { + clearTouchMoving(); + + if (lockAnimation) { + touchMovingRef.current = window.setTimeout(function () { + setLockAnimation(0); + }, 100); } - return null; - }).filter(function (tab) { - return tab; - }); -} + return clearTouchMoving; + }, [lockAnimation]); // ===================== Visible Range ===================== + // Render tab node & collect tab offset -function Tabs(_ref, ref) { - var _classNames; + var _useVisibleRange = (0, _useVisibleRange3.default)(tabOffsets, // Container + visibleTabContentValue, // Transform + tabPositionTopOrBottom ? transformLeft : transformTop, // Tabs + tabContentSizeValue, // Add + addSizeValue, // Operation + operationSizeValue, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, { + tabs: tabs + })), + _useVisibleRange2 = (0, _slicedToArray2.default)(_useVisibleRange, 2), + visibleStart = _useVisibleRange2[0], + visibleEnd = _useVisibleRange2[1]; // ========================= Scroll ======================== - var id = _ref.id, - _ref$prefixCls = _ref.prefixCls, - prefixCls = _ref$prefixCls === void 0 ? 'rc-tabs' : _ref$prefixCls, - className = _ref.className, - children = _ref.children, - direction = _ref.direction, - activeKey = _ref.activeKey, - defaultActiveKey = _ref.defaultActiveKey, - editable = _ref.editable, - _ref$animated = _ref.animated, - animated = _ref$animated === void 0 ? { - inkBar: true, - tabPane: false - } : _ref$animated, - _ref$tabPosition = _ref.tabPosition, - tabPosition = _ref$tabPosition === void 0 ? 'top' : _ref$tabPosition, - tabBarGutter = _ref.tabBarGutter, - tabBarStyle = _ref.tabBarStyle, - tabBarExtraContent = _ref.tabBarExtraContent, - locale = _ref.locale, - moreIcon = _ref.moreIcon, - moreTransitionName = _ref.moreTransitionName, - destroyInactiveTabPane = _ref.destroyInactiveTabPane, - renderTabBar = _ref.renderTabBar, - onChange = _ref.onChange, - onTabClick = _ref.onTabClick, - onTabScroll = _ref.onTabScroll, - getPopupContainer = _ref.getPopupContainer, - popupClassName = _ref.popupClassName, - restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); - var tabs = parseTabList(children); - var rtl = direction === 'rtl'; - var mergedAnimated; - if (animated === false) { - mergedAnimated = { - inkBar: false, - tabPane: false - }; - } else if (animated === true) { - mergedAnimated = { - inkBar: true, - tabPane: true + var scrollToTab = (0, _useEvent.default)(function () { + var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : activeKey; + var tabOffset = tabOffsets.get(key) || { + width: 0, + height: 0, + left: 0, + right: 0, + top: 0 }; - } else { - mergedAnimated = (0, _objectSpread2.default)({ - inkBar: true, - tabPane: false - }, (0, _typeof2.default)(animated) === 'object' ? animated : {}); - } // ======================== Mobile ======================== + if (tabPositionTopOrBottom) { + // ============ Align with top & bottom ============ + var newTransform = transformLeft; // RTL - var _useState = (0, React.useState)(false), - _useState2 = (0, _slicedToArray2.default)(_useState, 2), - mobile = _useState2[0], - setMobile = _useState2[1]; + if (rtl) { + if (tabOffset.right < transformLeft) { + newTransform = tabOffset.right; + } else if (tabOffset.right + tabOffset.width > transformLeft + visibleTabContentValue) { + newTransform = tabOffset.right + tabOffset.width - visibleTabContentValue; + } + } // LTR + else if (tabOffset.left < -transformLeft) { + newTransform = -tabOffset.left; + } else if (tabOffset.left + tabOffset.width > -transformLeft + visibleTabContentValue) { + newTransform = -(tabOffset.left + tabOffset.width - visibleTabContentValue); + } - (0, React.useEffect)(function () { - // Only update on the client side - setMobile((0, _isMobile.default)()); - }, []); // ====================== Active Key ====================== + setTransformTop(0); + setTransformLeft(alignInRange(newTransform)); + } else { + // ============ Align with left & right ============ + var _newTransform = transformTop; - var _useMergedState = (0, _useMergedState5.default)(function () { - var _tabs$; + if (tabOffset.top < -transformTop) { + _newTransform = -tabOffset.top; + } else if (tabOffset.top + tabOffset.height > -transformTop + visibleTabContentValue) { + _newTransform = -(tabOffset.top + tabOffset.height - visibleTabContentValue); + } - return (_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.key; - }, { - value: activeKey, - defaultValue: defaultActiveKey - }), - _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2), - mergedActiveKey = _useMergedState2[0], - setMergedActiveKey = _useMergedState2[1]; + setTransformLeft(0); + setTransformTop(alignInRange(_newTransform)); + } + }); // ========================== Tab ========================== - var _useState3 = (0, React.useState)(function () { - return tabs.findIndex(function (tab) { - return tab.key === mergedActiveKey; - }); - }), - _useState4 = (0, _slicedToArray2.default)(_useState3, 2), - activeIndex = _useState4[0], - setActiveIndex = _useState4[1]; // Reset active key if not exist anymore + var tabNodeStyle = {}; + if (tabPosition === 'top' || tabPosition === 'bottom') { + tabNodeStyle[rtl ? 'marginRight' : 'marginLeft'] = tabBarGutter; + } else { + tabNodeStyle.marginTop = tabBarGutter; + } - (0, React.useEffect)(function () { - var newActiveIndex = tabs.findIndex(function (tab) { - return tab.key === mergedActiveKey; + var tabNodes = tabs.map(function (tab, i) { + var key = tab.key; + return /*#__PURE__*/React.createElement(_TabNode.default, { + id: id, + prefixCls: prefixCls, + key: key, + tab: tab + /* first node should not have margin left */ + , + style: i === 0 ? undefined : tabNodeStyle, + closable: tab.closable, + editable: editable, + active: key === activeKey, + renderWrapper: children, + removeAriaLabel: locale === null || locale === void 0 ? void 0 : locale.removeAriaLabel, + onClick: function onClick(e) { + onTabClick(key, e); + }, + onFocus: function onFocus() { + scrollToTab(key); + doLockAnimation(); + + if (!tabsWrapperRef.current) { + return; + } // Focus element will make scrollLeft change which we should reset back + + + if (!rtl) { + tabsWrapperRef.current.scrollLeft = 0; + } + + tabsWrapperRef.current.scrollTop = 0; + } }); + }); // Update buttons records - if (newActiveIndex === -1) { - var _tabs$newActiveIndex; + var updateTabSizes = function updateTabSizes() { + return setTabSizes(function () { + var newSizes = new Map(); + tabs.forEach(function (_ref2) { + var _tabListRef$current; - newActiveIndex = Math.max(0, Math.min(activeIndex, tabs.length - 1)); - setMergedActiveKey((_tabs$newActiveIndex = tabs[newActiveIndex]) === null || _tabs$newActiveIndex === void 0 ? void 0 : _tabs$newActiveIndex.key); - } + var key = _ref2.key; + var btnNode = (_tabListRef$current = tabListRef.current) === null || _tabListRef$current === void 0 ? void 0 : _tabListRef$current.querySelector("[data-node-key=\"".concat((0, _util.genDataNodeKey)(key), "\"]")); - setActiveIndex(newActiveIndex); + if (btnNode) { + newSizes.set(key, { + width: btnNode.offsetWidth, + height: btnNode.offsetHeight, + left: btnNode.offsetLeft, + top: btnNode.offsetTop + }); + } + }); + return newSizes; + }); + }; + + (0, React.useEffect)(function () { + updateTabSizes(); }, [tabs.map(function (tab) { return tab.key; - }).join('_'), mergedActiveKey, activeIndex]); // ===================== Accessibility ==================== + }).join('_')]); + var onListHolderResize = (0, _useUpdate.default)(function () { + // Update wrapper records + var containerSize = getSize(containerRef); + var extraLeftSize = getSize(extraLeftRef); + var extraRightSize = getSize(extraRightRef); + setContainerExcludeExtraSize([containerSize[0] - extraLeftSize[0] - extraRightSize[0], containerSize[1] - extraLeftSize[1] - extraRightSize[1]]); + var newAddSize = getSize(innerAddButtonRef); + setAddSize(newAddSize); + var newOperationSize = getSize(operationsRef); + setOperationSize(newOperationSize); // Which includes add button size + + var tabContentFullSize = getSize(tabListRef); + setTabContentSize([tabContentFullSize[0] - newAddSize[0], tabContentFullSize[1] - newAddSize[1]]); // Update buttons records + + updateTabSizes(); + }); // ======================== Dropdown ======================= - var _useMergedState3 = (0, _useMergedState5.default)(null, { - value: id - }), - _useMergedState4 = (0, _slicedToArray2.default)(_useMergedState3, 2), - mergedId = _useMergedState4[0], - setMergedId = _useMergedState4[1]; + var startHiddenTabs = tabs.slice(0, visibleStart); + var endHiddenTabs = tabs.slice(visibleEnd + 1); + var hiddenTabs = [].concat((0, _toConsumableArray2.default)(startHiddenTabs), (0, _toConsumableArray2.default)(endHiddenTabs)); // =================== Link & Operations =================== - var mergedTabPosition = tabPosition; + var _useState11 = (0, React.useState)(), + _useState12 = (0, _slicedToArray2.default)(_useState11, 2), + inkStyle = _useState12[0], + setInkStyle = _useState12[1]; + + var activeTabOffset = tabOffsets.get(activeKey); // Delay set ink style to avoid remove tab blink - if (mobile && !['left', 'right'].includes(tabPosition)) { - mergedTabPosition = 'top'; - } // Async generate id to avoid ssr mapping failed + var inkBarRafRef = (0, React.useRef)(); + function cleanInkBarRaf() { + _raf.default.cancel(inkBarRafRef.current); + } (0, React.useEffect)(function () { - if (!id) { - setMergedId("rc-tabs-".concat("production" === 'test' ? 'test' : uuid)); - uuid += 1; - } - }, []); // ======================== Events ======================== + var newInkStyle = {}; - function onInternalTabClick(key, e) { - onTabClick === null || onTabClick === void 0 ? void 0 : onTabClick(key, e); - var isActiveChanged = key !== mergedActiveKey; - setMergedActiveKey(key); + if (activeTabOffset) { + if (tabPositionTopOrBottom) { + if (rtl) { + newInkStyle.right = activeTabOffset.right; + } else { + newInkStyle.left = activeTabOffset.left; + } - if (isActiveChanged) { - onChange === null || onChange === void 0 ? void 0 : onChange(key); + newInkStyle.width = activeTabOffset.width; + } else { + newInkStyle.top = activeTabOffset.top; + newInkStyle.height = activeTabOffset.height; + } } - } // ======================== Render ======================== + cleanInkBarRaf(); + inkBarRafRef.current = (0, _raf.default)(function () { + setInkStyle(newInkStyle); + }); + return cleanInkBarRaf; + }, [activeTabOffset, tabPositionTopOrBottom, rtl]); // ========================= Effect ======================== + + (0, React.useEffect)(function () { + scrollToTab(); // eslint-disable-next-line + }, [activeKey, transformMin, transformMax, (0, _util.stringify)(activeTabOffset), (0, _util.stringify)(tabOffsets), tabPositionTopOrBottom]); // Should recalculate when rtl changed - var sharedProps = { - id: mergedId, - activeKey: mergedActiveKey, - animated: mergedAnimated, - tabPosition: mergedTabPosition, - rtl: rtl, - mobile: mobile - }; - var tabNavBar; - var tabNavBarProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, sharedProps), {}, { - editable: editable, - locale: locale, - moreIcon: moreIcon, - moreTransitionName: moreTransitionName, - tabBarGutter: tabBarGutter, - onTabClick: onInternalTabClick, - onTabScroll: onTabScroll, - extra: tabBarExtraContent, - style: tabBarStyle, - panes: children, - getPopupContainer: getPopupContainer, - popupClassName: popupClassName - }); + (0, React.useEffect)(function () { + onListHolderResize(); // eslint-disable-next-line + }, [rtl]); // ========================= Render ======================== + + var hasDropdown = !!hiddenTabs.length; + var wrapPrefix = "".concat(prefixCls, "-nav-wrap"); + var pingLeft; + var pingRight; + var pingTop; + var pingBottom; - if (renderTabBar) { - tabNavBar = renderTabBar(tabNavBarProps, _TabNavList.default); + if (tabPositionTopOrBottom) { + if (rtl) { + pingRight = transformLeft > 0; + pingLeft = transformLeft !== transformMax; + } else { + pingLeft = transformLeft < 0; + pingRight = transformLeft !== transformMin; + } } else { - tabNavBar = /*#__PURE__*/React.createElement(_TabNavList.default, tabNavBarProps); + pingTop = transformTop < 0; + pingBottom = transformTop !== transformMin; } - return /*#__PURE__*/React.createElement(_TabContext.default.Provider, { - value: { - tabs: tabs, - prefixCls: prefixCls + return /*#__PURE__*/React.createElement(_rcResizeObserver.default, { + onResize: onListHolderResize + }, /*#__PURE__*/React.createElement("div", { + ref: (0, _ref3.useComposeRef)(ref, containerRef), + role: "tablist", + className: (0, _classnames.default)("".concat(prefixCls, "-nav"), className), + style: style, + onKeyDown: function onKeyDown() { + // No need animation when use keyboard + doLockAnimation(); } - }, /*#__PURE__*/React.createElement("div", (0, _extends2.default)({ - ref: ref, - id: id, - className: (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-").concat(mergedTabPosition), (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-mobile"), mobile), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-editable"), editable), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-rtl"), rtl), _classNames), className) - }, restProps), tabNavBar, /*#__PURE__*/React.createElement(_TabPanelList.default, (0, _extends2.default)({ - destroyInactiveTabPane: destroyInactiveTabPane - }, sharedProps, { - animated: mergedAnimated - })))); + }, /*#__PURE__*/React.createElement(_ExtraContent.default, { + ref: extraLeftRef, + position: "left", + extra: extra, + prefixCls: prefixCls + }), /*#__PURE__*/React.createElement("div", { + className: (0, _classnames.default)(wrapPrefix, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(wrapPrefix, "-ping-left"), pingLeft), (0, _defineProperty2.default)(_classNames, "".concat(wrapPrefix, "-ping-right"), pingRight), (0, _defineProperty2.default)(_classNames, "".concat(wrapPrefix, "-ping-top"), pingTop), (0, _defineProperty2.default)(_classNames, "".concat(wrapPrefix, "-ping-bottom"), pingBottom), _classNames)), + ref: tabsWrapperRef + }, /*#__PURE__*/React.createElement(_rcResizeObserver.default, { + onResize: onListHolderResize + }, /*#__PURE__*/React.createElement("div", { + ref: tabListRef, + className: "".concat(prefixCls, "-nav-list"), + style: { + transform: "translate(".concat(transformLeft, "px, ").concat(transformTop, "px)"), + transition: lockAnimation ? 'none' : undefined + } + }, tabNodes, /*#__PURE__*/React.createElement(_AddButton.default, { + ref: innerAddButtonRef, + prefixCls: prefixCls, + locale: locale, + editable: editable, + style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, tabNodes.length === 0 ? undefined : tabNodeStyle), {}, { + visibility: hasDropdown ? 'hidden' : null + }) + }), /*#__PURE__*/React.createElement("div", { + className: (0, _classnames.default)("".concat(prefixCls, "-ink-bar"), (0, _defineProperty2.default)({}, "".concat(prefixCls, "-ink-bar-animated"), animated.inkBar)), + style: inkStyle + })))), /*#__PURE__*/React.createElement(_OperationNode.default, (0, _extends2.default)({}, props, { + removeAriaLabel: locale === null || locale === void 0 ? void 0 : locale.removeAriaLabel, + ref: operationsRef, + prefixCls: prefixCls, + tabs: hiddenTabs, + className: !hasDropdown && operationsHiddenClassName, + tabMoving: !!lockAnimation + })), /*#__PURE__*/React.createElement(_ExtraContent.default, { + ref: extraRightRef, + position: "right", + extra: extra, + prefixCls: prefixCls + }))); + /* eslint-enable */ } -var ForwardTabs = /*#__PURE__*/React.forwardRef(Tabs); -ForwardTabs.TabPane = _TabPane.default; -var _default = ForwardTabs; +var _default = /*#__PURE__*/React.forwardRef(TabNavList); + exports.default = _default; -},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/typeof":"xLw6","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","@babel/runtime/helpers/esm/objectSpread2":"UKeT","react":"n8MK","classnames":"qb7c","rc-util/es/Children/toArray":"artt","rc-util/es/isMobile":"nb8J","rc-util/es/hooks/useMergedState":"zMpY","./TabNavList":"Piyq","./TabPanelList":"om2l","./TabPanelList/TabPane":"Fb5J","./TabContext":"vHWa"}],"FgVr":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/toConsumableArray":"Qv3s","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","classnames":"yl9j","rc-resize-observer":"q9L5","rc-util/es/hooks/useEvent":"ssYe","rc-util/es/raf":"dtu8","rc-util/es/ref":"lrsr","react":"n8MK","../hooks/useOffsets":"uhKO","../hooks/useSyncState":"AAQN","../hooks/useTouchMove":"MZjt","../hooks/useUpdate":"yzOp","../hooks/useVisibleRange":"eQ4Y","../TabContext":"vHWa","../util":"CUlO","./AddButton":"kT7Q","./ExtraContent":"Btc5","./OperationNode":"MhTA","./TabNode":"VleC"}],"n6Yn":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -Object.defineProperty(exports, "TabPane", { - enumerable: true, - get: function () { - return _TabPane.default; - } -}); -exports.default = void 0; - -var _Tabs = _interopRequireDefault(require("./Tabs")); +exports.default = TabNavListWrapper; -var _TabPane = _interopRequireDefault(require("./TabPanelList/TabPane")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); -var _default = _Tabs.default; -exports.default = _default; -},{"./Tabs":"zJYA","./TabPanelList/TabPane":"Fb5J"}],"FshY":[function(require,module,exports) { -"use strict"; +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = useAccessibility; +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); var React = _interopRequireWildcard(require("react")); -var _KeyCode = _interopRequireDefault(require("rc-util/es/KeyCode")); +var _ = _interopRequireDefault(require(".")); -var _raf = _interopRequireDefault(require("rc-util/es/raf")); +var _TabContext = _interopRequireDefault(require("../TabContext")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _TabPane = _interopRequireDefault(require("../TabPanelList/TabPane")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -var ESC = _KeyCode.default.ESC, - TAB = _KeyCode.default.TAB; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function useAccessibility(_ref) { - var visible = _ref.visible, - setTriggerVisible = _ref.setTriggerVisible, - triggerRef = _ref.triggerRef, - menuRef = _ref.menuRef, - onVisibleChange = _ref.onVisibleChange, - autoFocus = _ref.autoFocus; - var focusMenuRef = React.useRef(false); +var _excluded = ["renderTabBar"], + _excluded2 = ["label", "key"]; // zombieJ: To compatible with `renderTabBar` usage. - var handleCloseMenuAndReturnFocus = function handleCloseMenuAndReturnFocus() { - if (visible && triggerRef.current) { - var _triggerRef$current, _triggerRef$current$t, _triggerRef$current$t2, _triggerRef$current$t3; +// We have to create a TabNavList components. +function TabNavListWrapper(_ref) { + var renderTabBar = _ref.renderTabBar, + restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); - (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : (_triggerRef$current$t = _triggerRef$current.triggerRef) === null || _triggerRef$current$t === void 0 ? void 0 : (_triggerRef$current$t2 = _triggerRef$current$t.current) === null || _triggerRef$current$t2 === void 0 ? void 0 : (_triggerRef$current$t3 = _triggerRef$current$t2.focus) === null || _triggerRef$current$t3 === void 0 ? void 0 : _triggerRef$current$t3.call(_triggerRef$current$t2); - setTriggerVisible(false); + var _React$useContext = React.useContext(_TabContext.default), + tabs = _React$useContext.tabs; - if (typeof onVisibleChange === 'function') { - onVisibleChange(false); - } - } - }; + if (renderTabBar) { + var tabNavBarProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, restProps), {}, { + // Legacy support. We do not use this actually + panes: tabs.map(function (_ref2) { + var label = _ref2.label, + key = _ref2.key, + restTabProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2); + return /*#__PURE__*/React.createElement(_TabPane.default, (0, _extends2.default)({ + tab: label, + key: key, + tabKey: key + }, restTabProps)); + }) + }); + return renderTabBar(tabNavBarProps, _.default); + } - var focusMenu = function focusMenu() { - var _menuRef$current, _menuRef$current$focu; + return /*#__PURE__*/React.createElement(_.default, restProps); +} +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK",".":"Piyq","../TabContext":"vHWa","../TabPanelList/TabPane":"Fb5J"}],"IOfK":[function(require,module,exports) { +"use strict"; - (_menuRef$current = menuRef.current) === null || _menuRef$current === void 0 ? void 0 : (_menuRef$current$focu = _menuRef$current.focus) === null || _menuRef$current$focu === void 0 ? void 0 : _menuRef$current$focu.call(_menuRef$current); - focusMenuRef.current = true; - }; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = useAnimateConfig; - var handleKeyDown = function handleKeyDown(event) { - var _menuRef$current2; +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); - switch (event.keyCode) { - case ESC: - handleCloseMenuAndReturnFocus(); - break; +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); - case TAB: - if (!focusMenuRef.current && ((_menuRef$current2 = menuRef.current) === null || _menuRef$current2 === void 0 ? void 0 : _menuRef$current2.focus)) { - event.preventDefault(); - focusMenu(); - } else { - handleCloseMenuAndReturnFocus(); - } +var _warning = _interopRequireDefault(require("rc-util/es/warning")); - break; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function useAnimateConfig() { + var animated = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { + inkBar: true, + tabPane: false }; + var mergedAnimated; - React.useEffect(function () { - if (visible) { - window.addEventListener('keydown', handleKeyDown); + if (animated === false) { + mergedAnimated = { + inkBar: false, + tabPane: false + }; + } else if (animated === true) { + mergedAnimated = { + inkBar: true, + tabPane: false + }; + } else { + mergedAnimated = (0, _objectSpread2.default)({ + inkBar: true + }, (0, _typeof2.default)(animated) === 'object' ? animated : {}); + } // Enable tabPane animation if provide motion - if (autoFocus) { - // FIXME: hack with raf - (0, _raf.default)(focusMenu, 3); - } - return function () { - window.removeEventListener('keydown', handleKeyDown); - focusMenuRef.current = false; - }; + if (mergedAnimated.tabPaneMotion && mergedAnimated.tabPane === undefined) { + mergedAnimated.tabPane = true; + } + + if (!mergedAnimated.tabPaneMotion && mergedAnimated.tabPane) { + if ("production" !== 'production') { + (0, _warning.default)(false, '`animated.tabPane` is true but `animated.tabPaneMotion` is not provided. Motion will not work.'); } - return function () { - focusMenuRef.current = false; - }; - }, [visible]); // eslint-disable-line react-hooks/exhaustive-deps + mergedAnimated.tabPane = false; + } + + return mergedAnimated; } -},{"react":"n8MK","rc-util/es/KeyCode":"Imvn","rc-util/es/raf":"adDJ"}],"rgdw":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/typeof":"xLw6","@babel/runtime/helpers/esm/objectSpread2":"UKeT","rc-util/es/warning":"orzV"}],"zJYA":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -17264,206 +19732,216 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/extends")); var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty")); +var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2")); + var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray")); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/typeof")); + var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties")); var React = _interopRequireWildcard(require("react")); -var _rcTrigger = _interopRequireDefault(require("rc-trigger")); - var _classnames = _interopRequireDefault(require("classnames")); -var _placements = _interopRequireDefault(require("./placements")); - -var _useAccessibility = _interopRequireDefault(require("./hooks/useAccessibility")); - -var _ref = require("rc-util/es/ref"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +var _isMobile = _interopRequireDefault(require("rc-util/es/isMobile")); -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var _useMergedState5 = _interopRequireDefault(require("rc-util/es/hooks/useMergedState")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _TabPanelList = _interopRequireDefault(require("./TabPanelList")); -var _excluded = ["arrow", "prefixCls", "transitionName", "animation", "align", "placement", "placements", "getPopupContainer", "showAction", "hideAction", "overlayClassName", "overlayStyle", "visible", "trigger", "autoFocus"]; +var _TabContext = _interopRequireDefault(require("./TabContext")); -function Dropdown(props, ref) { - var _props$arrow = props.arrow, - arrow = _props$arrow === void 0 ? false : _props$arrow, - _props$prefixCls = props.prefixCls, - prefixCls = _props$prefixCls === void 0 ? 'rc-dropdown' : _props$prefixCls, - transitionName = props.transitionName, - animation = props.animation, - align = props.align, - _props$placement = props.placement, - placement = _props$placement === void 0 ? 'bottomLeft' : _props$placement, - _props$placements = props.placements, - placements = _props$placements === void 0 ? _placements.default : _props$placements, - getPopupContainer = props.getPopupContainer, - showAction = props.showAction, - hideAction = props.hideAction, - overlayClassName = props.overlayClassName, - overlayStyle = props.overlayStyle, - visible = props.visible, - _props$trigger = props.trigger, - trigger = _props$trigger === void 0 ? ['hover'] : _props$trigger, - autoFocus = props.autoFocus, - otherProps = (0, _objectWithoutProperties2.default)(props, _excluded); +var _Wrapper = _interopRequireDefault(require("./TabNavList/Wrapper")); - var _React$useState = React.useState(), - _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), - triggerVisible = _React$useState2[0], - setTriggerVisible = _React$useState2[1]; +var _useAnimateConfig = _interopRequireDefault(require("./hooks/useAnimateConfig")); - var mergedVisible = 'visible' in props ? visible : triggerVisible; - var triggerRef = React.useRef(null); - React.useImperativeHandle(ref, function () { - return triggerRef.current; - }); - var menuRef = React.useRef(null); - var menuClassName = "".concat(prefixCls, "-menu"); - (0, _useAccessibility.default)({ - visible: mergedVisible, - setTriggerVisible: setTriggerVisible, - triggerRef: triggerRef, - menuRef: menuRef, - onVisibleChange: props.onVisibleChange, - autoFocus: autoFocus - }); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - var getOverlayElement = function getOverlayElement() { - var overlay = props.overlay; - var overlayElement; +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - if (typeof overlay === 'function') { - overlayElement = overlay(); - } else { - overlayElement = overlay; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - return overlayElement; - }; +var _excluded = ["id", "prefixCls", "className", "items", "direction", "activeKey", "defaultActiveKey", "editable", "animated", "tabPosition", "tabBarGutter", "tabBarStyle", "tabBarExtraContent", "locale", "moreIcon", "moreTransitionName", "destroyInactiveTabPane", "renderTabBar", "onChange", "onTabClick", "onTabScroll", "getPopupContainer", "popupClassName"]; // Accessibility https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Tab_Role - var onClick = function onClick(e) { - var onOverlayClick = props.onOverlayClick; - var overlayProps = getOverlayElement().props; - setTriggerVisible(false); +/** + * Should added antd: + * - type + * + * Removed: + * - onNextClick + * - onPrevClick + * - keyboard + */ +// Used for accessibility +var uuid = 0; - if (onOverlayClick) { - onOverlayClick(e); - } +function Tabs(_ref, ref) { + var _classNames; - if (overlayProps.onClick) { - overlayProps.onClick(e); - } - }; + var id = _ref.id, + _ref$prefixCls = _ref.prefixCls, + prefixCls = _ref$prefixCls === void 0 ? 'rc-tabs' : _ref$prefixCls, + className = _ref.className, + items = _ref.items, + direction = _ref.direction, + activeKey = _ref.activeKey, + defaultActiveKey = _ref.defaultActiveKey, + editable = _ref.editable, + animated = _ref.animated, + _ref$tabPosition = _ref.tabPosition, + tabPosition = _ref$tabPosition === void 0 ? 'top' : _ref$tabPosition, + tabBarGutter = _ref.tabBarGutter, + tabBarStyle = _ref.tabBarStyle, + tabBarExtraContent = _ref.tabBarExtraContent, + locale = _ref.locale, + moreIcon = _ref.moreIcon, + moreTransitionName = _ref.moreTransitionName, + destroyInactiveTabPane = _ref.destroyInactiveTabPane, + renderTabBar = _ref.renderTabBar, + onChange = _ref.onChange, + onTabClick = _ref.onTabClick, + onTabScroll = _ref.onTabScroll, + getPopupContainer = _ref.getPopupContainer, + popupClassName = _ref.popupClassName, + restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); + var tabs = React.useMemo(function () { + return (items || []).filter(function (item) { + return item && (0, _typeof2.default)(item) === 'object' && 'key' in item; + }); + }, [items]); + var rtl = direction === 'rtl'; + var mergedAnimated = (0, _useAnimateConfig.default)(animated); // ======================== Mobile ======================== - var onVisibleChange = function onVisibleChange(newVisible) { - var onVisibleChangeProp = props.onVisibleChange; - setTriggerVisible(newVisible); + var _useState = (0, React.useState)(false), + _useState2 = (0, _slicedToArray2.default)(_useState, 2), + mobile = _useState2[0], + setMobile = _useState2[1]; - if (typeof onVisibleChangeProp === 'function') { - onVisibleChangeProp(newVisible); - } - }; + (0, React.useEffect)(function () { + // Only update on the client side + setMobile((0, _isMobile.default)()); + }, []); // ====================== Active Key ====================== - var getMenuElement = function getMenuElement() { - var _extraOverlayProps; + var _useMergedState = (0, _useMergedState5.default)(function () { + var _tabs$; - var overlayElement = getOverlayElement(); // @ts-ignore + return (_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.key; + }, { + value: activeKey, + defaultValue: defaultActiveKey + }), + _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2), + mergedActiveKey = _useMergedState2[0], + setMergedActiveKey = _useMergedState2[1]; - var composedMenuRef = (0, _ref.composeRef)(menuRef, overlayElement.ref); - var extraOverlayProps = (_extraOverlayProps = { - prefixCls: menuClassName - }, (0, _defineProperty2.default)(_extraOverlayProps, 'data-dropdown-inject', true), (0, _defineProperty2.default)(_extraOverlayProps, "onClick", onClick), (0, _defineProperty2.default)(_extraOverlayProps, "ref", (0, _ref.supportRef)(overlayElement) ? composedMenuRef : undefined), _extraOverlayProps); + var _useState3 = (0, React.useState)(function () { + return tabs.findIndex(function (tab) { + return tab.key === mergedActiveKey; + }); + }), + _useState4 = (0, _slicedToArray2.default)(_useState3, 2), + activeIndex = _useState4[0], + setActiveIndex = _useState4[1]; // Reset active key if not exist anymore - if (typeof overlayElement.type === 'string') { - delete extraOverlayProps.prefixCls; - delete extraOverlayProps['data-dropdown-inject']; - } - return /*#__PURE__*/React.createElement(React.Fragment, null, arrow && /*#__PURE__*/React.createElement("div", { - className: "".concat(prefixCls, "-arrow") - }), /*#__PURE__*/React.cloneElement(overlayElement, extraOverlayProps)); - }; + (0, React.useEffect)(function () { + var newActiveIndex = tabs.findIndex(function (tab) { + return tab.key === mergedActiveKey; + }); - var getMenuElementOrLambda = function getMenuElementOrLambda() { - var overlay = props.overlay; + if (newActiveIndex === -1) { + var _tabs$newActiveIndex; - if (typeof overlay === 'function') { - return getMenuElement; + newActiveIndex = Math.max(0, Math.min(activeIndex, tabs.length - 1)); + setMergedActiveKey((_tabs$newActiveIndex = tabs[newActiveIndex]) === null || _tabs$newActiveIndex === void 0 ? void 0 : _tabs$newActiveIndex.key); } - return getMenuElement(); - }; + setActiveIndex(newActiveIndex); + }, [tabs.map(function (tab) { + return tab.key; + }).join('_'), mergedActiveKey, activeIndex]); // ===================== Accessibility ==================== - var getMinOverlayWidthMatchTrigger = function getMinOverlayWidthMatchTrigger() { - var minOverlayWidthMatchTrigger = props.minOverlayWidthMatchTrigger, - alignPoint = props.alignPoint; + var _useMergedState3 = (0, _useMergedState5.default)(null, { + value: id + }), + _useMergedState4 = (0, _slicedToArray2.default)(_useMergedState3, 2), + mergedId = _useMergedState4[0], + setMergedId = _useMergedState4[1]; // Async generate id to avoid ssr mapping failed - if ('minOverlayWidthMatchTrigger' in props) { - return minOverlayWidthMatchTrigger; - } - return !alignPoint; - }; + (0, React.useEffect)(function () { + if (!id) { + setMergedId("rc-tabs-".concat("production" === 'test' ? 'test' : uuid)); + uuid += 1; + } + }, []); // ======================== Events ======================== - var getOpenClassName = function getOpenClassName() { - var openClassName = props.openClassName; + function onInternalTabClick(key, e) { + onTabClick === null || onTabClick === void 0 ? void 0 : onTabClick(key, e); + var isActiveChanged = key !== mergedActiveKey; + setMergedActiveKey(key); - if (openClassName !== undefined) { - return openClassName; + if (isActiveChanged) { + onChange === null || onChange === void 0 ? void 0 : onChange(key); } + } // ======================== Render ======================== - return "".concat(prefixCls, "-open"); - }; - var renderChildren = function renderChildren() { - var children = props.children; - var childrenProps = children.props ? children.props : {}; - var childClassName = (0, _classnames.default)(childrenProps.className, getOpenClassName()); - return mergedVisible && children ? /*#__PURE__*/React.cloneElement(children, { - className: childClassName - }) : children; + var sharedProps = { + id: mergedId, + activeKey: mergedActiveKey, + animated: mergedAnimated, + tabPosition: tabPosition, + rtl: rtl, + mobile: mobile }; + var tabNavBar; + var tabNavBarProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, sharedProps), {}, { + editable: editable, + locale: locale, + moreIcon: moreIcon, + moreTransitionName: moreTransitionName, + tabBarGutter: tabBarGutter, + onTabClick: onInternalTabClick, + onTabScroll: onTabScroll, + extra: tabBarExtraContent, + style: tabBarStyle, + panes: null, + getPopupContainer: getPopupContainer, + popupClassName: popupClassName + }); + return /*#__PURE__*/React.createElement(_TabContext.default.Provider, { + value: { + tabs: tabs, + prefixCls: prefixCls + } + }, /*#__PURE__*/React.createElement("div", (0, _extends2.default)({ + ref: ref, + id: id, + className: (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-").concat(tabPosition), (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-mobile"), mobile), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-editable"), editable), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-rtl"), rtl), _classNames), className) + }, restProps), tabNavBar, /*#__PURE__*/React.createElement(_Wrapper.default, (0, _extends2.default)({}, tabNavBarProps, { + renderTabBar: renderTabBar + })), /*#__PURE__*/React.createElement(_TabPanelList.default, (0, _extends2.default)({ + destroyInactiveTabPane: destroyInactiveTabPane + }, sharedProps, { + animated: mergedAnimated + })))); +} - var triggerHideAction = hideAction; - - if (!triggerHideAction && trigger.indexOf('contextMenu') !== -1) { - triggerHideAction = ['click']; - } +var ForwardTabs = /*#__PURE__*/React.forwardRef(Tabs); - return /*#__PURE__*/React.createElement(_rcTrigger.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({ - builtinPlacements: placements - }, otherProps), {}, { - prefixCls: prefixCls, - ref: triggerRef, - popupClassName: (0, _classnames.default)(overlayClassName, (0, _defineProperty2.default)({}, "".concat(prefixCls, "-show-arrow"), arrow)), - popupStyle: overlayStyle, - action: trigger, - showAction: showAction, - hideAction: triggerHideAction || [], - popupPlacement: placement, - popupAlign: align, - popupTransitionName: transitionName, - popupAnimation: animation, - popupVisible: mergedVisible, - stretch: getMinOverlayWidthMatchTrigger() ? 'minWidth' : '', - popup: getMenuElementOrLambda(), - onPopupVisibleChange: onVisibleChange, - getPopupContainer: getPopupContainer - }), renderChildren()); +if ("production" !== 'production') { + ForwardTabs.displayName = 'Tabs'; } -var _default = /*#__PURE__*/React.forwardRef(Dropdown); - +var _default = ForwardTabs; exports.default = _default; -},{"@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","rc-trigger":"PZMl","classnames":"qb7c","./placements":"K12W","./hooks/useAccessibility":"FshY","rc-util/es/ref":"AOnv"}],"SyQB":[function(require,module,exports) { +},{"@babel/runtime/helpers/esm/extends":"SpjQ","@babel/runtime/helpers/esm/defineProperty":"gpd2","@babel/runtime/helpers/esm/objectSpread2":"UKeT","@babel/runtime/helpers/esm/slicedToArray":"T12H","@babel/runtime/helpers/esm/typeof":"xLw6","@babel/runtime/helpers/esm/objectWithoutProperties":"tuNH","react":"n8MK","classnames":"yl9j","rc-util/es/isMobile":"R6MQ","rc-util/es/hooks/useMergedState":"w0MT","./TabPanelList":"om2l","./TabContext":"vHWa","./TabNavList/Wrapper":"n6Yn","./hooks/useAnimateConfig":"IOfK"}],"FgVr":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -17471,13 +19949,93 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -var _Dropdown = _interopRequireDefault(require("./Dropdown")); +var _Tabs = _interopRequireDefault(require("./Tabs")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _default = _Dropdown.default; +var _default = _Tabs.default; exports.default = _default; -},{"./Dropdown":"rgdw"}],"CZvM":[function(require,module,exports) { +},{"./Tabs":"zJYA"}],"qb7c":[function(require,module,exports) { +var define; +/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +/* global define */ + +(function () { + 'use strict'; + + var hasOwn = {}.hasOwnProperty; + + function classNames () { + var classes = ''; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (arg) { + classes = appendClass(classes, parseValue(arg)); + } + } + + return classes; + } + + function parseValue (arg) { + if (typeof arg === 'string' || typeof arg === 'number') { + return arg; + } + + if (typeof arg !== 'object') { + return ''; + } + + if (Array.isArray(arg)) { + return classNames.apply(null, arg); + } + + if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) { + return arg.toString(); + } + + var classes = ''; + + for (var key in arg) { + if (hasOwn.call(arg, key) && arg[key]) { + classes = appendClass(classes, key); + } + } + + return classes; + } + + function appendClass (value, newClass) { + if (!newClass) { + return value; + } + + if (value) { + return value + ' ' + newClass; + } + + return value + newClass; + } + + if (typeof module !== 'undefined' && module.exports) { + classNames.default = classNames; + module.exports = classNames; + } else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) { + // register as 'classnames', consistent with npm package name + define('classnames', [], function () { + return classNames; + }); + } else { + window.classNames = classNames; + } +}()); + +},{}],"CZvM":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { diff --git a/interfaces/dockdata.boxbase.html b/interfaces/dockdata.boxbase.html deleted file mode 100644 index bb31719c..00000000 --- a/interfaces/dockdata.boxbase.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - BoxBase | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface BoxBase

-
-
-
-
-
-
-
-

Hierarchy

-
    -
  • - BoxBase - -
  • -
-
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

children

-
children: (PanelBase | BoxBase)[]
- -
-
- -

Optional id

-
id: string
- -
-
-

id will be auto generated if it's undefined

-
-
-
-
- -

mode

-
mode: DockMode
- -
-
- -

Optional size

-
size: number
- -
-
-

The size in dock box, - width when in horizontal layout and height when in vertical layout

-
-
-
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.boxdata.html b/interfaces/dockdata.boxdata.html deleted file mode 100644 index a072a04f..00000000 --- a/interfaces/dockdata.boxdata.html +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - BoxData | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface BoxData

-
-
-
-
-
-
-
-
-
-

a box is the layout element that contains other boxes or panels

-
-
-
-
-

Hierarchy

-
    -
  • - BoxBase -
  • -
  • - BoxChild -
      -
    • - BoxData -
    • -
    -
  • -
-
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

children

-
children: (PanelData | BoxData)[]
- -
-
- -

Optional heightFlex

-
heightFlex: number
- -
-
- -

Optional id

-
id: string
- -
-
-

id will be auto generated if it's undefined

-
-
-
-
- -

Optional minHeight

-
minHeight: number
- -
-
- -

Optional minWidth

-
minWidth: number
- -
-
- -

mode

-
mode: DockMode
- -
-
- -

Optional parent

-
parent: BoxData
- -
-
- -

Optional size

-
size: number
- -
-
-

The size in dock box, - width when in horizontal layout and height when in vertical layout

-
-
-
-
- -

Optional widthFlex

-
widthFlex: number
- -
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.dockcontext.html b/interfaces/dockdata.dockcontext.html deleted file mode 100644 index 5f9bb4fe..00000000 --- a/interfaces/dockdata.dockcontext.html +++ /dev/null @@ -1,411 +0,0 @@ - - - - - - DockContext | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface DockContext

-
-
-
-
-
-
-
-

Hierarchy

-
    -
  • - DockContext -
  • -
-
-
-

Implemented by

- -
-
-

Index

-
-
-
-

Methods

- -
-
-
-
-
-

Methods

-
- -

dockMove

- -
    -
  • - -
    -
    -

    Move a tab or a panel, if source or target is already in the layout, you can use the find method to get it with id first

    -
    -
    -

    Parameters

    -
      -
    • -
      source: TabData | PanelData
      -
      -

      the source TabData or PanelData being moved

      -
        -
      • it can exist in the layout already
      • -
      • or can be a new tab or new panel that you want to add to the layout
      • -
      -
      -
    • -
    • -
      target: string | TabData | PanelData | BoxData
      -
      -

      where you want to drop the source, can be the id or target data model

      -
      -
    • -
    • -
      direction: DropDirection
      -
      -

      which direction to drop

      -
        -
      • when direction is 'after-tab' or 'before-tab', target must be TabData
      • -
      • when direction is 'remove' or 'front', target must be null
      • -
      • when direction is 'float', target doesn't matter. If this is called directly from code without any user interaction, source must be PanelData with x,y,w,h properties
      • -
      -
      -
    • -
    • -
      Optional floatPosition: FloatPosition
      -
      -

      position of float panel, used only when direction="float"

      -
      -
    • -
    -

    Returns void

    -
  • -
-
-
- -

find

- -
    -
  • - -
    -
    -

    Find PanelData or TabData by id

    -
    -
    -

    Parameters

    -
      -
    • -
      id: string
      -
    • -
    • -
      Optional filter: Filter
      -
    • -
    -

    Returns TabData | PanelData | BoxData

    -
  • -
-
-
- -

getGroup

- -
    -
  • - -
    -
    -

    Get the TabGroup defined in defaultLayout

    -
    -
    -

    Parameters

    -
      -
    • -
      name: string
      -
    • -
    -

    Returns TabGroup

    -
  • -
-
-
- -

navigateToPanel

-
    -
  • navigateToPanel(fromElement: HTMLElement, direction?: string): void
  • -
-
    -
  • - -
    -
    -

    Move focus to a dockpanel nearby

    -
    -
    -

    Parameters

    -
      -
    • -
      fromElement: HTMLElement
      -
    • -
    • -
      Optional direction: string
      -
      -
      -
    • -
    -

    Returns void

    -
  • -
-
-
- -

updateTab

-
    -
  • updateTab(id: string, newTab: TabData, makeActive?: boolean): boolean
  • -
-
    -
  • - -
    -
    -

    Update a tab with new TabData

    -
    -
    -

    Parameters

    -
      -
    • -
      id: string
      -
      -

      tab id to update

      -
      -
    • -
    • -
      newTab: TabData
      -
      -

      new tab data, if newTab is null, it only changes the active tab of parent panel

      -
      -
    • -
    • -
      Optional makeActive: boolean
      -
      -

      whether to make the tab the active child of parent panel

      -
      -
    • -
    -

    Returns boolean

    -

    returns false if the tab is not found

    -
  • -
-
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Method
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.floatposition.html b/interfaces/dockdata.floatposition.html deleted file mode 100644 index 4c129da2..00000000 --- a/interfaces/dockdata.floatposition.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - FloatPosition | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface FloatPosition

-
-
-
-
-
-
-
-

Hierarchy

- -
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

height

-
height: number
- -
-
- -

left

-
left: number
- -
-
- -

top

-
top: number
- -
-
- -

width

-
width: number
- -
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.floatsize.html b/interfaces/dockdata.floatsize.html deleted file mode 100644 index 3c216540..00000000 --- a/interfaces/dockdata.floatsize.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - FloatSize | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface FloatSize

-
-
-
-
-
-
-
-

Hierarchy

- -
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

height

-
height: number
- -
-
- -

width

-
width: number
- -
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.layoutbase.html b/interfaces/dockdata.layoutbase.html deleted file mode 100644 index b6ff6419..00000000 --- a/interfaces/dockdata.layoutbase.html +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - LayoutBase | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface LayoutBase

-
-
-
-
-
-
-
-

Hierarchy

- -
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

dockbox

-
dockbox: BoxBase
- -
-
- -

Optional floatbox

-
floatbox: BoxBase
- -
-
- -

Optional maxbox

-
maxbox: BoxBase
- -
-
- -

Optional windowbox

-
windowbox: BoxBase
- -
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.layoutdata.html b/interfaces/dockdata.layoutdata.html deleted file mode 100644 index 9f1473a1..00000000 --- a/interfaces/dockdata.layoutdata.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - LayoutData | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface LayoutData

-
-
-
-
-
-
-
-

Hierarchy

- -
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

dockbox

-
dockbox: BoxData
- -
-
-

dock box

-
-
-
-
- -

Optional floatbox

-
floatbox: BoxData
- -
-
-

float box, - Children must be PanelData, child box is not allowed

-
-
-
-
- -

Optional maxbox

-
maxbox: BoxData
- -
-
-

The maximized panel, - only one child allowed, child must be PanelData

-
-
-
-
- -

Optional windowbox

-
windowbox: BoxData
- -
-
-

window box, - Children must be PanelData, child box is not allowed

-
-
-
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.panelbase.html b/interfaces/dockdata.panelbase.html deleted file mode 100644 index 6e0ca3d4..00000000 --- a/interfaces/dockdata.panelbase.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - PanelBase | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface PanelBase

-
-
-
-
-
-
-
-

Hierarchy

- -
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

Optional activeId

-
activeId: string
- -
-
-

The id of current tab

-
-
-
-
- -

Optional group

-
group: string
- -
-
-

if group is undefined, it will be set to the group name of first tab

-
-
-
-
- -

Optional h

-
h: number
- -
-
-

float mode only

-
-
-
-
- -

Optional id

-
id: string
- -
-
-

id will be auto generated if it's undefined

-
-
-
-
- -

Optional size

-
size: number
- -
-
-

The size in dock box, - width when in horizontal layout and height when in vertical layout

-
-
-
-
- -

tabs

-
tabs: TabBase[]
- -
-
- -

Optional w

-
w: number
- -
-
-

float mode only

-
-
-
-
- -

Optional x

-
x: number
- -
-
-

float mode only

-
-
-
-
- -

Optional y

-
y: number
- -
-
-

float mode only

-
-
-
-
- -

Optional z

-
z: number
- -
-
-

float mode only

-
-
-
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.paneldata.html b/interfaces/dockdata.paneldata.html deleted file mode 100644 index b9c4875b..00000000 --- a/interfaces/dockdata.paneldata.html +++ /dev/null @@ -1,498 +0,0 @@ - - - - - - PanelData | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface PanelData

-
-
-
-
-
-
-
-
-
-

a panel is a visiaul container with tabs button in the title bar

-
-
-
-
-

Hierarchy

-
    -
  • - PanelBase -
  • -
  • - BoxChild -
      -
    • - PanelData -
    • -
    -
  • -
-
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

Optional activeId

-
activeId: string
- -
-
-

The id of current tab

-
-
-
-
- -

Optional group

-
group: string
- -
-
-

if group is undefined, it will be set to the group name of first tab

-
-
-
-
- -

Optional h

-
h: number
- -
-
-

float mode only

-
-
-
-
- -

Optional heightFlex

-
heightFlex: number
- -
-
- -

Optional id

-
id: string
- -
-
-

id will be auto generated if it's undefined

-
-
-
-
- -

Optional minHeight

-
minHeight: number
- -
-
- -

Optional minWidth

-
minWidth: number
- -
-
- -

Optional panelLock

-
panelLock: PanelLock
- -
-
-

addition information of a panel, - This prevents the panel from being removed when there is no tab inside - a locked panel can not be moved to float layer either

-
-
-
-
- -

Optional parent

-
parent: BoxData
- -
-
- -

Optional size

-
size: number
- -
-
-

The size in dock box, - width when in horizontal layout and height when in vertical layout

-
-
-
-
- -

tabs

-
tabs: TabData[]
- -
-
- -

Optional w

-
w: number
- -
-
-

float mode only

-
-
-
-
- -

Optional widthFlex

-
widthFlex: number
- -
-
- -

Optional x

-
x: number
- -
-
-

float mode only

-
-
-
-
- -

Optional y

-
y: number
- -
-
-

float mode only

-
-
-
-
- -

Optional z

-
z: number
- -
-
-

float mode only

-
-
-
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.tabbase.html b/interfaces/dockdata.tabbase.html deleted file mode 100644 index 30f8f858..00000000 --- a/interfaces/dockdata.tabbase.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - TabBase | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface TabBase

-
-
-
-
-
-
-
-

Hierarchy

-
    -
  • - TabBase - -
  • -
-
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

Optional id

-
id: string
- -
-
-

id must be unique

-
-
-
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.tabdata.html b/interfaces/dockdata.tabdata.html deleted file mode 100644 index ceb06f2b..00000000 --- a/interfaces/dockdata.tabdata.html +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - TabData | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface TabData

-
-
-
-
-
-
-
-

Hierarchy

-
    -
  • - TabBase -
  • -
  • - DockDataBase -
      -
    • - TabData -
    • -
    -
  • -
-
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

Optional cacheContext

-
cacheContext: Context<any>
- -
-
-
deprecated
-

no longer needed

-
-
-
-
-
- -

Optional cached

-
cached: boolean
- -
-
-
    -
  • when value is true: content will always reuse the react component thus allows the component to keep its internal state
  • -
  • when value is false: content will be destroyed when it's not visible, TabGroup.animated should be set to false, otherwise animation would show blank pages
  • -
  • when value is undefined: content is rendered normally as react component
  • -
-
-
-
-
- -

Optional closable

-
closable: boolean
- -
-
- -

content

-
content: ReactElement<any, string | JSXElementConstructor<any>> | ((tab: TabData) => ReactElement<any, string | JSXElementConstructor<any>>)
- -
-
- -

Optional group

-
group: string
- -
-
-
    -
  • group defines style of the panel
  • -
  • tabs with different tab groups can not be put in same panel
  • -
  • more options for the group can be defined as TabGroup in LayoutProps.groups
  • -
-
-
-
-
- -

Optional id

-
id: string
- -
-
-

id must be unique

-
-
-
-
- -

Optional minHeight

-
minHeight: number
- -
-
- -

Optional minWidth

-
minWidth: number
- -
-
- -

title

-
title: ReactChild
- -
-
-

title that's shown in the tab of the panel header

-
-
-
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.tabgroup.html b/interfaces/dockdata.tabgroup.html deleted file mode 100644 index 54365055..00000000 --- a/interfaces/dockdata.tabgroup.html +++ /dev/null @@ -1,456 +0,0 @@ - - - - - - TabGroup | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface TabGroup

-
-
-
-
-
-
-
-

Hierarchy

-
    -
  • - TabGroup -
  • -
-
-
-

Index

-
- -
-
-
-

Properties

-
- -

Optional animated

-
animated: boolean
- -
-
-

Whether to show animation effect when switch tabs.

-
-

default true

-
-
-
- -

Optional disableDock

-
disableDock: boolean
- -
-
-

Disable dock, so the panel will only work in float mode.

-
-

default: false

-
-
-
- -

Optional floatable

-
floatable: boolean | "singleTab"
- -
-
-

Whether tab can be dragged into float layer. - If value is "singleTab", float panel can't have multiple tabs.

-
-

default: false

-
-
-
- -

Optional heightFlex

-
heightFlex: number
- -
-
-

Override the default flex grow and flex shrink for panel height

-
-
-
-
- -

Optional maximizable

-
maximizable: boolean
- -
-
-

Whether tab can be maximized

-
-

default: false

-
-
-
- -

Optional moreIcon

-
moreIcon: ReactNode
- -
-
-

Override the default moreIcon

-
-
-
-
- -

Optional newWindow

-
newWindow: boolean
- -
-
-

Whether tab can be converted to native window, only works when floatable is true.

-
-

default: false

-
-
-
- -

Optional panelExtra

-
panelExtra: (panel: PanelData, context: DockContext) => ReactElement<any, string | JSXElementConstructor<any>>
- -
-
-

Generate extra content show in the right side of tab bar.

-
-

panelExtra can also be used as a listener on panel state changes, - If you don't need to show extra content in this case, just return null.

-
-
-

Type declaration

-
    -
  • -
      -
    • (panel: PanelData, context: DockContext): ReactElement<any, string | JSXElementConstructor<any>>
    • -
    -
      -
    • -

      Parameters

      - -

      Returns ReactElement<any, string | JSXElementConstructor<any>>

      -
    • -
    -
  • -
-
-
-
- -

Optional preferredFloatHeight

-
preferredFloatHeight: [number, number]
- -
-
-

When creating float panel from dragging, DockLayout would use the original panel's size. - Use this to defined the [min, max] allowed height for the default size of a float panel. - If not specified, minHeight = 50, maxHeight = 500

-
-
-
-
- -

Optional preferredFloatWidth

-
preferredFloatWidth: [number, number]
- -
-
-

When creating float panel from dragging, DockLayout would use the original panel's size. - Use this to defined the [min, max] allowed with for the default size of a float panel. - If not specified, minWidth = 100, maxWidth = 600

-
-
-
-
- -

Optional tabLocked

-
tabLocked: boolean
- -
-
-

When tabs are locked, you can not drag tab to create new panel, but it can still be dropped into a different panel if they have the same tab group.

-
-

default false

-
-
-
- -

Optional widthFlex

-
widthFlex: number
- -
-
-

Override the default flex grow and flex shrink for panel width

-
-
-
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/dockdata.tabpanecache.html b/interfaces/dockdata.tabpanecache.html deleted file mode 100644 index 5dbd69f9..00000000 --- a/interfaces/dockdata.tabpanecache.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - TabPaneCache | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface TabPaneCache

-
-
-
-
-
-
-
-

Hierarchy

-
    -
  • - TabPaneCache -
  • -
-
-
-

Index

-
-
-
-

Properties

- -
-
-
-
-
-

Properties

-
- -

div

-
div: HTMLDivElement
- -
-
- -

id

-
id: string
- -
-
- -

owner

-
owner: any
- -
-
- -

Optional portal

-
portal: ReactPortal
- -
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file diff --git a/interfaces/docklayout.layoutprops.html b/interfaces/docklayout.layoutprops.html deleted file mode 100644 index bda6e036..00000000 --- a/interfaces/docklayout.layoutprops.html +++ /dev/null @@ -1,491 +0,0 @@ - - - - - - LayoutProps | rc-dock - - - - - - -
-
-
-
- -
-
- Options -
-
- All -
    -
  • Public
  • -
  • Public/Protected
  • -
  • All
  • -
-
- - -
-
- Menu -
-
-
-
-
-
- -

Interface LayoutProps

-
-
-
-
-
-
-
-

Hierarchy

-
    -
  • - LayoutProps -
  • -
-
-
-

Index

-
-
-
-

Properties

- -
-
-

Methods

- -
-
-
-
-
-

Properties

-
- -

Optional defaultLayout

-
defaultLayout: LayoutData
- -
-
-
    -
  • when LayoutProps.loadTab callback is defined, tabs in defaultLayout only need to have an id, unless loadTab requires other fields
  • -
  • when LayoutProps.loadTab is not defined, tabs must contain title and content, as well as other fields in TabData when needed
  • -
-
-
-
-
- -

Optional dockId

-
dockId: string
- -
-
-

when there are multiple DockLayout, by default, you can't drag panel between them - but if you assign same dockId, it will allow panels to be dragged from one layout to another

-
-
-
-
- -

Optional dropMode

-
dropMode: "default" | "edge"
- -
-
-
    -
  • default mode: showing 4 to 9 squares to help picking drop areas
  • -
  • edge mode: using the distance between mouse and panel border to pick drop area
      -
    • in edge mode, dragging float panel's header won't bring panel back to dock layer
    • -
    -
  • -
-
-
-
-
- -

Optional groups

-
groups: {}
- -
-
-

Tab Groups, defines additional configuration for different groups

-
-
-
-

Type declaration

- -
-
-
- -

Optional layout

-
layout: LayoutBase
- -
-
-

set layout only when you want to use DockLayout as a fully controlled react component - when using controlled layout, [[LayoutProps.onChange]] must be set to enable any layout change

-
-
-
-
- -

Optional maximizeTo

-
maximizeTo: string | HTMLElement
- -
-
-

when specified, docklayout will create a react portal for the maximized panel - use dom element as the value, or use the element's id

-
-
-
-
- -

Optional style

-
style: CSSProperties
- -
-
-
-

Methods

-
- -

Optional afterPanelLoaded

- -
    -
  • - -
    -
    -

    modify the loadedPanel, you can retrieve additional data into the panel

    -
      -
    • modifying panel tabs is allowed, make sure to add or replace full TabData with title and content, because loadTab won't be called after this
    • -
    • if tabs is empty, but still remaining in layout because of panelLock, make sure also set the group if it's not null
    • -
    -
    -
    -

    Parameters

    - -

    Returns void

    -
  • -
-
-
- -

Optional afterPanelSaved

- -
    -
  • - -
    -
    -

    modify the savedPanel, you can add additional data into the savedPanel

    -
    -
    -

    Parameters

    - -

    Returns void

    -
  • -
-
-
- -

Optional loadTab

- -
    -
  • - -
    -
    -

    override the default loadTab behavior

    -
      -
    • when loadTab is not defined, LayoutProps.defaultLayout will be used to find a tab to load, thus defaultLayout must contain the titles and contents for TabData
    • -
    • when loadTab is defined, LayoutProps.defaultLayout can ignore all those and only keep id and other custom data
    • -
    -
    -
    -

    Parameters

    - -

    Returns TabData

    -
  • -
-
-
- -

Optional onLayoutChange

- -
    -
  • - -

    Parameters

    -
      -
    • -
      newLayout: LayoutBase
      -
      -

      layout data can be set to LayoutProps.layout directly when used as controlled component

      -
      -
    • -
    • -
      Optional currentTabId: string
      -
      -

      id of current tab

      -
      -
    • -
    • -
      Optional direction: DropDirection
      -
      -

      direction of the dock change

      -
      -
    • -
    -

    Returns void

    -
  • -
-
-
- -

Optional saveTab

- -
    -
  • - -
    -
    -

    override the default saveTab behavior

    -
    -
    -

    Parameters

    - -

    Returns TabBase

    -

    must at least have an unique id

    -
  • -
-
-
-
- -
-
-
-
-

Legend

-
-
    -
  • Interface
  • -
  • Property
  • -
  • Method
  • -
-
    -
  • Type alias
  • -
-
    -
  • Class
  • -
-
-
-
-
-

Generated using TypeDoc

-
-
- - - \ No newline at end of file