aoye 0.0.21 → 0.0.23

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/index.d.ts CHANGED
@@ -22,6 +22,39 @@ declare enum State {
22
22
  Pulling = 1
23
23
  }
24
24
 
25
+ declare class Line {
26
+ static link(v1: Signal, v2: Signal): void;
27
+ static unlink(line: Line): void;
28
+ static unlinkRec(line: Line): void;
29
+ static unlinkEmit(line: Line): void;
30
+ /** 上游节点 连 link */
31
+ static emit_line(upstream: Signal, line: Line): void;
32
+ /** 下游节点 连 link */
33
+ static rec_line(downstream: Signal, line: Line): void;
34
+ /** 同一节点发出的 两个条线 相连 */
35
+ static line_line_emit(l1: Line, l2: Line): void;
36
+ /** 同一节点接收的 两个条线 相连 */
37
+ static line_line_rec(l1: Line, l2: Line): void;
38
+ static insert_line_emit(l1: Line, l2: Line, ins: Line): void;
39
+ static insert_line_rec(l1: Line, l2: Line, ins: Line): void;
40
+ /** 上游顶点 */
41
+ upstream: Signal;
42
+ /** 上游节点 发出的上一条线 */
43
+ prevEmitLine: Line;
44
+ /** 上游节点 发出的下一条线 */
45
+ nextEmitLine: Line;
46
+ /** 下游顶点 */
47
+ downstream: Signal;
48
+ /** 下游节点 接收的上一条线 */
49
+ prevRecLine: Line;
50
+ /** 下游节点 接收的下一条线 */
51
+ nextRecLine: Line;
52
+ /** 表示 scope 当前存在的 外部 link */
53
+ prevOutLink: any;
54
+ nextOutLink: any;
55
+ constructor();
56
+ }
57
+
25
58
  type SignalType = 'ref' | 'auto' | 'proxy';
26
59
  declare enum Keys {
27
60
  Iterator = "__AOYE_ITERATOR",
@@ -102,39 +135,6 @@ type PRecord<K extends string | symbol | number, V> = Partial<Record<K, V>>;
102
135
  type DeepValue<T, P> = P extends [infer Head, ...infer Tail] ? Head extends keyof T ? Tail extends [] ? T[Head] : DeepValue<T[Head], Tail> : never : never;
103
136
  type MatchValue<V1, T2, P2> = (DeepValue<T2, P2> extends V1 ? P2 : never);
104
137
 
105
- declare class Line {
106
- static link(v1: Signal, v2: Signal): void;
107
- static unlink(line: Line): void;
108
- static unlinkRec(line: Line): void;
109
- static unlinkEmit(line: Line): void;
110
- /** 上游节点 连 link */
111
- static emit_line(upstream: Vertex, line: Line): void;
112
- /** 下游节点 连 link */
113
- static rec_line(downstream: Vertex, line: Line): void;
114
- /** 同一节点发出的 两个条线 相连 */
115
- static line_line_emit(l1: Line, l2: Line): void;
116
- /** 同一节点接收的 两个条线 相连 */
117
- static line_line_rec(l1: Line, l2: Line): void;
118
- static insert_line_emit(l1: Line, l2: Line, ins: Line): void;
119
- static insert_line_rec(l1: Line, l2: Line, ins: Line): void;
120
- /** 上游顶点 */
121
- upstream: Vertex;
122
- /** 上游节点 发出的上一条线 */
123
- prevEmitLine: Line;
124
- /** 上游节点 发出的下一条线 */
125
- nextEmitLine: Line;
126
- /** 下游顶点 */
127
- downstream: Vertex;
128
- /** 下游节点 接收的上一条线 */
129
- prevRecLine: Line;
130
- /** 下游节点 接收的下一条线 */
131
- nextRecLine: Line;
132
- /** 表示 scope 当前存在的 外部 link */
133
- prevOutLink: any;
134
- nextOutLink: any;
135
- constructor();
136
- }
137
-
138
138
  declare class Signal<T = any> implements Vertex {
139
139
  nextValue: T;
140
140
  /** 为什么是 shallow,因为 pullDeep 会把
@@ -166,17 +166,20 @@ declare class Signal<T = any> implements Vertex {
166
166
  * 递归拉取负责建立以来链
167
167
  */
168
168
  pullRecurse(shouldLink?: boolean): T;
169
- linkWhenPull(downstream: Signal): void;
169
+ linkWhenPull(downstream: Signal, shouldLink: boolean): void;
170
170
  pullDeep(): T;
171
171
  get v(): T;
172
172
  markDownStreamsDirty(): void;
173
173
  set v(v: T);
174
+ scheduleEffect(): void;
174
175
  /** 返回值为 true 表示已处理 */
175
176
  runIfDirty(): void;
176
177
  isDisabled(): number;
177
178
  /** 记录当前 effect 中 clean */
178
179
  clean: () => void;
179
180
  }
181
+ declare function batchStart(): void;
182
+ declare function batchEnd(): void;
180
183
 
181
184
  declare const deepSignal: <T>(target: T, scope: Signal, deep?: boolean) => any;
182
185
  /**
@@ -251,14 +254,6 @@ declare class Store {
251
254
  map<P extends Store = any, O extends string = ''>(keyMap?: PRecord<keyof this, keyof Omit<P, O> | DeepOmitPath<P, O>>): void;
252
255
  }
253
256
 
254
- declare class Batch {
255
- deep: number;
256
- start(): void;
257
- end(): void;
258
- inBatch(): boolean;
259
- }
260
- declare const batch: Batch;
261
-
262
257
  declare const toRaw: <T>(a: T) => any;
263
258
 
264
259
  declare const DefaultCustomSignalOpt: {
@@ -296,5 +291,5 @@ declare const customEffect: (opt?: CustomEffectOpt) => typeof effect;
296
291
  declare const isSignal: (value: unknown) => value is Signal;
297
292
  declare const isScope: (value: any) => boolean;
298
293
 
299
- export { $, IsStore, Keys, Scheduler, Signal, Store, StoreIgnoreKeys, TaskQueue, batch, clean, customEffect, deepSignal, effect, getPulling, isScope, isSignal, registerScheduler, runWithPulling, scope, setPulling, shareSignal, toRaw };
294
+ export { $, IsStore, Keys, Scheduler, Signal, Store, StoreIgnoreKeys, TaskQueue, batchEnd, batchStart, clean, customEffect, deepSignal, effect, getPulling, isScope, isSignal, registerScheduler, runWithPulling, scope, setPulling, shareSignal, toRaw };
300
295
  export type { CreateScope, CreateSignal, CreateTaskProps, CustomEffectOpt, CustomSignalOpt, DFSCtxBegin, DFSCtxCompete, DeepOmitPath, DeepPath, DeepValue, Dispose, Getter, Key, MatchValue, Mix, PRecord, ScheduleHandler, SignalOpt, SignalType, Task, TaskControlReturn, ValueDiff, Vertex };