@quicktvui/naddons 1.0.0-alpha.0 → 1.0.0-alpha.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.
package/dist/naddons.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),_=require("@extscreen/es3-core"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),_=require("@extscreen/es3-core"),R=require("@extscreen/es3-vue"),w=new Set;function P(r,n,i){return e.defineComponent({name:`${r}AsyncWrapper`,inheritAttrs:!1,setup(c,{slots:v,attrs:m}){const l=e.ref("loading"),A=e.ref("");let d=null,s=null;try{d=_.useES(),s=_.useESPlugin()}catch(t){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",t)}const S=async()=>{if(!d||typeof d.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const t=await d.isComponentRegistered(r);return console.log(`[withAsyncPlugin] isComponentRegistered('${r}') 返回:`,t),!!(t===!0||t&&typeof t=="object"&&t.registered===!0)}catch(t){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",t),!1}},q=async()=>{if(!n){l.value="ready";return}const t=await S();if(console.log(`[withAsyncPlugin] 拦截检查 - ${r} 是否已注册:`,t),t||w.has(n)){l.value="ready",w.add(n),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!s){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${r}`),l.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${n}`);try{await new Promise((o,g)=>{let y;const f={onPluginInstallSuccess(u,a,h){u===n&&(clearTimeout(y),s.removeListener(f),console.log(`[withAsyncPlugin] 安装成功 pkg=${u} 状态码=${a}`),a==1003?(i?(console.log(`[withAsyncPlugin] 触发反射初始化: ${i}`),R.Native.callNative("EsNativeModule","callReflect",{entry:{from:i,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),o()):g(new Error(`安装失败 pkg=${u} status=${a} msg=${h}`)))},onPluginInstallError(u,a,h){u===n&&(clearTimeout(y),s.removeListener(f),g(new Error(`安装失败 pkg=${u} status=${a} msg=${h}`)))}};s.addListener({pkg:n},f),y=setTimeout(()=>{s.removeListener(f),g(new Error(`插件安装超时: ${n}`))},8e3),typeof s.installPlugin=="function"?s.installPlugin({pkg:n}):typeof s.install=="function"?s.install(n):g(new Error("当前运行时不支持 install / installPlugin"))}),await e.nextTick(),w.add(n),l.value="ready"}catch(o){console.error("[withAsyncPlugin] 插件加载失败:",o),A.value=(o==null?void 0:o.message)||String(o),l.value="error"}};return e.onMounted(()=>{q()}),()=>{const t={width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...m.style||{}};return l.value==="loading"?e.h("div",{class:"qt-plugin-container",style:t},[e.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]):l.value==="error"?e.h("div",{class:"qt-plugin-container",style:t},[e.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${A.value}`)]):e.h("div",{class:"qt-plugin-container",style:t},[e.h(r,{...m,style:{width:"100%",height:"100%",backgroundColor:"transparent"}},v)])}}})}const b=e.defineComponent({__name:"GridTabs",setup(r){const n=e.ref(),i=P("qt-grid-tabs","com.quicktvui.plugin.glintui","com.quicktvui.plugin.glintui.GlintPluginApp");return(c,v)=>(e.openBlock(),e.createBlock(e.unref(i),e.mergeProps({ref_key:"nativeRef",ref:n},c.$attrs),{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3},16))}});let p;try{p=require("@extscreen/es3-vue").registerElement}catch{}const $={install:r=>{globalThis.__qt_grid_tabs_registered||p&&(p("qt-grid-tabs",{component:{name:"qt-grid-tabs",processEventData(n,i,c){return{handler:i,nativeEvent:c}}}}),globalThis.__qt_grid_tabs_registered=!0),r.component("GridTabs",b)}},E={install:r=>{r.use($)}};exports.GridTabs=b;exports.GridTabsPlugin=$;exports.QuickTVUINAddons=E;exports.default=E;exports.withAsyncPlugin=P;
|
package/dist/naddons.es.js
CHANGED
|
@@ -1,67 +1,69 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useES as
|
|
3
|
-
import { Native as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
return
|
|
1
|
+
import { defineComponent as $, ref as w, onMounted as b, h as u, nextTick as S, openBlock as q, createBlock as R, unref as x, mergeProps as C, withCtx as T, renderSlot as G } from "vue";
|
|
2
|
+
import { useES as I, useESPlugin as L } from "@extscreen/es3-core";
|
|
3
|
+
import { Native as M } from "@extscreen/es3-vue";
|
|
4
|
+
const p = /* @__PURE__ */ new Set();
|
|
5
|
+
function V(n, t, s) {
|
|
6
|
+
return $({
|
|
7
7
|
name: `${n}AsyncWrapper`,
|
|
8
8
|
inheritAttrs: !1,
|
|
9
|
-
setup(
|
|
10
|
-
const
|
|
9
|
+
setup(c, { slots: v, attrs: A }) {
|
|
10
|
+
const i = w("loading"), _ = w("");
|
|
11
11
|
let d = null, r = null;
|
|
12
12
|
try {
|
|
13
|
-
d =
|
|
13
|
+
d = I(), r = L();
|
|
14
14
|
} catch (e) {
|
|
15
15
|
console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。", e);
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const E = async () => {
|
|
18
18
|
if (!d || typeof d.isComponentRegistered != "function")
|
|
19
|
-
return !1;
|
|
19
|
+
return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"), !1;
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return !1;
|
|
21
|
+
const e = await d.isComponentRegistered(n);
|
|
22
|
+
return console.log(`[withAsyncPlugin] isComponentRegistered('${n}') 返回:`, e), !!(e === !0 || e && typeof e == "object" && e.registered === !0);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
return console.warn("[withAsyncPlugin] 检查组件注册状态异常:", e), !1;
|
|
26
25
|
}
|
|
27
|
-
},
|
|
26
|
+
}, P = async () => {
|
|
28
27
|
if (!t) {
|
|
29
|
-
|
|
28
|
+
i.value = "ready";
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const e = await E();
|
|
32
|
+
if (console.log(`[withAsyncPlugin] 拦截检查 - ${n} 是否已注册:`, e), e || p.has(t)) {
|
|
33
|
+
i.value = "ready", p.add(t), console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");
|
|
30
34
|
return;
|
|
31
35
|
}
|
|
32
|
-
if (
|
|
33
|
-
|
|
36
|
+
if (!r) {
|
|
37
|
+
console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${n}`), i.value = "ready";
|
|
34
38
|
return;
|
|
35
39
|
}
|
|
36
40
|
console.log(`[withAsyncPlugin] 开始动态安装插件: ${t}`);
|
|
37
41
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onPluginInstallSuccess(o, c, y) {
|
|
44
|
-
o === t && (clearTimeout(g), r.removeListener(f), console.log(`[withAsyncPlugin] 安装成功 pkg=${o} 状态码=${c}`), c == 1003 ? (s ? (console.log(`[withAsyncPlugin] 触发反射初始化: ${s}`), L.callNative("EsNativeModule", "callReflect", {
|
|
42
|
+
await new Promise((l, f) => {
|
|
43
|
+
let y;
|
|
44
|
+
const g = {
|
|
45
|
+
onPluginInstallSuccess(o, a, h) {
|
|
46
|
+
o === t && (clearTimeout(y), r.removeListener(g), console.log(`[withAsyncPlugin] 安装成功 pkg=${o} 状态码=${a}`), a == 1003 ? (s ? (console.log(`[withAsyncPlugin] 触发反射初始化: ${s}`), M.callNative("EsNativeModule", "callReflect", {
|
|
45
47
|
entry: {
|
|
46
48
|
from: s,
|
|
47
49
|
method: "setup"
|
|
48
50
|
}
|
|
49
|
-
})) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),
|
|
51
|
+
})) : console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"), l()) : f(new Error(`安装失败 pkg=${o} status=${a} msg=${h}`)));
|
|
50
52
|
},
|
|
51
|
-
onPluginInstallError(o,
|
|
52
|
-
o === t && (clearTimeout(
|
|
53
|
+
onPluginInstallError(o, a, h) {
|
|
54
|
+
o === t && (clearTimeout(y), r.removeListener(g), f(new Error(`安装失败 pkg=${o} status=${a} msg=${h}`)));
|
|
53
55
|
}
|
|
54
56
|
};
|
|
55
|
-
r.addListener({ pkg: t },
|
|
56
|
-
r.removeListener(
|
|
57
|
-
}, 8e3), typeof r.installPlugin == "function" ? r.installPlugin({ pkg: t }) : typeof r.install == "function" ? r.install(t) :
|
|
58
|
-
}), await
|
|
59
|
-
} catch (
|
|
60
|
-
console.error("[withAsyncPlugin] 插件加载失败:",
|
|
57
|
+
r.addListener({ pkg: t }, g), y = setTimeout(() => {
|
|
58
|
+
r.removeListener(g), f(new Error(`插件安装超时: ${t}`));
|
|
59
|
+
}, 8e3), typeof r.installPlugin == "function" ? r.installPlugin({ pkg: t }) : typeof r.install == "function" ? r.install(t) : f(new Error("当前运行时不支持 install / installPlugin"));
|
|
60
|
+
}), await S(), p.add(t), i.value = "ready";
|
|
61
|
+
} catch (l) {
|
|
62
|
+
console.error("[withAsyncPlugin] 插件加载失败:", l), _.value = (l == null ? void 0 : l.message) || String(l), i.value = "error";
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
+
return b(() => {
|
|
66
|
+
P();
|
|
65
67
|
}), () => {
|
|
66
68
|
const e = {
|
|
67
69
|
width: "100%",
|
|
@@ -70,15 +72,15 @@ function M(n, t, s) {
|
|
|
70
72
|
flexDirection: "column",
|
|
71
73
|
justifyContent: "center",
|
|
72
74
|
alignItems: "center",
|
|
73
|
-
...
|
|
75
|
+
...A.style || {}
|
|
74
76
|
};
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
]) :
|
|
78
|
-
|
|
79
|
-
]) :
|
|
80
|
-
|
|
81
|
-
...
|
|
77
|
+
return i.value === "loading" ? u("div", { class: "qt-plugin-container", style: e }, [
|
|
78
|
+
u("div", { style: { color: "white", fontSize: "30px" } }, "插件加载中...")
|
|
79
|
+
]) : i.value === "error" ? u("div", { class: "qt-plugin-container", style: e }, [
|
|
80
|
+
u("div", { style: { color: "white", fontSize: "30px", backgroundColor: "rgba(255,0,0,0.5)" } }, `插件加载失败: ${_.value}`)
|
|
81
|
+
]) : u("div", { class: "qt-plugin-container", style: e }, [
|
|
82
|
+
u(n, {
|
|
83
|
+
...A,
|
|
82
84
|
style: { width: "100%", height: "100%", backgroundColor: "transparent" }
|
|
83
85
|
}, v)
|
|
84
86
|
]);
|
|
@@ -86,20 +88,20 @@ function M(n, t, s) {
|
|
|
86
88
|
}
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
|
-
const
|
|
91
|
+
const z = /* @__PURE__ */ $({
|
|
90
92
|
__name: "GridTabs",
|
|
91
93
|
setup(n) {
|
|
92
|
-
const t =
|
|
94
|
+
const t = w(), s = V(
|
|
93
95
|
"qt-grid-tabs",
|
|
94
96
|
"com.quicktvui.plugin.glintui",
|
|
95
97
|
"com.quicktvui.plugin.glintui.GlintPluginApp"
|
|
96
98
|
);
|
|
97
|
-
return (
|
|
99
|
+
return (c, v) => (q(), R(x(s), C({
|
|
98
100
|
ref_key: "nativeRef",
|
|
99
101
|
ref: t
|
|
100
|
-
},
|
|
101
|
-
default:
|
|
102
|
-
G(
|
|
102
|
+
}, c.$attrs), {
|
|
103
|
+
default: T(() => [
|
|
104
|
+
G(c.$slots, "default")
|
|
103
105
|
]),
|
|
104
106
|
_: 3
|
|
105
107
|
}, 16));
|
|
@@ -110,28 +112,29 @@ try {
|
|
|
110
112
|
m = require("@extscreen/es3-vue").registerElement;
|
|
111
113
|
} catch {
|
|
112
114
|
}
|
|
113
|
-
const
|
|
115
|
+
const B = {
|
|
114
116
|
install: (n) => {
|
|
115
117
|
globalThis.__qt_grid_tabs_registered || m && (m("qt-grid-tabs", {
|
|
116
118
|
component: {
|
|
117
119
|
name: "qt-grid-tabs",
|
|
118
|
-
processEventData(t, s,
|
|
120
|
+
processEventData(t, s, c) {
|
|
119
121
|
return {
|
|
120
122
|
handler: s,
|
|
121
|
-
nativeEvent:
|
|
123
|
+
nativeEvent: c
|
|
122
124
|
};
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
|
-
}), globalThis.__qt_grid_tabs_registered = !0), n.component("GridTabs",
|
|
127
|
+
}), globalThis.__qt_grid_tabs_registered = !0), n.component("GridTabs", z);
|
|
126
128
|
}
|
|
127
|
-
},
|
|
129
|
+
}, Q = {
|
|
128
130
|
install: (n) => {
|
|
129
|
-
n.use(
|
|
131
|
+
n.use(B);
|
|
130
132
|
}
|
|
131
133
|
};
|
|
132
134
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
z as GridTabs,
|
|
136
|
+
B as GridTabsPlugin,
|
|
137
|
+
Q as QuickTVUINAddons,
|
|
138
|
+
Q as default,
|
|
139
|
+
V as withAsyncPlugin
|
|
137
140
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quicktvui/naddons",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"description": "Vue 3 wrappers for QuickTVUI Native Addons",
|
|
5
5
|
"main": "dist/naddons.cjs.js",
|
|
6
6
|
"module": "dist/naddons.es.js",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"prepublishOnly": "npm run build"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@extscreen/es3-core": "
|
|
18
|
-
"@extscreen/es3-vue": "
|
|
19
|
-
"vue": "
|
|
17
|
+
"@extscreen/es3-core": ">=3.0.0",
|
|
18
|
+
"@extscreen/es3-vue": ">=3.0.0",
|
|
19
|
+
"vue": ">=3.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@vitejs/plugin-vue": "^4.0.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
2
|
-
default?(_: {}): any;
|
|
3
|
-
}>;
|
|
4
|
-
export default _default;
|
|
5
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
6
|
-
new (): {
|
|
7
|
-
$slots: S;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 提供统一的异步插件安装和降级包装器。
|
|
3
|
-
* 这个组件不会被暴露给最终用户,只被 auto-generated 的组件代码调用。
|
|
4
|
-
*/
|
|
5
|
-
export declare function withAsyncPlugin(NativeTag: string, pluginPkgName?: string, pluginInitClass?: string): import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/index.d.ts
DELETED