@quicktvui/naddons 1.0.0-alpha.5 → 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.
@@ -1,566 +1,396 @@
1
- import { defineComponent as x, ref as E, openBlock as _, createBlock as S, unref as q, mergeProps as M, withCtx as D, renderSlot as O, computed as ae, resolveComponent as j, normalizeStyle as ue, watch as C, createElementBlock as de, Fragment as me, renderList as fe, shallowRef as H, onMounted as ye, h as N, nextTick as ge } from "vue";
2
- import { useES as be, useESPlugin as pe } from "@extscreen/es3-core";
3
- import { Native as G } from "@extscreen/es3-vue";
4
- const W = /* @__PURE__ */ x({
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(e, { expose: o }) {
12
- const i = E(), t = F(
13
- "GTTabs",
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 o({
17
- scrollToTop: (...r) => {
18
- var n;
19
- return (n = i.value) == null ? void 0 : n.scrollToTop(...r);
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
- }), (r, n) => (_(), S(q(t), M({
32
+ }), (s, l) => (R(), C(M(m), Q({
22
33
  ref_key: "nativeRef",
23
- ref: i,
24
- tabsData: e.tabsData,
25
- actionPayload: e.actionPayload,
26
- onOnTabSelected: n[0] || (n[0] = (a) => r.$emit("onTabSelected", a.nativeEvent)),
27
- onOnTabNeedsData: n[1] || (n[1] = (a) => r.$emit("onTabNeedsData", a.nativeEvent)),
28
- onOnLoadMore: n[2] || (n[2] = (a) => r.$emit("onLoadMore", a.nativeEvent)),
29
- onOnItemPresence: n[3] || (n[3] = (a) => r.$emit("onItemPresence", a.nativeEvent)),
30
- onOnTabFocused: n[4] || (n[4] = (a) => r.$emit("onTabFocused", a.nativeEvent)),
31
- onOnItemClick: n[5] || (n[5] = (a) => r.$emit("onItemClick", a.nativeEvent)),
32
- onOnItemFocused: n[6] || (n[6] = (a) => r.$emit("onItemFocused", a.nativeEvent))
33
- }, r.$attrs), {
34
- default: D(() => [
35
- O(r.$slots, "default")
34
+ ref: c,
35
+ protocolVersion: o.protocolVersion,
36
+ tabsData: o.tabsData,
37
+ actionPayload: o.actionPayload,
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"]));
39
- }
40
- }), ve = x({
41
- name: "PortalItem",
42
- props: {
43
- portalId: {
44
- type: String,
45
- required: !0
46
- },
47
- // 前端必须传入明确的宽高 (由于不支持 100%)
48
- width: {
49
- type: [Number, String],
50
- required: !0
51
- },
52
- height: {
53
- type: [Number, String],
54
- required: !0
55
- }
56
- },
57
- setup(e) {
58
- return {
59
- itemStyle: ae(() => {
60
- const i = typeof e.width == "number" ? `${e.width}px` : e.width, t = typeof e.height == "number" ? `${e.height}px` : e.height;
61
- return {
62
- width: i,
63
- height: t,
64
- display: "flex",
65
- flexDirection: "column"
66
- };
67
- })
68
- };
69
- }
70
- }), le = (e, o) => {
71
- const i = e.__vccOpts || e;
72
- for (const [t, r] of o)
73
- i[t] = r;
74
- return i;
75
- };
76
- function he(e, o, i, t, r, n) {
77
- const a = j("qt-portal-item-native");
78
- return _(), S(a, {
79
- portalId: e.portalId,
80
- style: ue(e.itemStyle)
81
- }, {
82
- default: D(() => [
83
- O(e.$slots, "default")
84
- ]),
85
- _: 3
86
- }, 8, ["portalId", "style"]);
87
- }
88
- const z = /* @__PURE__ */ le(ve, [["render", he]]), Pe = x({
89
- name: "PortalPool",
90
- components: {
91
- PortalItem: z
92
- },
93
- props: {
94
- // 传入原始的数据源
95
- data: {
96
- type: Array,
97
- default: () => []
98
- },
99
- // GridTabs 发出的 presence 状态表 (由父级监听 @onItemPresence 后传入)
100
- // 格式: { [itemId: string]: 'visible' | 'enter' | 'attached' | 'leave' }
101
- presenceMap: {
102
- type: Object,
103
- default: () => ({})
104
- },
105
- // 总宽度,用于计算基于 span 的 px 宽度
106
- gridBasis: {
107
- type: Number,
108
- default: 24
109
- },
110
- totalWidth: {
111
- type: Number,
112
- default: 1920
113
- }
114
- },
115
- setup(e) {
116
- const o = E([]), i = () => {
117
- var r;
118
- const t = [];
119
- for (const n of e.data)
120
- if (n.viewType && n.viewType.startsWith("portal:") && n.portalId) {
121
- const a = e.presenceMap[n.itemId] || "leave";
122
- if (a !== "leave" && a !== "null" && a) {
123
- const p = n.span || e.gridBasis, b = Math.round(e.totalWidth / e.gridBasis * p), I = ((r = n.layoutConfig) == null ? void 0 : r.aspectRatio) || 1, A = Math.round(b / I);
124
- t.push({
125
- ...n,
126
- presenceState: a,
127
- width: b,
128
- height: A
129
- });
130
- }
131
- }
132
- o.value = t;
133
- };
134
- return C(() => e.data, i, { deep: !0, immediate: !0 }), C(() => e.presenceMap, i, { deep: !0 }), {
135
- activePortals: o
136
- };
51
+ }, 16, ["protocolVersion", "tabsData", "actionPayload"]));
137
52
  }
138
53
  });
139
- function Ie(e, o, i, t, r, n) {
140
- const a = j("PortalItem"), p = j("qt-portal-pool-native");
141
- return _(), S(p, { class: "qt-portal-pool-hidden" }, {
142
- default: D(() => [
143
- (_(!0), de(me, null, fe(e.activePortals, (b) => (_(), S(a, {
144
- key: b.portalId,
145
- portalId: b.portalId,
146
- width: b.width,
147
- height: b.height
148
- }, {
149
- default: D(() => [
150
- O(e.$slots, "default", {
151
- portal: b,
152
- presenceState: b.presenceState
153
- })
154
- ]),
155
- _: 2
156
- }, 1032, ["portalId", "width", "height"]))), 128))
157
- ]),
158
- _: 3
159
- });
160
- }
161
- const X = /* @__PURE__ */ le(Pe, [["render", Ie]]);
162
- function Re(e, o) {
163
- const i = E(!1), t = E(!1);
164
- return {
165
- isIntersecting: i,
166
- isVisible: t,
167
- handlePresenceState: (n) => {
168
- var a, p, b;
169
- switch (n) {
170
- case "enter":
171
- i.value = !0, (a = o == null ? void 0 : o.onEnter) == null || a.call(o);
172
- break;
173
- case "visible":
174
- t.value = !0, (p = o == null ? void 0 : o.onVisible) == null || p.call(o);
175
- break;
176
- case "leave":
177
- i.value = !1, t.value = !1, (b = o == null ? void 0 : o.onLeave) == null || b.call(o);
178
- break;
179
- }
180
- }
181
- };
182
- }
183
- function Oe() {
184
- const e = E(""), o = (n) => {
185
- const a = Array.isArray(n) ? n : [n];
186
- e.value = JSON.stringify(a);
187
- };
188
- return {
189
- actionPayloadStr: e,
190
- dispatchAction: o,
191
- updateItem: (n, a) => {
192
- o({
193
- op: "UPDATE_ITEM",
194
- itemId: n,
195
- payload: a
196
- });
197
- },
198
- appendItems: (n, a) => {
199
- o({
200
- op: "APPEND_SUB_ITEMS",
201
- itemId: n,
202
- payload: {
203
- subItems: a
204
- }
205
- });
206
- },
207
- removeItem: (n) => {
208
- o({
209
- op: "REMOVE_ITEM",
210
- itemId: n
211
- });
212
- }
213
- };
214
- }
215
- function Te(e, o) {
216
- if (JSON.stringify(e.page_spec) !== JSON.stringify(o.page_spec) || JSON.stringify(e.navConfig) !== JSON.stringify(o.navConfig))
217
- return "FULL_RELOAD";
218
- const i = e.tabs || [], t = o.tabs || [];
219
- if (i.length !== t.length)
220
- return "FULL_RELOAD";
221
- for (let n = 0; n < t.length; n++)
222
- if (i[n].tabId !== t[n].tabId)
223
- return "FULL_RELOAD";
224
- const r = [];
225
- for (let n = 0; n < t.length; n++) {
226
- const a = i[n].items || [], p = t[n].items || [], b = t[n].tabId, I = new Map(a.map((u) => [u.id || u.itemId, u])), A = new Map(p.map((u) => [u.id || u.itemId, u]));
227
- let $ = -1;
228
- const v = [];
229
- for (let u = 0; u < p.length; u++) {
230
- const y = p[u], h = y.id || y.itemId, l = I.get(h);
231
- if (l) {
232
- const c = a.findIndex((R) => (R.id || R.itemId) === h);
233
- if (c <= $ || ($ = c, l.viewType !== y.viewType || l.span !== y.span))
234
- return "FULL_RELOAD";
235
- const T = JSON.stringify(l.content) !== JSON.stringify(y.content), w = l.state !== y.state;
236
- (T || w) && r.push({
237
- op: "UPDATE_ITEM",
238
- itemId: h,
239
- payload: {
240
- content: T ? y.content : void 0,
241
- state: w ? y.state : void 0
242
- }
243
- });
244
- } else {
245
- let c = !0;
246
- for (let T = u + 1; T < p.length; T++)
247
- if (I.has(p[T].id || p[T].itemId)) {
248
- c = !1;
249
- break;
250
- }
251
- if (!c)
252
- return "FULL_RELOAD";
253
- v.push(y);
254
- }
255
- }
256
- v.length > 0 && r.push({
257
- op: "APPEND_SUB_ITEMS",
258
- itemId: b,
259
- // 追加到对应的 Tab 容器下
260
- payload: { subItems: v }
261
- });
262
- for (const u of a) {
263
- const y = u.id || u.itemId;
264
- A.has(y) || r.push({
265
- op: "REMOVE_ITEM",
266
- itemId: y
267
- });
268
- }
269
- }
270
- return r;
271
- }
272
- function Ne(e) {
273
- const o = E(""), i = E("");
274
- let t = "";
275
- return C(e, (r) => {
276
- if (!r) {
277
- o.value = "", t = "";
278
- return;
279
- }
280
- const n = JSON.stringify(r);
281
- if (n !== t) {
282
- if (!t) {
283
- o.value = n, t = n;
284
- return;
285
- }
286
- try {
287
- const a = JSON.parse(t), p = JSON.parse(n), b = Te(a, p);
288
- b === "FULL_RELOAD" ? (console.log("[@quicktvui/naddons] Auto-Diff: 结构突变,执行全量刷新 (FULL_RELOAD)"), o.value = n) : b.length > 0 && (console.log("[@quicktvui/naddons] Auto-Diff: 命中局部更新,生成 Patch 指令 ->", b), i.value = JSON.stringify(b)), t = n;
289
- } catch (a) {
290
- console.warn("[@quicktvui/naddons] Auto-Diff failed, falling back to FULL_RELOAD", a), o.value = n, t = n;
291
- }
292
- }
293
- }, { deep: !0, immediate: !0 }), {
294
- tabsDataStr: o,
295
- actionPayloadStr: i
296
- };
297
- }
298
- let L;
299
- var ne;
54
+ let z;
55
+ var ae;
300
56
  try {
301
- const e = require("@extscreen/es3-vue");
302
- L = e.registerElement || ((ne = e.default) == null ? void 0 : ne.registerElement);
57
+ const o = require("@extscreen/es3-vue");
58
+ z = o.registerElement || ((ae = o.default) == null ? void 0 : ae.registerElement);
303
59
  } catch {
304
60
  }
305
- const Ee = {
306
- install: (e) => {
307
- globalThis.__GTTabs_registered || (L ? (L("gt-tabs", {
308
- component: {
309
- name: "GTTabs",
310
- processEventData(o, i) {
311
- const t = o.handler || o, r = i || t.nativeParams || {};
312
- return t && (t.nativeEvent = r), t;
313
- }
314
- }
315
- }), L("qt-portal-pool-native", {
316
- component: { name: "QtPortalPool" }
317
- }), L("qt-portal-item-native", {
318
- component: { name: "QtPortalItem" }
319
- }), L("qt-grid-tabs", {
320
- component: {
321
- name: "GTTabs",
322
- defaultNativeProps: {},
323
- processEventData(o, i, t) {
324
- return {
325
- ...o,
326
- ...t
327
- };
328
- }
329
- }
330
- }), globalThis.__GTTabs_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tags for GridTabs & Portals")) : console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")), e.component("GridTabs", W), e.component("gt-tabs", W), e.component("qt-grid-tabs", W), e.component("QtPortalItem", z), e.component("qt-portal-item", z), e.component("QtPortalPool", X), e.component("qt-portal-pool", X);
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);
331
80
  }
332
81
  };
333
- function Le(e, o) {
334
- const i = E(""), t = E(""), r = H([]), n = H([]);
335
- let a = !1, p = !1;
336
- const b = "__virtual_single_tab__", I = E({}), A = (s) => {
337
- const m = Array.isArray(s) ? s : [s];
338
- t.value = JSON.stringify(m);
339
- }, $ = (s, m) => {
340
- if (!s)
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)
341
97
  return !1;
342
- let d = !0;
343
- return s.id || (console.error(`[useGridTabs] ❌ 数据格式错误 (${m}): 卡片缺失必填字段 'id'。每个卡片必须有唯一标识才能进行后续更新!`, s), d = !1), s.viewType || (console.error(`[useGridTabs] ❌ 数据格式错误 (${m}): 卡片缺失必填字段 'viewType' (id: ${s.id || "未知"})。必须指定 Native 注册的视图类型或 Portal 标识!`, s), d = !1), d;
344
- }, v = (s, m) => {
345
- if (!s)
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)
346
102
  return !1;
347
- let d = !0;
348
- return s.tabId || (console.error(`[useGridTabs] ❌ 数据格式错误 (${m}): Tab 缺失必填字段 'tabId'。每个 Tab 必须有唯一标识!`, s), d = !1), (s.title === void 0 || s.title === null) && console.warn(`[useGridTabs] ⚠️ 数据格式警告 (${m}): Tab 缺失 'title' 字段 (tabId: ${s.tabId || "未知"}),导航栏可能显示为空。`, s), d;
349
- }, u = (s, m) => {
350
- if (!s || s.length === 0)
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)
351
107
  return;
352
- const d = s[0].hasOwnProperty("tabId") || s[0].hasOwnProperty("items") && Array.isArray(s[0].items);
353
- a = m === "1d", m === "1d" && d ? console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `items.value` (一维瀑布流) 赋值二维 Tabs 数据结构!请改用 `tabs.value = ...`") : m === "2d" && !d && console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `tabs.value` (二维导航) 赋值一维卡片列表数据结构!请改用 `items.value = ...`"), m === "1d" ? s.forEach((g, f) => $(g, `items.value[${f}]`)) : s.forEach((g, f) => {
354
- v(g, `tabs.value[${f}]`), g.items && Array.isArray(g.items) && g.items.forEach((P, k) => $(P, `tabs.value[${f}].items[${k}]`));
355
- }), p = !0, y();
356
- }, y = () => {
357
- if (!p)
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");
358
116
  return;
359
- let s = {
360
- gridBasis: (o == null ? void 0 : o.gridBasis) ?? 30,
361
- unitType: (o == null ? void 0 : o.unitType) ?? "px",
362
- layoutConfig: (o == null ? void 0 : o.layoutConfig) ?? {
363
- screenPadding: { left: 60, right: 60, top: 0, bottom: 60 },
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],
364
123
  navContentGapNormal: 0,
365
124
  itemGap: 24
366
125
  },
367
- navConfig: (o == null ? void 0 : o.navConfig) ?? {
368
- placement: "left",
126
+ navConfig: (r == null ? void 0 : r.navConfig) ?? {
127
+ dock: "left",
369
128
  mode: "fixed",
370
- renderType: "classic",
371
- baseSize: 200,
372
- expandedSize: 300
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"
373
142
  },
374
- referenceResolution: (o == null ? void 0 : o.referenceResolution) ?? { w: 1920, h: 1080 }
375
- }, m = [];
376
- a ? (s.navConfig = { ...s.navConfig, renderType: "none" }, m = [
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 = [
377
150
  {
378
- tabId: b,
151
+ tabId: m,
379
152
  title: "Virtual Tab",
380
153
  hidden: !0,
381
- items: n.value
154
+ items: g.value
382
155
  }
383
- ]) : m = r.value, i.value = JSON.stringify({
384
- page_spec: s,
385
- tabs: m
156
+ ]) : n = v.value;
157
+ const i = JSON.stringify({
158
+ page_spec: t,
159
+ tabs: n
386
160
  });
387
- }, h = (s, m) => new Proxy(s, {
388
- get(d, g, f) {
389
- return g === "push" ? (...P) => {
390
- P.forEach((V, ce) => $(V, `push(${ce})`)), p || console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");
391
- const k = Array.prototype.push.apply(d, P);
392
- return A({
393
- op: "APPEND_SUB_ITEMS",
394
- itemId: m,
395
- payload: { subItems: P }
396
- }), k;
397
- } : Reflect.get(d, g, f);
398
- },
399
- set(d, g, f, P) {
400
- if (g !== "length" && !isNaN(Number(g))) {
401
- p || console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(g)}]。请先对 items.value 或 tabs.value 进行全量赋值!`), $(f, `索引赋值 [${String(g)}]`);
402
- const k = Reflect.set(d, g, f, P);
403
- return f && f.id && A({
404
- op: "UPDATE_ITEM",
405
- itemId: f.id,
406
- payload: f
407
- }), k;
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
408
168
  }
409
- return Reflect.set(d, g, f, P);
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;
410
187
  }
411
- }), l = (s) => (s.items && Array.isArray(s.items) && !s.items.__isGridTabsProxy && (s.items = h(s.items, s.tabId), Object.defineProperty(s.items, "__isGridTabsProxy", { value: !0, enumerable: !1 })), new Proxy(s, {
412
- set(m, d, g, f) {
413
- if (d === "items") {
414
- let P = g;
415
- Array.isArray(g) && !g.__isGridTabsProxy && (P = h(g, m.tabId), Object.defineProperty(P, "__isGridTabsProxy", { value: !0, enumerable: !1 }));
416
- const k = Reflect.set(m, d, P, f);
417
- return y(), k;
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);
418
214
  }
419
- return Reflect.set(m, d, g, f);
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);
420
225
  }
421
- })), c = (s) => {
422
- const m = s.map((d) => l(d));
423
- return new Proxy(m, {
424
- set(d, g, f, P) {
425
- if (g !== "length" && !isNaN(Number(g))) {
426
- let k = f;
427
- f.__isGridTabsProxy || (k = l(f), Object.defineProperty(k, "__isGridTabsProxy", { value: !0, enumerable: !1 }));
428
- const V = Reflect.set(d, g, k, P);
429
- return y(), V;
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(), $;
430
235
  }
431
- return Reflect.set(d, g, f, P);
236
+ return Reflect.set(n, i, u, f);
432
237
  }
433
238
  });
434
239
  };
435
- C(r, (s, m) => {
436
- if (!s || s.length === 0) {
437
- i.value = "", p = !1;
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;
438
243
  return;
439
244
  }
440
- if (s.__isGridTabsProxy)
441
- y();
245
+ if (e.__isGridTabsProxy)
246
+ console.log("[useGridTabs] newTabs is ALREADY a proxy, triggering root update"), T();
442
247
  else {
443
- u(s, "2d");
444
- const d = c(s);
445
- Object.defineProperty(d, "__isGridTabsProxy", { value: !0, enumerable: !1 }), r.value = d;
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();
446
251
  }
447
- }, { flush: "sync" }), C(n, (s, m) => {
448
- if (!s || s.length === 0) {
449
- i.value = "", p = !1;
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;
450
255
  return;
451
256
  }
452
- if (s.__isGridTabsProxy)
453
- y();
257
+ if (e.__isGridTabsProxy)
258
+ console.log("[useGridTabs] newItems is ALREADY a proxy, triggering root update"), T();
454
259
  else {
455
- u(s, "1d");
456
- const d = h(s, b);
457
- Object.defineProperty(d, "__isGridTabsProxy", { value: !0, enumerable: !1 }), n.value = d;
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();
458
263
  }
459
264
  }, { flush: "sync" });
460
- const T = (s) => {
461
- if (!s || s.length === 0) {
462
- i.value = "", p = !1;
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;
463
270
  return;
464
271
  }
465
- s[0].hasOwnProperty("tabId") || s[0].hasOwnProperty("items") && Array.isArray(s[0].items) ? r.value = s : n.value = s;
466
- }, w = (s) => {
467
- I.value = s;
468
- }, R = ae(() => ({
469
- tabsData: i.value,
470
- actionPayload: t.value,
471
- onTabNeedsData: async (s) => {
472
- if (!I.value.onTabNeedsData)
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} 已经发起过请求,防止死循环`);
473
285
  return;
474
- const { tabId: m, index: d, reason: g } = s, f = await I.value.onTabNeedsData(m, d, g);
475
- if (f && Array.isArray(f)) {
476
- const P = r.value.find((k) => k.tabId === m);
477
- P && (P.items = f);
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);
478
296
  }
479
297
  },
480
- onLoadMore: async (s) => {
481
- if (!I.value.onLoadMore)
298
+ onLoadMore: async (...e) => {
299
+ let t = e[0];
300
+ if (t && t.nativeEvent && (t = t.nativeEvent), !s.value.onLoadMore)
482
301
  return;
483
- const { tabId: m, cursor: d, itemId: g } = s, f = await I.value.onLoadMore(m, d, g);
302
+ const { tabId: n, cursor: i, itemId: u } = t, f = await s.value.onLoadMore(n, i, u);
484
303
  if (f && Array.isArray(f) && f.length > 0)
485
- if (a)
486
- n.value.push(...f);
304
+ if (y)
305
+ g.value.push(...f);
487
306
  else {
488
- const P = r.value.find((k) => k.tabId === m);
489
- P && P.items && P.items.push(...f);
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);
490
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);
491
357
  }
492
358
  }));
