@quicktvui/naddons 1.0.0-beta.0 → 1.0.0-rc.0

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