@quicktvui/naddons 1.0.0-beta.1 → 1.0.0-rc.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.
- package/dist/components/GridTabs/GridTabs.vue.d.ts +2 -59
- package/dist/components/GridTabs/useGridTabs.d.ts +8 -1
- package/dist/components/Keyboard/Keyboard.vue.d.ts +2 -4
- package/dist/core/AddonProvider.d.ts +7 -0
- package/dist/naddons.cjs.js +1 -1
- package/dist/naddons.es.js +633 -527
- package/package.json +1 -1
package/dist/naddons.es.js
CHANGED
|
@@ -1,58 +1,28 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Native as
|
|
3
|
-
import { useES as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as L, ref as G, openBlock as B, createBlock as Q, unref as K, mergeProps as j, withCtx as V, renderSlot as W, shallowRef as oe, watch as se, computed as Ie, onMounted as Ae, h as U, nextTick as Ee, provide as Ne, inject as _e } from "vue";
|
|
2
|
+
import { Native as x } from "@extscreen/es3-vue";
|
|
3
|
+
import { useES as me, useESPlugin as ke } from "@extscreen/es3-core";
|
|
4
|
+
const ae = "QtGridTabs", J = /* @__PURE__ */ L({
|
|
5
5
|
__name: "GridTabs",
|
|
6
|
-
props: {
|
|
7
|
-
protocolVersion: {},
|
|
8
|
-
tabsData: {},
|
|
9
|
-
actionPayload: {},
|
|
10
|
-
hsvHue: { default: -2 }
|
|
11
|
-
},
|
|
12
|
-
emits: ["onTabSelected", "onTabNeedsData", "onLoadMore", "onItemPresence", "onTabFocused", "onItemClick", "onItemFocused", "onProtocolMismatch", "onScroll", "onScrollStateChanged"],
|
|
13
6
|
setup(o, { expose: s }) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const v = G(), p = Z(), f = ae + "_Plugin", r = (p.isPluginActive ? f : ae).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, ""), y = z(
|
|
8
|
+
r,
|
|
9
|
+
p.pluginPackageName || "com.quicktvui.plugin.glintui",
|
|
10
|
+
"com.quicktvui.plugin.glintui.GlintPluginApp"
|
|
17
11
|
);
|
|
18
12
|
return s({
|
|
19
13
|
getNativeNode: () => {
|
|
20
|
-
var i,
|
|
21
|
-
return ((
|
|
22
|
-
},
|
|
23
|
-
dispatchAction: (...i) => {
|
|
24
|
-
var l, P;
|
|
25
|
-
const a = ((P = (l = d.value) == null ? void 0 : l.getNativeNode) == null ? void 0 : P.call(l)) || d.value;
|
|
26
|
-
a && G.callUIFunction(a, "dispatchAction", i);
|
|
27
|
-
},
|
|
28
|
-
scrollToTop: (...i) => {
|
|
29
|
-
var l, P;
|
|
30
|
-
const a = ((P = (l = d.value) == null ? void 0 : l.getNativeNode) == null ? void 0 : P.call(l)) || d.value;
|
|
31
|
-
a && G.callUIFunction(a, "scrollToTop", i);
|
|
14
|
+
var i, d;
|
|
15
|
+
return ((d = (i = v.value) == null ? void 0 : i.getNativeNode) == null ? void 0 : d.call(i)) || v.value;
|
|
32
16
|
}
|
|
33
|
-
}), (i,
|
|
17
|
+
}), (i, d) => (B(), Q(K(y), j({
|
|
34
18
|
ref_key: "nativeRef",
|
|
35
|
-
ref:
|
|
36
|
-
protocolVersion: o.protocolVersion,
|
|
37
|
-
tabsData: o.tabsData,
|
|
38
|
-
actionPayload: o.actionPayload,
|
|
39
|
-
hsvHue: o.hsvHue,
|
|
40
|
-
onOnTabSelected: a[0] || (a[0] = (l) => i.$emit("onTabSelected", l.nativeEvent)),
|
|
41
|
-
onOnTabNeedsData: a[1] || (a[1] = (l) => i.$emit("onTabNeedsData", l.nativeEvent)),
|
|
42
|
-
onOnLoadMore: a[2] || (a[2] = (l) => i.$emit("onLoadMore", l.nativeEvent)),
|
|
43
|
-
onOnItemPresence: a[3] || (a[3] = (l) => i.$emit("onItemPresence", l.nativeEvent)),
|
|
44
|
-
onOnTabFocused: a[4] || (a[4] = (l) => i.$emit("onTabFocused", l.nativeEvent)),
|
|
45
|
-
onOnItemClick: a[5] || (a[5] = (l) => i.$emit("onItemClick", l.nativeEvent)),
|
|
46
|
-
onOnItemFocused: a[6] || (a[6] = (l) => i.$emit("onItemFocused", l.nativeEvent)),
|
|
47
|
-
onOnProtocolMismatch: a[7] || (a[7] = (l) => i.$emit("onProtocolMismatch", l.nativeEvent)),
|
|
48
|
-
onOnScroll: a[8] || (a[8] = (l) => i.$emit("onScroll", l.nativeEvent)),
|
|
49
|
-
onOnScrollStateChanged: a[9] || (a[9] = (l) => i.$emit("onScrollStateChanged", l.nativeEvent))
|
|
19
|
+
ref: v
|
|
50
20
|
}, i.$attrs), {
|
|
51
|
-
default:
|
|
52
|
-
|
|
21
|
+
default: V(() => [
|
|
22
|
+
W(i.$slots, "default")
|
|
53
23
|
]),
|
|
54
24
|
_: 3
|
|
55
|
-
}, 16
|
|
25
|
+
}, 16));
|
|
56
26
|
}
|
|
57
27
|
});
|
|
58
28
|
let Y;
|
|
@@ -62,17 +32,17 @@ try {
|
|
|
62
32
|
Y = o.registerElement || ((ge = o.default) == null ? void 0 : ge.registerElement);
|
|
63
33
|
} catch {
|
|
64
34
|
}
|
|
65
|
-
const
|
|
35
|
+
const we = {
|
|
66
36
|
install: (o) => {
|
|
67
37
|
if (!globalThis.__QtGridTabs_registered)
|
|
68
38
|
if (Y) {
|
|
69
|
-
const s = (
|
|
70
|
-
Y(
|
|
39
|
+
const s = (v, p) => {
|
|
40
|
+
Y(v, {
|
|
71
41
|
component: {
|
|
72
|
-
name:
|
|
73
|
-
processEventData(
|
|
74
|
-
const
|
|
75
|
-
return
|
|
42
|
+
name: p ? "QtGridTabs_Plugin" : "QtGridTabs",
|
|
43
|
+
processEventData(f, b) {
|
|
44
|
+
const r = f.handler || f, y = b || (r == null ? void 0 : r.nativeParams) || {};
|
|
45
|
+
return r && (r.nativeEvent = y), r;
|
|
76
46
|
}
|
|
77
47
|
}
|
|
78
48
|
});
|
|
@@ -80,44 +50,44 @@ const ke = {
|
|
|
80
50
|
s("qt-grid-tabs", !1), s("qt-grid-tabs-plugin", !0), s("QtGridTabs", !1), s("QtGridTabs_Plugin", !0), s("gt-tabs", !1), s("gt-tabs-plugin", !0), globalThis.__QtGridTabs_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtGridTabs");
|
|
81
51
|
} else
|
|
82
52
|
console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");
|
|
83
|
-
o.component("GridTabs",
|
|
53
|
+
o.component("GridTabs", J), o.component("qt-grid-tabs", J), o.component("gt-tabs", J);
|
|
84
54
|
}
|
|
85
55
|
};
|
|
86
|
-
function
|
|
87
|
-
const
|
|
88
|
-
let
|
|
89
|
-
const
|
|
90
|
-
let i = "";
|
|
91
|
-
const
|
|
92
|
-
const e = Array.isArray(
|
|
93
|
-
if (
|
|
56
|
+
function Ke(o, s) {
|
|
57
|
+
const v = G(""), p = oe([]), f = oe([]);
|
|
58
|
+
let b = !1, r = !1;
|
|
59
|
+
const y = "__virtual_single_tab__";
|
|
60
|
+
let i = "", d = !1;
|
|
61
|
+
const g = G({}), T = (n) => {
|
|
62
|
+
const e = Array.isArray(n) ? n : [n];
|
|
63
|
+
if (r && o.value) {
|
|
94
64
|
if (typeof o.value.dispatchAction == "function") {
|
|
95
|
-
console.log("[useGridTabs] Calling Wrapper dispatchAction directly"), o.value.dispatchAction(
|
|
65
|
+
console.log("[useGridTabs] Calling Wrapper dispatchAction directly"), o.value.dispatchAction(e);
|
|
96
66
|
return;
|
|
97
67
|
}
|
|
98
|
-
let
|
|
99
|
-
typeof o.value.getNativeNode == "function" ?
|
|
68
|
+
let t = o.value;
|
|
69
|
+
typeof o.value.getNativeNode == "function" ? t = o.value.getNativeNode() || o.value : o.value.nativeRef && (t = o.value.nativeRef), t ? (console.log("[useGridTabs] Calling Native callUIFunction dispatchAction fallback"), x.callUIFunction(t, "dispatchAction", [JSON.stringify(e)])) : console.warn("[useGridTabs] Native target is null or undefined, cannot call dispatchAction");
|
|
100
70
|
}
|
|
101
|
-
},
|
|
102
|
-
if (!
|
|
71
|
+
}, F = (n, e) => {
|
|
72
|
+
if (!n)
|
|
103
73
|
return !1;
|
|
104
|
-
let
|
|
105
|
-
return
|
|
106
|
-
},
|
|
107
|
-
if (!
|
|
74
|
+
let t = !0;
|
|
75
|
+
return n.id || (console.error(`[useGridTabs] ❌ 数据格式错误 (${e}): 卡片缺失必填字段 'id'。每个卡片必须有唯一标识才能进行后续更新!`, n), t = !1), n.viewType || (console.error(`[useGridTabs] ❌ 数据格式错误 (${e}): 卡片缺失必填字段 'viewType' (id: ${n.id || "未知"})。必须指定 Native 注册的视图类型或 Portal 标识!`, n), t = !1), t;
|
|
76
|
+
}, R = (n, e) => {
|
|
77
|
+
if (!n)
|
|
108
78
|
return !1;
|
|
109
|
-
let
|
|
110
|
-
return
|
|
111
|
-
},
|
|
112
|
-
if (!
|
|
79
|
+
let t = !0;
|
|
80
|
+
return n.tabId || (console.error(`[useGridTabs] ❌ 数据格式错误 (${e}): Tab 缺失必填字段 'tabId'。每个 Tab 必须有唯一标识!`, n), t = !1), (n.title === void 0 || n.title === null) && console.warn(`[useGridTabs] ⚠️ 数据格式警告 (${e}): Tab 缺失 'title' 字段 (tabId: ${n.tabId || "未知"}),导航栏可能显示为空。`, n), t;
|
|
81
|
+
}, k = (n, e) => {
|
|
82
|
+
if (!n || n.length === 0)
|
|
113
83
|
return;
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}),
|
|
119
|
-
},
|
|
120
|
-
if (!
|
|
84
|
+
O.clear();
|
|
85
|
+
const t = n[0].hasOwnProperty("tabId") || n[0].hasOwnProperty("items") && Array.isArray(n[0].items);
|
|
86
|
+
b = e === "1d", e === "1d" && t ? console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `items.value` (一维瀑布流) 赋值二维 Tabs 数据结构!请改用 `tabs.value = ...`") : e === "2d" && !t && console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `tabs.value` (二维导航) 赋值一维卡片列表数据结构!请改用 `items.value = ...`"), e === "1d" ? n.forEach((a, l) => F(a, `items.value[${l}]`)) : n.forEach((a, l) => {
|
|
87
|
+
R(a, `tabs.value[${l}]`), a.items && Array.isArray(a.items) && a.items.forEach((u, c) => F(u, `tabs.value[${l}].items[${c}]`));
|
|
88
|
+
}), r = !0, M();
|
|
89
|
+
}, O = /* @__PURE__ */ new Set(), M = (n = "unknown") => {
|
|
90
|
+
if (!r) {
|
|
121
91
|
console.warn("[useGridTabs] triggerRootUpdate skipped because isInitialized is false");
|
|
122
92
|
return;
|
|
123
93
|
}
|
|
@@ -160,338 +130,478 @@ function Me(o, s) {
|
|
|
160
130
|
},
|
|
161
131
|
themeConfig: s == null ? void 0 : s.themeConfig,
|
|
162
132
|
referenceResolution: (s == null ? void 0 : s.referenceResolution) ?? { w: 1920, h: 1080 }
|
|
163
|
-
},
|
|
164
|
-
|
|
133
|
+
}, t = [];
|
|
134
|
+
b ? (e.navConfig = { ...e.navConfig, renderType: "none" }, t = [
|
|
165
135
|
{
|
|
166
|
-
tabId:
|
|
136
|
+
tabId: y,
|
|
167
137
|
title: "Virtual Tab",
|
|
168
138
|
hidden: !0,
|
|
169
|
-
items:
|
|
139
|
+
items: f.value
|
|
170
140
|
}
|
|
171
|
-
]) :
|
|
172
|
-
const
|
|
141
|
+
]) : t = p.value;
|
|
142
|
+
const a = JSON.stringify({
|
|
173
143
|
page_spec: e,
|
|
174
|
-
tabs:
|
|
144
|
+
tabs: t
|
|
175
145
|
});
|
|
176
|
-
if (
|
|
177
|
-
console.log(`[useGridTabs] triggerRootUpdate: Initializing tabsDataStr (length=${
|
|
146
|
+
if (v.value === "")
|
|
147
|
+
console.log(`[useGridTabs] triggerRootUpdate: Initializing tabsDataStr (length=${a.length})`), v.value = a, i = a;
|
|
178
148
|
else {
|
|
179
|
-
if (i ===
|
|
149
|
+
if (i === a) {
|
|
180
150
|
console.log("[useGridTabs] triggerRootUpdate: Data unchanged, skipping RELOAD_TABS");
|
|
181
151
|
return;
|
|
182
152
|
}
|
|
183
|
-
console.log(`[useGridTabs] triggerRootUpdate: Sending RELOAD_TABS action directly to Native (length=${
|
|
153
|
+
console.log(`[useGridTabs] triggerRootUpdate: Sending RELOAD_TABS action directly to Native (length=${a.length})`), v.value = a, i = a, T({
|
|
184
154
|
op: "RELOAD_TABS",
|
|
185
155
|
payload: {
|
|
186
156
|
pageSpec: e,
|
|
187
157
|
// 兼容不同的 Gson alias
|
|
188
158
|
page_spec: e,
|
|
189
|
-
tabs:
|
|
159
|
+
tabs: t
|
|
190
160
|
}
|
|
191
161
|
});
|
|
192
162
|
}
|
|
193
|
-
},
|
|
194
|
-
if (!
|
|
195
|
-
return
|
|
196
|
-
|
|
197
|
-
set(
|
|
198
|
-
const
|
|
199
|
-
return
|
|
200
|
-
op: "UPDATE_ITEM",
|
|
201
|
-
itemId: t.id,
|
|
202
|
-
payload: t
|
|
203
|
-
}), g;
|
|
204
|
-
}
|
|
205
|
-
}), Object.defineProperty(t.content, "__isGridTabsProxy", { value: !0, enumerable: !1 }), Object.defineProperty(t.content, "__v_skip", { value: !0, enumerable: !1 })), t.subItems && Array.isArray(t.subItems) && !t.subItems.__isGridTabsProxy && (t.subItems = p(t.subItems, t.id), Object.defineProperty(t.subItems, "__isGridTabsProxy", { value: !0, enumerable: !1 }), Object.defineProperty(t.subItems, "__v_skip", { value: !0, enumerable: !1 }));
|
|
206
|
-
const e = new Proxy(t, {
|
|
207
|
-
set(n, r, u, f) {
|
|
208
|
-
const g = Reflect.set(n, r, u, f);
|
|
209
|
-
return n.id && c && l({
|
|
163
|
+
}, m = (n) => {
|
|
164
|
+
if (!n || typeof n != "object" || n.__isGridTabsProxy)
|
|
165
|
+
return n;
|
|
166
|
+
n.content && typeof n.content == "object" && !n.content.__isGridTabsProxy && (n.content = new Proxy(n.content, {
|
|
167
|
+
set(t, a, l, u) {
|
|
168
|
+
const c = Reflect.set(t, a, l, u);
|
|
169
|
+
return n.id && r && T({
|
|
210
170
|
op: "UPDATE_ITEM",
|
|
211
171
|
itemId: n.id,
|
|
212
172
|
payload: n
|
|
213
|
-
}),
|
|
173
|
+
}), c;
|
|
174
|
+
}
|
|
175
|
+
}), Object.defineProperty(n.content, "__isGridTabsProxy", { value: !0, enumerable: !1 }), Object.defineProperty(n.content, "__v_skip", { value: !0, enumerable: !1 })), n.subItems && Array.isArray(n.subItems) && !n.subItems.__isGridTabsProxy && (n.subItems = P(n.subItems, n.id), Object.defineProperty(n.subItems, "__isGridTabsProxy", { value: !0, enumerable: !1 }), Object.defineProperty(n.subItems, "__v_skip", { value: !0, enumerable: !1 }));
|
|
176
|
+
const e = new Proxy(n, {
|
|
177
|
+
set(t, a, l, u) {
|
|
178
|
+
const c = Reflect.set(t, a, l, u);
|
|
179
|
+
return t.id && r && !d && T({
|
|
180
|
+
op: "UPDATE_ITEM",
|
|
181
|
+
itemId: t.id,
|
|
182
|
+
payload: t
|
|
183
|
+
}), c;
|
|
214
184
|
}
|
|
215
185
|
});
|
|
216
186
|
return Object.defineProperty(e, "__isGridTabsProxy", { value: !0, enumerable: !1 }), Object.defineProperty(e, "__v_skip", { value: !0, enumerable: !1 }), e;
|
|
217
|
-
},
|
|
218
|
-
for (let
|
|
219
|
-
t
|
|
220
|
-
return new Proxy(
|
|
221
|
-
get(
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
return
|
|
187
|
+
}, P = (n, e) => {
|
|
188
|
+
for (let t = 0; t < n.length; t++)
|
|
189
|
+
n[t] = m(n[t]);
|
|
190
|
+
return new Proxy(n, {
|
|
191
|
+
get(t, a, l) {
|
|
192
|
+
return a === "push" ? (...u) => {
|
|
193
|
+
u.forEach((S, q) => F(S, `push(${q})`)), r || console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");
|
|
194
|
+
const c = u.map((S) => m(S)), h = Array.prototype.push.apply(t, c);
|
|
195
|
+
return d || T({
|
|
226
196
|
op: "APPEND_SUB_ITEMS",
|
|
227
197
|
itemId: e,
|
|
228
|
-
payload: { subItems:
|
|
229
|
-
}),
|
|
230
|
-
} :
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
198
|
+
payload: { subItems: c }
|
|
199
|
+
}), h;
|
|
200
|
+
} : a === "unshift" ? (...u) => {
|
|
201
|
+
u.forEach((S, q) => F(S, `unshift(${q})`)), r || console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 unshift()。请先对 items.value 或 tabs.value 进行全量赋值!");
|
|
202
|
+
const c = u.map((S) => m(S)), h = Array.prototype.unshift.apply(t, c);
|
|
203
|
+
return r && c.length > 0 && !d && T({
|
|
204
|
+
op: "PREPEND_SUB_ITEMS",
|
|
235
205
|
itemId: e,
|
|
236
|
-
payload: {
|
|
237
|
-
})
|
|
238
|
-
} :
|
|
206
|
+
payload: { subItems: c }
|
|
207
|
+
}), h;
|
|
208
|
+
} : a === "splice" ? (...u) => {
|
|
209
|
+
const c = u.length >= 2 && u[0] === 0 && u[1] === t.length, h = Array.prototype.splice.apply(t, u);
|
|
210
|
+
return r && c && e !== y ? d || T({
|
|
211
|
+
op: "CLEAR_SUB_ITEMS",
|
|
212
|
+
itemId: e
|
|
213
|
+
}) : r && (d || M("items array spliced")), h;
|
|
214
|
+
} : Reflect.get(t, a, l);
|
|
239
215
|
},
|
|
240
|
-
set(
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
return
|
|
216
|
+
set(t, a, l, u) {
|
|
217
|
+
if (a !== "length" && !isNaN(Number(a))) {
|
|
218
|
+
r || console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(a)}]。请先对 items.value 或 tabs.value 进行全量赋值!`), F(l, `索引赋值 [${String(a)}]`);
|
|
219
|
+
const c = m(l), h = Reflect.set(t, a, c, u);
|
|
220
|
+
return c && c.id && !d && T({
|
|
245
221
|
op: "UPDATE_ITEM",
|
|
246
|
-
itemId:
|
|
247
|
-
payload:
|
|
248
|
-
}),
|
|
222
|
+
itemId: c.id,
|
|
223
|
+
payload: c
|
|
224
|
+
}), h;
|
|
249
225
|
}
|
|
250
|
-
return Reflect.set(
|
|
226
|
+
return Reflect.set(t, a, l, u);
|
|
251
227
|
}
|
|
252
228
|
});
|
|
253
|
-
},
|
|
254
|
-
set(e,
|
|
255
|
-
if (
|
|
256
|
-
let
|
|
257
|
-
return Array.isArray(
|
|
258
|
-
} else if (
|
|
259
|
-
const
|
|
260
|
-
return
|
|
229
|
+
}, _ = (n) => (n.items && Array.isArray(n.items) && !n.items.__isGridTabsProxy && (n.items = P(n.items, n.tabId), Object.defineProperty(n.items, "__isGridTabsProxy", { value: !0, enumerable: !1 })), new Proxy(n, {
|
|
230
|
+
set(e, t, a, l) {
|
|
231
|
+
if (t === "items") {
|
|
232
|
+
let c = a;
|
|
233
|
+
return Array.isArray(a) && !a.__isGridTabsProxy && (c = P(a, e.tabId), Object.defineProperty(c, "__isGridTabsProxy", { value: !0, enumerable: !1 })), Reflect.set(e, t, c, l);
|
|
234
|
+
} else if (t === "loadState") {
|
|
235
|
+
const c = Reflect.set(e, t, a, l);
|
|
236
|
+
return r && e.tabId && !d && T({
|
|
261
237
|
op: "UPDATE_TAB_STATE",
|
|
262
238
|
itemId: e.tabId,
|
|
263
|
-
payload: { loadState:
|
|
264
|
-
}),
|
|
239
|
+
payload: { loadState: a }
|
|
240
|
+
}), c;
|
|
265
241
|
}
|
|
266
|
-
return Reflect.set(e,
|
|
242
|
+
return Reflect.set(e, t, a, l);
|
|
267
243
|
}
|
|
268
|
-
})),
|
|
269
|
-
const e =
|
|
244
|
+
})), E = (n) => {
|
|
245
|
+
const e = n.map((t) => _(t));
|
|
270
246
|
return new Proxy(e, {
|
|
271
|
-
set(
|
|
272
|
-
if (
|
|
273
|
-
let
|
|
274
|
-
|
|
275
|
-
const
|
|
276
|
-
return
|
|
247
|
+
set(t, a, l, u) {
|
|
248
|
+
if (a !== "length" && !isNaN(Number(a))) {
|
|
249
|
+
let c = l;
|
|
250
|
+
l.__isGridTabsProxy || (c = _(l), Object.defineProperty(c, "__isGridTabsProxy", { value: !0, enumerable: !1 }));
|
|
251
|
+
const h = Reflect.set(t, a, c, u);
|
|
252
|
+
return M(), h;
|
|
277
253
|
}
|
|
278
|
-
return Reflect.set(
|
|
254
|
+
return Reflect.set(t, a, l, u);
|
|
279
255
|
}
|
|
280
256
|
});
|
|
281
257
|
};
|
|
282
|
-
|
|
283
|
-
if (console.log("[useGridTabs] watch(tabs) triggered:", { newTabs:
|
|
284
|
-
|
|
258
|
+
se(p, (n, e) => {
|
|
259
|
+
if (console.log("[useGridTabs] watch(tabs) triggered:", { newTabs: n, isInitialized: r }), !n || n.length === 0) {
|
|
260
|
+
v.value = "", i = "", r = !1;
|
|
285
261
|
return;
|
|
286
262
|
}
|
|
287
|
-
if (
|
|
288
|
-
console.log("[useGridTabs] newTabs is ALREADY a proxy, triggering root update"),
|
|
263
|
+
if (n.__isGridTabsProxy)
|
|
264
|
+
console.log("[useGridTabs] newTabs is ALREADY a proxy, triggering root update"), M();
|
|
289
265
|
else {
|
|
290
266
|
console.log("[useGridTabs] newTabs is NOT a proxy, performing full deduceModeAndInitialize & wrapping");
|
|
291
|
-
const
|
|
292
|
-
Object.defineProperty(
|
|
267
|
+
const t = E(n);
|
|
268
|
+
Object.defineProperty(t, "__isGridTabsProxy", { value: !0, enumerable: !1 }), k(t, "2d"), p.value = t;
|
|
293
269
|
}
|
|
294
|
-
}, { flush: "sync", deep: !1 }),
|
|
295
|
-
if (console.log("[useGridTabs] watch(items) triggered:", { newItems:
|
|
296
|
-
|
|
270
|
+
}, { flush: "sync", deep: !1 }), se(f, (n, e) => {
|
|
271
|
+
if (console.log("[useGridTabs] watch(items) triggered:", { newItems: n, isInitialized: r }), !n || n.length === 0) {
|
|
272
|
+
v.value = "", i = "", r = !1;
|
|
297
273
|
return;
|
|
298
274
|
}
|
|
299
|
-
if (
|
|
300
|
-
console.log("[useGridTabs] newItems is ALREADY a proxy, triggering root update"),
|
|
275
|
+
if (n.__isGridTabsProxy)
|
|
276
|
+
console.log("[useGridTabs] newItems is ALREADY a proxy, triggering root update"), M();
|
|
301
277
|
else {
|
|
302
278
|
console.log("[useGridTabs] newItems is NOT a proxy, performing full deduceModeAndInitialize & wrapping");
|
|
303
|
-
const
|
|
304
|
-
Object.defineProperty(
|
|
279
|
+
const t = P(n, y);
|
|
280
|
+
Object.defineProperty(t, "__isGridTabsProxy", { value: !0, enumerable: !1 }), k(t, "1d"), f.value = t;
|
|
305
281
|
}
|
|
306
282
|
}, { flush: "sync", deep: !1 });
|
|
307
|
-
const
|
|
308
|
-
console.log("[useGridTabs] resetInitialization called manually"),
|
|
309
|
-
for (const
|
|
310
|
-
delete
|
|
311
|
-
},
|
|
312
|
-
if (!
|
|
313
|
-
|
|
283
|
+
const I = {}, N = () => {
|
|
284
|
+
console.log("[useGridTabs] resetInitialization called manually"), r = !1, O.clear();
|
|
285
|
+
for (const n in I)
|
|
286
|
+
delete I[n];
|
|
287
|
+
}, w = (n) => {
|
|
288
|
+
if (!n || n.length === 0) {
|
|
289
|
+
v.value = "", r = !1;
|
|
314
290
|
return;
|
|
315
291
|
}
|
|
316
|
-
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
tabsData:
|
|
292
|
+
n[0].hasOwnProperty("tabId") || n[0].hasOwnProperty("items") && Array.isArray(n[0].items) ? p.value = n : f.value = n;
|
|
293
|
+
}, $ = (n) => {
|
|
294
|
+
g.value = n;
|
|
295
|
+
}, A = Ie(() => ({
|
|
296
|
+
tabsData: v.value,
|
|
321
297
|
// 不再绑定 actionPayload 属性,完全走命令式 API,防止触发无意义的 Vue 节点更新
|
|
322
|
-
onTabNeedsData: async (...
|
|
323
|
-
let e =
|
|
324
|
-
if (e && e.nativeEvent && (e = e.nativeEvent), !
|
|
298
|
+
onTabNeedsData: async (...n) => {
|
|
299
|
+
let e = n[0];
|
|
300
|
+
if (e && e.nativeEvent && (e = e.nativeEvent), !g.value.onTabNeedsData)
|
|
325
301
|
return;
|
|
326
|
-
const { tabId:
|
|
327
|
-
if (
|
|
328
|
-
console.log(`[useGridTabs] onTabNeedsData SKIP: tabId=${
|
|
302
|
+
const { tabId: t, index: a, reason: l } = e;
|
|
303
|
+
if (O.has(t)) {
|
|
304
|
+
console.log(`[useGridTabs] onTabNeedsData SKIP: tabId=${t} 已经发起过请求,防止死循环`);
|
|
329
305
|
return;
|
|
330
306
|
}
|
|
331
|
-
|
|
307
|
+
O.add(t);
|
|
332
308
|
try {
|
|
333
|
-
const
|
|
334
|
-
if (
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
|
|
309
|
+
const u = await g.value.onTabNeedsData(t, a, l);
|
|
310
|
+
if (u && Array.isArray(u))
|
|
311
|
+
if (I[t] = 1, u.length > 0) {
|
|
312
|
+
const c = p.value.find((h) => h.tabId === t);
|
|
313
|
+
c && (c.items ? c.items.length > 0 && c.items.splice(0, c.items.length) : c.items = [], c.items.push(...u), c.loadState = "ready", T({
|
|
338
314
|
op: "UPDATE_TAB_STATE",
|
|
339
|
-
itemId:
|
|
315
|
+
itemId: t,
|
|
340
316
|
payload: { loadState: "ready" }
|
|
341
317
|
}));
|
|
342
318
|
} else
|
|
343
|
-
console.warn(`[useGridTabs] ⚠️ 警告: onTabNeedsData(tabId="${
|
|
344
|
-
} catch (
|
|
345
|
-
console.error("[useGridTabs] onTabNeedsData 执行失败:",
|
|
319
|
+
console.warn(`[useGridTabs] ⚠️ 警告: onTabNeedsData(tabId="${t}") 返回了空数组 []!`), console.warn("👉 如果你已经在此函数内手动调用了 push() 来追加数据,请在最后 return null 或 undefined。"), console.warn("👉 如果该 Tab 确实没有数据,返回 [] 可能会导致底层的 Header 等已有元素被清空,请注意检查。"), console.warn("👉 框架已为您拦截此次空数组覆盖,保留了当前的 DOM 结构。");
|
|
320
|
+
} catch (u) {
|
|
321
|
+
console.error("[useGridTabs] onTabNeedsData 执行失败:", u), O.delete(t);
|
|
346
322
|
}
|
|
347
323
|
},
|
|
348
|
-
onLoadMore: async (...
|
|
349
|
-
let e =
|
|
350
|
-
if (e && e.nativeEvent && (e = e.nativeEvent), !
|
|
324
|
+
onLoadMore: async (...n) => {
|
|
325
|
+
let e = n[0];
|
|
326
|
+
if (e && e.nativeEvent && (e = e.nativeEvent), !g.value.onLoadMore)
|
|
351
327
|
return;
|
|
352
|
-
const { tabId:
|
|
353
|
-
console.log(`[useGridTabs] 拦截到底层 onLoadMore,强行接管页码: tabId=${
|
|
328
|
+
const { tabId: t, itemId: a } = e, u = (I[t] || 1) + 1;
|
|
329
|
+
console.log(`[useGridTabs] 拦截到底层 onLoadMore,强行接管页码: tabId=${t}, pageNo=${u}`);
|
|
354
330
|
try {
|
|
355
|
-
const
|
|
356
|
-
if (
|
|
357
|
-
if (
|
|
358
|
-
if (
|
|
359
|
-
|
|
331
|
+
const c = await g.value.onLoadMore(t, u, a);
|
|
332
|
+
if (c && Array.isArray(c))
|
|
333
|
+
if (c.length > 0)
|
|
334
|
+
if (I[t] = u, b)
|
|
335
|
+
f.value.push(...c);
|
|
360
336
|
else {
|
|
361
|
-
const
|
|
362
|
-
|
|
337
|
+
const h = p.value.find((S) => S.tabId === t);
|
|
338
|
+
h && h.items && h.items.push(...c);
|
|
363
339
|
}
|
|
364
340
|
else
|
|
365
|
-
console.warn(`[useGridTabs] ⚠️ 警告: onLoadMore(tabId="${
|
|
366
|
-
} catch (
|
|
367
|
-
console.error("[useGridTabs] onLoadMore 业务层请求失败:",
|
|
341
|
+
console.warn(`[useGridTabs] ⚠️ 警告: onLoadMore(tabId="${t}", pageNo="${u}") 返回了空数组 []!`), console.warn('👉 如果这是你的最后一页数据,推荐在卡片列表中追加一个 type="no_more" 的 footer 卡片,而不是仅仅返回空。'), console.warn("👉 框架已忽略本次空数据追加,且不会自增页码。");
|
|
342
|
+
} catch (c) {
|
|
343
|
+
console.error("[useGridTabs] onLoadMore 业务层请求失败:", c);
|
|
368
344
|
}
|
|
369
345
|
},
|
|
370
|
-
onItemPresence: (...
|
|
371
|
-
let e =
|
|
372
|
-
if (console.log("[useGridTabs] ⚡️ bindings caught onItemPresence:", e),
|
|
346
|
+
onItemPresence: (...n) => {
|
|
347
|
+
let e = n[0];
|
|
348
|
+
if (console.log("[useGridTabs] ⚡️ bindings caught onItemPresence:", e), g.value.onItemPresence)
|
|
373
349
|
try {
|
|
374
|
-
let
|
|
375
|
-
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}) :
|
|
380
|
-
} catch (
|
|
381
|
-
console.error("[useGridTabs] Failed to parse onItemPresence event payload:",
|
|
350
|
+
let t = typeof e == "string" ? e : (e == null ? void 0 : e.nativeEvent) || e;
|
|
351
|
+
t && typeof t.data == "string" && (t = t.data);
|
|
352
|
+
const a = typeof t == "string" ? JSON.parse(t) : t;
|
|
353
|
+
a && a.type === "VIEW_PRESENCE_BATCH" && Array.isArray(a.payload) ? a.payload.forEach((l) => {
|
|
354
|
+
l.itemId && typeof l.itemId == "string" && l.itemId.startsWith("fallback_pos_") && console.warn(`[useGridTabs] ⚠️ 警告:检测到列表项曝光 (index=${l.index}),但未配置 itemId。请检查传入的 items 数组,务必为每个数据项指定唯一的 itemId,否则底层无法准确进行去重与曝光上报。`), g.value.onItemPresence(l);
|
|
355
|
+
}) : g.value.onItemPresence(a);
|
|
356
|
+
} catch (t) {
|
|
357
|
+
console.error("[useGridTabs] Failed to parse onItemPresence event payload:", t), g.value.onItemPresence(e);
|
|
382
358
|
}
|
|
383
359
|
},
|
|
384
|
-
onTabSelected: (...
|
|
385
|
-
let e =
|
|
386
|
-
e && e.nativeEvent && (e = e.nativeEvent),
|
|
360
|
+
onTabSelected: (...n) => {
|
|
361
|
+
let e = n[0];
|
|
362
|
+
e && e.nativeEvent && (e = e.nativeEvent), g.value.onTabSelected && g.value.onTabSelected(e);
|
|
387
363
|
},
|
|
388
|
-
onItemClick: (...
|
|
389
|
-
let e =
|
|
390
|
-
if (console.log("[useGridTabs] RAW onItemClick intercepted from Native:", e), e && e.nativeEvent && (e = e.nativeEvent),
|
|
364
|
+
onItemClick: (...n) => {
|
|
365
|
+
let e = n[0];
|
|
366
|
+
if (console.log("[useGridTabs] RAW onItemClick intercepted from Native:", e), e && e.nativeEvent && (e = e.nativeEvent), g.value.onItemClick)
|
|
391
367
|
try {
|
|
392
|
-
let
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
console.error("[useGridTabs] Failed to parse onItemClick event payload:", n), a.value.onItemClick(e);
|
|
368
|
+
let t = typeof e == "string" ? e : (e == null ? void 0 : e.data) || e;
|
|
369
|
+
const a = typeof t == "string" ? JSON.parse(t) : t;
|
|
370
|
+
g.value.onItemClick(a);
|
|
371
|
+
} catch (t) {
|
|
372
|
+
console.error("[useGridTabs] Failed to parse onItemClick event payload:", t), g.value.onItemClick(e);
|
|
398
373
|
}
|
|
399
374
|
else
|
|
400
375
|
console.warn("[useGridTabs] onItemClick triggered but NO callback registered in callbacksRef!");
|
|
401
376
|
},
|
|
402
|
-
|
|
403
|
-
let e =
|
|
404
|
-
if (e && e.nativeEvent && (e = e.nativeEvent),
|
|
377
|
+
onItemLongClick: (...n) => {
|
|
378
|
+
let e = n[0];
|
|
379
|
+
if (console.log("[useGridTabs] RAW onItemLongClick intercepted from Native:", e), typeof e == "number" && n.length >= 3 && typeof n[1] == "string" && (e = n[2]), e && e.nativeEvent && (e = e.nativeEvent), g.value.onItemLongClick)
|
|
405
380
|
try {
|
|
406
|
-
let
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
} catch (
|
|
410
|
-
console.error("[useGridTabs] Failed to parse
|
|
381
|
+
let t = typeof e == "string" ? e : (e == null ? void 0 : e.data) || e;
|
|
382
|
+
const a = typeof t == "string" ? JSON.parse(t) : t;
|
|
383
|
+
g.value.onItemLongClick(a);
|
|
384
|
+
} catch (t) {
|
|
385
|
+
console.error("[useGridTabs] Failed to parse onItemLongClick event payload:", t), g.value.onItemLongClick(e);
|
|
411
386
|
}
|
|
412
387
|
},
|
|
413
|
-
|
|
414
|
-
let e =
|
|
415
|
-
e && e.nativeEvent && (e = e.nativeEvent),
|
|
388
|
+
onItemFocused: (...n) => {
|
|
389
|
+
let e = n[0];
|
|
390
|
+
if (e && e.nativeEvent && (e = e.nativeEvent), g.value.onItemFocused)
|
|
391
|
+
try {
|
|
392
|
+
let t = typeof e == "string" ? e : (e == null ? void 0 : e.data) || e;
|
|
393
|
+
const a = typeof t == "string" ? JSON.parse(t) : t;
|
|
394
|
+
g.value.onItemFocused(a);
|
|
395
|
+
} catch (t) {
|
|
396
|
+
console.error("[useGridTabs] Failed to parse onItemFocused event payload:", t), g.value.onItemFocused(e);
|
|
397
|
+
}
|
|
416
398
|
},
|
|
417
|
-
|
|
418
|
-
let e =
|
|
419
|
-
|
|
399
|
+
onTabFocused: (...n) => {
|
|
400
|
+
let e = n[0];
|
|
401
|
+
e && e.nativeEvent && (e = e.nativeEvent), g.value.onTabFocused && g.value.onTabFocused(e);
|
|
402
|
+
},
|
|
403
|
+
onScroll: (...n) => {
|
|
404
|
+
let e = n[0];
|
|
405
|
+
if (e && e.nativeEvent && (e = e.nativeEvent), g.value.onScroll)
|
|
420
406
|
try {
|
|
421
|
-
const
|
|
422
|
-
|
|
407
|
+
const t = (e == null ? void 0 : e.data) || e;
|
|
408
|
+
g.value.onScroll(t);
|
|
423
409
|
} catch {
|
|
424
|
-
|
|
410
|
+
g.value.onScroll(e);
|
|
425
411
|
}
|
|
426
412
|
},
|
|
427
|
-
onScrollStateChanged: (...
|
|
428
|
-
let e =
|
|
429
|
-
if (e && e.nativeEvent && (e = e.nativeEvent),
|
|
413
|
+
onScrollStateChanged: (...n) => {
|
|
414
|
+
let e = n[0];
|
|
415
|
+
if (e && e.nativeEvent && (e = e.nativeEvent), g.value.onScrollStateChanged)
|
|
430
416
|
try {
|
|
431
|
-
const
|
|
432
|
-
|
|
417
|
+
const t = (e == null ? void 0 : e.data) || e;
|
|
418
|
+
g.value.onScrollStateChanged(t);
|
|
433
419
|
} catch {
|
|
434
|
-
|
|
420
|
+
g.value.onScrollStateChanged(e);
|
|
435
421
|
}
|
|
436
422
|
}
|
|
437
423
|
}));
|
|
438
424
|
return {
|
|
439
|
-
tabsDataStr:
|
|
440
|
-
bindings:
|
|
441
|
-
tabs:
|
|
442
|
-
items:
|
|
443
|
-
initData:
|
|
444
|
-
setCallbacks:
|
|
445
|
-
updateItem: (
|
|
446
|
-
if (!
|
|
425
|
+
tabsDataStr: v,
|
|
426
|
+
bindings: A,
|
|
427
|
+
tabs: p,
|
|
428
|
+
items: f,
|
|
429
|
+
initData: w,
|
|
430
|
+
setCallbacks: $,
|
|
431
|
+
updateItem: (n, e) => {
|
|
432
|
+
if (!r) {
|
|
447
433
|
console.error("[useGridTabs] ❌ 时机错误: 尚未初始化数据,无法调用 updateItem");
|
|
448
434
|
return;
|
|
449
435
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
n(u);
|
|
464
|
-
break;
|
|
436
|
+
T({ op: "UPDATE_ITEM", itemId: n, payload: e }), d = !0;
|
|
437
|
+
try {
|
|
438
|
+
if (b) {
|
|
439
|
+
const t = f.value.find((a) => a.id === n);
|
|
440
|
+
t && Object.assign(t, e);
|
|
441
|
+
} else
|
|
442
|
+
for (const t of p.value)
|
|
443
|
+
if (t.items) {
|
|
444
|
+
const a = t.items.find((l) => l.id === n);
|
|
445
|
+
if (a) {
|
|
446
|
+
Object.assign(a, e);
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
465
449
|
}
|
|
450
|
+
} finally {
|
|
451
|
+
d = !1;
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
deleteItem: (n, e = !0) => {
|
|
455
|
+
if (r) {
|
|
456
|
+
T({ op: "DELETE_ITEM", itemId: n, payload: { animated: e } }), d = !0;
|
|
457
|
+
try {
|
|
458
|
+
if (b) {
|
|
459
|
+
const t = f.value.findIndex((a) => a.id === n);
|
|
460
|
+
t !== -1 && f.value.splice(t, 1);
|
|
461
|
+
} else
|
|
462
|
+
for (const t of p.value)
|
|
463
|
+
if (t.items) {
|
|
464
|
+
const a = t.items.findIndex((l) => l.id === n);
|
|
465
|
+
if (a !== -1) {
|
|
466
|
+
t.items.splice(a, 1);
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
} finally {
|
|
471
|
+
d = !1;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
prependItems: (n, e) => {
|
|
476
|
+
if (r) {
|
|
477
|
+
T({
|
|
478
|
+
op: "PREPEND_SUB_ITEMS",
|
|
479
|
+
itemId: n,
|
|
480
|
+
payload: { subItems: e }
|
|
481
|
+
}), d = !0;
|
|
482
|
+
try {
|
|
483
|
+
if (b)
|
|
484
|
+
f.value.unshift(...e);
|
|
485
|
+
else {
|
|
486
|
+
const t = p.value.find((a) => a.tabId === n);
|
|
487
|
+
t && t.items && t.items.unshift(...e);
|
|
466
488
|
}
|
|
489
|
+
} finally {
|
|
490
|
+
d = !1;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
467
493
|
},
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
494
|
+
clearItems: (n) => {
|
|
495
|
+
if (r) {
|
|
496
|
+
T({
|
|
497
|
+
op: "CLEAR_SUB_ITEMS",
|
|
498
|
+
itemId: n
|
|
499
|
+
}), d = !0;
|
|
473
500
|
try {
|
|
474
|
-
|
|
475
|
-
|
|
501
|
+
if (b)
|
|
502
|
+
f.value.splice(0, f.value.length);
|
|
503
|
+
else {
|
|
504
|
+
const e = p.value.find((t) => t.tabId === n);
|
|
505
|
+
e && e.items && e.items.splice(0, e.items.length);
|
|
506
|
+
}
|
|
507
|
+
} finally {
|
|
508
|
+
d = !1;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
moveItem: (n, e, t) => {
|
|
513
|
+
if (r) {
|
|
514
|
+
T({
|
|
515
|
+
op: "MOVE_ITEM",
|
|
516
|
+
itemId: n,
|
|
517
|
+
payload: { targetPosition: e, anchorItemId: t }
|
|
518
|
+
}), d = !0;
|
|
519
|
+
try {
|
|
520
|
+
const a = (l) => {
|
|
521
|
+
const u = l.findIndex((h) => h.id === n), c = l.findIndex((h) => h.id === t);
|
|
522
|
+
if (u !== -1 && c !== -1) {
|
|
523
|
+
const h = l.splice(u, 1)[0], S = l.findIndex((Te) => Te.id === t), q = e === "after" ? S + 1 : S;
|
|
524
|
+
l.splice(q, 0, h);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
if (b)
|
|
528
|
+
a(f.value);
|
|
529
|
+
else
|
|
530
|
+
for (const l of p.value)
|
|
531
|
+
l.items && a(l.items);
|
|
532
|
+
} finally {
|
|
533
|
+
d = !1;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
},
|
|
537
|
+
replaceItem: (n, e) => {
|
|
538
|
+
if (r) {
|
|
539
|
+
T({
|
|
540
|
+
op: "REPLACE_ITEM",
|
|
541
|
+
itemId: n,
|
|
542
|
+
payload: e
|
|
543
|
+
}), d = !0;
|
|
544
|
+
try {
|
|
545
|
+
if (b) {
|
|
546
|
+
const t = f.value.findIndex((a) => a.id === n);
|
|
547
|
+
t !== -1 && (f.value[t] = e);
|
|
548
|
+
} else
|
|
549
|
+
for (const t of p.value)
|
|
550
|
+
if (t.items) {
|
|
551
|
+
const a = t.items.findIndex((l) => l.id === n);
|
|
552
|
+
if (a !== -1) {
|
|
553
|
+
t.items[a] = e;
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
} finally {
|
|
558
|
+
d = !1;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
dispatchAction: T,
|
|
563
|
+
resetInitialization: N,
|
|
564
|
+
getFocusState: async () => new Promise((n, e) => {
|
|
565
|
+
let t = o.value;
|
|
566
|
+
typeof o.value.getNativeNode == "function" ? t = o.value.getNativeNode() || o.value : o.value.nativeRef && (t = o.value.nativeRef), console.log("[useGridTabs] getFocusState called, nativeTarget:", t);
|
|
567
|
+
const a = (l) => {
|
|
568
|
+
if (console.log("[useGridTabs] getFocusState callback received:", l), l && l.isSuccess !== void 0 && l.result !== void 0) {
|
|
569
|
+
n(l.result);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
try {
|
|
573
|
+
const u = typeof l == "string" ? JSON.parse(l) : l;
|
|
574
|
+
n(u);
|
|
476
575
|
} catch (u) {
|
|
477
576
|
e(u);
|
|
478
577
|
}
|
|
479
|
-
}
|
|
578
|
+
};
|
|
579
|
+
typeof x.callUIFunction == "function" ? (console.log('[useGridTabs] Executing Native.callUIFunction("getFocusState") with callback as 4th arg'), x.callUIFunction(t, "getFocusState", [], a)) : (console.error("[useGridTabs] Native.callUIFunction is not available"), e(new Error("Native.callUIFunction is not available")));
|
|
480
580
|
}),
|
|
481
|
-
getItemRect: async (
|
|
482
|
-
let
|
|
483
|
-
typeof o.value.getNativeNode == "function" ?
|
|
581
|
+
getItemRect: async (n) => new Promise((e, t) => {
|
|
582
|
+
let a = o.value;
|
|
583
|
+
typeof o.value.getNativeNode == "function" ? a = o.value.getNativeNode() || o.value : o.value.nativeRef && (a = o.value.nativeRef), console.log(`[useGridTabs] getItemRect called for itemId=${n}, nativeTarget:`, a);
|
|
584
|
+
const l = (u) => {
|
|
585
|
+
if (console.log(`[useGridTabs] getItemRect callback received for itemId=${n}:`, u), u && u.isSuccess !== void 0 && u.result !== void 0) {
|
|
586
|
+
e(u.result);
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
484
589
|
try {
|
|
485
|
-
const
|
|
486
|
-
e(
|
|
487
|
-
} catch (
|
|
488
|
-
|
|
590
|
+
const c = typeof u == "string" ? JSON.parse(u) : u;
|
|
591
|
+
e(c);
|
|
592
|
+
} catch (c) {
|
|
593
|
+
t(c);
|
|
489
594
|
}
|
|
490
|
-
}
|
|
491
|
-
|
|
595
|
+
};
|
|
596
|
+
typeof x.callUIFunction == "function" ? (console.log('[useGridTabs] Executing Native.callUIFunction("getItemRect") with itemId and callback as 4th arg'), x.callUIFunction(a, "getItemRect", [n], l)) : (console.error("[useGridTabs] Native.callUIFunction is not available"), t(new Error("Native.callUIFunction is not available")));
|
|
597
|
+
}),
|
|
598
|
+
requestFocus: (n) => {
|
|
599
|
+
let e = o.value;
|
|
600
|
+
typeof o.value.getNativeNode == "function" ? e = o.value.getNativeNode() || o.value : o.value.nativeRef && (e = o.value.nativeRef), x.callUIFunction(e, "requestFocus", [n]);
|
|
601
|
+
}
|
|
492
602
|
};
|
|
493
603
|
}
|
|
494
|
-
const re = "QtKeyboard",
|
|
604
|
+
const re = "QtKeyboard", ie = /* @__PURE__ */ L({
|
|
495
605
|
__name: "Keyboard",
|
|
496
606
|
props: {
|
|
497
607
|
backgroundColor: {},
|
|
@@ -503,44 +613,31 @@ const re = "QtKeyboard", ae = /* @__PURE__ */ q({
|
|
|
503
613
|
placeholder: {},
|
|
504
614
|
textFullKeyboard: {},
|
|
505
615
|
textT9Keyboard: {},
|
|
616
|
+
keyboardType: {},
|
|
506
617
|
textClear: {},
|
|
507
618
|
textDelete: {},
|
|
508
619
|
currentInput: {},
|
|
509
620
|
autofocus: { type: Boolean },
|
|
510
|
-
requestFocus: { type: Boolean },
|
|
511
|
-
keyboardType: {},
|
|
512
621
|
rememberKeyboardType: { type: Boolean }
|
|
513
622
|
},
|
|
514
623
|
emits: ["onInputChanged", "onKeyPressed"],
|
|
515
|
-
setup(o, { expose: s
|
|
516
|
-
const v =
|
|
517
|
-
|
|
518
|
-
|
|
624
|
+
setup(o, { expose: s }) {
|
|
625
|
+
const v = G(), p = Z(), f = re + "_Plugin", r = (p.isPluginActive ? f : re).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, ""), y = z(
|
|
626
|
+
r,
|
|
627
|
+
p.pluginPackageName || "com.quicktvui.plugin.extraui",
|
|
519
628
|
"com.quicktvui.plugin.extraui.ExtraUIPluginApp"
|
|
520
|
-
)
|
|
521
|
-
return
|
|
522
|
-
(a.autofocus || a.requestFocus) && setTimeout(() => {
|
|
523
|
-
var P, h;
|
|
524
|
-
const l = ((h = (P = v.value) == null ? void 0 : P.getNativeNode) == null ? void 0 : h.call(P)) || v.value;
|
|
525
|
-
l && G.callUIFunction(l, "requestFocus", [!0]);
|
|
526
|
-
}, 300);
|
|
527
|
-
}), J(() => a.requestFocus, (l) => {
|
|
528
|
-
l && setTimeout(() => {
|
|
529
|
-
var h, S;
|
|
530
|
-
const P = ((S = (h = v.value) == null ? void 0 : h.getNativeNode) == null ? void 0 : S.call(h)) || v.value;
|
|
531
|
-
P && G.callUIFunction(P, "requestFocus", [!0]);
|
|
532
|
-
}, 300);
|
|
533
|
-
}), s({
|
|
629
|
+
);
|
|
630
|
+
return s({
|
|
534
631
|
getNativeNode: () => {
|
|
535
|
-
var
|
|
536
|
-
return ((
|
|
632
|
+
var i, d;
|
|
633
|
+
return ((d = (i = v.value) == null ? void 0 : i.getNativeNode) == null ? void 0 : d.call(i)) || v.value;
|
|
537
634
|
},
|
|
538
|
-
requestFocus: (...
|
|
539
|
-
var
|
|
540
|
-
const
|
|
541
|
-
|
|
635
|
+
requestFocus: (...i) => {
|
|
636
|
+
var g, T;
|
|
637
|
+
const d = ((T = (g = v.value) == null ? void 0 : g.getNativeNode) == null ? void 0 : T.call(g)) || v.value;
|
|
638
|
+
d && x.callUIFunction(d, "requestFocus", i);
|
|
542
639
|
}
|
|
543
|
-
}), (
|
|
640
|
+
}), (i, d) => (B(), Q(K(y), j({
|
|
544
641
|
ref_key: "nativeRef",
|
|
545
642
|
ref: v,
|
|
546
643
|
backgroundColor: o.backgroundColor,
|
|
@@ -552,41 +649,40 @@ const re = "QtKeyboard", ae = /* @__PURE__ */ q({
|
|
|
552
649
|
placeholder: o.placeholder,
|
|
553
650
|
textFullKeyboard: o.textFullKeyboard,
|
|
554
651
|
textT9Keyboard: o.textT9Keyboard,
|
|
652
|
+
keyboardType: o.keyboardType,
|
|
555
653
|
textClear: o.textClear,
|
|
556
654
|
textDelete: o.textDelete,
|
|
557
655
|
currentInput: o.currentInput,
|
|
558
656
|
autofocus: o.autofocus,
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
default: j(() => [
|
|
566
|
-
V(l.$slots, "default")
|
|
657
|
+
rememberKeyboardType: o.rememberKeyboardType,
|
|
658
|
+
onOnInputChanged: d[0] || (d[0] = (g) => i.$emit("onInputChanged", g.nativeEvent)),
|
|
659
|
+
onOnKeyPressed: d[1] || (d[1] = (g) => i.$emit("onKeyPressed", g.nativeEvent))
|
|
660
|
+
}, i.$attrs), {
|
|
661
|
+
default: V(() => [
|
|
662
|
+
W(i.$slots, "default")
|
|
567
663
|
]),
|
|
568
664
|
_: 3
|
|
569
|
-
}, 16, ["backgroundColor", "backgroundGradient", "textColor", "weakTextColor", "focusBackgroundColor", "focusTextColor", "placeholder", "textFullKeyboard", "textT9Keyboard", "textClear", "textDelete", "currentInput", "autofocus", "
|
|
665
|
+
}, 16, ["backgroundColor", "backgroundGradient", "textColor", "weakTextColor", "focusBackgroundColor", "focusTextColor", "placeholder", "textFullKeyboard", "textT9Keyboard", "keyboardType", "textClear", "textDelete", "currentInput", "autofocus", "rememberKeyboardType"]));
|
|
570
666
|
}
|
|
571
667
|
});
|
|
572
668
|
let X;
|
|
573
|
-
var
|
|
669
|
+
var pe;
|
|
574
670
|
try {
|
|
575
671
|
const o = require("@extscreen/es3-vue");
|
|
576
|
-
X = o.registerElement || ((
|
|
672
|
+
X = o.registerElement || ((pe = o.default) == null ? void 0 : pe.registerElement);
|
|
577
673
|
} catch {
|
|
578
674
|
}
|
|
579
|
-
const
|
|
675
|
+
const xe = {
|
|
580
676
|
install: (o) => {
|
|
581
677
|
if (!globalThis.__QtKeyboard_registered)
|
|
582
678
|
if (X) {
|
|
583
|
-
const s = (
|
|
584
|
-
X(
|
|
679
|
+
const s = (v, p) => {
|
|
680
|
+
X(v, {
|
|
585
681
|
component: {
|
|
586
|
-
name:
|
|
587
|
-
processEventData(
|
|
588
|
-
const
|
|
589
|
-
return
|
|
682
|
+
name: p ? "QtKeyboard_Plugin" : "QtKeyboard",
|
|
683
|
+
processEventData(f, b) {
|
|
684
|
+
const r = f.handler || f, y = b || (r == null ? void 0 : r.nativeParams) || {};
|
|
685
|
+
return r && (r.nativeEvent = y), r;
|
|
590
686
|
}
|
|
591
687
|
}
|
|
592
688
|
});
|
|
@@ -594,26 +690,26 @@ const Se = {
|
|
|
594
690
|
s("qt-keyboard", !1), s("qt-keyboard-plugin", !0), s("QtKeyboard", !1), s("QtKeyboard_Plugin", !0), globalThis.__QtKeyboard_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtKeyboard");
|
|
595
691
|
} else
|
|
596
692
|
console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");
|
|
597
|
-
o.component("Keyboard",
|
|
693
|
+
o.component("Keyboard", ie), o.component("qt-keyboard", ie);
|
|
598
694
|
}
|
|
599
|
-
},
|
|
695
|
+
}, le = "QtPortalPool", ce = /* @__PURE__ */ L({
|
|
600
696
|
__name: "PortalPool",
|
|
601
697
|
setup(o, { expose: s }) {
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
|
|
698
|
+
const v = G(), p = Z(), f = le + "_Plugin", r = (p.isPluginActive ? f : le).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, ""), y = z(
|
|
699
|
+
r,
|
|
700
|
+
p.pluginPackageName || "com.quicktvui.plugin.glintui"
|
|
605
701
|
);
|
|
606
702
|
return s({
|
|
607
703
|
getNativeNode: () => {
|
|
608
|
-
var i,
|
|
609
|
-
return ((
|
|
704
|
+
var i, d;
|
|
705
|
+
return ((d = (i = v.value) == null ? void 0 : i.getNativeNode) == null ? void 0 : d.call(i)) || v.value;
|
|
610
706
|
}
|
|
611
|
-
}), (i,
|
|
707
|
+
}), (i, d) => (B(), Q(K(y), j({
|
|
612
708
|
ref_key: "nativeRef",
|
|
613
|
-
ref:
|
|
709
|
+
ref: v
|
|
614
710
|
}, i.$attrs), {
|
|
615
|
-
default:
|
|
616
|
-
|
|
711
|
+
default: V(() => [
|
|
712
|
+
W(i.$slots, "default")
|
|
617
713
|
]),
|
|
618
714
|
_: 3
|
|
619
715
|
}, 16));
|
|
@@ -626,17 +722,17 @@ try {
|
|
|
626
722
|
ee = o.registerElement || ((be = o.default) == null ? void 0 : be.registerElement);
|
|
627
723
|
} catch {
|
|
628
724
|
}
|
|
629
|
-
const
|
|
725
|
+
const Se = {
|
|
630
726
|
install: (o) => {
|
|
631
727
|
if (!globalThis.__QtPortalPool_registered)
|
|
632
728
|
if (ee) {
|
|
633
|
-
const s = (
|
|
634
|
-
ee(
|
|
729
|
+
const s = (v, p) => {
|
|
730
|
+
ee(v, {
|
|
635
731
|
component: {
|
|
636
|
-
name:
|
|
637
|
-
processEventData(
|
|
638
|
-
const
|
|
639
|
-
return
|
|
732
|
+
name: p ? "QtPortalPool_Plugin" : "QtPortalPool",
|
|
733
|
+
processEventData(f, b) {
|
|
734
|
+
const r = f.handler || f, y = b || (r == null ? void 0 : r.nativeParams) || {};
|
|
735
|
+
return r && (r.nativeEvent = y), r;
|
|
640
736
|
}
|
|
641
737
|
}
|
|
642
738
|
});
|
|
@@ -644,30 +740,30 @@ const $e = {
|
|
|
644
740
|
s("qt-portal-pool", !1), s("qt-portal-pool-plugin", !0), s("QtPortalPool", !1), s("QtPortalPool_Plugin", !0), globalThis.__QtPortalPool_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtPortalPool");
|
|
645
741
|
} else
|
|
646
742
|
console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");
|
|
647
|
-
o.component("PortalPool",
|
|
743
|
+
o.component("PortalPool", ce), o.component("qt-portal-pool", ce);
|
|
648
744
|
}
|
|
649
|
-
},
|
|
745
|
+
}, ue = "QtPortalItem", de = /* @__PURE__ */ L({
|
|
650
746
|
__name: "PortalItem",
|
|
651
747
|
props: {
|
|
652
748
|
portalId: {}
|
|
653
749
|
},
|
|
654
750
|
setup(o, { expose: s }) {
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
751
|
+
const v = G(), p = Z(), f = ue + "_Plugin", r = (p.isPluginActive ? f : ue).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, ""), y = z(
|
|
752
|
+
r,
|
|
753
|
+
p.pluginPackageName || "com.quicktvui.plugin.glintui"
|
|
658
754
|
);
|
|
659
755
|
return s({
|
|
660
756
|
getNativeNode: () => {
|
|
661
|
-
var i,
|
|
662
|
-
return ((
|
|
757
|
+
var i, d;
|
|
758
|
+
return ((d = (i = v.value) == null ? void 0 : i.getNativeNode) == null ? void 0 : d.call(i)) || v.value;
|
|
663
759
|
}
|
|
664
|
-
}), (i,
|
|
760
|
+
}), (i, d) => (B(), Q(K(y), j({
|
|
665
761
|
ref_key: "nativeRef",
|
|
666
|
-
ref:
|
|
762
|
+
ref: v,
|
|
667
763
|
portalId: o.portalId
|
|
668
764
|
}, i.$attrs), {
|
|
669
|
-
default:
|
|
670
|
-
|
|
765
|
+
default: V(() => [
|
|
766
|
+
W(i.$slots, "default")
|
|
671
767
|
]),
|
|
672
768
|
_: 3
|
|
673
769
|
}, 16, ["portalId"]));
|
|
@@ -680,17 +776,17 @@ try {
|
|
|
680
776
|
te = o.registerElement || ((ye = o.default) == null ? void 0 : ye.registerElement);
|
|
681
777
|
} catch {
|
|
682
778
|
}
|
|
683
|
-
const
|
|
779
|
+
const Ge = {
|
|
684
780
|
install: (o) => {
|
|
685
781
|
if (!globalThis.__QtPortalItem_registered)
|
|
686
782
|
if (te) {
|
|
687
|
-
const s = (
|
|
688
|
-
te(
|
|
783
|
+
const s = (v, p) => {
|
|
784
|
+
te(v, {
|
|
689
785
|
component: {
|
|
690
|
-
name:
|
|
691
|
-
processEventData(
|
|
692
|
-
const
|
|
693
|
-
return
|
|
786
|
+
name: p ? "QtPortalItem_Plugin" : "QtPortalItem",
|
|
787
|
+
processEventData(f, b) {
|
|
788
|
+
const r = f.handler || f, y = b || (r == null ? void 0 : r.nativeParams) || {};
|
|
789
|
+
return r && (r.nativeEvent = y), r;
|
|
694
790
|
}
|
|
695
791
|
}
|
|
696
792
|
});
|
|
@@ -698,44 +794,44 @@ const _e = {
|
|
|
698
794
|
s("qt-portal-item", !1), s("qt-portal-item-plugin", !0), s("QtPortalItem", !1), s("QtPortalItem_Plugin", !0), globalThis.__QtPortalItem_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtPortalItem");
|
|
699
795
|
} else
|
|
700
796
|
console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");
|
|
701
|
-
o.component("PortalItem",
|
|
797
|
+
o.component("PortalItem", de), o.component("qt-portal-item", de);
|
|
702
798
|
}
|
|
703
|
-
},
|
|
799
|
+
}, ve = "QtHsvBackground", fe = /* @__PURE__ */ L({
|
|
704
800
|
__name: "HsvBackground",
|
|
705
801
|
props: {
|
|
706
802
|
hue: { default: -2 }
|
|
707
803
|
},
|
|
708
804
|
setup(o, { expose: s }) {
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
805
|
+
const v = G(), p = Z(), f = ve + "_Plugin", r = (p.isPluginActive ? f : ve).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase().replace(/^-/, ""), y = z(
|
|
806
|
+
r,
|
|
807
|
+
p.pluginPackageName || "com.quicktvui.plugin.glintui"
|
|
712
808
|
);
|
|
713
809
|
return s({
|
|
714
810
|
getNativeNode: () => {
|
|
715
|
-
var i,
|
|
716
|
-
return ((
|
|
811
|
+
var i, d;
|
|
812
|
+
return ((d = (i = v.value) == null ? void 0 : i.getNativeNode) == null ? void 0 : d.call(i)) || v.value;
|
|
717
813
|
}
|
|
718
|
-
}), (i,
|
|
814
|
+
}), (i, d) => (B(), Q(K(y), j({
|
|
719
815
|
ref_key: "nativeRef",
|
|
720
|
-
ref:
|
|
816
|
+
ref: v,
|
|
721
817
|
hue: o.hue
|
|
722
818
|
}, i.$attrs), {
|
|
723
|
-
default:
|
|
724
|
-
|
|
819
|
+
default: V(() => [
|
|
820
|
+
W(i.$slots, "default")
|
|
725
821
|
]),
|
|
726
822
|
_: 3
|
|
727
823
|
}, 16, ["hue"]));
|
|
728
824
|
}
|
|
729
|
-
}),
|
|
825
|
+
}), $e = {
|
|
730
826
|
install(o) {
|
|
731
|
-
o.component("qt-hsv-background",
|
|
827
|
+
o.component("qt-hsv-background", fe), o.component("HsvBackground", fe);
|
|
732
828
|
}
|
|
733
|
-
},
|
|
829
|
+
}, Oe = {
|
|
734
830
|
// 如果设置为 true,则全局跳过所有组件的原生插件安装检查,直接渲染
|
|
735
831
|
skipPluginCheck: !1
|
|
736
|
-
},
|
|
737
|
-
function z(o, s,
|
|
738
|
-
return
|
|
832
|
+
}, H = /* @__PURE__ */ new Set();
|
|
833
|
+
function z(o, s, v) {
|
|
834
|
+
return L({
|
|
739
835
|
name: `${o}AsyncWrapper`,
|
|
740
836
|
inheritAttrs: !1,
|
|
741
837
|
props: {
|
|
@@ -745,208 +841,218 @@ function z(o, s, d) {
|
|
|
745
841
|
default: !1
|
|
746
842
|
}
|
|
747
843
|
},
|
|
748
|
-
setup(
|
|
749
|
-
const
|
|
750
|
-
|
|
844
|
+
setup(p, { slots: f, attrs: b, expose: r }) {
|
|
845
|
+
const y = G("loading"), i = G(""), d = G(), g = globalThis.__VUE_INSTANCE__;
|
|
846
|
+
r({
|
|
751
847
|
getNativeNode: () => {
|
|
752
|
-
let
|
|
753
|
-
return !
|
|
848
|
+
let m = d.value;
|
|
849
|
+
return !m && g && g.vnode && g.vnode.el && (m = g.vnode.el, m.childNodes && m.childNodes.length > 0 && (m = m.childNodes[0])), m;
|
|
754
850
|
},
|
|
755
|
-
nativeRef:
|
|
851
|
+
nativeRef: d
|
|
756
852
|
});
|
|
757
|
-
let
|
|
853
|
+
let R = null, k = null;
|
|
758
854
|
try {
|
|
759
|
-
|
|
760
|
-
} catch (
|
|
761
|
-
console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",
|
|
855
|
+
R = me(), k = ke();
|
|
856
|
+
} catch (m) {
|
|
857
|
+
console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。", m);
|
|
762
858
|
}
|
|
763
|
-
const
|
|
764
|
-
if (!
|
|
859
|
+
const O = async () => {
|
|
860
|
+
if (!R || typeof R.isComponentRegistered != "function")
|
|
765
861
|
return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"), !1;
|
|
766
862
|
try {
|
|
767
|
-
const
|
|
768
|
-
if (console.log(`[withAsyncPlugin] isComponentRegistered('${o}') 返回:`,
|
|
863
|
+
const m = await R.isComponentRegistered(o);
|
|
864
|
+
if (console.log(`[withAsyncPlugin] isComponentRegistered('${o}') 返回:`, m), m === !0 || m && typeof m == "object" && (m.registered === !0 || m.isRegistered === !0))
|
|
769
865
|
return !0;
|
|
770
866
|
try {
|
|
771
|
-
const
|
|
772
|
-
if (
|
|
773
|
-
const
|
|
774
|
-
console.log(`[withAsyncPlugin] 当前引擎核心版本: ${
|
|
775
|
-
const
|
|
776
|
-
if (
|
|
777
|
-
if (
|
|
867
|
+
const P = await x.callNativeWithPromise("ExtendModule", "getCoreSDKInfo");
|
|
868
|
+
if (P && P.core_version) {
|
|
869
|
+
const _ = P.core_version;
|
|
870
|
+
console.log(`[withAsyncPlugin] 当前引擎核心版本: ${_}`);
|
|
871
|
+
const E = _.split(".").map((I) => parseInt(I, 10));
|
|
872
|
+
if (E.length >= 3 && !isNaN(E[0]) && !isNaN(E[1]) && !isNaN(E[2]))
|
|
873
|
+
if (E[0] * 1e6 + E[1] * 1e3 + E[2] >= 1011205) {
|
|
778
874
|
console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${o}`);
|
|
779
|
-
const
|
|
780
|
-
console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${o}, ${
|
|
781
|
-
const [
|
|
782
|
-
|
|
783
|
-
|
|
875
|
+
const N = o.split("-").map((A) => A.charAt(0).toUpperCase() + A.slice(1)).join("");
|
|
876
|
+
console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${o}, ${N}`);
|
|
877
|
+
const [w, $] = await Promise.all([
|
|
878
|
+
x.callNativeWithPromise("ExtendModule", "isComponentRegistered", o).catch(() => !1),
|
|
879
|
+
x.callNativeWithPromise("ExtendModule", "isComponentRegistered", N).catch(() => !1)
|
|
784
880
|
]);
|
|
785
|
-
if (console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${
|
|
881
|
+
if (console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${w}, ${$}]`), w === !0 || $ === !0)
|
|
786
882
|
return !0;
|
|
787
883
|
} else
|
|
788
|
-
console.log(`[withAsyncPlugin] 引擎版本 ${
|
|
884
|
+
console.log(`[withAsyncPlugin] 引擎版本 ${_} < 1.11.205,跳过 ExtendModule 检查`);
|
|
789
885
|
else
|
|
790
|
-
console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${
|
|
886
|
+
console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${_}`);
|
|
791
887
|
}
|
|
792
|
-
} catch (
|
|
793
|
-
console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",
|
|
888
|
+
} catch (P) {
|
|
889
|
+
console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:", P);
|
|
794
890
|
}
|
|
795
891
|
return !1;
|
|
796
|
-
} catch (
|
|
797
|
-
return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",
|
|
892
|
+
} catch (m) {
|
|
893
|
+
return console.warn("[withAsyncPlugin] 检查组件注册状态异常:", m), !1;
|
|
798
894
|
}
|
|
799
|
-
},
|
|
800
|
-
if (
|
|
801
|
-
console.log(`[withAsyncPlugin] 跳过 ${o} 插件检查 (skipPluginCheck = true)`),
|
|
895
|
+
}, M = async () => {
|
|
896
|
+
if (Oe.skipPluginCheck || p.skipPluginCheck) {
|
|
897
|
+
console.log(`[withAsyncPlugin] 跳过 ${o} 插件检查 (skipPluginCheck = true)`), y.value = "ready";
|
|
802
898
|
return;
|
|
803
899
|
}
|
|
804
900
|
if (!s) {
|
|
805
|
-
|
|
901
|
+
y.value = "ready";
|
|
806
902
|
return;
|
|
807
903
|
}
|
|
808
|
-
const
|
|
809
|
-
if (console.log(`[withAsyncPlugin] 拦截检查 - ${o} 是否已注册:`,
|
|
810
|
-
|
|
904
|
+
const m = await O();
|
|
905
|
+
if (console.log(`[withAsyncPlugin] 拦截检查 - ${o} 是否已注册:`, m), m || H.has(s)) {
|
|
906
|
+
y.value = "ready", H.add(s), console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");
|
|
811
907
|
return;
|
|
812
908
|
}
|
|
813
|
-
if (!
|
|
814
|
-
console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${o}`),
|
|
909
|
+
if (!k) {
|
|
910
|
+
console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${o}`), y.value = "ready";
|
|
815
911
|
return;
|
|
816
912
|
}
|
|
817
913
|
console.log(`[withAsyncPlugin] 开始动态安装插件: ${s}`);
|
|
818
914
|
try {
|
|
819
|
-
await new Promise((
|
|
820
|
-
let
|
|
821
|
-
const
|
|
822
|
-
onPluginInstallSuccess(
|
|
823
|
-
|
|
915
|
+
await new Promise((P, _) => {
|
|
916
|
+
let E;
|
|
917
|
+
const I = {
|
|
918
|
+
onPluginInstallSuccess(N, w, $) {
|
|
919
|
+
N === s && (clearTimeout(E), k.removeListener(I), console.log(`[withAsyncPlugin] 安装成功 pkg=${N} 状态码=${w}`), w == 1003 || w == 1001 ? (v ? (console.log(`[withAsyncPlugin] 触发反射初始化: ${v}`), x.callNative("EsNativeModule", "callReflect", {
|
|
824
920
|
entry: {
|
|
825
|
-
from:
|
|
921
|
+
from: v,
|
|
826
922
|
method: "setup"
|
|
827
923
|
}
|
|
828
|
-
})) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),
|
|
924
|
+
})) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"), P()) : _(new Error(`安装失败 pkg=${N} status=${w} msg=${$}`)));
|
|
829
925
|
},
|
|
830
|
-
onPluginInstallError(
|
|
831
|
-
|
|
926
|
+
onPluginInstallError(N, w, $) {
|
|
927
|
+
N === s && (clearTimeout(E), k.removeListener(I), _(new Error(`安装失败 pkg=${N} status=${w} msg=${$}`)));
|
|
832
928
|
}
|
|
833
929
|
};
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}, 8e3), typeof
|
|
837
|
-
}), await
|
|
838
|
-
} catch (
|
|
839
|
-
console.error("[withAsyncPlugin] 插件加载失败:",
|
|
930
|
+
k.addListener({ pkg: s }, I), E = setTimeout(() => {
|
|
931
|
+
k.removeListener(I), _(new Error(`插件安装超时: ${s}`));
|
|
932
|
+
}, 8e3), typeof k.installPlugin == "function" ? k.installPlugin({ pkg: s }) : typeof k.install == "function" ? k.install(s) : _(new Error("当前运行时不支持 install / installPlugin"));
|
|
933
|
+
}), await Ee(), H.add(s), y.value = "ready";
|
|
934
|
+
} catch (P) {
|
|
935
|
+
console.error("[withAsyncPlugin] 插件加载失败:", P), i.value = (P == null ? void 0 : P.message) || String(P), y.value = "error";
|
|
840
936
|
}
|
|
841
937
|
};
|
|
842
|
-
return
|
|
843
|
-
|
|
938
|
+
return Ae(() => {
|
|
939
|
+
M();
|
|
844
940
|
}), () => {
|
|
845
|
-
const
|
|
941
|
+
const m = {
|
|
846
942
|
display: "flex",
|
|
847
943
|
flexDirection: "column",
|
|
848
944
|
justifyContent: "center",
|
|
849
945
|
alignItems: "center",
|
|
850
|
-
...
|
|
946
|
+
...b.style || {}
|
|
851
947
|
};
|
|
852
|
-
|
|
853
|
-
const
|
|
854
|
-
class:
|
|
855
|
-
style:
|
|
948
|
+
b.width !== void 0 && !m.width && (m.width = typeof b.width == "number" ? `${b.width}px` : b.width), b.height !== void 0 && !m.height && (m.height = typeof b.height == "number" ? `${b.height}px` : b.height);
|
|
949
|
+
const P = b.class ? `qt-plugin-container ${b.class}` : "qt-plugin-container", _ = {
|
|
950
|
+
class: P,
|
|
951
|
+
style: m,
|
|
856
952
|
// 默认关闭外层 div 的裁剪,防止内部组件 focusScale 时被切
|
|
857
953
|
clipChildren: !1,
|
|
858
954
|
clipPadding: !1,
|
|
859
955
|
clipToPadding: !1
|
|
860
956
|
};
|
|
861
|
-
if (
|
|
862
|
-
return
|
|
863
|
-
|
|
957
|
+
if (y.value === "loading")
|
|
958
|
+
return U("div", _, [
|
|
959
|
+
U("div", { style: { color: "white", fontSize: "30px" } }, "插件加载中...")
|
|
864
960
|
]);
|
|
865
|
-
if (
|
|
866
|
-
return
|
|
867
|
-
|
|
961
|
+
if (y.value === "error")
|
|
962
|
+
return U("div", _, [
|
|
963
|
+
U("div", { style: { color: "white", fontSize: "30px", backgroundColor: "rgba(255,0,0,0.5)" } }, `插件加载失败: ${i.value}`)
|
|
868
964
|
]);
|
|
869
|
-
const
|
|
870
|
-
for (const [
|
|
871
|
-
if (
|
|
872
|
-
let
|
|
873
|
-
|
|
874
|
-
} else if (
|
|
875
|
-
let
|
|
876
|
-
|
|
965
|
+
const E = {}, I = {};
|
|
966
|
+
for (const [A, C] of Object.entries(b))
|
|
967
|
+
if (A.startsWith("on") && typeof C == "function") {
|
|
968
|
+
let D = A;
|
|
969
|
+
A.startsWith("onOn") && (D = "on" + A.slice(4)), I[D] = C;
|
|
970
|
+
} else if (A.startsWith("on") && Array.isArray(C)) {
|
|
971
|
+
let D = A;
|
|
972
|
+
A.startsWith("onOn") && (D = "on" + A.slice(4)), I[D] = C;
|
|
877
973
|
} else
|
|
878
|
-
|
|
879
|
-
const
|
|
880
|
-
...
|
|
881
|
-
|
|
882
|
-
class:
|
|
974
|
+
A.startsWith("onOn") || (E[A] = C);
|
|
975
|
+
const N = {
|
|
976
|
+
...E,
|
|
977
|
+
...I,
|
|
978
|
+
class: P,
|
|
883
979
|
// 把外层 class 传给内部
|
|
884
|
-
style:
|
|
980
|
+
style: m,
|
|
885
981
|
// 把外层 style 传给内部
|
|
886
|
-
ref: (
|
|
887
|
-
|
|
982
|
+
ref: (A) => {
|
|
983
|
+
d.value = A;
|
|
888
984
|
}
|
|
889
|
-
},
|
|
890
|
-
return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:", Object.keys(
|
|
985
|
+
}, w = N.tabsData || "", $ = N.actionPayload || "";
|
|
986
|
+
return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:", Object.keys(N), "tabsData.length=", w.length, "actionPayload.length=", $.length), U(o, N, f.default ? f.default() : []);
|
|
891
987
|
};
|
|
892
988
|
}
|
|
893
989
|
});
|
|
894
990
|
}
|
|
895
|
-
const
|
|
991
|
+
const he = Symbol("AddonEnvContext"), Pe = {
|
|
896
992
|
isPluginActive: !1,
|
|
897
993
|
nameSuffix: "",
|
|
898
994
|
pluginPackageName: "com.quicktvui.plugin.glintui",
|
|
899
995
|
builtInVersions: {}
|
|
900
996
|
};
|
|
901
|
-
async function
|
|
902
|
-
const
|
|
903
|
-
let
|
|
997
|
+
async function je(o = "com.quicktvui.plugin.glintui", s = "_Plugin") {
|
|
998
|
+
const v = me();
|
|
999
|
+
let p = {};
|
|
904
1000
|
try {
|
|
905
|
-
const i = await
|
|
906
|
-
i && typeof i == "object" && (
|
|
1001
|
+
const i = await x.callNativeModule("AddonEnvModule", "getBuiltInVersions", []);
|
|
1002
|
+
i && typeof i == "object" && (p = i);
|
|
907
1003
|
} catch (i) {
|
|
908
1004
|
console.warn("[AddonProvider] Failed to fetch built-in versions from AddonEnvModule", i);
|
|
909
1005
|
}
|
|
910
|
-
const
|
|
911
|
-
isPluginActive:
|
|
912
|
-
nameSuffix:
|
|
1006
|
+
const f = `QtGridTabs${s}`, b = v.isComponentRegistered(f), r = b instanceof Promise ? await b : b, y = {
|
|
1007
|
+
isPluginActive: r,
|
|
1008
|
+
nameSuffix: r ? s : "",
|
|
913
1009
|
// 如果使用了热更插件,包名加上 .ext 后缀(与 Gradle 打包脚本对齐)
|
|
914
|
-
pluginPackageName:
|
|
915
|
-
builtInVersions:
|
|
1010
|
+
pluginPackageName: r ? `${o}.ext` : o,
|
|
1011
|
+
builtInVersions: p
|
|
916
1012
|
};
|
|
917
|
-
return console.info("[AddonProvider] Environment initialized:",
|
|
1013
|
+
return console.info("[AddonProvider] Environment initialized:", y), y;
|
|
918
1014
|
}
|
|
919
|
-
let ne =
|
|
920
|
-
function
|
|
921
|
-
ne.value = o,
|
|
1015
|
+
let ne = G(Pe);
|
|
1016
|
+
function Ve(o) {
|
|
1017
|
+
ne.value = o, Ne(he, ne);
|
|
922
1018
|
}
|
|
923
|
-
function
|
|
1019
|
+
function Z() {
|
|
924
1020
|
var o;
|
|
925
|
-
return ((o =
|
|
1021
|
+
return ((o = _e(he, ne)) == null ? void 0 : o.value) || Pe;
|
|
1022
|
+
}
|
|
1023
|
+
async function We(o) {
|
|
1024
|
+
console.log("[AddonProvider] Sending GridTabs global config to Native:", o);
|
|
1025
|
+
try {
|
|
1026
|
+
const s = await x.callNativeWithPromise("GridTabsConfigModule", "setDefaultConfig", JSON.stringify(o));
|
|
1027
|
+
return console.log("[AddonProvider] Received response from Native:", s), !!(s && s.success);
|
|
1028
|
+
} catch (s) {
|
|
1029
|
+
return console.error("[AddonProvider] Failed to initialize GridTabs global config:", s), !1;
|
|
1030
|
+
}
|
|
926
1031
|
}
|
|
927
|
-
const
|
|
1032
|
+
const ze = {
|
|
928
1033
|
install: (o) => {
|
|
929
|
-
o.use(
|
|
1034
|
+
o.use(we), o.use(xe), o.use(Se), o.use(Ge), o.use($e);
|
|
930
1035
|
}
|
|
931
1036
|
};
|
|
932
1037
|
export {
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1038
|
+
he as ADDON_ENV_CONTEXT_KEY,
|
|
1039
|
+
J as GridTabs,
|
|
1040
|
+
we as GridTabsPlugin,
|
|
1041
|
+
fe as HsvBackground,
|
|
1042
|
+
$e as HsvBackgroundPlugin,
|
|
1043
|
+
ie as Keyboard,
|
|
1044
|
+
xe as KeyboardPlugin,
|
|
1045
|
+
de as PortalItem,
|
|
1046
|
+
Ge as PortalItemPlugin,
|
|
1047
|
+
ce as PortalPool,
|
|
1048
|
+
Se as PortalPoolPlugin,
|
|
1049
|
+
ze as QuickTVUINAddons,
|
|
1050
|
+
Oe as QuickTVUINAddonsConfig,
|
|
1051
|
+
ze as default,
|
|
1052
|
+
je as initAddonEnv,
|
|
1053
|
+
We as initGridTabsGlobalConfig,
|
|
1054
|
+
Ve as provideAddonEnv,
|
|
1055
|
+
Z as useAddonEnv,
|
|
1056
|
+
Ke as useGridTabs,
|
|
951
1057
|
z as withAsyncPlugin
|
|
952
1058
|
};
|