(idsOption, options)
| 146 | // `pair` object and a gutter. |
| 147 | // 5. Actually size the pair elements, insert gutters and attach event listeners. |
| 148 | var Split = function (idsOption, options) { |
| 149 | if ( options === void 0 ) options = {}; |
| 150 | |
| 151 | var ids = idsOption; |
| 152 | var dimension; |
| 153 | var clientAxis; |
| 154 | var position; |
| 155 | var positionEnd; |
| 156 | var clientSize; |
| 157 | var elements; |
| 158 | |
| 159 | // Allow HTMLCollection to be used as an argument when supported |
| 160 | if (Array.from) { |
| 161 | ids = Array.from(ids); |
| 162 | } |
| 163 | |
| 164 | // All DOM elements in the split should have a common parent. We can grab |
| 165 | // the first elements parent and hope users read the docs because the |
| 166 | // behavior will be whacky otherwise. |
| 167 | var firstElement = elementOrSelector(ids[0]); |
| 168 | var parent = firstElement.parentNode; |
| 169 | var parentStyle = getComputedStyle ? getComputedStyle(parent) : null; |
| 170 | var parentFlexDirection = parentStyle ? parentStyle.flexDirection : null; |
| 171 | |
| 172 | // Set default options.sizes to equal percentages of the parent element. |
| 173 | var sizes = getOption(options, 'sizes') || ids.map(function () { return 100 / ids.length; }); |
| 174 | |
| 175 | // Standardize minSize to an array if it isn't already. This allows minSize |
| 176 | // to be passed as a number. |
| 177 | var minSize = getOption(options, 'minSize', 100); |
| 178 | var minSizes = Array.isArray(minSize) ? minSize : ids.map(function () { return minSize; }); |
| 179 | |
| 180 | // Get other options |
| 181 | var expandToMin = getOption(options, 'expandToMin', false); |
| 182 | var gutterSize = getOption(options, 'gutterSize', 10); |
| 183 | var gutterAlign = getOption(options, 'gutterAlign', 'center'); |
| 184 | var snapOffset = getOption(options, 'snapOffset', 30); |
| 185 | var dragInterval = getOption(options, 'dragInterval', 1); |
| 186 | var direction = getOption(options, 'direction', HORIZONTAL); |
| 187 | var cursor = getOption( |
| 188 | options, |
| 189 | 'cursor', |
| 190 | direction === HORIZONTAL ? 'col-resize' : 'row-resize' |
| 191 | ); |
| 192 | var gutter = getOption(options, 'gutter', defaultGutterFn); |
| 193 | var elementStyle = getOption( |
| 194 | options, |
| 195 | 'elementStyle', |
| 196 | defaultElementStyleFn |
| 197 | ); |
| 198 | var gutterStyle = getOption(options, 'gutterStyle', defaultGutterStyleFn); |
| 199 | |
| 200 | // 2. Initialize a bunch of strings based on the direction we're splitting. |
| 201 | // A lot of the behavior in the rest of the library is paramatized down to |
| 202 | // rely on CSS strings and classes. |
| 203 | if (direction === HORIZONTAL) { |
| 204 | dimension = 'width'; |
| 205 | clientAxis = 'clientX'; |
no test coverage detected