@quicktvui/web-renderer 1.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 (56) hide show
  1. package/package.json +24 -0
  2. package/src/adapters/es3-video-player.js +828 -0
  3. package/src/components/Modal.js +119 -0
  4. package/src/components/QtAnimationView.js +678 -0
  5. package/src/components/QtBaseComponent.js +165 -0
  6. package/src/components/QtFastListView.js +1920 -0
  7. package/src/components/QtFlexView.js +799 -0
  8. package/src/components/QtImage.js +203 -0
  9. package/src/components/QtItemFrame.js +239 -0
  10. package/src/components/QtItemStoreView.js +93 -0
  11. package/src/components/QtItemView.js +125 -0
  12. package/src/components/QtListView.js +331 -0
  13. package/src/components/QtLoadingView.js +55 -0
  14. package/src/components/QtPageRootView.js +19 -0
  15. package/src/components/QtPlayMark.js +168 -0
  16. package/src/components/QtProgressBar.js +199 -0
  17. package/src/components/QtQRCode.js +78 -0
  18. package/src/components/QtReplaceChild.js +149 -0
  19. package/src/components/QtRippleView.js +166 -0
  20. package/src/components/QtSeekBar.js +409 -0
  21. package/src/components/QtText.js +679 -0
  22. package/src/components/QtTransitionImage.js +170 -0
  23. package/src/components/QtView.js +706 -0
  24. package/src/components/QtWebView.js +613 -0
  25. package/src/components/TabsView.js +420 -0
  26. package/src/components/ViewPager.js +206 -0
  27. package/src/components/index.js +24 -0
  28. package/src/components/plugins/TextV2Component.js +70 -0
  29. package/src/components/plugins/index.js +7 -0
  30. package/src/core/SceneBuilder.js +58 -0
  31. package/src/core/TVFocusManager.js +2014 -0
  32. package/src/core/asyncLocalStorage.js +175 -0
  33. package/src/core/autoProxy.js +165 -0
  34. package/src/core/componentRegistry.js +84 -0
  35. package/src/core/constants.js +6 -0
  36. package/src/core/index.js +8 -0
  37. package/src/core/moduleUtils.js +36 -0
  38. package/src/core/patches.js +958 -0
  39. package/src/core/templateBinding.js +666 -0
  40. package/src/index.js +246 -0
  41. package/src/modules/AndroidDevelopModule.js +101 -0
  42. package/src/modules/AndroidDeviceModule.js +341 -0
  43. package/src/modules/AndroidNetworkModule.js +178 -0
  44. package/src/modules/AndroidSharedPreferencesModule.js +100 -0
  45. package/src/modules/ESDeviceInfoModule.js +450 -0
  46. package/src/modules/ESGroupDataModule.js +195 -0
  47. package/src/modules/ESIJKAudioPlayerModule.js +477 -0
  48. package/src/modules/ESLocalStorageModule.js +100 -0
  49. package/src/modules/ESLogModule.js +65 -0
  50. package/src/modules/ESModule.js +106 -0
  51. package/src/modules/ESNetworkSpeedModule.js +117 -0
  52. package/src/modules/ESToastModule.js +172 -0
  53. package/src/modules/EsNativeModule.js +117 -0
  54. package/src/modules/FastListModule.js +101 -0
  55. package/src/modules/FocusModule.js +145 -0
  56. package/src/modules/RuntimeDeviceModule.js +176 -0
