@playpilot/tpi 6.6.1 → 6.6.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "6.6.1",
3
+ "version": "6.6.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -23,6 +23,7 @@
23
23
  "@types/node": "^25.2.0",
24
24
  "@typescript-eslint/eslint-plugin": "^8.32.1",
25
25
  "@typescript-eslint/parser": "^8.32.1",
26
+ "dotenv": "^16.4.7",
26
27
  "eslint": "^9.27.0",
27
28
  "eslint-config-prettier": "^9.1.0",
28
29
  "eslint-plugin-svelte": "^3.15.0",
@@ -27,6 +27,8 @@
27
27
  RENT: t('Rent'),
28
28
  TVOD: t('Rent Or Buy'),
29
29
  }
30
+
31
+ let actionWidth = $state(0)
30
32
  </script>
31
33
 
32
34
  <!-- svelte-ignore a11y_no_static_element_interactions -->
@@ -44,7 +46,7 @@
44
46
  data-playlink={name}
45
47
  rel="sponsored">
46
48
 
47
- <div class="playlink-content">
49
+ <div class="playlink-content" style:--action-width={actionWidth ? `${actionWidth}px` : null}>
48
50
  <img src={removeImageUrlPrefix(logo_url)} alt="" height="36" width="36" />
49
51
 
50
52
  <span class="name">{name}</span>
@@ -57,7 +59,7 @@
57
59
  <span class="cta">{cta_text}</span>
58
60
  {/if}
59
61
 
60
- <div class="action">
62
+ <div class="action" bind:clientWidth={actionWidth}>
61
63
  {action_text || t('Watch')}
62
64
  </div>
63
65
 
@@ -161,7 +163,7 @@
161
163
  z-index: 5;
162
164
  display: grid;
163
165
  grid-template-areas: "image name action" "image category action";
164
- grid-template-columns: $image-size auto margin(6);
166
+ grid-template-columns: $image-size auto var(--action-width, margin(6));
165
167
  align-items: center;
166
168
  gap: 0 margin(0.75);
167
169
  padding: margin(0.75);
package/vite.config.js CHANGED
@@ -1,14 +1,18 @@
1
1
  import path from 'path'
2
+ import * as dotenv from 'dotenv'
2
3
  import { defineConfig } from 'vitest/config'
3
4
  import { sveltekit } from '@sveltejs/kit/vite'
4
5
  import { svelte } from '@sveltejs/vite-plugin-svelte'
5
6
  import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
6
7
  import packageJson from './package.json'
7
8
 
9
+ dotenv.config({ path: '.env' })
10
+
8
11
  export default defineConfig(({ command }) => ({
9
12
  plugins: [
10
13
  command === 'build' ? svelte() : sveltekit(),
11
14
  command === 'build' && cssInjectedByJsPlugin(),
15
+ command === 'build' && injectEnvVariables,
12
16
  ],
13
17
 
14
18
  build: {
@@ -19,7 +23,6 @@ export default defineConfig(({ command }) => ({
19
23
  name: 'PlayPilotLinkInjections',
20
24
  entryFileNames: 'link-injections.js',
21
25
  },
22
- external: ['$env/static/public'],
23
26
  },
24
27
  },
25
28
 
@@ -44,3 +47,20 @@ export default defineConfig(({ command }) => ({
44
47
  __SCRIPT_VERSION__: JSON.stringify(packageJson.version),
45
48
  },
46
49
  }))
50
+
51
+ const injectEnvVariables = {
52
+ name: 'resolve-env-variables',
53
+ /** @param {string} id */
54
+ resolveId(id) {
55
+ if (id === '$env/static/public') return '\0$env/static/public'
56
+ },
57
+ /** @param {string} id */
58
+ load(id) {
59
+ if (id === '\0$env/static/public') {
60
+ return Object.entries(process.env)
61
+ .filter(([key]) => key.startsWith('PUBLIC_'))
62
+ .map(([key, value]) => `export const ${key} = ${JSON.stringify(value)};`)
63
+ .join('\n')
64
+ }
65
+ },
66
+ }