@akashjs/runtime 0.2.0 → 0.2.1
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/animate.d.cts +145 -0
- package/dist/animate.d.ts +145 -0
- package/dist/{chunk-V7VG23IO.cjs → chunk-3AL2DVPZ.cjs} +3 -3
- package/dist/{chunk-V7VG23IO.cjs.map → chunk-3AL2DVPZ.cjs.map} +1 -1
- package/dist/{chunk-CHF5LH56.cjs → chunk-6NX6JRSV.cjs} +3 -3
- package/dist/{chunk-CHF5LH56.cjs.map → chunk-6NX6JRSV.cjs.map} +1 -1
- package/dist/chunk-772SU4MG.js +2 -0
- package/dist/chunk-772SU4MG.js.map +1 -0
- package/dist/chunk-7LQZF3XA.cjs +2 -0
- package/dist/chunk-7LQZF3XA.cjs.map +1 -0
- package/dist/{chunk-DYJUCZXA.js → chunk-BT6HNBE7.js} +4 -4
- package/dist/chunk-BT6HNBE7.js.map +1 -0
- package/dist/{chunk-CGKMCVEZ.js → chunk-D6QQYZIC.js} +2 -2
- package/dist/{chunk-CGKMCVEZ.js.map → chunk-D6QQYZIC.js.map} +1 -1
- package/dist/{chunk-R3W5W647.cjs → chunk-H4SAK7A5.cjs} +2 -2
- package/dist/{chunk-R3W5W647.cjs.map → chunk-H4SAK7A5.cjs.map} +1 -1
- package/dist/{chunk-VFOAULHK.js → chunk-IM2VW4TK.js} +3 -3
- package/dist/{chunk-VFOAULHK.js.map → chunk-IM2VW4TK.js.map} +1 -1
- package/dist/chunk-NQVWTQ2I.cjs +5 -0
- package/dist/chunk-NQVWTQ2I.cjs.map +1 -0
- package/dist/{chunk-5EFX654I.cjs → chunk-NVZLEJXB.cjs} +2 -2
- package/dist/{chunk-5EFX654I.cjs.map → chunk-NVZLEJXB.cjs.map} +1 -1
- package/dist/{chunk-DPJ6RJ7A.js → chunk-ODDXU5DO.js} +2 -2
- package/dist/chunk-ODDXU5DO.js.map +1 -0
- package/dist/{chunk-EUKRTV4W.js → chunk-POLTPHUA.js} +3 -3
- package/dist/{chunk-EUKRTV4W.js.map → chunk-POLTPHUA.js.map} +1 -1
- package/dist/{chunk-4HAE7H7W.cjs → chunk-YIB4EKVI.cjs} +2 -2
- package/dist/chunk-YIB4EKVI.cjs.map +1 -0
- package/dist/{chunk-SRPWGLOQ.js → chunk-Z5LQV5ND.js} +2 -2
- package/dist/{chunk-SRPWGLOQ.js.map → chunk-Z5LQV5ND.js.map} +1 -1
- package/dist/component-C1WnFcRp.d.cts +59 -0
- package/dist/component-C1WnFcRp.d.ts +59 -0
- package/dist/context-2uQ6fuxu.d.cts +57 -0
- package/dist/context-2uQ6fuxu.d.ts +57 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +65 -0
- package/dist/core.d.ts +65 -0
- package/dist/core.js +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3218 -0
- package/dist/index.d.ts +3218 -0
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/machine.cjs +1 -1
- package/dist/machine.d.cts +87 -0
- package/dist/machine.d.ts +87 -0
- package/dist/machine.js +1 -1
- package/dist/offline.cjs +1 -1
- package/dist/offline.d.cts +73 -0
- package/dist/offline.d.ts +73 -0
- package/dist/offline.js +1 -1
- package/dist/pwa.cjs +1 -1
- package/dist/pwa.d.cts +80 -0
- package/dist/pwa.d.ts +80 -0
- package/dist/pwa.js +1 -1
- package/dist/signals-C7XfOHHR.d.cts +55 -0
- package/dist/signals-C7XfOHHR.d.ts +55 -0
- package/dist/ssr.cjs +1 -1
- package/dist/ssr.d.cts +78 -0
- package/dist/ssr.d.ts +78 -0
- package/dist/ssr.js +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +88 -0
- package/dist/store.d.ts +88 -0
- package/dist/store.js +1 -1
- package/dist/sync.cjs +1 -1
- package/dist/sync.d.cts +128 -0
- package/dist/sync.d.ts +128 -0
- package/dist/sync.js +1 -1
- package/dist/test.cjs +2 -2
- package/dist/test.d.cts +109 -0
- package/dist/test.d.ts +109 -0
- package/dist/test.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4HAE7H7W.cjs.map +0 -1
- package/dist/chunk-DPJ6RJ7A.js.map +0 -1
- package/dist/chunk-DYJUCZXA.js.map +0 -1
- package/dist/chunk-P5GADKQS.cjs +0 -2
- package/dist/chunk-P5GADKQS.cjs.map +0 -1
- package/dist/chunk-Q5BER4ZB.js +0 -2
- package/dist/chunk-Q5BER4ZB.js.map +0 -1
- package/dist/chunk-QDCIW4YE.cjs +0 -5
- package/dist/chunk-QDCIW4YE.cjs.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Represents any renderable node in AkashJS */
|
|
2
|
+
type AkashNode = Node | string | number | boolean | null | undefined | AkashNode[];
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component system.
|
|
6
|
+
*
|
|
7
|
+
* Components are functions. defineComponent() wraps a setup function
|
|
8
|
+
* that runs once, establishes signals and effects, and returns a
|
|
9
|
+
* render function that produces DOM nodes.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Mark a function as a compiler-generated reactive getter */
|
|
13
|
+
declare function __getter<T>(fn: () => T): (() => T) & {
|
|
14
|
+
__reactive: true;
|
|
15
|
+
};
|
|
16
|
+
interface Ref<T = HTMLElement> {
|
|
17
|
+
current: T | undefined;
|
|
18
|
+
}
|
|
19
|
+
interface ComponentContext<P extends Record<string, unknown> = Record<string, unknown>> {
|
|
20
|
+
props: Readonly<P>;
|
|
21
|
+
children: () => AkashNode;
|
|
22
|
+
}
|
|
23
|
+
type Component<P extends Record<string, unknown> = Record<string, unknown>> = {
|
|
24
|
+
(props: P & {
|
|
25
|
+
children?: AkashNode | (() => AkashNode);
|
|
26
|
+
}): Node;
|
|
27
|
+
_akash: true;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Register a callback to run after the component is mounted to the DOM.
|
|
31
|
+
* If the callback returns a function, it will be called on unmount (cleanup).
|
|
32
|
+
*/
|
|
33
|
+
declare function onMount(fn: () => void | (() => void)): void;
|
|
34
|
+
/**
|
|
35
|
+
* Register a callback to run before the component is unmounted.
|
|
36
|
+
*/
|
|
37
|
+
declare function onUnmount(fn: () => void): void;
|
|
38
|
+
/**
|
|
39
|
+
* Register an error handler for this component and its descendants.
|
|
40
|
+
*/
|
|
41
|
+
declare function onError(fn: (error: Error) => void): void;
|
|
42
|
+
/**
|
|
43
|
+
* Create a ref for accessing a DOM element or storing a mutable value.
|
|
44
|
+
*/
|
|
45
|
+
declare function ref<T = HTMLElement>(initialValue?: T): Ref<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Define a component. The setup function runs once per instance.
|
|
48
|
+
* It receives a context with typed props and must return a render function.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* const Counter = defineComponent<{ initial: number }>((ctx) => {
|
|
52
|
+
* const count = signal(ctx.props.initial);
|
|
53
|
+
* return () => <div>{count()}</div>;
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare function defineComponent<P extends Record<string, any> = Record<string, any>>(setup: (ctx: ComponentContext<P>) => () => AkashNode): Component<P>;
|
|
58
|
+
|
|
59
|
+
export { type AkashNode as A, type Component as C, type Ref as R, __getter as _, type ComponentContext as a, onMount as b, onUnmount as c, defineComponent as d, onError as o, ref as r };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Represents any renderable node in AkashJS */
|
|
2
|
+
type AkashNode = Node | string | number | boolean | null | undefined | AkashNode[];
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Component system.
|
|
6
|
+
*
|
|
7
|
+
* Components are functions. defineComponent() wraps a setup function
|
|
8
|
+
* that runs once, establishes signals and effects, and returns a
|
|
9
|
+
* render function that produces DOM nodes.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Mark a function as a compiler-generated reactive getter */
|
|
13
|
+
declare function __getter<T>(fn: () => T): (() => T) & {
|
|
14
|
+
__reactive: true;
|
|
15
|
+
};
|
|
16
|
+
interface Ref<T = HTMLElement> {
|
|
17
|
+
current: T | undefined;
|
|
18
|
+
}
|
|
19
|
+
interface ComponentContext<P extends Record<string, unknown> = Record<string, unknown>> {
|
|
20
|
+
props: Readonly<P>;
|
|
21
|
+
children: () => AkashNode;
|
|
22
|
+
}
|
|
23
|
+
type Component<P extends Record<string, unknown> = Record<string, unknown>> = {
|
|
24
|
+
(props: P & {
|
|
25
|
+
children?: AkashNode | (() => AkashNode);
|
|
26
|
+
}): Node;
|
|
27
|
+
_akash: true;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Register a callback to run after the component is mounted to the DOM.
|
|
31
|
+
* If the callback returns a function, it will be called on unmount (cleanup).
|
|
32
|
+
*/
|
|
33
|
+
declare function onMount(fn: () => void | (() => void)): void;
|
|
34
|
+
/**
|
|
35
|
+
* Register a callback to run before the component is unmounted.
|
|
36
|
+
*/
|
|
37
|
+
declare function onUnmount(fn: () => void): void;
|
|
38
|
+
/**
|
|
39
|
+
* Register an error handler for this component and its descendants.
|
|
40
|
+
*/
|
|
41
|
+
declare function onError(fn: (error: Error) => void): void;
|
|
42
|
+
/**
|
|
43
|
+
* Create a ref for accessing a DOM element or storing a mutable value.
|
|
44
|
+
*/
|
|
45
|
+
declare function ref<T = HTMLElement>(initialValue?: T): Ref<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Define a component. The setup function runs once per instance.
|
|
48
|
+
* It receives a context with typed props and must return a render function.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* const Counter = defineComponent<{ initial: number }>((ctx) => {
|
|
52
|
+
* const count = signal(ctx.props.initial);
|
|
53
|
+
* return () => <div>{count()}</div>;
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare function defineComponent<P extends Record<string, any> = Record<string, any>>(setup: (ctx: ComponentContext<P>) => () => AkashNode): Component<P>;
|
|
58
|
+
|
|
59
|
+
export { type AkashNode as A, type Component as C, type Ref as R, __getter as _, type ComponentContext as a, onMount as b, onUnmount as c, defineComponent as d, onError as o, ref as r };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Batch multiple signal writes — subscribers are notified only once
|
|
3
|
+
* at the end of the batch.
|
|
4
|
+
*/
|
|
5
|
+
declare function batch(fn: () => void): void;
|
|
6
|
+
/** Synchronously flush all pending effects. Useful for testing. */
|
|
7
|
+
declare function flushSync(): void;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Lightweight dependency injection via provide/inject.
|
|
11
|
+
*
|
|
12
|
+
* Context is scoped to the component tree — no injector hierarchy,
|
|
13
|
+
* no decorators, no classes. Just createContext(), provide(), inject().
|
|
14
|
+
*/
|
|
15
|
+
declare const CONTEXT_BRAND: unique symbol;
|
|
16
|
+
interface InjectionKey<T> {
|
|
17
|
+
readonly [CONTEXT_BRAND]: true;
|
|
18
|
+
readonly _type: T;
|
|
19
|
+
readonly defaultValue: T | undefined;
|
|
20
|
+
readonly id: symbol;
|
|
21
|
+
}
|
|
22
|
+
interface ContextScope {
|
|
23
|
+
values: Map<symbol, unknown>;
|
|
24
|
+
parent: ContextScope | null;
|
|
25
|
+
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
declare function getCurrentScope(): ContextScope | null;
|
|
28
|
+
/**
|
|
29
|
+
* Run a function within a given scope so that provide/inject
|
|
30
|
+
* work correctly for components created asynchronously
|
|
31
|
+
* (e.g., lazy-loaded route components).
|
|
32
|
+
*/
|
|
33
|
+
declare function runInScope<T>(scope: ContextScope, fn: () => T): T;
|
|
34
|
+
/**
|
|
35
|
+
* Create a typed context key with an optional default value.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* const ThemeContext = createContext<'light' | 'dark'>('light');
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
declare function createContext<T>(defaultValue?: T): InjectionKey<T>;
|
|
42
|
+
/**
|
|
43
|
+
* Provide a value for a context key in the current component scope.
|
|
44
|
+
* All descendant components can inject() this value.
|
|
45
|
+
*
|
|
46
|
+
* Must be called inside defineComponent() setup.
|
|
47
|
+
*/
|
|
48
|
+
declare function provide<T>(key: InjectionKey<T>, value: T): void;
|
|
49
|
+
/**
|
|
50
|
+
* Inject a value from the nearest ancestor that provided it.
|
|
51
|
+
*
|
|
52
|
+
* Must be called inside defineComponent() setup.
|
|
53
|
+
*/
|
|
54
|
+
declare function inject<T>(key: InjectionKey<T>): T;
|
|
55
|
+
declare function inject<T>(key: InjectionKey<T>, fallback: T): T;
|
|
56
|
+
|
|
57
|
+
export { type InjectionKey as I, batch as b, createContext as c, flushSync as f, getCurrentScope as g, inject as i, provide as p, runInScope as r };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Batch multiple signal writes — subscribers are notified only once
|
|
3
|
+
* at the end of the batch.
|
|
4
|
+
*/
|
|
5
|
+
declare function batch(fn: () => void): void;
|
|
6
|
+
/** Synchronously flush all pending effects. Useful for testing. */
|
|
7
|
+
declare function flushSync(): void;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Lightweight dependency injection via provide/inject.
|
|
11
|
+
*
|
|
12
|
+
* Context is scoped to the component tree — no injector hierarchy,
|
|
13
|
+
* no decorators, no classes. Just createContext(), provide(), inject().
|
|
14
|
+
*/
|
|
15
|
+
declare const CONTEXT_BRAND: unique symbol;
|
|
16
|
+
interface InjectionKey<T> {
|
|
17
|
+
readonly [CONTEXT_BRAND]: true;
|
|
18
|
+
readonly _type: T;
|
|
19
|
+
readonly defaultValue: T | undefined;
|
|
20
|
+
readonly id: symbol;
|
|
21
|
+
}
|
|
22
|
+
interface ContextScope {
|
|
23
|
+
values: Map<symbol, unknown>;
|
|
24
|
+
parent: ContextScope | null;
|
|
25
|
+
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
declare function getCurrentScope(): ContextScope | null;
|
|
28
|
+
/**
|
|
29
|
+
* Run a function within a given scope so that provide/inject
|
|
30
|
+
* work correctly for components created asynchronously
|
|
31
|
+
* (e.g., lazy-loaded route components).
|
|
32
|
+
*/
|
|
33
|
+
declare function runInScope<T>(scope: ContextScope, fn: () => T): T;
|
|
34
|
+
/**
|
|
35
|
+
* Create a typed context key with an optional default value.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* const ThemeContext = createContext<'light' | 'dark'>('light');
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
declare function createContext<T>(defaultValue?: T): InjectionKey<T>;
|
|
42
|
+
/**
|
|
43
|
+
* Provide a value for a context key in the current component scope.
|
|
44
|
+
* All descendant components can inject() this value.
|
|
45
|
+
*
|
|
46
|
+
* Must be called inside defineComponent() setup.
|
|
47
|
+
*/
|
|
48
|
+
declare function provide<T>(key: InjectionKey<T>, value: T): void;
|
|
49
|
+
/**
|
|
50
|
+
* Inject a value from the nearest ancestor that provided it.
|
|
51
|
+
*
|
|
52
|
+
* Must be called inside defineComponent() setup.
|
|
53
|
+
*/
|
|
54
|
+
declare function inject<T>(key: InjectionKey<T>): T;
|
|
55
|
+
declare function inject<T>(key: InjectionKey<T>, fallback: T): T;
|
|
56
|
+
|
|
57
|
+
export { type InjectionKey as I, batch as b, createContext as c, flushSync as f, getCurrentScope as g, inject as i, provide as p, runInScope as r };
|
package/dist/core.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkNQVWTQ2I_cjs=require('./chunk-NQVWTQ2I.cjs'),chunk3AL2DVPZ_cjs=require('./chunk-3AL2DVPZ.cjs');Object.defineProperty(exports,"For",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.t}});Object.defineProperty(exports,"Show",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.s}});Object.defineProperty(exports,"bindProperty",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.o}});Object.defineProperty(exports,"bindText",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.n}});Object.defineProperty(exports,"bindVisible",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.p}});Object.defineProperty(exports,"cloneTemplate",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.l}});Object.defineProperty(exports,"createContext",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.g}});Object.defineProperty(exports,"createElement",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.j}});Object.defineProperty(exports,"createText",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.k}});Object.defineProperty(exports,"defineComponent",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.B}});Object.defineProperty(exports,"inject",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.i}});Object.defineProperty(exports,"insert",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.v}});Object.defineProperty(exports,"nodeToDOM",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.u}});Object.defineProperty(exports,"onError",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.z}});Object.defineProperty(exports,"onMount",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.x}});Object.defineProperty(exports,"onUnmount",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.y}});Object.defineProperty(exports,"provide",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.h}});Object.defineProperty(exports,"ref",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.A}});Object.defineProperty(exports,"renderConditional",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.q}});Object.defineProperty(exports,"renderList",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.r}});Object.defineProperty(exports,"setProperty",{enumerable:true,get:function(){return chunkNQVWTQ2I_cjs.m}});Object.defineProperty(exports,"batch",{enumerable:true,get:function(){return chunk3AL2DVPZ_cjs.a}});Object.defineProperty(exports,"computed",{enumerable:true,get:function(){return chunk3AL2DVPZ_cjs.m}});Object.defineProperty(exports,"effect",{enumerable:true,get:function(){return chunk3AL2DVPZ_cjs.n}});Object.defineProperty(exports,"flushSync",{enumerable:true,get:function(){return chunk3AL2DVPZ_cjs.b}});Object.defineProperty(exports,"signal",{enumerable:true,get:function(){return chunk3AL2DVPZ_cjs.l}});Object.defineProperty(exports,"untrack",{enumerable:true,get:function(){return chunk3AL2DVPZ_cjs.o}});//# sourceMappingURL=core.cjs.map
|
|
2
2
|
//# sourceMappingURL=core.cjs.map
|
package/dist/core.d.cts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export { R as ReadonlySignal, S as Signal, c as computed, e as effect, s as signal, u as untrack } from './signals-C7XfOHHR.cjs';
|
|
2
|
+
export { I as InjectionKey, b as batch, c as createContext, f as flushSync, i as inject, p as provide } from './context-2uQ6fuxu.cjs';
|
|
3
|
+
import { A as AkashNode } from './component-C1WnFcRp.cjs';
|
|
4
|
+
export { C as Component, a as ComponentContext, R as Ref, d as defineComponent, o as onError, b as onMount, c as onUnmount, r as ref } from './component-C1WnFcRp.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Direct DOM rendering runtime.
|
|
8
|
+
*
|
|
9
|
+
* No virtual DOM. The compiler generates calls to these helpers.
|
|
10
|
+
* Signal reads inside templates become fine-grained effects that
|
|
11
|
+
* update only the specific DOM node that changed.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Create an element and optionally set static attributes */
|
|
15
|
+
declare function createElement(tag: string, attrs?: Record<string, unknown>): HTMLElement;
|
|
16
|
+
/** Create a text node */
|
|
17
|
+
declare function createText(value: string): Text;
|
|
18
|
+
/** Clone a template element for static structure */
|
|
19
|
+
declare function cloneTemplate(html: string): DocumentFragment;
|
|
20
|
+
declare function setProperty(el: HTMLElement, key: string, value: unknown): void;
|
|
21
|
+
/** Bind a reactive expression to a text node's content */
|
|
22
|
+
declare function bindText(node: Text, fn: () => unknown): () => void;
|
|
23
|
+
/** Bind a reactive expression to an element's attribute/property */
|
|
24
|
+
declare function bindProperty(el: HTMLElement, key: string, fn: () => unknown): () => void;
|
|
25
|
+
/** Bind a reactive expression to an element's visibility (display) */
|
|
26
|
+
declare function bindVisible(el: HTMLElement, fn: () => boolean): () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Render a conditional block. Swaps DOM fragments based on a reactive
|
|
29
|
+
* condition. Used by the compiler for :if directives and <Show>.
|
|
30
|
+
*/
|
|
31
|
+
declare function renderConditional(parent: Node, anchor: Node, condition: () => boolean, trueBranch: () => Node, falseBranch?: () => Node): () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Render a reactive list with keyed reconciliation.
|
|
34
|
+
* Used by the compiler for :for directives and <For>.
|
|
35
|
+
*/
|
|
36
|
+
declare function renderList<T>(parent: Node, anchor: Node, items: () => T[], keyFn: (item: T, index: number) => unknown, renderItem: (item: T, index: number) => Node): () => void;
|
|
37
|
+
/** Props for the <Show> component */
|
|
38
|
+
interface ShowProps<T> {
|
|
39
|
+
when: (() => T | null | undefined | false) | T | null | undefined | false;
|
|
40
|
+
fallback?: () => AkashNode;
|
|
41
|
+
children: (value: T) => AkashNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* <Show> component — conditionally renders children with type narrowing.
|
|
45
|
+
* The children callback receives the non-null/undefined value.
|
|
46
|
+
* `when` can be a reactive getter or a static value.
|
|
47
|
+
*/
|
|
48
|
+
declare function Show<T>(props: ShowProps<T>): Node;
|
|
49
|
+
/** Props for the <For> component */
|
|
50
|
+
interface ForProps<T> {
|
|
51
|
+
each: (() => T[]) | T[];
|
|
52
|
+
key: (item: T) => unknown;
|
|
53
|
+
children: (item: T, index: number) => AkashNode;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* <For> component — renders a list with keyed reconciliation.
|
|
57
|
+
* `each` can be a reactive getter or a static array.
|
|
58
|
+
*/
|
|
59
|
+
declare function For<T>(props: ForProps<T>): Node;
|
|
60
|
+
/** Convert an AkashNode to a DOM Node */
|
|
61
|
+
declare function nodeToDOM(node: AkashNode): Node;
|
|
62
|
+
/** Insert a node into a parent before an anchor */
|
|
63
|
+
declare function insert(parent: Node, node: AkashNode, anchor?: Node): void;
|
|
64
|
+
|
|
65
|
+
export { AkashNode, For, Show, bindProperty, bindText, bindVisible, cloneTemplate, createElement, createText, insert, nodeToDOM, renderConditional, renderList, setProperty };
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export { R as ReadonlySignal, S as Signal, c as computed, e as effect, s as signal, u as untrack } from './signals-C7XfOHHR.js';
|
|
2
|
+
export { I as InjectionKey, b as batch, c as createContext, f as flushSync, i as inject, p as provide } from './context-2uQ6fuxu.js';
|
|
3
|
+
import { A as AkashNode } from './component-C1WnFcRp.js';
|
|
4
|
+
export { C as Component, a as ComponentContext, R as Ref, d as defineComponent, o as onError, b as onMount, c as onUnmount, r as ref } from './component-C1WnFcRp.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Direct DOM rendering runtime.
|
|
8
|
+
*
|
|
9
|
+
* No virtual DOM. The compiler generates calls to these helpers.
|
|
10
|
+
* Signal reads inside templates become fine-grained effects that
|
|
11
|
+
* update only the specific DOM node that changed.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Create an element and optionally set static attributes */
|
|
15
|
+
declare function createElement(tag: string, attrs?: Record<string, unknown>): HTMLElement;
|
|
16
|
+
/** Create a text node */
|
|
17
|
+
declare function createText(value: string): Text;
|
|
18
|
+
/** Clone a template element for static structure */
|
|
19
|
+
declare function cloneTemplate(html: string): DocumentFragment;
|
|
20
|
+
declare function setProperty(el: HTMLElement, key: string, value: unknown): void;
|
|
21
|
+
/** Bind a reactive expression to a text node's content */
|
|
22
|
+
declare function bindText(node: Text, fn: () => unknown): () => void;
|
|
23
|
+
/** Bind a reactive expression to an element's attribute/property */
|
|
24
|
+
declare function bindProperty(el: HTMLElement, key: string, fn: () => unknown): () => void;
|
|
25
|
+
/** Bind a reactive expression to an element's visibility (display) */
|
|
26
|
+
declare function bindVisible(el: HTMLElement, fn: () => boolean): () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Render a conditional block. Swaps DOM fragments based on a reactive
|
|
29
|
+
* condition. Used by the compiler for :if directives and <Show>.
|
|
30
|
+
*/
|
|
31
|
+
declare function renderConditional(parent: Node, anchor: Node, condition: () => boolean, trueBranch: () => Node, falseBranch?: () => Node): () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Render a reactive list with keyed reconciliation.
|
|
34
|
+
* Used by the compiler for :for directives and <For>.
|
|
35
|
+
*/
|
|
36
|
+
declare function renderList<T>(parent: Node, anchor: Node, items: () => T[], keyFn: (item: T, index: number) => unknown, renderItem: (item: T, index: number) => Node): () => void;
|
|
37
|
+
/** Props for the <Show> component */
|
|
38
|
+
interface ShowProps<T> {
|
|
39
|
+
when: (() => T | null | undefined | false) | T | null | undefined | false;
|
|
40
|
+
fallback?: () => AkashNode;
|
|
41
|
+
children: (value: T) => AkashNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* <Show> component — conditionally renders children with type narrowing.
|
|
45
|
+
* The children callback receives the non-null/undefined value.
|
|
46
|
+
* `when` can be a reactive getter or a static value.
|
|
47
|
+
*/
|
|
48
|
+
declare function Show<T>(props: ShowProps<T>): Node;
|
|
49
|
+
/** Props for the <For> component */
|
|
50
|
+
interface ForProps<T> {
|
|
51
|
+
each: (() => T[]) | T[];
|
|
52
|
+
key: (item: T) => unknown;
|
|
53
|
+
children: (item: T, index: number) => AkashNode;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* <For> component — renders a list with keyed reconciliation.
|
|
57
|
+
* `each` can be a reactive getter or a static array.
|
|
58
|
+
*/
|
|
59
|
+
declare function For<T>(props: ForProps<T>): Node;
|
|
60
|
+
/** Convert an AkashNode to a DOM Node */
|
|
61
|
+
declare function nodeToDOM(node: AkashNode): Node;
|
|
62
|
+
/** Insert a node into a parent before an anchor */
|
|
63
|
+
declare function insert(parent: Node, node: AkashNode, anchor?: Node): void;
|
|
64
|
+
|
|
65
|
+
export { AkashNode, For, Show, bindProperty, bindText, bindVisible, cloneTemplate, createElement, createText, insert, nodeToDOM, renderConditional, renderList, setProperty };
|
package/dist/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{t as For,s as Show,o as bindProperty,n as bindText,p as bindVisible,l as cloneTemplate,g as createContext,j as createElement,k as createText,B as defineComponent,i as inject,v as insert,u as nodeToDOM,z as onError,x as onMount,y as onUnmount,h as provide,A as ref,q as renderConditional,r as renderList,m as setProperty}from'./chunk-
|
|
1
|
+
export{t as For,s as Show,o as bindProperty,n as bindText,p as bindVisible,l as cloneTemplate,g as createContext,j as createElement,k as createText,B as defineComponent,i as inject,v as insert,u as nodeToDOM,z as onError,x as onMount,y as onUnmount,h as provide,A as ref,q as renderConditional,r as renderList,m as setProperty}from'./chunk-BT6HNBE7.js';export{a as batch,m as computed,n as effect,b as flushSync,l as signal,o as untrack}from'./chunk-POLTPHUA.js';//# sourceMappingURL=core.js.map
|
|
2
2
|
//# sourceMappingURL=core.js.map
|