@sigx/runtime-core 0.1.5 → 0.1.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.
- package/dist/app-types.d.ts +55 -15
- package/dist/app-types.d.ts.map +1 -1
- package/dist/app.d.ts +4 -8
- package/dist/app.d.ts.map +1 -1
- package/dist/async-context.d.ts +47 -0
- package/dist/async-context.d.ts.map +1 -0
- package/dist/component.d.ts +146 -40
- package/dist/component.d.ts.map +1 -1
- package/dist/compound.d.ts +34 -0
- package/dist/compound.d.ts.map +1 -0
- package/dist/di/factory.d.ts +3 -2
- package/dist/di/factory.d.ts.map +1 -1
- package/dist/di/injectable.d.ts +80 -6
- package/dist/di/injectable.d.ts.map +1 -1
- package/dist/directives.d.ts +111 -0
- package/dist/directives.d.ts.map +1 -0
- package/dist/error-boundary.d.ts +40 -0
- package/dist/error-boundary.d.ts.map +1 -0
- package/dist/hydration/index.d.ts +88 -0
- package/dist/hydration/index.d.ts.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +576 -696
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime.d.ts +3 -2
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/lazy.d.ts.map +1 -1
- package/dist/model.d.ts +68 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/platform.d.ts +9 -9
- package/dist/platform.d.ts.map +1 -1
- package/dist/renderer.d.ts +18 -3
- package/dist/renderer.d.ts.map +1 -1
- package/dist/utils/is-component.d.ts +30 -0
- package/dist/utils/is-component.d.ts.map +1 -0
- package/dist/utils/normalize.d.ts +4 -1
- package/dist/utils/normalize.d.ts.map +1 -1
- package/dist/utils/props-accessor.d.ts +6 -9
- package/dist/utils/props-accessor.d.ts.map +1 -1
- package/package.json +15 -6
- package/dist/sheet.d.ts +0 -51
- package/dist/sheet.d.ts.map +0 -1
- package/dist/stores/store.d.ts +0 -70
- package/dist/stores/store.d.ts.map +0 -1
- package/dist/styled.d.ts +0 -15
- package/dist/styled.d.ts.map +0 -1
- package/dist/utils/component-helpers.d.ts +0 -38
- package/dist/utils/component-helpers.d.ts.map +0 -1
package/dist/di/injectable.d.ts
CHANGED
|
@@ -1,9 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AppContext } from "../app-types.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Injectable function type with metadata
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export interface InjectableFunction<T> {
|
|
6
|
+
(): T;
|
|
7
|
+
_factory: () => T;
|
|
8
|
+
_token: symbol;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Define an injectable service/value that can be provided at app or component level.
|
|
12
|
+
*
|
|
13
|
+
* The returned function can be called to get the current instance:
|
|
14
|
+
* - If provided at component level via `defineProvide()`, returns that instance
|
|
15
|
+
* - If provided at app level via `app.defineProvide()`, returns that instance
|
|
16
|
+
* - Otherwise falls back to a global singleton created by the factory
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Define a service
|
|
21
|
+
* const useApiConfig = defineInjectable(() => ({
|
|
22
|
+
* baseUrl: 'https://api.example.com'
|
|
23
|
+
* }));
|
|
24
|
+
*
|
|
25
|
+
* // Use it in any component - gets nearest provided instance or global singleton
|
|
26
|
+
* const config = useApiConfig();
|
|
27
|
+
* console.log(config.baseUrl);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function defineInjectable<T>(factory: () => T): InjectableFunction<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Provide a new instance of an injectable at the current component level.
|
|
33
|
+
* Child components will receive this instance when calling the injectable function.
|
|
34
|
+
*
|
|
35
|
+
* @param useFn - The injectable function created by defineInjectable
|
|
36
|
+
* @param factory - Optional custom factory to create the instance (overrides default)
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const useApiConfig = defineInjectable(() => ({ baseUrl: 'https://api.example.com' }));
|
|
41
|
+
*
|
|
42
|
+
* const MyComponent = component(() => {
|
|
43
|
+
* // Create and provide a new instance for this subtree
|
|
44
|
+
* const config = defineProvide(useApiConfig);
|
|
45
|
+
* config.baseUrl = 'https://custom.api.com';
|
|
46
|
+
*
|
|
47
|
+
* return () => <ChildComponent />;
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // Or provide a pre-constructed instance:
|
|
51
|
+
* const MyComponent2 = component(() => {
|
|
52
|
+
* const customService = createMyService({ custom: 'options' });
|
|
53
|
+
* defineProvide(useMyService, () => customService);
|
|
54
|
+
*
|
|
55
|
+
* return () => <ChildComponent />;
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function defineProvide<T>(useFn: InjectableFunction<T>, factory?: () => T): T;
|
|
60
|
+
/**
|
|
61
|
+
* Get the current AppContext from the component tree.
|
|
62
|
+
* The AppContext is provided at the root component level during mount/hydrate/SSR.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const appContext = useAppContext();
|
|
67
|
+
* console.log(appContext?.app);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function useAppContext(): AppContext | null;
|
|
71
|
+
/**
|
|
72
|
+
* Get the AppContext token.
|
|
73
|
+
* Used by renderers to provide the AppContext at the root component level.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
export declare function getAppContextToken(): symbol;
|
|
77
|
+
/**
|
|
78
|
+
* Provide the AppContext on a component's provides Map.
|
|
79
|
+
* Called by the renderer for the ROOT component only.
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
export declare function provideAppContext(ctx: any, appContext: AppContext): void;
|
|
9
83
|
//# sourceMappingURL=injectable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectable.d.ts","sourceRoot":"","sources":["../../src/di/injectable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"injectable.d.ts","sourceRoot":"","sources":["../../src/di/injectable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA6DlD;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC;IACN,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAuB3E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAWnF;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAaxE"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directive system for SignalX.
|
|
3
|
+
*
|
|
4
|
+
* Directives provide reusable element-level lifecycle hooks via the `use:name` prop syntax.
|
|
5
|
+
* They can be registered globally via `app.directive()` or passed inline as imported values.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { defineDirective } from 'sigx';
|
|
10
|
+
*
|
|
11
|
+
* const tooltip = defineDirective<string>({
|
|
12
|
+
* mounted(el, { value }) {
|
|
13
|
+
* el.title = value;
|
|
14
|
+
* },
|
|
15
|
+
* updated(el, { value }) {
|
|
16
|
+
* el.title = value;
|
|
17
|
+
* },
|
|
18
|
+
* unmounted(el) {
|
|
19
|
+
* el.title = '';
|
|
20
|
+
* }
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // Inline usage:
|
|
24
|
+
* <div use:tooltip="Hello!">Hover me</div>
|
|
25
|
+
*
|
|
26
|
+
* // Or with explicit binding:
|
|
27
|
+
* <div use:tooltip={[tooltip, "Hello!"]}>Hover me</div>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* The binding object passed to directive hooks.
|
|
32
|
+
*/
|
|
33
|
+
export interface DirectiveBinding<T = any> {
|
|
34
|
+
/** The current value passed to the directive */
|
|
35
|
+
value: T;
|
|
36
|
+
/** The previous value (available in `updated` hook) */
|
|
37
|
+
oldValue?: T;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Extension interface for directive definitions.
|
|
41
|
+
*
|
|
42
|
+
* Other packages (e.g., `@sigx/server-renderer`) can augment this interface
|
|
43
|
+
* to add hooks like `getSSRProps` via TypeScript module augmentation.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* // In @sigx/server-renderer
|
|
48
|
+
* declare module '@sigx/runtime-core' {
|
|
49
|
+
* interface DirectiveDefinitionExtensions<T> {
|
|
50
|
+
* getSSRProps?(binding: DirectiveBinding<T>): Record<string, any> | void;
|
|
51
|
+
* }
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export interface DirectiveDefinitionExtensions<T = any> {
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A directive definition object with lifecycle hooks.
|
|
59
|
+
*
|
|
60
|
+
* All hooks are optional. Additional hooks (e.g., `getSSRProps`) may be
|
|
61
|
+
* available when SSR packages augment `DirectiveDefinitionExtensions`.
|
|
62
|
+
*/
|
|
63
|
+
export interface DirectiveDefinition<T = any, El = any> extends DirectiveDefinitionExtensions<T> {
|
|
64
|
+
/** Called after the element is created but before it is inserted into the DOM */
|
|
65
|
+
created?(el: El, binding: DirectiveBinding<T>): void;
|
|
66
|
+
/** Called after the element is inserted into the DOM */
|
|
67
|
+
mounted?(el: El, binding: DirectiveBinding<T>): void;
|
|
68
|
+
/** Called when the binding value changes */
|
|
69
|
+
updated?(el: El, binding: DirectiveBinding<T>): void;
|
|
70
|
+
/** Called before the element is removed from the DOM */
|
|
71
|
+
unmounted?(el: El, binding: DirectiveBinding<T>): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A resolved directive binding stored on a VNode.
|
|
75
|
+
* Tuple of [definition, value].
|
|
76
|
+
*/
|
|
77
|
+
export type ResolvedDirective<T = any, El = any> = [DirectiveDefinition<T, El>, T];
|
|
78
|
+
/**
|
|
79
|
+
* Marker symbol to identify directive definitions.
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
export declare const __DIRECTIVE__: unique symbol;
|
|
83
|
+
/**
|
|
84
|
+
* Internal type for marked directive definitions.
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export interface MarkedDirectiveDefinition<T = any, El = any> extends DirectiveDefinition<T, El> {
|
|
88
|
+
[__DIRECTIVE__]: true;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Define a directive. This is an identity function that marks the definition
|
|
92
|
+
* for type inference and runtime identification.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const highlight = defineDirective<string>({
|
|
97
|
+
* mounted(el, { value }) {
|
|
98
|
+
* el.style.backgroundColor = value;
|
|
99
|
+
* },
|
|
100
|
+
* updated(el, { value }) {
|
|
101
|
+
* el.style.backgroundColor = value;
|
|
102
|
+
* }
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare function defineDirective<T = any, El = any>(definition: DirectiveDefinition<T, El>): DirectiveDefinition<T, El>;
|
|
107
|
+
/**
|
|
108
|
+
* Check if a value is a directive definition.
|
|
109
|
+
*/
|
|
110
|
+
export declare function isDirective(value: any): value is DirectiveDefinition;
|
|
111
|
+
//# sourceMappingURL=directives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,GAAG;IACrC,gDAAgD;IAChD,KAAK,EAAE,CAAC,CAAC;IACT,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,6BAA6B,CAAC,CAAC,GAAG,GAAG;CAErD;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,GAAG,CAAE,SAAQ,6BAA6B,CAAC,CAAC,CAAC;IAC5F,iFAAiF;IACjF,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACrD,wDAAwD;IACxD,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACrD,4CAA4C;IAC5C,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACrD,wDAAwD;IACxD,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAC1D;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEnF;;;GAGG;AACH,eAAO,MAAM,aAAa,eAA+B,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,yBAAyB,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,GAAG,CAAE,SAAQ,mBAAmB,CAAC,CAAC,EAAE,EAAE,CAAC;IAC5F,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC;CACzB;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,EAAE,EAAE,CAAC,CAGrH;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,mBAAmB,CAEpE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ErrorBoundary component for catching render errors.
|
|
3
|
+
*
|
|
4
|
+
* Catches errors thrown during child component rendering and displays
|
|
5
|
+
* a fallback UI. Works during both SSR and client-side rendering.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { ErrorBoundary } from 'sigx';
|
|
10
|
+
*
|
|
11
|
+
* <ErrorBoundary
|
|
12
|
+
* fallback={(error, retry) => (
|
|
13
|
+
* <div>
|
|
14
|
+
* <p>Something went wrong: {error.message}</p>
|
|
15
|
+
* <button onClick={retry}>Retry</button>
|
|
16
|
+
* </div>
|
|
17
|
+
* )}
|
|
18
|
+
* >
|
|
19
|
+
* <RiskyComponent />
|
|
20
|
+
* </ErrorBoundary>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { type DefineProp, type DefineSlot } from './component.js';
|
|
24
|
+
import type { JSXElement } from './jsx-runtime.js';
|
|
25
|
+
/**
|
|
26
|
+
* Props for the ErrorBoundary component
|
|
27
|
+
*/
|
|
28
|
+
type ErrorBoundaryProps = DefineProp<'fallback', JSXElement | ((error: Error, retry: () => void) => JSXElement)> & DefineSlot<'default'>;
|
|
29
|
+
/**
|
|
30
|
+
* ErrorBoundary component.
|
|
31
|
+
*
|
|
32
|
+
* Wraps children and catches errors thrown during rendering.
|
|
33
|
+
* When an error occurs, displays the `fallback` UI.
|
|
34
|
+
* Provides a `retry` function to reset and re-render children.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ErrorBoundary: import("@sigx/runtime-core/jsx-runtime").ComponentFactory<ErrorBoundaryProps, void, {
|
|
37
|
+
default: () => JSXElement | JSXElement[] | null;
|
|
38
|
+
}>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=error-boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../src/error-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAa,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,KAAK,kBAAkB,GACnB,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,UAAU,CAAC,CAAC,GACtF,UAAU,CAAC,SAAS,CAAC,CAAC;AAE1B;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;EAoCG,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hydration utilities for SSR
|
|
3
|
+
*
|
|
4
|
+
* These utilities are shared between server-side rendering (stream.ts)
|
|
5
|
+
* and client-side hydration (hydrate.ts). They are placed in runtime-core
|
|
6
|
+
* to allow any SSR implementation to use them.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Client directive prefix used for selective hydration
|
|
12
|
+
*/
|
|
13
|
+
export declare const CLIENT_DIRECTIVE_PREFIX = "client:";
|
|
14
|
+
/**
|
|
15
|
+
* Valid client directive names
|
|
16
|
+
*/
|
|
17
|
+
export declare const CLIENT_DIRECTIVES: readonly ["client:load", "client:idle", "client:visible", "client:media", "client:only"];
|
|
18
|
+
export type ClientDirective = typeof CLIENT_DIRECTIVES[number];
|
|
19
|
+
/**
|
|
20
|
+
* Hydration strategies for client directives
|
|
21
|
+
*/
|
|
22
|
+
export type HydrationStrategy = 'load' | 'idle' | 'visible' | 'media' | 'only';
|
|
23
|
+
/**
|
|
24
|
+
* Result of getHydrationDirective
|
|
25
|
+
*/
|
|
26
|
+
export interface HydrationDirective {
|
|
27
|
+
strategy: HydrationStrategy;
|
|
28
|
+
media?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Filter out client directives from props.
|
|
32
|
+
* Used to get the actual component props without hydration hints.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const props = { 'client:visible': true, name: 'test', count: 5 };
|
|
37
|
+
* filterClientDirectives(props); // { name: 'test', count: 5 }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function filterClientDirectives(props: Record<string, any>): Record<string, any>;
|
|
41
|
+
/**
|
|
42
|
+
* Get hydration directive from props.
|
|
43
|
+
* Returns the strategy and optional media query for client:media.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* getHydrationDirective({ 'client:visible': true }); // { strategy: 'visible' }
|
|
48
|
+
* getHydrationDirective({ 'client:media': '(min-width: 768px)' }); // { strategy: 'media', media: '(min-width: 768px)' }
|
|
49
|
+
* getHydrationDirective({ name: 'test' }); // null
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function getHydrationDirective(props: Record<string, any>): HydrationDirective | null;
|
|
53
|
+
/**
|
|
54
|
+
* Check if props contain any client directive.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* hasClientDirective({ 'client:visible': true }); // true
|
|
59
|
+
* hasClientDirective({ name: 'test' }); // false
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function hasClientDirective(props: Record<string, any>): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Serialize props for client hydration.
|
|
65
|
+
* Filters out non-serializable values (functions, symbols, undefined).
|
|
66
|
+
* Returns undefined if no serializable props remain.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* serializeProps({ name: 'test', onClick: () => {} }); // { name: 'test' }
|
|
71
|
+
* serializeProps({ onClick: () => {} }); // undefined
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare function serializeProps(props: Record<string, any>): Record<string, any> | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Create an emit function for component context.
|
|
77
|
+
* This is a common pattern used in both mountComponent and hydrateComponent.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const emit = createEmit(reactiveProps);
|
|
82
|
+
* emit('click', eventData); // Calls props.onClick(eventData)
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare function createEmit(reactiveProps: {
|
|
86
|
+
value?: Record<string, any>;
|
|
87
|
+
} | Record<string, any>): (event: string, ...args: any[]) => void;
|
|
88
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hydration/index.ts"],"names":[],"mappings":"AAAA;;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
CHANGED
|
@@ -2,8 +2,11 @@ export * from './platform.js';
|
|
|
2
2
|
export * from './plugins.js';
|
|
3
3
|
export * from './app.js';
|
|
4
4
|
export * from './component.js';
|
|
5
|
+
export * from './compound.js';
|
|
5
6
|
export * from './jsx-runtime.js';
|
|
6
7
|
export * from './lazy.js';
|
|
8
|
+
export * from './model.js';
|
|
9
|
+
export { ErrorBoundary } from './error-boundary.js';
|
|
7
10
|
export { Utils } from './utils/index.js';
|
|
8
11
|
export { createPropsAccessor } from './utils/props-accessor.js';
|
|
9
12
|
export { createSlots } from './utils/slots.js';
|
|
@@ -13,8 +16,10 @@ export * from './models/index.js';
|
|
|
13
16
|
export * from './messaging/index.js';
|
|
14
17
|
export * from './di/injectable.js';
|
|
15
18
|
export * from './di/factory.js';
|
|
16
|
-
export * from './
|
|
19
|
+
export * from './directives.js';
|
|
17
20
|
import './jsx-types.d.ts';
|
|
18
21
|
export { signal } from '@sigx/reactivity';
|
|
19
22
|
export * from './renderer.js';
|
|
23
|
+
export * from './hydration/index.js';
|
|
24
|
+
export { runInRequestScope, hasRequestIsolation } from './async-context.js';
|
|
20
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,gBAAgB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