@myelophone/nuxt 0.18.2

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 (259) hide show
  1. package/.devcontainer/Dockerfile +7 -0
  2. package/.devcontainer/devcontainer.json +21 -0
  3. package/.editorconfig +43 -0
  4. package/.github/workflows/package.yml +73 -0
  5. package/.nuxtignore +6 -0
  6. package/.releaserc.js +132 -0
  7. package/.yarn/releases/yarn-4.18.0.cjs +1000 -0
  8. package/.yarnrc.yml +8 -0
  9. package/CHANGELOG.md +141 -0
  10. package/LICENSE +77 -0
  11. package/README.md +3004 -0
  12. package/app/app.vue +455 -0
  13. package/app/assets/css/animation.css +81 -0
  14. package/app/assets/css/backgrounds.css +57 -0
  15. package/app/assets/css/base.css +182 -0
  16. package/app/assets/css/index.css +9 -0
  17. package/app/assets/css/links.css +12 -0
  18. package/app/assets/css/multimedia.css +102 -0
  19. package/app/assets/css/preloader.css +68 -0
  20. package/app/assets/css/print.css +40 -0
  21. package/app/assets/css/tailwind.css +20 -0
  22. package/app/assets/css/theme.css +29 -0
  23. package/app/components/consent/GoogleMap.vue +59 -0
  24. package/app/components/consent/Youtube.vue +27 -0
  25. package/app/components/cookie/Banner.vue +70 -0
  26. package/app/components/cookie/ConsentWrapper.vue +71 -0
  27. package/app/components/cookie/PrivacyPolicy.vue +179 -0
  28. package/app/components/cookie/SettingsModal.vue +387 -0
  29. package/app/components/grid/Col.vue +262 -0
  30. package/app/components/grid/Container.vue +236 -0
  31. package/app/components/grid/Row.vue +248 -0
  32. package/app/components/grid/Stack.vue +233 -0
  33. package/app/components/myelophone/Copyright.vue +5 -0
  34. package/app/components/myelophone/Welcome.vue +107 -0
  35. package/app/components/page/FullscreenPreloader.vue +177 -0
  36. package/app/components/page/Preloader.vue +18 -0
  37. package/app/components/page/ReadyLocalized.vue +19 -0
  38. package/app/components/ready/.gitkeep +0 -0
  39. package/app/components/safe/Email.vue +52 -0
  40. package/app/components/safe/ImgWithLoader.vue +180 -0
  41. package/app/components/safe/NuxtImg.vue +25 -0
  42. package/app/components/safe/NuxtPicture.vue +29 -0
  43. package/app/components/section/.gitkeep +0 -0
  44. package/app/components/seo/BrandInfo.vue +76 -0
  45. package/app/components/seo/ContentNoIndex.vue +35 -0
  46. package/app/components/seo/NoIndex.vue +22 -0
  47. package/app/components/seo/OrgInfo.vue +130 -0
  48. package/app/components/seo/ProfileInfo.vue +137 -0
  49. package/app/components/ui/Accordion.vue +163 -0
  50. package/app/components/ui/Alert.vue +179 -0
  51. package/app/components/ui/Avatar.vue +88 -0
  52. package/app/components/ui/Badge.vue +150 -0
  53. package/app/components/ui/Banner.vue +133 -0
  54. package/app/components/ui/Button.vue +175 -0
  55. package/app/components/ui/Card.vue +66 -0
  56. package/app/components/ui/Checkbox.vue +134 -0
  57. package/app/components/ui/Chip.vue +136 -0
  58. package/app/components/ui/CommandPalette.vue +434 -0
  59. package/app/components/ui/Console.vue +583 -0
  60. package/app/components/ui/CursorCreative.vue +148 -0
  61. package/app/components/ui/FeatureAccordion.vue +165 -0
  62. package/app/components/ui/FileUpload.vue +705 -0
  63. package/app/components/ui/GeoDependent.vue +72 -0
  64. package/app/components/ui/Heading.vue +51 -0
  65. package/app/components/ui/Icon.vue +42 -0
  66. package/app/components/ui/Icon8.vue +39 -0
  67. package/app/components/ui/Input.vue +88 -0
  68. package/app/components/ui/LangLink.vue +34 -0
  69. package/app/components/ui/LangVisible.vue +33 -0
  70. package/app/components/ui/LanguageSelect.vue +202 -0
  71. package/app/components/ui/LightBox.vue +155 -0
  72. package/app/components/ui/LocalTime.vue +170 -0
  73. package/app/components/ui/Modal.vue +161 -0
  74. package/app/components/ui/Popup.vue +200 -0
  75. package/app/components/ui/PostContent.server.vue +23 -0
  76. package/app/components/ui/ProtectedEmail.vue +52 -0
  77. package/app/components/ui/RelativeTime.vue +141 -0
  78. package/app/components/ui/ScheduledContent.vue +150 -0
  79. package/app/components/ui/ScrollToTop.client.vue +48 -0
  80. package/app/components/ui/SegmentedControl.vue +148 -0
  81. package/app/components/ui/SiteSearch.vue +1191 -0
  82. package/app/components/ui/Skeleton.vue +91 -0
  83. package/app/components/ui/SmartContrast.vue +74 -0
  84. package/app/components/ui/SnapContainer.vue +222 -0
  85. package/app/components/ui/SnapSection.vue +294 -0
  86. package/app/components/ui/SonnerStyle.vue +7 -0
  87. package/app/components/ui/SplitSection.vue +99 -0
  88. package/app/components/ui/Steps.vue +858 -0
  89. package/app/components/ui/StickyWrapper.vue +46 -0
  90. package/app/components/ui/Table.vue +251 -0
  91. package/app/components/ui/Tabs.vue +451 -0
  92. package/app/components/ui/TextColumn.vue +36 -0
  93. package/app/components/ui/Textarea.vue +251 -0
  94. package/app/components/ui/Toggler.vue +40 -0
  95. package/app/components/ui/Tooltip.vue +524 -0
  96. package/app/components/ui/TruncateText.vue +105 -0
  97. package/app/components/ui/ViewportSpacer.vue +72 -0
  98. package/app/components/view/AnimatedCounter.vue +121 -0
  99. package/app/components/view/AnnouncementBar.vue +104 -0
  100. package/app/components/view/AvatarGroup.vue +104 -0
  101. package/app/components/view/Breadcrumbs.vue +97 -0
  102. package/app/components/view/ContentWithToc.vue +152 -0
  103. package/app/components/view/Copyright.vue +68 -0
  104. package/app/components/view/CountdownTimer.vue +184 -0
  105. package/app/components/view/CreativeCTA.vue +143 -0
  106. package/app/components/view/CurrencySelect.vue +254 -0
  107. package/app/components/view/FeatureBoxGrid.vue +142 -0
  108. package/app/components/view/HorizontalMenu.vue +97 -0
  109. package/app/components/view/ImageCompare.vue +141 -0
  110. package/app/components/view/ImgSlider.vue +333 -0
  111. package/app/components/view/InfiniteMarquee.vue +147 -0
  112. package/app/components/view/InfoBar.vue +86 -0
  113. package/app/components/view/LogoGrid.vue +106 -0
  114. package/app/components/view/LogoSlider.vue +83 -0
  115. package/app/components/view/NotFound.vue +81 -0
  116. package/app/components/view/PartialBackground.vue +313 -0
  117. package/app/components/view/QuoteBig.vue +111 -0
  118. package/app/components/view/ResponsiveMenu.vue +219 -0
  119. package/app/components/view/ReviewsSlider.vue +230 -0
  120. package/app/components/view/SocialBar.vue +78 -0
  121. package/app/components/view/StickyHeadingContent.vue +158 -0
  122. package/app/components/view/TallyForm.vue +295 -0
  123. package/app/components/view/WarningOutdated.vue +113 -0
  124. package/app/composables/useApi.ts +88 -0
  125. package/app/composables/useAppSeo.ts +78 -0
  126. package/app/composables/useBreadcrumbs.ts +106 -0
  127. package/app/composables/useChangeUrl.ts +73 -0
  128. package/app/composables/useCommand.ts +28 -0
  129. package/app/composables/useCookieControl.ts +111 -0
  130. package/app/composables/useCookieModal.ts +9 -0
  131. package/app/composables/useDevice.ts +109 -0
  132. package/app/composables/useGeoFetch.ts +139 -0
  133. package/app/composables/useLoadScript.ts +36 -0
  134. package/app/composables/useModalState.ts +37 -0
  135. package/app/composables/useMultiLang.ts +278 -0
  136. package/app/composables/useNetwork.ts +49 -0
  137. package/app/composables/useNuxtVersion.ts +5 -0
  138. package/app/composables/usePiniaStore.ts +5 -0
  139. package/app/composables/usePopupControl.ts +57 -0
  140. package/app/composables/useQuery.ts +307 -0
  141. package/app/composables/useReadyPage.ts +182 -0
  142. package/app/composables/useSafeList.ts +90 -0
  143. package/app/composables/useScriptLoader.ts +221 -0
  144. package/app/composables/useSiteSearch.ts +32 -0
  145. package/app/composables/useSnapScroll.ts +24 -0
  146. package/app/composables/useStatic.ts +5 -0
  147. package/app/composables/useStorage.ts +252 -0
  148. package/app/composables/useStoreBroadcast.ts +146 -0
  149. package/app/composables/useThemeSync.ts +81 -0
  150. package/app/constants/layout.ts +109 -0
  151. package/app/constants/predefinedCookieScripts.ts +1222 -0
  152. package/app/constants/ui-events.ts +1 -0
  153. package/app/error.vue +169 -0
  154. package/app/layouts/default-blog.vue +5 -0
  155. package/app/layouts/default.vue +3 -0
  156. package/app/locales/en/commands.json +5 -0
  157. package/app/locales/en/cookies.json +182 -0
  158. package/app/locales/en/error.json +4 -0
  159. package/app/locales/en/interface.json +33 -0
  160. package/app/locales/en/myelophone.json +8 -0
  161. package/app/locales/en/outdated.json +5 -0
  162. package/app/locales/en/times.json +18 -0
  163. package/app/locales/pl/commands.json +5 -0
  164. package/app/locales/pl/cookies.json +182 -0
  165. package/app/locales/pl/error.json +4 -0
  166. package/app/locales/pl/interface.json +33 -0
  167. package/app/locales/pl/myelophone.json +8 -0
  168. package/app/locales/pl/outdated.json +5 -0
  169. package/app/locales/pl/times.json +18 -0
  170. package/app/locales/ru/commands.json +5 -0
  171. package/app/locales/ru/cookies.json +182 -0
  172. package/app/locales/ru/error.json +4 -0
  173. package/app/locales/ru/interface.json +33 -0
  174. package/app/locales/ru/myelophone.json +8 -0
  175. package/app/locales/ru/outdated.json +5 -0
  176. package/app/locales/ru/times.json +18 -0
  177. package/app/middleware/blog-layout.ts +28 -0
  178. package/app/middleware/i18n.global.ts +17 -0
  179. package/app/middleware/not-found-status.ts +11 -0
  180. package/app/modules/default-blog/index.ts +39 -0
  181. package/app/modules/default-blog/posts.ts +80 -0
  182. package/app/modules/default-sitemap/index.ts +116 -0
  183. package/app/modules/default-sitemap/runtime/sitemap.get.ts +42 -0
  184. package/app/modules/fullscreen-preloader/module.ts +43 -0
  185. package/app/modules/htaccess/.htaccess +38 -0
  186. package/app/modules/htaccess/index.ts +23 -0
  187. package/app/modules/i18n-shaker.mjs +221 -0
  188. package/app/modules/multi18n/module.ts +71 -0
  189. package/app/modules/myelophone-config/module.ts +241 -0
  190. package/app/pages/[...all].vue +9 -0
  191. package/app/pages/index.vue +3 -0
  192. package/app/pages/post/[...slug].vue +30 -0
  193. package/app/plugins/bfcache-refresh.client.ts +9 -0
  194. package/app/plugins/canonical.ts +30 -0
  195. package/app/plugins/csp-nonce.server.ts +41 -0
  196. package/app/plugins/multi18n.client.ts +21 -0
  197. package/app/plugins/multi18n.server.ts +15 -0
  198. package/app/plugins/nuxt-version.client.ts +4 -0
  199. package/app/plugins/restore.client.ts +21 -0
  200. package/app/plugins/reveal.ts +89 -0
  201. package/app/plugins/url-helper.client.ts +66 -0
  202. package/app/server/api/exchange-rates.get.ts +216 -0
  203. package/app/server/api/healthz.ts +1 -0
  204. package/app/server/api/logout.post.ts +6 -0
  205. package/app/server/middleware/normalize-url.ts +14 -0
  206. package/app/server/middleware/security-headers.ts +147 -0
  207. package/app/server/middleware/url-helper.ts +43 -0
  208. package/app/server/plugins/clean-html-spaces.ts +15 -0
  209. package/app/server/plugins/clean-styles.ts +94 -0
  210. package/app/server/plugins/compression.ts +122 -0
  211. package/app/server/plugins/css-preload.ts +26 -0
  212. package/app/server/plugins/early-hints.ts +31 -0
  213. package/app/server/plugins/force-noindex.ts +43 -0
  214. package/app/server/plugins/html-one-line.ts +17 -0
  215. package/app/server/plugins/inline-style.ts +7 -0
  216. package/app/server/routes/healthz.get.ts +1 -0
  217. package/app/server/tsconfig.json +3 -0
  218. package/app/stores/cart.ts +945 -0
  219. package/app/stores/commands.ts +43 -0
  220. package/app/stores/device.ts +156 -0
  221. package/app/stores/querySync.ts +5 -0
  222. package/app/stores/settings.ts +145 -0
  223. package/app/stores/user.ts +607 -0
  224. package/app/types/cookie.ts +89 -0
  225. package/app/types/myelophone.d.ts +87 -0
  226. package/app/types/site-search.ts +110 -0
  227. package/app/utils/asyncRefresh.ts +4 -0
  228. package/app/utils/blog.server.ts +142 -0
  229. package/app/utils/jsonLd.ts +56 -0
  230. package/app/utils/myelophoneConfig.ts +4 -0
  231. package/app/utils/sortBy.ts +18 -0
  232. package/app/utils/transliterate.ts +75 -0
  233. package/app/utils/ytVideo.ts +37 -0
  234. package/app/workers/site-search.worker.ts +661 -0
  235. package/biome.json +94 -0
  236. package/commitlint.config.js +3 -0
  237. package/nuxt.config.ts +539 -0
  238. package/package.json +101 -0
  239. package/playground/content/.gitkeep +0 -0
  240. package/playground/locales/.gitkeep +0 -0
  241. package/playground/myelophone.dev.ts +45 -0
  242. package/playground/nuxt.config.ts +105 -0
  243. package/playground/package.json +5 -0
  244. package/playground/pages/.gitkeep +0 -0
  245. package/playground/tsconfig.json +3 -0
  246. package/playwright.config.ts +23 -0
  247. package/public/browsers/chrome.svg +77 -0
  248. package/public/browsers/edge.svg +98 -0
  249. package/public/browsers/firefox.svg +300 -0
  250. package/public/favicon.ico +0 -0
  251. package/public/myelophone_eng.png +0 -0
  252. package/public/myelophone_eng_white.png +0 -0
  253. package/spa-loading-template.html +72 -0
  254. package/tests/home.spec.ts +9 -0
  255. package/tests/utils.ts +23 -0
  256. package/tsconfig.json +16 -0
  257. package/vite/plugins/clean-css.ts +190 -0
  258. package/vite/plugins/postcss-add-viewportunits.ts +33 -0
  259. package/vite/plugins/postcss-viewport-fallback.ts +49 -0
