itube-specs 0.0.195

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.
Files changed (169) hide show
  1. package/README.md +121 -0
  2. package/components/cards/f-video-mini-card.vue +49 -0
  3. package/components/grids/f-grid-categories.vue +20 -0
  4. package/components/grids/f-grid-channels.vue +23 -0
  5. package/components/grids/f-grid-models.vue +25 -0
  6. package/components/grids/f-grid-playlists.vue +21 -0
  7. package/components/grids/f-grid-videos.vue +33 -0
  8. package/components/page-components/f-breadcrumbs.vue +44 -0
  9. package/components/page-components/f-chips-panel.vue +101 -0
  10. package/components/page-components/f-pagination.vue +206 -0
  11. package/components/page-components/f-report.vue +221 -0
  12. package/components/page-components/f-share.vue +96 -0
  13. package/components/page-components/f-sort.vue +57 -0
  14. package/components/page-components/f-videos-title.vue +20 -0
  15. package/components/ui/f-button.vue +50 -0
  16. package/components/ui/f-checkbox.vue +55 -0
  17. package/components/ui/f-chips.vue +116 -0
  18. package/components/ui/f-count.vue +12 -0
  19. package/components/ui/f-country.vue +26 -0
  20. package/components/ui/f-dropdown.vue +122 -0
  21. package/components/ui/f-icon.vue +19 -0
  22. package/components/ui/f-img.vue +46 -0
  23. package/components/ui/f-input.vue +162 -0
  24. package/components/ui/f-label.vue +20 -0
  25. package/components/ui/f-link.vue +33 -0
  26. package/components/ui/f-model-tag.vue +28 -0
  27. package/components/ui/f-notification.vue +77 -0
  28. package/components/ui/f-popup.vue +136 -0
  29. package/components/ui/f-radio.vue +56 -0
  30. package/components/ui/f-select.vue +88 -0
  31. package/components/ui/f-slider.vue +55 -0
  32. package/components/ui/f-snackbar.vue +47 -0
  33. package/components/ui/f-timestamp.vue +51 -0
  34. package/components/ui/f-toggle.vue +29 -0
  35. package/composables/use-antiadblock-domains.ts +20 -0
  36. package/composables/use-auth-popup.ts +25 -0
  37. package/composables/use-convert-query-categories.ts +7 -0
  38. package/composables/use-generate-link.ts +30 -0
  39. package/composables/use-get-pure-route-name.ts +5 -0
  40. package/composables/use-get-videos-filter-request.ts +30 -0
  41. package/composables/use-meta.ts +42 -0
  42. package/composables/use-playlist-edit.ts +36 -0
  43. package/composables/use-report-popup.ts +21 -0
  44. package/composables/use-seo-links.ts +87 -0
  45. package/composables/use-share-popup.ts +23 -0
  46. package/composables/use-snackbar.ts +52 -0
  47. package/composables/use-test-composable.ts +3 -0
  48. package/lib/alphabet-items.ts +2 -0
  49. package/lib/contact-forms-scheme.ts +98 -0
  50. package/lib/contacts/report-issue-items.ts +5 -0
  51. package/lib/contacts/report-malware-items.ts +6 -0
  52. package/lib/contacts/report-reasons-items.ts +12 -0
  53. package/lib/contacts/report-wrong-items.ts +6 -0
  54. package/lib/index.ts +7 -0
  55. package/lib/report-forms-scheme.ts +205 -0
  56. package/nuxt.config.ts +20 -0
  57. package/package.json +53 -0
  58. package/runtime/enums/async-data.ts +48 -0
  59. package/runtime/enums/auth-step.ts +5 -0
  60. package/runtime/enums/contacts-subjects.ts +7 -0
  61. package/runtime/enums/languages.ts +9 -0
  62. package/runtime/enums/niche.ts +6 -0
  63. package/runtime/enums/playlist-step.ts +5 -0
  64. package/runtime/enums/playlist-type.ts +4 -0
  65. package/runtime/enums/report-forms-subjects.ts +7 -0
  66. package/runtime/index.ts +51 -0
  67. package/runtime/utils/cleaners/clean-category-card.ts +9 -0
  68. package/runtime/utils/cleaners/clean-category-info.ts +9 -0
  69. package/runtime/utils/cleaners/clean-channel-card.ts +12 -0
  70. package/runtime/utils/cleaners/clean-channel-info.ts +13 -0
  71. package/runtime/utils/cleaners/clean-model-card.ts +9 -0
  72. package/runtime/utils/cleaners/clean-model-info.ts +11 -0
  73. package/runtime/utils/cleaners/clean-playlist-card.ts +16 -0
  74. package/runtime/utils/cleaners/clean-playlist-data.ts +15 -0
  75. package/runtime/utils/cleaners/clean-playlist-video.ts +12 -0
  76. package/runtime/utils/cleaners/clean-profile-data.ts +11 -0
  77. package/runtime/utils/cleaners/clean-user-playlists-card.ts +11 -0
  78. package/runtime/utils/cleaners/clean-video-card.ts +19 -0
  79. package/runtime/utils/cleaners/clean-video-data.ts +27 -0
  80. package/runtime/utils/compress-image.ts +27 -0
  81. package/runtime/utils/converters/convert-categories-to-chips.ts +13 -0
  82. package/runtime/utils/converters/convert-categories-to-footer.ts +11 -0
  83. package/runtime/utils/converters/convert-date-to-timestamp.ts +37 -0
  84. package/runtime/utils/converters/convert-model-card-to-chips.ts +13 -0
  85. package/runtime/utils/converters/convert-string.ts +56 -0
  86. package/runtime/utils/converters/group-categories-by-first-letter.ts +24 -0
  87. package/runtime/utils/converters/group-objects-by-first-letter.ts +16 -0
  88. package/runtime/utils/format-date.ts +12 -0
  89. package/runtime/utils/format-number.ts +12 -0
  90. package/runtime/utils/format-time-ago.ts +21 -0
  91. package/runtime/utils/get-duration.ts +17 -0
  92. package/runtime/utils/get-month.ts +22 -0
  93. package/runtime/utils/get-multiple-query.ts +26 -0
  94. package/runtime/utils/get-selected-query.ts +6 -0
  95. package/runtime/utils/is-mobile.ts +15 -0
  96. package/runtime/utils/normalize-url.ts +43 -0
  97. package/runtime/utils/on-backdrop-click.ts +5 -0
  98. package/runtime/utils/scroll-lock.ts +28 -0
  99. package/runtime/utils/server/abort-controller.ts +14 -0
  100. package/runtime/utils/server/api-helper.ts +41 -0
  101. package/runtime/utils/server/get-url-with-proxied-params.ts +6 -0
  102. package/runtime/utils/server/parse-api-error.ts +14 -0
  103. package/runtime/utils/server/server-api-helper.ts +28 -0
  104. package/runtime/utils/validate-email.ts +4 -0
  105. package/runtime/utils/validate-password.ts +3 -0
  106. package/runtime/utils/validate-phone.ts +4 -0
  107. package/runtime/utils/validate-username.ts +4 -0
  108. package/runtime/utils/video-data-add-model-icon.ts +20 -0
  109. package/runtime/utils/vtt-helper.ts +86 -0
  110. package/types/authorization-forms.d.ts +16 -0
  111. package/types/breadcrumb-item.d.ts +4 -0
  112. package/types/button-sizes.d.ts +1 -0
  113. package/types/button-themes.d.ts +1 -0
  114. package/types/card-info.d.ts +22 -0
  115. package/types/category-card.d.ts +8 -0
  116. package/types/change-email-form.d.ts +3 -0
  117. package/types/change-password-form.d.ts +4 -0
  118. package/types/channel-card.d.ts +10 -0
  119. package/types/chips-item.d.ts +8 -0
  120. package/types/contacts-form.d.ts +10 -0
  121. package/types/contacts-scheme.d.ts +14 -0
  122. package/types/country.d.ts +5 -0
  123. package/types/css-breakpoints.d.ts +1 -0
  124. package/types/filter-scheme.d.ts +37 -0
  125. package/types/fluid-player.d.ts +226 -0
  126. package/types/gender.d.ts +5 -0
  127. package/types/group-categories.d.ts +15 -0
  128. package/types/index.d.ts +59 -0
  129. package/types/input-types.d.ts +1 -0
  130. package/types/link-item.d.ts +6 -0
  131. package/types/model-card.d.ts +7 -0
  132. package/types/model-filter-payload.d.ts +4 -0
  133. package/types/model-filter.d.ts +15 -0
  134. package/types/model-group.d.ts +5 -0
  135. package/types/model-tag.d.ts +5 -0
  136. package/types/multi-suggest.d.ts +105 -0
  137. package/types/navigation-items.d.ts +10 -0
  138. package/types/paginated-response.d.ts +8 -0
  139. package/types/parameter-model.d.ts +14 -0
  140. package/types/playlist-card.d.ts +16 -0
  141. package/types/playlist-data.d.ts +15 -0
  142. package/types/playlist-info-type.d.ts +28 -0
  143. package/types/playlist-video-form.d.ts +9 -0
  144. package/types/profile-data.d.ts +9 -0
  145. package/types/raw/raw-category-card.d.ts +23 -0
  146. package/types/raw/raw-category-info.d.ts +23 -0
  147. package/types/raw/raw-channel-card.d.ts +29 -0
  148. package/types/raw/raw-channel-info.d.ts +29 -0
  149. package/types/raw/raw-model-card.d.ts +53 -0
  150. package/types/raw/raw-model-info.d.ts +54 -0
  151. package/types/raw/raw-playlist-card.d.ts +27 -0
  152. package/types/raw/raw-playlist-data.d.ts +29 -0
  153. package/types/raw/raw-playlist-user.d.ts +24 -0
  154. package/types/raw/raw-playlist-video.d.ts +18 -0
  155. package/types/raw/raw-profile-data.d.ts +22 -0
  156. package/types/raw/raw-video-card.d.ts +78 -0
  157. package/types/raw/raw-video-data.d.ts +53 -0
  158. package/types/recovery-password-form.d.ts +4 -0
  159. package/types/related-phrases.d.ts +6 -0
  160. package/types/report-form.d.ts +9 -0
  161. package/types/report-scheme.d.ts +21 -0
  162. package/types/request-filters.d.ts +13 -0
  163. package/types/request-pagination.d.ts +5 -0
  164. package/types/search-top-models.d.ts +6 -0
  165. package/types/select-item.d.ts +10 -0
  166. package/types/tab-item.d.ts +6 -0
  167. package/types/thumbs-urls.d.ts +13 -0
  168. package/types/video-card.d.ts +18 -0
  169. package/types/video-data.d.ts +36 -0
