@vscode/markdown-editor 0.0.2-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/dist/commands/cursorCommands.d.ts +13 -0
- package/dist/commands/editCommands.d.ts +14 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/selectionCommands.d.ts +6 -0
- package/dist/commands/types.d.ts +26 -0
- package/dist/core/geometry.d.ts +37 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/lengthEdit.d.ts +38 -0
- package/dist/core/offsetRange.d.ts +26 -0
- package/dist/core/selection.d.ts +13 -0
- package/dist/core/sourceOffset.d.ts +1 -0
- package/dist/core/stringEdit.d.ts +27 -0
- package/dist/core/stringValue.d.ts +8 -0
- package/dist/core/wordUtils.d.ts +6 -0
- package/dist/highlighter/defaultMonacoSyntaxHighlighter.d.ts +20 -0
- package/dist/highlighter/index.d.ts +3 -0
- package/dist/highlighter/monacoSyntaxHighlighter.d.ts +38 -0
- package/dist/highlighter/syntaxHighlighter.d.ts +67 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4274 -0
- package/dist/index.js.map +1 -0
- package/dist/model/cursorNavigation.d.ts +7 -0
- package/dist/model/editorModel.d.ts +54 -0
- package/dist/model/index.d.ts +4 -0
- package/dist/model/measuredLayoutModel.d.ts +50 -0
- package/dist/observables.d.ts +1 -0
- package/dist/observables.js +463 -0
- package/dist/observables.js.map +1 -0
- package/dist/parser/_micromarkAdapter.d.ts +7 -0
- package/dist/parser/ast.d.ts +274 -0
- package/dist/parser/index.d.ts +4 -0
- package/dist/parser/parse.d.ts +2 -0
- package/dist/parser/parser.d.ts +14 -0
- package/dist/parser/reconcile.d.ts +33 -0
- package/dist/parser/test/getAnnotatedSource.d.ts +2 -0
- package/dist/parser/test/snapshot.d.ts +9 -0
- package/dist/parser/visualizeAst.d.ts +33 -0
- package/dist/runOnChange-owE1SMC0.js +1514 -0
- package/dist/runOnChange-owE1SMC0.js.map +1 -0
- package/dist/test/random.d.ts +16 -0
- package/dist/view/content/blockView.d.ts +179 -0
- package/dist/view/content/documentView.d.ts +41 -0
- package/dist/view/content/dom.d.ts +16 -0
- package/dist/view/content/katexEditableIdentifiers.d.ts +36 -0
- package/dist/view/content/viewNode.d.ts +93 -0
- package/dist/view/editorController.d.ts +34 -0
- package/dist/view/editorView.d.ts +100 -0
- package/dist/view/fixture/astViewerView.d.ts +27 -0
- package/dist/view/fixture/cyclingTsHighlighter.d.ts +17 -0
- package/dist/view/fixture/debugColors.d.ts +26 -0
- package/dist/view/fixture/monacoDebugPanel.d.ts +7 -0
- package/dist/view/index.d.ts +9 -0
- package/dist/view/measuredLayoutDebugView.d.ts +70 -0
- package/dist/view/parts/cursorView.d.ts +29 -0
- package/dist/view/parts/selectionView.d.ts +57 -0
- package/dist/view/viewData.d.ts +251 -0
- package/dist/view/visualLineMap.d.ts +157 -0
- package/dist/view/visualizeViewTree.d.ts +5 -0
- package/package.json +68 -0
- package/src/view/editor.css +517 -0
- package/src/view/themes/default.css +235 -0
- package/src/view/themes/github.css +308 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BlockAstNode, DocumentAstNode, ListAstNode } from '../parser/ast.js';
|
|
2
|
+
/**
|
|
3
|
+
* Move the cursor one position left or right, skipping over hidden marker
|
|
4
|
+
* ranges in inactive blocks (and inactive items of an active list).
|
|
5
|
+
*/
|
|
6
|
+
export declare function nextCursorPosition(doc: DocumentAstNode, activeBlock: BlockAstNode | undefined, cursor: number, direction: 'left' | 'right'): number;
|
|
7
|
+
export declare function findActiveListItemIndex(list: ListAstNode, cursorOffset: number): number | undefined;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { StringValue } from '../core/stringValue.js';
|
|
2
|
+
import { StringEdit } from '../core/stringEdit.js';
|
|
3
|
+
import { Selection } from '../core/selection.js';
|
|
4
|
+
import { BlockAstNode, DocumentAstNode } from '../parser/ast.js';
|
|
5
|
+
export declare const NO_ACTIVE_BLOCKS: unique symbol;
|
|
6
|
+
export declare class EditorModel {
|
|
7
|
+
private readonly _parser;
|
|
8
|
+
/**
|
|
9
|
+
* The most recent edit applied to {@link sourceText}, used by
|
|
10
|
+
* {@link document} to let the parser link incrementally edited code
|
|
11
|
+
* blocks. Only trusted when it exactly bridges the previous and current
|
|
12
|
+
* source text (see {@link document}).
|
|
13
|
+
*/
|
|
14
|
+
private _pendingEdit;
|
|
15
|
+
readonly sourceText: import('@vscode/observables').ISettableObservable<StringValue, void>;
|
|
16
|
+
/**
|
|
17
|
+
* The current selection, or `undefined` when the editor has no caret
|
|
18
|
+
* (e.g. an inactive/unfocused rendering).
|
|
19
|
+
*/
|
|
20
|
+
readonly selection: import('@vscode/observables').ISettableObservable<Selection | undefined, void>;
|
|
21
|
+
/**
|
|
22
|
+
* Forces the rendered active-block set. `undefined` (the default)
|
|
23
|
+
* derives the set from the current selection range (see
|
|
24
|
+
* {@link activeBlocks}). The sentinel {@link NO_ACTIVE_BLOCKS} forces
|
|
25
|
+
* "no active block" — useful in fixtures that always want the
|
|
26
|
+
* collapsed/inactive rendering.
|
|
27
|
+
*/
|
|
28
|
+
readonly activeBlocksOverride: import('@vscode/observables').ISettableObservable<readonly BlockAstNode[] | typeof NO_ACTIVE_BLOCKS | undefined, void>;
|
|
29
|
+
readonly cursorOffset: import('@vscode/observables').IObservableWithChange<number | undefined, void>;
|
|
30
|
+
/**
|
|
31
|
+
* The parsed document. Threads the previous document into the parser so
|
|
32
|
+
* unchanged blocks keep their object identity across reparses (see
|
|
33
|
+
* {@link MarkdownParser.parse}). Writing `previous` inside the compute is
|
|
34
|
+
* a safe optimization: `derived` only recomputes when `sourceText`
|
|
35
|
+
* changes, and the result is structurally identical to a full reparse.
|
|
36
|
+
*/
|
|
37
|
+
readonly document: import('@vscode/observables').IObservableWithChange<DocumentAstNode, void>;
|
|
38
|
+
/**
|
|
39
|
+
* Block that contains the cursor (selection's active end). Used by
|
|
40
|
+
* cursor navigation to know which block's marker ranges count as
|
|
41
|
+
* visible. Unaffected by {@link activeBlocksOverride} because
|
|
42
|
+
* navigation is independent of rendering.
|
|
43
|
+
*/
|
|
44
|
+
readonly activeBlock: import('@vscode/observables').IObservableWithChange<BlockAstNode | undefined, void>;
|
|
45
|
+
/**
|
|
46
|
+
* All blocks whose source range intersects the current selection.
|
|
47
|
+
* The rendering side uses this to decide which blocks render in
|
|
48
|
+
* their expanded (markers-visible) form. When the selection is
|
|
49
|
+
* collapsed this is a one-element set holding {@link activeBlock}.
|
|
50
|
+
*/
|
|
51
|
+
readonly activeBlocks: import('@vscode/observables').IObservableWithChange<Set<BlockAstNode>, void>;
|
|
52
|
+
applyEdit(edit: StringEdit): void;
|
|
53
|
+
applyEditForSelection(edit: StringEdit): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { BlockAstNode } from '../parser/ast.js';
|
|
2
|
+
import { ViewNode } from '../view/content/viewNode.js';
|
|
3
|
+
import { VisualLineMap } from '../view/visualLineMap.js';
|
|
4
|
+
/**
|
|
5
|
+
* One block's place in the rendered document.
|
|
6
|
+
*
|
|
7
|
+
* `height` is in CSS pixels. It is either a real DOM measurement
|
|
8
|
+
* (`isMeasured: true`) or an estimate produced when the block is not
|
|
9
|
+
* currently mounted (`isMeasured: false`). Estimates exist so virtual
|
|
10
|
+
* rendering can size the scroll container without mounting every block.
|
|
11
|
+
*
|
|
12
|
+
* `visualLineMap` and `viewNode` are set only when the block is mounted
|
|
13
|
+
* and measured. Cursor positioning, selection painting and up/down
|
|
14
|
+
* navigation read through `visualLineMap`; the debug view walks
|
|
15
|
+
* `viewNode` to enumerate text leaves for per-character introspection.
|
|
16
|
+
* Unmeasured blocks have neither.
|
|
17
|
+
*/
|
|
18
|
+
export interface BlockMeasurement {
|
|
19
|
+
readonly block: BlockAstNode;
|
|
20
|
+
readonly absoluteStart: number;
|
|
21
|
+
readonly height: number;
|
|
22
|
+
readonly isMeasured: boolean;
|
|
23
|
+
readonly visualLineMap: VisualLineMap | undefined;
|
|
24
|
+
readonly viewNode: ViewNode | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The set of measurements/estimates the view has produced for the current
|
|
28
|
+
* document. This is the "view → derived facts about layout" channel: the
|
|
29
|
+
* view writes here as a side effect of rendering and measuring; the
|
|
30
|
+
* controller (and selection/cursor rendering) reads from here.
|
|
31
|
+
*
|
|
32
|
+
* Keeping these facts in their own observable model — instead of as ad-hoc
|
|
33
|
+
* fields on the view — preserves the invariant
|
|
34
|
+
*
|
|
35
|
+
* view(model + Δ) = view(model) + Δ
|
|
36
|
+
*
|
|
37
|
+
* i.e. the view becomes a pure function of (EditorModel, MeasuredLayoutModel).
|
|
38
|
+
* Everything else that depends on layout (controller, commands) goes
|
|
39
|
+
* through this model and never touches view fields directly.
|
|
40
|
+
*/
|
|
41
|
+
export declare class MeasuredLayoutModel {
|
|
42
|
+
readonly measurements: import('@vscode/observables').ISettableObservable<readonly BlockMeasurement[], void>;
|
|
43
|
+
/**
|
|
44
|
+
* Concatenated visual line map across all mounted blocks. Lines are
|
|
45
|
+
* left in DOM (client-coordinate) y order — each per-block map already
|
|
46
|
+
* uses absolute client coordinates from `getClientRects()`, so the
|
|
47
|
+
* concatenation is well-formed without re-sorting.
|
|
48
|
+
*/
|
|
49
|
+
readonly visualLineMap: import('@vscode/observables').IObservableWithChange<VisualLineMap, void>;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@vscode/observables';
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import { B as w, T, g as C, b as u, s as c, O as E, c as v, o as V, d as _, t as g, e as k, a as S, C as O, f as z, h as b, i as W, j as D, k as N, l as P, m as R, n as q, p as L } from "./runOnChange-owE1SMC0.js";
|
|
2
|
+
import { D as de, q as oe, u as ue, v as he, w as le, x as be, y as fe, z as ce, A as ge, E as ve, F as _e, G as pe, H as me, I as Ce, J as Oe, K as ye, L as we, M as Ve, N as Se, P as De, Q as Ue, R as Fe, S as Te, r as Ee, U as ke, V as ze, W as We, X as Ne, Y as Pe } from "./runOnChange-owE1SMC0.js";
|
|
3
|
+
class H extends w {
|
|
4
|
+
get debugName() {
|
|
5
|
+
return this._debugNameData.getDebugName(this) ?? "LazyObservableValue";
|
|
6
|
+
}
|
|
7
|
+
constructor(e, t, s, r) {
|
|
8
|
+
super(r), this._debugNameData = e, this._equalityComparator = s, this._isUpToDate = !0, this._deltas = [], this._updateCounter = 0, this._value = t;
|
|
9
|
+
}
|
|
10
|
+
get() {
|
|
11
|
+
return this._update(), this._value;
|
|
12
|
+
}
|
|
13
|
+
_update() {
|
|
14
|
+
if (!this._isUpToDate)
|
|
15
|
+
if (this._isUpToDate = !0, this._deltas.length > 0) {
|
|
16
|
+
for (const e of this._deltas) {
|
|
17
|
+
C()?.handleObservableUpdated(this, { change: e, didChange: !0, oldValue: "(unknown)", newValue: this._value, hadValue: !0 });
|
|
18
|
+
for (const t of this._observers)
|
|
19
|
+
t.handleChange(this, e);
|
|
20
|
+
}
|
|
21
|
+
this._deltas.length = 0;
|
|
22
|
+
} else {
|
|
23
|
+
C()?.handleObservableUpdated(this, { change: void 0, didChange: !0, oldValue: "(unknown)", newValue: this._value, hadValue: !0 });
|
|
24
|
+
for (const e of this._observers)
|
|
25
|
+
e.handleChange(this, void 0);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
_beginUpdate() {
|
|
29
|
+
if (this._updateCounter++, this._updateCounter === 1)
|
|
30
|
+
for (const e of this._observers)
|
|
31
|
+
e.beginUpdate(this);
|
|
32
|
+
}
|
|
33
|
+
_endUpdate() {
|
|
34
|
+
if (this._updateCounter--, this._updateCounter === 0) {
|
|
35
|
+
this._update();
|
|
36
|
+
const e = [...this._observers];
|
|
37
|
+
for (const t of e)
|
|
38
|
+
t.endUpdate(this);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
addObserver(e) {
|
|
42
|
+
const t = !this._observers.has(e) && this._updateCounter > 0;
|
|
43
|
+
super.addObserver(e), t && e.beginUpdate(this);
|
|
44
|
+
}
|
|
45
|
+
removeObserver(e) {
|
|
46
|
+
const t = this._observers.has(e) && this._updateCounter > 0;
|
|
47
|
+
super.removeObserver(e), t && e.endUpdate(this);
|
|
48
|
+
}
|
|
49
|
+
set(e, t, s) {
|
|
50
|
+
if (s === void 0 && this._equalityComparator(this._value, e))
|
|
51
|
+
return;
|
|
52
|
+
let r;
|
|
53
|
+
t || (t = r = new T(() => {
|
|
54
|
+
}, () => `Setting ${this.debugName}`));
|
|
55
|
+
try {
|
|
56
|
+
if (this._isUpToDate = !1, this._setValue(e), s !== void 0 && this._deltas.push(s), t.updateObserver({
|
|
57
|
+
beginUpdate: () => this._beginUpdate(),
|
|
58
|
+
endUpdate: () => this._endUpdate(),
|
|
59
|
+
handleChange: (n, i) => {
|
|
60
|
+
},
|
|
61
|
+
handlePossibleChange: (n) => {
|
|
62
|
+
}
|
|
63
|
+
}, this), this._updateCounter > 1)
|
|
64
|
+
for (const n of this._observers)
|
|
65
|
+
n.handlePossibleChange(this);
|
|
66
|
+
} finally {
|
|
67
|
+
r && r.finish();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
toString() {
|
|
71
|
+
return `${this.debugName}: ${this._value}`;
|
|
72
|
+
}
|
|
73
|
+
_setValue(e) {
|
|
74
|
+
this._value = e;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function U(a, e, t = v.ofCaller()) {
|
|
78
|
+
return a.lazy ? new H(new u(a.owner, a.debugName, void 0), e, a.equalsFn ?? c, t) : new E(new u(a.owner, a.debugName, void 0), e, a.equalsFn ?? c, t);
|
|
79
|
+
}
|
|
80
|
+
class I {
|
|
81
|
+
/**
|
|
82
|
+
* The cached value.
|
|
83
|
+
* Does not force a computation of the value.
|
|
84
|
+
*/
|
|
85
|
+
get cachedValue() {
|
|
86
|
+
return this._value;
|
|
87
|
+
}
|
|
88
|
+
constructor(e) {
|
|
89
|
+
this._computeValue = e, this._value = V(this, void 0);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Returns the cached value.
|
|
93
|
+
* Computes the value if the value has not been cached yet.
|
|
94
|
+
*/
|
|
95
|
+
getValue() {
|
|
96
|
+
let e = this._value.get();
|
|
97
|
+
return e || (e = this._computeValue(), this._value.set(e, void 0)), e;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
class p {
|
|
101
|
+
static fromFn(e) {
|
|
102
|
+
return new p(e());
|
|
103
|
+
}
|
|
104
|
+
constructor(e) {
|
|
105
|
+
this._value = V(this, void 0), this.promiseResult = this._value, this.resolvedValue = _(this, (t) => {
|
|
106
|
+
const s = this.promiseResult.read(t);
|
|
107
|
+
if (s)
|
|
108
|
+
return s.getDataOrThrow();
|
|
109
|
+
}), this.promise = e.then((t) => (g((s) => {
|
|
110
|
+
this._value.set(new y(t, void 0), s);
|
|
111
|
+
}), t), (t) => {
|
|
112
|
+
throw g((s) => {
|
|
113
|
+
this._value.set(new y(void 0, t), s);
|
|
114
|
+
}), t;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
class y {
|
|
119
|
+
constructor(e, t) {
|
|
120
|
+
this.data = e, this.error = t;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Returns the value if the promise resolved, otherwise throws the error.
|
|
124
|
+
*/
|
|
125
|
+
getDataOrThrow() {
|
|
126
|
+
if (this.error)
|
|
127
|
+
throw this.error;
|
|
128
|
+
return this.data;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
class G {
|
|
132
|
+
constructor(e) {
|
|
133
|
+
this._computePromise = e, this._lazyValue = new I(() => new p(this._computePromise())), this.cachedPromiseResult = _(this, (t) => this._lazyValue.cachedValue.read(t)?.promiseResult.read(t));
|
|
134
|
+
}
|
|
135
|
+
getPromise() {
|
|
136
|
+
return this._lazyValue.getValue().promise;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function J(a, e, t, s) {
|
|
140
|
+
return e || (e = (r) => r != null), new Promise((r, n) => {
|
|
141
|
+
let i = !0, d = !1;
|
|
142
|
+
const f = a.map((o) => ({
|
|
143
|
+
isFinished: e(o),
|
|
144
|
+
error: t ? t(o) : !1,
|
|
145
|
+
state: o
|
|
146
|
+
})), h = S((o) => {
|
|
147
|
+
const { isFinished: F, error: l, state: m } = f.read(o);
|
|
148
|
+
(F || l) && (i ? d = !0 : h.dispose(), l ? n(l === !0 ? m : l) : r(m));
|
|
149
|
+
});
|
|
150
|
+
if (s) {
|
|
151
|
+
const o = s.onCancellationRequested(() => {
|
|
152
|
+
h.dispose(), o.dispose(), n(new O());
|
|
153
|
+
});
|
|
154
|
+
if (s.isCancellationRequested) {
|
|
155
|
+
h.dispose(), o.dispose(), n(new O());
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
i = !1, d && h.dispose();
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function Q(a, e) {
|
|
163
|
+
let t, s;
|
|
164
|
+
e === void 0 ? (t = a, s = void 0) : (s = a, t = e);
|
|
165
|
+
let r;
|
|
166
|
+
return new k(new u(s, void 0, t), (n) => (r && r.dispose(), r = new z(), t(n, r.token)), void 0, () => r?.dispose(), c, v.ofCaller());
|
|
167
|
+
}
|
|
168
|
+
function X(a) {
|
|
169
|
+
return {
|
|
170
|
+
createChangeSummary: (e) => ({
|
|
171
|
+
changes: []
|
|
172
|
+
}),
|
|
173
|
+
handleChange(e, t) {
|
|
174
|
+
for (const s in a)
|
|
175
|
+
e.didChange(a[s]) && t.changes.push({ key: s, change: e.change });
|
|
176
|
+
return !0;
|
|
177
|
+
},
|
|
178
|
+
beforeUpdate(e, t) {
|
|
179
|
+
for (const s in a) {
|
|
180
|
+
if (s === "changes")
|
|
181
|
+
throw new b('property name "changes" is reserved for change tracking');
|
|
182
|
+
t[s] = a[s].read(e);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function Y(a) {
|
|
188
|
+
let e;
|
|
189
|
+
return {
|
|
190
|
+
createChangeSummary: (t) => ({
|
|
191
|
+
changes: []
|
|
192
|
+
}),
|
|
193
|
+
handleChange(t, s) {
|
|
194
|
+
e || (e = a());
|
|
195
|
+
for (const r in e)
|
|
196
|
+
t.didChange(e[r]) && s.changes.push({ key: r, change: t.change });
|
|
197
|
+
return !0;
|
|
198
|
+
},
|
|
199
|
+
beforeUpdate(t, s) {
|
|
200
|
+
e || (e = a());
|
|
201
|
+
for (const r in e) {
|
|
202
|
+
if (r === "changes")
|
|
203
|
+
throw new b('property name "changes" is reserved for change tracking');
|
|
204
|
+
s[r] = e[r].read(t);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function Z(a) {
|
|
210
|
+
return new A(a);
|
|
211
|
+
}
|
|
212
|
+
class A extends W {
|
|
213
|
+
constructor(e) {
|
|
214
|
+
super(), this.value = e;
|
|
215
|
+
}
|
|
216
|
+
get debugName() {
|
|
217
|
+
return this.toString();
|
|
218
|
+
}
|
|
219
|
+
get() {
|
|
220
|
+
return this.value;
|
|
221
|
+
}
|
|
222
|
+
addObserver(e) {
|
|
223
|
+
}
|
|
224
|
+
removeObserver(e) {
|
|
225
|
+
}
|
|
226
|
+
log() {
|
|
227
|
+
return this;
|
|
228
|
+
}
|
|
229
|
+
toString() {
|
|
230
|
+
return `Const: ${this.value}`;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function B(a, e, t = v.ofCaller()) {
|
|
234
|
+
return new M(typeof a == "string" ? a : new u(a, void 0, void 0), e, t);
|
|
235
|
+
}
|
|
236
|
+
class M extends w {
|
|
237
|
+
constructor(e, t, s) {
|
|
238
|
+
super(s), this.event = t, this.handleEvent = () => {
|
|
239
|
+
g((r) => {
|
|
240
|
+
for (const n of this._observers)
|
|
241
|
+
r.updateObserver(n, this), n.handleChange(this, void 0);
|
|
242
|
+
}, () => this.debugName);
|
|
243
|
+
}, this.debugName = typeof e == "string" ? e : e.getDebugName(this) ?? "Observable Signal From Event";
|
|
244
|
+
}
|
|
245
|
+
onFirstObserverAdded() {
|
|
246
|
+
this.subscription = this.event(this.handleEvent);
|
|
247
|
+
}
|
|
248
|
+
onLastObserverRemoved() {
|
|
249
|
+
this.subscription.dispose(), this.subscription = void 0;
|
|
250
|
+
}
|
|
251
|
+
get() {
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function $(a) {
|
|
255
|
+
return (e) => {
|
|
256
|
+
let t = !0;
|
|
257
|
+
return S((s) => {
|
|
258
|
+
a.read(s), t ? t = !1 : e();
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
class x {
|
|
263
|
+
constructor(e) {
|
|
264
|
+
this.observable = e;
|
|
265
|
+
}
|
|
266
|
+
get onDidChange() {
|
|
267
|
+
return $(this.observable);
|
|
268
|
+
}
|
|
269
|
+
get value() {
|
|
270
|
+
return this.observable.get();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function j(a, e) {
|
|
274
|
+
return e instanceof x ? e.observable : D(a, e.onDidChange, () => e.value);
|
|
275
|
+
}
|
|
276
|
+
function ee(a, e) {
|
|
277
|
+
if (e.length === 0)
|
|
278
|
+
throw new b();
|
|
279
|
+
let t = !1, s;
|
|
280
|
+
const r = D(a, (n) => {
|
|
281
|
+
const i = new P();
|
|
282
|
+
for (const d of e)
|
|
283
|
+
i.add(R({ debugName: () => q(r, new u(a, void 0, void 0)) + ".updateLastChangedValue" }, (f) => {
|
|
284
|
+
t = !0, s = d.read(f), n();
|
|
285
|
+
}));
|
|
286
|
+
return i.add({
|
|
287
|
+
dispose() {
|
|
288
|
+
t = !1, s = void 0;
|
|
289
|
+
}
|
|
290
|
+
}), i;
|
|
291
|
+
}, () => t ? s : e[e.length - 1].get());
|
|
292
|
+
return r;
|
|
293
|
+
}
|
|
294
|
+
function te(a, e) {
|
|
295
|
+
return N(a, (t, s) => s ?? e(t));
|
|
296
|
+
}
|
|
297
|
+
function se(a, e, t) {
|
|
298
|
+
let s, r, n = !1;
|
|
299
|
+
const i = B("deferUnobserve", (d) => {
|
|
300
|
+
if (n)
|
|
301
|
+
throw new b("deferUnobserve: Cannot add observer after disposal");
|
|
302
|
+
return r !== void 0 && (clearTimeout(r), r = void 0), s || (s = L(e)), {
|
|
303
|
+
dispose() {
|
|
304
|
+
r = setTimeout(() => {
|
|
305
|
+
r = void 0, s?.dispose(), s = void 0;
|
|
306
|
+
}, t);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
});
|
|
310
|
+
return a.add({
|
|
311
|
+
dispose() {
|
|
312
|
+
r !== void 0 && (clearTimeout(r), r = void 0), s?.dispose(), s = void 0, n = !0;
|
|
313
|
+
}
|
|
314
|
+
}), _((d) => (i.read(d), e.read(d)));
|
|
315
|
+
}
|
|
316
|
+
class ae {
|
|
317
|
+
constructor() {
|
|
318
|
+
this._data = /* @__PURE__ */ new Set(), this._obs = U({ equalsFn: () => !1 }, this), this.observable = this._obs;
|
|
319
|
+
}
|
|
320
|
+
get size() {
|
|
321
|
+
return this._data.size;
|
|
322
|
+
}
|
|
323
|
+
has(e) {
|
|
324
|
+
return this._data.has(e);
|
|
325
|
+
}
|
|
326
|
+
add(e, t) {
|
|
327
|
+
return this._data.has(e) || (this._data.add(e), this._obs.set(this, t)), this;
|
|
328
|
+
}
|
|
329
|
+
delete(e, t) {
|
|
330
|
+
const s = this._data.delete(e);
|
|
331
|
+
return s && this._obs.set(this, t), s;
|
|
332
|
+
}
|
|
333
|
+
clear(e) {
|
|
334
|
+
this._data.size > 0 && (this._data.clear(), this._obs.set(this, e));
|
|
335
|
+
}
|
|
336
|
+
forEach(e, t) {
|
|
337
|
+
this._data.forEach((s, r, n) => {
|
|
338
|
+
e.call(t, s, r, this);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
*entries() {
|
|
342
|
+
for (const e of this._data)
|
|
343
|
+
yield [e, e];
|
|
344
|
+
}
|
|
345
|
+
*keys() {
|
|
346
|
+
yield* this._data.keys();
|
|
347
|
+
}
|
|
348
|
+
*values() {
|
|
349
|
+
yield* this._data.values();
|
|
350
|
+
}
|
|
351
|
+
[Symbol.iterator]() {
|
|
352
|
+
return this.values();
|
|
353
|
+
}
|
|
354
|
+
get [Symbol.toStringTag]() {
|
|
355
|
+
return "ObservableSet";
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
class re {
|
|
359
|
+
constructor() {
|
|
360
|
+
this._data = /* @__PURE__ */ new Map(), this._obs = U({ equalsFn: () => !1 }, this), this.observable = this._obs;
|
|
361
|
+
}
|
|
362
|
+
get size() {
|
|
363
|
+
return this._data.size;
|
|
364
|
+
}
|
|
365
|
+
has(e) {
|
|
366
|
+
return this._data.has(e);
|
|
367
|
+
}
|
|
368
|
+
get(e) {
|
|
369
|
+
return this._data.get(e);
|
|
370
|
+
}
|
|
371
|
+
set(e, t, s) {
|
|
372
|
+
const r = this._data.has(e), n = this._data.get(e);
|
|
373
|
+
return (!r || n !== t) && (this._data.set(e, t), this._obs.set(this, s)), this;
|
|
374
|
+
}
|
|
375
|
+
delete(e, t) {
|
|
376
|
+
const s = this._data.delete(e);
|
|
377
|
+
return s && this._obs.set(this, t), s;
|
|
378
|
+
}
|
|
379
|
+
clear(e) {
|
|
380
|
+
this._data.size > 0 && (this._data.clear(), this._obs.set(this, e));
|
|
381
|
+
}
|
|
382
|
+
forEach(e, t) {
|
|
383
|
+
this._data.forEach((s, r, n) => {
|
|
384
|
+
e.call(t, s, r, this);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
*entries() {
|
|
388
|
+
yield* this._data.entries();
|
|
389
|
+
}
|
|
390
|
+
*keys() {
|
|
391
|
+
yield* this._data.keys();
|
|
392
|
+
}
|
|
393
|
+
*values() {
|
|
394
|
+
yield* this._data.values();
|
|
395
|
+
}
|
|
396
|
+
[Symbol.iterator]() {
|
|
397
|
+
return this.entries();
|
|
398
|
+
}
|
|
399
|
+
get [Symbol.toStringTag]() {
|
|
400
|
+
return "ObservableMap";
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
export {
|
|
404
|
+
v as DebugLocation,
|
|
405
|
+
de as Disposable,
|
|
406
|
+
P as DisposableStore,
|
|
407
|
+
I as ObservableLazy,
|
|
408
|
+
G as ObservableLazyPromise,
|
|
409
|
+
re as ObservableMap,
|
|
410
|
+
p as ObservablePromise,
|
|
411
|
+
ae as ObservableSet,
|
|
412
|
+
y as PromiseResult,
|
|
413
|
+
T as TransactionImpl,
|
|
414
|
+
x as ValueWithChangeEventFromObservable,
|
|
415
|
+
oe as asyncTransaction,
|
|
416
|
+
S as autorun,
|
|
417
|
+
ue as autorunDelta,
|
|
418
|
+
he as autorunHandleChanges,
|
|
419
|
+
le as autorunIterableDelta,
|
|
420
|
+
R as autorunOpts,
|
|
421
|
+
be as autorunSelfDisposable,
|
|
422
|
+
fe as autorunWithStore,
|
|
423
|
+
ce as autorunWithStoreHandleChanges,
|
|
424
|
+
Z as constObservable,
|
|
425
|
+
ge as debouncedObservable,
|
|
426
|
+
ve as debouncedObservableDeprecated,
|
|
427
|
+
se as deferUnobserve,
|
|
428
|
+
_ as derived,
|
|
429
|
+
te as derivedConstOnceDefined,
|
|
430
|
+
_e as derivedDisposable,
|
|
431
|
+
pe as derivedHandleChanges,
|
|
432
|
+
N as derivedObservableWithCache,
|
|
433
|
+
me as derivedObservableWithWritableCache,
|
|
434
|
+
Ce as derivedOpts,
|
|
435
|
+
Q as derivedWithCancellationToken,
|
|
436
|
+
Oe as derivedWithSetter,
|
|
437
|
+
ye as derivedWithStore,
|
|
438
|
+
we as disposableObservableValue,
|
|
439
|
+
Ve as globalTransaction,
|
|
440
|
+
L as keepObserved,
|
|
441
|
+
ee as latestChangedValue,
|
|
442
|
+
Se as mapObservableArrayCached,
|
|
443
|
+
D as observableFromEvent,
|
|
444
|
+
De as observableFromEventOpts,
|
|
445
|
+
Ue as observableFromPromise,
|
|
446
|
+
j as observableFromValueWithChangeEvent,
|
|
447
|
+
Fe as observableSignal,
|
|
448
|
+
B as observableSignalFromEvent,
|
|
449
|
+
V as observableValue,
|
|
450
|
+
U as observableValueOpts,
|
|
451
|
+
Te as recomputeInitiallyAndOnChange,
|
|
452
|
+
X as recordChanges,
|
|
453
|
+
Y as recordChangesLazy,
|
|
454
|
+
Ee as runOnChange,
|
|
455
|
+
ke as runOnChangeWithCancellationToken,
|
|
456
|
+
ze as runOnChangeWithStore,
|
|
457
|
+
We as signalFromObservable,
|
|
458
|
+
Ne as subtransaction,
|
|
459
|
+
g as transaction,
|
|
460
|
+
J as waitForState,
|
|
461
|
+
Pe as wasEventTriggeredRecently
|
|
462
|
+
};
|
|
463
|
+
//# sourceMappingURL=observables.js.map
|