@sigx/runtime-core 0.1.4 → 0.1.5
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/component.d.ts +22 -3
- package/dist/component.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +221 -115
- package/dist/index.js.map +1 -1
- package/dist/plugins.d.ts +25 -1
- package/dist/plugins.d.ts.map +1 -1
- package/dist/renderer.d.ts +22 -19
- package/dist/renderer.d.ts.map +1 -1
- package/dist/utils/component-helpers.d.ts +38 -0
- package/dist/utils/component-helpers.d.ts.map +1 -0
- package/dist/utils/normalize.d.ts +31 -0
- package/dist/utils/normalize.d.ts.map +1 -0
- package/dist/utils/props-accessor.d.ts +23 -0
- package/dist/utils/props-accessor.d.ts.map +1 -0
- package/dist/utils/slots.d.ts +46 -0
- package/dist/utils/slots.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/plugins.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* issues with ES module initialization.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
|
-
* Plugin system for components (used by HMR, DevTools, etc.)
|
|
9
|
+
* Plugin system for components (used by HMR, DevTools, SSR, etc.)
|
|
10
10
|
* Note: SetupFn type is duplicated here to avoid circular imports
|
|
11
11
|
*/
|
|
12
12
|
export type ComponentPlugin = {
|
|
@@ -17,4 +17,28 @@ export declare function registerComponentPlugin(plugin: ComponentPlugin): void;
|
|
|
17
17
|
* Get all registered plugins (internal use)
|
|
18
18
|
*/
|
|
19
19
|
export declare function getComponentPlugins(): readonly ComponentPlugin[];
|
|
20
|
+
/**
|
|
21
|
+
* Context extension system for adding properties to ComponentSetupContext
|
|
22
|
+
* Used by SSR, DevTools, and other packages that need to extend the context
|
|
23
|
+
*/
|
|
24
|
+
type ContextExtension = (ctx: any) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Register a function that will be called to extend every component context.
|
|
27
|
+
* Extensions are called in order of registration.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // In @sigx/server-renderer/client
|
|
32
|
+
* registerContextExtension((ctx) => {
|
|
33
|
+
* ctx.ssr = { load: () => {} };
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function registerContextExtension(extension: ContextExtension): void;
|
|
38
|
+
/**
|
|
39
|
+
* Apply all registered context extensions to a context object.
|
|
40
|
+
* Called internally by the renderer when creating component contexts.
|
|
41
|
+
*/
|
|
42
|
+
export declare function applyContextExtensions(ctx: any): void;
|
|
43
|
+
export {};
|
|
20
44
|
//# sourceMappingURL=plugins.d.ts.map
|
package/dist/plugins.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;CAChF,CAAC;AAIF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAErE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,eAAe,EAAE,CAEhE"}
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;CAChF,CAAC;AAIF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAErE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,eAAe,EAAE,CAEhE;AAED;;;GAGG;AACH,KAAK,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;AAG3C;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAE1E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAIrD"}
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { VNode, JSXElement } from './jsx-runtime.js';
|
|
2
2
|
import { EffectRunner } from '@sigx/reactivity';
|
|
3
|
+
import { SetupFn } from './component.js';
|
|
4
|
+
import { InternalSlotsObject } from './utils/slots.js';
|
|
3
5
|
import { AppContext } from './app.js';
|
|
4
6
|
/**
|
|
5
7
|
* Internal VNode with renderer-specific properties.
|
|
@@ -16,19 +18,6 @@ export interface InternalVNode extends VNode {
|
|
|
16
18
|
/** Reactive props signal for the component */
|
|
17
19
|
_componentProps?: Record<string, any>;
|
|
18
20
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Internal slots object with tracking properties
|
|
21
|
-
*/
|
|
22
|
-
interface InternalSlotsObject {
|
|
23
|
-
default: () => any[];
|
|
24
|
-
_children: any;
|
|
25
|
-
_version: {
|
|
26
|
-
v: number;
|
|
27
|
-
};
|
|
28
|
-
_slotsFromProps: Record<string, any>;
|
|
29
|
-
_isPatching?: boolean;
|
|
30
|
-
[key: string]: any;
|
|
31
|
-
}
|
|
32
21
|
export interface RendererOptions<HostNode = any, HostElement = any> {
|
|
33
22
|
patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, isSVG?: boolean): void;
|
|
34
23
|
insert(child: HostNode, parent: HostElement, anchor?: HostNode | null): void;
|
|
@@ -45,12 +34,26 @@ export interface RendererOptions<HostNode = any, HostElement = any> {
|
|
|
45
34
|
cloneNode?(node: HostNode): HostNode;
|
|
46
35
|
insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, isSVG: boolean): [HostNode, HostNode];
|
|
47
36
|
}
|
|
48
|
-
export type RootRenderFunction<HostNode = any, HostElement = any> = (vnode: JSXElement, container: HostElement,
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
export type RootRenderFunction<HostNode = any, HostElement = any> = (vnode: JSXElement, container: HostElement, appContext?: AppContext) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Function types for renderer operations exposed for plugins/hydration
|
|
40
|
+
*/
|
|
41
|
+
export type RendererMountFn<HostNode = any, HostElement = any> = (vnode: VNode, container: HostElement, before?: HostNode | null) => void;
|
|
42
|
+
export type RendererUnmountFn<HostNode = any, HostElement = any> = (vnode: VNode, container: HostElement) => void;
|
|
43
|
+
export type RendererPatchFn<HostNode = any, HostElement = any> = (n1: VNode, n2: VNode, container: HostElement) => void;
|
|
44
|
+
export type RendererMountComponentFn<HostNode = any, HostElement = any> = (vnode: VNode, container: HostElement, before: HostNode | null, setup: SetupFn<any, any, any, any>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Renderer instance returned by createRenderer
|
|
47
|
+
*/
|
|
48
|
+
export interface Renderer<HostNode = any, HostElement = any> {
|
|
49
|
+
render: RootRenderFunction<HostNode, HostElement>;
|
|
50
|
+
patch: RendererPatchFn<HostNode, HostElement>;
|
|
51
|
+
mount: RendererMountFn<HostNode, HostElement>;
|
|
52
|
+
unmount: RendererUnmountFn<HostNode, HostElement>;
|
|
53
|
+
mountComponent: RendererMountComponentFn<HostNode, HostElement>;
|
|
51
54
|
createApp: (rootComponent: any) => {
|
|
52
|
-
mount(selectorOrContainer: string | HostElement)
|
|
55
|
+
mount: (selectorOrContainer: string | HostElement) => void;
|
|
53
56
|
};
|
|
54
|
-
}
|
|
55
|
-
export
|
|
57
|
+
}
|
|
58
|
+
export declare function createRenderer<HostNode = any, HostElement = any>(options: RendererOptions<HostNode, HostElement>): Renderer<HostNode, HostElement>;
|
|
56
59
|
//# sourceMappingURL=renderer.d.ts.map
|
package/dist/renderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAY,UAAU,EAAQ,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAA2B,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAY,UAAU,EAAQ,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAA2B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAoG,OAAO,EAAiB,MAAM,gBAAgB,CAAC;AAE1J,OAAO,EAAe,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGpE,OAAO,EACH,UAAU,EAOb,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,KAAK;IACxC,wDAAwD;IACxD,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC;AAyCD,MAAM,WAAW,eAAe,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,GAAG,GAAG;IAC9D,SAAS,CAAC,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/F,MAAM,CAAC,KAAK,EAAE,QAAQ,EAA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E,GAAG,KAAK;QAAE,KAAK,EAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,WAAW,KAAK,IAAI,CAAA;KAAE,CAAC;CACrG;AAED,wBAAgB,cAAc,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,GAAG,GAAG,EAC5D,OAAO,EAAE,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,GAChD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,CAynBjC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared component helpers used by both runtime-core renderer and server-renderer hydration.
|
|
3
|
+
* These are the canonical implementations - avoid duplication.
|
|
4
|
+
*/
|
|
5
|
+
import { VNode, JSXElement } from '../jsx-runtime.js';
|
|
6
|
+
import { PropsAccessor } from '../component.js';
|
|
7
|
+
/**
|
|
8
|
+
* Internal slots object with tracking properties
|
|
9
|
+
*/
|
|
10
|
+
export interface InternalSlotsObject {
|
|
11
|
+
default: () => any[];
|
|
12
|
+
_children: any;
|
|
13
|
+
_version: {
|
|
14
|
+
v: number;
|
|
15
|
+
};
|
|
16
|
+
_slotsFromProps: Record<string, any>;
|
|
17
|
+
_isPatching?: boolean;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates a props accessor that can be called with defaults or accessed directly.
|
|
22
|
+
* After calling with defaults, direct property access uses those defaults.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createPropsAccessor<TProps extends Record<string, any>>(reactiveProps: TProps): PropsAccessor<TProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Create slots object from children and slots prop.
|
|
27
|
+
* Uses a version signal to trigger re-renders when children change.
|
|
28
|
+
* Supports named slots via:
|
|
29
|
+
* - `slots` prop object (e.g., slots={{ header: () => <div>...</div> }})
|
|
30
|
+
* - `slot` prop on children (e.g., <div slot="header">...</div>)
|
|
31
|
+
*/
|
|
32
|
+
export declare function createSlots(children: any, slotsFromProps?: Record<string, any>): InternalSlotsObject;
|
|
33
|
+
/**
|
|
34
|
+
* Normalize render result to a VNode (wrapping arrays in Fragment)
|
|
35
|
+
* Handles null, undefined, false, true by returning an empty Text node.
|
|
36
|
+
*/
|
|
37
|
+
export declare function normalizeSubTree(result: JSXElement | JSXElement[] | null | undefined | boolean): VNode;
|
|
38
|
+
//# sourceMappingURL=component-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/component-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EAAe,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC;IACrB,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClE,aAAa,EAAE,MAAM,GACtB,aAAa,CAAC,MAAM,CAAC,CAmDvB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,mBAAmB,CAwEpG;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAmCtG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VNode normalization utilities.
|
|
3
|
+
* Converts render results into proper VNode structures.
|
|
4
|
+
*/
|
|
5
|
+
import { VNode, JSXElement } from '../jsx-runtime.js';
|
|
6
|
+
/**
|
|
7
|
+
* Normalize render result to a VNode (wrapping arrays in Fragment).
|
|
8
|
+
* Handles null, undefined, false, true by returning an empty Text node.
|
|
9
|
+
*
|
|
10
|
+
* This is used to normalize the return value of component render functions
|
|
11
|
+
* into a consistent VNode structure for the renderer to process.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // Conditional rendering returns null/false
|
|
16
|
+
* normalizeSubTree(null) // → empty Text node
|
|
17
|
+
* normalizeSubTree(false) // → empty Text node
|
|
18
|
+
*
|
|
19
|
+
* // Arrays become Fragments
|
|
20
|
+
* normalizeSubTree([<A/>, <B/>]) // → Fragment with children
|
|
21
|
+
*
|
|
22
|
+
* // Primitives become Text nodes
|
|
23
|
+
* normalizeSubTree("hello") // → Text node
|
|
24
|
+
* normalizeSubTree(42) // → Text node
|
|
25
|
+
*
|
|
26
|
+
* // VNodes pass through
|
|
27
|
+
* normalizeSubTree(<div/>) // → same VNode
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function normalizeSubTree(result: JSXElement | JSXElement[] | null | undefined | boolean): VNode;
|
|
31
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/utils/normalize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAmCtG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props accessor for component setup functions.
|
|
3
|
+
* Provides a callable proxy that supports defaults and reactive property access.
|
|
4
|
+
*/
|
|
5
|
+
import { PropsAccessor } from '../component.js';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a props accessor that can be called with defaults or accessed directly.
|
|
8
|
+
* After calling with defaults, direct property access uses those defaults.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // In component setup:
|
|
13
|
+
* const props = createPropsAccessor(reactiveProps);
|
|
14
|
+
*
|
|
15
|
+
* // Set defaults
|
|
16
|
+
* props({ count: 0, label: 'Default' });
|
|
17
|
+
*
|
|
18
|
+
* // Access props (falls back to defaults if not provided)
|
|
19
|
+
* const count = props.count;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function createPropsAccessor<TProps extends Record<string, any>>(reactiveProps: TProps): PropsAccessor<TProps>;
|
|
23
|
+
//# sourceMappingURL=props-accessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props-accessor.d.ts","sourceRoot":"","sources":["../../src/utils/props-accessor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClE,aAAa,EAAE,MAAM,GACtB,aAAa,CAAC,MAAM,CAAC,CAmDvB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slots system for component children.
|
|
3
|
+
* Supports default and named slots with reactivity.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Internal slots object with tracking properties
|
|
7
|
+
*/
|
|
8
|
+
export interface InternalSlotsObject {
|
|
9
|
+
default: () => any[];
|
|
10
|
+
_children: any;
|
|
11
|
+
_version: {
|
|
12
|
+
v: number;
|
|
13
|
+
};
|
|
14
|
+
_slotsFromProps: Record<string, any>;
|
|
15
|
+
_isPatching?: boolean;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create slots object from children and slots prop.
|
|
20
|
+
* Uses a version signal to trigger re-renders when children change.
|
|
21
|
+
*
|
|
22
|
+
* Supports named slots via:
|
|
23
|
+
* - `slots` prop object (e.g., `slots={{ header: () => <div>...</div> }}`)
|
|
24
|
+
* - `slot` prop on children (e.g., `<div slot="header">...</div>`)
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Parent component
|
|
29
|
+
* <Card slots={{ header: () => <h1>Title</h1> }}>
|
|
30
|
+
* <p>Default content</p>
|
|
31
|
+
* <span slot="footer">Footer text</span>
|
|
32
|
+
* </Card>
|
|
33
|
+
*
|
|
34
|
+
* // Card component setup
|
|
35
|
+
* const slots = createSlots(children, slotsFromProps);
|
|
36
|
+
* return () => (
|
|
37
|
+
* <div>
|
|
38
|
+
* {slots.header()}
|
|
39
|
+
* {slots.default()}
|
|
40
|
+
* {slots.footer()}
|
|
41
|
+
* </div>
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function createSlots(children: any, slotsFromProps?: Record<string, any>): InternalSlotsObject;
|
|
46
|
+
//# sourceMappingURL=slots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/utils/slots.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC;IACrB,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,mBAAmB,CAwEpG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigx/runtime-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Runtime core for SignalX",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "https://github.com/signalxjs/core/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@sigx/reactivity": "^0.1.
|
|
40
|
+
"@sigx/reactivity": "^0.1.5"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^20.0.0",
|