@@ -0,0 +1,221 @@
1
+ <template>
2
+ <transition mode="out-in">
3
+ <FPopup
4
+ v-if="isReportPopupOpen"
5
+ v-model="isReportPopupOpen"
6
+ >
7
+ <template #title>{{ t('report') }}</template>
8
+ <div
9
+ class="f-report__popup-wrapper"
10
+ :class="{'_loading': loading}"
11
+ >
12
+ <FVideoMiniCard
13
+ class="f-report__video-card"
14
+ :card="reportedVideoCard"
15
+ />
16
+ <div class="f-report__forms">
17
+ <details
18
+ v-for="(item, index) in reportFormsScheme"
19
+ class="f-report__form"
20
+ name="report-details"
21
+ :key="`report-form-${index}`"
22
+ @toggle="(event) => onToggle(event, item.subject)"
23
+ >
24
+ <summary
25
+ class="f-report__form-button"
26
+ >
27
+ {{ t(`report_form.${item.title}`) }}
28
+ <FIcon
29
+ class="f-report__form-icon"
30
+ name="chevron-down"
31
+ size="24"
32
+ />
33
+ </summary>
34
+ <p
35
+ v-if="item.text"
36
+ class="f-report__form-text"
37
+ >{{ t(`report_form.${item.text}`) }}
38
+ </p>
39
+ <p
40
+ v-if="item.subtext"
41
+ class="f-report__form-text"
42
+ >{{ t(`report_form.${item.subtext}`) }}
43
+ </p>
44
+ <ul
45
+ v-if="item.list && item.list.length > 0"
46
+ >
47
+ <li
48
+ v-for="(subItem, subIndex) in item.list"
49
+ :key="`report-list-${subIndex}`"
50
+ class="f-report__form-list"
51
+ >{{ t(`report_form.${subItem.text}`) }}
52
+ </li>
53
+ </ul>
54
+ <form class="f-report__form-wrapper">
55
+ <template
56
+ v-for="(subItem, subIndex) in item.items"
57
+ :key="`${subItem.label}-${subIndex}`"
58
+ >
59
+ <FInput
60
+ v-if="['text', 'tel', 'textarea'].includes(subItem.type)"
61
+ v-model="form.data[subItem.value] as string"
62
+ :key="`report-form-${index}`"
63
+ :label=" t(`report_form.${subItem.label}`)"
64
+ :type="subItem.type as InputTypes"
65
+ :class="{'--wide': subItem.wide}"
66
+ :required="subItem.required"
67
+ :error="error[subItem.value]"
68
+ @update:error="(val: boolean) => error[subItem.value] = val"
69
+ />
70
+ <FCheckbox
71
+ v-if="subItem.type === 'checkbox'"
72
+ v-model="form.data[subItem.value] as boolean"
73
+ class="--wide"
74
+ :required="subItem.required"
75
+ :error="error[subItem.value]"
76
+ @update:error="(val: boolean) => error[subItem.value] = val"
77
+ >{{ t(`report_form.${subItem.text}`) }}
78
+ </FCheckbox>
79
+ <FRadio
80
+ v-if="subItem.type === 'radio' "
81
+ v-model="reasonValue"
82
+ name="report-radio-value"
83
+ :value="subItem.value"
84
+ class="--wide"
85
+ :label=" t(`report_form.${subItem.text}`)"
86
+ :required="subItem.required"
87
+ :error="errorRadio"
88
+ @update:error="(val: boolean) => errorRadio = val"
89
+ />
90
+ </template>
91
+ </form>
92
+ <FButton
93
+ :disabled="loading"
94
+ wide
95
+ @click="submit"
96
+ >{{ t('report_form.send_report') }}
97
+ </FButton>
98
+ </details>
99
+ </div>
100
+ <FButton
101
+ wide
102
+ theme="secondary"
103
+ @click="closeReportPopup"
104
+ >{{ t('cancel') }}
105
+ </FButton>
106
+ </div>
107
+ </FPopup>
108
+ </transition>
109
+ </template>
110
+
111
+ <script setup lang="ts">
112
+ import { reportFormsScheme } from '../../lib/report-forms-scheme';
113
+ import { EReportFormsSubjects, validateEmail, validatePhone } from '../../runtime';
114
+ import type { InputTypes, IReportForm } from '../../types';
115
+
116
+ const reasonValue = ref('');
117
+ const errorRadio = ref(false);
118
+ const error = ref<Record<string, boolean>>({});
119
+
120
+ const { t } = useI18n();
121
+
122
+ const form = ref<IReportForm>({
123
+ categoryName: EReportFormsSubjects.DMCA,
124
+ reason: '',
125
+ url: '',
126
+ token: '',
127
+ data: {},
128
+ })
129
+
130
+ const { isReportPopupOpen, closeReportPopup, reportedVideoCard } = useReportPopup();
131
+
132
+ const videoGuid = computed(() => reportedVideoCard.value.guid);
133
+
134
+ const loading = ref(false);
135
+
136
+ const activeCategory = computed(() => reportFormsScheme.find((subItem) => subItem.subject === form.value.categoryName))
137
+ const requiredFields = computed(() => activeCategory.value?.items?.filter(item => item.required).map(item => item.value));
138
+
139
+ const { executeRecaptcha } = useGoogleRecaptcha();
140
+
141
+ const { snackbarText, snackbarTheme, showErrorSnack, resetSnackbar } = useSnackbar();
142
+
143
+ function resetForm() {
144
+ Object.keys(form.value).forEach((key) => {
145
+ if (key === 'data') {
146
+ form.value.data = {}
147
+ }
148
+ })
149
+ reasonValue.value = ''
150
+ Object.keys(error.value).forEach(key => error.value[ key ] = false)
151
+ errorRadio.value = false
152
+ }
153
+
154
+ async function submit() {
155
+ resetSnackbar();
156
+ errorRadio.value = false;
157
+ Object.keys(error.value).forEach(key => error.value[ key ] = false);
158
+
159
+ let valid = true;
160
+
161
+ if (activeCategory.value?.hasReason) {
162
+ errorRadio.value = !reasonValue.value;
163
+ if (errorRadio.value) valid = false;
164
+ }
165
+
166
+ if (requiredFields.value && requiredFields.value.length > 0) {
167
+ requiredFields.value.forEach(item => {
168
+ const val = form.value.data[ item ];
169
+
170
+ if (item === 'from' && !validateEmail(val as string)) {
171
+ error.value[ item ] = true;
172
+ showErrorSnack('error_email');
173
+ } else if (item === 'phone' && !validatePhone(val as string)) {
174
+ error.value[ item ] = !validatePhone(val as string);
175
+ showErrorSnack('error_phone');
176
+ } else if (['confirmTrue', 'confirmOwner'].includes(item)) {
177
+ error.value[ item ] = !val;
178
+ } else {
179
+ error.value[ item ] = val === undefined || val === null || String(val).trim() === '';
180
+ showErrorSnack('error_text');
181
+ }
182
+
183
+ if (error.value[ item ]) valid = false;
184
+ });
185
+ }
186
+
187
+ if (!valid) return;
188
+
189
+ try {
190
+ const baseURL = window.location.origin;
191
+ loading.value = true;
192
+ const { token } = await executeRecaptcha('submit');
193
+ form.value.token = token || '';
194
+ form.value.url = `${baseURL}/videos/${reportedVideoCard.value.id}`;
195
+
196
+ if (reasonValue.value) {
197
+ form.value.data[ 'reason' ] = reasonValue.value;
198
+ }
199
+ await useFetchVideoAbuse(form.value, videoGuid.value);
200
+ closeReportPopup();
201
+ resetForm();
202
+ snackbarText.value = 'email_send';
203
+ snackbarTheme.value = 'success';
204
+ } catch (error) {
205
+ console.log('error send email', error);
206
+ snackbarText.value = 'email_error';
207
+ snackbarTheme.value = 'error';
208
+ } finally {
209
+ loading.value = false
210
+ }
211
+ }
212
+
213
+ function onToggle(event: Event, subject: EReportFormsSubjects) {
214
+ const el = event.target as HTMLDetailsElement;
215
+ if (el.open) {
216
+ form.value.categoryName = subject;
217
+ } else {
218
+ resetForm();
219
+ }
220
+ }
221
+ </script>
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <transition mode="out-in">
3
+ <FPopup
4
+ v-model="isSharePopupOpen"
5
+ v-if="isSharePopupOpen"
6
+ sheet
7
+ >
8
+ <template #title>{{ $t('share') }}</template>
9
+ <div class="f-share__popup-wrapper">
10
+ <FVideoMiniCard
11
+ v-if="sharedVideoCard && Object.keys(sharedVideoCard).length"
12
+ class="f-share__video-card"
13
+ :card="sharedVideoCard"
14
+ />
15
+ <div class="f-share__buttons">
16
+ <a
17
+ v-for="(item, index) in buttons"
18
+ class="f-share__button"
19
+ target="_blank"
20
+ :key="`share-button-${index}`"
21
+ :href="item.link"
22
+ >
23
+ <FImg
24
+ sizes="24px"
25
+ width="24"
26
+ height="24"
27
+ :src="`/img/socials/${item.img}`"
28
+ />
29
+ {{ item.text }}
30
+ </a>
31
+ </div>
32
+ <FInput
33
+ class="f-share__copy"
34
+ :label="inputText"
35
+ :title="fullUrl"
36
+ readonly
37
+ :icon="copyIcon"
38
+ :model-value="fullUrl"
39
+ @click="copyUrl"
40
+ />
41
+ <FButton
42
+ wide
43
+ theme="ghost"
44
+ @click="closeSharePopup"
45
+ >{{ $t('cancel') }}</FButton>
46
+ </div>
47
+ </FPopup>
48
+ </transition>
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ const {isSharePopupOpen, closeSharePopup, sharedVideoCard} = useSharePopup();
53
+
54
+ const route = useRoute();
55
+
56
+ const isCopied = ref(false);
57
+
58
+ const fullUrl = computed(() => window.location.origin + route.fullPath);
59
+
60
+ function copyUrl() {
61
+ navigator.clipboard.writeText(fullUrl.value).then(() => {
62
+ isCopied.value = true
63
+ })
64
+ }
65
+
66
+ const copyIcon = computed(() => isCopied.value ? 'check' : 'copy');
67
+ const inputText = computed(() => isCopied.value ? t('link_copied') : t('link'));
68
+
69
+ watch(() => isCopied.value, (value) => {
70
+ if (value) {
71
+ setTimeout(() => isCopied.value = false, 3000)
72
+ }
73
+ })
74
+
75
+ const { t } = useI18n()
76
+
77
+ const buttons = computed(() => {
78
+ return [
79
+ {
80
+ img: 'telegram.svg',
81
+ link: `https://t.me/share/url?url=${encodeURIComponent(fullUrl.value)}`,
82
+ text: 'Telegram',
83
+ },
84
+ {
85
+ img: 'whatsapp.svg',
86
+ link: `https://wa.me/?text=${encodeURIComponent(fullUrl.value)}`,
87
+ text: 'Whatsapp',
88
+ },
89
+ {
90
+ img: 'twitter.svg',
91
+ link: `https://twitter.com/intent/tweet?url=${encodeURIComponent(fullUrl.value)}`,
92
+ text: 'Twitter',
93
+ },
94
+ ]
95
+ })
96
+ </script>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <div class="f-sort">
3
+ <FLink
4
+ class="f-sort__button"
5
+ v-for="(item, index) in items"
6
+ :key="`sort-item-${index}`"
7
+ :to="linkTo(item, index)"
8
+ :active="isActive(item, index)"
9
+ :size="size"
10
+ :theme="theme"
11
+ >
12
+ {{ t(item.title) }}
13
+ </FLink>
14
+ </div>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ import type { ButtonSizes, IChipsItem, ButtonThemes } from '../../types';
19
+
20
+ defineProps<{
21
+ items: IChipsItem[]
22
+ theme?: ButtonThemes
23
+ size?: ButtonSizes
24
+ }>()
25
+
26
+ const {t} = useI18n();
27
+ const route = useRoute();
28
+
29
+ function linkTo(item: IChipsItem, index: number) {
30
+ if (index === 0) {
31
+ const query = { ...route.query }
32
+ delete query['sort']
33
+ delete query['page']
34
+ return { path: route.path, query: query }
35
+ }
36
+
37
+ if (!item.key) return { query: { ...route.query } }
38
+
39
+ const oldQuery = { ...route.query }
40
+ delete oldQuery['page']
41
+
42
+ return {
43
+ query: {
44
+ ...oldQuery,
45
+ [item.key]: item.value
46
+ }
47
+ }
48
+ }
49
+
50
+ function isActive(item: IChipsItem, index: number) {
51
+ if (item.key && !route.query[item.key] && index === 0) {
52
+ return true;
53
+ }
54
+
55
+ return route.query[item.key?.toLowerCase() || ''] === String(item.value)?.toLowerCase()
56
+ }
57
+ </script>
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <div class="f-videos-title">
3
+ <component :is="titleTag" class="f-videos-title__title _title">
4
+ <slot></slot>
5
+ </component>
6
+ <FCount class="f-videos-title__count" v-if="count">{{ count }}</FCount>
7
+ </div>
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ withDefaults(defineProps<{
12
+ count?: number
13
+ titleTag?: string
14
+ }>(), {
15
+ titleTag: 'h1'
16
+ })
17
+ </script>
18
+
19
+ <style scoped lang="scss">
20
+ </style>
@@ -0,0 +1,50 @@
1
+ <!--Если в кнопке иконка, обязательно ее вставлять не в дефолтный слот-->
2
+ <template>
3
+ <button
4
+ class="f-button"
5
+ :class="[
6
+ `--${theme}`,
7
+ `--${size}`,
8
+ icon && `--icon`,
9
+ {'--wide': wide},
10
+ {'--disabled': disabled},
11
+ {'--active': active},
12
+ ]"
13
+ :type="type"
14
+ v-bind="$attrs"
15
+ :title="title || slotText"
16
+ >
17
+ <slot></slot>
18
+ </button>
19
+ </template>
20
+
21
+ <script setup lang="ts">
22
+ withDefaults(
23
+ defineProps<{
24
+ type?: 'button' | 'submit' | 'reset',
25
+ theme?: 'primary' | 'secondary' | 'ghost' | 'bordered' | 'tab',
26
+ size?: 'm' | 's',
27
+ icon?: boolean,
28
+ wide?: boolean,
29
+ disabled?: boolean,
30
+ active?: boolean,
31
+ title?: string,
32
+ }>(),
33
+ {
34
+ type: 'button',
35
+ theme: 'primary',
36
+ size: 'm',
37
+ }
38
+ )
39
+
40
+ const slots = useSlots()
41
+
42
+ const slotText = computed(() => {
43
+ const content = slots.default?.()
44
+ if (!content) return ''
45
+ return content
46
+ .map(vnode => vnode.children)
47
+ .filter(c => typeof c === 'string')
48
+ .join(' ')
49
+ })
50
+ </script>
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <label
3
+ class="f-checkbox"
4
+ :class="[
5
+ {'f-checkbox--disabled': disabled},
6
+ {'f-checkbox--error': error},
7
+ ]"
8
+ >
9
+ <input
10
+ class="f-checkbox__input _visually-hidden"
11
+ type="checkbox"
12
+ :name="name"
13
+ :checked="modelValue"
14
+ @change="onChange"
15
+ v-bind="$attrs"
16
+ >
17
+ <span class="f-checkbox__check">
18
+ <FIcon
19
+ class="f-checkbox__check-icon"
20
+ name="check"
21
+ size="20"
22
+ />
23
+ </span>
24
+ <span class="f-checkbox__label">
25
+ <slot></slot>
26
+ </span>
27
+ <span
28
+ v-if="$slots.description"
29
+ class="f-checkbox__description"
30
+ >
31
+ <slot name="description"></slot>
32
+ </span>
33
+ </label>
34
+ </template>
35
+
36
+ <script setup lang="ts">
37
+ const props = defineProps<{
38
+ modelValue: boolean | undefined
39
+ name?: string
40
+ disabled?: boolean
41
+ error?: boolean
42
+ }>()
43
+
44
+ const emit = defineEmits<{
45
+ (eventName: 'update:modelValue', value: Boolean): void
46
+ (eventName: 'update:error', value: boolean): void
47
+ }>()
48
+
49
+ function onChange(event: Event) {
50
+ emit('update:modelValue', event.target?.checked)
51
+ if (props.error) {
52
+ emit('update:error', false);
53
+ }
54
+ }
55
+ </script>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <component
3
+ :is="component"
4
+ class="f-chips"
5
+ :class="{
6
+ '--active': isActive,
7
+ '--alphabet': alphabet,
8
+ '--small': mini,
9
+ '--not-capitalize': item.prefix === 'search' || notCapitalize,
10
+ '--bright': bright
11
+ }"
12
+ :to="href"
13
+ v-bind="{ ...$attrs, ...(component === 'button' ? { type: 'button' } : {}) }"
14
+ :title="name"
15
+ @click="onButtonClick"
16
+ >
17
+ <FIcon
18
+ v-if="item.icon"
19
+ :name="item.icon"
20
+ size="16"
21
+ />
22
+ {{ name }}
23
+ <FIcon
24
+ v-if="(isActive && !withoutClose && item.value !== 'reset' && !mini) || withClose"
25
+ class="f-chips__close"
26
+ name="close"
27
+ size="16"
28
+ />
29
+ </component>
30
+ </template>
31
+
32
+ <script setup lang="ts">
33
+ import type { IChipsItem } from '../../types';
34
+ import { convertString } from '../../runtime';
35
+
36
+ const props = defineProps<{
37
+ item: IChipsItem
38
+ allLink?: boolean
39
+ alphabet?: boolean
40
+ active?: boolean
41
+ withoutClose?: boolean
42
+ withClose?: boolean
43
+ isLink?: boolean
44
+ mini?: boolean
45
+ bright?: boolean
46
+ notCapitalize?: boolean
47
+ }>()
48
+
49
+ const emit = defineEmits<{
50
+ (eventName: 'click'): void
51
+ }>()
52
+
53
+ const route = useRoute()
54
+
55
+ const { generateLink } = useGenerateLink();
56
+
57
+ const isActive = computed(() => {
58
+ if (props.active || props.item.value === 'reset' && !route.params.slug) {
59
+ return true
60
+ }
61
+ return ((convertString().fromSlug(String(route.params.slug))).toLowerCase() === props.item.title.toLowerCase()) && route.path.includes(props.item.prefix || '');
62
+ })
63
+ const component = computed(() => {
64
+ if (props.isLink) {
65
+ return resolveComponent('NuxtLink')
66
+ }
67
+ return 'button'
68
+ })
69
+
70
+ const link = computed(() => {
71
+ if (props.item.value === 'reset') {
72
+ // клик по popular
73
+ return `/${props.item.prefix}`
74
+ }
75
+ if (props.allLink) {
76
+ // временно пока не перешли на value
77
+ return `/${props.item.value}`
78
+ }
79
+ if (props.item.value && props.item.prefix) {
80
+ if (route.params.slug === props.item.title) {
81
+ // возврат, при активном состоянии
82
+ return props.alphabet ? `/${props.item.prefix}` : '/';
83
+ }
84
+ if (props.alphabet) {
85
+ return `/${props.item.prefix}/letter/${convertString().toSlug(props.item.title)}`;
86
+ }
87
+ return `/${props.item.prefix}/${convertString().toSlug(String(props.item.value))}`;
88
+ }
89
+ return ''
90
+ })
91
+
92
+ const href = computed(() => {
93
+ if (props.isLink) {
94
+ if (convertString().fromSlug(String(route.params.slug)).toLowerCase() === props.item.title.toLowerCase() && route.path.includes(props.item?.prefix || '')) {
95
+ return generateLink(props.item?.prefix || '')
96
+ } else if ((props.item.value && props.item.prefix) || props.allLink) {
97
+ return generateLink(link.value)
98
+ }
99
+ return generateLink(`/${props.item?.prefix}/${link.value}`)
100
+ }
101
+ return null
102
+ })
103
+
104
+ function onButtonClick() {
105
+ if (!props.isLink) {
106
+ emit('click')
107
+ }
108
+ }
109
+
110
+ const name = computed(() => {
111
+ if (props.item?.title.toLowerCase() === 'post') {
112
+ return '#'
113
+ }
114
+ return props.item.title
115
+ })
116
+ </script>
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <span
3
+ class="f-count"
4
+ ><slot></slot>
5
+ </span>
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ </script>
10
+
11
+ <style scoped lang="scss">
12
+ </style>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <FImg
3
+ class="f-country"
4
+ :sizes="sizes"
5
+ :width="width"
6
+ :height="height"
7
+ :src="src || '/img/flags/um.svg'"
8
+ alt="country"
9
+ />
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ withDefaults( defineProps<{
14
+ width?: number
15
+ height?: number
16
+ sizes?: string
17
+ src?: string
18
+ }>(), {
19
+ width: 16,
20
+ height: 16,
21
+ sizes: '16px',
22
+ })
23
+ </script>
24
+
25
+ <style scoped lang="scss">
26
+ </style>