@playpilot/tpi 8.29.11 → 8.31.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.
Files changed (32) hide show
  1. package/dist/editorial.mount.js +9 -9
  2. package/dist/link-injections.js +1 -1
  3. package/dist/mount.js +7 -7
  4. package/package.json +1 -1
  5. package/src/lib/api/externalPages.ts +1 -0
  6. package/src/lib/api/participants.ts +1 -1
  7. package/src/lib/api/providers.ts +1 -1
  8. package/src/lib/api/search.ts +9 -0
  9. package/src/lib/api/titles.ts +1 -1
  10. package/src/lib/injection.ts +479 -479
  11. package/src/lib/types/global.d.ts +1 -0
  12. package/src/routes/components/Editorial/Editor.svelte +0 -2
  13. package/src/routes/components/Editorial/EditorItem.svelte +2 -2
  14. package/src/routes/components/Editorial/ManualInjection.svelte +26 -19
  15. package/src/routes/components/Editorial/Search/ParticipantSearchItem.svelte +86 -0
  16. package/src/routes/components/Editorial/Search/TypeSearch.svelte +120 -0
  17. package/src/routes/components/Explore/Routes/ExploreModal.svelte +107 -107
  18. package/src/routes/components/Modals/TitlesReelModal.svelte +3 -3
  19. package/src/routes/components/Rails/TitlesRail.svelte +1 -1
  20. package/src/routes/components/Tabs.svelte +12 -23
  21. package/src/routes/components/YouTubeEmbed.svelte +61 -20
  22. package/src/routes/components/YouTubeEmbedBackground.svelte +1 -0
  23. package/src/routes/components/YouTubeEmbedOverlay.svelte +1 -1
  24. package/src/routes/elements/+page.svelte +12 -0
  25. package/src/tests/lib/api/externalPages.test.js +134 -1
  26. package/src/tests/routes/components/Editorial/EditorItem.test.js +1 -2
  27. package/src/tests/routes/components/Editorial/ManualInjection.test.js +43 -6
  28. package/src/tests/routes/components/Editorial/Search/{TitleSearch.test.js → TypeSearch.test.js} +21 -9
  29. package/src/tests/routes/components/YouTubeEmbed.test.js +109 -33
  30. package/src/tests/routes/components/YouTubeEmbedBackground.test.js +2 -3
  31. package/src/tests/routes/components/YouTubeEmbedOverlay.test.js +2 -3
  32. package/src/routes/components/Editorial/Search/TitleSearch.svelte +0 -96
@@ -5,9 +5,8 @@ import YouTubeEmbedBackground from '../../../routes/components/YouTubeEmbedBackg
5
5
 
6
6
  describe('YouTubeEmbedBackground.svelte', () => {
7
7
  it('Should render embed iframe with given video url', () => {
8
- const { container } = render(YouTubeEmbedBackground, { embeddable_url: 'youtube.com/watch?v=abc' })
8
+ const { getByTestId } = render(YouTubeEmbedBackground, { embeddable_url: 'youtube.com/watch?v=abc' })
9
9
 
10
- // @ts-ignore
11
- expect(container.querySelector('iframe').src).toBe('https://video.playpilot.net/?video_id=abc&color=fa548a&muted=true&loop=true&captions=false&controls=&start_time=5&autoplay=true&playsinline=true')
10
+ expect(getByTestId('youtube.com/watch?v=abc')).toBeTruthy()
12
11
  })
13
12
  })
@@ -5,10 +5,9 @@ import YouTubeEmbedOverlay from '../../../routes/components/YouTubeEmbedOverlay.
5
5
 
6
6
  describe('YouTubeEmbedOverlay.svelte', () => {
7
7
  it('Should render embed iframe with given video url', () => {
8
- const { container } = render(YouTubeEmbedOverlay, { embeddable_url: 'youtube.com/watch?v=abc', onclose: () => null })
8
+ const { getByTestId } = render(YouTubeEmbedOverlay, { embeddable_url: 'youtube.com/watch?v=abc', onclose: () => null })
9
9
 
10
- // @ts-ignore
11
- expect(container.querySelector('iframe').src).toBe('https://video.playpilot.net/?video_id=abc&color=fa548a&muted=false&loop=false&captions=false&controls=current-time,fullscreen,mute,play,progress&start_time=0&autoplay=true&playsinline=true')
10
+ expect(getByTestId('youtube.com/watch?v=abc')).toBeTruthy()
12
11
  })
13
12
 
14
13
  it('Should fire given onclose function on click of close button and backdrop', async () => {
@@ -1,96 +0,0 @@
1
- <script lang="ts">
2
- import { searchTitles } from '$lib/api/search'
3
- import type { TitleData } from '$lib/types/title'
4
- import TextInput from '../TextInput.svelte'
5
- import TitleSearchItem from './TitleSearchItem.svelte'
6
-
7
- interface Props {
8
- onselect?: (title: TitleData) => void
9
- query: string
10
- }
11
-
12
- let { onselect = () => null, query = $bindable() }: Props = $props()
13
-
14
- let results: TitleData[] = $state([])
15
- let selectedResult: TitleData | null = $state(null)
16
- let loading = $state(false)
17
-
18
- $effect(() => {
19
- if (query) search(query)
20
- })
21
-
22
- async function search(query: string): Promise<void> {
23
- loading = true
24
-
25
- try {
26
- results = await searchTitles(query)
27
- } finally {
28
- loading = false
29
- }
30
- }
31
-
32
- function select(title: TitleData): void {
33
- query = title.title
34
- selectedResult = title
35
-
36
- onselect(title)
37
- }
38
- </script>
39
-
40
- <div class="search">
41
- <TextInput
42
- bind:value={query}
43
- oninput={() => selectedResult = null}
44
- name="search"
45
- label="Search..." />
46
-
47
- {#if query && !selectedResult}
48
- <div class="results" data-testid="search-results">
49
- {#each results as title (title.sid)}
50
- <TitleSearchItem {title} onclick={() => select(title)} />
51
- {:else}
52
- {#if !loading}
53
- <em class="empty">No results found</em>
54
- {/if}
55
- {/each}
56
- </div>
57
- {/if}
58
-
59
- {#if selectedResult}
60
- <div class="selected">
61
- <TitleSearchItem title={selectedResult} hoverable={false} />
62
- </div>
63
- {/if}
64
- </div>
65
-
66
- <style lang="scss">
67
- .search {
68
- position: relative;
69
- }
70
-
71
- .results {
72
- z-index: 1;
73
- position: absolute;
74
- top: calc(100% + margin(0.5));
75
- left: 0;
76
- right: 0;
77
- height: 30vh;
78
- max-height: margin(10);
79
- border-radius: margin(0.5);
80
- background: theme(lighter);
81
- scrollbar-width: thin;
82
- overflow: auto;
83
- }
84
-
85
- .empty {
86
- padding: margin(0.5);
87
- font-size: margin(0.75);
88
- color: theme(text-color-alt);
89
- }
90
-
91
- .selected {
92
- margin: margin(0.5) 0;
93
- border-radius: 0.5rem;
94
- border: 2px solid theme(green);
95
- }
96
- </style>