@vscode/markdown-editor 0.0.2-0 → 0.0.2-2

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.
Files changed (96) hide show
  1. package/dist/_observables/assert.d.ts +2 -0
  2. package/dist/_observables/deps.d.ts +28 -0
  3. package/dist/_observables/disposables.d.ts +19 -0
  4. package/dist/_observables/equals.d.ts +32 -0
  5. package/dist/_observables/index.d.ts +2 -0
  6. package/dist/_observables/observableInternal/base.d.ts +172 -0
  7. package/dist/_observables/observableInternal/changeTracker.d.ts +44 -0
  8. package/dist/_observables/observableInternal/commonFacade/cancellation.d.ts +24 -0
  9. package/dist/_observables/observableInternal/commonFacade/deps.d.ts +24 -0
  10. package/dist/_observables/observableInternal/debugLocation.d.ts +21 -0
  11. package/dist/_observables/observableInternal/debugName.d.ts +33 -0
  12. package/dist/_observables/observableInternal/experimental/deferUnobserve.d.ts +16 -0
  13. package/dist/_observables/observableInternal/experimental/reducer.d.ts +37 -0
  14. package/dist/_observables/observableInternal/experimental/utils.d.ts +15 -0
  15. package/dist/_observables/observableInternal/index.d.ts +25 -0
  16. package/dist/_observables/observableInternal/logging/consoleObservableLogger.d.ts +40 -0
  17. package/dist/_observables/observableInternal/logging/debugGetDependencyGraph.d.ts +4 -0
  18. package/dist/_observables/observableInternal/logging/debugger/debuggerRpc.d.ts +4 -0
  19. package/dist/_observables/observableInternal/logging/debugger/devToolsLogger.d.ts +43 -0
  20. package/dist/_observables/observableInternal/logging/debugger/rpc.d.ts +41 -0
  21. package/dist/_observables/observableInternal/logging/debugger/utils.d.ts +13 -0
  22. package/dist/_observables/observableInternal/logging/logging.d.ts +30 -0
  23. package/dist/_observables/observableInternal/map.d.ts +18 -0
  24. package/dist/_observables/observableInternal/observables/baseObservable.d.ts +58 -0
  25. package/dist/_observables/observableInternal/observables/constObservable.d.ts +5 -0
  26. package/dist/_observables/observableInternal/observables/derived.d.ts +46 -0
  27. package/dist/_observables/observableInternal/observables/derivedImpl.d.ts +83 -0
  28. package/dist/_observables/observableInternal/observables/lazyObservableValue.d.ts +27 -0
  29. package/dist/_observables/observableInternal/observables/observableFromEvent.d.ts +37 -0
  30. package/dist/_observables/observableInternal/observables/observableSignal.d.ts +11 -0
  31. package/dist/_observables/observableInternal/observables/observableSignalFromEvent.d.ts +5 -0
  32. package/dist/_observables/observableInternal/observables/observableValue.d.ts +37 -0
  33. package/dist/_observables/observableInternal/observables/observableValueOpts.d.ts +8 -0
  34. package/dist/_observables/observableInternal/reactions/autorun.d.ts +56 -0
  35. package/dist/_observables/observableInternal/reactions/autorunImpl.d.ts +53 -0
  36. package/dist/_observables/observableInternal/set.d.ts +17 -0
  37. package/dist/_observables/observableInternal/transaction.d.ts +27 -0
  38. package/dist/_observables/observableInternal/utils/promise.d.ts +75 -0
  39. package/dist/_observables/observableInternal/utils/runOnChange.d.ts +7 -0
  40. package/dist/_observables/observableInternal/utils/utils.d.ts +43 -0
  41. package/dist/_observables/observableInternal/utils/utilsCancellation.d.ts +10 -0
  42. package/dist/_observables/observableInternal/utils/valueWithChangeEvent.d.ts +10 -0
  43. package/dist/_observables/utils.d.ts +15 -0
  44. package/dist/index.d.ts +1769 -6
  45. package/dist/observables.d.ts +4 -1
  46. package/package.json +1 -1
  47. package/dist/commands/cursorCommands.d.ts +0 -13
  48. package/dist/commands/editCommands.d.ts +0 -14
  49. package/dist/commands/index.d.ts +0 -4
  50. package/dist/commands/selectionCommands.d.ts +0 -6
  51. package/dist/commands/types.d.ts +0 -26
  52. package/dist/core/geometry.d.ts +0 -37
  53. package/dist/core/index.d.ts +0 -8
  54. package/dist/core/lengthEdit.d.ts +0 -38
  55. package/dist/core/offsetRange.d.ts +0 -26
  56. package/dist/core/selection.d.ts +0 -13
  57. package/dist/core/sourceOffset.d.ts +0 -1
  58. package/dist/core/stringEdit.d.ts +0 -27
  59. package/dist/core/stringValue.d.ts +0 -8
  60. package/dist/core/wordUtils.d.ts +0 -6
  61. package/dist/highlighter/defaultMonacoSyntaxHighlighter.d.ts +0 -20
  62. package/dist/highlighter/index.d.ts +0 -3
  63. package/dist/highlighter/monacoSyntaxHighlighter.d.ts +0 -38
  64. package/dist/highlighter/syntaxHighlighter.d.ts +0 -67
  65. package/dist/model/cursorNavigation.d.ts +0 -7
  66. package/dist/model/editorModel.d.ts +0 -54
  67. package/dist/model/index.d.ts +0 -4
  68. package/dist/model/measuredLayoutModel.d.ts +0 -50
  69. package/dist/parser/_micromarkAdapter.d.ts +0 -7
  70. package/dist/parser/ast.d.ts +0 -274
  71. package/dist/parser/index.d.ts +0 -4
  72. package/dist/parser/parse.d.ts +0 -2
  73. package/dist/parser/parser.d.ts +0 -14
  74. package/dist/parser/reconcile.d.ts +0 -33
  75. package/dist/parser/test/getAnnotatedSource.d.ts +0 -2
  76. package/dist/parser/test/snapshot.d.ts +0 -9
  77. package/dist/parser/visualizeAst.d.ts +0 -33
  78. package/dist/test/random.d.ts +0 -16
  79. package/dist/view/content/blockView.d.ts +0 -179
  80. package/dist/view/content/documentView.d.ts +0 -41
  81. package/dist/view/content/dom.d.ts +0 -16
  82. package/dist/view/content/katexEditableIdentifiers.d.ts +0 -36
  83. package/dist/view/content/viewNode.d.ts +0 -93
  84. package/dist/view/editorController.d.ts +0 -34
  85. package/dist/view/editorView.d.ts +0 -100
  86. package/dist/view/fixture/astViewerView.d.ts +0 -27
  87. package/dist/view/fixture/cyclingTsHighlighter.d.ts +0 -17
  88. package/dist/view/fixture/debugColors.d.ts +0 -26
  89. package/dist/view/fixture/monacoDebugPanel.d.ts +0 -7
  90. package/dist/view/index.d.ts +0 -9
  91. package/dist/view/measuredLayoutDebugView.d.ts +0 -70
  92. package/dist/view/parts/cursorView.d.ts +0 -29
  93. package/dist/view/parts/selectionView.d.ts +0 -57
  94. package/dist/view/viewData.d.ts +0 -251
  95. package/dist/view/visualLineMap.d.ts +0 -157
  96. package/dist/view/visualizeViewTree.d.ts +0 -5
