svelte-tv 1.0.3 → 1.0.5

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 (4) hide show
  1. package/LICENSE +21 -1
  2. package/README.md +14 -34
  3. package/dist/utils.js +17 -5
  4. package/package.json +10 -2
package/LICENSE CHANGED
@@ -1 +1,21 @@
1
- Apache-2.0
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SpongeBed81
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- <a href="https://sveltetv.dev">
1
+ <a href="https://rasterzero-dev.github.io/svelte-tv-docs/">
2
2
  <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="banner_dark.png">
4
- <img src="banner_white.png" alt="Svelte TV" />
3
+ <source media="(prefers-color-scheme: dark)" srcset="assets/banner_dark.png">
4
+ <img src="assets/banner_white.png" alt="Svelte TV" />
5
5
  </picture>
6
6
  </a>
7
7
 
8
8
  <h1 align="center">
9
- <a href="https://sveltetv.dev/">
9
+ <a href="https://rasterzero-dev.github.io/svelte-tv-docs/">
10
10
  Svelte TV
11
11
  </a>
12
12
  </h1>
@@ -18,28 +18,21 @@
18
18
 
19
19
  <p align="center">
20
20
  <a href="./LICENSE">
21
- <img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="Svelte TV is released under the Apache 2.0 license." />
21
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="Svelte TV is released under the MIT license." />
22
22
  </a>
23
+
23
24
  <a href="https://www.npmjs.org/package/svelte-tv">
24
25
  <img src="https://img.shields.io/npm/v/svelte-tv?color=brightgreen&label=npm%20package" alt="Current npm package version." />
25
26
  </a>
26
- <a href="https://sveltetv.dev/docs/contributing">
27
+ <a>
27
28
  <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs are welcome!" />
28
29
  </a>
29
30
  </p>
30
31
 
31
32
  <h3 align="center">
32
- <a href="https://sveltetv.dev/docs/getting-started">Getting Started</a>
33
- <span> &middot; </span>
34
- <a href="https://sveltetv.dev/docs/learn">Learn the Basics</a>
35
- <span> &middot; </span>
36
- <a href="https://sveltetv.dev/showcase">Showcase</a>
37
- <span> &middot; </span>
38
- <a href="https://sveltetv.dev/docs/contributing">Contribute</a>
39
- <span> &middot; </span>
40
- <a href="https://sveltetv.dev/community">Community</a>
33
+ <a href="https://rasterzero-dev.github.io/svelte-tv-docs/docs/getting-started/">Getting Started</a>
41
34
  <span> &middot; </span>
42
- <a href="https://sveltetv.dev/support">Support</a>
35
+ <a href="https://rasterzero-dev.github.io/svelte-tv-docs/docs/essentials/focus/">Learn the Basics</a>
43
36
  </h3>
44
37
 
