@quicktvui/naddons 1.0.0-alpha.5 → 1.0.0-alpha.7

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,6 +1,8 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
2
  initialDate?: string | undefined;
3
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ }>>, {
4
+ getNativeNode: () => any;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
6
  onDateChanged: (payload?: any) => void;
5
7
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
6
8
  initialDate?: string | undefined;
@@ -1,8 +1,11 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
+ protocolVersion?: string | undefined;
2
3
  tabsData?: string | undefined;
3
4
  actionPayload?: string | undefined;
4
5
  }>>, {
5
- scrollToTop: (...args: any[]) => any;
6
+ getNativeNode: () => any;
7
+ dispatchAction: (...args: any[]) => void;
8
+ scrollToTop: (...args: any[]) => void;
6
9
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
10
  onTabSelected: (payload?: any) => void;
8
11
  onTabNeedsData: (payload?: any) => void;
@@ -11,7 +14,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
11
14
  onTabFocused: (payload?: any) => void;
12
15
  onItemClick: (payload?: any) => void;
13
16
  onItemFocused: (payload?: any) => void;
17
+ onProtocolMismatch: (payload?: any) => void;
14
18
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
19
+ protocolVersion?: string | undefined;
15
20
  tabsData?: string | undefined;
16
21
  actionPayload?: string | undefined;
17
22
  }>>> & Readonly<{
@@ -22,6 +27,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
22
27
  onOnTabFocused?: ((payload?: any) => any) | undefined;
23
28
  onOnItemClick?: ((payload?: any) => any) | undefined;
24
29
  onOnItemFocused?: ((payload?: any) => any) | undefined;
30
+ onOnProtocolMismatch?: ((payload?: any) => any) | undefined;
25
31
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
26
32
  default?(_: {}): any;
27
33
  }>;
@@ -1,35 +1,26 @@
1
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
- portalId: {
3
- type: StringConstructor;
4
- required: true;
5
- };
6
- width: {
7
- type: (StringConstructor | NumberConstructor)[];
8
- required: true;
9
- };
10
- height: {
11
- type: (StringConstructor | NumberConstructor)[];
12
- required: true;
13
- };
14
- }>, {
15
- itemStyle: import("vue").ComputedRef<{
16
- width: string;
17
- height: string;
18
- display: string;
19
- flexDirection: string;
20
- }>;
21
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
22
- portalId: {
23
- type: StringConstructor;
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
+ portalId: string;
3
+ width?: number | undefined;
4
+ height?: number | undefined;
5
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
6
+ portalId: string;
7
+ width?: number | undefined;
8
+ height?: number | undefined;
9
+ }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
10
+ default?(_: {}): any;
11
+ }>;
12
+ export default _default;
13
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
+ type __VLS_TypePropsToRuntimeProps<T> = {
15
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
16
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
+ } : {
18
+ type: import('vue').PropType<T[K]>;
24
19
  required: true;
25
20
  };
26
- width: {
27
- type: (StringConstructor | NumberConstructor)[];
28
- required: true;
21
+ };
22
+ type __VLS_WithTemplateSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
29
25
  };
30
- height: {
31
- type: (StringConstructor | NumberConstructor)[];
32
- required: true;
33
- };
34
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
35
- export default _default;
26
+ };
@@ -1,79 +1,2 @@
1
- import { PropType } from 'vue';
2
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
- data: {
4
- type: PropType<any[]>;
5
- default: () => never[];
6
- };
7
- presenceMap: {
8
- type: PropType<Record<string, string>>;
9
- default: () => {};
10
- };
11
- gridBasis: {
12
- type: NumberConstructor;
13
- default: number;
14
- };
15
- totalWidth: {
16
- type: NumberConstructor;
17
- default: number;
18
- };
19
- }>, {
20
- activePortals: import("vue").Ref<any[], any[]>;
21
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
22
- data: {
23
- type: PropType<any[]>;
24
- default: () => never[];
25
- };
26
- presenceMap: {
27
- type: PropType<Record<string, string>>;
28
- default: () => {};
29
- };
30
- gridBasis: {
31
- type: NumberConstructor;
32
- default: number;
33
- };
34
- totalWidth: {
35
- type: NumberConstructor;
36
- default: number;
37
- };
38
- }>> & Readonly<{}>, {
39
- data: any[];
40
- presenceMap: Record<string, string>;
41
- gridBasis: number;
42
- totalWidth: number;
43
- }, {}, {
44
- PortalItem: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
45
- portalId: {
46
- type: StringConstructor;
47
- required: true;
48
- };
49
- width: {
50
- type: (StringConstructor | NumberConstructor)[];
51
- required: true;
52
- };
53
- height: {
54
- type: (StringConstructor | NumberConstructor)[];
55
- required: true;
56
- };
57
- }>, {
58
- itemStyle: import("vue").ComputedRef<{
59
- width: string;
60
- height: string;
61
- display: string;
62
- flexDirection: string;
63
- }>;
64
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
65
- portalId: {
66
- type: StringConstructor;
67
- required: true;
68
- };
69
- width: {
70
- type: (StringConstructor | NumberConstructor)[];
71
- required: true;
72
- };
73
- height: {
74
- type: (StringConstructor | NumberConstructor)[];
75
- required: true;
76
- };
77
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
78
- }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
79
2
  export default _default;
@@ -1,21 +1,14 @@
1
1
  import type { App } from 'vue';
2
2
  import GridTabs from './GridTabs.vue';
3
- import PortalItem from './PortalItem.vue';
4
- import PortalPool from './PortalPool.vue';
5
3
  export declare const GridTabsPlugin: {
6
4
  install: (app: App) => void;
7
5
  };
8
- export { GridTabs, PortalItem, PortalPool };
9
- export * from './useGridItemPresence';
10
- export * from './useGridTabsUpdater';
11
- export * from './useGridTabsData';
6
+ export { GridTabs };
12
7
  export default GridTabsPlugin;
13
8
  declare module 'vue' {
14
9
  interface GlobalComponents {
15
10
  GridTabs: typeof GridTabs;
16
- 'gt-tabs': typeof GridTabs;
17
11
  'qt-grid-tabs': typeof GridTabs;
18
- 'qt-portal-pool': typeof PortalPool;
19
- 'qt-portal-item': typeof PortalItem;
12
+ 'gt-tabs': typeof GridTabs;
20
13
  }
21
14
  }
@@ -1,51 +1,91 @@
1
1
  export interface GTAction {
2
- op: 'UPDATE_ITEM' | 'APPEND_SUB_ITEMS' | 'REMOVE_ITEM';
3
- itemId: string;
2
+ op: 'UPDATE_ITEM' | 'APPEND_SUB_ITEMS' | 'REMOVE_ITEM' | 'RELOAD_TABS';
3
+ itemId?: string;
4
4
  payload?: any;
5
5
  }
