@quicktvui/naddons 1.0.0-alpha.3 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/naddons.cjs.js +1 -1
- package/dist/naddons.es.js +168 -141
- package/package.json +1 -1
package/dist/naddons.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),I=require("@extscreen/es3-core"),v=require("@extscreen/es3-vue"),$=l.defineComponent({__name:"GridTabs",props:{tabsData:{},actionPayload:{}},emits:["onTabSelected","onTabNeedsData","onLoadMore","onItemPresence","onTabFocused","onItemClick","onItemFocused"],setup(o,{expose:t}){const u=l.ref(),d=p("QtGridTabs","com.quicktvui.plugin.glintui");return t({scrollToTop:(...a)=>{var n;return(n=u.value)==null?void 0:n.scrollToTop(...a)}}),(a,n)=>(l.openBlock(),l.createBlock(l.unref(d),l.mergeProps({ref_key:"nativeRef",ref:u,tabsData:o.tabsData,actionPayload:o.actionPayload,onOnTabSelected:n[0]||(n[0]=i=>a.$emit("onTabSelected",i.nativeEvent)),onOnTabNeedsData:n[1]||(n[1]=i=>a.$emit("onTabNeedsData",i.nativeEvent)),onOnLoadMore:n[2]||(n[2]=i=>a.$emit("onLoadMore",i.nativeEvent)),onOnItemPresence:n[3]||(n[3]=i=>a.$emit("onItemPresence",i.nativeEvent)),onOnTabFocused:n[4]||(n[4]=i=>a.$emit("onTabFocused",i.nativeEvent)),onOnItemClick:n[5]||(n[5]=i=>a.$emit("onItemClick",i.nativeEvent)),onOnItemFocused:n[6]||(n[6]=i=>a.$emit("onItemFocused",i.nativeEvent))},a.$attrs),{default:l.withCtx(()=>[l.renderSlot(a.$slots,"default")]),_:3},16,["tabsData","actionPayload"]))}});function F(o,t){const u=l.ref(!1),d=l.ref(!1);return{isIntersecting:u,isVisible:d,handlePresenceState:n=>{var i,P,b;switch(n){case"enter":u.value=!0,(i=t==null?void 0:t.onEnter)==null||i.call(t);break;case"visible":d.value=!0,(P=t==null?void 0:t.onVisible)==null||P.call(t);break;case"leave":u.value=!1,d.value=!1,(b=t==null?void 0:t.onLeave)==null||b.call(t);break}}}}let w;var E;try{const o=require("@extscreen/es3-vue");w=o.registerElement||((E=o.default)==null?void 0:E.registerElement)}catch{}const S={install:o=>{globalThis.__QtGridTabs_registered||(w?(w("qt-grid-tabs",{component:{name:"QtGridTabs",processEventData(t,u,d){return console.log(`[GridTabs/index.ts] qt-grid-tabs 收到原生事件: ${u}, 数据:`,d),t.nativeEvent=d,t}}}),w("QtGridTabs",{component:{name:"QtGridTabs",processEventData(t,u,d){return console.log(`[GridTabs/index.ts] QtGridTabs 收到原生事件: ${u}, 数据:`,d),t.nativeEvent=d,t}}}),globalThis.__QtGridTabs_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtGridTabs")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),o.component("GridTabs",$),o.component("qt-grid-tabs",$)}},T=new Set;function p(o,t,u){return l.defineComponent({name:`${o}AsyncWrapper`,inheritAttrs:!1,setup(d,{slots:a,attrs:n}){const i=l.ref("loading"),P=l.ref("");let b=null,m=null;try{b=I.useES(),m=I.useESPlugin()}catch(r){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",r)}const M=async()=>{if(!b||typeof b.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const r=await b.isComponentRegistered(o);if(console.log(`[withAsyncPlugin] isComponentRegistered('${o}') 返回:`,r),r===!0||r&&typeof r=="object"&&(r.registered===!0||r.isRegistered===!0))return!0;try{const c=await v.Native.callNativeWithPromise("ExtendModule","getCoreSDKInfo");if(c&&c.core_version){const f=c.core_version;console.log(`[withAsyncPlugin] 当前引擎核心版本: ${f}`);const e=f.split(".").map(s=>parseInt(s,10));if(e.length>=3&&!isNaN(e[0])&&!isNaN(e[1])&&!isNaN(e[2]))if(e[0]*1e6+e[1]*1e3+e[2]>=1011205){console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${o}`);const g=o.split("-").map(A=>A.charAt(0).toUpperCase()+A.slice(1)).join("");console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${o}, ${g}`);const[y,h]=await Promise.all([v.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",o).catch(()=>!1),v.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",g).catch(()=>!1)]);if(console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${y}, ${h}]`),y===!0||h===!0)return!0}else console.log(`[withAsyncPlugin] 引擎版本 ${f} < 1.11.205,跳过 ExtendModule 检查`);else console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${f}`)}}catch(c){console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",c)}return!1}catch(r){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",r),!1}},O=async()=>{if(!t){i.value="ready";return}const r=await M();if(console.log(`[withAsyncPlugin] 拦截检查 - ${o} 是否已注册:`,r),r||T.has(t)){i.value="ready",T.add(t),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!m){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${o}`),i.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${t}`);try{await new Promise((c,f)=>{let e;const s={onPluginInstallSuccess(g,y,h){g===t&&(clearTimeout(e),m.removeListener(s),console.log(`[withAsyncPlugin] 安装成功 pkg=${g} 状态码=${y}`),y==1003||y==1001?(u?(console.log(`[withAsyncPlugin] 触发反射初始化: ${u}`),v.Native.callNative("EsNativeModule","callReflect",{entry:{from:u,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),c()):f(new Error(`安装失败 pkg=${g} status=${y} msg=${h}`)))},onPluginInstallError(g,y,h){g===t&&(clearTimeout(e),m.removeListener(s),f(new Error(`安装失败 pkg=${g} status=${y} msg=${h}`)))}};m.addListener({pkg:t},s),e=setTimeout(()=>{m.removeListener(s),f(new Error(`插件安装超时: ${t}`))},8e3),typeof m.installPlugin=="function"?m.installPlugin({pkg:t}):typeof m.install=="function"?m.install(t):f(new Error("当前运行时不支持 install / installPlugin"))}),await l.nextTick(),T.add(t),i.value="ready"}catch(c){console.error("[withAsyncPlugin] 插件加载失败:",c),P.value=(c==null?void 0:c.message)||String(c),i.value="error"}};return l.onMounted(()=>{O()}),()=>{const r={width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...n.style||{}};if(i.value==="loading")return l.h("div",{class:"qt-plugin-container",style:r},[l.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]);if(i.value==="error")return l.h("div",{class:"qt-plugin-container",style:r},[l.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${P.value}`)]);const c={};for(const[e,s]of Object.entries(n)){const g=e.startsWith("on")&&e!=="onItemPresence"&&e!=="onTabSelected"&&e!=="onTabNeedsData"&&e!=="onLoadMore"&&e!=="onTabFocused"&&e!=="onItemClick"&&e!=="onItemFocused";!e.startsWith("onOn")&&!g&&(c[e]=s)}const f={...c,style:{width:"1920px",height:"1080px",backgroundColor:"transparent"},onItemPresence:e=>{console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onItemPresence:`,e);const s=n.onOnItemPresence||n.onItemPresence||n.onitempresence;typeof s=="function"&&s(e)},onTabSelected:e=>{console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onTabSelected:`,e);const s=n.onOnTabSelected||n.onTabSelected;typeof s=="function"&&s(e)},onTabNeedsData:e=>{console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onTabNeedsData:`,e);const s=n.onOnTabNeedsData||n.onTabNeedsData;typeof s=="function"&&s(e)},onLoadMore:e=>{console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onLoadMore:`,e);const s=n.onOnLoadMore||n.onLoadMore;typeof s=="function"&&s(e)},onTabFocused:e=>{console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onTabFocused:`,e);const s=n.onOnTabFocused||n.onTabFocused;typeof s=="function"&&s(e)},onItemClick:e=>{console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onItemClick:`,e);const s=n.onOnItemClick||n.onItemClick;typeof s=="function"&&s(e)},onItemFocused:e=>{console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onItemFocused:`,e);const s=n.onOnItemFocused||n.onItemFocused;typeof s=="function"&&s(e)}};return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:",Object.keys(f)),l.h("div",{class:"qt-plugin-container",style:r},[l.h(o,f,a.default?a.default():[])])}}})}const C={install:o=>{o.use(S)}};exports.GridTabs=$;exports.GridTabsPlugin=S;exports.QuickTVUINAddons=C;exports.default=C;exports.useGridItemPresence=F;exports.withAsyncPlugin=p;
|
package/dist/naddons.es.js
CHANGED
|
@@ -1,232 +1,259 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useES as
|
|
3
|
-
import { Native as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as p, ref as P, openBlock as M, createBlock as F, unref as O, mergeProps as D, withCtx as k, renderSlot as G, onMounted as R, h, nextTick as L } from "vue";
|
|
2
|
+
import { useES as x, useESPlugin as q } from "@extscreen/es3-core";
|
|
3
|
+
import { Native as v } from "@extscreen/es3-vue";
|
|
4
|
+
const E = /* @__PURE__ */ p({
|
|
5
5
|
__name: "GridTabs",
|
|
6
6
|
props: {
|
|
7
7
|
tabsData: {},
|
|
8
8
|
actionPayload: {}
|
|
9
9
|
},
|
|
10
10
|
emits: ["onTabSelected", "onTabNeedsData", "onLoadMore", "onItemPresence", "onTabFocused", "onItemClick", "onItemFocused"],
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
11
|
+
setup(o, { expose: t }) {
|
|
12
|
+
const a = P(), u = W(
|
|
13
13
|
"QtGridTabs",
|
|
14
14
|
"com.quicktvui.plugin.glintui"
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return e({
|
|
22
|
-
scrollToTop: (...a) => {
|
|
23
|
-
var t;
|
|
24
|
-
return (t = d.value) == null ? void 0 : t.scrollToTop(...a);
|
|
15
|
+
);
|
|
16
|
+
return t({
|
|
17
|
+
scrollToTop: (...c) => {
|
|
18
|
+
var n;
|
|
19
|
+
return (n = a.value) == null ? void 0 : n.scrollToTop(...c);
|
|
25
20
|
}
|
|
26
|
-
}), (
|
|
21
|
+
}), (c, n) => (M(), F(O(u), D({
|
|
27
22
|
ref_key: "nativeRef",
|
|
28
|
-
ref:
|
|
29
|
-
tabsData:
|
|
30
|
-
actionPayload:
|
|
31
|
-
onOnTabSelected:
|
|
32
|
-
onOnTabNeedsData:
|
|
33
|
-
onOnLoadMore:
|
|
34
|
-
onOnItemPresence:
|
|
35
|
-
onOnTabFocused:
|
|
36
|
-
onOnItemClick:
|
|
37
|
-
onOnItemFocused:
|
|
38
|
-
},
|
|
39
|
-
default:
|
|
40
|
-
|
|
23
|
+
ref: a,
|
|
24
|
+
tabsData: o.tabsData,
|
|
25
|
+
actionPayload: o.actionPayload,
|
|
26
|
+
onOnTabSelected: n[0] || (n[0] = (l) => c.$emit("onTabSelected", l.nativeEvent)),
|
|
27
|
+
onOnTabNeedsData: n[1] || (n[1] = (l) => c.$emit("onTabNeedsData", l.nativeEvent)),
|
|
28
|
+
onOnLoadMore: n[2] || (n[2] = (l) => c.$emit("onLoadMore", l.nativeEvent)),
|
|
29
|
+
onOnItemPresence: n[3] || (n[3] = (l) => c.$emit("onItemPresence", l.nativeEvent)),
|
|
30
|
+
onOnTabFocused: n[4] || (n[4] = (l) => c.$emit("onTabFocused", l.nativeEvent)),
|
|
31
|
+
onOnItemClick: n[5] || (n[5] = (l) => c.$emit("onItemClick", l.nativeEvent)),
|
|
32
|
+
onOnItemFocused: n[6] || (n[6] = (l) => c.$emit("onItemFocused", l.nativeEvent))
|
|
33
|
+
}, c.$attrs), {
|
|
34
|
+
default: k(() => [
|
|
35
|
+
G(c.$slots, "default")
|
|
41
36
|
]),
|
|
42
37
|
_: 3
|
|
43
38
|
}, 16, ["tabsData", "actionPayload"]));
|
|
44
39
|
}
|
|
45
40
|
});
|
|
46
|
-
function
|
|
47
|
-
const
|
|
41
|
+
function z(o, t) {
|
|
42
|
+
const a = P(!1), u = P(!1);
|
|
48
43
|
return {
|
|
49
|
-
isIntersecting:
|
|
50
|
-
isVisible:
|
|
51
|
-
handlePresenceState: (
|
|
52
|
-
var
|
|
53
|
-
switch (
|
|
44
|
+
isIntersecting: a,
|
|
45
|
+
isVisible: u,
|
|
46
|
+
handlePresenceState: (n) => {
|
|
47
|
+
var l, w, y;
|
|
48
|
+
switch (n) {
|
|
54
49
|
case "enter":
|
|
55
|
-
|
|
50
|
+
a.value = !0, (l = t == null ? void 0 : t.onEnter) == null || l.call(t);
|
|
56
51
|
break;
|
|
57
52
|
case "visible":
|
|
58
|
-
|
|
53
|
+
u.value = !0, (w = t == null ? void 0 : t.onVisible) == null || w.call(t);
|
|
59
54
|
break;
|
|
60
55
|
case "leave":
|
|
61
|
-
|
|
56
|
+
a.value = !1, u.value = !1, (y = t == null ? void 0 : t.onLeave) == null || y.call(t);
|
|
62
57
|
break;
|
|
63
58
|
}
|
|
64
59
|
}
|
|
65
60
|
};
|
|
66
61
|
}
|
|
67
|
-
let
|
|
68
|
-
var
|
|
62
|
+
let $;
|
|
63
|
+
var I;
|
|
69
64
|
try {
|
|
70
|
-
const
|
|
71
|
-
|
|
65
|
+
const o = require("@extscreen/es3-vue");
|
|
66
|
+
$ = o.registerElement || ((I = o.default) == null ? void 0 : I.registerElement);
|
|
72
67
|
} catch {
|
|
73
68
|
}
|
|
74
|
-
const
|
|
75
|
-
install: (
|
|
76
|
-
globalThis.__QtGridTabs_registered || (
|
|
69
|
+
const Q = {
|
|
70
|
+
install: (o) => {
|
|
71
|
+
globalThis.__QtGridTabs_registered || ($ ? ($("qt-grid-tabs", {
|
|
77
72
|
component: {
|
|
78
73
|
name: "QtGridTabs",
|
|
79
74
|
// 关键:将前端标签映射到真正的 Native 组件名
|
|
80
|
-
processEventData(
|
|
81
|
-
return {
|
|
82
|
-
handler: u,
|
|
83
|
-
nativeEvent: d
|
|
84
|
-
};
|
|
75
|
+
processEventData(t, a, u) {
|
|
76
|
+
return console.log(`[GridTabs/index.ts] qt-grid-tabs 收到原生事件: ${a}, 数据:`, u), t.nativeEvent = u, t;
|
|
85
77
|
}
|
|
86
78
|
}
|
|
87
|
-
}),
|
|
79
|
+
}), $("QtGridTabs", {
|
|
88
80
|
component: {
|
|
89
81
|
name: "QtGridTabs",
|
|
90
|
-
processEventData(
|
|
91
|
-
return {
|
|
92
|
-
handler: u,
|
|
93
|
-
nativeEvent: d
|
|
94
|
-
};
|
|
82
|
+
processEventData(t, a, u) {
|
|
83
|
+
return console.log(`[GridTabs/index.ts] QtGridTabs 收到原生事件: ${a}, 数据:`, u), t.nativeEvent = u, t;
|
|
95
84
|
}
|
|
96
85
|
}
|
|
97
|
-
}), globalThis.__QtGridTabs_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtGridTabs")) : console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),
|
|
86
|
+
}), globalThis.__QtGridTabs_registered = !0, console.log("[@quicktvui/naddons] Successfully registered Native tag:", "QtGridTabs")) : console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")), o.component("GridTabs", E), o.component("qt-grid-tabs", E);
|
|
98
87
|
}
|
|
99
|
-
},
|
|
100
|
-
function
|
|
101
|
-
return
|
|
102
|
-
name: `${
|
|
88
|
+
}, T = /* @__PURE__ */ new Set();
|
|
89
|
+
function W(o, t, a) {
|
|
90
|
+
return p({
|
|
91
|
+
name: `${o}AsyncWrapper`,
|
|
103
92
|
inheritAttrs: !1,
|
|
104
|
-
setup(
|
|
105
|
-
const
|
|
106
|
-
let
|
|
93
|
+
setup(u, { slots: c, attrs: n }) {
|
|
94
|
+
const l = P("loading"), w = P("");
|
|
95
|
+
let y = null, g = null;
|
|
107
96
|
try {
|
|
108
|
-
|
|
109
|
-
} catch (
|
|
110
|
-
console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",
|
|
97
|
+
y = x(), g = q();
|
|
98
|
+
} catch (i) {
|
|
99
|
+
console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。", i);
|
|
111
100
|
}
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
101
|
+
const S = async () => {
|
|
102
|
+
if (!y || typeof y.isComponentRegistered != "function")
|
|
114
103
|
return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"), !1;
|
|
115
104
|
try {
|
|
116
|
-
const
|
|
117
|
-
if (console.log(`[withAsyncPlugin] isComponentRegistered('${
|
|
105
|
+
const i = await y.isComponentRegistered(o);
|
|
106
|
+
if (console.log(`[withAsyncPlugin] isComponentRegistered('${o}') 返回:`, i), i === !0 || i && typeof i == "object" && (i.registered === !0 || i.isRegistered === !0))
|
|
118
107
|
return !0;
|
|
119
108
|
try {
|
|
120
|
-
const
|
|
121
|
-
if (
|
|
122
|
-
const
|
|
123
|
-
console.log(`[withAsyncPlugin] 当前引擎核心版本: ${
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
if (
|
|
127
|
-
console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${
|
|
128
|
-
const
|
|
129
|
-
console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${
|
|
130
|
-
const [m,
|
|
131
|
-
|
|
132
|
-
|
|
109
|
+
const r = await v.callNativeWithPromise("ExtendModule", "getCoreSDKInfo");
|
|
110
|
+
if (r && r.core_version) {
|
|
111
|
+
const d = r.core_version;
|
|
112
|
+
console.log(`[withAsyncPlugin] 当前引擎核心版本: ${d}`);
|
|
113
|
+
const e = d.split(".").map((s) => parseInt(s, 10));
|
|
114
|
+
if (e.length >= 3 && !isNaN(e[0]) && !isNaN(e[1]) && !isNaN(e[2]))
|
|
115
|
+
if (e[0] * 1e6 + e[1] * 1e3 + e[2] >= 1011205) {
|
|
116
|
+
console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${o}`);
|
|
117
|
+
const f = o.split("-").map((A) => A.charAt(0).toUpperCase() + A.slice(1)).join("");
|
|
118
|
+
console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${o}, ${f}`);
|
|
119
|
+
const [m, b] = await Promise.all([
|
|
120
|
+
v.callNativeWithPromise("ExtendModule", "isComponentRegistered", o).catch(() => !1),
|
|
121
|
+
v.callNativeWithPromise("ExtendModule", "isComponentRegistered", f).catch(() => !1)
|
|
133
122
|
]);
|
|
134
|
-
if (console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${m}, ${
|
|
123
|
+
if (console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${m}, ${b}]`), m === !0 || b === !0)
|
|
135
124
|
return !0;
|
|
136
125
|
} else
|
|
137
|
-
console.log(`[withAsyncPlugin] 引擎版本 ${
|
|
126
|
+
console.log(`[withAsyncPlugin] 引擎版本 ${d} < 1.11.205,跳过 ExtendModule 检查`);
|
|
138
127
|
else
|
|
139
|
-
console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${
|
|
128
|
+
console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${d}`);
|
|
140
129
|
}
|
|
141
|
-
} catch (
|
|
142
|
-
console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",
|
|
130
|
+
} catch (r) {
|
|
131
|
+
console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:", r);
|
|
143
132
|
}
|
|
144
133
|
return !1;
|
|
145
|
-
} catch (
|
|
146
|
-
return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",
|
|
134
|
+
} catch (i) {
|
|
135
|
+
return console.warn("[withAsyncPlugin] 检查组件注册状态异常:", i), !1;
|
|
147
136
|
}
|
|
148
137
|
}, C = async () => {
|
|
149
|
-
if (!
|
|
150
|
-
|
|
138
|
+
if (!t) {
|
|
139
|
+
l.value = "ready";
|
|
151
140
|
return;
|
|
152
141
|
}
|
|
153
|
-
const
|
|
154
|
-
if (console.log(`[withAsyncPlugin] 拦截检查 - ${
|
|
155
|
-
|
|
142
|
+
const i = await S();
|
|
143
|
+
if (console.log(`[withAsyncPlugin] 拦截检查 - ${o} 是否已注册:`, i), i || T.has(t)) {
|
|
144
|
+
l.value = "ready", T.add(t), console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");
|
|
156
145
|
return;
|
|
157
146
|
}
|
|
158
|
-
if (!
|
|
159
|
-
console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${
|
|
147
|
+
if (!g) {
|
|
148
|
+
console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${o}`), l.value = "ready";
|
|
160
149
|
return;
|
|
161
150
|
}
|
|
162
|
-
console.log(`[withAsyncPlugin] 开始动态安装插件: ${
|
|
151
|
+
console.log(`[withAsyncPlugin] 开始动态安装插件: ${t}`);
|
|
163
152
|
try {
|
|
164
|
-
await new Promise((
|
|
165
|
-
let
|
|
166
|
-
const
|
|
167
|
-
onPluginInstallSuccess(
|
|
168
|
-
|
|
153
|
+
await new Promise((r, d) => {
|
|
154
|
+
let e;
|
|
155
|
+
const s = {
|
|
156
|
+
onPluginInstallSuccess(f, m, b) {
|
|
157
|
+
f === t && (clearTimeout(e), g.removeListener(s), console.log(`[withAsyncPlugin] 安装成功 pkg=${f} 状态码=${m}`), m == 1003 || m == 1001 ? (a ? (console.log(`[withAsyncPlugin] 触发反射初始化: ${a}`), v.callNative("EsNativeModule", "callReflect", {
|
|
169
158
|
entry: {
|
|
170
|
-
from:
|
|
159
|
+
from: a,
|
|
171
160
|
method: "setup"
|
|
172
161
|
}
|
|
173
|
-
})) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),
|
|
162
|
+
})) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"), r()) : d(new Error(`安装失败 pkg=${f} status=${m} msg=${b}`)));
|
|
174
163
|
},
|
|
175
|
-
onPluginInstallError(
|
|
176
|
-
|
|
164
|
+
onPluginInstallError(f, m, b) {
|
|
165
|
+
f === t && (clearTimeout(e), g.removeListener(s), d(new Error(`安装失败 pkg=${f} status=${m} msg=${b}`)));
|
|
177
166
|
}
|
|
178
167
|
};
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}, 8e3), typeof
|
|
182
|
-
}), await L(),
|
|
183
|
-
} catch (
|
|
184
|
-
console.error("[withAsyncPlugin] 插件加载失败:",
|
|
168
|
+
g.addListener({ pkg: t }, s), e = setTimeout(() => {
|
|
169
|
+
g.removeListener(s), d(new Error(`插件安装超时: ${t}`));
|
|
170
|
+
}, 8e3), typeof g.installPlugin == "function" ? g.installPlugin({ pkg: t }) : typeof g.install == "function" ? g.install(t) : d(new Error("当前运行时不支持 install / installPlugin"));
|
|
171
|
+
}), await L(), T.add(t), l.value = "ready";
|
|
172
|
+
} catch (r) {
|
|
173
|
+
console.error("[withAsyncPlugin] 插件加载失败:", r), w.value = (r == null ? void 0 : r.message) || String(r), l.value = "error";
|
|
185
174
|
}
|
|
186
175
|
};
|
|
187
|
-
return
|
|
176
|
+
return R(() => {
|
|
188
177
|
C();
|
|
189
178
|
}), () => {
|
|
190
|
-
const
|
|
179
|
+
const i = {
|
|
191
180
|
width: "100%",
|
|
192
181
|
height: "100%",
|
|
193
182
|
display: "flex",
|
|
194
183
|
flexDirection: "column",
|
|
195
184
|
justifyContent: "center",
|
|
196
185
|
alignItems: "center",
|
|
197
|
-
...
|
|
186
|
+
...n.style || {}
|
|
198
187
|
};
|
|
199
|
-
if (
|
|
200
|
-
return h("div", { class: "qt-plugin-container", style:
|
|
188
|
+
if (l.value === "loading")
|
|
189
|
+
return h("div", { class: "qt-plugin-container", style: i }, [
|
|
201
190
|
h("div", { style: { color: "white", fontSize: "30px" } }, "插件加载中...")
|
|
202
191
|
]);
|
|
203
|
-
if (
|
|
204
|
-
return h("div", { class: "qt-plugin-container", style:
|
|
205
|
-
h("div", { style: { color: "white", fontSize: "30px", backgroundColor: "rgba(255,0,0,0.5)" } }, `插件加载失败: ${
|
|
192
|
+
if (l.value === "error")
|
|
193
|
+
return h("div", { class: "qt-plugin-container", style: i }, [
|
|
194
|
+
h("div", { style: { color: "white", fontSize: "30px", backgroundColor: "rgba(255,0,0,0.5)" } }, `插件加载失败: ${w.value}`)
|
|
206
195
|
]);
|
|
207
|
-
const
|
|
208
|
-
for (const [
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
196
|
+
const r = {};
|
|
197
|
+
for (const [e, s] of Object.entries(n)) {
|
|
198
|
+
const f = e.startsWith("on") && e !== "onItemPresence" && e !== "onTabSelected" && e !== "onTabNeedsData" && e !== "onLoadMore" && e !== "onTabFocused" && e !== "onItemClick" && e !== "onItemFocused";
|
|
199
|
+
!e.startsWith("onOn") && !f && (r[e] = s);
|
|
200
|
+
}
|
|
201
|
+
const d = {
|
|
202
|
+
...r,
|
|
203
|
+
style: { width: "1920px", height: "1080px", backgroundColor: "transparent" },
|
|
204
|
+
onItemPresence: (e) => {
|
|
205
|
+
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onItemPresence:`, e);
|
|
206
|
+
const s = n.onOnItemPresence || n.onItemPresence || n.onitempresence;
|
|
207
|
+
typeof s == "function" && s(e);
|
|
208
|
+
},
|
|
209
|
+
onTabSelected: (e) => {
|
|
210
|
+
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onTabSelected:`, e);
|
|
211
|
+
const s = n.onOnTabSelected || n.onTabSelected;
|
|
212
|
+
typeof s == "function" && s(e);
|
|
213
|
+
},
|
|
214
|
+
onTabNeedsData: (e) => {
|
|
215
|
+
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onTabNeedsData:`, e);
|
|
216
|
+
const s = n.onOnTabNeedsData || n.onTabNeedsData;
|
|
217
|
+
typeof s == "function" && s(e);
|
|
218
|
+
},
|
|
219
|
+
onLoadMore: (e) => {
|
|
220
|
+
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onLoadMore:`, e);
|
|
221
|
+
const s = n.onOnLoadMore || n.onLoadMore;
|
|
222
|
+
typeof s == "function" && s(e);
|
|
223
|
+
},
|
|
224
|
+
onTabFocused: (e) => {
|
|
225
|
+
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onTabFocused:`, e);
|
|
226
|
+
const s = n.onOnTabFocused || n.onTabFocused;
|
|
227
|
+
typeof s == "function" && s(e);
|
|
228
|
+
},
|
|
229
|
+
onItemClick: (e) => {
|
|
230
|
+
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onItemClick:`, e);
|
|
231
|
+
const s = n.onOnItemClick || n.onItemClick;
|
|
232
|
+
typeof s == "function" && s(e);
|
|
233
|
+
},
|
|
234
|
+
onItemFocused: (e) => {
|
|
235
|
+
console.log(`[withAsyncPlugin] NativeTag=${o} 收到事件 onItemFocused:`, e);
|
|
236
|
+
const s = n.onOnItemFocused || n.onItemFocused;
|
|
237
|
+
typeof s == "function" && s(e);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:", Object.keys(d)), h("div", { class: "qt-plugin-container", style: i }, [
|
|
241
|
+
h(o, d, c.default ? c.default() : [])
|
|
215
242
|
]);
|
|
216
243
|
};
|
|
217
244
|
}
|
|
218
245
|
});
|
|
219
246
|
}
|
|
220
|
-
const
|
|
221
|
-
install: (
|
|
222
|
-
|
|
247
|
+
const B = {
|
|
248
|
+
install: (o) => {
|
|
249
|
+
o.use(Q);
|
|
223
250
|
}
|
|
224
251
|
};
|
|
225
252
|
export {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
253
|
+
E as GridTabs,
|
|
254
|
+
Q as GridTabsPlugin,
|
|
255
|
+
B as QuickTVUINAddons,
|
|
256
|
+
B as default,
|
|
257
|
+
z as useGridItemPresence,
|
|
258
|
+
W as withAsyncPlugin
|
|
232
259
|
};
|