@@ -0,0 +1,72 @@
1
+ <script setup lang="ts">
2
+ interface GeoRules {
3
+ whitelist?: string[];
4
+ blacklist?: string[];
5
+ }
6
+
7
+ const props = defineProps<{
8
+ rules: GeoRules;
9
+ geoData?: { country?: string };
10
+ }>();
11
+
12
+ const { geo, resolve } = useGeoFetch();
13
+ const localVisible = ref(false);
14
+
15
+ const checkVisibility = (countryCode: string) => {
16
+ const current = countryCode.trim().toUpperCase();
17
+ const normalize = (list: string[]) =>
18
+ list.map((i) => i.trim().toUpperCase());
19
+
20
+ if (props.rules.whitelist) {
21
+ return normalize(props.rules.whitelist).includes(current);
22
+ }
23
+ if (props.rules.blacklist) {
24
+ return !normalize(props.rules.blacklist).includes(current);
25
+ }
26
+ return true;
27
+ };
28
+
29
+ watchEffect(async () => {
30
+ const countrySource =
31
+ props.geoData?.country ||
32
+ (geo.value.resolved ? geo.value.country : null);
33
+
34
+ if (countrySource !== null) {
35
+ const shouldShow = checkVisibility(countrySource);
36
+ if (shouldShow) {
37
+ await nextTick();
38
+ localVisible.value = true;
39
+ } else {
40
+ localVisible.value = false;
41
+ }
42
+ }
43
+ });
44
+
45
+ onMounted(() => {
46
+ if (!props.geoData) {
47
+ resolve();
48
+ }
49
+ });
50
+ </script>
51
+
52
+ <template>
53
+ <ClientOnly>
54
+ <Transition name="fade" appear>
55
+ <div v-if="localVisible" class="geo-wrapper" data-nosnippet>
56
+ <slot />
57
+ </div>
58
+ </Transition>
59
+ </ClientOnly>
60
+ </template>
61
+
62
+ <style scoped>
63
+ .fade-enter-active {
64
+ transition: opacity 0.6s ease-out;
65
+ }
66
+ .fade-enter-from {
67
+ opacity: 0;
68
+ }
69
+ .geo-wrapper {
70
+ display: contents;
71
+ }
72
+ </style>
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <component :is="tag" :class="headingClass">
3
+ <slot />
4
+ </component>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ const props = defineProps<{
9
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
10
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | "display";
11
+ class?: string;
12
+ }>();
13
+
14
+ const tag = computed(() => `h${props.level || 2}`);
15
+
16
+ const defaultClasses: Record<number, string> = {
17
+ 1: "text-4xl font-semibold",
18
+ 2: "text-3xl font-semibold",
19
+ 3: "text-2xl font-semibold",
20
+ 4: "text-xl font-medium",
21
+ 5: "text-lg font-medium",
22
+ 6: "text-base font-normal",
23
+ };
24
+
25
+ const fontWeightClasses: Record<number, string> = {
26
+ 1: "font-semibold",
27
+ 2: "font-semibold",
28
+ 3: "font-semibold",
29
+ 4: "font-medium",
30
+ 5: "font-medium",
31
+ 6: "font-normal",
32
+ };
33
+
34
+ const sizeClasses = {
35
+ xs: "text-xl",
36
+ sm: "text-2xl",
37
+ md: "text-3xl",
38
+ lg: "text-4xl md:text-5xl",
39
+ xl: "text-5xl md:text-6xl",
40
+ display: "text-5xl md:text-7xl lg:text-8xl",
41
+ } as const;
42
+
43
+ const headingClass = computed(() => {
44
+ const level = props.level || 1;
45
+ const typography = props.size
46
+ ? `${sizeClasses[props.size]} ${fontWeightClasses[level]}`
47
+ : defaultClasses[level];
48
+
49
+ return `${typography} ${props.class || ""}`.trim();
50
+ });
51
+ </script>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <span
3
+ class="app-icon shadow-none"
4
+ :class="[props.class, !normalizedSize ? 'w-5 h-5' : '']"
5
+ :style="{
6
+ '--icon-url': `url(${iconUrl})`,
7
+ width: normalizedSize || undefined,
8
+ height: normalizedSize || undefined,
9
+ }"
10
+ role="img"
11
+ />
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import type { HTMLAttributes } from "vue";
16
+
17
+ interface Props {
18
+ name: string;
19
+ size?: string | number;
20
+ class?: HTMLAttributes["class"];
21
+ }
22
+
23
+ const props = defineProps<Props>();
24
+
25
+ const [prefix, iconName] = props.name.split(":");
26
+
27
+ const iconUrl = computed(
28
+ () => `https://api.iconify.design/${prefix}/${iconName}.svg`,
29
+ );
30
+
31
+ const normalizedSize = computed(() => {
32
+ if (!props.size) return null;
33
+
34
+ const s = String(props.size);
35
+
36
+ if (/^\d+$/.test(s)) return `${s}px`;
37
+
38
+ if (/^\d+(\.\d+)?(px|rem|em|vh|vw|%|pt|pc|in|cm|mm)$/.test(s)) return s;
39
+
40
+ return s;
41
+ });
42
+ </script>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <img
3
+ class="inline-block"
4
+ :src="iconUrl"
5
+ :alt="icon"
6
+ :width="size"
7
+ :height="size"
8
+ v-bind="$attrs"
9
+ />
10
+ </template>
11
+
12
+ <script setup>
13
+ const props = defineProps({
14
+ icon: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ type: {
19
+ type: String,
20
+ default: "ios-filled",
21
+ },
22
+ size: {
23
+ type: [String, Number],
24
+ default: 28,
25
+ },
26
+ color: {
27
+ type: String,
28
+ default: "000000",
29
+ },
30
+ });
31
+
32
+ const formattedColor = computed(() => {
33
+ return props.color.startsWith("#") ? props.color.substring(1) : props.color;
34
+ });
35
+
36
+ const iconUrl = computed(() => {
37
+ return `https://img.icons8.com/${props.type}/${props.size}/${formattedColor.value}/${props.icon}.png`;
38
+ });
39
+ </script>
@@ -0,0 +1,88 @@
1
+ <script setup lang="ts">
2
+ const props = defineProps({
3
+ modelValue: [String, Number],
4
+ id: {
5
+ type: String,
6
+ default: undefined,
7
+ },
8
+ type: {
9
+ type: String,
10
+ default: "text",
11
+ },
12
+ label: String,
13
+ placeholder: {
14
+ type: String,
15
+ default: " ",
16
+ },
17
+ icon: String,
18
+ iconPosition: {
19
+ type: String as () => "start" | "end",
20
+ default: "end",
21
+ },
22
+ disabled: Boolean,
23
+ });
24
+
25
+ const emit = defineEmits(["update:modelValue"]);
26
+
27
+ const generatedId = ref<string | undefined>(undefined);
28
+
29
+ onMounted(() => {
30
+ if (!props.id && !generatedId.value) {
31
+ generatedId.value = `input-${Math.random().toString(36).slice(2)}`;
32
+ }
33
+ });
34
+
35
+ const inputId = computed(() => props.id || generatedId.value);
36
+
37
+ const hasValue = computed(
38
+ () => props.modelValue != null && props.modelValue !== "",
39
+ );
40
+
41
+ const iconClasses = computed(
42
+ () =>
43
+ `absolute inset-y-0 top-[-8px] ${
44
+ props.iconPosition === "start" ? "left-0 pl-3" : "right-0 pr-3"
45
+ } flex items-center text-[var(--ui-text)]`,
46
+ );
47
+
48
+ const inputPadding = computed(() => {
49
+ if (!props.icon) return "px-3";
50
+ return props.iconPosition === "start" ? "ps-9 pe-3" : "ps-3 pe-9";
51
+ });
52
+ </script>
53
+
54
+ <template>
55
+ <label :for="inputId" class="relative block">
56
+ <input
57
+ :id="inputId"
58
+ :type="type"
59
+ :value="modelValue"
60
+ :placeholder="placeholder"
61
+ :disabled="disabled"
62
+ @input="
63
+ emit(
64
+ 'update:modelValue',
65
+ ($event.target as HTMLInputElement).value,
66
+ )
67
+ "
68
+ class="peer w-full h-11 rounded-md border bg-(--ui-bg) text-(--ui-text) transition-all sm:text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 dark:focus:border-blue-400 dark:focus:ring-blue-400 disabled:opacity-60 disabled:cursor-not-allowed mb-2 leading-6 pt-2.5 pb-2.5"
69
+ :class="inputPadding"
70
+ />
71
+
72
+ <span
73
+ v-if="label"
74
+ class="absolute top-3 left-3 text-(--ui-text) text-sm font-medium bg-(--ui-bg) px-2 transition-all duration-150 peer-focus:-translate-y-5 peer-focus:scale-[0.85] peer-focus:text-blue-600 peer-focus:px-2 peer-focus:left-3 dark:peer-focus:text-blue-400 cursor-text leading-[1.1rem]"
75
+ :class="{
76
+ '-translate-y-5 scale-[0.85] text-blue-600 dark:text-blue-400 px-2 left-3':
77
+ hasValue,
78
+ 'ps-9': icon && iconPosition === 'start' && !hasValue,
79
+ }"
80
+ >
81
+ {{ label }}
82
+ </span>
83
+
84
+ <span v-if="icon" :class="iconClasses">
85
+ <UiIcon :name="icon" class="w-4 h-4" />
86
+ </span>
87
+ </label>
88
+ </template>
@@ -0,0 +1,34 @@
1
+ <script setup lang="ts">
2
+ interface Props {
3
+ to: string;
4
+ exact?: boolean;
5
+ replace?: boolean;
6
+ }
7
+
8
+ const props = defineProps<Props>();
9
+ const pinia = useNuxtApp().$pinia;
10
+ const settingsStore = useSettingsStore(pinia);
11
+
12
+ const localizedTo = computed(() => {
13
+ const current = settingsStore.currentLocale;
14
+ const defaultLocale = settingsStore.defaultLocale;
15
+
16
+ if (!current || !props.to) return props.to;
17
+
18
+ if (current === defaultLocale) return props.to;
19
+
20
+ const normalized = props.to.startsWith("/") ? props.to : `/${props.to}`;
21
+
22
+ if (normalized.startsWith(`/${current}/`) || normalized === `/${current}`) {
23
+ return normalized;
24
+ }
25
+
26
+ return normalized === "/" ? `/${current}` : `/${current}${normalized}`;
27
+ });
28
+ </script>
29
+
30
+ <template>
31
+ <NuxtLink :to="localizedTo" :exact="exact" :replace="replace">
32
+ <slot />
33
+ </NuxtLink>
34
+ </template>
@@ -0,0 +1,33 @@
1
+ <script setup lang="ts">
2
+ interface Props {
3
+ only?: string | string[];
4
+ except?: string | string[];
5
+ }
6
+
7
+ const props = defineProps<Props>();
8
+
9
+ const pinia = useNuxtApp().$pinia;
10
+ const settings = useSettingsStore(pinia);
11
+
12
+ const isVisible = computed(() => {
13
+ const locale = settings.currentLocale || settings.defaultLocale || "en";
14
+
15
+ if (props.only) {
16
+ const list = Array.isArray(props.only) ? props.only : [props.only];
17
+ return list.includes(locale);
18
+ }
19
+
20
+ if (props.except) {
21
+ const list = Array.isArray(props.except)
22
+ ? props.except
23
+ : [props.except];
24
+ return !list.includes(locale);
25
+ }
26
+
27
+ return true;
28
+ });
29
+ </script>
30
+
31
+ <template>
32
+ <slot v-if="isVisible" />
33
+ </template>
@@ -0,0 +1,202 @@
1
+ <template>
2
+ <div
3
+ ref="selectWrapper"
4
+ class="ui-lang-select"
5
+ :class="[
6
+ containerClass,
7
+ {
8
+ 'is-open': isOpen,
9
+ 'drop-up': isDropUp,
10
+ 'drop-right': isDropRight,
11
+ },
12
+ ]"
13
+ @mousedown.stop
14
+ >
15
+ <button
16
+ type="button"
17
+ class="lang-trigger"
18
+ :class="triggerClass"
19
+ @click.stop="toggleDropdown"
20
+ >
21
+ <slot name="trigger">
22
+ <span v-if="showFull" class="lang-text">{{
23
+ t(`common.${settingsStore.currentLocale}`)
24
+ }}</span>
25
+ <span v-else class="lang-text">{{
26
+ settingsStore.currentLocale
27
+ }}</span>
28
+ </slot>
29
+ <span class="lang-arrow"></span>
30
+ </button>
31
+
32
+ <div v-if="isOpen" class="lang-dropdown" :class="dropdownClass">
33
+ <div class="lang-dropdown-scroll">
34
+ <button
35
+ v-for="lang in uniqueLocales"
36
+ :key="lang"
37
+ type="button"
38
+ class="lang-option"
39
+ :class="[
40
+ optionClass,
41
+ { 'is-selected': settingsStore.currentLocale === lang },
42
+ ]"
43
+ @click="selectLanguage(lang)"
44
+ >
45
+ <span v-if="showFull" class="lang-text">{{
46
+ t(`common.${lang}`)
47
+ }}</span>
48
+ <span v-else class="lang-text">{{ lang }}</span>
49
+ </button>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </template>
54
+
55
+ <script setup lang="ts">
56
+ const props = defineProps<{
57
+ showFull?: boolean;
58
+ containerClass?: string;
59
+ triggerClass?: string;
60
+ dropdownClass?: string;
61
+ optionClass?: string;
62
+ }>();
63
+
64
+ const { t } = useMultiLang(["common"]);
65
+ const settingsStore = useSettingsStore(useNuxtApp().$pinia);
66
+
67
+ const isOpen = ref(false);
68
+ const isDropUp = ref(false);
69
+ const isDropRight = ref(false);
70
+ const selectWrapper = ref<HTMLElement | null>(null);
71
+
72
+ const uniqueLocales = computed(() => [...new Set(settingsStore.locales || [])]);
73
+
74
+ const toggleDropdown = () => {
75
+ if (!isOpen.value) checkPosition();
76
+ isOpen.value = !isOpen.value;
77
+ };
78
+
79
+ const checkPosition = () => {
80
+ if (!selectWrapper.value) return;
81
+ const rect = selectWrapper.value.getBoundingClientRect();
82
+ isDropUp.value = window.innerHeight - rect.bottom < 200;
83
+ isDropRight.value = window.innerWidth - rect.left < 150;
84
+ };
85
+
86
+ const selectLanguage = (lang: string) => {
87
+ settingsStore.setLocale(lang);
88
+ isOpen.value = false;
89
+ };
90
+
91
+ const close = () => {
92
+ isOpen.value = false;
93
+ };
94
+
95
+ onMounted(() => {
96
+ window.addEventListener("click", close);
97
+ window.addEventListener("resize", close);
98
+ });
99
+
100
+ onBeforeUnmount(() => {
101
+ window.removeEventListener("click", close);
102
+ window.removeEventListener("resize", close);
103
+ });
104
+ </script>
105
+
106
+ <style scoped>
107
+ .ui-lang-select {
108
+ position: relative;
109
+ display: inline-block;
110
+ --bg: var(--ui-bg);
111
+ --brd: var(--ui-border);
112
+ --txt: var(--ui-text);
113
+ --ui-hover: rgba(128, 128, 128, 0.1);
114
+ }
115
+
116
+ .lang-trigger {
117
+ cursor: pointer;
118
+ background: var(--bg);
119
+ border: 1px solid var(--brd);
120
+ color: var(--txt);
121
+ padding: 8px 14px;
122
+ display: flex;
123
+ align-items: center;
124
+ gap: 10px;
125
+ text-transform: uppercase;
126
+ font-family: inherit;
127
+ font-weight: 400;
128
+ transition: background 0.2s;
129
+ }
130
+
131
+ .lang-text {
132
+ font-size: 1rem;
133
+ line-height: 1;
134
+ }
135
+
136
+ .lang-trigger:hover {
137
+ background: var(--ui-hover);
138
+ }
139
+
140
+ .lang-arrow {
141
+ width: 6px;
142
+ height: 6px;
143
+ border-right: 1px solid var(--txt);
144
+ border-bottom: 1px solid var(--txt);
145
+ transform: rotate(45deg) translateY(-2px);
146
+ opacity: 0.6;
147
+ }
148
+
149
+ .is-open .lang-arrow {
150
+ transform: rotate(-135deg) translateY(1px);
151
+ }
152
+
153
+ .lang-dropdown {
154
+ position: absolute;
155
+ top: calc(100% + 4px);
156
+ left: 0;
157
+ z-index: 1000;
158
+ background: var(--bg);
159
+ border: 1px solid var(--brd);
160
+ min-width: 100%;
161
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
162
+ }
163
+
164
+ .drop-right .lang-dropdown {
165
+ left: auto;
166
+ right: 0;
167
+ }
168
+ .drop-up .lang-dropdown {
169
+ top: auto;
170
+ bottom: calc(100% + 4px);
171
+ }
172
+
173
+ .lang-option {
174
+ width: 100%;
175
+ padding: 12px 14px;
176
+ border: none;
177
+ background: transparent;
178
+ color: var(--txt);
179
+ text-align: left;
180
+ cursor: pointer;
181
+ display: flex;
182
+ align-items: center;
183
+ text-transform: uppercase;
184
+ font-weight: 400;
185
+ transition: all 0.2s;
186
+ }
187
+
188
+ .lang-option:hover {
189
+ background: var(--ui-hover);
190
+ }
191
+
192
+ .lang-option.is-selected {
193
+ background: var(--txt);
194
+ color: var(--bg);
195
+ }
196
+
197
+ @media (prefers-color-scheme: light) {
198
+ .ui-lang-select {
199
+ --ui-hover: rgba(0, 0, 0, 0.05);
200
+ }
201
+ }
202
+ </style>