6
- export interface GTConfig {
6
+ export interface GTAnimationConfig {
7
+ duration?: number;
8
+ easing?: 'ease-in' | 'ease-out' | 'linear';
9
+ layoutEntrance?: 'staggered_slide_up' | 'fade_in' | 'none';
10
+ itemUpdate?: 'fade_cross' | 'default' | 'none';
11
+ }
12
+ export interface GTPageSpec {
7
13
  gridBasis?: number;
8
14
  unitType?: string;
15
+ contentConfig?: any;
9
16
  layoutConfig?: any;
10
17
  navConfig?: any;
18
+ animationConfig?: GTAnimationConfig;
19
+ focusConfig?: any;
20
+ [key: string]: any;
21
+ }
22
+ export interface GTConfig extends GTPageSpec {
11
23
  referenceResolution?: any;
12
24
  }
13
25
  export interface GTItemContent {
14
26
  title?: string;
15
27
  subTitle?: string;
16
28
  poster?: string;
29
+ subItems?: GTItem[];
17
30
  [key: string]: any;
18
31
  }
19
32
  export interface GTItem {
20
33
  id: string;
21
34
  viewType: string;
22
35
  span?: number;
36
+ state?: 'ready' | 'loading' | 'error' | 'disabled';
37
+ fallbackTemplates?: Record<string, string>;
38
+ clickPayload?: any;
39
+ focusPayload?: any;
23
40
  content?: GTItemContent;
24
41
  [key: string]: any;
25
42
  }
26
43
  export interface GTTab {
27
44
  tabId: string;
28
45
  title: string;
46
+ initialFocusId?: string;
47
+ loadState?: 'ready' | 'loading' | 'error' | 'empty' | 'loading_more' | 'no_more';
48
+ fallbackTemplates?: Record<string, string>;
29
49
  items?: GTItem[];
30
50
  hidden?: boolean;
31
51
  [key: string]: any;
32
52
  }
53
+ export interface GTItemEventPayload {
54
+ itemId: string;
55
+ tabIndex: number;
56
+ itemIndex: number;
57
+ subIndex: number;
58
+ clickPayload?: any;
59
+ focusPayload?: any;
60
+ hasFocus?: boolean;
61
+ [key: string]: any;
62
+ }
33
63
  export interface GTCallbacks {
34
64
  onTabNeedsData?: (tabId: string, index: number, reason: string) => Promise<GTItem[]>;
35
65
  onLoadMore?: (tabId: string, cursor: number, itemId: string) => Promise<GTItem[]>;
66
+ onItemPresence?: (event: any) => void;
67
+ onTabSelected?: (event: any) => void;
68
+ onItemClick?: (payload: GTItemEventPayload) => void;
69
+ onItemFocused?: (payload: GTItemEventPayload) => void;
70
+ onTabFocused?: (event: any) => void;
36
71
  }
37
72
  export declare function useGridTabs(gridRef: any, defaultConfig?: GTConfig): {
38
73
  tabsDataStr: import("vue").Ref<string, string>;
39
- actionPayloadStr: import("vue").Ref<string, string>;
40
74
  bindings: import("vue").ComputedRef<{
41
75
  tabsData: string;
42
- actionPayload: string;
43
- onTabNeedsData: (e: any) => Promise<void>;
44
- onLoadMore: (e: any) => Promise<void>;
76
+ onTabNeedsData: (...args: any[]) => Promise<void>;
77
+ onLoadMore: (...args: any[]) => Promise<void>;
78
+ onItemPresence: (...args: any[]) => void;
79
+ onTabSelected: (...args: any[]) => void;
80
+ onItemClick: (...args: any[]) => void;
81
+ onItemFocused: (...args: any[]) => void;
82
+ onTabFocused: (...args: any[]) => void;
45
83
  }>;
46
84
  tabs: import("vue").ShallowRef<GTTab[], GTTab[]>;
47
85
  items: import("vue").ShallowRef<GTItem[], GTItem[]>;
48
86
  initData: (data: any[]) => void;
49
87
  setCallbacks: (callbacks: GTCallbacks) => void;
88
+ updateItem: (itemId: string, payload: any) => void;
50
89
  dispatchAction: (action: GTAction | GTAction[]) => void;
90
+ resetInitialization: () => void;
51
91
  };
@@ -10,7 +10,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
10
10
  textClear?: string | undefined;
11
11
  textDelete?: string | undefined;
12
12
  currentInput?: string | undefined;
13
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ }>>, {
14
+ getNativeNode: () => any;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
16
  onInputChanged: (payload?: any) => void;
15
17
  onKeyPressed: (payload?: any) => void;
16
18
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
@@ -1,6 +1,8 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
2
  maxLength?: any;
3
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ }>>, {
4
+ getNativeNode: () => any;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
6
  onNumberPressed: (payload?: any) => void;
5
7
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
6
8
  maxLength?: any;
@@ -0,0 +1,24 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
+ portalId?: string | undefined;
3
+ }>>, {
4
+ getNativeNode: () => any;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
6
+ portalId?: string | undefined;
7
+ }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
8
+ default?(_: {}): any;
9
+ }>;
10
+ export default _default;
11
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
12
+ type __VLS_TypePropsToRuntimeProps<T> = {
13
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
14
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
15
+ } : {
16
+ type: import('vue').PropType<T[K]>;
17
+ required: true;
18
+ };
19
+ };
20
+ type __VLS_WithTemplateSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -0,0 +1,13 @@
1
+ import type { App } from 'vue';
2
+ import PortalItem from './PortalItem.vue';
3
+ export declare const PortalItemPlugin: {
4
+ install: (app: App) => void;
5
+ };
6
+ export { PortalItem };
7
+ export default PortalItemPlugin;
8
+ declare module 'vue' {
9
+ interface GlobalComponents {
10
+ PortalItem: typeof PortalItem;
11
+ 'qt-portal-item': typeof PortalItem;
12
+ }
13
+ }
@@ -0,0 +1,11 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {
2
+ getNativeNode: () => any;
3
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
4
+ default?(_: {}): any;
5
+ }>;
6
+ export default _default;
7
+ type __VLS_WithTemplateSlots<T, S> = T & {
8
+ new (): {
9
+ $slots: S;
10
+ };
11
+ };
@@ -0,0 +1,13 @@
1
+ import type { App } from 'vue';
2
+ import PortalPool from './PortalPool.vue';
3
+ export declare const PortalPoolPlugin: {
4
+ install: (app: App) => void;
5
+ };
6
+ export { PortalPool };
7
+ export default PortalPoolPlugin;
8
+ declare module 'vue' {
9
+ interface GlobalComponents {
10
+ PortalPool: typeof PortalPool;
11
+ 'qt-portal-pool': typeof PortalPool;
12
+ }
13
+ }
@@ -3,7 +3,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
3
3
  rating?: any;
4
4
  stepSize?: any;
5
5
  isIndicator?: boolean | undefined;
