@playpilot/tpi 2.0.5 → 3.0.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 (62) hide show
  1. package/dist/link-injections.js +2 -2
  2. package/eslint.config.js +20 -0
  3. package/package.json +5 -2
  4. package/src/lib/{api.js → api.ts} +26 -38
  5. package/src/lib/{array.js → array.ts} +1 -3
  6. package/src/lib/{auth.js → auth.ts} +8 -10
  7. package/src/lib/{fakeData.js → fakeData.ts} +7 -6
  8. package/src/lib/{hash.js → hash.ts} +2 -3
  9. package/src/lib/{html.js → html.ts} +2 -4
  10. package/src/lib/{linkInjection.js → linkInjection.ts} +41 -85
  11. package/src/lib/{localization.js → localization.ts} +10 -12
  12. package/src/lib/{meta.js → meta.ts} +8 -18
  13. package/src/lib/{playlink.js → playlink.ts} +4 -5
  14. package/src/lib/{search.js → search.ts} +2 -3
  15. package/src/lib/{text.js → text.ts} +7 -19
  16. package/src/lib/{tracking.js → tracking.ts} +6 -4
  17. package/src/lib/types/global.d.ts +13 -0
  18. package/src/lib/types/injection.d.ts +41 -0
  19. package/src/lib/types/language.d.ts +1 -0
  20. package/src/lib/types/participant.d.ts +13 -0
  21. package/src/lib/types/playlink.d.ts +11 -0
  22. package/src/lib/types/position.d.ts +6 -0
  23. package/src/lib/types/title.d.ts +23 -0
  24. package/src/lib/types/user.d.ts +7 -0
  25. package/src/lib/{url.js → url.ts} +1 -2
  26. package/src/routes/+layout.svelte +3 -3
  27. package/src/routes/+page.svelte +12 -17
  28. package/src/routes/components/AfterArticlePlaylinks.svelte +14 -13
  29. package/src/routes/components/ContextMenu.svelte +11 -7
  30. package/src/routes/components/Description.svelte +9 -4
  31. package/src/routes/components/Editorial/AIIndicator.svelte +10 -7
  32. package/src/routes/components/Editorial/Alert.svelte +8 -3
  33. package/src/routes/components/Editorial/DragHandle.svelte +18 -26
  34. package/src/routes/components/Editorial/Editor.svelte +24 -23
  35. package/src/routes/components/Editorial/EditorItem.svelte +20 -18
  36. package/src/routes/components/Editorial/ManualInjection.svelte +16 -17
  37. package/src/routes/components/Editorial/PlaylinkTypeSelect.svelte +8 -4
  38. package/src/routes/components/Editorial/Search/TitleSearch.svelte +13 -17
  39. package/src/routes/components/Editorial/Switch.svelte +14 -4
  40. package/src/routes/components/Editorial/TextInput.svelte +10 -3
  41. package/src/routes/components/Genres.svelte +8 -5
  42. package/src/routes/components/Icons/IconAlign.svelte +8 -3
  43. package/src/routes/components/Icons/IconChevron.svelte +6 -3
  44. package/src/routes/components/Icons/IconEnlarge.svelte +6 -3
  45. package/src/routes/components/Modal.svelte +11 -10
  46. package/src/routes/components/Participants.svelte +8 -3
  47. package/src/routes/components/Playlinks.svelte +11 -7
  48. package/src/routes/components/Popover.svelte +11 -10
  49. package/src/routes/components/RoundButton.svelte +11 -9
  50. package/src/routes/components/SkeletonText.svelte +8 -3
  51. package/src/routes/components/Title.svelte +9 -3
  52. package/src/routes/components/TitleModal.svelte +9 -4
  53. package/src/routes/components/TitlePopover.svelte +7 -3
  54. package/src/tests/routes/components/Genres.test.js +1 -1
  55. package/src/lib/index.js +0 -1
  56. package/src/typedefs.js +0 -95
  57. /package/src/lib/{constants.js → constants.ts} +0 -0
  58. /package/src/lib/{genres.json → data/genres.json} +0 -0
  59. /package/src/lib/data/{translations.js → translations.ts} +0 -0
  60. /package/src/lib/enums/{Language.js → Language.ts} +0 -0
  61. /package/src/lib/enums/{TrackingEvent.js → TrackingEvent.ts} +0 -0
  62. /package/{jsconfig.json → tsconfig.json} +0 -0
@@ -1,17 +1,22 @@
1
- <script>
1
+ <script lang="ts">
2
2
  import { TrackingEvent } from '$lib/enums/TrackingEvent'
3
3
  import { track } from '$lib/tracking'
4
+ import type { TitleData } from '$lib/types/title'
4
5
  import Modal from './Modal.svelte'
5
6
  import Title from './Title.svelte'
6
7
 
7
- /** @type {{ onclose: () => void, title: TitleData }} */
8
- const { onclose, title } = $props()
8
+ interface Props {
9
+ onclose: () => void,
10
+ title: TitleData
11
+ }
12
+
13
+ const { onclose, title }: Props = $props()
9
14
 
