Skip to content

Commit b8eab6e

Browse files
committed
Fix ellipsis and mark style
`:global(…)` doesn't work on custom elements. Here's a workaround suggested in sveltejs/svelte#2969 (comment)
1 parent 8164a33 commit b8eab6e

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

libs/search-widget/src/Widget.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
11
@import "common-style";
2-
3-
:global(mark) {
4-
background-color: inherit;
5-
font-weight: var(--font-weight-semi-bold);
6-
}

libs/search-widget/src/Widget.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import type { KBStates, Resource } from '@nuclia/core';
2121
import { Observable } from 'rxjs';
2222
import { setupSuggestionsAndPredictions, setupTriggerSearch } from './core/search-bar';
23+
import globalCss from './_video-widget/_global.scss';
2324
2425
export let backend = 'https://nuclia.cloud/api';
2526
export let widgetid = '';
@@ -126,6 +127,8 @@
126127
};
127128
</script>
128129

130+
<svelte:element this="style">{@html globalCss}</svelte:element>
131+
129132
<div class="nuclia-widget" {style} data-version="__NUCLIA_DEV_VERSION__">
130133
{#if ready}
131134
{#if type === 'input'}

libs/search-widget/src/_video-widget/SearchBar.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import { setLang } from '../core/i18n';
1010
import SearchInput from '../widgets/search-input/SearchInput.svelte';
1111
import { setupTriggerSearch } from '../core/search-bar';
12+
import globalCss from './_global.scss';
1213
1314
export let backend = 'https://nuclia.cloud/api';
1415
export let widgetid = '';
@@ -68,6 +69,7 @@
6869
});
6970
</script>
7071

72+
<svelte:element this="style">{@html globalCss}</svelte:element>
7173
<div class="nuclia-widget" data-version="__NUCLIA_DEV_VERSION__">
7274
{#if ready}
7375
<SearchInput {placeholder} searchBarWidget={true} />

libs/search-widget/src/_video-widget/SearchResults.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,3 @@
1313
flex-direction: column;
1414
gap: var(--rhythm-3);
1515
}
16-
17-
:global(mark) {
18-
background-color: inherit;
19-
font-weight: var(--font-weight-semi-bold);
20-
}
21-
22-
:global(.ellipsis) {
23-
overflow: hidden;
24-
text-overflow: ellipsis;
25-
white-space: nowrap;
26-
}

libs/search-widget/src/_video-widget/SearchResults.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { _ } from '../core/i18n';
99
import LoadingDots from '../components/spinner/LoadingDots.svelte';
1010
import VideoTile from './VideoTile.svelte';
11+
import globalCss from './_global.scss';
1112
1213
const showResults = nucliaStore().triggerSearch.pipe(map(() => true));
1314
const results = nucliaState().results;
@@ -43,6 +44,7 @@
4344
});
4445
</script>
4546

47+
<svelte:element this="style">{@html globalCss}</svelte:element>
4648
<div class="nuclia-widget sw-video-results" data-version="__NUCLIA_DEV_VERSION__">
4749
{#if $showResults}
4850
{#if $hasSearchError}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
mark {
2+
background-color: inherit;
3+
font-weight: var(--font-weight-semi-bold);
4+
}
5+
6+
.ellipsis {
7+
overflow: hidden;
8+
text-overflow: ellipsis;
9+
white-space: nowrap;
10+
}

0 commit comments

Comments
 (0)