6
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ }>>, {
7
+ getNativeNode: () => any;
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
9
  onRatingChanged: (payload?: any) => void;
8
10
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
9
11
  numStars?: any;
@@ -0,0 +1,34 @@
1
+ export declare const ADDON_ENV_CONTEXT_KEY: unique symbol;
2
+ export interface AddonEnv {
3
+ /** 是否存在并且激活了热更新插件 */
4
+ isPluginActive: boolean;
5
+ /**
6
+ * 热更插件特有的名称后缀。
7
+ * 当 isPluginActive 为 true 时,后缀为 '_Plugin',否则为空字符串。
8
+ */
9
+ nameSuffix: string;
10
+ /**
11
+ * 应该使用的底层插件包名。
12
+ * 如果激活了热更插件,则为独立插件包名;否则为内置基础包名。
13
+ */
14
+ pluginPackageName: string;
15
+ /** 宿主内置组件的真实版本映射表 (组件注册名 -> 版本号) */
16
+ builtInVersions: Record<string, string>;
17
+ }
18
+ /**
19
+ * 探测并初始化全局的 Addon 运行环境。
20
+ * 建议在 App.vue 的 onESCreate 或路由前置守卫中调用一次。
21
+ *
22
+ * @param basePluginPackage 基础插件包名,如 'com.quicktvui.plugin.glintui'
23
+ * @param pluginSuffix 探测新插件的专用后缀,默认为 '_Plugin'
24
+ */
25
+ export declare function initAddonEnv(basePluginPackage?: string, pluginSuffix?: string): Promise<AddonEnv>;
26
+ /**
27
+ * 提供 Addon 环境给子组件
28
+ */
29
+ export declare function provideAddonEnv(env: AddonEnv): void;
30
+ /**
31
+ * 在组件内获取当前的 Addon 运行环境。
32
+ * 如果上层没有 provide,则回退到安全默认环境。
33
+ */
34
+ export declare function useAddonEnv(): AddonEnv;
package/dist/index.d.ts CHANGED
@@ -1,31 +1,40 @@
1
1
  export * from './components/GridTabs';
2
2
  export { useGridTabs } from './components/GridTabs/useGridTabs';
3
- export * from './components/RatingBar';
4
- export * from './components/Keyboard';
5
- export * from './components/NumericKeyboard';
6
- export * from './components/DatePicker';
7
- import { GridTabs } from './components/GridTabs';
8
- import { RatingBar } from './components/RatingBar';
9
- import { Keyboard } from './components/Keyboard';
10
- import { NumericKeyboard } from './components/NumericKeyboard';
11
- import { DatePicker } from './components/DatePicker';
3
+ import { GridTabsPlugin, GridTabs } from './components/GridTabs';
4
+ import { KeyboardPlugin, Keyboard } from './components/Keyboard';
5
+ import { PortalPoolPlugin, PortalPool } from './components/PortalPool';
6
+ import { PortalItemPlugin, PortalItem } from './components/PortalItem';
7
+ export { GridTabsPlugin, GridTabs, KeyboardPlugin, Keyboard, PortalPoolPlugin, PortalPool, PortalItemPlugin, PortalItem };
12
8
  export { withAsyncPlugin, QuickTVUINAddonsConfig } from './core/withAsyncPlugin';
9
+ export * from './core/AddonProvider';
13
10
  import { App } from 'vue';
14
11
  export declare const QuickTVUINAddons: {
15
12
  install: (app: App) => void;
16
13
  };
17
14
  export default QuickTVUINAddons;
15
+ declare module '@vue/runtime-core' {
16
+ interface GlobalComponents {
17
+ GridTabs: typeof GridTabs;
18
+ 'gt-tabs': typeof GridTabs;
19
+ 'qt-grid-tabs': typeof GridTabs;
20
+ Keyboard: typeof Keyboard;
21
+ 'qt-keyboard': typeof Keyboard;
22
+ PortalPool: typeof PortalPool;
23
+ 'qt-portal-pool': typeof PortalPool;
24
+ PortalItem: typeof PortalItem;
25
+ 'qt-portal-item': typeof PortalItem;
26
+ }
27
+ }
18
28
  declare module 'vue' {
19
29
  interface GlobalComponents {
20
30
  GridTabs: typeof GridTabs;
31
+ 'gt-tabs': typeof GridTabs;
21
32
  'qt-grid-tabs': typeof GridTabs;
22
- RatingBar: typeof RatingBar;
23
- 'qt-rating-bar': typeof RatingBar;
24
33
  Keyboard: typeof Keyboard;
25
34
  'qt-keyboard': typeof Keyboard;
26
- NumericKeyboard: typeof NumericKeyboard;
27
- 'qt-numeric-keyboard': typeof NumericKeyboard;
28
- DatePicker: typeof DatePicker;
29
- 'qt-date-picker': typeof DatePicker;
35
+ PortalPool: typeof PortalPool;
36
+ 'qt-portal-pool': typeof PortalPool;
37
+ PortalItem: typeof PortalItem;
38
+ 'qt-portal-item': typeof PortalItem;
30
39
  }
31
40
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),V=require("@extscreen/es3-core"),D=require("@extscreen/es3-vue"),C=r.defineComponent({__name:"GridTabs",props:{tabsData:{},actionPayload:{}},emits:["onTabSelected","onTabNeedsData","onLoadMore","onItemPresence","onTabFocused","onItemClick","onItemFocused"],setup(e,{expose:o}){const a=r.ref(),t=x("GTTabs","com.quicktvui.plugin.glintui");return o({scrollToTop:(...s)=>{var n;return(n=a.value)==null?void 0:n.scrollToTop(...s)}}),(s,n)=>(r.openBlock(),r.createBlock(r.unref(t),r.mergeProps({ref_key:"nativeRef",ref:a,tabsData:e.tabsData,actionPayload:e.actionPayload,onOnTabSelected:n[0]||(n[0]=l=>s.$emit("onTabSelected",l.nativeEvent)),onOnTabNeedsData:n[1]||(n[1]=l=>s.$emit("onTabNeedsData",l.nativeEvent)),onOnLoadMore:n[2]||(n[2]=l=>s.$emit("onLoadMore",l.nativeEvent)),onOnItemPresence:n[3]||(n[3]=l=>s.$emit("onItemPresence",l.nativeEvent)),onOnTabFocused:n[4]||(n[4]=l=>s.$emit("onTabFocused",l.nativeEvent)),onOnItemClick:n[5]||(n[5]=l=>s.$emit("onItemClick",l.nativeEvent)),onOnItemFocused:n[6]||(n[6]=l=>s.$emit("onItemFocused",l.nativeEvent))},s.$attrs),{default:r.withCtx(()=>[r.renderSlot(s.$slots,"default")]),_:3},16,["tabsData","actionPayload"]))}}),ae=r.defineComponent({name:"PortalItem",props:{portalId:{type:String,required:!0},width:{type:[Number,String],required:!0},height:{type:[Number,String],required:!0}},setup(e){return{itemStyle:r.computed(()=>{const a=typeof e.width=="number"?`${e.width}px`:e.width,t=typeof e.height=="number"?`${e.height}px`:e.height;return{width:a,height:t,display:"flex",flexDirection:"column"}})}}}),X=(e,o)=>{const a=e.__vccOpts||e;for(const[t,s]of o)a[t]=s;return a};function le(e,o,a,t,s,n){const l=r.resolveComponent("qt-portal-item-native");return r.openBlock(),r.createBlock(l,{portalId:e.portalId,style:r.normalizeStyle(e.itemStyle)},{default:r.withCtx(()=>[r.renderSlot(e.$slots,"default")]),_:3},8,["portalId","style"])}const L=X(ae,[["render",le]]),ce=r.defineComponent({name:"PortalPool",components:{PortalItem:L},props:{data:{type:Array,default:()=>[]},presenceMap:{type:Object,default:()=>({})},gridBasis:{type:Number,default:24},totalWidth:{type:Number,default:1920}},setup(e){const o=r.ref([]),a=()=>{var s;const t=[];for(const n of e.data)if(n.viewType&&n.viewType.startsWith("portal:")&&n.portalId){const l=e.presenceMap[n.itemId]||"leave";if(l!=="leave"&&l!=="null"&&l){const h=n.span||e.gridBasis,b=Math.round(e.totalWidth/e.gridBasis*h),T=((s=n.layoutConfig)==null?void 0:s.aspectRatio)||1,A=Math.round(b/T);t.push({...n,presenceState:l,width:b,height:A})}}o.value=t};return r.watch(()=>e.data,a,{deep:!0,immediate:!0}),r.watch(()=>e.presenceMap,a,{deep:!0}),{activePortals:o}}});function ue(e,o,a,t,s,n){const l=r.resolveComponent("PortalItem"),h=r.resolveComponent("qt-portal-pool-native");return r.openBlock(),r.createBlock(h,{class:"qt-portal-pool-hidden"},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.activePortals,b=>(r.openBlock(),r.createBlock(l,{key:b.portalId,portalId:b.portalId,width:b.width,height:b.height},{default:r.withCtx(()=>[r.renderSlot(e.$slots,"default",{portal:b,presenceState:b.presenceState})]),_:2},1032,["portalId","width","height"]))),128))]),_:3})}const G=X(ce,[["render",ue]]);function de(e,o){const a=r.ref(!1),t=r.ref(!1);return{isIntersecting:a,isVisible:t,handlePresenceState:n=>{var l,h,b;switch(n){case"enter":a.value=!0,(l=o==null?void 0:o.onEnter)==null||l.call(o);break;case"visible":t.value=!0,(h=o==null?void 0:o.onVisible)==null||h.call(o);break;case"leave":a.value=!1,t.value=!1,(b=o==null?void 0:o.onLeave)==null||b.call(o);break}}}}function fe(){const e=r.ref(""),o=n=>{const l=Array.isArray(n)?n:[n];e.value=JSON.stringify(l)};return{actionPayloadStr:e,dispatchAction:o,updateItem:(n,l)=>{o({op:"UPDATE_ITEM",itemId:n,payload:l})},appendItems:(n,l)=>{o({op:"APPEND_SUB_ITEMS",itemId:n,payload:{subItems:l}})},removeItem:n=>{o({op:"REMOVE_ITEM",itemId:n})}}}function Y(e,o){if(JSON.stringify(e.page_spec)!==JSON.stringify(o.page_spec)||JSON.stringify(e.navConfig)!==JSON.stringify(o.navConfig))return"FULL_RELOAD";const a=e.tabs||[],t=o.tabs||[];if(a.length!==t.length)return"FULL_RELOAD";for(let n=0;n<t.length;n++)if(a[n].tabId!==t[n].tabId)return"FULL_RELOAD";const s=[];for(let n=0;n<t.length;n++){const l=a[n].items||[],h=t[n].items||[],b=t[n].tabId,T=new Map(l.map(d=>[d.id||d.itemId,d])),A=new Map(h.map(d=>[d.id||d.itemId,d]));let $=-1;const v=[];for(let d=0;d<h.length;d++){const y=h[d],P=y.id||y.itemId,c=T.get(P);if(c){const u=l.findIndex(S=>(S.id||S.itemId)===P);if(u<=$||($=u,c.viewType!==y.viewType||c.span!==y.span))return"FULL_RELOAD";const k=JSON.stringify(c.content)!==JSON.stringify(y.content),w=c.state!==y.state;(k||w)&&s.push({op:"UPDATE_ITEM",itemId:P,payload:{content:k?y.content:void 0,state:w?y.state:void 0}})}else{let u=!0;for(let k=d+1;k<h.length;k++)if(T.has(h[k].id||h[k].itemId)){u=!1;break}if(!u)return"FULL_RELOAD";v.push(y)}}v.length>0&&s.push({op:"APPEND_SUB_ITEMS",itemId:b,payload:{subItems:v}});for(const d of l){const y=d.id||d.itemId;A.has(y)||s.push({op:"REMOVE_ITEM",itemId:y})}}return s}function me(e){const o=r.ref(""),a=r.ref("");let t="";return r.watch(e,s=>{if(!s){o.value="",t="";return}const n=JSON.stringify(s);if(n!==t){if(!t){o.value=n,t=n;return}try{const l=JSON.parse(t),h=JSON.parse(n),b=Y(l,h);b==="FULL_RELOAD"?(console.log("[@quicktvui/naddons] Auto-Diff: 结构突变,执行全量刷新 (FULL_RELOAD)"),o.value=n):b.length>0&&(console.log("[@quicktvui/naddons] Auto-Diff: 命中局部更新,生成 Patch 指令 ->",b),a.value=JSON.stringify(b)),t=n}catch(l){console.warn("[@quicktvui/naddons] Auto-Diff failed, falling back to FULL_RELOAD",l),o.value=n,t=n}}},{deep:!0,immediate:!0}),{tabsDataStr:o,actionPayloadStr:a}}let _;var W;try{const e=require("@extscreen/es3-vue");_=e.registerElement||((W=e.default)==null?void 0:W.registerElement)}catch{}const Z={install:e=>{globalThis.__GTTabs_registered||(_?(_("gt-tabs",{component:{name:"GTTabs",processEventData(o,a){const t=o.handler||o,s=a||t.nativeParams||{};return t&&(t.nativeEvent=s),t}}}),_("qt-portal-pool-native",{component:{name:"QtPortalPool"}}),_("qt-portal-item-native",{component:{name:"QtPortalItem"}}),_("qt-grid-tabs",{component:{name:"GTTabs",defaultNativeProps:{},processEventData(o,a,t){return{...o,...t}}}}),globalThis.__GTTabs_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tags for GridTabs & Portals")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("GridTabs",C),e.component("gt-tabs",C),e.component("qt-grid-tabs",C),e.component("QtPortalItem",L),e.component("qt-portal-item",L),e.component("QtPortalPool",G),e.component("qt-portal-pool",G)}};function ge(e,o){const a=r.ref(""),t=r.ref(""),s=r.shallowRef([]),n=r.shallowRef([]);let l=!1,h=!1;const b="__virtual_single_tab__",T=r.ref({}),A=i=>{const m=Array.isArray(i)?i:[i];t.value=JSON.stringify(m)},$=(i,m)=>{if(!i)return!1;let f=!0;return i.id||(console.error(`[useGridTabs] ❌ 数据格式错误 (${m}): 卡片缺失必填字段 'id'。每个卡片必须有唯一标识才能进行后续更新!`,i),f=!1),i.viewType||(console.error(`[useGridTabs] ❌ 数据格式错误 (${m}): 卡片缺失必填字段 'viewType' (id: ${i.id||"未知"})。必须指定 Native 注册的视图类型或 Portal 标识!`,i),f=!1),f},v=(i,m)=>{if(!i)return!1;let f=!0;return i.tabId||(console.error(`[useGridTabs] ❌ 数据格式错误 (${m}): Tab 缺失必填字段 'tabId'。每个 Tab 必须有唯一标识!`,i),f=!1),(i.title===void 0||i.title===null)&&console.warn(`[useGridTabs] ⚠️ 数据格式警告 (${m}): Tab 缺失 'title' 字段 (tabId: ${i.tabId||"未知"}),导航栏可能显示为空。`,i),f},d=(i,m)=>{if(!i||i.length===0)return;const f=i[0].hasOwnProperty("tabId")||i[0].hasOwnProperty("items")&&Array.isArray(i[0].items);l=m==="1d",m==="1d"&&f?console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `items.value` (一维瀑布流) 赋值二维 Tabs 数据结构!请改用 `tabs.value = ...`"):m==="2d"&&!f&&console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `tabs.value` (二维导航) 赋值一维卡片列表数据结构!请改用 `items.value = ...`"),m==="1d"?i.forEach((p,g)=>$(p,`items.value[${g}]`)):i.forEach((p,g)=>{v(p,`tabs.value[${g}]`),p.items&&Array.isArray(p.items)&&p.items.forEach((I,E)=>$(I,`tabs.value[${g}].items[${E}]`))}),h=!0,y()},y=()=>{if(!h)return;let i={gridBasis:(o==null?void 0:o.gridBasis)??30,unitType:(o==null?void 0:o.unitType)??"px",layoutConfig:(o==null?void 0:o.layoutConfig)??{screenPadding:{left:60,right:60,top:0,bottom:60},navContentGapNormal:0,itemGap:24},navConfig:(o==null?void 0:o.navConfig)??{placement:"left",mode:"fixed",renderType:"classic",baseSize:200,expandedSize:300},referenceResolution:(o==null?void 0:o.referenceResolution)??{w:1920,h:1080}},m=[];l?(i.navConfig={...i.navConfig,renderType:"none"},m=[{tabId:b,title:"Virtual Tab",hidden:!0,items:n.value}]):m=s.value,a.value=JSON.stringify({page_spec:i,tabs:m})},P=(i,m)=>new Proxy(i,{get(f,p,g){return p==="push"?(...I)=>{I.forEach((B,ie)=>$(B,`push(${ie})`)),h||console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");const E=Array.prototype.push.apply(f,I);return A({op:"APPEND_SUB_ITEMS",itemId:m,payload:{subItems:I}}),E}:Reflect.get(f,p,g)},set(f,p,g,I){if(p!=="length"&&!isNaN(Number(p))){h||console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(p)}]。请先对 items.value 或 tabs.value 进行全量赋值!`),$(g,`索引赋值 [${String(p)}]`);const E=Reflect.set(f,p,g,I);return g&&g.id&&A({op:"UPDATE_ITEM",itemId:g.id,payload:g}),E}return Reflect.set(f,p,g,I)}}),c=i=>(i.items&&Array.isArray(i.items)&&!i.items.__isGridTabsProxy&&(i.items=P(i.items,i.tabId),Object.defineProperty(i.items,"__isGridTabsProxy",{value:!0,enumerable:!1})),new Proxy(i,{set(m,f,p,g){if(f==="items"){let I=p;Array.isArray(p)&&!p.__isGridTabsProxy&&(I=P(p,m.tabId),Object.defineProperty(I,"__isGridTabsProxy",{value:!0,enumerable:!1}));const E=Reflect.set(m,f,I,g);return y(),E}return Reflect.set(m,f,p,g)}})),u=i=>{const m=i.map(f=>c(f));return new Proxy(m,{set(f,p,g,I){if(p!=="length"&&!isNaN(Number(p))){let E=g;g.__isGridTabsProxy||(E=c(g),Object.defineProperty(E,"__isGridTabsProxy",{value:!0,enumerable:!1}));const B=Reflect.set(f,p,E,I);return y(),B}return Reflect.set(f,p,g,I)}})};r.watch(s,(i,m)=>{if(!i||i.length===0){a.value="",h=!1;return}if(i.__isGridTabsProxy)y();else{d(i,"2d");const f=u(i);Object.defineProperty(f,"__isGridTabsProxy",{value:!0,enumerable:!1}),s.value=f}},{flush:"sync"}),r.watch(n,(i,m)=>{if(!i||i.length===0){a.value="",h=!1;return}if(i.__isGridTabsProxy)y();else{d(i,"1d");const f=P(i,b);Object.defineProperty(f,"__isGridTabsProxy",{value:!0,enumerable:!1}),n.value=f}},{flush:"sync"});const k=i=>{if(!i||i.length===0){a.value="",h=!1;return}i[0].hasOwnProperty("tabId")||i[0].hasOwnProperty("items")&&Array.isArray(i[0].items)?s.value=i:n.value=i},w=i=>{T.value=i},S=r.computed(()=>({tabsData:a.value,actionPayload:t.value,onTabNeedsData:async i=>{if(!T.value.onTabNeedsData)return;const{tabId:m,index:f,reason:p}=i,g=await T.value.onTabNeedsData(m,f,p);if(g&&Array.isArray(g)){const I=s.value.find(E=>E.tabId===m);I&&(I.items=g)}},onLoadMore:async i=>{if(!T.value.onLoadMore)return;const{tabId:m,cursor:f,itemId:p}=i,g=await T.value.onLoadMore(m,f,p);if(g&&Array.isArray(g)&&g.length>0)if(l)n.value.push(...g);else{const I=s.value.find(E=>E.tabId===m);I&&I.items&&I.items.push(...g)}}}));return{tabsDataStr:a,actionPayloadStr:t,bindings:S,tabs:s,items:n,initData:k,setCallbacks:w,dispatchAction:A}}const K=r.defineComponent({__name:"RatingBar",props:{numStars:{},rating:{},stepSize:{},isIndicator:{type:Boolean}},emits:["onRatingChanged"],setup(e){const o=r.ref(),a=x("QtRatingBar","com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return(t,s)=>(r.openBlock(),r.createBlock(r.unref(a),r.mergeProps({ref_key:"nativeRef",ref:o,numStars:e.numStars,rating:e.rating,stepSize:e.stepSize,isIndicator:e.isIndicator,onOnRatingChanged:s[0]||(s[0]=n=>t.$emit("onRatingChanged",n.nativeEvent))},t.$attrs),{default:r.withCtx(()=>[r.renderSlot(t.$slots,"default")]),_:3},16,["numStars","rating","stepSize","isIndicator"]))}});let R;var j;try{const e=require("@extscreen/es3-vue");R=e.registerElement||((j=e.default)==null?void 0:j.registerElement)}catch{}const ee={install:e=>{globalThis.__QtRatingBar_registered||(R?(R("qt-rating-bar",{component:{name:"QtRatingBar",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),R("QtRatingBar",{component:{name:"QtRatingBar",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),globalThis.__QtRatingBar_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtRatingBar")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("RatingBar",K),e.component("qt-rating-bar",K)}},Q=r.defineComponent({__name:"Keyboard",props:{backgroundColor:{},textColor:{},weakTextColor:{},focusBackgroundColor:{},focusTextColor:{},placeholder:{},textFullKeyboard:{},textT9Keyboard:{},textClear:{},textDelete:{},currentInput:{}},emits:["onInputChanged","onKeyPressed"],setup(e){const o=r.ref(),a=x("QtKeyboard","com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return(t,s)=>(r.openBlock(),r.createBlock(r.unref(a),r.mergeProps({ref_key:"nativeRef",ref:o,backgroundColor:e.backgroundColor,textColor:e.textColor,weakTextColor:e.weakTextColor,focusBackgroundColor:e.focusBackgroundColor,focusTextColor:e.focusTextColor,placeholder:e.placeholder,textFullKeyboard:e.textFullKeyboard,textT9Keyboard:e.textT9Keyboard,textClear:e.textClear,textDelete:e.textDelete,currentInput:e.currentInput,onOnInputChanged:s[0]||(s[0]=n=>t.$emit("onInputChanged",n.nativeEvent)),onOnKeyPressed:s[1]||(s[1]=n=>t.$emit("onKeyPressed",n.nativeEvent))},t.$attrs),{default:r.withCtx(()=>[r.renderSlot(t.$slots,"default")]),_:3},16,["backgroundColor","textColor","weakTextColor","focusBackgroundColor","focusTextColor","placeholder","textFullKeyboard","textT9Keyboard","textClear","textDelete","currentInput"]))}});let N;var J;try{const e=require("@extscreen/es3-vue");N=e.registerElement||((J=e.default)==null?void 0:J.registerElement)}catch{}const te={install:e=>{globalThis.__QtKeyboard_registered||(N?(N("qt-keyboard",{component:{name:"QtKeyboard",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),N("QtKeyboard",{component:{name:"QtKeyboard",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),globalThis.__QtKeyboard_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtKeyboard")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("Keyboard",Q),e.component("qt-keyboard",Q)}},F=r.defineComponent({__name:"NumericKeyboard",props:{maxLength:{}},emits:["onNumberPressed"],setup(e){const o=r.ref(),a=x("QtNumericKeyboard","com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return(t,s)=>(r.openBlock(),r.createBlock(r.unref(a),r.mergeProps({ref_key:"nativeRef",ref:o,maxLength:e.maxLength,onOnNumberPressed:s[0]||(s[0]=n=>t.$emit("onNumberPressed",n.nativeEvent))},t.$attrs),{default:r.withCtx(()=>[r.renderSlot(t.$slots,"default")]),_:3},16,["maxLength"]))}});let O;var z;try{const e=require("@extscreen/es3-vue");O=e.registerElement||((z=e.default)==null?void 0:z.registerElement)}catch{}const ne={install:e=>{globalThis.__QtNumericKeyboard_registered||(O?(O("qt-numeric-keyboard",{component:{name:"QtNumericKeyboard",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),O("QtNumericKeyboard",{component:{name:"QtNumericKeyboard",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),globalThis.__QtNumericKeyboard_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtNumericKeyboard")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("NumericKeyboard",F),e.component("qt-numeric-keyboard",F)}},U=r.defineComponent({__name:"DatePicker",props:{initialDate:{}},emits:["onDateChanged"],setup(e){const o=r.ref(),a=x("QtDatePicker","com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return(t,s)=>(r.openBlock(),r.createBlock(r.unref(a),r.mergeProps({ref_key:"nativeRef",ref:o,initialDate:e.initialDate,onOnDateChanged:s[0]||(s[0]=n=>t.$emit("onDateChanged",n.nativeEvent))},t.$attrs),{default:r.withCtx(()=>[r.renderSlot(t.$slots,"default")]),_:3},16,["initialDate"]))}});let q;var H;try{const e=require("@extscreen/es3-vue");q=e.registerElement||((H=e.default)==null?void 0:H.registerElement)}catch{}const oe={install:e=>{globalThis.__QtDatePicker_registered||(q?(q("qt-date-picker",{component:{name:"QtDatePicker",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),q("QtDatePicker",{component:{name:"QtDatePicker",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),globalThis.__QtDatePicker_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtDatePicker")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("DatePicker",U),e.component("qt-date-picker",U)}},re={skipPluginCheck:!1},M=new Set;function x(e,o,a){return r.defineComponent({name:`${e}AsyncWrapper`,inheritAttrs:!1,props:{skipPluginCheck:{type:Boolean,default:!1}},setup(t,{slots:s,attrs:n}){const l=r.ref("loading"),h=r.ref("");let b=null,T=null;try{b=V.useES(),T=V.useESPlugin()}catch(v){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",v)}const A=async()=>{if(!b||typeof b.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const v=await b.isComponentRegistered(e);if(console.log(`[withAsyncPlugin] isComponentRegistered('${e}') 返回:`,v),v===!0||v&&typeof v=="object"&&(v.registered===!0||v.isRegistered===!0))return!0;try{const d=await D.Native.callNativeWithPromise("ExtendModule","getCoreSDKInfo");if(d&&d.core_version){const y=d.core_version;console.log(`[withAsyncPlugin] 当前引擎核心版本: ${y}`);const P=y.split(".").map(c=>parseInt(c,10));if(P.length>=3&&!isNaN(P[0])&&!isNaN(P[1])&&!isNaN(P[2]))if(P[0]*1e6+P[1]*1e3+P[2]>=1011205){console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${e}`);const u=e.split("-").map(S=>S.charAt(0).toUpperCase()+S.slice(1)).join("");console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${e}, ${u}`);const[k,w]=await Promise.all([D.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",e).catch(()=>!1),D.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",u).catch(()=>!1)]);if(console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${k}, ${w}]`),k===!0||w===!0)return!0}else console.log(`[withAsyncPlugin] 引擎版本 ${y} < 1.11.205,跳过 ExtendModule 检查`);else console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${y}`)}}catch(d){console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",d)}return!1}catch(v){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",v),!1}},$=async()=>{if(re.skipPluginCheck||t.skipPluginCheck){console.log(`[withAsyncPlugin] 跳过 ${e} 插件检查 (skipPluginCheck = true)`),l.value="ready";return}if(!o){l.value="ready";return}const v=await A();if(console.log(`[withAsyncPlugin] 拦截检查 - ${e} 是否已注册:`,v),v||M.has(o)){l.value="ready",M.add(o),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!T){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${e}`),l.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${o}`);try{await new Promise((d,y)=>{let P;const c={onPluginInstallSuccess(u,k,w){u===o&&(clearTimeout(P),T.removeListener(c),console.log(`[withAsyncPlugin] 安装成功 pkg=${u} 状态码=${k}`),k==1003||k==1001?(a?(console.log(`[withAsyncPlugin] 触发反射初始化: ${a}`),D.Native.callNative("EsNativeModule","callReflect",{entry:{from:a,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),d()):y(new Error(`安装失败 pkg=${u} status=${k} msg=${w}`)))},onPluginInstallError(u,k,w){u===o&&(clearTimeout(P),T.removeListener(c),y(new Error(`安装失败 pkg=${u} status=${k} msg=${w}`)))}};T.addListener({pkg:o},c),P=setTimeout(()=>{T.removeListener(c),y(new Error(`插件安装超时: ${o}`))},8e3),typeof T.installPlugin=="function"?T.installPlugin({pkg:o}):typeof T.install=="function"?T.install(o):y(new Error("当前运行时不支持 install / installPlugin"))}),await r.nextTick(),M.add(o),l.value="ready"}catch(d){console.error("[withAsyncPlugin] 插件加载失败:",d),h.value=(d==null?void 0:d.message)||String(d),l.value="error"}};return r.onMounted(()=>{$()}),()=>{const v={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...n.style||{}},d=n.class?`qt-plugin-container ${n.class}`:"qt-plugin-container";if(l.value==="loading")return r.h("div",{class:d,style:v},[r.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]);if(l.value==="error")return r.h("div",{class:d,style:v},[r.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${h.value}`)]);const y={};for(const[c,u]of Object.entries(n)){const k=c.startsWith("on")&&c!=="onItemPresence"&&c!=="onTabSelected"&&c!=="onTabNeedsData"&&c!=="onLoadMore"&&c!=="onTabFocused"&&c!=="onItemClick"&&c!=="onItemFocused";c==="class"||c==="style"||!c.startsWith("onOn")&&!k&&(y[c]=u)}const P={...y,style:{width:"100%",height:"100%",backgroundColor:"transparent"},onItemPresence:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onItemPresence:`,c);const u=n.onOnItemPresence||n.onItemPresence||n["onItem-presence"]||n.onitempresence;typeof u=="function"&&u(c)},onTabSelected:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onTabSelected:`,c);const u=n.onOnTabSelected||n.onTabSelected||n["onTab-selected"]||n.ontabselected;typeof u=="function"&&u(c)},onTabNeedsData:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onTabNeedsData:`,c);const u=n.onOnTabNeedsData||n.onTabNeedsData||n["onTab-needs-data"]||n.ontabneedsdata;typeof u=="function"&&u(c)},onLoadMore:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onLoadMore:`,c);const u=n.onOnLoadMore||n.onLoadMore||n["onLoad-more"]||n.onloadmore;typeof u=="function"&&u(c)},onTabFocused:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onTabFocused:`,c);const u=n.onOnTabFocused||n.onTabFocused||n["onTab-focused"]||n.ontabfocused;typeof u=="function"&&u(c)},onItemClick:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onItemClick:`,c);const u=n.onOnItemClick||n.onItemClick||n["onItem-click"]||n.onitemclick;typeof u=="function"&&u(c)},onItemFocused:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onItemFocused:`,c);const u=n.onOnItemFocused||n.onItemFocused||n["onItem-focused"]||n.onitemfocused;typeof u=="function"&&u(c)}};return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:",Object.keys(P)),r.h("div",{class:d,style:v},[r.h(e,P,s.default?s.default():[])])}}})}const se={install:e=>{e.use(Z),e.use(ee),e.use(te),e.use(ne),e.use(oe)}};exports.DatePicker=U;exports.DatePickerPlugin=oe;exports.GridTabs=C;exports.GridTabsPlugin=Z;exports.Keyboard=Q;exports.KeyboardPlugin=te;exports.NumericKeyboard=F;exports.NumericKeyboardPlugin=ne;exports.PortalItem=L;exports.PortalPool=G;exports.QuickTVUINAddons=se;exports.QuickTVUINAddonsConfig=re;exports.RatingBar=K;exports.RatingBarPlugin=ee;exports.default=se;exports.diffGridTabsData=Y;exports.useGridItemPresence=de;exports.useGridTabs=ge;exports.useGridTabsData=me;exports.useGridTabsUpdater=fe;exports.withAsyncPlugin=x;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),x=require("@extscreen/es3-vue"),Q=require("@extscreen/es3-core"),Z="QtGridTabs",D=l.defineComponent({__name:"GridTabs",props:{protocolVersion:{},tabsData:{},actionPayload:{}},emits:["onTabSelected","onTabNeedsData","onLoadMore","onItemPresence","onTabFocused","onItemClick","onItemFocused","onProtocolMismatch"],setup(o,{expose:r}){const u=l.ref(),g=O(),f=Z+"_Plugin",a=(g.isPluginActive?f:Z).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),b=C(a,g.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var s,c;return((c=(s=u.value)==null?void 0:s.getNativeNode)==null?void 0:c.call(s))||u.value},dispatchAction:(...s)=>{var v,$;const c=(($=(v=u.value)==null?void 0:v.getNativeNode)==null?void 0:$.call(v))||u.value;c&&x.Native.callUIFunction(c,"dispatchAction",s)},scrollToTop:(...s)=>{var v,$;const c=(($=(v=u.value)==null?void 0:v.getNativeNode)==null?void 0:$.call(v))||u.value;c&&x.Native.callUIFunction(c,"scrollToTop",s)}}),(s,c)=>(l.openBlock(),l.createBlock(l.unref(b),l.mergeProps({ref_key:"nativeRef",ref:u,protocolVersion:o.protocolVersion,tabsData:o.tabsData,actionPayload:o.actionPayload,onOnTabSelected:c[0]||(c[0]=v=>s.$emit("onTabSelected",v.nativeEvent)),onOnTabNeedsData:c[1]||(c[1]=v=>s.$emit("onTabNeedsData",v.nativeEvent)),onOnLoadMore:c[2]||(c[2]=v=>s.$emit("onLoadMore",v.nativeEvent)),onOnItemPresence:c[3]||(c[3]=v=>s.$emit("onItemPresence",v.nativeEvent)),onOnTabFocused:c[4]||(c[4]=v=>s.$emit("onTabFocused",v.nativeEvent)),onOnItemClick:c[5]||(c[5]=v=>s.$emit("onItemClick",v.nativeEvent)),onOnItemFocused:c[6]||(c[6]=v=>s.$emit("onItemFocused",v.nativeEvent)),onOnProtocolMismatch:c[7]||(c[7]=v=>s.$emit("onProtocolMismatch",v.nativeEvent))},s.$attrs),{default:l.withCtx(()=>[l.renderSlot(s.$slots,"default")]),_:3},16,["protocolVersion","tabsData","actionPayload"]))}});let F;var X;try{const o=require("@extscreen/es3-vue");F=o.registerElement||((X=o.default)==null?void 0:X.registerElement)}catch{}const oe={install:o=>{if(!globalThis.__QtGridTabs_registered)if(F){const r=(u,g)=>{F(u,{component:{name:g?"QtGridTabs_Plugin":"QtGridTabs",processEventData(f,y){const a=f.handler||f,b=y||(a==null?void 0:a.nativeParams)||{};return a&&(a.nativeEvent=b),a}}})};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")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("GridTabs",D),o.component("qt-grid-tabs",D),o.component("gt-tabs",D)}};function de(o,r){const u=l.ref(""),g=l.shallowRef([]),f=l.shallowRef([]);let y=!1,a=!1;const b="__virtual_single_tab__",s=l.ref({}),c=e=>{const t=Array.isArray(e)?e:[e],n=JSON.stringify(t);if(a&&o.value){if(typeof o.value.dispatchAction=="function"){console.log("[useGridTabs] Calling Wrapper dispatchAction directly"),o.value.dispatchAction(n);return}let i=o.value;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.Native.callUIFunction(i,"dispatchAction",[n])):console.warn("[useGridTabs] Native target is null or undefined, cannot call dispatchAction")}},v=(e,t)=>{if(!e)return!1;let n=!0;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},$=(e,t)=>{if(!e)return!1;let n=!0;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},R=(e,t)=>{if(!e||e.length===0)return;k.clear();const n=e[0].hasOwnProperty("tabId")||e[0].hasOwnProperty("items")&&Array.isArray(e[0].items);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,d)=>v(i,`items.value[${d}]`)):e.forEach((i,d)=>{$(i,`tabs.value[${d}]`),i.items&&Array.isArray(i.items)&&i.items.forEach((p,P)=>v(p,`tabs.value[${d}].items[${P}]`))}),a=!0,h()},k=new Set,h=(e="unknown")=>{if(!a){console.warn("[useGridTabs] triggerRootUpdate skipped because isInitialized is false");return}let t={gridBasis:(r==null?void 0:r.gridBasis)??30,unitType:(r==null?void 0:r.unitType)??"px",contentConfig:(r==null?void 0:r.contentConfig)??(r==null?void 0:r.layoutConfig)??{padding:[0,60,60,60],navContentGapNormal:0,itemGap:24},navConfig:(r==null?void 0:r.navConfig)??{dock:"left",mode:"fixed",renderType:"smart-hybrid",box:{size:[200,0]},expandedBox:{size:[300,0]}},cacheConfig:(r==null?void 0:r.cacheConfig)??{offscreenPageLimit:1,prefetchOffset:2,resetOnSwitch:!0},animationConfig:(r==null?void 0:r.animationConfig)??{duration:250,layoutEntrance:"staggered_slide_up",itemUpdate:"fade_cross"},focusConfig:(r==null?void 0:r.focusConfig)??{defaultFocus:"content",restoreLastFocus:!0},referenceResolution:(r==null?void 0:r.referenceResolution)??{w:1920,h:1080}},n=[];y?(t.navConfig={...t.navConfig,renderType:"none"},n=[{tabId:b,title:"Virtual Tab",hidden:!0,items:f.value}]):n=g.value;const i=JSON.stringify({page_spec:t,tabs:n});u.value===""?(console.log(`[useGridTabs] triggerRootUpdate: Initializing tabsDataStr (length=${i.length})`),u.value=i):(console.log(`[useGridTabs] triggerRootUpdate: Sending RELOAD_TABS action directly to Native (length=${i.length})`),u.value=i,c({op:"RELOAD_TABS",payload:{pageSpec:t,page_spec:t,tabs:n}}))},G=e=>!e||typeof e!="object"||e.__isGridTabsProxy?e:(e.content&&typeof e.content=="object"&&!e.content.__isGridTabsProxy&&(e.content=new Proxy(e.content,{set(t,n,i,d){const p=Reflect.set(t,n,i,d);return e.id&&a&&c({op:"UPDATE_ITEM",itemId:e.id,payload:e}),p}}),Object.defineProperty(e.content,"__isGridTabsProxy",{value:!0,enumerable:!1})),new Proxy(e,{set(t,n,i,d){const p=Reflect.set(t,n,i,d);return t.id&&a&&c({op:"UPDATE_ITEM",itemId:t.id,payload:t}),p}})),S=(e,t)=>{for(let n=0;n<e.length;n++)e[n]=G(e[n]);return new Proxy(e,{get(n,i,d){return i==="push"?(...p)=>{p.forEach((M,ue)=>v(M,`push(${ue})`)),a||console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");const P=p.map(M=>G(M)),_=Array.prototype.push.apply(n,P);return c({op:"APPEND_SUB_ITEMS",itemId:t,payload:{subItems:P}}),_}:Reflect.get(n,i,d)},set(n,i,d,p){if(i!=="length"&&!isNaN(Number(i))){a||console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(i)}]。请先对 items.value 或 tabs.value 进行全量赋值!`),v(d,`索引赋值 [${String(i)}]`);const P=G(d),_=Reflect.set(n,i,P,p);return P&&P.id&&c({op:"UPDATE_ITEM",itemId:P.id,payload:P}),_}return Reflect.set(n,i,d,p)}})},m=e=>(e.items&&Array.isArray(e.items)&&!e.items.__isGridTabsProxy&&(e.items=S(e.items,e.tabId),Object.defineProperty(e.items,"__isGridTabsProxy",{value:!0,enumerable:!1})),new Proxy(e,{set(t,n,i,d){if(n==="items"){let p=i;Array.isArray(i)&&!i.__isGridTabsProxy&&(p=S(i,t.tabId),Object.defineProperty(p,"__isGridTabsProxy",{value:!0,enumerable:!1}));const P=Reflect.set(t,n,p,d);return h(),P}return Reflect.set(t,n,i,d)}})),T=e=>{const t=e.map(n=>m(n));return new Proxy(t,{set(n,i,d,p){if(i!=="length"&&!isNaN(Number(i))){let P=d;d.__isGridTabsProxy||(P=m(d),Object.defineProperty(P,"__isGridTabsProxy",{value:!0,enumerable:!1}));const _=Reflect.set(n,i,P,p);return h(),_}return Reflect.set(n,i,d,p)}})};l.watch(g,(e,t)=>{if(console.log("[useGridTabs] watch(tabs) triggered:",{newTabs:e,isInitialized:a}),!e||e.length===0){u.value="",a=!1;return}if(e.__isGridTabsProxy)console.log("[useGridTabs] newTabs is ALREADY a proxy, triggering root update"),h();else{console.log("[useGridTabs] newTabs is NOT a proxy, performing full deduceModeAndInitialize & wrapping"),R(e,"2d");const n=T(e);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),g.value=n,h()}},{flush:"sync"}),l.watch(f,(e,t)=>{if(console.log("[useGridTabs] watch(items) triggered:",{newItems:e,isInitialized:a}),!e||e.length===0){u.value="",a=!1;return}if(e.__isGridTabsProxy)console.log("[useGridTabs] newItems is ALREADY a proxy, triggering root update"),h();else{console.log("[useGridTabs] newItems is NOT a proxy, performing full deduceModeAndInitialize & wrapping"),R(e,"1d");const n=S(e,b);Object.defineProperty(n,"__isGridTabsProxy",{value:!0,enumerable:!1}),f.value=n,h()}},{flush:"sync"});const E=()=>{console.log("[useGridTabs] resetInitialization called manually"),a=!1,u.value=""},A=e=>{if(!e||e.length===0){u.value="",a=!1;return}e[0].hasOwnProperty("tabId")||e[0].hasOwnProperty("items")&&Array.isArray(e[0].items)?g.value=e:f.value=e},I=e=>{s.value=e},N=l.computed(()=>({tabsData:u.value,onTabNeedsData:async(...e)=>{let t=e[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),!s.value.onTabNeedsData)return;const{tabId:n,index:i,reason:d}=t;if(k.has(n)){console.log(`[useGridTabs] onTabNeedsData SKIP: tabId=${n} 已经发起过请求,防止死循环`);return}k.add(n);try{const p=await s.value.onTabNeedsData(n,i,d);if(p&&Array.isArray(p)){const P=g.value.find(_=>_.tabId===n);P&&(P.items=p)}}catch(p){console.error("[useGridTabs] onTabNeedsData 执行失败:",p),k.delete(n)}},onLoadMore:async(...e)=>{let t=e[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),!s.value.onLoadMore)return;const{tabId:n,cursor:i,itemId:d}=t,p=await s.value.onLoadMore(n,i,d);if(p&&Array.isArray(p)&&p.length>0)if(y)f.value.push(...p);else{const P=g.value.find(_=>_.tabId===n);P&&P.items&&P.items.push(...p)}},onItemPresence:(...e)=>{let t=e[0];if(console.log("[useGridTabs] ⚡️ bindings caught onItemPresence:",t),s.value.onItemPresence)try{let n=typeof t=="string"?t:(t==null?void 0:t.nativeEvent)||t;n&&typeof n.data=="string"&&(n=n.data);const i=typeof n=="string"?JSON.parse(n):n;i&&i.type==="VIEW_PRESENCE_BATCH"&&Array.isArray(i.payload)?i.payload.forEach(d=>{d.itemId&&typeof d.itemId=="string"&&d.itemId.startsWith("fallback_pos_")&&console.warn(`[useGridTabs] ⚠️ 警告:检测到列表项曝光 (index=${d.index}),但未配置 itemId。请检查传入的 items 数组,务必为每个数据项指定唯一的 itemId,否则底层无法准确进行去重与曝光上报。`),s.value.onItemPresence(d)}):s.value.onItemPresence(i)}catch(n){console.error("[useGridTabs] Failed to parse onItemPresence event payload:",n),s.value.onItemPresence(t)}},onTabSelected:(...e)=>{let t=e[0];t&&t.nativeEvent&&(t=t.nativeEvent),s.value.onTabSelected&&s.value.onTabSelected(t)},onItemClick:(...e)=>{let t=e[0];if(console.log("[useGridTabs] RAW onItemClick intercepted from Native:",t),t&&t.nativeEvent&&(t=t.nativeEvent),s.value.onItemClick)try{let n=typeof t=="string"?t:(t==null?void 0:t.data)||t;console.log("[useGridTabs] Parsed eventStr:",n);const i=typeof n=="string"?JSON.parse(n):n;s.value.onItemClick(i)}catch(n){console.error("[useGridTabs] Failed to parse onItemClick event payload:",n),s.value.onItemClick(t)}else console.warn("[useGridTabs] onItemClick triggered but NO callback registered in callbacksRef!")},onItemFocused:(...e)=>{let t=e[0];if(t&&t.nativeEvent&&(t=t.nativeEvent),s.value.onItemFocused)try{let n=typeof t=="string"?t:(t==null?void 0:t.data)||t;const i=typeof n=="string"?JSON.parse(n):n;s.value.onItemFocused(i)}catch(n){console.error("[useGridTabs] Failed to parse onItemFocused event payload:",n),s.value.onItemFocused(t)}},onTabFocused:(...e)=>{let t=e[0];t&&t.nativeEvent&&(t=t.nativeEvent),s.value.onTabFocused&&s.value.onTabFocused(t)}}));return{tabsDataStr:u,bindings:N,tabs:g,items:f,initData:A,setCallbacks:I,updateItem:(e,t)=>{if(!a){console.error("[useGridTabs] ❌ 时机错误: 尚未初始化数据,无法调用 updateItem");return}c({op:"UPDATE_ITEM",itemId:e,payload:t});const n=i=>{for(const d in t)d==="content"&&i.content?Object.assign(i.content,t.content):i[d]=t[d]};if(y){const i=f.value.find(d=>d.id===e);i&&n(i)}else for(const i of g.value)if(i.items){const d=i.items.find(p=>p.id===e);if(d){n(d);break}}},dispatchAction:c,resetInitialization:E}}const J="QtKeyboard",L=l.defineComponent({__name:"Keyboard",props:{backgroundColor:{},textColor:{},weakTextColor:{},focusBackgroundColor:{},focusTextColor:{},placeholder:{},textFullKeyboard:{},textT9Keyboard:{},textClear:{},textDelete:{},currentInput:{}},emits:["onInputChanged","onKeyPressed"],setup(o,{expose:r}){const u=l.ref(),g=O(),f=J+"_Plugin",a=(g.isPluginActive?f:J).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),b=C(a,g.pluginPackageName||"com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return r({getNativeNode:()=>{var s,c;return((c=(s=u.value)==null?void 0:s.getNativeNode)==null?void 0:c.call(s))||u.value}}),(s,c)=>(l.openBlock(),l.createBlock(l.unref(b),l.mergeProps({ref_key:"nativeRef",ref:u,backgroundColor:o.backgroundColor,textColor:o.textColor,weakTextColor:o.weakTextColor,focusBackgroundColor:o.focusBackgroundColor,focusTextColor:o.focusTextColor,placeholder:o.placeholder,textFullKeyboard:o.textFullKeyboard,textT9Keyboard:o.textT9Keyboard,textClear:o.textClear,textDelete:o.textDelete,currentInput:o.currentInput,onOnInputChanged:c[0]||(c[0]=v=>s.$emit("onInputChanged",v.nativeEvent)),onOnKeyPressed:c[1]||(c[1]=v=>s.$emit("onKeyPressed",v.nativeEvent))},s.$attrs),{default:l.withCtx(()=>[l.renderSlot(s.$slots,"default")]),_:3},16,["backgroundColor","textColor","weakTextColor","focusBackgroundColor","focusTextColor","placeholder","textFullKeyboard","textT9Keyboard","textClear","textDelete","currentInput"]))}});let K;var ee;try{const o=require("@extscreen/es3-vue");K=o.registerElement||((ee=o.default)==null?void 0:ee.registerElement)}catch{}const se={install:o=>{if(!globalThis.__QtKeyboard_registered)if(K){const r=(u,g)=>{K(u,{component:{name:g?"QtKeyboard_Plugin":"QtKeyboard",processEventData(f,y){const a=f.handler||f,b=y||(a==null?void 0:a.nativeParams)||{};return a&&(a.nativeEvent=b),a}}})};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")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("Keyboard",L),o.component("qt-keyboard",L)}},Y="QtPortalPool",U=l.defineComponent({__name:"PortalPool",setup(o,{expose:r}){const u=l.ref(),g=O(),f=Y+"_Plugin",a=(g.isPluginActive?f:Y).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),b=C(a,g.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var s,c;return((c=(s=u.value)==null?void 0:s.getNativeNode)==null?void 0:c.call(s))||u.value}}),(s,c)=>(l.openBlock(),l.createBlock(l.unref(b),l.mergeProps({ref_key:"nativeRef",ref:u},s.$attrs),{default:l.withCtx(()=>[l.renderSlot(s.$slots,"default")]),_:3},16))}});let B;var te;try{const o=require("@extscreen/es3-vue");B=o.registerElement||((te=o.default)==null?void 0:te.registerElement)}catch{}const re={install:o=>{if(!globalThis.__QtPortalPool_registered)if(B){const r=(u,g)=>{B(u,{component:{name:g?"QtPortalPool_Plugin":"QtPortalPool",processEventData(f,y){const a=f.handler||f,b=y||(a==null?void 0:a.nativeParams)||{};return a&&(a.nativeEvent=b),a}}})};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")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("PortalPool",U),o.component("qt-portal-pool",U)}},H="QtPortalItem",V=l.defineComponent({__name:"PortalItem",props:{portalId:{}},setup(o,{expose:r}){const u=l.ref(),g=O(),f=H+"_Plugin",a=(g.isPluginActive?f:H).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase().replace(/^-/,""),b=C(a,g.pluginPackageName||"com.quicktvui.plugin.glintui");return r({getNativeNode:()=>{var s,c;return((c=(s=u.value)==null?void 0:s.getNativeNode)==null?void 0:c.call(s))||u.value}}),(s,c)=>(l.openBlock(),l.createBlock(l.unref(b),l.mergeProps({ref_key:"nativeRef",ref:u,portalId:o.portalId},s.$attrs),{default:l.withCtx(()=>[l.renderSlot(s.$slots,"default")]),_:3},16,["portalId"]))}});let j;var ne;try{const o=require("@extscreen/es3-vue");j=o.registerElement||((ne=o.default)==null?void 0:ne.registerElement)}catch{}const ie={install:o=>{if(!globalThis.__QtPortalItem_registered)if(j){const r=(u,g)=>{j(u,{component:{name:g?"QtPortalItem_Plugin":"QtPortalItem",processEventData(f,y){const a=f.handler||f,b=y||(a==null?void 0:a.nativeParams)||{};return a&&(a.nativeEvent=b),a}}})};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")}else console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue");o.component("PortalItem",V),o.component("qt-portal-item",V)}},ae={skipPluginCheck:!1},q=new Set;function C(o,r,u){return l.defineComponent({name:`${o}AsyncWrapper`,inheritAttrs:!1,props:{skipPluginCheck:{type:Boolean,default:!1}},setup(g,{slots:f,attrs:y,expose:a}){const b=l.ref("loading"),s=l.ref(""),c=l.ref(),v=globalThis.__VUE_INSTANCE__;a({getNativeNode:()=>{let m=c.value;return!m&&v&&v.vnode&&v.vnode.el&&(m=v.vnode.el,m.childNodes&&m.childNodes.length>0&&(m=m.childNodes[0])),m},nativeRef:c});let k=null,h=null;try{k=Q.useES(),h=Q.useESPlugin()}catch(m){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",m)}const G=async()=>{if(!k||typeof k.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const m=await k.isComponentRegistered(o);if(console.log(`[withAsyncPlugin] isComponentRegistered('${o}') 返回:`,m),m===!0||m&&typeof m=="object"&&(m.registered===!0||m.isRegistered===!0))return!0;try{const T=await x.Native.callNativeWithPromise("ExtendModule","getCoreSDKInfo");if(T&&T.core_version){const E=T.core_version;console.log(`[withAsyncPlugin] 当前引擎核心版本: ${E}`);const A=E.split(".").map(I=>parseInt(I,10));if(A.length>=3&&!isNaN(A[0])&&!isNaN(A[1])&&!isNaN(A[2]))if(A[0]*1e6+A[1]*1e3+A[2]>=1011205){console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${o}`);const N=o.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("");console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${o}, ${N}`);const[w,e]=await Promise.all([x.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",o).catch(()=>!1),x.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",N).catch(()=>!1)]);if(console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${w}, ${e}]`),w===!0||e===!0)return!0}else console.log(`[withAsyncPlugin] 引擎版本 ${E} < 1.11.205,跳过 ExtendModule 检查`);else console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${E}`)}}catch(T){console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",T)}return!1}catch(m){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",m),!1}},S=async()=>{if(ae.skipPluginCheck||g.skipPluginCheck){console.log(`[withAsyncPlugin] 跳过 ${o} 插件检查 (skipPluginCheck = true)`),b.value="ready";return}if(!r){b.value="ready";return}const m=await G();if(console.log(`[withAsyncPlugin] 拦截检查 - ${o} 是否已注册:`,m),m||q.has(r)){b.value="ready",q.add(r),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!h){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${o}`),b.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${r}`);try{await new Promise((T,E)=>{let A;const I={onPluginInstallSuccess(N,w,e){N===r&&(clearTimeout(A),h.removeListener(I),console.log(`[withAsyncPlugin] 安装成功 pkg=${N} 状态码=${w}`),w==1003||w==1001?(u?(console.log(`[withAsyncPlugin] 触发反射初始化: ${u}`),x.Native.callNative("EsNativeModule","callReflect",{entry:{from:u,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),T()):E(new Error(`安装失败 pkg=${N} status=${w} msg=${e}`)))},onPluginInstallError(N,w,e){N===r&&(clearTimeout(A),h.removeListener(I),E(new Error(`安装失败 pkg=${N} status=${w} msg=${e}`)))}};h.addListener({pkg:r},I),A=setTimeout(()=>{h.removeListener(I),E(new Error(`插件安装超时: ${r}`))},8e3),typeof h.installPlugin=="function"?h.installPlugin({pkg:r}):typeof h.install=="function"?h.install(r):E(new Error("当前运行时不支持 install / installPlugin"))}),await l.nextTick(),q.add(r),b.value="ready"}catch(T){console.error("[withAsyncPlugin] 插件加载失败:",T),s.value=(T==null?void 0:T.message)||String(T),b.value="error"}};return l.onMounted(()=>{S()}),()=>{const m={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...y.style||{}},T=y.class?`qt-plugin-container ${y.class}`:"qt-plugin-container";if(b.value==="loading")return l.h("div",{class:T,style:m},[l.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]);if(b.value==="error")return l.h("div",{class:T,style:m},[l.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${s.value}`)]);const E={},A={};for(const[e,t]of Object.entries(y))if(!(e==="class"||e==="style"))if(e.startsWith("on")&&typeof t=="function"){let n=e;e.startsWith("onOn")&&(n="on"+e.slice(4)),A[n]=t}else if(e.startsWith("on")&&Array.isArray(t)){let n=e;e.startsWith("onOn")&&(n="on"+e.slice(4)),A[n]=t}else e.startsWith("onOn")||(E[e]=t);const I={...E,...A,ref:e=>{c.value=e},style:{width:"100%",height:"100%",backgroundColor:"transparent"}},N=I.tabsData||"",w=I.actionPayload||"";return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:",Object.keys(I),"tabsData.length=",N.length,"actionPayload.length=",w.length),l.h("div",{class:T,style:m},[l.h(o,I,f.default?f.default():[])])}}})}const W=Symbol("AddonEnvContext"),le={isPluginActive:!1,nameSuffix:"",pluginPackageName:"com.quicktvui.plugin.glintui",builtInVersions:{}};async function ve(o="com.quicktvui.plugin.glintui",r="_Plugin"){const u=Q.useES();let g={};try{const s=await x.Native.callNativeModule("AddonEnvModule","getBuiltInVersions",[]);s&&typeof s=="object"&&(g=s)}catch(s){console.warn("[AddonProvider] Failed to fetch built-in versions from AddonEnvModule",s)}const f=`QtGridTabs${r}`,y=u.isComponentRegistered(f),a=y instanceof Promise?await y:y,b={isPluginActive:a,nameSuffix:a?r:"",pluginPackageName:a?`${o}.ext`:o,builtInVersions:g};return console.info("[AddonProvider] Environment initialized:",b),b}let z=l.ref(le);function ge(o){z.value=o,l.provide(W,z)}function O(){var o;return((o=l.inject(W,z))==null?void 0:o.value)||le}const ce={install:o=>{o.use(oe),o.use(se),o.use(re),o.use(ie)}};exports.ADDON_ENV_CONTEXT_KEY=W;exports.GridTabs=D;exports.GridTabsPlugin=oe;exports.Keyboard=L;exports.KeyboardPlugin=se;exports.PortalItem=V;exports.PortalItemPlugin=ie;exports.PortalPool=U;exports.PortalPoolPlugin=re;exports.QuickTVUINAddons=ce;exports.QuickTVUINAddonsConfig=ae;exports.default=ce;exports.initAddonEnv=ve;exports.provideAddonEnv=ge;exports.useAddonEnv=O;exports.useGridTabs=de;exports.withAsyncPlugin=C;