10
15
  track(TrackingEvent.TitleModalView, title)
11
16
 
12
17
  let hasTrackedScrolling = false
13
18
 
14
- function onscroll() {
19
+ function onscroll(): void {
15
20
  if (hasTrackedScrolling) return
16
21
 
17
22
  track(TrackingEvent.TitleModalScroll, title)
@@ -1,11 +1,15 @@
1
- <script>
1
+ <script lang="ts">
2
2
  import { TrackingEvent } from '$lib/enums/TrackingEvent'
3
3
  import { track } from '$lib/tracking'
4
+ import type { TitleData } from '$lib/types/title'
4
5
  import Popover from './Popover.svelte'
5
6
  import Title from './Title.svelte'
6
7
 
7
- /** @type {{ title: TitleData }} */
8
- const { title } = $props()
8
+ interface Props {
9
+ title: TitleData
10
+ }
11
+
12
+ const { title }: Props = $props()
9
13
 
10
14
  let maxHeight = $state(0)
11
15
 
@@ -2,7 +2,7 @@ import { render, fireEvent } from '@testing-library/svelte'
2
2
  import { describe, expect, it } from 'vitest'
3
3
 
4
4
  import Genres from '../../../routes/components/Genres.svelte'
5
- import genreData from '$lib/genres.json'
5
+ import genreData from '$lib/data/genres.json'
6
6
 
7
7
  describe('Genres.svelte', () => {
8
8
  it('Should match genre slug to genres in genres.json', () => {
package/src/lib/index.js DELETED
@@ -1 +0,0 @@
1
- // place files you want to import through the `$lib` alias in this folder.
package/src/typedefs.js DELETED
@@ -1,95 +0,0 @@
1
- /**
2
- * @typedef {{
3
- * sid: string,
4
- * slug: string,
5
- * poster_uuid: string,
6
- * standing_poster_uuid: string,
7
- * genres: string[],
8
- * year: number,
9
- * imdb_score: number,
10
- * type: string,
11
- * providers: PlaylinkData[],
12
- * description: string,
13
- * small_poster: string,
14
- * medium_poster: string,
15
- * standing_poster: string,
16
- * title: string,
17
- * original_title: string,
18
- * length?: number,
19
- * participants?: Participant[],
20
- * blurb?: string,
21
- * }} TitleData
22
- */
23
-
24
- /**
25
- * @typedef {{ sid: string, name: string, url: string, logo_url: string, extra_info: { category: PlaylinkCategory } }} PlaylinkData
26
- */
27
-
28
- /**
29
- * @typedef {'SVOD' | 'BUY' | 'RENT' | 'TVOD'} PlaylinkCategory
30
- */
31
-
32
- /**
33
- * @typedef {{ username: string, profile: { display_name: string, profile_photo: string } }} User
34
- */
35
-
36
- /**
37
- * @typedef {{ sid: string, name: string, birth_date: string, death_date: string | null, jobs: Job[], image: string | null, image_uuid: string | null, gender: string, character: string | null }} Participant
38
- */
39
-
40
- /**
41
- * @typedef {'actor' | 'writer' | 'director'} Job
42
- */
43
-
44
- /**
45
- * @typedef {{
46
- * sid: string,
47
- * title: string,
48
- * sentence: string,
49
- * playpilot_url: string,
50
- * key: string,
51
- * title_details?: TitleData,
52
- * inactive?: boolean,
53
- * failed?: boolean,
54
- * in_text?: boolean,
55
- * after_article?: boolean,
56
- * after_article_style?: 'modal_button' | 'playlinks' | null,
57
- * manual?: boolean,
58
- * removed?: boolean,
59
- * duplicate?: boolean,
60
- * }} LinkInjection
61
- */
62
-
63
- /** @typedef {Record<string, { elementIndex: number, from: number, to: number }>} LinkInjectionRanges */
64
-
65
- /**
66
- * @typedef {'bottom' | 'center'} Alignment
67
- */
68
-
69
- /**
70
- * @typedef {{
71
- * injections_ready: boolean,
72
- * page_updated: boolean,
73
- * automation_enabled: boolean,
74
- * injections_enabled: boolean,
75
- * ai_running: boolean,
76
- * ai_injections: LinkInjection[] | null,
77
- * link_injections: LinkInjection[] | null,
78
- * }} LinkInjectionResponse
79
- */
80
-
81
- /**
82
- * @typedef {{ aiInjections: LinkInjection[], manualInjections: LinkInjection[] }} LinkInjectionTypes
83
- */
84
-
85
- /**
86
- * @typedef {{ x: number, y: number }} Position
87
- */
88
-
89
- /**
90
- * @typedef {{ heading: string | null, modified_time: string | null, published_time: string | null }} ArticleMetaData
91
- */
92
-
93
- /**
94
- * @typedef {'en-US' | 'sv-SE'} LanguageCode
95
- */
File without changes
File without changes
File without changes
File without changes