itube-specs 0.0.895 → 0.0.896

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.
@@ -150,6 +150,8 @@ const { generateLink } = useGenerateLink();
150
150
 
151
151
  const pageName = useGetPureRouteName();
152
152
  const isChannelPage = computed(() => pageName === 'channels-channel');
153
+ const isModelPage = computed(() => pageName.startsWith('models-slug'));
154
+ const isSearchPage = computed(() => pageName.startsWith('search-slug'));
153
155
 
154
156
  const previewId = useId();
155
157
  const { activePreviewId, startPreviewByHover, stopPreviewByHover, startPreviewByTouch } = useVideoPreview();
@@ -193,10 +195,23 @@ const channelLink = computed(() => props.card.channelName
193
195
  const slug = useSlug();
194
196
 
195
197
  const cardTags = computed(() => {
196
- const models = props.card.models ? [...props.card.models].filter(item => item.toLowerCase() !== slug.value.toLowerCase()) : [];
198
+ const query = slug.value.toLowerCase();
199
+
200
+ const models = props.card.models
201
+ ? [ ...props.card.models ].filter(item => !isModelPage.value || item.toLowerCase() !== query)
202
+ : [];
203
+
204
+ const searchRank = (item: string) => {
205
+ if (!isSearchPage.value || !query) return 0;
206
+ const name = item.toLowerCase();
207
+ if (name === query) return 0;
208
+ return name.includes(query) ? 1 : 2;
209
+ };
210
+
197
211
  const sortModels = models.sort((a, b) =>
198
- a.localeCompare(b)
212
+ searchRank(a) - searchRank(b) || a.localeCompare(b)
199
213
  );
214
+
200
215
  return sortModels?.map(item => convertString().toChips(item, 'models'));
201
216
  });
202
217
  </script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.895",
4
+ "version": "0.0.896",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {