@sigx/runtime-core 0.1.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/dist/app-types.d.ts +226 -0
- package/dist/app-types.d.ts.map +1 -0
- package/dist/app.d.ts +77 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/component.d.ts +222 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/di/factory.d.ts +20 -0
- package/dist/di/factory.d.ts.map +1 -0
- package/dist/di/injectable.d.ts +9 -0
- package/dist/di/injectable.d.ts.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1123 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-runtime.d.ts +31 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/messaging/index.d.ts +9 -0
- package/dist/messaging/index.d.ts.map +1 -0
- package/dist/models/index.d.ts +18 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/platform.d.ts +28 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/plugins.d.ts +20 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/renderer.d.ts +26 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/sheet.d.ts +51 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/stores/store.d.ts +70 -0
- package/dist/stores/store.d.ts.map +1 -0
- package/dist/styled.d.ts +15 -0
- package/dist/styled.d.ts.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the sigx application and plugin system.
|
|
3
|
+
*
|
|
4
|
+
* This file contains only type definitions with no runtime code,
|
|
5
|
+
* ensuring clean type isolation and avoiding circular dependencies.
|
|
6
|
+
*/
|
|
7
|
+
import type { VNode } from './jsx-runtime.js';
|
|
8
|
+
import type { ComponentSetupContext } from './component.js';
|
|
9
|
+
/**
|
|
10
|
+
* Component instance info passed to lifecycle hooks.
|
|
11
|
+
* This is renderer-agnostic - works with DOM, Terminal, or any platform.
|
|
12
|
+
*/
|
|
13
|
+
export interface ComponentInstance {
|
|
14
|
+
/** Component name (if defined via defineComponent options) */
|
|
15
|
+
name?: string;
|
|
16
|
+
/** The component's setup context with props, slots, emit, etc. */
|
|
17
|
+
ctx: ComponentSetupContext;
|
|
18
|
+
/** The component's virtual node */
|
|
19
|
+
vnode: VNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* App-level configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface AppConfig {
|
|
25
|
+
/**
|
|
26
|
+
* Global error handler for component errors.
|
|
27
|
+
* Return true to suppress the error from propagating.
|
|
28
|
+
*/
|
|
29
|
+
errorHandler?: (err: Error, instance: ComponentInstance | null, info: string) => boolean | void;
|
|
30
|
+
/**
|
|
31
|
+
* Global warning handler (dev mode).
|
|
32
|
+
*/
|
|
33
|
+
warnHandler?: (msg: string, instance: ComponentInstance | null, trace: string) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Performance tracking hook - called when a component renders
|
|
36
|
+
*/
|
|
37
|
+
performance?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* App lifecycle hooks that plugins can use to observe all components
|
|
41
|
+
*/
|
|
42
|
+
export interface AppLifecycleHooks {
|
|
43
|
+
/**
|
|
44
|
+
* Called when a component's setup function completes
|
|
45
|
+
*/
|
|
46
|
+
onComponentCreated?: (instance: ComponentInstance) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Called after a component is mounted to the platform (DOM, terminal, etc.)
|
|
49
|
+
*/
|
|
50
|
+
onComponentMounted?: (instance: ComponentInstance) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Called before a component is unmounted
|
|
53
|
+
*/
|
|
54
|
+
onComponentUnmounted?: (instance: ComponentInstance) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Called when a component's render function runs (re-render)
|
|
57
|
+
*/
|
|
58
|
+
onComponentUpdated?: (instance: ComponentInstance) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Called when an error occurs in a component.
|
|
61
|
+
* Return true to suppress the error from propagating.
|
|
62
|
+
*/
|
|
63
|
+
onComponentError?: (err: Error, instance: ComponentInstance, info: string) => boolean | void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* App context that gets passed through the component tree.
|
|
67
|
+
* Used internally by renderers to propagate app-level state.
|
|
68
|
+
*/
|
|
69
|
+
export interface AppContext {
|
|
70
|
+
/** The app instance */
|
|
71
|
+
app: App;
|
|
72
|
+
/** App-level provides (available via inject in all components) */
|
|
73
|
+
provides: Map<any, any>;
|
|
74
|
+
/** App configuration */
|
|
75
|
+
config: AppConfig;
|
|
76
|
+
/** Lifecycle hooks from all plugins */
|
|
77
|
+
hooks: AppLifecycleHooks[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Plugin interface - plugins implement install() to configure the app.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const myPlugin: Plugin<{ debug?: boolean }> = {
|
|
85
|
+
* name: 'my-plugin',
|
|
86
|
+
* install(app, options) {
|
|
87
|
+
* app.provide('myService', new MyService(options));
|
|
88
|
+
* app.hook({
|
|
89
|
+
* onComponentMounted: (instance) => {
|
|
90
|
+
* if (options?.debug) console.log('Mounted:', instance.name);
|
|
91
|
+
* }
|
|
92
|
+
* });
|
|
93
|
+
* }
|
|
94
|
+
* };
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export interface Plugin<Options = any> {
|
|
98
|
+
/**
|
|
99
|
+
* Plugin name for debugging
|
|
100
|
+
*/
|
|
101
|
+
name?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Called when plugin is installed via app.use()
|
|
104
|
+
*/
|
|
105
|
+
install(app: App, options?: Options): void;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Function-style plugin (simpler alternative to object plugins)
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const simplePlugin: PluginInstallFn = (app) => {
|
|
113
|
+
* app.provide('logger', createLogger());
|
|
114
|
+
* };
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export type PluginInstallFn<Options = any> = (app: App, options?: Options) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Mount function signature - implemented by platform renderers.
|
|
120
|
+
* Each platform (DOM, Terminal, etc.) provides their own mount function.
|
|
121
|
+
*
|
|
122
|
+
* @param element - The root component/element to render
|
|
123
|
+
* @param container - Platform-specific container (HTMLElement, terminal options, etc.)
|
|
124
|
+
* @param appContext - The app context for DI and lifecycle hooks
|
|
125
|
+
* @returns Optional cleanup/unmount function
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* // DOM platform provides:
|
|
130
|
+
* export const domMount: MountFn<HTMLElement> = (element, container, appContext) => {
|
|
131
|
+
* render(element, container, appContext);
|
|
132
|
+
* return () => { /* cleanup *\/ };
|
|
133
|
+
* };
|
|
134
|
+
*
|
|
135
|
+
* // Terminal platform provides:
|
|
136
|
+
* export const terminalMount: MountFn<TerminalOptions> = (element, options, appContext) => {
|
|
137
|
+
* return renderTerminal(element, options, appContext);
|
|
138
|
+
* };
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export type MountFn<TContainer = any> = (element: any, container: TContainer, appContext: AppContext) => (() => void) | void;
|
|
142
|
+
/**
|
|
143
|
+
* Unmount function signature - provided by platform renderers
|
|
144
|
+
*/
|
|
145
|
+
export type UnmountFn<TContainer = any> = (container: TContainer) => void;
|
|
146
|
+
/**
|
|
147
|
+
* The App instance returned by defineApp().
|
|
148
|
+
* Provides a chainable API for configuring and mounting the application.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```tsx
|
|
152
|
+
* const app = defineApp(<App />);
|
|
153
|
+
*
|
|
154
|
+
* // Using with defineInjectable tokens
|
|
155
|
+
* const useConfig = defineInjectable(() => ({ apiUrl: 'https://...' }));
|
|
156
|
+
* app.provide(useConfig, { apiUrl: 'https://custom.api.com' });
|
|
157
|
+
*
|
|
158
|
+
* // Or with simple symbols/values
|
|
159
|
+
* app.provide(ConfigToken, myConfig);
|
|
160
|
+
*
|
|
161
|
+
* app.use(routerPlugin)
|
|
162
|
+
* .mount(document.getElementById('app')!, render);
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export interface App<TContainer = any> {
|
|
166
|
+
/**
|
|
167
|
+
* App configuration (error handlers, etc.)
|
|
168
|
+
*/
|
|
169
|
+
config: AppConfig;
|
|
170
|
+
/**
|
|
171
|
+
* Install a plugin. Plugins are only installed once.
|
|
172
|
+
*/
|
|
173
|
+
use<Options>(plugin: Plugin<Options> | PluginInstallFn<Options>, options?: Options): App<TContainer>;
|
|
174
|
+
/**
|
|
175
|
+
* Provide a value at app level (available to all components via inject).
|
|
176
|
+
*
|
|
177
|
+
* The token can be:
|
|
178
|
+
* - A function created by defineInjectable
|
|
179
|
+
* - A Symbol
|
|
180
|
+
* - Any unique object reference
|
|
181
|
+
*
|
|
182
|
+
* Values provided here are available to all components via inject().
|
|
183
|
+
*/
|
|
184
|
+
provide<T>(token: any, value: T): App<TContainer>;
|
|
185
|
+
/**
|
|
186
|
+
* Register lifecycle hooks to observe all components
|
|
187
|
+
*/
|
|
188
|
+
hook(hooks: AppLifecycleHooks): App<TContainer>;
|
|
189
|
+
/**
|
|
190
|
+
* Mount the app to a container.
|
|
191
|
+
*
|
|
192
|
+
* If a mount function is not provided, the platform's default mount function
|
|
193
|
+
* will be used (set via setDefaultMount by runtime-dom, runtime-terminal, etc.)
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```tsx
|
|
197
|
+
* // Simple usage (uses platform default)
|
|
198
|
+
* app.mount(document.getElementById('app')!);
|
|
199
|
+
*
|
|
200
|
+
* // Explicit mount function
|
|
201
|
+
* import { domMount } from '@sigx/runtime-dom';
|
|
202
|
+
* app.mount(document.getElementById('app')!, domMount);
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
mount(container: TContainer, mountFn?: MountFn<TContainer>): App<TContainer>;
|
|
206
|
+
/**
|
|
207
|
+
* Unmount the app and clean up resources
|
|
208
|
+
*/
|
|
209
|
+
unmount(): void;
|
|
210
|
+
/**
|
|
211
|
+
* Get the app context (for internal use by renderers)
|
|
212
|
+
* @internal
|
|
213
|
+
*/
|
|
214
|
+
_context: AppContext;
|
|
215
|
+
/**
|
|
216
|
+
* Check if the app is mounted
|
|
217
|
+
* @internal
|
|
218
|
+
*/
|
|
219
|
+
_isMounted: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* The container where the app is mounted
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
_container: TContainer | null;
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=app-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-types.d.ts","sourceRoot":"","sources":["../src/app-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAM5D;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,GAAG,EAAE,qBAAqB,CAAC;IAC3B,mCAAmC;IACnC,KAAK,EAAE,KAAK,CAAC;CAChB;AAMD;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC;IAEhG;;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OAAO,CAAC;IAEpB;;;OAGG;IACH,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CACjC"}
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application instance and plugin system for sigx.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a renderer-agnostic way to configure and bootstrap
|
|
5
|
+
* sigx applications with plugins, dependency injection, and lifecycle hooks.
|
|
6
|
+
*/
|
|
7
|
+
export type { ComponentInstance, AppConfig, AppLifecycleHooks, AppContext, Plugin, PluginInstallFn, MountFn, UnmountFn, App } from './app-types.js';
|
|
8
|
+
import type { ComponentInstance, AppContext, MountFn, App } from './app-types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Unique symbol for app context injection
|
|
11
|
+
*/
|
|
12
|
+
export declare const AppContextKey: unique symbol;
|
|
13
|
+
/**
|
|
14
|
+
* Set the default mount function for the platform.
|
|
15
|
+
* Called by platform packages (runtime-dom, runtime-terminal) on import.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // In @sigx/runtime-dom
|
|
20
|
+
* import { setDefaultMount } from '@sigx/runtime-core';
|
|
21
|
+
* setDefaultMount(domMount);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function setDefaultMount<TContainer = any>(mountFn: MountFn<TContainer>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get the current default mount function.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare function getDefaultMount(): MountFn<any> | null;
|
|
30
|
+
/**
|
|
31
|
+
* Create an application instance.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import { defineApp, defineInjectable } from '@sigx/runtime-core';
|
|
36
|
+
* import { render } from '@sigx/runtime-dom';
|
|
37
|
+
*
|
|
38
|
+
* // Define an injectable service
|
|
39
|
+
* const useApiConfig = defineInjectable(() => ({ baseUrl: 'https://api.example.com' }));
|
|
40
|
+
*
|
|
41
|
+
* const app = defineApp(<App />);
|
|
42
|
+
*
|
|
43
|
+
* app.use(myPlugin, { option: 'value' });
|
|
44
|
+
*
|
|
45
|
+
* // Provide using the injectable token (works with inject())
|
|
46
|
+
* app.provide(useApiConfig, { baseUrl: 'https://custom.api.com' });
|
|
47
|
+
*
|
|
48
|
+
* app.mount(document.getElementById('app')!, render);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function defineApp<TContainer = any>(rootComponent: any): App<TContainer>;
|
|
52
|
+
/**
|
|
53
|
+
* Notify all app hooks that a component was created.
|
|
54
|
+
* Called by the renderer after setup() returns.
|
|
55
|
+
*/
|
|
56
|
+
export declare function notifyComponentCreated(context: AppContext | null, instance: ComponentInstance): void;
|
|
57
|
+
/**
|
|
58
|
+
* Notify all app hooks that a component was mounted.
|
|
59
|
+
* Called by the renderer after mount hooks run.
|
|
60
|
+
*/
|
|
61
|
+
export declare function notifyComponentMounted(context: AppContext | null, instance: ComponentInstance): void;
|
|
62
|
+
/**
|
|
63
|
+
* Notify all app hooks that a component was unmounted.
|
|
64
|
+
* Called by the renderer before cleanup.
|
|
65
|
+
*/
|
|
66
|
+
export declare function notifyComponentUnmounted(context: AppContext | null, instance: ComponentInstance): void;
|
|
67
|
+
/**
|
|
68
|
+
* Notify all app hooks that a component updated.
|
|
69
|
+
* Called by the renderer after re-render.
|
|
70
|
+
*/
|
|
71
|
+
export declare function notifyComponentUpdated(context: AppContext | null, instance: ComponentInstance): void;
|
|
72
|
+
/**
|
|
73
|
+
* Handle an error in a component. Returns true if the error was handled.
|
|
74
|
+
* Called by the renderer when an error occurs in setup or render.
|
|
75
|
+
*/
|
|
76
|
+
export declare function handleComponentError(context: AppContext | null, err: Error, instance: ComponentInstance | null, info: string): boolean;
|
|
77
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot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,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,iBAAiB,GAAG,IAAI,EAClC,IAAI,EAAE,MAAM,GACb,OAAO,CAyBT"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { JSXElement } from "./jsx-runtime.js";
|
|
2
|
+
import { signal } from "@sigx/reactivity";
|
|
3
|
+
/**
|
|
4
|
+
* Define a single prop with type, required/optional status
|
|
5
|
+
*/
|
|
6
|
+
export type DefineProp<TName extends string, TType, Required extends boolean = false> = Required extends false ? {
|
|
7
|
+
[K in TName]?: TType;
|
|
8
|
+
} : {
|
|
9
|
+
[K in TName]: TType;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Define a 2-way bound prop (sync).
|
|
13
|
+
*/
|
|
14
|
+
export type DefineSync<TNameOrType, TType = void> = TType extends void ? DefineProp<"value", TNameOrType> & DefineEvent<"update:value", TNameOrType> : TNameOrType extends string ? DefineProp<TNameOrType, TType> & DefineEvent<`update:${TNameOrType}`, TType> : never;
|
|
15
|
+
export type EventDefinition<T> = {
|
|
16
|
+
__eventDetail: T;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Define a single custom event with its detail type
|
|
20
|
+
*/
|
|
21
|
+
export type DefineEvent<TName extends string, TDetail = void> = {
|
|
22
|
+
[K in TName]?: EventDefinition<TDetail>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Define a slot with optional scoped props.
|
|
26
|
+
* - DefineSlot<"header"> - a simple slot named "header"
|
|
27
|
+
* - DefineSlot<"item", { item: T; index: number }> - a scoped slot with props
|
|
28
|
+
*/
|
|
29
|
+
export type DefineSlot<TName extends string, TProps = void> = {
|
|
30
|
+
__slots?: {
|
|
31
|
+
[K in TName]: TProps extends void ? () => JSXElement | JSXElement[] | null : (props: TProps) => JSXElement | JSXElement[] | null;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Extract slot definitions from a combined type
|
|
36
|
+
*/
|
|
37
|
+
type ExtractSlots<T> = T extends {
|
|
38
|
+
__slots?: infer S;
|
|
39
|
+
} ? S : {};
|
|
40
|
+
/**
|
|
41
|
+
* Default slot function type
|
|
42
|
+
*/
|
|
43
|
+
type DefaultSlot = () => JSXElement[];
|
|
44
|
+
/**
|
|
45
|
+
* Slots object passed to components - always has default, plus any declared slots
|
|
46
|
+
*/
|
|
47
|
+
export type SlotsObject<TSlots = {}> = {
|
|
48
|
+
default: DefaultSlot;
|
|
49
|
+
} & TSlots;
|
|
50
|
+
/**
|
|
51
|
+
* Extract event names from an event definition
|
|
52
|
+
*/
|
|
53
|
+
type EventNames<TEvents> = {
|
|
54
|
+
[K in keyof TEvents]: TEvents[K] extends EventDefinition<any> | undefined ? K : never;
|
|
55
|
+
}[keyof TEvents] & string;
|
|
56
|
+
/**
|
|
57
|
+
* Extract event detail type for a specific event name
|
|
58
|
+
*/
|
|
59
|
+
type EventDetail<TEvents, TName extends EventNames<TEvents>> = TEvents extends {
|
|
60
|
+
[K in TName]?: EventDefinition<infer TDetail>;
|
|
61
|
+
} ? TDetail : never;
|
|
62
|
+
/**
|
|
63
|
+
* Typed emit function for dispatching custom events
|
|
64
|
+
*/
|
|
65
|
+
export type EmitFn<TEvents extends Record<string, any>> = <TName extends EventNames<TEvents>>(eventName: TName, ...args: EventDetail<TEvents, TName> extends void ? [] : [detail: EventDetail<TEvents, TName>]) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Capitalize the first letter of a string
|
|
68
|
+
*/
|
|
69
|
+
type Capitalize<S extends string> = S extends `${infer First}${infer Rest}` ? `${Uppercase<First>}${Rest}` : S;
|
|
70
|
+
/**
|
|
71
|
+
* Convert events to event handler props (on{EventName})
|
|
72
|
+
*/
|
|
73
|
+
type EventHandlers<TEvents extends Record<string, any>> = {
|
|
74
|
+
[K in keyof TEvents as TEvents[K] extends EventDefinition<any> | undefined ? `on${Capitalize<string & K>}` : never]?: (detail: TEvents[K] extends EventDefinition<infer D> | undefined ? D : never) => void;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Platform registry - platforms add their element type here via declaration merging
|
|
78
|
+
*/
|
|
79
|
+
export interface PlatformTypes {
|
|
80
|
+
}
|
|
81
|
+
/** Resolves to the platform's element type, or 'any' if not defined */
|
|
82
|
+
export type PlatformElement = PlatformTypes extends {
|
|
83
|
+
element: infer E;
|
|
84
|
+
} ? E : any;
|
|
85
|
+
/**
|
|
86
|
+
* Base mount context - platforms can extend this via declaration merging
|
|
87
|
+
*/
|
|
88
|
+
export interface MountContext<TElement = PlatformElement> {
|
|
89
|
+
el: TElement;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Base setup context - platforms can extend this via declaration merging
|
|
93
|
+
*/
|
|
94
|
+
export interface SetupContext {
|
|
95
|
+
}
|
|
96
|
+
export interface ComponentSetupContext<TElement = PlatformElement, TProps extends Record<string, any> = {}, TEvents extends Record<string, any> = {}, TRef = any, TSlots = {}> extends SetupContext {
|
|
97
|
+
el: TElement;
|
|
98
|
+
signal: typeof signal;
|
|
99
|
+
props: TProps;
|
|
100
|
+
slots: SlotsObject<TSlots>;
|
|
101
|
+
emit: EmitFn<TEvents>;
|
|
102
|
+
parent: any | null;
|
|
103
|
+
onMount(fn: (ctx: MountContext<TElement>) => void): void;
|
|
104
|
+
onCleanup(fn: (ctx: MountContext<TElement>) => void): void;
|
|
105
|
+
expose(exposed: TRef): void;
|
|
106
|
+
}
|
|
107
|
+
export declare function getCurrentInstance(): ComponentSetupContext<any, any, any, any, {}> | null;
|
|
108
|
+
export declare function setCurrentInstance(ctx: ComponentSetupContext<any, any, any> | null): ComponentSetupContext<any, any, any, any, {}> | null;
|
|
109
|
+
export declare function onMount(fn: (ctx: MountContext) => void): void;
|
|
110
|
+
export declare function onCleanup(fn: (ctx: MountContext) => void): void;
|
|
111
|
+
export type ViewFn = () => JSXElement | JSXElement[] | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Type for component setup functions.
|
|
114
|
+
*/
|
|
115
|
+
export type SetupFn<TSlots = {}> = (ctx: ComponentSetupContext<any, any, any, any, TSlots>) => ViewFn;
|
|
116
|
+
/**
|
|
117
|
+
* Get component metadata (for DevTools)
|
|
118
|
+
*/
|
|
119
|
+
export declare function getComponentMeta(factory: Function): {
|
|
120
|
+
name?: string;
|
|
121
|
+
setup: SetupFn<any>;
|
|
122
|
+
} | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Helper to create a proxy that tracks property access
|
|
125
|
+
*/
|
|
126
|
+
export declare function createPropsProxy<T extends Record<string, any>>(target: T, onAccess?: (key: string) => void): T;
|
|
127
|
+
export type DefineExpose<T> = {
|
|
128
|
+
__exposed?: {
|
|
129
|
+
__type: T;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
type ExtractExposed<T> = "__exposed" extends keyof T ? (NonNullable<T["__exposed"]> extends {
|
|
133
|
+
__type: infer E;
|
|
134
|
+
} ? E : void) : void;
|
|
135
|
+
export type Ref<T> = {
|
|
136
|
+
current: T | null;
|
|
137
|
+
} | ((instance: T | null) => void);
|
|
138
|
+
/**
|
|
139
|
+
* Extract the exposed API type from a component.
|
|
140
|
+
* Use this to type variables that will hold a component's exposed interface.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```tsx
|
|
144
|
+
* let api: Exposed<typeof MyComponent>;
|
|
145
|
+
* <MyComponent ref={r => api = r!} />
|
|
146
|
+
* api.exposedMethod();
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
export type Exposed<T extends {
|
|
150
|
+
__ref: any;
|
|
151
|
+
}> = T["__ref"];
|
|
152
|
+
/**
|
|
153
|
+
* Extract the ref (exposed) type from a component (includes function ref option).
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```tsx
|
|
157
|
+
* const myRef = { current: null } as ComponentRef<typeof MyComponent>;
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export type ComponentRef<T extends {
|
|
161
|
+
__ref: any;
|
|
162
|
+
}> = Ref<T["__ref"]>;
|
|
163
|
+
/**
|
|
164
|
+
* Strip internal type markers from props
|
|
165
|
+
*/
|
|
166
|
+
type StripInternalMarkers<T> = Omit<T, "__exposed" | "__slots">;
|
|
167
|
+
/**
|
|
168
|
+
* Component options (optional second param)
|
|
169
|
+
*/
|
|
170
|
+
export interface ComponentOptions {
|
|
171
|
+
/** Component name for DevTools debugging */
|
|
172
|
+
name?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Slot props type - converts slot definitions to a slots prop object
|
|
176
|
+
*/
|
|
177
|
+
type SlotProps<TSlots> = TSlots extends Record<string, any> ? {
|
|
178
|
+
slots?: Partial<TSlots>;
|
|
179
|
+
} : {};
|
|
180
|
+
export type ComponentFactory<TCombined extends Record<string, any>, TRef, TSlots> = ((props: StripInternalMarkers<Omit<TCombined, EventNames<TCombined>>> & EventHandlers<TCombined> & SlotProps<TSlots> & JSX.IntrinsicAttributes & {
|
|
181
|
+
ref?: Ref<TRef>;
|
|
182
|
+
children?: any;
|
|
183
|
+
}) => JSXElement) & {
|
|
184
|
+
/** @internal Setup function for the renderer */
|
|
185
|
+
__setup: SetupFn<TSlots>;
|
|
186
|
+
/** @internal Component name for debugging */
|
|
187
|
+
__name?: string;
|
|
188
|
+
/** @internal Type brand for props */
|
|
189
|
+
__props: StripInternalMarkers<TCombined>;
|
|
190
|
+
/** @internal Type brand for events */
|
|
191
|
+
__events: TCombined;
|
|
192
|
+
/** @internal Type brand for ref */
|
|
193
|
+
__ref: TRef;
|
|
194
|
+
/** @internal Type brand for slots */
|
|
195
|
+
__slots: TSlots;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Define a component. Returns a JSX factory function.
|
|
199
|
+
*
|
|
200
|
+
* @param setup - Setup function that receives context and returns a render function
|
|
201
|
+
* @param options - Optional configuration (e.g., name for DevTools)
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```tsx
|
|
205
|
+
* type CardProps = DefineProp<"title", string> & DefineSlot<"header">;
|
|
206
|
+
*
|
|
207
|
+
* export const Card = defineComponent<CardProps>((ctx) => {
|
|
208
|
+
* const { title } = ctx.props;
|
|
209
|
+
* const { slots } = ctx;
|
|
210
|
+
*
|
|
211
|
+
* return () => (
|
|
212
|
+
* <div class="card">
|
|
213
|
+
* {slots.header?.() ?? <h2>{title}</h2>}
|
|
214
|
+
* {slots.default()}
|
|
215
|
+
* </div>
|
|
216
|
+
* );
|
|
217
|
+
* });
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
export declare function defineComponent<TCombined extends Record<string, any> = {}, TRef = ExtractExposed<TCombined>, TSlots = ExtractSlots<TCombined>>(setup: (ctx: ComponentSetupContext<PlatformElement, StripInternalMarkers<TCombined>, TCombined, TRef, TSlots>) => ViewFn, options?: ComponentOptions): ComponentFactory<TCombined, TRef, TSlots>;
|
|
221
|
+
export {};
|
|
222
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAM1C;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,EAAE,QAAQ,SAAS,OAAO,GAAG,KAAK,IAAI,QAAQ,SAAS,KAAK,GACxG;KAAG,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK;CAAE,GACxB;KAAG,CAAC,IAAI,KAAK,GAAG,KAAK;CAAE,CAAC;AAE9B;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,WAAW,EAAE,KAAK,GAAG,IAAI,IAAI,KAAK,SAAS,IAAI,GAChE,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,WAAW,CAAC,cAAc,EAAE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ACpB,mCAAmC;IACnC,KAAK,EAAE,IAAI,CAAC;IACZ,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAC3B,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,EAC1C,IAAI,GAAG,cAAc,CAAC,SAAS,CAAC,EAChC,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,EAEhC,KAAK,EAAE,CAAC,GAAG,EAAE,qBAAqB,CAAC,eAAe,EAAE,oBAAoB,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,EACxH,OAAO,CAAC,EAAE,gBAAgB,GAC3B,gBAAgB,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CA4B3C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InstanceLifetimes, guid } from "../models/index.js";
|
|
2
|
+
export declare class SubscriptionHandler {
|
|
3
|
+
private unsubs;
|
|
4
|
+
add(unsub: () => void): void;
|
|
5
|
+
unsubscribe(): void;
|
|
6
|
+
}
|
|
7
|
+
export interface SetupFactoryContext {
|
|
8
|
+
onDeactivated(fn: () => void): void;
|
|
9
|
+
subscriptions: SubscriptionHandler;
|
|
10
|
+
overrideDispose(onDispose: (fn: () => void) => void): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function defineFactory<InferReturnSetup>(setup: (ctx: SetupFactoryContext, ...args: any) => InferReturnSetup, lifetime: InstanceLifetimes, typeIdentifier?: guid): () => InferReturnSetup & {
|
|
13
|
+
dispose?: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function defineFactory<InferReturnSetup, T1>(setup: (ctx: SetupFactoryContext, param1: T1) => InferReturnSetup, lifetime: InstanceLifetimes, typeIdentifier?: guid): (param1: T1) => InferReturnSetup;
|
|
16
|
+
export declare function defineFactory<InferReturnSetup, T1, T2>(setup: (ctx: SetupFactoryContext, param1: T1, param2: T2) => InferReturnSetup, lifetime: InstanceLifetimes, typeIdentifier?: string): (param1: T1, param2: T2) => InferReturnSetup;
|
|
17
|
+
export declare function defineFactory<InferReturnSetup, T1, T2, T3>(setup: (ctx: SetupFactoryContext, param1: T1, param2: T2, param3: T3) => InferReturnSetup, lifetime: InstanceLifetimes, typeIdentifier?: guid): (param1: T1, param2: T2, param3: T3) => InferReturnSetup;
|
|
18
|
+
export declare function defineFactory<InferReturnSetup, T1, T2, T3, T4>(setup: (ctx: SetupFactoryContext, param1: T1, param2: T2, param3: T3, param4: T4) => InferReturnSetup, lifetime: InstanceLifetimes, typeIdentifier?: guid): (param1: T1, param2: T2, param3: T3, param4: T4) => InferReturnSetup;
|
|
19
|
+
export declare function defineFactory<InferReturnSetup, T1, T2, T3, T4, T5>(setup: (ctx: SetupFactoryContext, param1: T1, param2: T2, param3: T3, param4: T4, param5: T5) => InferReturnSetup, lifetime: InstanceLifetimes, typeIdentifier?: guid): (param1: T1, param2: T2, param3: T3, param4: T4, param5: T5) => InferReturnSetup;
|
|
20
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/di/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG7D,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,MAAM,CAAsB;IACpC,GAAG,CAAC,KAAK,EAAE,MAAM,IAAI;IAGrB,WAAW;CAId;AAED,MAAM,WAAW,mBAAmB;IAChC,aAAa,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACpC,aAAa,EAAE,mBAAmB,CAAC;IACnC,eAAe,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC;CAC9D;AAED,wBAAgB,aAAa,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AC1D,KAAK,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,gBAAgB,EACrG,QAAQ,EAAE,iBAAiB,EAC3B,cAAc,CAAC,EAAE,IAAI,GACtB,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,gBAAgB,CAAA;AACvE,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC9D,KAAK,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,gBAAgB,EACjH,QAAQ,EAAE,iBAAiB,EAC3B,cAAc,CAAC,EAAE,IAAI,GACtB,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function inject<T>(token: any): T | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* Inject the App instance (useful for plugins)
|
|
4
|
+
*/
|
|
5
|
+
export declare function injectApp(): unknown;
|
|
6
|
+
export declare function provide<T>(token: any, value: T): void;
|
|
7
|
+
export declare function defineInjectable<T>(factory: () => T): () => any;
|
|
8
|
+
export declare function defineProvide<T>(useFn: () => T): T;
|
|
9
|
+
//# sourceMappingURL=injectable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectable.d.ts","sourceRoot":"","sources":["../../src/di/injectable.ts"],"names":[],"mappings":"AAOA,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,GAAG,SAAS,CAyBnD;AAiBD;;GAEG;AACH,wBAAgB,SAAS,YAExB;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,QAW9C;AAID,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,aAmBnD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAWlD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './platform.js';
|
|
2
|
+
export * from './plugins.js';
|
|
3
|
+
export * from './app.js';
|
|
4
|
+
export * from './component.js';
|
|
5
|
+
export * from './jsx-runtime.js';
|
|
6
|
+
export { Utils } from './utils/index.js';
|
|
7
|
+
export * from './models/index.js';
|
|
8
|
+
export * from './messaging/index.js';
|
|
9
|
+
export * from './di/injectable.js';
|
|
10
|
+
export * from './di/factory.js';
|
|
11
|
+
export * from './stores/store.js';
|
|
12
|
+
import './jsx-types.d.ts';
|
|
13
|
+
export { signal } from '@sigx/reactivity';
|
|
14
|
+
export * from './renderer.js';
|
|
15
|
+
export type { CustomElementRegistry, ComponentProps, RegisteredElements } from './register.d.ts';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|