493
359
  return {
494
- tabsDataStr: i,
495
- actionPayloadStr: t,
496
- bindings: R,
497
- tabs: r,
498
- items: n,
499
- initData: T,
500
- setCallbacks: w,
501
- dispatchAction: A
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
502
391
  };
503
392
  }
504
- const Y = /* @__PURE__ */ x({
505
- __name: "RatingBar",
506
- props: {
507
- numStars: {},
508
- rating: {},
509
- stepSize: {},
510
- isIndicator: { type: Boolean }
511
- },
512
- emits: ["onRatingChanged"],
513
- setup(e) {
514
- const o = E(), i = F(
515
- "QtRatingBar",
516
- "com.quicktvui.plugin.extraui",
517
- "com.quicktvui.plugin.extraui.ExtraUIPluginApp"
518
- );
519
- return (t, r) => (_(), S(q(i), M({
520
- ref_key: "nativeRef",
521
- ref: o,
522
- numStars: e.numStars,
523
- rating: e.rating,
524
- stepSize: e.stepSize,
525
- isIndicator: e.isIndicator,
526
- onOnRatingChanged: r[0] || (r[0] = (n) => t.$emit("onRatingChanged", n.nativeEvent))
527
- }, t.$attrs), {
528
- default: D(() => [
529
- O(t.$slots, "default")
530
- ]),
531
- _: 3
532
- }, 16, ["numStars", "rating", "stepSize", "isIndicator"]));
533
- }
534
- });
535
- let K;
536
- var oe;
537
- try {
538
- const e = require("@extscreen/es3-vue");
539
- K = e.registerElement || ((oe = e.default) == null ? void 0 : oe.registerElement);
540
- } catch {
541
- }
542
- const ke = {
543
- install: (e) => {
544
- globalThis.__QtRatingBar_registered || (K ? (K("qt-rating-bar", {
545
- component: {
546
- name: "QtRatingBar",
547
- // 关键:将前端标签映射到真正的 Native 组件名
548
- processEventData(o, i) {
549
- const t = o.handler || o, r = i || (t == null ? void 0 : t.nativeParams) || {};
550
- return t && (t.nativeEvent = r), t;
551
- }
552
- }
553
- }), K("QtRatingBar", {
554
- component: {
555
- name: "QtRatingBar",
556
- processEventData(o, i) {
557
- const t = o.handler || o, r = i || (t == null ? void 0 : t.nativeParams) || {};
558
- return t && (t.nativeEvent = r), t;
559
- }
560
- }
561
- }), globalThis.__QtRatingBar_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtRatingBar")) : console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")), e.component("RatingBar", Y), e.component("qt-rating-bar", Y);
562
- }
563
- }, Z = /* @__PURE__ */ x({
393
+ const te = "QtKeyboard", ne = /* @__PURE__ */ D({
564
394
  __name: "Keyboard",
565
395
  props: {
566
396
  backgroundColor: {},
@@ -576,177 +406,179 @@ const ke = {
576
406
  currentInput: {}
577
407
  },
578
408
  emits: ["onInputChanged", "onKeyPressed"],
579
- setup(e) {
580
- const o = E(), i = F(
581
- "QtKeyboard",
582
- "com.quicktvui.plugin.extraui",
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",
583
413
  "com.quicktvui.plugin.extraui.ExtraUIPluginApp"
584
414
  );
585
- return (t, r) => (_(), S(q(i), M({
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({
586
421
  ref_key: "nativeRef",
587
- ref: o,
588
- backgroundColor: e.backgroundColor,
589
- textColor: e.textColor,
590
- weakTextColor: e.weakTextColor,
591
- focusBackgroundColor: e.focusBackgroundColor,
592
- focusTextColor: e.focusTextColor,
593
- placeholder: e.placeholder,
594
- textFullKeyboard: e.textFullKeyboard,
595
- textT9Keyboard: e.textT9Keyboard,
596
- textClear: e.textClear,
597
- textDelete: e.textDelete,
598
- currentInput: e.currentInput,
599
- onOnInputChanged: r[0] || (r[0] = (n) => t.$emit("onInputChanged", n.nativeEvent)),
600
- onOnKeyPressed: r[1] || (r[1] = (n) => t.$emit("onKeyPressed", n.nativeEvent))
601
- }, t.$attrs), {
602
- default: D(() => [
603
- O(t.$slots, "default")
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")
604
439
  ]),
605
440
  _: 3
606
441
  }, 16, ["backgroundColor", "textColor", "weakTextColor", "focusBackgroundColor", "focusTextColor", "placeholder", "textFullKeyboard", "textT9Keyboard", "textClear", "textDelete", "currentInput"]));
607
442
  }
608
443
  });
609
- let Q;
610
- var re;
444
+ let W;
445
+ var le;
611
446
  try {
612
- const e = require("@extscreen/es3-vue");
613
- Q = e.registerElement || ((re = e.default) == null ? void 0 : re.registerElement);
447
+ const o = require("@extscreen/es3-vue");
448
+ W = o.registerElement || ((le = o.default) == null ? void 0 : le.registerElement);
614
449
  } catch {
615
450
  }
616
- const we = {
617
- install: (e) => {
618
- globalThis.__QtKeyboard_registered || (Q ? (Q("qt-keyboard", {
619
- component: {
620
- name: "QtKeyboard",
621
- // 关键:将前端标签映射到真正的 Native 组件名
622
- processEventData(o, i) {
623
- const t = o.handler || o, r = i || (t == null ? void 0 : t.nativeParams) || {};
624
- return t && (t.nativeEvent = r), t;
625
- }
626
- }
627
- }), Q("QtKeyboard", {
628
- component: {
629
- name: "QtKeyboard",
630
- processEventData(o, i) {
631
- const t = o.handler || o, r = i || (t == null ? void 0 : t.nativeParams) || {};
632
- return t && (t.nativeEvent = r), t;
633
- }
634
- }
635
- }), globalThis.__QtKeyboard_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtKeyboard")) : console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")), e.component("Keyboard", Z), e.component("qt-keyboard", Z);
451
+ const Ae = {
452
+ install: (o) => {
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);
636
470
  }
637
- }, ee = /* @__PURE__ */ x({
638
- __name: "NumericKeyboard",
639
- props: {
640
- maxLength: {}
641
- },
642
- emits: ["onNumberPressed"],
643
- setup(e) {
644
- const o = E(), i = F(
645
- "QtNumericKeyboard",
646
- "com.quicktvui.plugin.extraui",
647
- "com.quicktvui.plugin.extraui.ExtraUIPluginApp"
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"
648
477
  );
649
- return (t, r) => (_(), S(q(i), M({
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;
482
+ }
483
+ }), (s, l) => (R(), C(M(m), Q({
650
484
  ref_key: "nativeRef",
651
- ref: o,
652
- maxLength: e.maxLength,
653
- onOnNumberPressed: r[0] || (r[0] = (n) => t.$emit("onNumberPressed", n.nativeEvent))
654
- }, t.$attrs), {
655
- default: D(() => [
656
- O(t.$slots, "default")
485
+ ref: c
486
+ }, s.$attrs), {
487
+ default: q(() => [
488
+ F(s.$slots, "default")
657
489
  ]),
658
490
  _: 3
659
- }, 16, ["maxLength"]));
491
+ }, 16));
660
492
  }
661
493
  });
662
- let B;
663
- var se;
494
+ let Z;
495
+ var ce;
664
496
  try {
665
- const e = require("@extscreen/es3-vue");
666
- B = e.registerElement || ((se = e.default) == null ? void 0 : se.registerElement);
497
+ const o = require("@extscreen/es3-vue");
498
+ Z = o.registerElement || ((ce = o.default) == null ? void 0 : ce.registerElement);
667
499
  } catch {
668
500
  }
669
- const Ae = {
670
- install: (e) => {
671
- globalThis.__QtNumericKeyboard_registered || (B ? (B("qt-numeric-keyboard", {
672
- component: {
673
- name: "QtNumericKeyboard",
674
- // 关键:将前端标签映射到真正的 Native 组件名
675
- processEventData(o, i) {
676
- const t = o.handler || o, r = i || (t == null ? void 0 : t.nativeParams) || {};
677
- return t && (t.nativeEvent = r), t;
678
- }
679
- }
680
- }), B("QtNumericKeyboard", {
681
- component: {
682
- name: "QtNumericKeyboard",
683
- processEventData(o, i) {
684
- const t = o.handler || o, r = i || (t == null ? void 0 : t.nativeParams) || {};
685
- return t && (t.nativeEvent = r), t;
686
- }
687
- }
688
- }), globalThis.__QtNumericKeyboard_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtNumericKeyboard")) : console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")), e.component("NumericKeyboard", ee), e.component("qt-numeric-keyboard", ee);
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);
689
520
  }
690
- }, te = /* @__PURE__ */ x({
691
- __name: "DatePicker",
521
+ }, re = "QtPortalItem", ie = /* @__PURE__ */ D({
522
+ __name: "PortalItem",
692
523
  props: {
693
- initialDate: {}
524
+ portalId: {}
694
525
  },
695
- emits: ["onDateChanged"],
696
- setup(e) {
697
- const o = E(), i = F(
698
- "QtDatePicker",
699
- "com.quicktvui.plugin.extraui",
700
- "com.quicktvui.plugin.extraui.ExtraUIPluginApp"
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"
701
530
  );
702
- return (t, r) => (_(), S(q(i), M({
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;
535
+ }
536
+ }), (s, l) => (R(), C(M(m), Q({
703
537
  ref_key: "nativeRef",
704
- ref: o,
705
- initialDate: e.initialDate,
706
- onOnDateChanged: r[0] || (r[0] = (n) => t.$emit("onDateChanged", n.nativeEvent))
707
- }, t.$attrs), {
708
- default: D(() => [
709
- O(t.$slots, "default")
538
+ ref: c,
539
+ portalId: o.portalId
540
+ }, s.$attrs), {
541
+ default: q(() => [
542
+ F(s.$slots, "default")
710
543
  ]),
711
544
  _: 3
712
- }, 16, ["initialDate"]));
545
+ }, 16, ["portalId"]));
713
546
  }
714
547
  });
715
- let U;
716
- var ie;
548
+ let J;
549
+ var ue;
717
550
  try {
718
- const e = require("@extscreen/es3-vue");
719
- U = e.registerElement || ((ie = e.default) == null ? void 0 : ie.registerElement);
551
+ const o = require("@extscreen/es3-vue");
552
+ J = o.registerElement || ((ue = o.default) == null ? void 0 : ue.registerElement);
720
553
  } catch {
721
554
  }
722
- const $e = {
723
- install: (e) => {
724
- globalThis.__QtDatePicker_registered || (U ? (U("qt-date-picker", {
725
- component: {
726
- name: "QtDatePicker",
727
- // 关键:将前端标签映射到真正的 Native 组件名
728
- processEventData(o, i) {
729
- const t = o.handler || o, r = i || (t == null ? void 0 : t.nativeParams) || {};
730
- return t && (t.nativeEvent = r), t;
731
- }
732
- }
733
- }), U("QtDatePicker", {
734
- component: {
735
- name: "QtDatePicker",
736
- processEventData(o, i) {
737
- const t = o.handler || o, r = i || (t == null ? void 0 : t.nativeParams) || {};
738
- return t && (t.nativeEvent = r), t;
739
- }
740
- }
741
- }), globalThis.__QtDatePicker_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtDatePicker")) : console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")), e.component("DatePicker", te), e.component("qt-date-picker", te);
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);
742
574
  }
743
- }, _e = {
575
+ }, Ne = {
744
576
  // 如果设置为 true,则全局跳过所有组件的原生插件安装检查,直接渲染
745
577
  skipPluginCheck: !1
746
- }, J = /* @__PURE__ */ new Set();
747
- function F(e, o, i) {
748
- return x({
749
- name: `${e}AsyncWrapper`,
578
+ }, B = /* @__PURE__ */ new Set();
579
+ function L(o, r, c) {
580
+ return D({
581
+ name: `${o}AsyncWrapper`,
750
582
  inheritAttrs: !1,
751
583
  props: {
752
584
  // 允许单个组件级别跳过检查
@@ -755,187 +587,197 @@ function F(e, o, i) {
755
587
  default: !1
756
588
  }
757
589
  },
758
- setup(t, { slots: r, attrs: n }) {
759
- const a = E("loading"), p = E("");
760
- let b = null, I = null;
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;
761
600
  try {
762
- b = be(), I = pe();
763
- } catch (v) {
764
- console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。", v);
601
+ k = de(), T = Te();
602
+ } catch (b) {
603
+ console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。", b);
765
604
  }
766
- const A = async () => {
767
- if (!b || typeof b.isComponentRegistered != "function")
605
+ const S = async () => {
606
+ if (!k || typeof k.isComponentRegistered != "function")
768
607
  return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"), !1;
769
608
  try {
770
- const v = await b.isComponentRegistered(e);
771
- if (console.log(`[withAsyncPlugin] isComponentRegistered('${e}') 返回:`, v), v === !0 || v && typeof v == "object" && (v.registered === !0 || v.isRegistered === !0))
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))
772
611
  return !0;
773
612
  try {
774
- const u = await G.callNativeWithPromise("ExtendModule", "getCoreSDKInfo");
775
- if (u && u.core_version) {
776
- const y = u.core_version;
777
- console.log(`[withAsyncPlugin] 当前引擎核心版本: ${y}`);
778
- const h = y.split(".").map((l) => parseInt(l, 10));
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));
779
618
  if (h.length >= 3 && !isNaN(h[0]) && !isNaN(h[1]) && !isNaN(h[2]))
780
619
  if (h[0] * 1e6 + h[1] * 1e3 + h[2] >= 1011205) {
781
- console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${e}`);
782
- const c = e.split("-").map((R) => R.charAt(0).toUpperCase() + R.slice(1)).join("");
783
- console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${e}, ${c}`);
784
- const [T, w] = await Promise.all([
785
- G.callNativeWithPromise("ExtendModule", "isComponentRegistered", e).catch(() => !1),
786
- G.callNativeWithPromise("ExtendModule", "isComponentRegistered", c).catch(() => !1)
620
+ console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${o}`);
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)
787
626
  ]);
788
- if (console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${T}, ${w}]`), T === !0 || w === !0)
627
+ if (console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${N}, ${e}]`), N === !0 || e === !0)
789
628
  return !0;
790
629
  } else
791
- console.log(`[withAsyncPlugin] 引擎版本 ${y} < 1.11.205,跳过 ExtendModule 检查`);
630
+ console.log(`[withAsyncPlugin] 引擎版本 ${A} < 1.11.205,跳过 ExtendModule 检查`);
792
631
  else
793
- console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${y}`);
632
+ console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${A}`);
794
633
  }
795
- } catch (u) {
796
- console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:", u);
634
+ } catch (P) {
635
+ console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:", P);
797
636
  }
798
637
  return !1;
799
- } catch (v) {
800
- return console.warn("[withAsyncPlugin] 检查组件注册状态异常:", v), !1;
638
+ } catch (b) {
639
+ return console.warn("[withAsyncPlugin] 检查组件注册状态异常:", b), !1;
801
640
  }
802
- }, $ = async () => {
803
- if (_e.skipPluginCheck || t.skipPluginCheck) {
804
- console.log(`[withAsyncPlugin] 跳过 ${e} 插件检查 (skipPluginCheck = true)`), a.value = "ready";
641
+ }, O = async () => {
642
+ if (Ne.skipPluginCheck || v.skipPluginCheck) {
643
+ console.log(`[withAsyncPlugin] 跳过 ${o} 插件检查 (skipPluginCheck = true)`), m.value = "ready";
805
644
  return;
806
645
  }
807
- if (!o) {
808
- a.value = "ready";
646
+ if (!r) {
647
+ m.value = "ready";
809
648
  return;
810
649
  }
811
- const v = await A();
812
- if (console.log(`[withAsyncPlugin] 拦截检查 - ${e} 是否已注册:`, v), v || J.has(o)) {
813
- a.value = "ready", J.add(o), console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");
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] 组件已注册,跳过安装流程");
814
653
  return;
815
654
  }
816
- if (!I) {
817
- console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${e}`), a.value = "ready";
655
+ if (!T) {
656
+ console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${o}`), m.value = "ready";
818
657
  return;
819
658
  }
820
- console.log(`[withAsyncPlugin] 开始动态安装插件: ${o}`);
659
+ console.log(`[withAsyncPlugin] 开始动态安装插件: ${r}`);
821
660
  try {
822
- await new Promise((u, y) => {
661
+ await new Promise((P, A) => {
823
662
  let h;
824
- const l = {
825
- onPluginInstallSuccess(c, T, w) {
826
- c === o && (clearTimeout(h), I.removeListener(l), console.log(`[withAsyncPlugin] 安装成功 pkg=${c} 状态码=${T}`), T == 1003 || T == 1001 ? (i ? (console.log(`[withAsyncPlugin] 触发反射初始化: ${i}`), G.callNative("EsNativeModule", "callReflect", {
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", {
827
666
  entry: {
828
- from: i,
667
+ from: c,
829
668
  method: "setup"
830
669
  }
831
- })) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"), u()) : y(new Error(`安装失败 pkg=${c} status=${T} msg=${w}`)));
670
+ })) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"), P()) : A(new Error(`安装失败 pkg=${E} status=${N} msg=${e}`)));
832
671
  },
833
- onPluginInstallError(c, T, w) {
834
- c === o && (clearTimeout(h), I.removeListener(l), y(new Error(`安装失败 pkg=${c} status=${T} msg=${w}`)));
672
+ onPluginInstallError(E, N, e) {
673
+ E === r && (clearTimeout(h), T.removeListener(I), A(new Error(`安装失败 pkg=${E} status=${N} msg=${e}`)));
835
674
  }
836
675
  };
837
- I.addListener({ pkg: o }, l), h = setTimeout(() => {
838
- I.removeListener(l), y(new Error(`插件安装超时: ${o}`));
839
- }, 8e3), typeof I.installPlugin == "function" ? I.installPlugin({ pkg: o }) : typeof I.install == "function" ? I.install(o) : y(new Error("当前运行时不支持 install / installPlugin"));
840
- }), await ge(), J.add(o), a.value = "ready";
841
- } catch (u) {
842
- console.error("[withAsyncPlugin] 插件加载失败:", u), p.value = (u == null ? void 0 : u.message) || String(u), a.value = "error";
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";
843
682
  }
844
683
  };
845
- return ye(() => {
846
- $();
684
+ return be(() => {
685
+ O();
847
686
  }), () => {
848
- const v = {
687
+ const b = {
849
688
  display: "flex",
850
689
  flexDirection: "column",
851
690
  justifyContent: "center",
852
691
  alignItems: "center",
853
- ...n.style || {}
854
- }, u = n.class ? `qt-plugin-container ${n.class}` : "qt-plugin-container";
855
- if (a.value === "loading")
856
- return N("div", { class: u, style: v }, [
857
- N("div", { style: { color: "white", fontSize: "30px" } }, "插件加载中...")
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" } }, "插件加载中...")
858
697
  ]);
859
- if (a.value === "error")
860
- return N("div", { class: u, style: v }, [
861
- N("div", { style: { color: "white", fontSize: "30px", backgroundColor: "rgba(255,0,0,0.5)" } }, `插件加载失败: ${p.value}`)
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}`)
862
701
  ]);
863
- const y = {};
864
- for (const [l, c] of Object.entries(n)) {
865
- const T = l.startsWith("on") && l !== "onItemPresence" && l !== "onTabSelected" && l !== "onTabNeedsData" && l !== "onLoadMore" && l !== "onTabFocused" && l !== "onItemClick" && l !== "onItemFocused";
866
- l === "class" || l === "style" || !l.startsWith("onOn") && !T && (y[l] = c);
867
- }
868
- const h = {
869
- ...y,
870
- style: { width: "100%", height: "100%", backgroundColor: "transparent" },
871
- onItemPresence: (l) => {
872
- console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onItemPresence:`, l);
873
- const c = n.onOnItemPresence || n.onItemPresence || n["onItem-presence"] || n.onitempresence;
874
- typeof c == "function" && c(l);
875
- },
876
- onTabSelected: (l) => {
877
- console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onTabSelected:`, l);
878
- const c = n.onOnTabSelected || n.onTabSelected || n["onTab-selected"] || n.ontabselected;
879
- typeof c == "function" && c(l);
880
- },
881
- onTabNeedsData: (l) => {
882
- console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onTabNeedsData:`, l);
883
- const c = n.onOnTabNeedsData || n.onTabNeedsData || n["onTab-needs-data"] || n.ontabneedsdata;
884
- typeof c == "function" && c(l);
885
- },
886
- onLoadMore: (l) => {
887
- console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onLoadMore:`, l);
888
- const c = n.onOnLoadMore || n.onLoadMore || n["onLoad-more"] || n.onloadmore;
889
- typeof c == "function" && c(l);
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;
890
718
  },
891
- onTabFocused: (l) => {
892
- console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onTabFocused:`, l);
893
- const c = n.onOnTabFocused || n.onTabFocused || n["onTab-focused"] || n.ontabfocused;
894
- typeof c == "function" && c(l);
895
- },
896
- onItemClick: (l) => {
897
- console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onItemClick:`, l);
898
- const c = n.onOnItemClick || n.onItemClick || n["onItem-click"] || n.onitemclick;
899
- typeof c == "function" && c(l);
900
- },
901
- onItemFocused: (l) => {
902
- console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onItemFocused:`, l);
903
- const c = n.onOnItemFocused || n.onItemFocused || n["onItem-focused"] || n.onitemfocused;
904
- typeof c == "function" && c(l);
905
- }
906
- };
907
- return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:", Object.keys(h)), N("div", { class: u, style: v }, [
908
- N(e, h, r.default ? r.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() : [])
909
723
  ]);
910
724
  };
911
725
  }
912
726
  });
913
727
  }
914
- const Ce = {
915
- install: (e) => {
916
- e.use(Ee), e.use(ke), e.use(we), e.use(Ae), e.use($e);
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 = {
761
+ install: (o) => {
762
+ o.use(he), o.use(Ae), o.use(Ie), o.use(Ee);
917
763
  }
918
764
  };
919
765
  export {
920
- te as DatePicker,
921
- $e as DatePickerPlugin,
922
- W as GridTabs,
923
- Ee as GridTabsPlugin,
924
- Z as Keyboard,
925
- we as KeyboardPlugin,
926
- ee as NumericKeyboard,
927
- Ae as NumericKeyboardPlugin,
928
- z as PortalItem,
929
- X as PortalPool,
930
- Ce as QuickTVUINAddons,
931
- _e as QuickTVUINAddonsConfig,
932
- Y as RatingBar,
933
- ke as RatingBarPlugin,
934
- Ce as default,
935
- Te as diffGridTabsData,
936
- Re as useGridItemPresence,
937
- Le as useGridTabs,
938
- Ne as useGridTabsData,
939
- Oe as useGridTabsUpdater,
940
- F as withAsyncPlugin
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
941
783
  };