@stillflow/engine 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +156 -3
- package/dist/index.cjs.js +1051 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.es.js +1023 -0
- package/dist/jsx-runtime.d.ts +43 -0
- package/dist/lib-DUuDpiwh.js +11975 -0
- package/dist/lib-lWz8P7iq.cjs +11979 -0
- package/dist/stillflow/abstracts/IR.d.ts +7 -0
- package/dist/stillflow/abstracts/meta.d.ts +8 -0
- package/dist/stillflow/abstracts/operators.d.ts +22 -0
- package/dist/stillflow/abstracts/state.d.ts +13 -0
- package/dist/stillflow/abstracts/view.d.ts +8 -0
- package/dist/stillflow/compiler/compile.d.ts +11 -0
- package/dist/stillflow/compiler/instantiate.d.ts +3 -0
- package/dist/stillflow/factories/factories.d.ts +10 -0
- package/dist/stillflow/index.d.ts +5 -0
- package/dist/stillflow/kernel/buffer.d.ts +10 -0
- package/dist/stillflow/kernel/kernel.d.ts +26 -0
- package/dist/stillflow/kernel/signal.d.ts +5 -0
- package/dist/stillflow/operators.d.ts +15 -0
- package/dist/stillflow/state.d.ts +15 -0
- package/dist/stillflow/stillflow.d.ts +28 -0
- package/dist/stillflow/tools/batcher.d.ts +9 -0
- package/dist/stillflow/variable.d.ts +12 -0
- package/dist/stillflow-collection/abstract/collection.delta.d.ts +10 -0
- package/dist/stillflow-collection/abstract/collection.flusher.d.ts +17 -0
- package/dist/stillflow-collection/abstract/collection.glee.d.ts +28 -0
- package/dist/stillflow-collection/abstract/collection.index.d.ts +9 -0
- package/dist/stillflow-collection/abstract/collection.logical.d.ts +13 -0
- package/dist/stillflow-collection/abstract/collection.physical.d.ts +13 -0
- package/dist/stillflow-collection/abstract/collection.serializable.d.ts +4 -0
- package/dist/stillflow-collection/array.d.ts +21 -0
- package/dist/stillflow-collection/fenwick.d.ts +28 -0
- package/dist/stillflow-collection/flushable.d.ts +38 -0
- package/dist/stillflow-collection/index.d.ts +6 -0
- package/dist/stillflow-collection/utilities/disjointed-set.d.ts +10 -0
- package/dist/stillflow-collection/utilities/fenwick-tree.d.ts +9 -0
- package/dist/stillflow-collection/utilities/index.d.ts +1 -0
- package/dist/stillflow-collection/utilities/interval-merger.d.ts +7 -0
- package/dist/stillflow-collection/utilities/range-fenwick-tree.d.ts +11 -0
- package/dist/stillflow-runtime/dom.d.ts +5 -0
- package/dist/stillflow-runtime/utilities/delegate-event.d.ts +1 -0
- package/dist/stillflow-runtime/utilities/index.d.ts +3 -0
- package/dist/stillflow-runtime/utilities/reconcile-if.d.ts +10 -0
- package/dist/stillflow-runtime/utilities/reconcile-list.d.ts +8 -0
- package/dist/stillflow-serialize/deserialize.d.ts +2 -0
- package/dist/stillflow-serialize/index.d.ts +2 -0
- package/dist/stillflow-serialize/serialize.d.ts +2 -0
- package/dist/stillflow-serialize/serialized.d.ts +4 -0
- package/dist/stillflow-vite/dom.pass.codegen.d.ts +8 -0
- package/dist/stillflow-vite/dom.pass.transform.d.ts +16 -0
- package/dist/stillflow-vite/dom.target.d.ts +2 -0
- package/dist/stillflow-vite/targets.plugin.d.ts +9 -0
- package/dist/stillflow-vite/vm-abstract/index.d.ts +3 -0
- package/dist/stillflow-vite/vm-abstract/vm.instruction.d.ts +7 -0
- package/dist/stillflow-vite/vm-abstract/vm.options.d.ts +4 -0
- package/dist/stillflow-vite/vm-abstract/vm.target.d.ts +23 -0
- package/dist/stillflow-vite/vm-compiler/bytecode-builder.d.ts +33 -0
- package/dist/stillflow-vite/vm-compiler/codes.d.ts +20 -0
- package/dist/stillflow-vite/vm-compiler/dirty.d.ts +7 -0
- package/dist/stillflow-vite/vm-compiler/fabric.d.ts +9 -0
- package/dist/stillflow-vite/vm-compiler/index.d.ts +8 -0
- package/dist/stillflow-vite/vm-compiler/nodes.d.ts +72 -0
- package/dist/stillflow-vite/vm-compiler/pass.analyze-dirty.d.ts +3 -0
- package/dist/stillflow-vite/vm-compiler/pass.analyze-dynamic.d.ts +2 -0
- package/dist/stillflow-vite/vm-compiler/pass.lowering.d.ts +4 -0
- package/dist/stillflow-vite/vm-compiler/pass.scopes.d.ts +14 -0
- package/dist/stillflow-vite/vm-targets/collect-components.d.ts +8 -0
- package/dist/stillflow-vite/vm-targets/collect-imports.d.ts +3 -0
- package/dist/stillflow-vite/vm-targets/find-component.d.ts +3 -0
- package/dist/targets.index.d.ts +1 -0
- package/dist/vite.cjs.js +261 -0
- package/dist/vite.es.js +260 -0
- package/dist/vite.plugin.d.ts +3 -0
- package/dist/vm.instruction-DPuxu4sV.cjs +9 -0
- package/dist/vm.instruction-oyM-GI-p.js +4 -0
- package/dist/vms.cjs.js +1096 -0
- package/dist/vms.es.js +1095 -0
- package/package.json +99 -5
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type Mapping = Record<string, any>;
|
|
2
|
+
export type Ref<T extends Mapping, P extends keyof T> = {
|
|
3
|
+
type: 'ref';
|
|
4
|
+
path: P;
|
|
5
|
+
};
|
|
6
|
+
export type Backref<T extends Mapping, P extends keyof T> = {
|
|
7
|
+
type: 'backref';
|
|
8
|
+
path: P;
|
|
9
|
+
};
|
|
10
|
+
export type Local<T> = {
|
|
11
|
+
type: 'local';
|
|
12
|
+
value: T;
|
|
13
|
+
};
|
|
14
|
+
export type Link<V extends Mapping> = {
|
|
15
|
+
type: 'link';
|
|
16
|
+
source: V;
|
|
17
|
+
};
|
|
18
|
+
export type Is = {
|
|
19
|
+
type: 'is';
|
|
20
|
+
factory: string;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type Mapping = Record<string, any>;
|
|
2
|
+
export interface AbstractState<T extends Mapping = Mapping> {
|
|
3
|
+
write<K extends keyof T>(path: K, value: T[K]): void;
|
|
4
|
+
read<K extends keyof T>(path: K): T[K];
|
|
5
|
+
remove<K extends keyof T>(path: K): void;
|
|
6
|
+
entries(): {
|
|
7
|
+
[K in keyof T]: T[K];
|
|
8
|
+
};
|
|
9
|
+
from_entries(entries: {
|
|
10
|
+
[K in keyof T]: T[K];
|
|
11
|
+
}): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta } from './meta.js';
|
|
2
|
+
import { Backref, Link, Local, Ref } from './operators.js';
|
|
3
|
+
type Mapping = Record<string, any>;
|
|
4
|
+
type OperatorView<V extends Mapping, T extends Mapping, K extends keyof V> = V[K] extends Ref<T, infer K0> ? T[K0] : V[K] extends Backref<T, infer K1> ? T[K1] : V[K] extends Local<infer K2> ? K2 : V[K] extends Link<infer K3> ? View<K3, T> : any;
|
|
5
|
+
export type View<V extends Mapping, T extends Mapping> = Meta & {
|
|
6
|
+
[K in keyof V]: OperatorView<V, T, K>;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Backref, Is, Link, Local, Ref } from '../abstracts/operators.js';
|
|
2
|
+
import { Kernel } from '../kernel/kernel.js';
|
|
3
|
+
import { IR } from '../abstracts/IR.js';
|
|
4
|
+
import { Meta } from '../abstracts/meta.js';
|
|
5
|
+
import { View } from '../abstracts/view.js';
|
|
6
|
+
type Mapping = Record<string, any>;
|
|
7
|
+
type Source = Record<string, Link<any> | Ref<any, any> | Backref<any, any> | Local<any> | Is>;
|
|
8
|
+
export declare function $ProcessWrite<T extends Mapping>(kernel: Kernel<T>, source: IR, view: Mapping): void;
|
|
9
|
+
export declare function $ProcessRead<T extends Mapping>(kernel: Kernel<T>, source: IR, view: Mapping): void;
|
|
10
|
+
export declare function $Compile<V extends Source, T extends Mapping>(kernel: Kernel<T>, source: V): View<V, T> & Meta;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Mapping = Record<string, any>;
|
|
2
|
+
export declare class Factories {
|
|
3
|
+
private _parent;
|
|
4
|
+
private _factories;
|
|
5
|
+
constructor(_parent?: Factories | null);
|
|
6
|
+
add<T, V extends Mapping>(type: string, factory: (view: V, factories: Factories) => T): void;
|
|
7
|
+
get<T, V extends Mapping>(type: string, view: V): T;
|
|
8
|
+
make(): Factories;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractState } from '../abstracts/state.js';
|
|
2
|
+
type Mapping = Record<string, any>;
|
|
3
|
+
export declare class Buffer<T extends Mapping = Mapping> {
|
|
4
|
+
private _messages;
|
|
5
|
+
constructor();
|
|
6
|
+
write<K extends keyof T>(path: K, value: T[K]): void;
|
|
7
|
+
discard(): void;
|
|
8
|
+
commit(state: AbstractState<T>): void;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Buffer } from './buffer.js';
|
|
2
|
+
import { AbstractState } from '../abstracts/state.js';
|
|
3
|
+
type Mapping = Record<string, any>;
|
|
4
|
+
export declare class Kernel<T extends Mapping = Mapping> implements AbstractState<T> {
|
|
5
|
+
private _state;
|
|
6
|
+
private _before;
|
|
7
|
+
private _after;
|
|
8
|
+
private _commiting;
|
|
9
|
+
private _additional;
|
|
10
|
+
private _buffers;
|
|
11
|
+
constructor(_state: AbstractState<T>);
|
|
12
|
+
bind(buffer: Buffer<T>): () => void;
|
|
13
|
+
before(site: () => void): () => void;
|
|
14
|
+
after(site: () => void): () => void;
|
|
15
|
+
write<K extends keyof T>(path: K, value: T[K]): void;
|
|
16
|
+
read<K extends keyof T>(path: K): T[K];
|
|
17
|
+
remove<K extends keyof T>(path: K): void;
|
|
18
|
+
entries(): {
|
|
19
|
+
[K in keyof T]: T[K];
|
|
20
|
+
};
|
|
21
|
+
from_entries(entries: {
|
|
22
|
+
[K in keyof T]: T[K];
|
|
23
|
+
}): void;
|
|
24
|
+
commit(): void;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Backref, Is, Link, Local, Ref } from './abstracts/operators.js';
|
|
2
|
+
type Mapping = Record<string, any>;
|
|
3
|
+
declare function ref<T extends Mapping, K extends keyof T>(path: K): Ref<T, K>;
|
|
4
|
+
declare function backref<T extends Mapping, K extends keyof T>(path: K): Backref<T, K>;
|
|
5
|
+
declare function local<T>(value: T): Local<T>;
|
|
6
|
+
declare function link<V extends Mapping>(source: V): Link<V>;
|
|
7
|
+
declare function is(factory: string): Is;
|
|
8
|
+
declare const _default: {
|
|
9
|
+
ref: typeof ref;
|
|
10
|
+
backref: typeof backref;
|
|
11
|
+
link: typeof link;
|
|
12
|
+
local: typeof local;
|
|
13
|
+
is: typeof is;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AbstractState } from './abstracts/state.js';
|
|
2
|
+
type Mapping = Record<string, any>;
|
|
3
|
+
export declare class State<T extends Mapping = Mapping> implements AbstractState<T> {
|
|
4
|
+
private _state;
|
|
5
|
+
write<K extends keyof T>(path: K, value: T[K]): void;
|
|
6
|
+
read<K extends keyof T>(path: K): T[K];
|
|
7
|
+
remove<K extends keyof T>(path: K): void;
|
|
8
|
+
entries(): {
|
|
9
|
+
[K in keyof T]: T[K];
|
|
10
|
+
};
|
|
11
|
+
from_entries(entries: {
|
|
12
|
+
[K in keyof T]: T[K];
|
|
13
|
+
}): void;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Meta } from './abstracts/meta.js';
|
|
2
|
+
import { AbstractState } from './abstracts/state.js';
|
|
3
|
+
import { View } from './abstracts/view.js';
|
|
4
|
+
import { Factories } from './factories/factories.js';
|
|
5
|
+
import { Buffer } from './kernel/buffer.js';
|
|
6
|
+
import { Variable } from './variable.js';
|
|
7
|
+
type Mapping = Record<string, any>;
|
|
8
|
+
type Options = {
|
|
9
|
+
strategy: (site: () => void) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare class Stillflow<T extends Mapping = Mapping> {
|
|
12
|
+
private _state;
|
|
13
|
+
private _options;
|
|
14
|
+
private _views;
|
|
15
|
+
private _kernel;
|
|
16
|
+
private _batcher;
|
|
17
|
+
constructor(_state: AbstractState<T>, _options?: Options);
|
|
18
|
+
on(site: () => void): () => void;
|
|
19
|
+
factory(): Factories;
|
|
20
|
+
buffer(): Buffer<T>;
|
|
21
|
+
bind(buffer: Buffer<T>): void;
|
|
22
|
+
compile<V extends Mapping>(source: V): View<V, T>;
|
|
23
|
+
instantiate<V extends Meta>(source: V, factory: Factories): V;
|
|
24
|
+
entries(): { [K in keyof T]: T[K]; };
|
|
25
|
+
commit(): void;
|
|
26
|
+
variable<K extends keyof T>(path: K): Variable<T, K>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Backref, Ref } from './abstracts/operators.js';
|
|
2
|
+
import { Kernel } from './kernel/kernel.js';
|
|
3
|
+
export declare class Variable<T extends Record<string, any>, P extends keyof T> {
|
|
4
|
+
private _kernel;
|
|
5
|
+
private _key;
|
|
6
|
+
constructor(_kernel: Kernel<T>, _key: P);
|
|
7
|
+
write(value: T[P]): void;
|
|
8
|
+
read(): T[P];
|
|
9
|
+
remove(): void;
|
|
10
|
+
ref(): Ref<T, P>;
|
|
11
|
+
backref(): Backref<T, P>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LogicalIndex } from './collection.index';
|
|
2
|
+
export type Delta<T> = {
|
|
3
|
+
addes: number;
|
|
4
|
+
swaps: Map<LogicalIndex, LogicalIndex>;
|
|
5
|
+
updates: Map<LogicalIndex, T>;
|
|
6
|
+
removes: Set<LogicalIndex>;
|
|
7
|
+
replaces: boolean;
|
|
8
|
+
clears: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function clear_delta<T>(delta: Delta<T>): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Delta } from './collection.delta';
|
|
2
|
+
import { SerializableCollection } from './collection.serializable';
|
|
3
|
+
export interface Flusher<T> extends SerializableCollection<T> {
|
|
4
|
+
flush(): Delta<T>;
|
|
5
|
+
at(id: number): T;
|
|
6
|
+
add(value: T): void;
|
|
7
|
+
set(id: number, value: T): void;
|
|
8
|
+
swap(i: number, j: number): void;
|
|
9
|
+
drop(id: number): void;
|
|
10
|
+
clear(): void;
|
|
11
|
+
mutate(id: number, mutator: (value: T) => void): void;
|
|
12
|
+
attach(value: T[]): void;
|
|
13
|
+
remove(id: number): void;
|
|
14
|
+
remove_range(left: number, right: number): void;
|
|
15
|
+
touch(id: number): void;
|
|
16
|
+
get size(): number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LogicalIndex, PhysicalIndex } from './collection.index';
|
|
2
|
+
import { LogicalCollection } from './collection.logical';
|
|
3
|
+
import { PhysicalCollection } from './collection.physical';
|
|
4
|
+
import { SerializableCollection } from './collection.serializable';
|
|
5
|
+
export declare abstract class GleeCollection<T> implements PhysicalCollection<T>, LogicalCollection<T>, SerializableCollection<T> {
|
|
6
|
+
abstract $to_logical(index: PhysicalIndex): LogicalIndex;
|
|
7
|
+
abstract $to_physical(id: LogicalIndex): PhysicalIndex;
|
|
8
|
+
abstract $at(index: PhysicalIndex): T;
|
|
9
|
+
abstract $set(index: PhysicalIndex, value: T): void;
|
|
10
|
+
abstract $swap(i: PhysicalIndex, j: PhysicalIndex): void;
|
|
11
|
+
abstract $mutate(index: PhysicalIndex, mutator: (value: T) => void): void;
|
|
12
|
+
abstract $remove(index: PhysicalIndex): void;
|
|
13
|
+
abstract $remove_range(left: PhysicalIndex, right: PhysicalIndex): void;
|
|
14
|
+
abstract shrink(): void;
|
|
15
|
+
at(id: LogicalIndex): T;
|
|
16
|
+
set(id: LogicalIndex, value: T): void;
|
|
17
|
+
swap(i: LogicalIndex, j: LogicalIndex): void;
|
|
18
|
+
mutate(id: LogicalIndex, mutator: (value: T) => void): void;
|
|
19
|
+
remove(id: LogicalIndex): void;
|
|
20
|
+
remove_range(left: LogicalIndex, right: LogicalIndex): void;
|
|
21
|
+
abstract add(value: T): void;
|
|
22
|
+
abstract attach(value: T[]): void;
|
|
23
|
+
abstract clear(): void;
|
|
24
|
+
abstract serialize<R = T>(map: (item: T) => R): R[];
|
|
25
|
+
abstract deserialize(items: T[]): void;
|
|
26
|
+
abstract get $size(): number;
|
|
27
|
+
get size(): number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Brand<T, B> = T & {
|
|
2
|
+
readonly __brand: B;
|
|
3
|
+
};
|
|
4
|
+
export type Index = number;
|
|
5
|
+
export type LogicalIndex = Brand<Index, 'LogicalIndex'>;
|
|
6
|
+
export type PhysicalIndex = Brand<Index, 'PhysicalIndex'>;
|
|
7
|
+
export declare const as_logical: (id: number) => LogicalIndex;
|
|
8
|
+
export declare const as_physical: (id: number) => PhysicalIndex;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LogicalIndex } from './collection.index';
|
|
2
|
+
export interface LogicalCollection<T> {
|
|
3
|
+
at(id: LogicalIndex): T;
|
|
4
|
+
add(value: T): void;
|
|
5
|
+
set(id: LogicalIndex, value: T): void;
|
|
6
|
+
swap(i: LogicalIndex, j: LogicalIndex): void;
|
|
7
|
+
clear(): void;
|
|
8
|
+
mutate(id: LogicalIndex, mutator: (value: T) => void): void;
|
|
9
|
+
attach(value: T[]): void;
|
|
10
|
+
remove(id: LogicalIndex): void;
|
|
11
|
+
remove_range(left: LogicalIndex, right: LogicalIndex): void;
|
|
12
|
+
get size(): number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LogicalIndex, PhysicalIndex } from './collection.index';
|
|
2
|
+
export interface PhysicalCollection<T> {
|
|
3
|
+
$to_logical(index: PhysicalIndex): LogicalIndex;
|
|
4
|
+
$to_physical(id: LogicalIndex): PhysicalIndex;
|
|
5
|
+
$at(index: PhysicalIndex): T;
|
|
6
|
+
$set(index: PhysicalIndex, value: T): void;
|
|
7
|
+
$swap(i: PhysicalIndex, j: PhysicalIndex): void;
|
|
8
|
+
$mutate(index: PhysicalIndex, mutator: (value: T) => void): void;
|
|
9
|
+
$remove(index: PhysicalIndex): void;
|
|
10
|
+
$remove_range(left: PhysicalIndex, right: PhysicalIndex): void;
|
|
11
|
+
shrink(): void;
|
|
12
|
+
get $size(): number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LogicalIndex, PhysicalIndex } from './abstract/collection.index.js';
|
|
2
|
+
import { GleeCollection } from './abstract/collection.glee.js';
|
|
3
|
+
export declare class ArrayCollection<T> extends GleeCollection<T> {
|
|
4
|
+
private _data;
|
|
5
|
+
constructor(initial?: T[]);
|
|
6
|
+
$to_logical(index: PhysicalIndex): LogicalIndex;
|
|
7
|
+
$to_physical(id: LogicalIndex): PhysicalIndex;
|
|
8
|
+
$at(id: PhysicalIndex): T;
|
|
9
|
+
$set(id: PhysicalIndex, value: T): void;
|
|
10
|
+
$swap(i: PhysicalIndex, j: PhysicalIndex): void;
|
|
11
|
+
$mutate(index: PhysicalIndex, mutator: (value: T) => void): void;
|
|
12
|
+
add(value: T): void;
|
|
13
|
+
attach(value: T[]): void;
|
|
14
|
+
$remove(id: PhysicalIndex): void;
|
|
15
|
+
$remove_range(left: PhysicalIndex, right: PhysicalIndex): void;
|
|
16
|
+
serialize<R = T>(map: (item: T) => R): R[];
|
|
17
|
+
deserialize(items: T[]): void;
|
|
18
|
+
shrink(): void;
|
|
19
|
+
clear(): void;
|
|
20
|
+
get $size(): number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LogicalIndex, PhysicalIndex } from './abstract/collection.index.js';
|
|
2
|
+
import { GleeCollection } from './abstract/collection.glee.js';
|
|
3
|
+
export declare class FenwickCollection<T> extends GleeCollection<T> {
|
|
4
|
+
private _size;
|
|
5
|
+
private static GROW;
|
|
6
|
+
private static REMOVE_COUNT;
|
|
7
|
+
private _removes;
|
|
8
|
+
private _tree;
|
|
9
|
+
private _shift;
|
|
10
|
+
private _data;
|
|
11
|
+
constructor(_size?: number);
|
|
12
|
+
$to_logical(index: PhysicalIndex): LogicalIndex;
|
|
13
|
+
$to_physical(id: LogicalIndex): PhysicalIndex;
|
|
14
|
+
$at(id: PhysicalIndex): T;
|
|
15
|
+
$set(id: PhysicalIndex, value: T): void;
|
|
16
|
+
$swap(i: PhysicalIndex, j: PhysicalIndex): void;
|
|
17
|
+
$mutate(index: PhysicalIndex, mutator: (value: T) => void): void;
|
|
18
|
+
shrink(): void;
|
|
19
|
+
clear(): void;
|
|
20
|
+
add(value: T): void;
|
|
21
|
+
attach(value: T[]): void;
|
|
22
|
+
serialize<R = T>(map: (item: T) => R): R[];
|
|
23
|
+
deserialize(items: T[]): void;
|
|
24
|
+
$remove(id: PhysicalIndex): void;
|
|
25
|
+
$remove_range(left: PhysicalIndex, right: PhysicalIndex): void;
|
|
26
|
+
get $size(): number;
|
|
27
|
+
get $capacity(): number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Delta } from './abstract/collection.delta.js';
|
|
2
|
+
import { GleeCollection } from './abstract/collection.glee.js';
|
|
3
|
+
import { Flusher } from './abstract/collection.flusher.js';
|
|
4
|
+
export declare class FlushableCollection<T> implements Flusher<T> {
|
|
5
|
+
private _base;
|
|
6
|
+
private _front;
|
|
7
|
+
private _back;
|
|
8
|
+
constructor(_base: GleeCollection<T>);
|
|
9
|
+
at(index: number): T;
|
|
10
|
+
add(value: T): void;
|
|
11
|
+
set(index: number, value: T): void;
|
|
12
|
+
swap(i: number, j: number): void;
|
|
13
|
+
attach(value: T[]): void;
|
|
14
|
+
mutate(index: number, mutator: (value: T) => void): void;
|
|
15
|
+
shrink(): void;
|
|
16
|
+
clear(): void;
|
|
17
|
+
touch(id: number): void;
|
|
18
|
+
/**
|
|
19
|
+
* Drops an item by its original creation index (`$index` inside `<for>`)
|
|
20
|
+
* resolving holes in $O(\log n)$ without re-indexing existing rows
|
|
21
|
+
*
|
|
22
|
+
* @param id Original physical index captured when the row was created
|
|
23
|
+
*/
|
|
24
|
+
drop(id: number): void;
|
|
25
|
+
/**
|
|
26
|
+
* Removes an item by its current logical index (`0 .. size - 1`)
|
|
27
|
+
*
|
|
28
|
+
* @param id Current logical position of the item in the list
|
|
29
|
+
*/
|
|
30
|
+
remove(id: number): void;
|
|
31
|
+
remove_range(left: number, right: number): void;
|
|
32
|
+
serialize<R = T>(map: (item: T) => R): R[];
|
|
33
|
+
deserialize(items: T[]): void;
|
|
34
|
+
flush(): Delta<T>;
|
|
35
|
+
get size(): number;
|
|
36
|
+
static fenwick<T>(initial_capacity?: number): FlushableCollection<T>;
|
|
37
|
+
static array<T>(initial?: T[]): FlushableCollection<T>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { FlushableCollection as Flushable } from './flushable';
|
|
2
|
+
export { FenwickCollection as Fenwick } from './fenwick';
|
|
3
|
+
export { ArrayCollection as Array } from './array';
|
|
4
|
+
export { as_logical, as_physical } from './abstract/collection.index';
|
|
5
|
+
export type { GleeCollection as Abstract } from './abstract/collection.glee';
|
|
6
|
+
export type { SerializableCollection as Serializable } from './abstract/collection.serializable';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class DSU {
|
|
2
|
+
private _size;
|
|
3
|
+
private _parent;
|
|
4
|
+
constructor(_size: number, old?: Int32Array);
|
|
5
|
+
find(index: number): number;
|
|
6
|
+
mark(left: number, right: number): void;
|
|
7
|
+
is_marked(index: number): boolean;
|
|
8
|
+
grow(length: number): DSU;
|
|
9
|
+
get size(): number;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fenwick } from './fenwick-tree.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Fenwick } from './fenwick-tree.js';
|
|
2
|
+
export declare class RangeFenwick {
|
|
3
|
+
private _start;
|
|
4
|
+
private _end;
|
|
5
|
+
private _size;
|
|
6
|
+
constructor(size: number, _start?: Fenwick, _end?: Fenwick);
|
|
7
|
+
add(left: number, right: number, delta?: number): void;
|
|
8
|
+
count(index: number): number;
|
|
9
|
+
grow(length: number): RangeFenwick;
|
|
10
|
+
get size(): number;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function delegate_event(event_name: string): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface BranchController {
|
|
2
|
+
readonly elements: readonly Node[];
|
|
3
|
+
readonly patch: (dirty: number) => void;
|
|
4
|
+
}
|
|
5
|
+
interface AnchorNode extends Comment {
|
|
6
|
+
_sf_branch?: number;
|
|
7
|
+
_sf_ctrl?: BranchController | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function reconcile_if(anchor: AnchorNode, active_index: number, factories: readonly (() => BranchController)[], dirty: number): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FlushableCollection } from '../../stillflow-collection/flushable';
|
|
2
|
+
export interface ListItemController<T> {
|
|
3
|
+
element: Element;
|
|
4
|
+
patch: (item: T) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function reconcile_list<T>(root: Element & {
|
|
7
|
+
sf_elements?: ListItemController<T>[];
|
|
8
|
+
}, items: FlushableCollection<T>, createItem: (item: T, index: number) => ListItemController<T>): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Serializable } from '../stillflow-collection/index';
|
|
2
|
+
export type Serialized<T> = T extends Serializable<infer U> ? Serialized<U>[] : T extends Map<infer K, infer V> ? K extends string | number ? Record<K, Serialized<V>> : never : T extends (infer U)[] ? Serialized<U>[] : T extends Function ? never : T extends object ? {
|
|
3
|
+
[K in keyof T as T[K] extends Function ? never : K]: Serialized<T[K]>;
|
|
4
|
+
} : T;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BytecodeBuilder } from './vm-compiler/bytecode-builder';
|
|
2
|
+
export declare function emit_dirty_prologue(tracked_variables: readonly string[], source: (name: string, bit: number) => string): string[];
|
|
3
|
+
export interface GeneratedCode {
|
|
4
|
+
module: string[];
|
|
5
|
+
mount: string[];
|
|
6
|
+
patch: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function generate_dom(builder: BytecodeBuilder): GeneratedCode;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StillflowNode } from './vm-compiler/nodes';
|
|
2
|
+
import { Component } from './vm-abstract/vm.target';
|
|
3
|
+
import { types } from '@babel/core';
|
|
4
|
+
export interface ComponentIR {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly params: {
|
|
7
|
+
readonly ids: readonly string[];
|
|
8
|
+
readonly defaults: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
readonly body: StillflowNode;
|
|
11
|
+
}
|
|
12
|
+
export interface TransformResult {
|
|
13
|
+
readonly root: StillflowNode;
|
|
14
|
+
readonly components: Map<string, ComponentIR>;
|
|
15
|
+
}
|
|
16
|
+
export declare function transform(node: types.Node, raw_components: Map<string, Component>): TransformResult;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Options } from './vm-abstract';
|
|
2
|
+
import { PluginObject } from '@babel/core';
|
|
3
|
+
export default function StillflowTargets({ node_module, path, babel, fs, parser }: {
|
|
4
|
+
node_module: any;
|
|
5
|
+
path: any;
|
|
6
|
+
babel: any;
|
|
7
|
+
fs: any;
|
|
8
|
+
parser: any;
|
|
9
|
+
}, options: Options): () => PluginObject<any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type TargetId = number;
|
|
2
|
+
export type LocalOpcode = number;
|
|
3
|
+
export type PackedOpcode = number;
|
|
4
|
+
export declare const CORE_TARGET_ID: TargetId;
|
|
5
|
+
export declare const pack_opcode: (target: TargetId, local: LocalOpcode) => PackedOpcode;
|
|
6
|
+
export declare const unpack_target: (pack: PackedOpcode) => TargetId;
|
|
7
|
+
export declare const unpack_local: (pack: PackedOpcode) => LocalOpcode;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Scope, types } from '@babel/core';
|
|
2
|
+
export type Component = {
|
|
3
|
+
node: types.Node;
|
|
4
|
+
parameters: {
|
|
5
|
+
ids: string[];
|
|
6
|
+
defaults: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
body: types.JSXElement;
|
|
9
|
+
filename: string;
|
|
10
|
+
scope: Scope;
|
|
11
|
+
};
|
|
12
|
+
export type Import = {
|
|
13
|
+
source: string;
|
|
14
|
+
imported_name: string;
|
|
15
|
+
is_default: boolean;
|
|
16
|
+
};
|
|
17
|
+
export interface VMChunk {
|
|
18
|
+
module: types.Statement[];
|
|
19
|
+
body: types.Statement[];
|
|
20
|
+
}
|
|
21
|
+
export interface VMTarget {
|
|
22
|
+
main(descriptor: types.JSXElement, components: Map<string, Component>): VMChunk;
|
|
23
|
+
}
|