@solidtv/solid 1.3.5 → 1.3.6
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/src/core/elementNode.d.ts +5 -0
- package/dist/src/core/elementNode.js +17 -2
- package/dist/src/core/elementNode.js.map +1 -1
- package/dist/src/primitives/Column.jsx +2 -1
- package/dist/src/primitives/Column.jsx.map +1 -1
- package/dist/src/primitives/Lazy.jsx +10 -4
- package/dist/src/primitives/Lazy.jsx.map +1 -1
- package/dist/src/primitives/Row.jsx +2 -1
- package/dist/src/primitives/Row.jsx.map +1 -1
- package/dist/src/primitives/Virtual.d.ts +2 -0
- package/dist/src/primitives/Virtual.jsx +18 -11
- package/dist/src/primitives/Virtual.jsx.map +1 -1
- package/dist/src/primitives/VirtualGrid.jsx +6 -1
- package/dist/src/primitives/VirtualGrid.jsx.map +1 -1
- package/dist/src/utils.js +36 -5
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/elementNode.ts +32 -2
- package/src/primitives/Column.tsx +2 -1
- package/src/primitives/Lazy.tsx +11 -5
- package/src/primitives/Row.tsx +3 -2
- package/src/primitives/Virtual.tsx +37 -25
- package/src/primitives/VirtualGrid.tsx +6 -1
- package/src/utils.ts +39 -5
package/dist/src/utils.js
CHANGED
|
@@ -6,7 +6,14 @@ const WEBGL_CONTEXT_IDS = [
|
|
|
6
6
|
'experimental-webgl2',
|
|
7
7
|
'experimental-webgl',
|
|
8
8
|
];
|
|
9
|
-
|
|
9
|
+
// WebGL support never changes during a page's lifetime, so each distinct id
|
|
10
|
+
// list is probed exactly once and the result is cached forever. This is
|
|
11
|
+
// load-bearing on embedded TV boxes: every probe call creates a real WebGL
|
|
12
|
+
// context, and those boxes cap live contexts very low. Probing repeatedly (the
|
|
13
|
+
// old behavior bypassed the cache for any non-default argument) creates a new
|
|
14
|
+
// context each time, blows the page's context budget, and evicts the oldest
|
|
15
|
+
// context — the live render context — which then fails every createTexture.
|
|
16
|
+
const supportedWebglVersions = new Map();
|
|
10
17
|
/**
|
|
11
18
|
* Converts a color string to a color number value.
|
|
12
19
|
*/
|
|
@@ -69,13 +76,25 @@ export function mod(n, m) {
|
|
|
69
76
|
* @returns List of WebGL context IDs that are supported by the client.
|
|
70
77
|
*/
|
|
71
78
|
export function getWebglSupportedVersions(webglContextIds = WEBGL_CONTEXT_IDS) {
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
// Cache per distinct id list. The previous version only cached the default
|
|
80
|
+
// list, so any caller passing its own array re-probed (and re-created a
|
|
81
|
+
// context) on every call — see the comment on `supportedWebglVersions`.
|
|
82
|
+
const cacheKey = webglContextIds.join('|');
|
|
83
|
+
const cached = supportedWebglVersions.get(cacheKey);
|
|
84
|
+
if (cached !== undefined) {
|
|
85
|
+
return cached;
|
|
74
86
|
}
|
|
75
87
|
const cv = document.createElement('canvas');
|
|
88
|
+
// A canvas locks to the first context type it hands out, so probing several
|
|
89
|
+
// ids on one canvas yields at most one live context. Capture it so we can
|
|
90
|
+
// release it below.
|
|
91
|
+
let probeContext = null;
|
|
76
92
|
const supports = webglContextIds.filter((id) => {
|
|
77
93
|
try {
|
|
78
94
|
const context = cv.getContext(id);
|
|
95
|
+
if (context !== null && probeContext === null) {
|
|
96
|
+
probeContext = context;
|
|
97
|
+
}
|
|
79
98
|
return !!(context &&
|
|
80
99
|
(context instanceof WebGLRenderingContext ||
|
|
81
100
|
context instanceof WebGL2RenderingContext ||
|
|
@@ -86,9 +105,21 @@ export function getWebglSupportedVersions(webglContextIds = WEBGL_CONTEXT_IDS) {
|
|
|
86
105
|
return false;
|
|
87
106
|
}
|
|
88
107
|
});
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
// Free the probe context immediately instead of leaking it until GC. Embedded
|
|
109
|
+
// TV browsers cap live WebGL contexts very low; a lingering probe burns one of
|
|
110
|
+
// those scarce slots and can trigger "too many active webgl contexts" — which
|
|
111
|
+
// evicts the oldest context (potentially the live render context). Guard with
|
|
112
|
+
// isContextLost(): if the browser already evicted this probe, loseContext()
|
|
113
|
+
// throws INVALID_OPERATION ("context already lost") and spams the console.
|
|
114
|
+
const probe = probeContext;
|
|
115
|
+
if (probe !== null &&
|
|
116
|
+
'getExtension' in probe &&
|
|
117
|
+
probe.isContextLost() === false) {
|
|
118
|
+
probe
|
|
119
|
+
.getExtension('WEBGL_lose_context')
|
|
120
|
+
?.loseContext();
|
|
91
121
|
}
|
|
122
|
+
supportedWebglVersions.set(cacheKey, supports);
|
|
92
123
|
return supports;
|
|
93
124
|
}
|
|
94
125
|
export const supportsWebGL = (webGLSupportedVersion) => ['webgl', 'experimental-webgl', 'webgl2'].some((ver) => webGLSupportedVersion.includes(ver));
|
package/dist/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAY,UAAU,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,iBAAiB,GAAG;IACxB,QAAQ;IACR,OAAO;IACP,qBAAqB;IACrB,oBAAoB;CACrB,CAAC;AACF,IAAI,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAY,UAAU,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,iBAAiB,GAAG;IACxB,QAAQ;IACR,OAAO;IACP,qBAAqB;IACrB,oBAAoB;CACrB,CAAC;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,2EAA2E;AAC3E,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAoB,CAAC;AAE3D;;GAEG;AACH,MA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