You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					39 lines
				
				1.1 KiB
			
		
		
			
		
	
	
					39 lines
				
				1.1 KiB
			| 
								 
											3 years ago
										 
									 | 
							
								"use strict";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								exports.__esModule = true;
							 | 
						||
| 
								 | 
							
								exports["default"] = void 0;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								var _errors = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("./_errors"));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function generateSelectors(template, state) {
							 | 
						||
| 
								 | 
							
								  var stateSuffix = state ? ":" + state : '';
							 | 
						||
| 
								 | 
							
								  return template(stateSuffix);
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * Function helper that adds an array of states to a template of selectors. Used in textInputs and buttons.
							 | 
						||
| 
								 | 
							
								 * @private
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function statefulSelectors(states, template, stateMap) {
							 | 
						||
| 
								 | 
							
								  if (!template) throw new _errors["default"](67);
							 | 
						||
| 
								 | 
							
								  if (states.length === 0) return generateSelectors(template, null);
							 | 
						||
| 
								 | 
							
								  var selectors = [];
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  for (var i = 0; i < states.length; i += 1) {
							 | 
						||
| 
								 | 
							
								    if (stateMap && stateMap.indexOf(states[i]) < 0) {
							 | 
						||
| 
								 | 
							
								      throw new _errors["default"](68);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    selectors.push(generateSelectors(template, states[i]));
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  selectors = selectors.join(',');
							 | 
						||
| 
								 | 
							
								  return selectors;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								var _default = statefulSelectors;
							 | 
						||
| 
								 | 
							
								exports["default"] = _default;
							 | 
						||
| 
								 | 
							
								module.exports = exports.default;
							 |