@1337exp/taoui 5.49.2 → 5.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +2 -1
- package/README.ru.md +2 -1
- package/dist/index.d.ts +245 -139
- package/dist/index.js +2207 -2116
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/skills/taoui/SKILL.md +2 -2
- package/skills/taoui/references/components.md +1408 -1392
- package/skills/taoui/references/patterns.md +32 -0
|
@@ -214,6 +214,38 @@ Density is added on top of the size (the height and the padding, not the font),
|
|
|
214
214
|
|
|
215
215
|
**Why.** A segmented switch is a row of equal-width buttons that you compare at a glance, and that only works when the options are short and alike. Apple's Human Interface Guidelines ask for no more than about five segments on iPhone, for segments of similar size ("it doesn't look good if content fills some segments but not others") and for nouns as labels; the GitLab Pajamas design system wants 2 or 3 options, never over 5, with a one-word label, and sends longer lists to a select. One long caption has two bad outcomes: it widens every segment (all are equal) until the control no longer fits, or it wraps, and then the user reads the options instead of seeing them, which is the job of a radio list. The cause is almost always in the design, not in the component, so the cheap fix is a shorter word and a legend, before any code.
|
|
216
216
|
|
|
217
|
+
## Switching the language
|
|
218
|
+
|
|
219
|
+
**When.** The person can change the language of the interface: a header, the footer of a side panel, a settings page.
|
|
220
|
+
|
|
221
|
+
**Rule.** Use `TaoLanguageSwitch`: a globe (`tao-globe`) that opens a list of the languages, each under its own name (`Русский`, `Deutsch`, `日本語`), the current one checked. Beside the globe it shows the name of the current language where there is room, and `icon-only` where there is not (a phone). Put it next to the theme toggle: the two are switches of the whole interface, not settings of a screen. The switch writes `<html lang>` and says the code in `v-model`; the texts, where the choice is stored and `setTaoLocale` for the built-in texts are the app's. Not flags, not codes in a `TaoSegmented`.
|
|
222
|
+
|
|
223
|
+
**Do:**
|
|
224
|
+
|
|
225
|
+
```vue
|
|
226
|
+
<TaoFlex align="center" :gap="8">
|
|
227
|
+
<TaoLanguageSwitch v-model="lang" :languages="['en', 'ru', 'de', 'fr', 'ja']" />
|
|
228
|
+
<TaoThemeToggle :apply="false" />
|
|
229
|
+
</TaoFlex>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Don't** (Five two-letter codes in a segmented control: it fills the bar and grows with every new language):
|
|
233
|
+
|
|
234
|
+
```vue
|
|
235
|
+
<TaoFlex align="center" :gap="8">
|
|
236
|
+
<TaoSegmented v-model="lang" aria-label="Language">
|
|
237
|
+
<TaoSegmentedOption value="en">EN</TaoSegmentedOption>
|
|
238
|
+
<TaoSegmentedOption value="ru">RU</TaoSegmentedOption>
|
|
239
|
+
<TaoSegmentedOption value="de">DE</TaoSegmentedOption>
|
|
240
|
+
<TaoSegmentedOption value="fr">FR</TaoSegmentedOption>
|
|
241
|
+
<TaoSegmentedOption value="ja">JA</TaoSegmentedOption>
|
|
242
|
+
</TaoSegmented>
|
|
243
|
+
<TaoThemeToggle :apply="false" />
|
|
244
|
+
</TaoFlex>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Why.** Each language is named in itself because a person who cannot read the current one must still find theirs: «Deutsch» is found by a German speaker on a page in any language, «German» only by someone who reads the page already. The W3C Internationalization guidance says the same, and adds why not flags: a flag is a country, and a language is not (many countries share one, and many have several). A code (`RU`, `JA`) is a name for programmers. A segmented control is for 2 to 5 short options that are compared at a glance (see «A segmented switch: short captions»), and a list of languages only grows, so it is a menu from the start. The globe is the sign everyone has learned for it, and `<html lang>` is what the browser, a screen reader and hyphenation read: it is easy to forget by hand, so the switch writes it.
|
|
248
|
+
|
|
217
249
|
## A destructive action
|
|
218
250
|
|
|
219
251
|
**When.** Delete, discard, reset: something that cannot be taken back.
|