(elements, config)
| 164 | }; |
| 165 | const _SplitText = class _SplitText { |
| 166 | constructor(elements, config) { |
| 167 | this.isSplit = false; |
| 168 | _initIfNecessary(); |
| 169 | this.elements = _elements(elements); |
| 170 | this.chars = []; |
| 171 | this.words = []; |
| 172 | this.lines = []; |
| 173 | this.masks = []; |
| 174 | this.vars = config; |
| 175 | this.elements.forEach((el) => { |
| 176 | var _a; |
| 177 | config.overwrite !== false && ((_a = el[_splitProp]) == null ? void 0 : _a._data.orig.filter(({ element }) => element === el).forEach(_revertOriginal)); |
| 178 | el[_splitProp] = this; |
| 179 | }); |
| 180 | this._split = () => this.isSplit && this.split(this.vars); |
| 181 | let orig = [], timerId, checkWidths = () => { |
| 182 | let i = orig.length, o; |
| 183 | while (i--) { |
| 184 | o = orig[i]; |
| 185 | let w = o.element.offsetWidth; |
| 186 | if (w !== o.width) { |
| 187 | o.width = w; |
| 188 | this._split(); |
| 189 | return; |
| 190 | } |
| 191 | } |
| 192 | }; |
| 193 | this._data = { orig, obs: typeof ResizeObserver !== "undefined" && new ResizeObserver(() => { |
| 194 | clearTimeout(timerId); |
| 195 | timerId = setTimeout(checkWidths, 200); |
| 196 | }) }; |
| 197 | _context(this); |
| 198 | this.split(config); |
| 199 | } |
| 200 | split(config) { |
| 201 | (this._ctx || _defaultContext).add(() => { |
| 202 | this.isSplit && this.revert(); |
nothing calls this directly
no test coverage detected