@quicktvui/web-renderer 1.0.2 → 1.0.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/package.json +1 -1
- package/src/index.js +50 -5
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -249,6 +249,7 @@ let _webEngine = null
|
|
|
249
249
|
/**
|
|
250
250
|
* Initialize the web renderer (convenience function)
|
|
251
251
|
* Creates and prepares the engine, applies patches
|
|
252
|
+
* This matches the initialization flow in main-web.js
|
|
252
253
|
*/
|
|
253
254
|
export function initWebRenderer() {
|
|
254
255
|
if (_webEngine) {
|
|
@@ -256,11 +257,54 @@ export function initWebRenderer() {
|
|
|
256
257
|
return _webEngine
|
|
257
258
|
}
|
|
258
259
|
|
|
259
|
-
console.log('[Web Renderer]
|
|
260
|
+
console.log('[Web Renderer] === Starting initialization ===')
|
|
261
|
+
|
|
262
|
+
// Step 0: Initialize async localStorage (must be first)
|
|
263
|
+
initAsyncLocalStorage()
|
|
264
|
+
|
|
265
|
+
// Step 0.1: Initialize auto proxy for development
|
|
266
|
+
initAutoProxy()
|
|
267
|
+
|
|
268
|
+
// Step 0.2: Register IJKPlayerComponent for web video
|
|
269
|
+
global.__WEB_COMPONENT__ = global.__WEB_COMPONENTS__ || {}
|
|
270
|
+
global.__WEB_COMPONENTS__['IJKPlayerComponent'] = IJKPlayerComponent
|
|
271
|
+
|
|
272
|
+
// Step 1: Setup SceneBuilder (must be done before main.ts loads)
|
|
273
|
+
setupSceneBuilder()
|
|
274
|
+
|
|
275
|
+
console.log('[Web Renderer] Component mappings:', Object.keys(quicktvuiComponents))
|
|
276
|
+
|
|
277
|
+
// Step 2: Create the web engine
|
|
260
278
|
_webEngine = createWebEngine()
|
|
261
279
|
|
|
262
|
-
// Apply all patches
|
|
263
|
-
|
|
280
|
+
// Step 3: Apply all patches BEFORE starting
|
|
281
|
+
applyAllPatches(_webEngine)
|
|
282
|
+
|
|
283
|
+
// Step 4: Initialize TV Focus Manager
|
|
284
|
+
const focusManager = new TVFocusManager()
|
|
285
|
+
global.__TV_FOCUS_MANAGER__ = focusManager
|
|
286
|
+
console.log('[Web Renderer] TVFocusManager initialized')
|
|
287
|
+
|
|
288
|
+
// Step 5: Inject global CSS to match Android layout behavior
|
|
289
|
+
const styleEl = document.createElement('style')
|
|
290
|
+
styleEl.id = 'web-platform-reset'
|
|
291
|
+
styleEl.textContent = `
|
|
292
|
+
/* Web-Android Layout Compatibility Reset */
|
|
293
|
+
|
|
294
|
+
/* Disable flex cross-axis stretching (Android behavior) */
|
|
295
|
+
/* In Android, children don't auto-fill parent's cross dimension */
|
|
296
|
+
#app,
|
|
297
|
+
#app * {
|
|
298
|
+
align-items: flex-start;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/* Elements with explicit style should override the reset */
|
|
302
|
+
[style*="align-items"] {
|
|
303
|
+
align-items: var(--align-items, center) !important;
|
|
304
|
+
}
|
|
305
|
+
`
|
|
306
|
+
document.head.appendChild(styleEl)
|
|
307
|
+
console.log('[Web Renderer] Global CSS reset injected for Android-compatible layout')
|
|
264
308
|
|
|
265
309
|
console.log('[Web Renderer] Initialization complete')
|
|
266
310
|
return _webEngine
|
|
@@ -272,10 +316,11 @@ export function initWebRenderer() {
|
|
|
272
316
|
*/
|
|
273
317
|
export function startWebRenderer() {
|
|
274
318
|
if (!_webEngine) {
|
|
275
|
-
console.log('[Web Renderer] No engine found,
|
|
276
|
-
|
|
319
|
+
console.log('[Web Renderer] No engine found, initializing...')
|
|
320
|
+
initWebRenderer()
|
|
277
321
|
}
|
|
278
322
|
|
|
323
|
+
console.log('[Web Renderer] Starting engine...')
|
|
279
324
|
startWebEngine(_webEngine)
|
|
280
325
|
return _webEngine
|
|
281
326
|
}
|