17b2d34fe6
* add countries data and combobox example * directly push to the options array No need to spread here because this will slow things down tremendously. If you add 5 options, then this will happen: ```js let options = [] options = [...options, 1] options = [...options, 2] options = [...options, 3] options = [...options, 4] options = [...options, 5] ``` It's making a lot of copies and has to spread everything it just copied again. Instead, let's just push to the array: ```js let options = [] options.push(1) options.push(2) options.push(3) options.push(4) options.push(5) ``` * only sort options by DOM node once When registering 50 options, we will re-sort the options based on the DOM node position for every option that gets registered. This is overkill and unnecessary. The re-sorting is useful if an option is injected between 2 options. When we sort the full list for _every_ `registerOption` call then the result after the last `registerOption` will be the same if we only sorted after the last `registerOption` call only. This will ensure that we are skipping a ton of work and only do the work once at the end where it matters. * debounce the `goToOption` call until the next frame This will allow us to perform the task of `goToOption` once instead of `n` times if they happen really fast after eachother. This can happen when you are leaving option B and going to option A. Then the following steps happen: - Leaving Option B `goToOption(Nothing)` - Entering Option A `goToOption(A)` Both will re-render everything because the internal active option index would be changed. But only the last `goToOption(A)` is the interesting version here. We could also move the `goToOption(Nothing)` to the `ComboboxOptions` (wrapper) itself instead of adding these listeners on each individual `ComboboxOption`. However, if you add an additional visual piece of DOM above or between the options, hovering that would not leave the `ComboboxOptions` and therefore the last `ComboboxOption` would still be active which we don't want. * update changelog
252 lines
4.4 KiB
TypeScript
252 lines
4.4 KiB
TypeScript
export let countries = [
|
|
'Afghanistan',
|
|
'Albania',
|
|
'Algeria',
|
|
'American Samoa',
|
|
'Andorra',
|
|
'Angola',
|
|
'Anguilla',
|
|
'Antarctica',
|
|
'Antigua and Barbuda',
|
|
'Argentina',
|
|
'Armenia',
|
|
'Aruba',
|
|
'Australia',
|
|
'Austria',
|
|
'Azerbaijan',
|
|
'Bahamas (the)',
|
|
'Bahrain',
|
|
'Bangladesh',
|
|
'Barbados',
|
|
'Belarus',
|
|
'Belgium',
|
|
'Belize',
|
|
'Benin',
|
|
'Bermuda',
|
|
'Bhutan',
|
|
'Bolivia (Plurinational State of)',
|
|
'Bonaire, Sint Eustatius and Saba',
|
|
'Bosnia and Herzegovina',
|
|
'Botswana',
|
|
'Bouvet Island',
|
|
'Brazil',
|
|
'British Indian Ocean Territory (the)',
|
|
'Brunei Darussalam',
|
|
'Bulgaria',
|
|
'Burkina Faso',
|
|
'Burundi',
|
|
'Cabo Verde',
|
|
'Cambodia',
|
|
'Cameroon',
|
|
'Canada',
|
|
'Cayman Islands (the)',
|
|
'Central African Republic (the)',
|
|
'Chad',
|
|
'Chile',
|
|
'China',
|
|
'Christmas Island',
|
|
'Cocos (Keeling) Islands (the)',
|
|
'Colombia',
|
|
'Comoros (the)',
|
|
'Congo (the Democratic Republic of the)',
|
|
'Congo (the)',
|
|
'Cook Islands (the)',
|
|
'Costa Rica',
|
|
'Croatia',
|
|
'Cuba',
|
|
'Curaçao',
|
|
'Cyprus',
|
|
'Czechia',
|
|
"Côte d'Ivoire",
|
|
'Denmark',
|
|
'Djibouti',
|
|
'Dominica',
|
|
'Dominican Republic (the)',
|
|
'Ecuador',
|
|
'Egypt',
|
|
'El Salvador',
|
|
'Equatorial Guinea',
|
|
'Eritrea',
|
|
'Estonia',
|
|
'Eswatini',
|
|
'Ethiopia',
|
|
'Falkland Islands (the) [Malvinas]',
|
|
'Faroe Islands (the)',
|
|
'Fiji',
|
|
'Finland',
|
|
'France',
|
|
'French Guiana',
|
|
'French Polynesia',
|
|
'French Southern Territories (the)',
|
|
'Gabon',
|
|
'Gambia (the)',
|
|
'Georgia',
|
|
'Germany',
|
|
'Ghana',
|
|
'Gibraltar',
|
|
'Greece',
|
|
'Greenland',
|
|
'Grenada',
|
|
'Guadeloupe',
|
|
'Guam',
|
|
'Guatemala',
|
|
'Guernsey',
|
|
'Guinea',
|
|
'Guinea-Bissau',
|
|
'Guyana',
|
|
'Haiti',
|
|
'Heard Island and McDonald Islands',
|
|
'Holy See (the)',
|
|
'Honduras',
|
|
'Hong Kong',
|
|
'Hungary',
|
|
'Iceland',
|
|
'India',
|
|
'Indonesia',
|
|
'Iran (Islamic Republic of)',
|
|
'Iraq',
|
|
'Ireland',
|
|
'Isle of Man',
|
|
'Israel',
|
|
'Italy',
|
|
'Jamaica',
|
|
'Japan',
|
|
'Jersey',
|
|
'Jordan',
|
|
'Kazakhstan',
|
|
'Kenya',
|
|
'Kiribati',
|
|
"Korea (the Democratic People's Republic of)",
|
|
'Korea (the Republic of)',
|
|
'Kuwait',
|
|
'Kyrgyzstan',
|
|
"Lao People's Democratic Republic (the)",
|
|
'Latvia',
|
|
'Lebanon',
|
|
'Lesotho',
|
|
'Liberia',
|
|
'Libya',
|
|
'Liechtenstein',
|
|
'Lithuania',
|
|
'Luxembourg',
|
|
'Macao',
|
|
'Madagascar',
|
|
'Malawi',
|
|
'Malaysia',
|
|
'Maldives',
|
|
'Mali',
|
|
'Malta',
|
|
'Marshall Islands (the)',
|
|
'Martinique',
|
|
'Mauritania',
|
|
'Mauritius',
|
|
'Mayotte',
|
|
'Mexico',
|
|
'Micronesia (Federated States of)',
|
|
'Moldova (the Republic of)',
|
|
'Monaco',
|
|
'Mongolia',
|
|
'Montenegro',
|
|
'Montserrat',
|
|
'Morocco',
|
|
'Mozambique',
|
|
'Myanmar',
|
|
'Namibia',
|
|
'Nauru',
|
|
'Nepal',
|
|
'Netherlands (the)',
|
|
'New Caledonia',
|
|
'New Zealand',
|
|
'Nicaragua',
|
|
'Niger (the)',
|
|
'Nigeria',
|
|
'Niue',
|
|
'Norfolk Island',
|
|
'Northern Mariana Islands (the)',
|
|
'Norway',
|
|
'Oman',
|
|
'Pakistan',
|
|
'Palau',
|
|
'Palestine, State of',
|
|
'Panama',
|
|
'Papua New Guinea',
|
|
'Paraguay',
|
|
'Peru',
|
|
'Philippines (the)',
|
|
'Pitcairn',
|
|
'Poland',
|
|
'Portugal',
|
|
'Puerto Rico',
|
|
'Qatar',
|
|
'Republic of North Macedonia',
|
|
'Romania',
|
|
'Russian Federation (the)',
|
|
'Rwanda',
|
|
'Réunion',
|
|
'Saint Barthélemy',
|
|
'Saint Helena, Ascension and Tristan da Cunha',
|
|
'Saint Kitts and Nevis',
|
|
'Saint Lucia',
|
|
'Saint Martin (French part)',
|
|
'Saint Pierre and Miquelon',
|
|
'Saint Vincent and the Grenadines',
|
|
'Samoa',
|
|
'San Marino',
|
|
'Sao Tome and Principe',
|
|
'Saudi Arabia',
|
|
'Senegal',
|
|
'Serbia',
|
|
'Seychelles',
|
|
'Sierra Leone',
|
|
'Singapore',
|
|
'Sint Maarten (Dutch part)',
|
|
'Slovakia',
|
|
'Slovenia',
|
|
'Solomon Islands',
|
|
'Somalia',
|
|
'South Africa',
|
|
'South Georgia and the South Sandwich Islands',
|
|
'South Sudan',
|
|
'Spain',
|
|
'Sri Lanka',
|
|
'Sudan (the)',
|
|
'Suriname',
|
|
'Svalbard and Jan Mayen',
|
|
'Sweden',
|
|
'Switzerland',
|
|
'Syrian Arab Republic',
|
|
'Taiwan',
|
|
'Tajikistan',
|
|
'Tanzania, United Republic of',
|
|
'Thailand',
|
|
'Timor-Leste',
|
|
'Togo',
|
|
'Tokelau',
|
|
'Tonga',
|
|
'Trinidad and Tobago',
|
|
'Tunisia',
|
|
'Turkey',
|
|
'Turkmenistan',
|
|
'Turks and Caicos Islands (the)',
|
|
'Tuvalu',
|
|
'Uganda',
|
|
'Ukraine',
|
|
'United Arab Emirates (the)',
|
|
'United Kingdom of Great Britain and Northern Ireland (the)',
|
|
'United States Minor Outlying Islands (the)',
|
|
'United States of America (the)',
|
|
'Uruguay',
|
|
'Uzbekistan',
|
|
'Vanuatu',
|
|
'Venezuela (Bolivarian Republic of)',
|
|
'Viet Nam',
|
|
'Virgin Islands (British)',
|
|
'Virgin Islands (U.S.)',
|
|
'Wallis and Futuna',
|
|
'Western Sahara',
|
|
'Yemen',
|
|
'Zambia',
|
|
'Zimbabwe',
|
|
'Åland Islands',
|
|
]
|