@@ -0,0 +1,145 @@
1
+ // FocusModule - Web adapter for focus border styling
2
+ // Provides focus border configuration for TV focus management
3
+
4
+ import { resolveAddon } from '../core/moduleUtils'
5
+
6
+ // Global focus configuration
7
+ const focusConfig = {
8
+ // Focus border corner radius
9
+ cornerRadius: 0,
10
+ cornerEnabled: false,
11
+
12
+ // Focus border color
13
+ borderColor: '#FFFFFF',
14
+ borderColorEnabled: false,
15
+
16
+ // Focus border width
17
+ borderWidth: 2,
18
+ borderWidthEnabled: false,
19
+
20
+ // Focus border inset (inward offset)
21
+ borderInset: 0,
22
+ borderInsetEnabled: false,
23
+
24
+ // Inner border (black border inside)
25
+ innerBorderEnabled: true,
26
+
27
+ // Focus scale factor
28
+ focusScale: 1.0,
29
+ }
30
+
31
+ /**
32
+ * Get current focus configuration
33
+ * @returns {object}
34
+ */
35
+ export function getFocusConfig() {
36
+ return { ...focusConfig }
37
+ }
38
+
39
+ /**
40
+ * Apply focus config to TVFocusManager if available
41
+ */
42
+ function applyFocusConfigToManager() {
43
+ const focusManager = global.__TV_FOCUS_MANAGER__
44
+ if (focusManager && typeof focusManager.updateFocusConfig === 'function') {
45
+ focusManager.updateFocusConfig(focusConfig)
46
+ }
47
+ }
48
+
49
+ export class FocusModule {
50
+ constructor(context) {
51
+ this.context = context
52
+ this.name = ''
53
+ this.mode = 'normal'
54
+ }
55
+
56
+ /**
57
+ * Set default focus border corner radius
58
+ * @param {number} radius - corner radius in pixels
59
+ */
60
+ setDefaultFocusBorderCorner(radius, ...args) {
61
+ focusConfig.cornerRadius = typeof radius === 'number' ? radius : 0
62
+ focusConfig.cornerEnabled = true
63
+ console.log('[FocusModule] setDefaultFocusBorderCorner:', focusConfig.cornerRadius)
64
+ applyFocusConfigToManager()
65
+ return resolveAddon(args, null)
66
+ }
67
+
68
+ /**
69
+ * Set default focus border color
70
+ * @param {string} color - CSS color value
71
+ */
72
+ setDefaultFocusBorderColor(color, ...args) {
73
+ focusConfig.borderColor = color || '#FFFFFF'
74
+ focusConfig.borderColorEnabled = true
75
+ console.log('[FocusModule] setDefaultFocusBorderColor:', focusConfig.borderColor)
76
+ applyFocusConfigToManager()
77
+ return resolveAddon(args, null)
78
+ }
79
+
80
+ /**
81
+ * Set default focus border width
82
+ * @param {number} width - border width in pixels
83
+ */
84
+ setDefaultFocusBorderWidth(width, ...args) {
85
+ focusConfig.borderWidth = typeof width === 'number' ? width : 2
86
+ focusConfig.borderWidthEnabled = true
87
+ console.log('[FocusModule] setDefaultFocusBorderWidth:', focusConfig.borderWidth)
88
+ applyFocusConfigToManager()
89
+ return resolveAddon(args, null)
90
+ }
91
+
92
+ /**
93
+ * Set focus border inset value (inward offset)
94
+ * @param {number} inset - inset in pixels
95
+ */
96
+ setFocusBorderInsetValue(inset, ...args) {
97
+ focusConfig.borderInset = typeof inset === 'number' ? inset : 0
98
+ focusConfig.borderInsetEnabled = true
99
+ console.log('[FocusModule] setFocusBorderInsetValue:', focusConfig.borderInset)
100
+ applyFocusConfigToManager()
101
+ return resolveAddon(args, null)
102
+ }
103
+
104
+ /**
105
+ * Enable/disable inner border (black border inside focus border)
106
+ * @param {boolean} enabled
107
+ */
108
+ setDefaultFocusInnerBorderEnable(enabled, ...args) {
109
+ focusConfig.innerBorderEnabled = enabled === true
110
+ console.log('[FocusModule] setDefaultFocusInnerBorderEnable:', focusConfig.innerBorderEnabled)
111
+ applyFocusConfigToManager()
112
+ return resolveAddon(args, null)
113
+ }
114
+
115
+ /**
116
+ * Set default focus scale factor
117
+ * @param {number} scale - scale factor (e.g., 1.1 for 10% enlargement)
118
+ */
119
+ setDefaultPlaceholderFocusScale(scale, ...args) {
120
+ focusConfig.focusScale = typeof scale === 'number' ? scale : 1.0
121
+ console.log('[FocusModule] setDefaultPlaceholderFocusScale:', focusConfig.focusScale)
122
+ applyFocusConfigToManager()
123
+ return resolveAddon(args, null)
124
+ }
125
+
126
+ /**
127
+ * Get current focus configuration
128
+ */
129
+ getFocusConfig(...args) {
130
+ return resolveAddon(args, focusConfig)
131
+ }
132
+
133
+ async init(...args) {
134
+ const addon = args && args.length ? args[args.length - 1] : null
135
+ if (addon && typeof addon.resolve === 'function') {
136
+ addon.resolve(true)
137
+ }
138
+ return Promise.resolve(true)
139
+ }
140
+
141
+ destroy() {}
142
+ }
143
+
144
+ // Export singleton instance for patches.js
145
+ export const focusModuleInstance = new FocusModule()
@@ -0,0 +1,176 @@
1
+ // RuntimeDeviceModule - Web adapter for device info
2
+ // Provides getRuntimeDeviceInfo for web environment
3
+
4
+ import { resolveAddon, createModuleInit } from '../core/moduleUtils'
5
+
6
+ const STORAGE_KEY = 'quicktvui_device_id'
7
+
8
+ // Generate UUID v4
9
+ // Use crypto.randomUUID() if available (cryptographically secure)
10
+ // Fallback to Math.random() for older browsers
11
+ function generateUUID() {
12
+ // Modern browsers: crypto.randomUUID() is cryptographically secure
13
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
14
+ return crypto.randomUUID()
15
+ }
16
+
17
+ // Fallback for older browsers
18
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
19
+ const r = (Math.random() * 16) | 0
20
+ const v = c === 'x' ? r : (r & 0x3) | 0x8
21
+ return v.toString(16)
22
+ })
23
+ }
24
+
25
+ // Get or create device ID
26
+ async function getOrCreateDeviceId() {
27
+ // Try to get existing ID from localStorage
28
+ try {
29
+ const existingId = await localStorage.getItem(STORAGE_KEY)
30
+ if (existingId) {
31
+ return existingId
32
+ }
33
+ } catch (e) {
34
+ // localStorage not available
35
+ }
36
+
37
+ // Generate a new UUID
38
+ const id = generateUUID()
39
+
40
+ // Try to persist it
41
+ try {
42
+ localStorage.setItem(STORAGE_KEY, id)
43
+ } catch (e) {
44
+ // localStorage not available
45
+ }
46
+
47
+ return id
48
+ }
49
+
50
+ // Get browser/device info
51
+ function getBrowserInfo() {
52
+ const ua = navigator.userAgent
53
+
54
+ let browser = 'unknown'
55
+ let os = 'unknown'
56
+ let osVersion = ''
57
+
58
+ // Detect OS
59
+ if (/Windows/i.test(ua)) {
60
+ os = 'windows'
61
+ const match = ua.match(/Windows NT (\d+\.?\d*)/)
62
+ osVersion = match ? match[1] : ''
63
+ } else if (/Mac/i.test(ua)) {
64
+ os = 'mac'
65
+ const match = ua.match(/Mac OS X (\d+[._]\d+[._]?\d*)/)
66
+ osVersion = match ? match[1].replace(/_/g, '.') : ''
67
+ } else if (/Linux/i.test(ua)) {
68
+ os = 'linux'
69
+ } else if (/Android/i.test(ua)) {
70
+ os = 'android'
71
+ const match = ua.match(/Android (\d+\.?\d*\.?\d*)/)
72
+ osVersion = match ? match[1] : ''
73
+ } else if (/iOS|iPhone|iPad/i.test(ua)) {
74
+ os = 'ios'
75
+ const match = ua.match(/OS (\d+_\d+_?\d*)/)
76
+ osVersion = match ? match[1].replace(/_/g, '.') : ''
77
+ }
78
+
79
+ // Detect browser
80
+ if (/Chrome/i.test(ua) && !/Edge|Edg/i.test(ua)) {
81
+ browser = 'chrome'
82
+ } else if (/Safari/i.test(ua) && !/Chrome/i.test(ua)) {
83
+ browser = 'safari'
84
+ } else if (/Firefox/i.test(ua)) {
85
+ browser = 'firefox'
86
+ } else if (/Edge|Edg/i.test(ua)) {
87
+ browser = 'edge'
88
+ }
89
+
90
+ return { browser, os, osVersion }
91
+ }
92
+
93
+ export class RuntimeDeviceModuleClass {
94
+ constructor(context) {
95
+ this.context = context
96
+ this.name = ''
97
+ this.mode = 'normal'
98
+ this._deviceId = null
99
+ }
100
+
101
+ // Get cached or generate device ID
102
+ async _getDeviceId() {
103
+ if (!this._deviceId) {
104
+ this._deviceId = await getOrCreateDeviceId()
105
+ }
106
+ return this._deviceId
107
+ }
108
+
109
+ // Get device ID only
110
+ async getRuntimeDeviceId(...args) {
111
+ const deviceId = await this._getDeviceId()
112
+ console.log(
113
+ '[RuntimeDeviceModule] getRuntimeDeviceId called, deviceId:',
114
+ deviceId,
115
+ 'args:',
116
+ args
117
+ )
118
+ return resolveAddon(args, deviceId)
119
+ }
120
+
121
+ // Get device type only
122
+ async getRuntimeDeviceType(...args) {
123
+ return resolveAddon(args, 'web')
124
+ }
125
+
126
+ // Main method: getRuntimeDeviceInfo
127
+ async getRuntimeDeviceInfo(...args) {
128
+ const { browser, os, osVersion } = getBrowserInfo()
129
+ const deviceId = await this._getDeviceId()
130
+
131
+ const deviceInfo = {
132
+ // Device identification
133
+ deviceId: deviceId,
134
+ deviceSerial: deviceId,
135
+
136
+ // Device type
137
+ deviceType: 'web',
138
+ deviceModel: browser,
139
+ deviceBrand: 'web',
140
+
141
+ // OS info
142
+ osName: os,
143
+ osVersion: osVersion,
144
+ osApiLevel: '',
145
+
146
+ // Screen info
147
+ screenWidth: window.screen.width || 0,
148
+ screenHeight: window.screen.height || 0,
149
+ screenDensity: window.devicePixelRatio || 1,
150
+
151
+ // App info
152
+ appVersion: '',
153
+ appVersionCode: 0,
154
+
155
+ // Network info
156
+ networkType: 'unknown',
157
+
158
+ // Platform
159
+ platform: 'web',
160
+ }
161
+
162
+ return resolveAddon(args, deviceInfo)
163
+ }
164
+
165
+ destroy() {}
166
+
167
+ async init(...args) {
168
+ return createModuleInit(args)
169
+ }
170
+ }
171
+
172
+ // Export class for HippyWebEngine (needs constructor)
173
+ export { RuntimeDeviceModuleClass as RuntimeDeviceModule }
174
+
175
+ // Also export singleton instance for patches.js
176
+ export const runtimeDeviceModuleInstance = new RuntimeDeviceModuleClass()