@lytjs/core-vnode 6.5.0 → 6.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,174 +1,174 @@
1
- # @lytjs/core-vnode
2
-
3
- > LytJS 核心应用 API(VNode 渲染模式),适合传统模板渲染场景
4
-
5
- ## 安装
6
-
7
- ```bash
8
- npm install @lytjs/core-vnode
9
- ```
10
-
11
- ## 与 @lytjs/core 的区别
12
-
13
- | 特性 | @lytjs/core-vnode | @lytjs/core |
14
- | -------- | ----------------- | --------------------- |
15
- | 渲染模式 | 仅 VNode | VNode + Signal 双模式 |
16
- | 包体积 | 更小 | 完整功能 |
17
- | 适用场景 | 传统模板应用 | 需要双模式切换的应用 |
18
-
19
- ## 核心 API
20
-
21
- ### createApp
22
-
23
- 创建 VNode 模式应用实例:
24
-
25
- ```typescript
26
- import { createApp, defineComponent, ref, h } from '@lytjs/core-vnode';
27
-
28
- const App = defineComponent({
29
- setup() {
30
- const count = ref(0);
31
-
32
- const increment = () => {
33
- count.value++;
34
- };
35
-
36
- return () =>
37
- h('div', [h('p', `Count: ${count.value}`), h('button', { onClick: increment }, 'Increment')]);
38
- },
39
- });
40
-
41
- const app = createApp(App);
42
- app.mount('#app');
43
- ```
44
-
45
- ### 使用模板
46
-
47
- ```typescript
48
- import { createApp, defineComponent, ref } from '@lytjs/core-vnode';
49
-
50
- const App = defineComponent({
51
- template: `
52
- <div>
53
- <p>Count: {{ count }}</p>
54
- <button @click="increment">Increment</button>
55
- </div>
56
- `,
57
- setup() {
58
- const count = ref(0);
59
- const increment = () => count.value++;
60
- return { count, increment };
61
- },
62
- });
63
-
64
- createApp(App).mount('#app');
65
- ```
66
-
67
- ### 生命周期钩子
68
-
69
- ```typescript
70
- import {
71
- onMounted,
72
- onUnmounted,
73
- onUpdated,
74
- onBeforeMount,
75
- onBeforeUnmount,
76
- onBeforeUpdate,
77
- onErrorCaptured,
78
- } from '@lytjs/core-vnode';
79
-
80
- const App = defineComponent({
81
- setup() {
82
- onMounted(() => {
83
- console.log('组件已挂载');
84
- });
85
-
86
- onUnmounted(() => {
87
- console.log('组件已卸载');
88
- });
89
-
90
- onErrorCaptured((err, instance, info) => {
91
- console.error('捕获到错误:', err, info);
92
- return false; // 阻止错误传播
93
- });
94
- },
95
- });
96
- ```
97
-
98
- ### 内置组件
99
-
100
- ```typescript
101
- import {
102
- KeepAlive,
103
- Suspense,
104
- Transition,
105
- TransitionGroup,
106
- Teleport,
107
- ErrorBoundary,
108
- } from '@lytjs/core-vnode';
109
-
110
- // KeepAlive 缓存组件
111
- // Suspense 处理异步组件
112
- // Transition/TransitionGroup 过渡动画
113
- // Teleport 传送内容
114
- // ErrorBoundary 错误边界
115
- ```
116
-
117
- ## 响应式 API
118
-
119
- 从 @lytjs/reactivity 重导出:
120
-
121
- ```typescript
122
- import {
123
- // 基础响应式
124
- ref,
125
- reactive,
126
- computed,
127
- watch,
128
- watchEffect,
129
- // 工具函数
130
- toRef,
131
- toRefs,
132
- unref,
133
- toValue,
134
- // 类型守卫
135
- isRef,
136
- isReactive,
137
- isReadonly,
138
- isProxy,
139
- } from '@lytjs/core-vnode';
140
- ```
141
-
142
- ## 组合式 API
143
-
144
- ```typescript
145
- import {
146
- useSlots,
147
- useAttrs,
148
- useModel,
149
- useTemplateRef,
150
- useId,
151
- useCssModule,
152
- useCssVars,
153
- } from '@lytjs/core-vnode';
154
- ```
155
-
156
- ## 类型定义
157
-
158
- ```typescript
159
- import type {
160
- App,
161
- AppConfig,
162
- Component,
163
- ComponentOptions,
164
- ComponentPublicInstance,
165
- VNode,
166
- VNodeChildren,
167
- } from '@lytjs/core-vnode';
168
- ```
169
-
170
- ## 相关包
171
-
172
- - [@lytjs/core](../core) - 完整核心(支持双模式)
173
- - [@lytjs/core-signal](../core-signal) - 仅 Signal 模式
174
- - [@lytjs/vdom](../vdom) - 虚拟 DOM 实现
1
+ # @lytjs/core-vnode
2
+
3
+ > LytJS 核心应用 API(VNode 渲染模式),适合传统模板渲染场景
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install @lytjs/core-vnode
9
+ ```
10
+
11
+ ## 与 @lytjs/core 的区别
12
+
13
+ | 特性 | @lytjs/core-vnode | @lytjs/core |
14
+ | -------- | ----------------- | --------------------- |
15
+ | 渲染模式 | 仅 VNode | VNode + Signal 双模式 |
16
+ | 包体积 | 更小 | 完整功能 |
17
+ | 适用场景 | 传统模板应用 | 需要双模式切换的应用 |
18
+
19
+ ## 核心 API
20
+
21
+ ### createApp
22
+
23
+ 创建 VNode 模式应用实例:
24
+
25
+ ```typescript
26
+ import { createApp, defineComponent, ref, h } from '@lytjs/core-vnode';
27
+
28
+ const App = defineComponent({
29
+ setup() {
30
+ const count = ref(0);
31
+
32
+ const increment = () => {
33
+ count.value++;
34
+ };
35
+
36
+ return () =>
37
+ h('div', [h('p', `Count: ${count.value}`), h('button', { onClick: increment }, 'Increment')]);
38
+ },
39
+ });
40
+
41
+ const app = createApp(App);
42
+ app.mount('#app');
43
+ ```
44
+
45
+ ### 使用模板
46
+
47
+ ```typescript
48
+ import { createApp, defineComponent, ref } from '@lytjs/core-vnode';
49
+
50
+ const App = defineComponent({
51
+ template: `
52
+ <div>
53
+ <p>Count: {{ count }}</p>
54
+ <button @click="increment">Increment</button>
55
+ </div>
56
+ `,
57
+ setup() {
58
+ const count = ref(0);
59
+ const increment = () => count.value++;
60
+ return { count, increment };
61
+ },
62
+ });
63
+
64
+ createApp(App).mount('#app');
65
+ ```
66
+
67
+ ### 生命周期钩子
68
+
69
+ ```typescript
70
+ import {
71
+ onMounted,
72
+ onUnmounted,
73
+ onUpdated,
74
+ onBeforeMount,
75
+ onBeforeUnmount,
76
+ onBeforeUpdate,
77
+ onErrorCaptured,
78
+ } from '@lytjs/core-vnode';
79
+
80
+ const App = defineComponent({
81
+ setup() {
82
+ onMounted(() => {
83
+ console.log('组件已挂载');
84
+ });
85
+
86
+ onUnmounted(() => {
87
+ console.log('组件已卸载');
88
+ });
89
+
90
+ onErrorCaptured((err, instance, info) => {
91
+ console.error('捕获到错误:', err, info);
92
+ return false; // 阻止错误传播
93
+ });
94
+ },
95
+ });
96
+ ```
97
+
98
+ ### 内置组件
99
+
100
+ ```typescript
101
+ import {
102
+ KeepAlive,
103
+ Suspense,
104
+ Transition,
105
+ TransitionGroup,
106
+ Teleport,
107
+ ErrorBoundary,
108
+ } from '@lytjs/core-vnode';
109
+
110
+ // KeepAlive 缓存组件
111
+ // Suspense 处理异步组件
112
+ // Transition/TransitionGroup 过渡动画
113
+ // Teleport 传送内容
114
+ // ErrorBoundary 错误边界
115
+ ```
116
+
117
+ ## 响应式 API
118
+
119
+ 从 @lytjs/reactivity 重导出:
120
+
121
+ ```typescript
122
+ import {
123
+ // 基础响应式
124
+ ref,
125
+ reactive,
126
+ computed,
127
+ watch,
128
+ watchEffect,
129
+ // 工具函数
130
+ toRef,
131
+ toRefs,
132
+ unref,
133
+ toValue,
134
+ // 类型守卫
135
+ isRef,
136
+ isReactive,
137
+ isReadonly,
138
+ isProxy,
139
+ } from '@lytjs/core-vnode';
140
+ ```
141
+
142
+ ## 组合式 API
143
+
144
+ ```typescript
145
+ import {
146
+ useSlots,
147
+ useAttrs,
148
+ useModel,
149
+ useTemplateRef,
150
+ useId,
151
+ useCssModule,
152
+ useCssVars,
153
+ } from '@lytjs/core-vnode';
154
+ ```
155
+
156
+ ## 类型定义
157
+
158
+ ```typescript
159
+ import type {
160
+ App,
161
+ AppConfig,
162
+ Component,
163
+ ComponentOptions,
164
+ ComponentPublicInstance,
165
+ VNode,
166
+ VNodeChildren,
167
+ } from '@lytjs/core-vnode';
168
+ ```
169
+
170
+ ## 相关包
171
+
172
+ - [@lytjs/core](../core) - 完整核心(支持双模式)
173
+ - [@lytjs/core-signal](../core-signal) - 仅 Signal 模式
174
+ - [@lytjs/vdom](../vdom) - 虚拟 DOM 实现
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lytjs/core-vnode",
3
- "version": "6.5.0",
3
+ "version": "6.7.0",
4
4
  "description": "Lyt.js Core - VNode rendering mode only",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -22,14 +22,14 @@
22
22
  "dev": "tsup --watch"
23
23
  },
24
24
  "dependencies": {
25
- "@lytjs/component": "^6.4.0",
26
- "@lytjs/reactivity": "^6.4.0",
27
- "@lytjs/vdom": "^6.4.0",
28
- "@lytjs/compiler": "^6.4.0",
29
- "@lytjs/renderer": "^6.4.0",
30
- "@lytjs/common-scheduler": "^6.4.0",
31
- "@lytjs/common-error": "^6.4.0",
32
- "@lytjs/shared-types": "^6.4.0"
25
+ "@lytjs/component": "^6.7.0",
26
+ "@lytjs/reactivity": "^6.7.0",
27
+ "@lytjs/vdom": "^6.7.0",
28
+ "@lytjs/compiler": "^6.7.0",
29
+ "@lytjs/renderer": "^6.7.0",
30
+ "@lytjs/common-scheduler": "^6.7.0",
31
+ "@lytjs/common-error": "^6.7.0",
32
+ "@lytjs/shared-types": "^6.7.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "tsup": "^8.0.0",
package/dist/index.d.cts DELETED
@@ -1,146 +0,0 @@
1
- import { VNode, Fragment, Text, Comment, VNodeChildren } from '@lytjs/vdom';
2
- export { Comment, Fragment, Text, VNode, VNodeChildren, cloneVNode, createVNode, mergeProps } from '@lytjs/vdom';
3
- import { BaseAppConfig, Directive, DebuggerEvent, DirectiveArguments } from '@lytjs/shared-types';
4
- export { DebuggerEvent, Directive, DirectiveArguments, DirectiveBinding, Renderer } from '@lytjs/shared-types';
5
- import { ComponentPublicInstance, ComponentOptions, InternalSlots } from '@lytjs/component';
6
- export { ComponentOptions, ComponentPublicInstance, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onUnmounted, onUpdated } from '@lytjs/component';
7
- export { nextTick } from '@lytjs/common-scheduler';
8
- import { WritableComputedRef } from '@lytjs/reactivity';
9
- export { computed, effect, reactive, ref, watch, watchEffect } from '@lytjs/reactivity';
10
- export { compile } from '@lytjs/compiler';
11
-
12
- /** 插件安装函数签名 */
13
- type PluginInstallFunction<T = unknown> = (app: App, ...options: T[]) => void;
14
- interface App<HostElement = Element> {
15
- config: AppConfig;
16
- use(plugin: Plugin | PluginInstallFunction, ...options: unknown[]): App;
17
- mount(rootContainer: HostElement | string): ComponentPublicInstance | null;
18
- unmount(): void;
19
- provide<T = unknown>(key: string | symbol, value: T): App;
20
- inject<T = unknown>(key: string | symbol): T | undefined;
21
- component(name: string, component: Component): App;
22
- directive(name: string, directive: Directive): App;
23
- mixin(mixin: ComponentOptions): App;
24
- errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
25
- warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
26
- }
27
- interface AppConfig extends BaseAppConfig {
28
- performance: boolean;
29
- globalProperties: Record<string, unknown>;
30
- isCustomElement?: (tag: string) => boolean;
31
- compilerOptions?: Record<string, unknown>;
32
- }
33
- /** createApp 的配置选项(VNode 模式固定使用 vnode 渲染,忽略 rendererMode) */
34
- interface AppOptions {
35
- /** VNode 模式下此选项被忽略,始终使用 VNode 渲染 */
36
- rendererMode?: 'vnode';
37
- }
38
- interface Plugin {
39
- install: PluginInstallFunction;
40
- }
41
- type Component = ComponentOptions | (() => VNode);
42
-
43
- type AsyncComponentLoader = () => Promise<Component>;
44
- interface AsyncComponentOptions {
45
- loader: AsyncComponentLoader;
46
- loadingComponent?: Component;
47
- errorComponent?: Component;
48
- delay?: number;
49
- timeout?: number;
50
- suspensible?: boolean;
51
- onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => void;
52
- }
53
-
54
- type ErrorCapturedHook = (err: Error, instance: ComponentPublicInstance | null, info: string) => boolean | void;
55
- type DebuggerHook = (event: DebuggerEvent) => void;
56
-
57
- declare function createApp(rootComponent: Component, rootProps?: Record<string, unknown> | null, _options?: AppOptions): App;
58
-
59
- /**
60
- * 创建 VNode
61
- */
62
- declare function h(type: string | Component | typeof Fragment | typeof Text | typeof Comment, props?: Record<string, unknown> | null, ...children: VNodeChildren[]): VNode;
63
-
64
- /**
65
- * 定义组件(re-export from @lytjs/component)
66
- *
67
- * 权威实现在 @lytjs/component 中,此处统一返回类型为 ComponentOptions。
68
- * 由于 Component = ComponentOptions | (() => any),
69
- * 返回 ComponentOptions 是 Component 的子集,完全兼容。
70
- */
71
- declare const defineComponent: (options: ComponentOptions) => ComponentOptions;
72
- /**
73
- * 定义异步组件
74
- */
75
- declare function defineAsyncComponent(source: AsyncComponentLoader | AsyncComponentOptions): Component;
76
-
77
- /**
78
- * 解析组件:从当前组件实例的 components 选项和全局注册中查找
79
- */
80
- declare function resolveComponent(name: string): Component | undefined;
81
- /**
82
- * 解析指令:从当前组件实例的 directives 选项和全局注册中查找
83
- */
84
- declare function resolveDirective(name: string): Directive | undefined;
85
-
86
- /**
87
- * 将指令应用到 VNode 上
88
- */
89
- declare function withDirectives(vnode: VNode, directives: DirectiveArguments): VNode;
90
- /** Memo 缓存条目 */
91
- interface MemoEntry {
92
- memo: unknown[];
93
- result: VNode;
94
- }
95
- /**
96
- * 带缓存的渲染辅助
97
- */
98
- declare function withMemo(memo: unknown[], render: () => VNode, cache: MemoEntry[], index: number): VNode;
99
-
100
- /**
101
- * 获取当前组件的 slots
102
- */
103
- declare function useSlots(): InternalSlots;
104
- /**
105
- * 获取当前组件的 attrs
106
- */
107
- declare function useAttrs(): Record<string, unknown>;
108
- /**
109
- * 双向绑定辅助(v-model 的 composition API 版本)
110
- */
111
- declare function useModel<T>(props: Record<string, T | undefined>, key: string): WritableComputedRef<T>;
112
-
113
- /**
114
- * defineCustomElement 的配置选项
115
- */
116
- interface DefineCustomElementOptions {
117
- /** 是否使用 Shadow DOM(默认 true) */
118
- shadowRoot?: boolean;
119
- /** Custom Element 标签名(默认使用组件 name) */
120
- name?: string;
121
- /** CSS 样式(注入到 Shadow DOM) */
122
- css?: string;
123
- }
124
- /**
125
- * 将 LytJS 组件包装为 Custom Element
126
- */
127
- declare function defineCustomElement(componentOptions: ComponentOptions, options?: DefineCustomElementOptions): CustomElementConstructor;
128
- /**
129
- * 在 setup 中获取当前 Custom Element 的 Shadow Root
130
- */
131
- declare function useShadowRoot(): ShadowRoot | null;
132
- /**
133
- * 在 setup 中获取当前 Custom Element 的宿主元素
134
- */
135
- declare function useHost(): HTMLElement | null;
136
- /**
137
- * 在 setup 中获取 slot 变化通知(MutationObserver)
138
- * 返回一个注册回调的函数
139
- */
140
- declare function useWebComponentSlots(onChange: () => void): void;
141
- /**
142
- * 向 Shadow DOM 注入样式
143
- */
144
- declare function injectChildStyles(styles: string): void;
145
-
146
- export { type App, type AppConfig, type AppOptions, type AsyncComponentLoader, type AsyncComponentOptions, type Component, type DebuggerHook, type DefineCustomElementOptions, type ErrorCapturedHook, type Plugin, createApp, h as createElement, defineAsyncComponent, defineComponent, defineCustomElement, h, injectChildStyles, resolveComponent, resolveDirective, useAttrs, useHost, useModel, useShadowRoot, useSlots, useWebComponentSlots, withDirectives, withMemo };
package/dist/index.d.ts DELETED
@@ -1,146 +0,0 @@
1
- import { VNode, Fragment, Text, Comment, VNodeChildren } from '@lytjs/vdom';
2
- export { Comment, Fragment, Text, VNode, VNodeChildren, cloneVNode, createVNode, mergeProps } from '@lytjs/vdom';
3
- import { BaseAppConfig, Directive, DebuggerEvent, DirectiveArguments } from '@lytjs/shared-types';
4
- export { DebuggerEvent, Directive, DirectiveArguments, DirectiveBinding, Renderer } from '@lytjs/shared-types';
5
- import { ComponentPublicInstance, ComponentOptions, InternalSlots } from '@lytjs/component';
6
- export { ComponentOptions, ComponentPublicInstance, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onUnmounted, onUpdated } from '@lytjs/component';
7
- export { nextTick } from '@lytjs/common-scheduler';
8
- import { WritableComputedRef } from '@lytjs/reactivity';
9
- export { computed, effect, reactive, ref, watch, watchEffect } from '@lytjs/reactivity';
10
- export { compile } from '@lytjs/compiler';
11
-
12
- /** 插件安装函数签名 */
13
- type PluginInstallFunction<T = unknown> = (app: App, ...options: T[]) => void;
14
- interface App<HostElement = Element> {
15
- config: AppConfig;
16
- use(plugin: Plugin | PluginInstallFunction, ...options: unknown[]): App;
17
- mount(rootContainer: HostElement | string): ComponentPublicInstance | null;
18
- unmount(): void;
19
- provide<T = unknown>(key: string | symbol, value: T): App;
20
- inject<T = unknown>(key: string | symbol): T | undefined;
21
- component(name: string, component: Component): App;
22
- directive(name: string, directive: Directive): App;
23
- mixin(mixin: ComponentOptions): App;
24
- errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
25
- warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
26
- }
27
- interface AppConfig extends BaseAppConfig {
28
- performance: boolean;
29
- globalProperties: Record<string, unknown>;
30
- isCustomElement?: (tag: string) => boolean;
31
- compilerOptions?: Record<string, unknown>;
32
- }
33
- /** createApp 的配置选项(VNode 模式固定使用 vnode 渲染,忽略 rendererMode) */
34
- interface AppOptions {
35
- /** VNode 模式下此选项被忽略,始终使用 VNode 渲染 */
36
- rendererMode?: 'vnode';
37
- }
38
- interface Plugin {
39
- install: PluginInstallFunction;
40
- }
41
- type Component = ComponentOptions | (() => VNode);
42
-
43
- type AsyncComponentLoader = () => Promise<Component>;
44
- interface AsyncComponentOptions {
45
- loader: AsyncComponentLoader;
46
- loadingComponent?: Component;
47
- errorComponent?: Component;
48
- delay?: number;
49
- timeout?: number;
50
- suspensible?: boolean;
51
- onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => void;
52
- }
53
-
54
- type ErrorCapturedHook = (err: Error, instance: ComponentPublicInstance | null, info: string) => boolean | void;
55
- type DebuggerHook = (event: DebuggerEvent) => void;
56
-
57
- declare function createApp(rootComponent: Component, rootProps?: Record<string, unknown> | null, _options?: AppOptions): App;
58
-
59
- /**
60
- * 创建 VNode
61
- */
62
- declare function h(type: string | Component | typeof Fragment | typeof Text | typeof Comment, props?: Record<string, unknown> | null, ...children: VNodeChildren[]): VNode;
63
-
64
- /**
65
- * 定义组件(re-export from @lytjs/component)
66
- *
67
- * 权威实现在 @lytjs/component 中,此处统一返回类型为 ComponentOptions。
68
- * 由于 Component = ComponentOptions | (() => any),
69
- * 返回 ComponentOptions 是 Component 的子集,完全兼容。
70
- */
71
- declare const defineComponent: (options: ComponentOptions) => ComponentOptions;
72
- /**
73
- * 定义异步组件
74
- */
75
- declare function defineAsyncComponent(source: AsyncComponentLoader | AsyncComponentOptions): Component;
76
-
77
- /**
78
- * 解析组件:从当前组件实例的 components 选项和全局注册中查找
79
- */
80
- declare function resolveComponent(name: string): Component | undefined;
81
- /**
82
- * 解析指令:从当前组件实例的 directives 选项和全局注册中查找
83
- */
84
- declare function resolveDirective(name: string): Directive | undefined;
85
-
86
- /**
87
- * 将指令应用到 VNode 上
88
- */
89
- declare function withDirectives(vnode: VNode, directives: DirectiveArguments): VNode;
90
- /** Memo 缓存条目 */
91
- interface MemoEntry {
92
- memo: unknown[];
93
- result: VNode;
94
- }
95
- /**
96
- * 带缓存的渲染辅助
97
- */
98
- declare function withMemo(memo: unknown[], render: () => VNode, cache: MemoEntry[], index: number): VNode;
99
-
100
- /**
101
- * 获取当前组件的 slots
102
- */
103
- declare function useSlots(): InternalSlots;
104
- /**
105
- * 获取当前组件的 attrs
106
- */
107
- declare function useAttrs(): Record<string, unknown>;
108
- /**
109
- * 双向绑定辅助(v-model 的 composition API 版本)
110
- */
111
- declare function useModel<T>(props: Record<string, T | undefined>, key: string): WritableComputedRef<T>;
112
-
113
- /**
114
- * defineCustomElement 的配置选项
115
- */
116
- interface DefineCustomElementOptions {
117
- /** 是否使用 Shadow DOM(默认 true) */
118
- shadowRoot?: boolean;
119
- /** Custom Element 标签名(默认使用组件 name) */
120
- name?: string;
121
- /** CSS 样式(注入到 Shadow DOM) */
122
- css?: string;
123
- }
124
- /**
125
- * 将 LytJS 组件包装为 Custom Element
126
- */
127
- declare function defineCustomElement(componentOptions: ComponentOptions, options?: DefineCustomElementOptions): CustomElementConstructor;
128
- /**
129
- * 在 setup 中获取当前 Custom Element 的 Shadow Root
130
- */
131
- declare function useShadowRoot(): ShadowRoot | null;
132
- /**
133
- * 在 setup 中获取当前 Custom Element 的宿主元素
134
- */
135
- declare function useHost(): HTMLElement | null;
136
- /**
137
- * 在 setup 中获取 slot 变化通知(MutationObserver)
138
- * 返回一个注册回调的函数
139
- */
140
- declare function useWebComponentSlots(onChange: () => void): void;
141
- /**
142
- * 向 Shadow DOM 注入样式
143
- */
144
- declare function injectChildStyles(styles: string): void;
145
-
146
- export { type App, type AppConfig, type AppOptions, type AsyncComponentLoader, type AsyncComponentOptions, type Component, type DebuggerHook, type DefineCustomElementOptions, type ErrorCapturedHook, type Plugin, createApp, h as createElement, defineAsyncComponent, defineComponent, defineCustomElement, h, injectChildStyles, resolveComponent, resolveDirective, useAttrs, useHost, useModel, useShadowRoot, useSlots, useWebComponentSlots, withDirectives, withMemo };