@playpilot/tpi 8.34.1 → 8.34.3
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.
- package/dist/editorial.mount.js +11 -11
- package/dist/link-injections.js +1 -1
- package/dist/mount.js +7 -7
- package/package.json +1 -1
- package/src/lib/enums/SplitTest.ts +0 -5
- package/src/lib/modal.ts +1 -3
- package/src/lib/scss/_mixins.scss +6 -0
- package/src/routes/components/Explore/Filter/Dropdown.svelte +2 -1
- package/src/routes/components/Explore/Routes/ExploreModal.svelte +2 -9
- package/src/routes/components/Modals/RailModal.svelte +7 -2
- package/src/routes/components/Rails/Rail.svelte +2 -1
- package/src/routes/components/RoundButton.svelte +1 -1
- package/src/routes/components/YouTubeEmbed.svelte +1 -1
- package/src/routes/components/YouTubeEmbedOverlay.svelte +10 -20
- package/src/routes/elements/+page.svelte +0 -10
- package/vite.config.js +43 -42
package/package.json
CHANGED
package/src/lib/modal.ts
CHANGED
|
@@ -11,9 +11,8 @@ import { playFallbackViewTransition } from './viewTransition'
|
|
|
11
11
|
import { destroyLinkPopover } from './popover'
|
|
12
12
|
import { prefersReducedMotion } from 'svelte/motion'
|
|
13
13
|
import TitlesRailModal from '../routes/components/Modals/TitlesRailModal.svelte'
|
|
14
|
-
import TitlesReelModal from '../routes/components/Modals/TitlesReelModal.svelte'
|
|
15
14
|
|
|
16
|
-
export type ModalType = 'title' | 'participant' | 'titles-rail'
|
|
15
|
+
export type ModalType = 'title' | 'participant' | 'titles-rail'
|
|
17
16
|
|
|
18
17
|
type Modal = {
|
|
19
18
|
injection?: LinkInjection | null
|
|
@@ -55,7 +54,6 @@ function getModalComponentByType(
|
|
|
55
54
|
{ type: Modal['type'], target: Element, data: Modal['data'], props?: Record<string, any> }): ReturnType<typeof mount> {
|
|
56
55
|
if (type === 'participant') return mount(ParticipantModal, { target, props: { participant: data as ParticipantData, ...props } })
|
|
57
56
|
if (type === 'titles-rail') return mount(TitlesRailModal, { target, props: { titles: data as TitleData[], ...props } })
|
|
58
|
-
if (type === 'titles-reel') return mount(TitlesReelModal, { target, props: { titles: data as TitleData[], ...props } })
|
|
59
57
|
return mount(TitleModal, { target, props: { title: data as TitleData, ...props } })
|
|
60
58
|
}
|
|
61
59
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { scale } from 'svelte/transition'
|
|
3
3
|
import { tick, type Snippet } from 'svelte'
|
|
4
|
+
import { prefersReducedMotion } from 'svelte/motion'
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
button: Snippet<[{ toggle: (event: MouseEvent) => void }]>,
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
style:--max-height={maxHeight ? `${maxHeight}px` : null}
|
|
73
74
|
style:--offset={offset ? `${offset}px` : null}
|
|
74
75
|
bind:this={contentElement}
|
|
75
|
-
transition:scale={{ start: 0.85, duration: 100 }}>
|
|
76
|
+
transition:scale={{ start: prefersReducedMotion.current ? 1 : 0.85, duration: 100 }}>
|
|
76
77
|
{@render content()}
|
|
77
78
|
</div>
|
|
78
79
|
{/if}
|
|
@@ -21,17 +21,10 @@
|
|
|
21
21
|
|
|
22
22
|
if (!sid) return
|
|
23
23
|
|
|
24
|
-
let type: ModalType = sid.startsWith('pr') ? 'participant' : '
|
|
24
|
+
let type: ModalType = sid.startsWith('pr') ? 'participant' : 'titles-rail' // Sids with with `pr` for participants, `ti` for titles
|
|
25
25
|
let data: any = null
|
|
26
26
|
|
|
27
|
-
if (type === '
|
|
28
|
-
const isMobile = window.innerWidth < mobileBreakpoint
|
|
29
|
-
const isInReelSplitTest = isMobile && getSplitTestVariantName(SplitTest.Reels) === 'Reel'
|
|
30
|
-
|
|
31
|
-
if (isMobile) trackSplitTestView(SplitTest.Reels)
|
|
32
|
-
|
|
33
|
-
type = isMobile && isInReelSplitTest ? 'titles-reel' : 'titles-rail'
|
|
34
|
-
|
|
27
|
+
if (type === 'titles-rail') {
|
|
35
28
|
const [title, railTitles] = (await Promise.allSettled([fetchTitleBySid(sid), fetchSimilarTitles({ sid } as unknown as TitleData)])).map((promise) =>
|
|
36
29
|
promise.status === 'fulfilled' ? promise.value : null,
|
|
37
30
|
)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount, type Snippet } from 'svelte'
|
|
3
|
-
import
|
|
3
|
+
import { prefersReducedMotion } from 'svelte/motion'
|
|
4
4
|
import { fade } from 'svelte/transition'
|
|
5
5
|
import { t } from '$lib/localization'
|
|
6
6
|
import { getFirstAdOfType } from '$lib/api/ads'
|
|
7
|
+
import TinySlider from 'svelte-tiny-slider'
|
|
7
8
|
import Modal from './Modal.svelte'
|
|
8
9
|
import IconArrow from '../Icons/IconArrow.svelte'
|
|
9
10
|
import ModalCloseOverlay from './ModalCloseOverlay.svelte'
|
|
@@ -19,10 +20,10 @@
|
|
|
19
20
|
|
|
20
21
|
const { items, initialIndex = 0, onchange = () => null, onclose = () => null, each, ...restProps }: Props = $props()
|
|
21
22
|
|
|
22
|
-
const transitionDuration = 300
|
|
23
23
|
|
|
24
24
|
let slider: TinySlider
|
|
25
25
|
let initialized = $state(false)
|
|
26
|
+
let transitionDuration = $state(prefersReducedMotion.current ? 0 : 300)
|
|
26
27
|
let availableHeight: number | null = $state(null)
|
|
27
28
|
let element: HTMLElement | null = $state(null)
|
|
28
29
|
let displayAd = $state(getFirstAdOfType('card'))
|
|
@@ -140,6 +141,10 @@
|
|
|
140
141
|
width: $size;
|
|
141
142
|
transition: opacity var(--transition-duration), transform var(--transition-duration);
|
|
142
143
|
|
|
144
|
+
@include reduced-motion {
|
|
145
|
+
transition: opacity 500ms;
|
|
146
|
+
}
|
|
147
|
+
|
|
143
148
|
&.active {
|
|
144
149
|
transform: none;
|
|
145
150
|
opacity: 1;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import TinySlider from 'svelte-tiny-slider'
|
|
4
4
|
import IconArrow from '../Icons/IconArrow.svelte'
|
|
5
5
|
import { heading as _heading } from '$lib/actions/heading'
|
|
6
|
+
import { prefersReducedMotion } from 'svelte/motion'
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
9
|
heading?: string
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
{/if}
|
|
29
30
|
|
|
30
31
|
<div class="rail">
|
|
31
|
-
<TinySlider bind:this={slider} {onchange} {onresize} bind:shown allowWheel>
|
|
32
|
+
<TinySlider bind:this={slider} {onchange} {onresize} transitionDuration={prefersReducedMotion.current ? 0 : 300} bind:shown allowWheel>
|
|
32
33
|
{@render children()}
|
|
33
34
|
|
|
34
35
|
{#snippet controls({ setIndex, currentIndex, reachedEnd })}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { fade } from 'svelte/transition'
|
|
3
3
|
import IconClose from './Icons/IconClose.svelte'
|
|
4
4
|
import YouTubeEmbed from './YouTubeEmbed.svelte'
|
|
5
|
+
import RoundButton from './RoundButton.svelte'
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
embeddable_url: string,
|
|
@@ -24,9 +25,11 @@
|
|
|
24
25
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
25
26
|
<div class="backdrop" onclick={onclose} data-testid="backdrop"></div>
|
|
26
27
|
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
28
|
+
<div class="close">
|
|
29
|
+
<RoundButton size="42px" onclick={onclose} aria-label="Close">
|
|
30
|
+
<IconClose size={24} />
|
|
31
|
+
</RoundButton>
|
|
32
|
+
</div>
|
|
30
33
|
</div>
|
|
31
34
|
|
|
32
35
|
<style lang="scss">
|
|
@@ -71,24 +74,11 @@
|
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
.close {
|
|
74
|
-
|
|
77
|
+
--playpilot-button-background: transparent;
|
|
78
|
+
--playpilot-button-text-color: white;
|
|
75
79
|
z-index: 1;
|
|
76
80
|
position: fixed;
|
|
77
|
-
top: margin(
|
|
78
|
-
right: margin(
|
|
79
|
-
padding: 0;
|
|
80
|
-
margin: 0;
|
|
81
|
-
border: 0;
|
|
82
|
-
background: transparent;
|
|
83
|
-
color: white;
|
|
84
|
-
cursor: pointer;
|
|
85
|
-
|
|
86
|
-
&:hover {
|
|
87
|
-
transform: scale(1.1);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&:active {
|
|
91
|
-
transform: scale(1);
|
|
92
|
-
}
|
|
81
|
+
top: margin(1);
|
|
82
|
+
right: margin(1);
|
|
93
83
|
}
|
|
94
84
|
</style>
|
|
@@ -97,16 +97,6 @@
|
|
|
97
97
|
<button onclick={() => openModal({ type: 'participant', data: participants[0] })}>Show participant modal</button>
|
|
98
98
|
</div>
|
|
99
99
|
</div>
|
|
100
|
-
|
|
101
|
-
<div>
|
|
102
|
-
<h3>TitlesReelModal.svelte</h3>
|
|
103
|
-
|
|
104
|
-
{#await fetchSimilarTitles(title) then titles}
|
|
105
|
-
<div class="item">
|
|
106
|
-
<button onclick={() => openModal({ type: 'titles-reel', data: titles })}>Show titles reel modal</button>
|
|
107
|
-
</div>
|
|
108
|
-
{/await}
|
|
109
|
-
</div>
|
|
110
100
|
</div>
|
|
111
101
|
|
|
112
102
|
<h2>Title elements</h2>
|
package/vite.config.js
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import * as dotenv from 'dotenv'
|
|
3
|
-
import { defineConfig } from 'vitest/config'
|
|
4
|
-
import { sveltekit } from '@sveltejs/kit/vite'
|
|
5
|
-
import packageJson from './package.json'
|
|
6
|
-
|
|
7
|
-
dotenv.config({ path: '.env' })
|
|
8
|
-
|
|
9
|
-
export default defineConfig(() => ({
|
|
10
|
-
plugins: [
|
|
11
|
-
sveltekit(),
|
|
12
|
-
],
|
|
13
|
-
|
|
14
|
-
server: {
|
|
15
|
-
port: 3000,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import * as dotenv from 'dotenv'
|
|
3
|
+
import { defineConfig } from 'vitest/config'
|
|
4
|
+
import { sveltekit } from '@sveltejs/kit/vite'
|
|
5
|
+
import packageJson from './package.json'
|
|
6
|
+
|
|
7
|
+
dotenv.config({ path: '.env' })
|
|
8
|
+
|
|
9
|
+
export default defineConfig(() => ({
|
|
10
|
+
plugins: [
|
|
11
|
+
sveltekit(),
|
|
12
|
+
],
|
|
13
|
+
|
|
14
|
+
server: {
|
|
15
|
+
port: 3000,
|
|
16
|
+
allowedHosts: ['engage-moderate-happy-davis.trycloudflare.com'],
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
test: {
|
|
20
|
+
environment: 'happy-dom',
|
|
21
|
+
environmentOptions: {
|
|
22
|
+
happyDOM: {
|
|
23
|
+
settings: {
|
|
24
|
+
disableJavaScriptFileLoading: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
29
|
+
setupFiles: ['src/tests/setup.js'],
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
resolve: {
|
|
33
|
+
conditions: process.env.VITEST ? ['browser'] : [],
|
|
34
|
+
alias: {
|
|
35
|
+
'$lib': path.resolve(__dirname, './src/lib'),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
define: {
|
|
40
|
+
__SCRIPT_VERSION__: JSON.stringify(packageJson.version),
|
|
41
|
+
__IS_EDITORIAL_SCRIPT__: true,
|
|
42
|
+
},
|
|
43
|
+
}))
|