@quicktvui/naddons 1.0.0-alpha.9 → 1.0.0-beta.1

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