@@ -0,0 +1,2 @@
1
+ export declare function assert(condition: boolean): void;
2
+ export declare function assertNonExoticNumber(value: number): void;
@@ -0,0 +1,28 @@
1
+ import { IDisposable, DisposableStore } from './disposables';
2
+ export { IDisposable, DisposableStore };
3
+ export declare function toDisposable(fn: () => void): IDisposable;
4
+ export declare function markAsDisposed(_disposable: IDisposable): void;
5
+ export declare function trackDisposable(_disposable: IDisposable): void;
6
+ export declare function assertFn(_fn: () => {}): void;
7
+ export declare class CancellationError extends Error {
8
+ constructor();
9
+ }
10
+ export interface CancellationToken {
11
+ /**
12
+ * A flag signalling is cancellation has been requested.
13
+ */
14
+ readonly isCancellationRequested: boolean;
15
+ /**
16
+ * An event which fires when cancellation is requested. This event
17
+ * only ever fires `once` as cancellation can only happen once. Listeners
18
+ * that are registered after cancellation will be called (next event loop run),
19
+ * but also only once.
20
+ *
21
+ * @event
22
+ */
23
+ readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;
24
+ }
25
+ export declare function onBugIndicatingError(_error?: any): void;
26
+ export declare class BugIndicatingError extends Error {
27
+ constructor(message?: string);
28
+ }
@@ -0,0 +1,19 @@
1
+ export interface IDisposable {
2
+ dispose(): void;
3
+ }
4
+ export declare class DisposableStore implements IDisposable {
5
+ private disposables;
6
+ private _isDisposed;
7
+ get isDisposed(): boolean;
8
+ dispose(): void;
9
+ add<T extends IDisposable | undefined>(disposable: T): T;
10
+ remove<T extends IDisposable | undefined>(disposable: T): T;
11
+ clear(): void;
12
+ leakItems(): void;
13
+ }
14
+ export declare abstract class Disposable implements IDisposable {
15
+ protected readonly _store: DisposableStore;
16
+ dispose(): void;
17
+ protected _register<T extends IDisposable>(t: T): T;
18
+ protected _registerOrDispose<T extends IDisposable | undefined>(t: T): T;
19
+ }
@@ -0,0 +1,32 @@
1
+ export type EqualityComparer<T> = (a: T, b: T) => boolean;
2
+ /**
3
+ * Compares two items for equality using strict equality.
4
+ */
5
+ export declare const strictEquals: EqualityComparer<any>;
6
+ /**
7
+ * Two items are considered equal, if their stringified representations are equal.
8
+ */
9
+ export declare function jsonStringifyEquals<T>(): EqualityComparer<T>;
10
+ /**
11
+ * Uses `item.equals(other)` to determine equality.
12
+ */
13
+ export declare function itemEquals<T extends {
14
+ equals(other: T): boolean;
15
+ }>(): EqualityComparer<T>;
16
+ /**
17
+ * Checks if two items are both null or undefined, or are equal according to the provided equality comparer.
18
+ */
19
+ export declare function equalsIfDefined<T>(v1: T | undefined | null, v2: T | undefined | null, equals: EqualityComparer<T>): boolean;
20
+ /**
21
+ * Returns an equality comparer that checks if two items are both null or undefined, or are equal according to the provided equality comparer.
22
+ */
23
+ export declare function equalsIfDefined<T>(equals: EqualityComparer<T>): EqualityComparer<T | undefined | null>;
24
+ /**
25
+ * Drills into arrays (items ordered) and objects (keys unordered) and uses strict equality on everything else.
26
+ */
27
+ export declare function structuralEquals<T>(a: T, b: T): boolean;
28
+ /**
29
+ * `getStructuralKey(a) === getStructuralKey(b) <=> structuralEquals(a, b)`
30
+ * (assuming that a and b are not cyclic structures and nothing extends globalThis Array).
31
+ */
32
+ export declare function getStructuralKey(t: unknown): string;
@@ -0,0 +1,2 @@
1
+ export * from './observableInternal/index';
2
+ export * from './disposables';
@@ -0,0 +1,172 @@
1
+ import { DisposableStore } from './commonFacade/deps';
2
+ /**
3
+ * Represents an observable value.
4
+ *
5
+ * @template T The type of the values the observable can hold.
6
+ */
7
+ export interface IObservable<T> extends IObservableWithChange<T, unknown> {
8
+ }
9
+ /**
10
+ * Represents an observable value.
11
+ *
12
+ * @template T The type of the values the observable can hold.
13
+ * @template TChange The type used to describe value changes
14
+ * (usually `void` and only used in advanced scenarios).
15
+ * While observers can miss temporary values of an observable,
16
+ * they will receive all change values (as long as they are subscribed)!
17
+ */
18
+ export interface IObservableWithChange<T, TChange = unknown> {
19
+ /**
20
+ * Returns the current value.
21
+ *
22
+ * Calls {@link IObserver.handleChange} if the observable notices that the value changed.
23
+ * Must not be called from {@link IObserver.handleChange}!
24
+ */
25
+ get(): T;
26
+ /**
27
+ * Forces the observable to check for changes and report them.
28
+ *
29
+ * Has the same effect as calling {@link IObservable.get}, but does not force the observable
30
+ * to actually construct the value, e.g. if change deltas are used.
31
+ * Calls {@link IObserver.handleChange} if the observable notices that the value changed.
32
+ * Must not be called from {@link IObserver.handleChange}!
33
+ */
34
+ reportChanges(): void;
35
+ /**
36
+ * Adds the observer to the set of subscribed observers.
37
+ * This method is idempotent.
38
+ */
39
+ addObserver(observer: IObserver): void;
40
+ /**
41
+ * Removes the observer from the set of subscribed observers.
42
+ * This method is idempotent.
43
+ */
44
+ removeObserver(observer: IObserver): void;
45
+ /**
46
+ * Reads the current value and subscribes the reader to this observable.
47
+ *
48
+ * Calls {@link IReader.readObservable} if a reader is given, otherwise {@link IObservable.get}
49
+ * (see {@link ConvenientObservable.read} for the implementation).
50
+ */
51
+ read(reader: IReader | undefined): T;
52
+ /**
53
+ * Makes sure this value is computed eagerly.
54
+ */
55
+ recomputeInitiallyAndOnChange(store: DisposableStore, handleValue?: (value: T) => void): IObservable<T>;
56
+ /**
57
+ * Makes sure this value is cached.
58
+ */
59
+ keepObserved(store: DisposableStore): IObservable<T>;
60
+ /**
61
+ * Creates a derived observable that depends on this observable.
62
+ * Use the reader to read other observables
63
+ * (see {@link ConvenientObservable.map} for the implementation).
64
+ */
65
+ map<TNew>(fn: (value: T, reader: IReader) => TNew): IObservable<TNew>;
66
+ map<TNew>(owner: object, fn: (value: T, reader: IReader) => TNew): IObservable<TNew>;
67
+ flatten<TNew>(this: IObservable<IObservable<TNew>>): IObservable<TNew>;
68
+ /**
69
+ * ONLY FOR DEBUGGING!
70
+ * Logs computations of this derived.
71
+ */
72
+ log(): IObservableWithChange<T, TChange>;
73
+ /**
74
+ * A human-readable name for debugging purposes.
75
+ */
76
+ readonly debugName: string;
77
+ /**
78
+ * ONLY FOR DEBUGGING!
79
+ */
80
+ debugGetDependencyGraph(): string;
81
+ /**
82
+ * This property captures the type of the change object. Do not use it at runtime!
83
+ */
84
+ readonly TChange: TChange;
85
+ }
86
+ /**
87
+ * Represents an observer that can be subscribed to an observable.
88
+ *
89
+ * If an observer is subscribed to an observable and that observable didn't signal
90
+ * a change through one of the observer methods, the observer can assume that the
91
+ * observable didn't change.
92
+ * If an observable reported a possible change, {@link IObservable.reportChanges} forces
93
+ * the observable to report an actual change if there was one.
94
+ */
95
+ export interface IObserver {
96
+ /**
97
+ * Signals that the given observable might have changed and a transaction potentially modifying that observable started.
98
+ * Before the given observable can call this method again, is must call {@link IObserver.endUpdate}.
99
+ *
100
+ * Implementations must not get/read the value of other observables, as they might not have received this event yet!
101
+ * The method {@link IObservable.reportChanges} can be used to force the observable to report the changes.
102
+ */
103
+ beginUpdate<T>(observable: IObservable<T>): void;
104
+ /**
105
+ * Signals that the transaction that potentially modified the given observable ended.
106
+ * This is a good place to react to (potential) changes.
107
+ */
108
+ endUpdate<T>(observable: IObservable<T>): void;
109
+ /**
110
+ * Signals that the given observable might have changed.
111
+ * The method {@link IObservable.reportChanges} can be used to force the observable to report the changes.
112
+ *
113
+ * Implementations must not get/read the value of other observables, as they might not have received this event yet!
114
+ * The change should be processed lazily or in {@link IObserver.endUpdate}.
115
+ */
116
+ handlePossibleChange<T>(observable: IObservable<T>): void;
117
+ /**
118
+ * Signals that the given {@link observable} changed.
119
+ *
120
+ * Implementations must not get/read the value of other observables, as they might not have received this event yet!
121
+ * The change should be processed lazily or in {@link IObserver.endUpdate}.
122
+ *
123
+ * @param change Indicates how or why the value changed.
124
+ */
125
+ handleChange<T, TChange>(observable: IObservableWithChange<T, TChange>, change: TChange): void;
126
+ }
127
+ export interface IReader {
128
+ /**
129
+ * Reads the value of an observable and subscribes to it.
130
+ */
131
+ readObservable<T>(observable: IObservableWithChange<T, any>): T;
132
+ }
133
+ export interface ISettable<T, TChange = void> {
134
+ /**
135
+ * Sets the value of the observable.
136
+ * Use a transaction to batch multiple changes (with a transaction, observers only react at the end of the transaction).
137
+ *
138
+ * @param transaction When given, value changes are handled on demand or when the transaction ends.
139
+ * @param change Describes how or why the value changed.
140
+ */
141
+ set(value: T, transaction: ITransaction | undefined, change: TChange): void;
142
+ }
143
+ export interface ITransaction {
144
+ /**
145
+ * Calls {@link Observer.beginUpdate} immediately
146
+ * and {@link Observer.endUpdate} when the transaction ends.
147
+ */
148
+ updateObserver(observer: IObserver, observable: IObservableWithChange<any, any>): void;
149
+ }
150
+ /**
151
+ * This function is used to indicate that the caller recovered from an error that indicates a bug.
152
+ */
153
+ export declare function handleBugIndicatingErrorRecovery(message: string): void;
154
+ /**
155
+ * A settable observable.
156
+ */
157
+ export interface ISettableObservable<T, TChange = void> extends IObservableWithChange<T, TChange>, ISettable<T, TChange> {
158
+ }
159
+ export interface IReaderWithStore extends IReader {
160
+ /**
161
+ * Items in this store get disposed just before the observable recomputes/reruns or when it becomes unobserved.
162
+ */
163
+ get store(): DisposableStore;
164
+ /**
165
+ * Items in this store get disposed just after the observable recomputes/reruns or when it becomes unobserved.
166
+ * This is important if the current run needs the undisposed result from the last run.
167
+ *
168
+ * Warning: Items in this store might still get disposed before dependents (that read the now disposed value in the past) are recomputed with the new (undisposed) value!
169
+ * A clean solution for this is ref counting.
170
+ */
171
+ get delayedStore(): DisposableStore;
172
+ }
@@ -0,0 +1,44 @@
1
+ import { IObservableWithChange, IReader } from './base';
2
+ export interface IChangeTracker<TChangeSummary> {
3
+ createChangeSummary(previousChangeSummary: TChangeSummary | undefined): TChangeSummary;
4
+ handleChange(ctx: IChangeContext, change: TChangeSummary): boolean;
5
+ beforeUpdate?(reader: IReader, change: TChangeSummary): void;
6
+ }
7
+ export interface IChangeContext {
8
+ readonly changedObservable: IObservableWithChange<any, any>;
9
+ readonly change: unknown;
10
+ /**
11
+ * Returns if the given observable caused the change.
12
+ */
13
+ didChange<T, TChange>(observable: IObservableWithChange<T, TChange>): this is {
14
+ change: TChange;
15
+ };
16
+ }
17
+ /**
18
+ * Subscribes to and records changes and the last value of the given observables.
19
+ * Don't use the key "changes", as it is reserved for the changes array!
20
+ */
21
+ export declare function recordChanges<TObs extends Record<any, IObservableWithChange<any, any>>>(obs: TObs): IChangeTracker<{
22
+ [TKey in keyof TObs]: ReturnType<TObs[TKey]['get']>;
23
+ } & {
24
+ changes: readonly ({
25
+ [TKey in keyof TObs]: {
26
+ key: TKey;
27
+ change: TObs[TKey]['TChange'];
28
+ };
29
+ }[keyof TObs])[];
30
+ }>;
31
+ /**
32
+ * Subscribes to and records changes and the last value of the given observables.
33
+ * Don't use the key "changes", as it is reserved for the changes array!
34
+ */
35
+ export declare function recordChangesLazy<TObs extends Record<any, IObservableWithChange<any, any>>>(getObs: () => TObs): IChangeTracker<{
36
+ [TKey in keyof TObs]: ReturnType<TObs[TKey]['get']>;
37
+ } & {
38
+ changes: readonly ({
39
+ [TKey in keyof TObs]: {
40
+ key: TKey;
41
+ change: TObs[TKey]['TChange'];
42
+ };
43
+ }[keyof TObs])[];
44
+ }>;
@@ -0,0 +1,24 @@
1
+ export declare class CancellationError extends Error {
2
+ constructor(message?: string);
3
+ }
4
+ export interface CancellationToken {
5
+ readonly isCancellationRequested: boolean;
6
+ readonly onCancellationRequested: (listener: () => void) => {
7
+ dispose: () => void;
8
+ };
9
+ }
10
+ export declare class CancellationTokenSource {
11
+ private _isCancelled;
12
+ private _listeners;
13
+ get token(): CancellationToken;
14
+ cancel(): void;
15
+ dispose(): void;
16
+ }
17
+ /**
18
+ * Creates a CancellationToken that is cancelled when the given disposable is disposed.
19
+ */
20
+ export declare function cancelOnDispose(disposable: {
21
+ add: (d: {
22
+ dispose: () => void;
23
+ }) => void;
24
+ }): CancellationToken;
@@ -0,0 +1,24 @@
1
+ import { IDisposable } from '../../disposables';
2
+ export { DisposableStore, IDisposable } from '../../disposables';
3
+ export declare function markAsDisposed(_obj: any): void;
4
+ export declare function trackDisposable(_obj: any): void;
5
+ export declare function assertFn(_condition: () => boolean): void;
6
+ export declare function toDisposable(fn: () => void): IDisposable;
7
+ export declare class BugIndicatingError extends Error {
8
+ constructor(message?: string);
9
+ }
10
+ export declare function onBugIndicatingError(error: any): void;
11
+ export declare function onUnexpectedError(error: any): void;
12
+ export type EqualityComparer<T> = (a: T, b: T) => boolean;
13
+ /**
14
+ * Compares two items for equality using strict equality.
15
+ */
16
+ export declare const strictEquals: EqualityComparer<any>;
17
+ export interface IValueWithChangeEvent<T> {
18
+ readonly onDidChange: Event<void>;
19
+ get value(): T;
20
+ }
21
+ export interface Event<T> {
22
+ (listener: (e: T) => any, thisArgs?: any): IDisposable;
23
+ }
24
+ export declare function isDefined<T>(arg: T | undefined | null): arg is T;
@@ -0,0 +1,21 @@
1
+ export type DebugLocation = DebugLocationImpl | undefined;
2
+ export declare namespace DebugLocation {
3
+ function enable(): void;
4
+ function ofCaller(): DebugLocation;
5
+ function ofNthCaller(n: number): DebugLocation;
6
+ }
7
+ declare class DebugLocationImpl implements ILocation {
8
+ readonly fileName: string;
9
+ readonly line: number;
10
+ readonly column: number;
11
+ readonly id: string;
12
+ static fromStack(stack: string, parentIdx: number): DebugLocationImpl | undefined;
13
+ constructor(fileName: string, line: number, column: number, id: string);
14
+ }
15
+ export interface ILocation {
16
+ fileName: string;
17
+ line: number;
18
+ column: number;
19
+ id: string;
20
+ }
21
+ export {};
@@ -0,0 +1,33 @@
1
+ export interface IDebugNameData {
2
+ /**
3
+ * The owner object of an observable.
4
+ * Used for debugging only, such as computing a name for the observable by iterating over the fields of the owner.
5
+ */
6
+ readonly owner?: DebugOwner | undefined;
7
+ /**
8
+ * A string or function that returns a string that represents the name of the observable.
9
+ * Used for debugging only.
10
+ */
11
+ readonly debugName?: DebugNameSource | undefined;
12
+ /**
13
+ * A function that points to the defining function of the object.
14
+ * Used for debugging only.
15
+ */
16
+ readonly debugReferenceFn?: Function | undefined;
17
+ }
18
+ export declare class DebugNameData {
19
+ readonly owner: DebugOwner | undefined;
20
+ readonly debugNameSource: DebugNameSource | undefined;
21
+ readonly referenceFn: Function | undefined;
22
+ constructor(owner: DebugOwner | undefined, debugNameSource: DebugNameSource | undefined, referenceFn: Function | undefined);
23
+ getDebugName(target: object): string | undefined;
24
+ }
25
+ /**
26
+ * The owning object of an observable.
27
+ * Is only used for debugging purposes, such as computing a name for the observable by iterating over the fields of the owner.
28
+ */
29
+ export type DebugOwner = object | undefined;
30
+ export type DebugNameSource = string | (() => string | undefined);
31
+ export declare function getDebugName(target: object, data: DebugNameData): string | undefined;
32
+ export declare function getClassName(obj: object): string | undefined;
33
+ export declare function getFunctionName(fn: Function): string | undefined;
@@ -0,0 +1,16 @@
1
+ import { IObservable } from '../base';
2
+ import { DisposableStore } from '../commonFacade/deps';
3
+ /**
4
+ * Wraps an observable so that its source remains observed for a grace period
5
+ * after the wrapping observable loses all its observers.
6
+ *
7
+ * When the wrapping observable has observers, an autorun keeps `obs` observed
8
+ * and forwards changes. When the last observer is removed, `obs` stays observed
9
+ * via `keepObserved` for `maxIdleTimeMs` before being released. If a new observer
10
+ * arrives during the grace period, the keep-alive is cancelled seamlessly.
11
+ *
12
+ * @param store - Controls the hard lifetime; disposing it cancels any pending grace period.
13
+ * @param obs - The source observable to keep alive longer.
14
+ * @param maxIdleTimeMs - Grace period in milliseconds.
15
+ */
16
+ export declare function deferUnobserve<T>(store: DisposableStore, obs: IObservable<T>, maxIdleTimeMs: number): IObservable<T>;
@@ -0,0 +1,37 @@
1
+ import { EqualityComparer } from '../commonFacade/deps';
2
+ import { IObservable, IObservableWithChange, ISettableObservable } from '../base';
3
+ import { IChangeTracker } from '../changeTracker';
4
+ import { DebugOwner } from '../debugName';
5
+ import { IDerivedReader } from '../observables/derivedImpl';
6
+ export interface IReducerOptions<T, TChangeSummary = void, TOutChange = void> {
7
+ /**
8
+ * Is called to create the initial value of the observable when it becomes observed.
9
+ */
10
+ initial: T | (() => T);
11
+ /**
12
+ * Is called to dispose the observable value when it is no longer observed.
13
+ */
14
+ disposeFinal?(value: T): void;
15
+ changeTracker?: IChangeTracker<TChangeSummary>;
16
+ equalityComparer?: EqualityComparer<T>;
17
+ /**
18
+ * Applies the changes to the value.
19
+ * Use `reader.reportChange` to report change details or to report a change if the same value is returned.
20
+ */
21
+ update(reader: IDerivedReader<TOutChange>, previousValue: T, changes: TChangeSummary): T;
22
+ }
23
+ /**
24
+ * Creates an observable value that is based on values and changes from other observables.
25
+ * Additionally, a reducer can report how that state changed.
26
+ */
27
+ export declare function observableReducer<T, TInChanges, TOutChange = void>(owner: DebugOwner, options: IReducerOptions<T, TInChanges, TOutChange>): SimplifyObservableWithChange<T, TOutChange>;
28
+ /**
29
+ * Creates an observable value that is based on values and changes from other observables.
30
+ * Additionally, a reducer can report how that state changed.
31
+ */
32
+ export declare function observableReducerSettable<T, TInChanges, TOutChange = void>(owner: DebugOwner, options: IReducerOptions<T, TInChanges, TOutChange>): ISettableObservable<T, TOutChange>;
33
+ /**
34
+ * Returns IObservable<T> if TChange is void, otherwise IObservableWithChange<T, TChange>
35
+ */
36
+ type SimplifyObservableWithChange<T, TChange> = TChange extends void ? IObservable<T> : IObservableWithChange<T, TChange>;
37
+ export {};
@@ -0,0 +1,15 @@
1
+ import { IObservable, IReader } from '../base';
2
+ import { DebugOwner } from '../debugName';
3
+ /**
4
+ * Creates an observable that has the latest changed value of the given observables.
5
+ * Initially (and when not observed), it has the value of the last observable.
6
+ * When observed and any of the observables change, it has the value of the last changed observable.
7
+ * If multiple observables change in the same transaction, the last observable wins.
8
+ */
9
+ export declare function latestChangedValue<T extends IObservable<any>[]>(owner: DebugOwner, observables: T): IObservable<ReturnType<T[number]['get']>>;
10
+ /**
11
+ * Works like a derived.
12
+ * However, if the value is not undefined, it is cached and will not be recomputed anymore.
13
+ * In that case, the derived will unsubscribe from its dependencies.
14
+ */
15
+ export declare function derivedConstOnceDefined<T>(owner: DebugOwner, fn: (reader: IReader) => T): IObservable<T | undefined>;
@@ -0,0 +1,25 @@
1
+ export { observableValueOpts } from './observables/observableValueOpts';
2
+ export { autorun, autorunDelta, autorunHandleChanges, autorunOpts, autorunWithStore, autorunWithStoreHandleChanges, autorunIterableDelta, autorunSelfDisposable } from './reactions/autorun';
3
+ export { type IObservable, type IObservableWithChange, type IObserver, type IReader, type ISettable, type ISettableObservable, type ITransaction } from './base';
4
+ export { disposableObservableValue } from './observables/observableValue';
5
+ export { derived, derivedDisposable, derivedHandleChanges, derivedOpts, derivedWithSetter, derivedWithStore } from './observables/derived';
6
+ export { type IDerivedReader } from './observables/derivedImpl';
7
+ export { ObservableLazy, ObservableLazyPromise, ObservablePromise, PromiseResult, } from './utils/promise';
8
+ export { derivedWithCancellationToken, waitForState } from './utils/utilsCancellation';
9
+ export { debouncedObservableDeprecated, debouncedObservable, derivedObservableWithCache, derivedObservableWithWritableCache, keepObserved, mapObservableArrayCached, observableFromPromise, recomputeInitiallyAndOnChange, signalFromObservable, wasEventTriggeredRecently, } from './utils/utils';
10
+ export { type DebugOwner } from './debugName';
11
+ export { type IChangeContext, type IChangeTracker, recordChanges, recordChangesLazy } from './changeTracker';
12
+ export { constObservable } from './observables/constObservable';
13
+ export { type IObservableSignal, observableSignal } from './observables/observableSignal';
14
+ export { observableFromEventOpts } from './observables/observableFromEvent';
15
+ export { observableSignalFromEvent } from './observables/observableSignalFromEvent';
16
+ export { asyncTransaction, globalTransaction, subtransaction, transaction, TransactionImpl } from './transaction';
17
+ export { observableFromValueWithChangeEvent, ValueWithChangeEventFromObservable } from './utils/valueWithChangeEvent';
18
+ export { runOnChange, runOnChangeWithCancellationToken, runOnChangeWithStore, type RemoveUndefined } from './utils/runOnChange';
19
+ export { derivedConstOnceDefined, latestChangedValue } from './experimental/utils';
20
+ export { deferUnobserve } from './experimental/deferUnobserve';
21
+ export { observableFromEvent } from './observables/observableFromEvent';
22
+ export { observableValue } from './observables/observableValue';
23
+ export { ObservableSet } from './set';
24
+ export { ObservableMap } from './map';
25
+ export { DebugLocation } from './debugLocation';
@@ -0,0 +1,40 @@
1
+ import { IObservable } from '../base';
2
+ import { TransactionImpl } from '../transaction';
3
+ import { IObservableLogger, IChangeInformation } from './logging';
4
+ import { FromEventObservable } from '../observables/observableFromEvent';
5
+ import { Derived } from '../observables/derivedImpl';
6
+ import { AutorunObserver } from '../reactions/autorunImpl';
7
+ export declare function logObservableToConsole(obs: IObservable<any>): void;
8
+ export declare class ConsoleObservableLogger implements IObservableLogger {
9
+ private indentation;
10
+ private _filteredObjects;
11
+ addFilteredObj(obj: unknown): void;
12
+ private _isIncluded;
13
+ private textToConsoleArgs;
14
+ private formatInfo;
15
+ handleObservableCreated(observable: IObservable<any>): void;
16
+ handleOnListenerCountChanged(observable: IObservable<any>, newCount: number): void;
17
+ handleObservableUpdated(observable: IObservable<unknown>, info: IChangeInformation): void;
18
+ private readonly changedObservablesSets;
19
+ formatChanges(changes: Set<IObservable<any>>): ConsoleText | undefined;
20
+ handleDerivedDependencyChanged(derived: Derived<any>, observable: IObservable<any>, change: unknown): void;
21
+ _handleDerivedRecomputed(derived: Derived<unknown>, info: IChangeInformation): void;
22
+ handleDerivedCleared(derived: Derived<unknown>): void;
23
+ handleFromEventObservableTriggered(observable: FromEventObservable<any, any>, info: IChangeInformation): void;
24
+ handleAutorunCreated(autorun: AutorunObserver): void;
25
+ handleAutorunDisposed(autorun: AutorunObserver): void;
26
+ handleAutorunDependencyChanged(autorun: AutorunObserver, observable: IObservable<any>, change: unknown): void;
27
+ handleAutorunStarted(autorun: AutorunObserver): void;
28
+ handleAutorunFinished(autorun: AutorunObserver): void;
29
+ handleBeginTransaction(transaction: TransactionImpl): void;
30
+ handleEndTransaction(): void;
31
+ }
32
+ type ConsoleText = (ConsoleText | undefined)[] | {
33
+ text: string;
34
+ style: string;
35
+ data?: unknown[];
36
+ } | {
37
+ data: unknown[];
38
+ };
39
+ export declare function formatValue(value: unknown, availableLen: number): string;
40
+ export {};
@@ -0,0 +1,4 @@
1
+ import { IObservable, IObserver } from '../base';
2
+ export declare function debugGetDependencyGraph(obs: IObservable<any> | IObserver, options?: {
3
+ debugNamePostProcessor?: (name: string) => string;
4
+ }): string;
@@ -0,0 +1,4 @@
1
+ import { API, SimpleTypedRpcConnection, MakeSideAsync } from './rpc';
2
+ export declare function registerDebugChannel<T extends {
3
+ channelId: string;
4
+ } & API>(channelId: T['channelId'], createClient: () => T['client']): SimpleTypedRpcConnection<MakeSideAsync<T['host']>>;
@@ -0,0 +1,43 @@
1
+ import { AutorunObserver } from '../../reactions/autorunImpl';
2
+ import { TransactionImpl } from '../../transaction';
3
+ import { IChangeInformation, IObservableLogger } from '../logging';
4
+ import { IObservable } from '../../base';
5
+ import { Derived } from '../../observables/derivedImpl';
6
+ import { DebugLocation } from '../../debugLocation';
7
+ export declare class DevToolsLogger implements IObservableLogger {
8
+ private static _instance;
9
+ static getInstance(): DevToolsLogger;
10
+ private _declarationId;
11
+ private _instanceId;
12
+ private readonly _declarations;
13
+ private readonly _instanceInfos;
14
+ private readonly _aliveInstances;
15
+ private readonly _activeTransactions;
16
+ private readonly _channel;
17
+ private getTransactionState;
18
+ private _getObservableInfo;
19
+ private _getAutorunInfo;
20
+ private _getInfo;
21
+ private _formatObservable;
22
+ private _formatObserver;
23
+ private constructor();
24
+ private _pendingChanges;
25
+ private readonly _changeThrottler;
26
+ private readonly _fullState;
27
+ private _handleChange;
28
+ private readonly _flushUpdates;
29
+ private _getDeclarationId;
30
+ handleObservableCreated(observable: IObservable<any>, location: DebugLocation): void;
31
+ handleOnListenerCountChanged(observable: IObservable<any>, newCount: number): void;
32
+ handleObservableUpdated(observable: IObservable<any>, changeInfo: IChangeInformation): void;
33
+ handleAutorunCreated(autorun: AutorunObserver, location: DebugLocation): void;
34
+ handleAutorunDisposed(autorun: AutorunObserver): void;
35
+ handleAutorunDependencyChanged(autorun: AutorunObserver, observable: IObservable<any>, change: unknown): void;
36
+ handleAutorunStarted(autorun: AutorunObserver): void;
37
+ handleAutorunFinished(autorun: AutorunObserver): void;
38
+ handleDerivedDependencyChanged(derived: Derived<any>, observable: IObservable<any>, change: unknown): void;
39
+ _handleDerivedRecomputed(observable: Derived<any>, changeInfo: IChangeInformation): void;
40
+ handleDerivedCleared(observable: Derived<any>): void;
41
+ handleBeginTransaction(transaction: TransactionImpl): void;
42
+ handleEndTransaction(transaction: TransactionImpl): void;
43
+ }
@@ -0,0 +1,41 @@
1
+ export type ChannelFactory = (handler: IChannelHandler) => IChannel;
2
+ export interface IChannel {
3
+ sendNotification(data: unknown): void;
4
+ sendRequest(data: unknown): Promise<RpcRequestResult>;
5
+ }
6
+ export interface IChannelHandler {
7
+ handleNotification(notificationData: unknown): void;
8
+ handleRequest(requestData: unknown): Promise<RpcRequestResult> | RpcRequestResult;
9
+ }
10
+ export type RpcRequestResult = {
11
+ type: 'result';
12
+ value: unknown;
13
+ } | {
14
+ type: 'error';
15
+ value: unknown;
16
+ };
17
+ export type API = {
18
+ host: Side;
19
+ client: Side;
20
+ };
21
+ export type Side = {
22
+ notifications: Record<string, (...args: any[]) => void>;
23
+ requests: Record<string, (...args: any[]) => Promise<unknown> | unknown>;
24
+ };
25
+ type MakeAsyncIfNot<TFn> = TFn extends (...args: infer TArgs) => infer TResult ? TResult extends Promise<unknown> ? TFn : (...args: TArgs) => Promise<TResult> : never;
26
+ export type MakeSideAsync<T extends Side> = {
27
+ notifications: T['notifications'];
28
+ requests: {
29
+ [K in keyof T['requests']]: MakeAsyncIfNot<T['requests'][K]>;
30
+ };
31
+ };
32
+ export declare class SimpleTypedRpcConnection<T extends Side> {
33
+ private readonly _channelFactory;
34
+ private readonly _getHandler;
35
+ static createHost<T extends API>(channelFactory: ChannelFactory, getHandler: () => T['host']): SimpleTypedRpcConnection<MakeSideAsync<T['client']>>;
36
+ static createClient<T extends API>(channelFactory: ChannelFactory, getHandler: () => T['client']): SimpleTypedRpcConnection<MakeSideAsync<T['host']>>;
37
+ readonly api: T;
38
+ private readonly _channel;
39
+ private constructor();
40
+ }
41
+ export {};