@quicktvui/naddons 1.0.0-alpha.4 → 1.0.0-alpha.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/components/DatePicker/DatePicker.vue.d.ts +28 -0
- package/dist/components/DatePicker/index.d.ts +13 -0
- package/dist/components/GridTabs/GridTabs.vue.d.ts +7 -1
- package/dist/components/GridTabs/PortalItem.vue.d.ts +26 -0
- package/dist/components/GridTabs/PortalPool.vue.d.ts +2 -0
- package/dist/components/GridTabs/index.d.ts +1 -1
- package/dist/components/GridTabs/useGridTabs.d.ts +91 -0
- package/dist/components/GridTabs/useGridTabsData.d.ts +20 -0
- package/dist/components/GridTabs/useGridTabsUpdater.d.ts +24 -0
- package/dist/components/Keyboard/Keyboard.vue.d.ts +50 -0
- package/dist/components/Keyboard/index.d.ts +13 -0
- package/dist/components/NumericKeyboard/NumericKeyboard.vue.d.ts +28 -0
- package/dist/components/NumericKeyboard/index.d.ts +13 -0
- package/dist/components/PortalItem/PortalItem.vue.d.ts +24 -0
- package/dist/components/PortalItem/index.d.ts +13 -0
- package/dist/components/PortalPool/PortalPool.vue.d.ts +11 -0
- package/dist/components/PortalPool/index.d.ts +13 -0
- package/dist/components/RatingBar/RatingBar.vue.d.ts +34 -0
- package/dist/components/RatingBar/index.d.ts +13 -0
- package/dist/core/AddonProvider.d.ts +34 -0
- package/dist/core/withAsyncPlugin.d.ts +17 -2
- package/dist/index.d.ts +28 -2
- package/dist/naddons.cjs.js +1 -1
- package/dist/naddons.es.js +706 -182
- package/package.json +3 -1
package/dist/naddons.es.js
CHANGED
|
@@ -1,259 +1,783 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as D, ref as w, openBlock as R, createBlock as C, unref as M, mergeProps as Q, withCtx as q, renderSlot as F, shallowRef as H, watch as X, computed as me, onMounted as be, h as G, nextTick as ye, provide as pe, inject as Pe } from "vue";
|
|
2
|
+
import { Native as x } from "@extscreen/es3-vue";
|
|
3
|
+
import { useES as de, useESPlugin as Te } from "@extscreen/es3-core";
|
|
4
|
+
const ee = "QtGridTabs", j = /* @__PURE__ */ D({
|
|
5
5
|
__name: "GridTabs",
|
|
6
6
|
props: {
|
|
7
|
+
protocolVersion: {},
|
|
7
8
|
tabsData: {},
|
|
8
9
|
actionPayload: {}
|
|
9
10
|
},
|
|
10
|
-
emits: ["onTabSelected", "onTabNeedsData", "onLoadMore", "onItemPresence", "onTabFocused", "onItemClick", "onItemFocused"],
|
|
11
|
-
setup(o, { expose:
|
|
12
|
-
const a =
|
|
13
|
-
|
|
14
|
-
"com.quicktvui.plugin.glintui"
|
|
11
|
+
emits: ["onTabSelected", "onTabNeedsData", "onLoadMore", "onItemPresence", "onTabFocused", "onItemClick", "onItemFocused", "onProtocolMismatch"],
|
|
12
|
+
setup(o, { expose: r }) {
|
|
13
|
+
const c = w(), v = K(), g = ee + "_Plugin", a = (v.isPluginActive ? g : ee).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, ""), m = L(
|
|
14
|
+
a,
|
|
15
|
+
v.pluginPackageName || "com.quicktvui.plugin.glintui"
|
|
15
16
|
);
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
return (
|
|
17
|
+
return r({
|
|
18
|
+
getNativeNode: () => {
|
|
19
|
+
var s, l;
|
|
20
|
+
return ((l = (s = c.value) == null ? void 0 : s.getNativeNode) == null ? void 0 : l.call(s)) || c.value;
|
|
21
|
+
},
|
|
22
|
+
dispatchAction: (...s) => {
|
|
23
|
+
var d, _;
|
|
24
|
+
const l = ((_ = (d = c.value) == null ? void 0 : d.getNativeNode) == null ? void 0 : _.call(d)) || c.value;
|
|
25
|
+
l && x.callUIFunction(l, "dispatchAction", s);
|
|
26
|
+
},
|
|
27
|
+
scrollToTop: (...s) => {
|
|
28
|
+
var d, _;
|
|
29
|
+
const l = ((_ = (d = c.value) == null ? void 0 : d.getNativeNode) == null ? void 0 : _.call(d)) || c.value;
|
|
30
|
+
l && x.callUIFunction(l, "scrollToTop", s);
|
|
20
31
|
}
|
|
21
|
-
}), (
|
|
32
|
+
}), (s, l) => (R(), C(M(m), Q({
|
|
22
33
|
ref_key: "nativeRef",
|
|
23
|
-
ref:
|
|
34
|
+
ref: c,
|
|
35
|
+
protocolVersion: o.protocolVersion,
|
|
24
36
|
tabsData: o.tabsData,
|
|
25
37
|
actionPayload: o.actionPayload,
|
|
26
|
-
onOnTabSelected:
|
|
27
|
-
onOnTabNeedsData:
|
|
28
|
-
onOnLoadMore:
|
|
29
|
-
onOnItemPresence:
|
|
30
|
-
onOnTabFocused:
|
|
31
|
-
onOnItemClick:
|
|
32
|
-
onOnItemFocused:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
onOnTabSelected: l[0] || (l[0] = (d) => s.$emit("onTabSelected", d.nativeEvent)),
|
|
39
|
+
onOnTabNeedsData: l[1] || (l[1] = (d) => s.$emit("onTabNeedsData", d.nativeEvent)),
|
|
40
|
+
onOnLoadMore: l[2] || (l[2] = (d) => s.$emit("onLoadMore", d.nativeEvent)),
|
|
41
|
+
onOnItemPresence: l[3] || (l[3] = (d) => s.$emit("onItemPresence", d.nativeEvent)),
|
|
42
|
+
onOnTabFocused: l[4] || (l[4] = (d) => s.$emit("onTabFocused", d.nativeEvent)),
|
|
43
|
+
onOnItemClick: l[5] || (l[5] = (d) => s.$emit("onItemClick", d.nativeEvent)),
|
|
44
|
+
onOnItemFocused: l[6] || (l[6] = (d) => s.$emit("onItemFocused", d.nativeEvent)),
|
|
45
|
+
onOnProtocolMismatch: l[7] || (l[7] = (d) => s.$emit("onProtocolMismatch", d.nativeEvent))
|
|
46
|
+
}, s.$attrs), {
|
|
47
|
+
default: q(() => [
|
|
48
|
+
F(s.$slots, "default")
|
|
36
49
|
]),
|
|
37
50
|
_: 3
|
|
38
|
-
}, 16, ["tabsData", "actionPayload"]));
|
|
51
|
+
}, 16, ["protocolVersion", "tabsData", "actionPayload"]));
|
|
39
52
|
}
|
|
40
53
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
let z;
|
|
55
|
+
var ae;
|
|
56
|
+
try {
|
|
57
|
+
const o = require("@extscreen/es3-vue");
|
|
58
|
+
z = o.registerElement || ((ae = o.default) == null ? void 0 : ae.registerElement);
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
const he = {
|
|
62
|
+
install: (o) => {
|
|
63
|
+
if (!globalThis.__QtGridTabs_registered)
|
|
64
|
+
if (z) {
|
|
65
|
+
const r = (c, v) => {
|
|
66
|
+
z(c, {
|
|
67
|
+
component: {
|
|
68
|
+
name: v ? "QtGridTabs_Plugin" : "QtGridTabs",
|
|
69
|
+
processEventData(g, y) {
|
|
70
|
+
const a = g.handler || g, m = y || (a == null ? void 0 : a.nativeParams) || {};
|
|
71
|
+
return a && (a.nativeEvent = m), a;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
r("qt-grid-tabs", !1), r("qt-grid-tabs-plugin", !0), r("QtGridTabs", !1), r("QtGridTabs_Plugin", !0), r("gt-tabs", !1), r("gt-tabs-plugin", !0), globalThis.__QtGridTabs_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtGridTabs");
|
|
77
|
+
} else
|
|
78
|
+
console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");
|
|
79
|
+
o.component("GridTabs", j), o.component("qt-grid-tabs", j), o.component("gt-tabs", j);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function _e(o, r) {
|
|
83
|
+
const c = w(""), v = H([]), g = H([]);
|
|
84
|
+
let y = !1, a = !1;
|
|
85
|
+
const m = "__virtual_single_tab__", s = w({}), l = (e) => {
|
|
86
|
+
const t = Array.isArray(e) ? e : [e], n = JSON.stringify(t);
|
|
87
|
+
if (a && o.value) {
|
|
88
|
+
if (typeof o.value.dispatchAction == "function") {
|
|
89
|
+
console.log("[useGridTabs] Calling Wrapper dispatchAction directly"), o.value.dispatchAction(n);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
let i = o.value;
|
|
93
|
+
typeof o.value.getNativeNode == "function" ? i = o.value.getNativeNode() || o.value : o.value.nativeRef && (i = o.value.nativeRef), i ? (console.log("[useGridTabs] Calling Native.callUIFunction(dispatchAction)"), x.callUIFunction(i, "dispatchAction", [n])) : console.warn("[useGridTabs] Native target is null or undefined, cannot call dispatchAction");
|
|
94
|
+
}
|
|
95
|
+
}, d = (e, t) => {
|
|
96
|
+
if (!e)
|
|
97
|
+
return !1;
|
|
98
|
+
let n = !0;
|
|
99
|
+
return e.id || (console.error(`[useGridTabs] ❌ 数据格式错误 (${t}): 卡片缺失必填字段 'id'。每个卡片必须有唯一标识才能进行后续更新!`, e), n = !1), e.viewType || (console.error(`[useGridTabs] ❌ 数据格式错误 (${t}): 卡片缺失必填字段 'viewType' (id: ${e.id || "未知"})。必须指定 Native 注册的视图类型或 Portal 标识!`, e), n = !1), n;
|
|
100
|
+
}, _ = (e, t) => {
|
|
101
|
+
if (!e)
|
|
102
|
+
return !1;
|
|
103
|
+
let n = !0;
|
|
104
|
+
return e.tabId || (console.error(`[useGridTabs] ❌ 数据格式错误 (${t}): Tab 缺失必填字段 'tabId'。每个 Tab 必须有唯一标识!`, e), n = !1), (e.title === void 0 || e.title === null) && console.warn(`[useGridTabs] ⚠️ 数据格式警告 (${t}): Tab 缺失 'title' 字段 (tabId: ${e.tabId || "未知"}),导航栏可能显示为空。`, e), n;
|
|
105
|
+
}, U = (e, t) => {
|
|
106
|
+
if (!e || e.length === 0)
|
|
107
|
+
return;
|
|
108
|
+
k.clear();
|
|
109
|
+
const n = e[0].hasOwnProperty("tabId") || e[0].hasOwnProperty("items") && Array.isArray(e[0].items);
|
|
110
|
+
y = t === "1d", t === "1d" && n ? console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `items.value` (一维瀑布流) 赋值二维 Tabs 数据结构!请改用 `tabs.value = ...`") : t === "2d" && !n && console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `tabs.value` (二维导航) 赋值一维卡片列表数据结构!请改用 `items.value = ...`"), t === "1d" ? e.forEach((i, u) => d(i, `items.value[${u}]`)) : e.forEach((i, u) => {
|
|
111
|
+
_(i, `tabs.value[${u}]`), i.items && Array.isArray(i.items) && i.items.forEach((f, p) => d(f, `tabs.value[${u}].items[${p}]`));
|
|
112
|
+
}), a = !0, T();
|
|
113
|
+
}, k = /* @__PURE__ */ new Set(), T = (e = "unknown") => {
|
|
114
|
+
if (!a) {
|
|
115
|
+
console.warn("[useGridTabs] triggerRootUpdate skipped because isInitialized is false");
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
let t = {
|
|
119
|
+
gridBasis: (r == null ? void 0 : r.gridBasis) ?? 30,
|
|
120
|
+
unitType: (r == null ? void 0 : r.unitType) ?? "px",
|
|
121
|
+
contentConfig: (r == null ? void 0 : r.contentConfig) ?? (r == null ? void 0 : r.layoutConfig) ?? {
|
|
122
|
+
padding: [0, 60, 60, 60],
|
|
123
|
+
navContentGapNormal: 0,
|
|
124
|
+
itemGap: 24
|
|
125
|
+
},
|
|
126
|
+
navConfig: (r == null ? void 0 : r.navConfig) ?? {
|
|
127
|
+
dock: "left",
|
|
128
|
+
mode: "fixed",
|
|
129
|
+
renderType: "smart-hybrid",
|
|
130
|
+
box: { size: [200, 0] },
|
|
131
|
+
expandedBox: { size: [300, 0] }
|
|
132
|
+
},
|
|
133
|
+
cacheConfig: (r == null ? void 0 : r.cacheConfig) ?? {
|
|
134
|
+
offscreenPageLimit: 1,
|
|
135
|
+
prefetchOffset: 2,
|
|
136
|
+
resetOnSwitch: !0
|
|
137
|
+
},
|
|
138
|
+
animationConfig: (r == null ? void 0 : r.animationConfig) ?? {
|
|
139
|
+
duration: 250,
|
|
140
|
+
layoutEntrance: "staggered_slide_up",
|
|
141
|
+
itemUpdate: "fade_cross"
|
|
142
|
+
},
|
|
143
|
+
focusConfig: (r == null ? void 0 : r.focusConfig) ?? {
|
|
144
|
+
defaultFocus: "content",
|
|
145
|
+
restoreLastFocus: !0
|
|
146
|
+
},
|
|
147
|
+
referenceResolution: (r == null ? void 0 : r.referenceResolution) ?? { w: 1920, h: 1080 }
|
|
148
|
+
}, n = [];
|
|
149
|
+
y ? (t.navConfig = { ...t.navConfig, renderType: "none" }, n = [
|
|
150
|
+
{
|
|
151
|
+
tabId: m,
|
|
152
|
+
title: "Virtual Tab",
|
|
153
|
+
hidden: !0,
|
|
154
|
+
items: g.value
|
|
58
155
|
}
|
|
156
|
+
]) : n = v.value;
|
|
157
|
+
const i = JSON.stringify({
|
|
158
|
+
page_spec: t,
|
|
159
|
+
tabs: n
|
|
160
|
+
});
|
|
161
|
+
c.value === "" ? (console.log(`[useGridTabs] triggerRootUpdate: Initializing tabsDataStr (length=${i.length})`), c.value = i) : (console.log(`[useGridTabs] triggerRootUpdate: Sending RELOAD_TABS action directly to Native (length=${i.length})`), c.value = i, l({
|
|
162
|
+
op: "RELOAD_TABS",
|
|
163
|
+
payload: {
|
|
164
|
+
pageSpec: t,
|
|
165
|
+
// 兼容不同的 Gson alias
|
|
166
|
+
page_spec: t,
|
|
167
|
+
tabs: n
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
}, S = (e) => !e || typeof e != "object" || e.__isGridTabsProxy ? e : (e.content && typeof e.content == "object" && !e.content.__isGridTabsProxy && (e.content = new Proxy(e.content, {
|
|
171
|
+
set(t, n, i, u) {
|
|
172
|
+
const f = Reflect.set(t, n, i, u);
|
|
173
|
+
return e.id && a && l({
|
|
174
|
+
op: "UPDATE_ITEM",
|
|
175
|
+
itemId: e.id,
|
|
176
|
+
payload: e
|
|
177
|
+
}), f;
|
|
178
|
+
}
|
|
179
|
+
}), Object.defineProperty(e.content, "__isGridTabsProxy", { value: !0, enumerable: !1 })), new Proxy(e, {
|
|
180
|
+
set(t, n, i, u) {
|
|
181
|
+
const f = Reflect.set(t, n, i, u);
|
|
182
|
+
return t.id && a && l({
|
|
183
|
+
op: "UPDATE_ITEM",
|
|
184
|
+
itemId: t.id,
|
|
185
|
+
payload: t
|
|
186
|
+
}), f;
|
|
59
187
|
}
|
|
188
|
+
})), O = (e, t) => {
|
|
189
|
+
for (let n = 0; n < e.length; n++)
|
|
190
|
+
e[n] = S(e[n]);
|
|
191
|
+
return new Proxy(e, {
|
|
192
|
+
get(n, i, u) {
|
|
193
|
+
return i === "push" ? (...f) => {
|
|
194
|
+
f.forEach((V, fe) => d(V, `push(${fe})`)), a || console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");
|
|
195
|
+
const p = f.map((V) => S(V)), $ = Array.prototype.push.apply(n, p);
|
|
196
|
+
return l({
|
|
197
|
+
op: "APPEND_SUB_ITEMS",
|
|
198
|
+
itemId: t,
|
|
199
|
+
payload: { subItems: p }
|
|
200
|
+
}), $;
|
|
201
|
+
} : Reflect.get(n, i, u);
|
|
202
|
+
},
|
|
203
|
+
set(n, i, u, f) {
|
|
204
|
+
if (i !== "length" && !isNaN(Number(i))) {
|
|
205
|
+
a || console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(i)}]。请先对 items.value 或 tabs.value 进行全量赋值!`), d(u, `索引赋值 [${String(i)}]`);
|
|
206
|
+
const p = S(u), $ = Reflect.set(n, i, p, f);
|
|
207
|
+
return p && p.id && l({
|
|
208
|
+
op: "UPDATE_ITEM",
|
|
209
|
+
itemId: p.id,
|
|
210
|
+
payload: p
|
|
211
|
+
}), $;
|
|
212
|
+
}
|
|
213
|
+
return Reflect.set(n, i, u, f);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}, b = (e) => (e.items && Array.isArray(e.items) && !e.items.__isGridTabsProxy && (e.items = O(e.items, e.tabId), Object.defineProperty(e.items, "__isGridTabsProxy", { value: !0, enumerable: !1 })), new Proxy(e, {
|
|
217
|
+
set(t, n, i, u) {
|
|
218
|
+
if (n === "items") {
|
|
219
|
+
let f = i;
|
|
220
|
+
Array.isArray(i) && !i.__isGridTabsProxy && (f = O(i, t.tabId), Object.defineProperty(f, "__isGridTabsProxy", { value: !0, enumerable: !1 }));
|
|
221
|
+
const p = Reflect.set(t, n, f, u);
|
|
222
|
+
return T(), p;
|
|
223
|
+
}
|
|
224
|
+
return Reflect.set(t, n, i, u);
|
|
225
|
+
}
|
|
226
|
+
})), P = (e) => {
|
|
227
|
+
const t = e.map((n) => b(n));
|
|
228
|
+
return new Proxy(t, {
|
|
229
|
+
set(n, i, u, f) {
|
|
230
|
+
if (i !== "length" && !isNaN(Number(i))) {
|
|
231
|
+
let p = u;
|
|
232
|
+
u.__isGridTabsProxy || (p = b(u), Object.defineProperty(p, "__isGridTabsProxy", { value: !0, enumerable: !1 }));
|
|
233
|
+
const $ = Reflect.set(n, i, p, f);
|
|
234
|
+
return T(), $;
|
|
235
|
+
}
|
|
236
|
+
return Reflect.set(n, i, u, f);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
X(v, (e, t) => {
|
|
241
|
+
if (console.log("[useGridTabs] watch(tabs) triggered:", { newTabs: e, isInitialized: a }), !e || e.length === 0) {
|
|
242
|
+
c.value = "", a = !1;
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (e.__isGridTabsProxy)
|
|
246
|
+
console.log("[useGridTabs] newTabs is ALREADY a proxy, triggering root update"), T();
|
|
247
|
+
else {
|
|
248
|
+
console.log("[useGridTabs] newTabs is NOT a proxy, performing full deduceModeAndInitialize & wrapping"), U(e, "2d");
|
|
249
|
+
const n = P(e);
|
|
250
|
+
Object.defineProperty(n, "__isGridTabsProxy", { value: !0, enumerable: !1 }), v.value = n, T();
|
|
251
|
+
}
|
|
252
|
+
}, { flush: "sync" }), X(g, (e, t) => {
|
|
253
|
+
if (console.log("[useGridTabs] watch(items) triggered:", { newItems: e, isInitialized: a }), !e || e.length === 0) {
|
|
254
|
+
c.value = "", a = !1;
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (e.__isGridTabsProxy)
|
|
258
|
+
console.log("[useGridTabs] newItems is ALREADY a proxy, triggering root update"), T();
|
|
259
|
+
else {
|
|
260
|
+
console.log("[useGridTabs] newItems is NOT a proxy, performing full deduceModeAndInitialize & wrapping"), U(e, "1d");
|
|
261
|
+
const n = O(e, m);
|
|
262
|
+
Object.defineProperty(n, "__isGridTabsProxy", { value: !0, enumerable: !1 }), g.value = n, T();
|
|
263
|
+
}
|
|
264
|
+
}, { flush: "sync" });
|
|
265
|
+
const A = () => {
|
|
266
|
+
console.log("[useGridTabs] resetInitialization called manually"), a = !1, c.value = "";
|
|
267
|
+
}, h = (e) => {
|
|
268
|
+
if (!e || e.length === 0) {
|
|
269
|
+
c.value = "", a = !1;
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
e[0].hasOwnProperty("tabId") || e[0].hasOwnProperty("items") && Array.isArray(e[0].items) ? v.value = e : g.value = e;
|
|
273
|
+
}, I = (e) => {
|
|
274
|
+
s.value = e;
|
|
275
|
+
}, E = me(() => ({
|
|
276
|
+
tabsData: c.value,
|
|
277
|
+
// 不再绑定 actionPayload 属性,完全走命令式 API,防止触发无意义的 Vue 节点更新
|
|
278
|
+
onTabNeedsData: async (...e) => {
|
|
279
|
+
let t = e[0];
|
|
280
|
+
if (t && t.nativeEvent && (t = t.nativeEvent), !s.value.onTabNeedsData)
|
|
281
|
+
return;
|
|
282
|
+
const { tabId: n, index: i, reason: u } = t;
|
|
283
|
+
if (k.has(n)) {
|
|
284
|
+
console.log(`[useGridTabs] onTabNeedsData SKIP: tabId=${n} 已经发起过请求,防止死循环`);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
k.add(n);
|
|
288
|
+
try {
|
|
289
|
+
const f = await s.value.onTabNeedsData(n, i, u);
|
|
290
|
+
if (f && Array.isArray(f)) {
|
|
291
|
+
const p = v.value.find(($) => $.tabId === n);
|
|
292
|
+
p && (p.items = f);
|
|
293
|
+
}
|
|
294
|
+
} catch (f) {
|
|
295
|
+
console.error("[useGridTabs] onTabNeedsData 执行失败:", f), k.delete(n);
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
onLoadMore: async (...e) => {
|
|
299
|
+
let t = e[0];
|
|
300
|
+
if (t && t.nativeEvent && (t = t.nativeEvent), !s.value.onLoadMore)
|
|
301
|
+
return;
|
|
302
|
+
const { tabId: n, cursor: i, itemId: u } = t, f = await s.value.onLoadMore(n, i, u);
|
|
303
|
+
if (f && Array.isArray(f) && f.length > 0)
|
|
304
|
+
if (y)
|
|
305
|
+
g.value.push(...f);
|
|
306
|
+
else {
|
|
307
|
+
const p = v.value.find(($) => $.tabId === n);
|
|
308
|
+
p && p.items && p.items.push(...f);
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
onItemPresence: (...e) => {
|
|
312
|
+
let t = e[0];
|
|
313
|
+
if (console.log("[useGridTabs] ⚡️ bindings caught onItemPresence:", t), s.value.onItemPresence)
|
|
314
|
+
try {
|
|
315
|
+
let n = typeof t == "string" ? t : (t == null ? void 0 : t.nativeEvent) || t;
|
|
316
|
+
n && typeof n.data == "string" && (n = n.data);
|
|
317
|
+
const i = typeof n == "string" ? JSON.parse(n) : n;
|
|
318
|
+
i && i.type === "VIEW_PRESENCE_BATCH" && Array.isArray(i.payload) ? i.payload.forEach((u) => {
|
|
319
|
+
u.itemId && typeof u.itemId == "string" && u.itemId.startsWith("fallback_pos_") && console.warn(`[useGridTabs] ⚠️ 警告:检测到列表项曝光 (index=${u.index}),但未配置 itemId。请检查传入的 items 数组,务必为每个数据项指定唯一的 itemId,否则底层无法准确进行去重与曝光上报。`), s.value.onItemPresence(u);
|
|
320
|
+
}) : s.value.onItemPresence(i);
|
|
321
|
+
} catch (n) {
|
|
322
|
+
console.error("[useGridTabs] Failed to parse onItemPresence event payload:", n), s.value.onItemPresence(t);
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
onTabSelected: (...e) => {
|
|
326
|
+
let t = e[0];
|
|
327
|
+
t && t.nativeEvent && (t = t.nativeEvent), s.value.onTabSelected && s.value.onTabSelected(t);
|
|
328
|
+
},
|
|
329
|
+
onItemClick: (...e) => {
|
|
330
|
+
let t = e[0];
|
|
331
|
+
if (console.log("[useGridTabs] RAW onItemClick intercepted from Native:", t), t && t.nativeEvent && (t = t.nativeEvent), s.value.onItemClick)
|
|
332
|
+
try {
|
|
333
|
+
let n = typeof t == "string" ? t : (t == null ? void 0 : t.data) || t;
|
|
334
|
+
console.log("[useGridTabs] Parsed eventStr:", n);
|
|
335
|
+
const i = typeof n == "string" ? JSON.parse(n) : n;
|
|
336
|
+
s.value.onItemClick(i);
|
|
337
|
+
} catch (n) {
|
|
338
|
+
console.error("[useGridTabs] Failed to parse onItemClick event payload:", n), s.value.onItemClick(t);
|
|
339
|
+
}
|
|
340
|
+
else
|
|
341
|
+
console.warn("[useGridTabs] onItemClick triggered but NO callback registered in callbacksRef!");
|
|
342
|
+
},
|
|
343
|
+
onItemFocused: (...e) => {
|
|
344
|
+
let t = e[0];
|
|
345
|
+
if (t && t.nativeEvent && (t = t.nativeEvent), s.value.onItemFocused)
|
|
346
|
+
try {
|
|
347
|
+
let n = typeof t == "string" ? t : (t == null ? void 0 : t.data) || t;
|
|
348
|
+
const i = typeof n == "string" ? JSON.parse(n) : n;
|
|
349
|
+
s.value.onItemFocused(i);
|
|
350
|
+
} catch (n) {
|
|
351
|
+
console.error("[useGridTabs] Failed to parse onItemFocused event payload:", n), s.value.onItemFocused(t);
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
onTabFocused: (...e) => {
|
|
355
|
+
let t = e[0];
|
|
356
|
+
t && t.nativeEvent && (t = t.nativeEvent), s.value.onTabFocused && s.value.onTabFocused(t);
|
|
357
|
+
}
|
|
358
|
+
}));
|
|
359
|
+
return {
|
|
360
|
+
tabsDataStr: c,
|
|
361
|
+
bindings: E,
|
|
362
|
+
tabs: v,
|
|
363
|
+
items: g,
|
|
364
|
+
initData: h,
|
|
365
|
+
setCallbacks: I,
|
|
366
|
+
updateItem: (e, t) => {
|
|
367
|
+
if (!a) {
|
|
368
|
+
console.error("[useGridTabs] ❌ 时机错误: 尚未初始化数据,无法调用 updateItem");
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
l({ op: "UPDATE_ITEM", itemId: e, payload: t });
|
|
372
|
+
const n = (i) => {
|
|
373
|
+
for (const u in t)
|
|
374
|
+
u === "content" && i.content ? Object.assign(i.content, t.content) : i[u] = t[u];
|
|
375
|
+
};
|
|
376
|
+
if (y) {
|
|
377
|
+
const i = g.value.find((u) => u.id === e);
|
|
378
|
+
i && n(i);
|
|
379
|
+
} else
|
|
380
|
+
for (const i of v.value)
|
|
381
|
+
if (i.items) {
|
|
382
|
+
const u = i.items.find((f) => f.id === e);
|
|
383
|
+
if (u) {
|
|
384
|
+
n(u);
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
dispatchAction: l,
|
|
390
|
+
resetInitialization: A
|
|
60
391
|
};
|
|
61
392
|
}
|
|
62
|
-
|
|
63
|
-
|
|
393
|
+
const te = "QtKeyboard", ne = /* @__PURE__ */ D({
|
|
394
|
+
__name: "Keyboard",
|
|
395
|
+
props: {
|
|
396
|
+
backgroundColor: {},
|
|
397
|
+
textColor: {},
|
|
398
|
+
weakTextColor: {},
|
|
399
|
+
focusBackgroundColor: {},
|
|
400
|
+
focusTextColor: {},
|
|
401
|
+
placeholder: {},
|
|
402
|
+
textFullKeyboard: {},
|
|
403
|
+
textT9Keyboard: {},
|
|
404
|
+
textClear: {},
|
|
405
|
+
textDelete: {},
|
|
406
|
+
currentInput: {}
|
|
407
|
+
},
|
|
408
|
+
emits: ["onInputChanged", "onKeyPressed"],
|
|
409
|
+
setup(o, { expose: r }) {
|
|
410
|
+
const c = w(), v = K(), g = te + "_Plugin", a = (v.isPluginActive ? g : te).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, ""), m = L(
|
|
411
|
+
a,
|
|
412
|
+
v.pluginPackageName || "com.quicktvui.plugin.extraui",
|
|
413
|
+
"com.quicktvui.plugin.extraui.ExtraUIPluginApp"
|
|
414
|
+
);
|
|
415
|
+
return r({
|
|
416
|
+
getNativeNode: () => {
|
|
417
|
+
var s, l;
|
|
418
|
+
return ((l = (s = c.value) == null ? void 0 : s.getNativeNode) == null ? void 0 : l.call(s)) || c.value;
|
|
419
|
+
}
|
|
420
|
+
}), (s, l) => (R(), C(M(m), Q({
|
|
421
|
+
ref_key: "nativeRef",
|
|
422
|
+
ref: c,
|
|
423
|
+
backgroundColor: o.backgroundColor,
|
|
424
|
+
textColor: o.textColor,
|
|
425
|
+
weakTextColor: o.weakTextColor,
|
|
426
|
+
focusBackgroundColor: o.focusBackgroundColor,
|
|
427
|
+
focusTextColor: o.focusTextColor,
|
|
428
|
+
placeholder: o.placeholder,
|
|
429
|
+
textFullKeyboard: o.textFullKeyboard,
|
|
430
|
+
textT9Keyboard: o.textT9Keyboard,
|
|
431
|
+
textClear: o.textClear,
|
|
432
|
+
textDelete: o.textDelete,
|
|
433
|
+
currentInput: o.currentInput,
|
|
434
|
+
onOnInputChanged: l[0] || (l[0] = (d) => s.$emit("onInputChanged", d.nativeEvent)),
|
|
435
|
+
onOnKeyPressed: l[1] || (l[1] = (d) => s.$emit("onKeyPressed", d.nativeEvent))
|
|
436
|
+
}, s.$attrs), {
|
|
437
|
+
default: q(() => [
|
|
438
|
+
F(s.$slots, "default")
|
|
439
|
+
]),
|
|
440
|
+
_: 3
|
|
441
|
+
}, 16, ["backgroundColor", "textColor", "weakTextColor", "focusBackgroundColor", "focusTextColor", "placeholder", "textFullKeyboard", "textT9Keyboard", "textClear", "textDelete", "currentInput"]));
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
let W;
|
|
445
|
+
var le;
|
|
64
446
|
try {
|
|
65
447
|
const o = require("@extscreen/es3-vue");
|
|
66
|
-
|
|
448
|
+
W = o.registerElement || ((le = o.default) == null ? void 0 : le.registerElement);
|
|
67
449
|
} catch {
|
|
68
450
|
}
|
|
69
|
-
const
|
|
451
|
+
const Ae = {
|
|
70
452
|
install: (o) => {
|
|
71
|
-
globalThis.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
453
|
+
if (!globalThis.__QtKeyboard_registered)
|
|
454
|
+
if (W) {
|
|
455
|
+
const r = (c, v) => {
|
|
456
|
+
W(c, {
|
|
457
|
+
component: {
|
|
458
|
+
name: v ? "QtKeyboard_Plugin" : "QtKeyboard",
|
|
459
|
+
processEventData(g, y) {
|
|
460
|
+
const a = g.handler || g, m = y || (a == null ? void 0 : a.nativeParams) || {};
|
|
461
|
+
return a && (a.nativeEvent = m), a;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
r("qt-keyboard", !1), r("qt-keyboard-plugin", !0), r("QtKeyboard", !1), r("QtKeyboard_Plugin", !0), globalThis.__QtKeyboard_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtKeyboard");
|
|
467
|
+
} else
|
|
468
|
+
console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");
|
|
469
|
+
o.component("Keyboard", ne), o.component("qt-keyboard", ne);
|
|
470
|
+
}
|
|
471
|
+
}, oe = "QtPortalPool", se = /* @__PURE__ */ D({
|
|
472
|
+
__name: "PortalPool",
|
|
473
|
+
setup(o, { expose: r }) {
|
|
474
|
+
const c = w(), v = K(), g = oe + "_Plugin", a = (v.isPluginActive ? g : oe).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, ""), m = L(
|
|
475
|
+
a,
|
|
476
|
+
v.pluginPackageName || "com.quicktvui.plugin.glintui"
|
|
477
|
+
);
|
|
478
|
+
return r({
|
|
479
|
+
getNativeNode: () => {
|
|
480
|
+
var s, l;
|
|
481
|
+
return ((l = (s = c.value) == null ? void 0 : s.getNativeNode) == null ? void 0 : l.call(s)) || c.value;
|
|
78
482
|
}
|
|
79
|
-
}),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
483
|
+
}), (s, l) => (R(), C(M(m), Q({
|
|
484
|
+
ref_key: "nativeRef",
|
|
485
|
+
ref: c
|
|
486
|
+
}, s.$attrs), {
|
|
487
|
+
default: q(() => [
|
|
488
|
+
F(s.$slots, "default")
|
|
489
|
+
]),
|
|
490
|
+
_: 3
|
|
491
|
+
}, 16));
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
let Z;
|
|
495
|
+
var ce;
|
|
496
|
+
try {
|
|
497
|
+
const o = require("@extscreen/es3-vue");
|
|
498
|
+
Z = o.registerElement || ((ce = o.default) == null ? void 0 : ce.registerElement);
|
|
499
|
+
} catch {
|
|
500
|
+
}
|
|
501
|
+
const Ie = {
|
|
502
|
+
install: (o) => {
|
|
503
|
+
if (!globalThis.__QtPortalPool_registered)
|
|
504
|
+
if (Z) {
|
|
505
|
+
const r = (c, v) => {
|
|
506
|
+
Z(c, {
|
|
507
|
+
component: {
|
|
508
|
+
name: v ? "QtPortalPool_Plugin" : "QtPortalPool",
|
|
509
|
+
processEventData(g, y) {
|
|
510
|
+
const a = g.handler || g, m = y || (a == null ? void 0 : a.nativeParams) || {};
|
|
511
|
+
return a && (a.nativeEvent = m), a;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
};
|
|
516
|
+
r("qt-portal-pool", !1), r("qt-portal-pool-plugin", !0), r("QtPortalPool", !1), r("QtPortalPool_Plugin", !0), globalThis.__QtPortalPool_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtPortalPool");
|
|
517
|
+
} else
|
|
518
|
+
console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");
|
|
519
|
+
o.component("PortalPool", se), o.component("qt-portal-pool", se);
|
|
520
|
+
}
|
|
521
|
+
}, re = "QtPortalItem", ie = /* @__PURE__ */ D({
|
|
522
|
+
__name: "PortalItem",
|
|
523
|
+
props: {
|
|
524
|
+
portalId: {}
|
|
525
|
+
},
|
|
526
|
+
setup(o, { expose: r }) {
|
|
527
|
+
const c = w(), v = K(), g = re + "_Plugin", a = (v.isPluginActive ? g : re).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, ""), m = L(
|
|
528
|
+
a,
|
|
529
|
+
v.pluginPackageName || "com.quicktvui.plugin.glintui"
|
|
530
|
+
);
|
|
531
|
+
return r({
|
|
532
|
+
getNativeNode: () => {
|
|
533
|
+
var s, l;
|
|
534
|
+
return ((l = (s = c.value) == null ? void 0 : s.getNativeNode) == null ? void 0 : l.call(s)) || c.value;
|
|
85
535
|
}
|
|
86
|
-
}),
|
|
536
|
+
}), (s, l) => (R(), C(M(m), Q({
|
|
537
|
+
ref_key: "nativeRef",
|
|
538
|
+
ref: c,
|
|
539
|
+
portalId: o.portalId
|
|
540
|
+
}, s.$attrs), {
|
|
541
|
+
default: q(() => [
|
|
542
|
+
F(s.$slots, "default")
|
|
543
|
+
]),
|
|
544
|
+
_: 3
|
|
545
|
+
}, 16, ["portalId"]));
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
let J;
|
|
549
|
+
var ue;
|
|
550
|
+
try {
|
|
551
|
+
const o = require("@extscreen/es3-vue");
|
|
552
|
+
J = o.registerElement || ((ue = o.default) == null ? void 0 : ue.registerElement);
|
|
553
|
+
} catch {
|
|
554
|
+
}
|
|
555
|
+
const Ee = {
|
|
556
|
+
install: (o) => {
|
|
557
|
+
if (!globalThis.__QtPortalItem_registered)
|
|
558
|
+
if (J) {
|
|
559
|
+
const r = (c, v) => {
|
|
560
|
+
J(c, {
|
|
561
|
+
component: {
|
|
562
|
+
name: v ? "QtPortalItem_Plugin" : "QtPortalItem",
|
|
563
|
+
processEventData(g, y) {
|
|
564
|
+
const a = g.handler || g, m = y || (a == null ? void 0 : a.nativeParams) || {};
|
|
565
|
+
return a && (a.nativeEvent = m), a;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
};
|
|
570
|
+
r("qt-portal-item", !1), r("qt-portal-item-plugin", !0), r("QtPortalItem", !1), r("QtPortalItem_Plugin", !0), globalThis.__QtPortalItem_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtPortalItem");
|
|
571
|
+
} else
|
|
572
|
+
console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");
|
|
573
|
+
o.component("PortalItem", ie), o.component("qt-portal-item", ie);
|
|
87
574
|
}
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
|
|
575
|
+
}, Ne = {
|
|
576
|
+
// 如果设置为 true,则全局跳过所有组件的原生插件安装检查,直接渲染
|
|
577
|
+
skipPluginCheck: !1
|
|
578
|
+
}, B = /* @__PURE__ */ new Set();
|
|
579
|
+
function L(o, r, c) {
|
|
580
|
+
return D({
|
|
91
581
|
name: `${o}AsyncWrapper`,
|
|
92
582
|
inheritAttrs: !1,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
583
|
+
props: {
|
|
584
|
+
// 允许单个组件级别跳过检查
|
|
585
|
+
skipPluginCheck: {
|
|
586
|
+
type: Boolean,
|
|
587
|
+
default: !1
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
setup(v, { slots: g, attrs: y, expose: a }) {
|
|
591
|
+
const m = w("loading"), s = w(""), l = w(), d = globalThis.__VUE_INSTANCE__;
|
|
592
|
+
a({
|
|
593
|
+
getNativeNode: () => {
|
|
594
|
+
let b = l.value;
|
|
595
|
+
return !b && d && d.vnode && d.vnode.el && (b = d.vnode.el, b.childNodes && b.childNodes.length > 0 && (b = b.childNodes[0])), b;
|
|
596
|
+
},
|
|
597
|
+
nativeRef: l
|
|
598
|
+
});
|
|
599
|
+
let k = null, T = null;
|
|
96
600
|
try {
|
|
97
|
-
|
|
98
|
-
} catch (
|
|
99
|
-
console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",
|
|
601
|
+
k = de(), T = Te();
|
|
602
|
+
} catch (b) {
|
|
603
|
+
console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。", b);
|
|
100
604
|
}
|
|
101
605
|
const S = async () => {
|
|
102
|
-
if (!
|
|
606
|
+
if (!k || typeof k.isComponentRegistered != "function")
|
|
103
607
|
return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"), !1;
|
|
104
608
|
try {
|
|
105
|
-
const
|
|
106
|
-
if (console.log(`[withAsyncPlugin] isComponentRegistered('${o}') 返回:`,
|
|
609
|
+
const b = await k.isComponentRegistered(o);
|
|
610
|
+
if (console.log(`[withAsyncPlugin] isComponentRegistered('${o}') 返回:`, b), b === !0 || b && typeof b == "object" && (b.registered === !0 || b.isRegistered === !0))
|
|
107
611
|
return !0;
|
|
108
612
|
try {
|
|
109
|
-
const
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
112
|
-
console.log(`[withAsyncPlugin] 当前引擎核心版本: ${
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
if (
|
|
613
|
+
const P = await x.callNativeWithPromise("ExtendModule", "getCoreSDKInfo");
|
|
614
|
+
if (P && P.core_version) {
|
|
615
|
+
const A = P.core_version;
|
|
616
|
+
console.log(`[withAsyncPlugin] 当前引擎核心版本: ${A}`);
|
|
617
|
+
const h = A.split(".").map((I) => parseInt(I, 10));
|
|
618
|
+
if (h.length >= 3 && !isNaN(h[0]) && !isNaN(h[1]) && !isNaN(h[2]))
|
|
619
|
+
if (h[0] * 1e6 + h[1] * 1e3 + h[2] >= 1011205) {
|
|
116
620
|
console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${o}`);
|
|
117
|
-
const
|
|
118
|
-
console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${o}, ${
|
|
119
|
-
const [
|
|
120
|
-
|
|
121
|
-
|
|
621
|
+
const E = o.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join("");
|
|
622
|
+
console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${o}, ${E}`);
|
|
623
|
+
const [N, e] = await Promise.all([
|
|
624
|
+
x.callNativeWithPromise("ExtendModule", "isComponentRegistered", o).catch(() => !1),
|
|
625
|
+
x.callNativeWithPromise("ExtendModule", "isComponentRegistered", E).catch(() => !1)
|
|
122
626
|
]);
|
|
123
|
-
if (console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${
|
|
627
|
+
if (console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${N}, ${e}]`), N === !0 || e === !0)
|
|
124
628
|
return !0;
|
|
125
629
|
} else
|
|
126
|
-
console.log(`[withAsyncPlugin] 引擎版本 ${
|
|
630
|
+
console.log(`[withAsyncPlugin] 引擎版本 ${A} < 1.11.205,跳过 ExtendModule 检查`);
|
|
127
631
|
else
|
|
128
|
-
console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${
|
|
632
|
+
console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${A}`);
|
|
129
633
|
}
|
|
130
|
-
} catch (
|
|
131
|
-
console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",
|
|
634
|
+
} catch (P) {
|
|
635
|
+
console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:", P);
|
|
132
636
|
}
|
|
133
637
|
return !1;
|
|
134
|
-
} catch (
|
|
135
|
-
return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",
|
|
638
|
+
} catch (b) {
|
|
639
|
+
return console.warn("[withAsyncPlugin] 检查组件注册状态异常:", b), !1;
|
|
136
640
|
}
|
|
137
|
-
},
|
|
138
|
-
if (
|
|
139
|
-
|
|
641
|
+
}, O = async () => {
|
|
642
|
+
if (Ne.skipPluginCheck || v.skipPluginCheck) {
|
|
643
|
+
console.log(`[withAsyncPlugin] 跳过 ${o} 插件检查 (skipPluginCheck = true)`), m.value = "ready";
|
|
140
644
|
return;
|
|
141
645
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
l.value = "ready", T.add(t), console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");
|
|
646
|
+
if (!r) {
|
|
647
|
+
m.value = "ready";
|
|
145
648
|
return;
|
|
146
649
|
}
|
|
147
|
-
|
|
148
|
-
|
|
650
|
+
const b = await S();
|
|
651
|
+
if (console.log(`[withAsyncPlugin] 拦截检查 - ${o} 是否已注册:`, b), b || B.has(r)) {
|
|
652
|
+
m.value = "ready", B.add(r), console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");
|
|
149
653
|
return;
|
|
150
654
|
}
|
|
151
|
-
|
|
655
|
+
if (!T) {
|
|
656
|
+
console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${o}`), m.value = "ready";
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
console.log(`[withAsyncPlugin] 开始动态安装插件: ${r}`);
|
|
152
660
|
try {
|
|
153
|
-
await new Promise((
|
|
154
|
-
let
|
|
155
|
-
const
|
|
156
|
-
onPluginInstallSuccess(
|
|
157
|
-
|
|
661
|
+
await new Promise((P, A) => {
|
|
662
|
+
let h;
|
|
663
|
+
const I = {
|
|
664
|
+
onPluginInstallSuccess(E, N, e) {
|
|
665
|
+
E === r && (clearTimeout(h), T.removeListener(I), console.log(`[withAsyncPlugin] 安装成功 pkg=${E} 状态码=${N}`), N == 1003 || N == 1001 ? (c ? (console.log(`[withAsyncPlugin] 触发反射初始化: ${c}`), x.callNative("EsNativeModule", "callReflect", {
|
|
158
666
|
entry: {
|
|
159
|
-
from:
|
|
667
|
+
from: c,
|
|
160
668
|
method: "setup"
|
|
161
669
|
}
|
|
162
|
-
})) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),
|
|
670
|
+
})) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"), P()) : A(new Error(`安装失败 pkg=${E} status=${N} msg=${e}`)));
|
|
163
671
|
},
|
|
164
|
-
onPluginInstallError(
|
|
165
|
-
|
|
672
|
+
onPluginInstallError(E, N, e) {
|
|
673
|
+
E === r && (clearTimeout(h), T.removeListener(I), A(new Error(`安装失败 pkg=${E} status=${N} msg=${e}`)));
|
|
166
674
|
}
|
|
167
675
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}, 8e3), typeof
|
|
171
|
-
}), await
|
|
172
|
-
} catch (
|
|
173
|
-
console.error("[withAsyncPlugin] 插件加载失败:",
|
|
676
|
+
T.addListener({ pkg: r }, I), h = setTimeout(() => {
|
|
677
|
+
T.removeListener(I), A(new Error(`插件安装超时: ${r}`));
|
|
678
|
+
}, 8e3), typeof T.installPlugin == "function" ? T.installPlugin({ pkg: r }) : typeof T.install == "function" ? T.install(r) : A(new Error("当前运行时不支持 install / installPlugin"));
|
|
679
|
+
}), await ye(), B.add(r), m.value = "ready";
|
|
680
|
+
} catch (P) {
|
|
681
|
+
console.error("[withAsyncPlugin] 插件加载失败:", P), s.value = (P == null ? void 0 : P.message) || String(P), m.value = "error";
|
|
174
682
|
}
|
|
175
683
|
};
|
|
176
|
-
return
|
|
177
|
-
|
|
684
|
+
return be(() => {
|
|
685
|
+
O();
|
|
178
686
|
}), () => {
|
|
179
|
-
const
|
|
180
|
-
width: "100%",
|
|
181
|
-
height: "100%",
|
|
687
|
+
const b = {
|
|
182
688
|
display: "flex",
|
|
183
689
|
flexDirection: "column",
|
|
184
690
|
justifyContent: "center",
|
|
185
691
|
alignItems: "center",
|
|
186
|
-
...
|
|
187
|
-
};
|
|
188
|
-
if (
|
|
189
|
-
return
|
|
190
|
-
|
|
692
|
+
...y.style || {}
|
|
693
|
+
}, P = y.class ? `qt-plugin-container ${y.class}` : "qt-plugin-container";
|
|
694
|
+
if (m.value === "loading")
|
|
695
|
+
return G("div", { class: P, style: b }, [
|
|
696
|
+
G("div", { style: { color: "white", fontSize: "30px" } }, "插件加载中...")
|
|
191
697
|
]);
|
|
192
|
-
if (
|
|
193
|
-
return
|
|
194
|
-
|
|
698
|
+
if (m.value === "error")
|
|
699
|
+
return G("div", { class: P, style: b }, [
|
|
700
|
+
G("div", { style: { color: "white", fontSize: "30px", backgroundColor: "rgba(255,0,0,0.5)" } }, `插件加载失败: ${s.value}`)
|
|
195
701
|
]);
|
|
196
|
-
const
|
|
197
|
-
for (const [e,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
702
|
+
const A = {}, h = {};
|
|
703
|
+
for (const [e, t] of Object.entries(y))
|
|
704
|
+
if (!(e === "class" || e === "style"))
|
|
705
|
+
if (e.startsWith("on") && typeof t == "function") {
|
|
706
|
+
let n = e;
|
|
707
|
+
e.startsWith("onOn") && (n = "on" + e.slice(4)), h[n] = t;
|
|
708
|
+
} else if (e.startsWith("on") && Array.isArray(t)) {
|
|
709
|
+
let n = e;
|
|
710
|
+
e.startsWith("onOn") && (n = "on" + e.slice(4)), h[n] = t;
|
|
711
|
+
} else
|
|
712
|
+
e.startsWith("onOn") || (A[e] = t);
|
|
713
|
+
const I = {
|
|
714
|
+
...A,
|
|
715
|
+
...h,
|
|
716
|
+
ref: (e) => {
|
|
717
|
+
l.value = e;
|
|
208
718
|
},
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
},
|
|
214
|
-
onTabNeedsData: (e) => {
|
|
215
|
-
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onTabNeedsData:`, e);
|
|
216
|
-
const s = n.onOnTabNeedsData || n.onTabNeedsData;
|
|
217
|
-
typeof s == "function" && s(e);
|
|
218
|
-
},
|
|
219
|
-
onLoadMore: (e) => {
|
|
220
|
-
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onLoadMore:`, e);
|
|
221
|
-
const s = n.onOnLoadMore || n.onLoadMore;
|
|
222
|
-
typeof s == "function" && s(e);
|
|
223
|
-
},
|
|
224
|
-
onTabFocused: (e) => {
|
|
225
|
-
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onTabFocused:`, e);
|
|
226
|
-
const s = n.onOnTabFocused || n.onTabFocused;
|
|
227
|
-
typeof s == "function" && s(e);
|
|
228
|
-
},
|
|
229
|
-
onItemClick: (e) => {
|
|
230
|
-
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onItemClick:`, e);
|
|
231
|
-
const s = n.onOnItemClick || n.onItemClick;
|
|
232
|
-
typeof s == "function" && s(e);
|
|
233
|
-
},
|
|
234
|
-
onItemFocused: (e) => {
|
|
235
|
-
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onItemFocused:`, e);
|
|
236
|
-
const s = n.onOnItemFocused || n.onItemFocused;
|
|
237
|
-
typeof s == "function" && s(e);
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:", Object.keys(d)), h("div", { class: "qt-plugin-container", style: i }, [
|
|
241
|
-
h(o, d, c.default ? c.default() : [])
|
|
719
|
+
style: { width: "100%", height: "100%", backgroundColor: "transparent" }
|
|
720
|
+
}, E = I.tabsData || "", N = I.actionPayload || "";
|
|
721
|
+
return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:", Object.keys(I), "tabsData.length=", E.length, "actionPayload.length=", N.length), G("div", { class: P, style: b }, [
|
|
722
|
+
G(o, I, g.default ? g.default() : [])
|
|
242
723
|
]);
|
|
243
724
|
};
|
|
244
725
|
}
|
|
245
726
|
});
|
|
246
727
|
}
|
|
247
|
-
const
|
|
728
|
+
const ve = Symbol("AddonEnvContext"), ge = {
|
|
729
|
+
isPluginActive: !1,
|
|
730
|
+
nameSuffix: "",
|
|
731
|
+
pluginPackageName: "com.quicktvui.plugin.glintui",
|
|
732
|
+
builtInVersions: {}
|
|
733
|
+
};
|
|
734
|
+
async function xe(o = "com.quicktvui.plugin.glintui", r = "_Plugin") {
|
|
735
|
+
const c = de();
|
|
736
|
+
let v = {};
|
|
737
|
+
try {
|
|
738
|
+
const s = await x.callNativeModule("AddonEnvModule", "getBuiltInVersions", []);
|
|
739
|
+
s && typeof s == "object" && (v = s);
|
|
740
|
+
} catch (s) {
|
|
741
|
+
console.warn("[AddonProvider] Failed to fetch built-in versions from AddonEnvModule", s);
|
|
742
|
+
}
|
|
743
|
+
const g = `QtGridTabs${r}`, y = c.isComponentRegistered(g), a = y instanceof Promise ? await y : y, m = {
|
|
744
|
+
isPluginActive: a,
|
|
745
|
+
nameSuffix: a ? r : "",
|
|
746
|
+
// 如果使用了热更插件,包名加上 .ext 后缀(与 Gradle 打包脚本对齐)
|
|
747
|
+
pluginPackageName: a ? `${o}.ext` : o,
|
|
748
|
+
builtInVersions: v
|
|
749
|
+
};
|
|
750
|
+
return console.info("[AddonProvider] Environment initialized:", m), m;
|
|
751
|
+
}
|
|
752
|
+
let Y = w(ge);
|
|
753
|
+
function Ge(o) {
|
|
754
|
+
Y.value = o, pe(ve, Y);
|
|
755
|
+
}
|
|
756
|
+
function K() {
|
|
757
|
+
var o;
|
|
758
|
+
return ((o = Pe(ve, Y)) == null ? void 0 : o.value) || ge;
|
|
759
|
+
}
|
|
760
|
+
const Se = {
|
|
248
761
|
install: (o) => {
|
|
249
|
-
o.use(
|
|
762
|
+
o.use(he), o.use(Ae), o.use(Ie), o.use(Ee);
|
|
250
763
|
}
|
|
251
764
|
};
|
|
252
765
|
export {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
766
|
+
ve as ADDON_ENV_CONTEXT_KEY,
|
|
767
|
+
j as GridTabs,
|
|
768
|
+
he as GridTabsPlugin,
|
|
769
|
+
ne as Keyboard,
|
|
770
|
+
Ae as KeyboardPlugin,
|
|
771
|
+
ie as PortalItem,
|
|
772
|
+
Ee as PortalItemPlugin,
|
|
773
|
+
se as PortalPool,
|
|
774
|
+
Ie as PortalPoolPlugin,
|
|
775
|
+
Se as QuickTVUINAddons,
|
|
776
|
+
Ne as QuickTVUINAddonsConfig,
|
|
777
|
+
Se as default,
|
|
778
|
+
xe as initAddonEnv,
|
|
779
|
+
Ge as provideAddonEnv,
|
|
780
|
+
K as useAddonEnv,
|
|
781
|
+
_e as useGridTabs,
|
|
782
|
+
L as withAsyncPlugin
|
|
259
783
|
};
|