45
38
  Svelte TV brings [**Svelte**'s][s] component model to [**Lightning**][l]-powered living room apps. With Svelte TV, you build renderer-native, focus-driven interfaces for Canvas and WebGL.
@@ -57,8 +50,6 @@ Svelte TV brings [**Svelte**'s][s] component model to [**Lightning**][l]-powered
57
50
  - [Requirements](#requirements)
58
51
  - [Building your first Svelte TV app](#building-your-first-svelte-tv-app)
59
52
  - [Documentation](#documentation)
60
- - [Roadmap](#roadmap)
61
- - [How to Contribute](#how-to-contribute)
62
53
  - [License](#license)
63
54
 
64
55
  ## 📋 Requirements
@@ -69,7 +60,7 @@ Because Svelte 5 relies on [JavaScript Proxy](https://developer.mozilla.org/en-U
69
60
 
70
61
  ## 🎉 Building your first Svelte TV app
71
62
 
72
- Follow the [Getting Started guide][getting-started] to create your first Svelte TV app. If you are new to focus-driven TV interfaces, start with [Learn the Basics][learn].
63
+ Follow the [Getting Started guide][getting-started] to create your first Svelte TV app. If you are new to focus-driven TV interfaces, start with [Learn the Basics](https://rasterzero-dev.github.io/svelte-tv-docs/docs/essentials/focus/)
73
64
 
74
65
  ## 📖 Documentation
75
66
 
@@ -77,22 +68,11 @@ The full documentation for Svelte TV can be found on our [website][docs].
77
68
 
78
69
  The documentation covers renderer setup, focus handling, layout, routing, effects, primitives, fonts, and deployment notes.
79
70
 
80
- ## 🚀 Roadmap
81
-
82
- Svelte TV is evolving around real TV app needs. You can follow planned work, open design notes, and release direction in the [Roadmap][roadmap].
83
-
84
- ## 👏 How to Contribute
85
-
86
- We want contributing to Svelte TV to be focused and practical. Read the [Contributing Guide][contribute] to learn how to report issues, propose changes, and work on the project.
87
-
88
71
  ## 📄 License
89
72
 
90
- Svelte TV is Apache-2.0 licensed, as found in the [LICENSE][license] file.
73
+ Svelte TV is MIT licensed, as found in the [LICENSE][license] file.
91
74
 
92
- [requirements]: https://sveltetv.dev/docs/requirements
93
- [getting-started]: https://sveltetv.dev/docs/getting-started
94
- [learn]: https://sveltetv.dev/docs/learn
95
- [docs]: https://sveltetv.dev/docs
96
- [roadmap]: https://sveltetv.dev/roadmap
97
- [contribute]: https://sveltetv.dev/docs/contributing
75
+ [requirements]: https://rasterzero-dev.github.io/svelte-tv-docs/docs/requirements
76
+ [getting-started]: https://rasterzero-dev.github.io/svelte-tv-docs/docs/getting-started/
77
+ [docs]: https://rasterzero-dev.github.io/svelte-tv-docs/docs
98
78
  [license]: ./LICENSE
package/dist/utils.js CHANGED
@@ -5,7 +5,7 @@ const WEBGL_CONTEXT_IDS = [
5
5
  'experimental-webgl2',
6
6
  'experimental-webgl',
7
7
  ];
8
- let supportedWebglVersions;
8
+ const supportedWebglVersions = new Map();
9
9
  export function hexColor(color = '') {
10
10
  if (isInteger(color)) {
11
11
  return color;
@@ -44,13 +44,19 @@ export function mod(n, m) {
44
44
  return ((n % m) + m) % m;
45
45
  }
46
46
  export function getWebglSupportedVersions(webglContextIds = WEBGL_CONTEXT_IDS) {
47
- if (supportedWebglVersions && webglContextIds === WEBGL_CONTEXT_IDS) {
48
- return supportedWebglVersions;
47
+ const cacheKey = webglContextIds.join('|');
48
+ const cached = supportedWebglVersions.get(cacheKey);
49
+ if (cached !== undefined) {
50
+ return cached;
49
51
  }
50
52
  const cv = document.createElement('canvas');
53
+ let probeContext = null;
51
54
  const supports = webglContextIds.filter((id) => {
52
55
  try {
53
56
  const context = cv.getContext(id);
57
+ if (context !== null && probeContext === null) {
58
+ probeContext = context;
59
+ }
54
60
  return !!(context &&
55
61
  (context instanceof WebGLRenderingContext ||
56
62
  context instanceof WebGL2RenderingContext ||
@@ -61,9 +67,15 @@ export function getWebglSupportedVersions(webglContextIds = WEBGL_CONTEXT_IDS) {
61
67
  return false;
62
68
  }
63
69
  });
64
- if (webglContextIds === WEBGL_CONTEXT_IDS) {
65
- supportedWebglVersions = supports;
70
+ const probe = probeContext;
71
+ if (probe !== null &&
72
+ 'getExtension' in probe &&
73
+ probe.isContextLost() === false) {
74
+ probe
75
+ .getExtension('WEBGL_lose_context')
76
+ ?.loseContext();
66
77
  }
78
+ supportedWebglVersions.set(cacheKey, supports);
67
79
  return supports;
68
80
  }
69
81
  export const supportsWebGL = (webGLSupportedVersion) => ['webgl', 'experimental-webgl', 'webgl2'].some((ver) => webGLSupportedVersion.includes(ver));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-tv",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Svelte speed for every screen 🚀✨",
5
5
  "type": "module",
6
6
  "exports": {
@@ -33,6 +33,14 @@
33
33
  "LICENSE",
34
34
  "NOTICE"
35
35
  ],
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/rasterzero-dev/svelte-tv.git"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/rasterzero-dev/svelte-tv/issues"
42
+ },
43
+ "homepage": "https://rasterzero-dev.github.io/svelte-tv-docs",
36
44
  "scripts": {
37
45
  "build": "svelte-package && tsc -p tsconfig.build.json",
38
46
  "check": "svelte-check --tsconfig tsconfig.json",
@@ -52,7 +60,7 @@
52
60
  "canvas",
53
61
  "tv"
54
62
  ],
55
- "license": "Apache-2.0",
63
+ "license": "MIT",
56
64
  "peerDependencies": {
57
65
  "@lightningjs/renderer": "^3.0.6",
58
66
  "svelte": "^5.56.4"