@quicktvui/naddons 1.0.0-alpha.1 → 1.0.0-alpha.11

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