@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.
Files changed (62) hide show
  1. package/dist/commands/cursorCommands.d.ts +13 -0
  2. package/dist/commands/editCommands.d.ts +14 -0
  3. package/dist/commands/index.d.ts +4 -0
  4. package/dist/commands/selectionCommands.d.ts +6 -0
  5. package/dist/commands/types.d.ts +26 -0
  6. package/dist/core/geometry.d.ts +37 -0
  7. package/dist/core/index.d.ts +8 -0
  8. package/dist/core/lengthEdit.d.ts +38 -0
  9. package/dist/core/offsetRange.d.ts +26 -0
  10. package/dist/core/selection.d.ts +13 -0
  11. package/dist/core/sourceOffset.d.ts +1 -0
  12. package/dist/core/stringEdit.d.ts +27 -0
  13. package/dist/core/stringValue.d.ts +8 -0
  14. package/dist/core/wordUtils.d.ts +6 -0
  15. package/dist/highlighter/defaultMonacoSyntaxHighlighter.d.ts +20 -0
  16. package/dist/highlighter/index.d.ts +3 -0
  17. package/dist/highlighter/monacoSyntaxHighlighter.d.ts +38 -0
  18. package/dist/highlighter/syntaxHighlighter.d.ts +67 -0
  19. package/dist/index.d.ts +6 -0
  20. package/dist/index.js +4274 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/model/cursorNavigation.d.ts +7 -0
  23. package/dist/model/editorModel.d.ts +54 -0
  24. package/dist/model/index.d.ts +4 -0
  25. package/dist/model/measuredLayoutModel.d.ts +50 -0
  26. package/dist/observables.d.ts +1 -0
  27. package/dist/observables.js +463 -0
  28. package/dist/observables.js.map +1 -0
  29. package/dist/parser/_micromarkAdapter.d.ts +7 -0
  30. package/dist/parser/ast.d.ts +274 -0
  31. package/dist/parser/index.d.ts +4 -0
  32. package/dist/parser/parse.d.ts +2 -0
  33. package/dist/parser/parser.d.ts +14 -0
  34. package/dist/parser/reconcile.d.ts +33 -0
  35. package/dist/parser/test/getAnnotatedSource.d.ts +2 -0
  36. package/dist/parser/test/snapshot.d.ts +9 -0
  37. package/dist/parser/visualizeAst.d.ts +33 -0
  38. package/dist/runOnChange-owE1SMC0.js +1514 -0
  39. package/dist/runOnChange-owE1SMC0.js.map +1 -0
  40. package/dist/test/random.d.ts +16 -0
  41. package/dist/view/content/blockView.d.ts +179 -0
  42. package/dist/view/content/documentView.d.ts +41 -0
  43. package/dist/view/content/dom.d.ts +16 -0
  44. package/dist/view/content/katexEditableIdentifiers.d.ts +36 -0
  45. package/dist/view/content/viewNode.d.ts +93 -0
  46. package/dist/view/editorController.d.ts +34 -0
  47. package/dist/view/editorView.d.ts +100 -0
  48. package/dist/view/fixture/astViewerView.d.ts +27 -0
  49. package/dist/view/fixture/cyclingTsHighlighter.d.ts +17 -0
  50. package/dist/view/fixture/debugColors.d.ts +26 -0
  51. package/dist/view/fixture/monacoDebugPanel.d.ts +7 -0
  52. package/dist/view/index.d.ts +9 -0
  53. package/dist/view/measuredLayoutDebugView.d.ts +70 -0
  54. package/dist/view/parts/cursorView.d.ts +29 -0
  55. package/dist/view/parts/selectionView.d.ts +57 -0
  56. package/dist/view/viewData.d.ts +251 -0
  57. package/dist/view/visualLineMap.d.ts +157 -0
  58. package/dist/view/visualizeViewTree.d.ts +5 -0
  59. package/package.json +68 -0
  60. package/src/view/editor.css +517 -0
  61. package/src/view/themes/default.css +235 -0
  62. package/src/view/themes/github.css +308 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observables.js","sources":["../../../external/vscode-observables/observables/dist/observableInternal/observables/lazyObservableValue.js","../../../external/vscode-observables/observables/dist/observableInternal/observables/observableValueOpts.js","../../../external/vscode-observables/observables/dist/observableInternal/utils/promise.js","../../../external/vscode-observables/observables/dist/observableInternal/utils/utilsCancellation.js","../../../external/vscode-observables/observables/dist/observableInternal/changeTracker.js","../../../external/vscode-observables/observables/dist/observableInternal/observables/constObservable.js","../../../external/vscode-observables/observables/dist/observableInternal/observables/observableSignalFromEvent.js","../../../external/vscode-observables/observables/dist/observableInternal/utils/valueWithChangeEvent.js","../../../external/vscode-observables/observables/dist/observableInternal/experimental/utils.js","../../../external/vscode-observables/observables/dist/observableInternal/experimental/deferUnobserve.js","../../../external/vscode-observables/observables/dist/observableInternal/set.js","../../../external/vscode-observables/observables/dist/observableInternal/map.js"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { TransactionImpl } from '../transaction.js';\nimport { getLogger } from '../logging/logging.js';\nimport { BaseObservable } from './baseObservable.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Holds off updating observers until the value is actually read.\n*/\nclass LazyObservableValue extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? 'LazyObservableValue';\n }\n constructor(_debugNameData, initialValue, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._equalityComparator = _equalityComparator;\n this._isUpToDate = true;\n this._deltas = [];\n this._updateCounter = 0;\n this._value = initialValue;\n }\n get() {\n this._update();\n return this._value;\n }\n _update() {\n if (this._isUpToDate) {\n return;\n }\n this._isUpToDate = true;\n if (this._deltas.length > 0) {\n for (const change of this._deltas) {\n getLogger()?.handleObservableUpdated(this, { change, didChange: true, oldValue: '(unknown)', newValue: this._value, hadValue: true });\n for (const observer of this._observers) {\n observer.handleChange(this, change);\n }\n }\n this._deltas.length = 0;\n }\n else {\n getLogger()?.handleObservableUpdated(this, { change: undefined, didChange: true, oldValue: '(unknown)', newValue: this._value, hadValue: true });\n for (const observer of this._observers) {\n observer.handleChange(this, undefined);\n }\n }\n }\n _beginUpdate() {\n this._updateCounter++;\n if (this._updateCounter === 1) {\n for (const observer of this._observers) {\n observer.beginUpdate(this);\n }\n }\n }\n _endUpdate() {\n this._updateCounter--;\n if (this._updateCounter === 0) {\n this._update();\n // End update could change the observer list.\n const observers = [...this._observers];\n for (const r of observers) {\n r.endUpdate(this);\n }\n }\n }\n addObserver(observer) {\n const shouldCallBeginUpdate = !this._observers.has(observer) && this._updateCounter > 0;\n super.addObserver(observer);\n if (shouldCallBeginUpdate) {\n observer.beginUpdate(this);\n }\n }\n removeObserver(observer) {\n const shouldCallEndUpdate = this._observers.has(observer) && this._updateCounter > 0;\n super.removeObserver(observer);\n if (shouldCallEndUpdate) {\n // Calling end update after removing the observer makes sure endUpdate cannot be called twice here.\n observer.endUpdate(this);\n }\n }\n set(value, tx, change) {\n if (change === undefined && this._equalityComparator(this._value, value)) {\n return;\n }\n let _tx;\n if (!tx) {\n tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`);\n }\n try {\n this._isUpToDate = false;\n this._setValue(value);\n if (change !== undefined) {\n this._deltas.push(change);\n }\n tx.updateObserver({\n beginUpdate: () => this._beginUpdate(),\n endUpdate: () => this._endUpdate(),\n handleChange: (observable, change) => { },\n handlePossibleChange: (observable) => { },\n }, this);\n if (this._updateCounter > 1) {\n // We already started begin/end update, so we need to manually call handlePossibleChange\n for (const observer of this._observers) {\n observer.handlePossibleChange(this);\n }\n }\n }\n finally {\n if (_tx) {\n _tx.finish();\n }\n }\n }\n toString() {\n return `${this.debugName}: ${this._value}`;\n }\n _setValue(newValue) {\n this._value = newValue;\n }\n}\n\nexport { LazyObservableValue };\n//# sourceMappingURL=lazyObservableValue.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DebugNameData } from '../debugName.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { ObservableValue } from './observableValue.js';\nimport { LazyObservableValue } from './lazyObservableValue.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableValueOpts(options, initialValue, debugLocation = DebugLocation.ofCaller()) {\n if (options.lazy) {\n return new LazyObservableValue(new DebugNameData(options.owner, options.debugName, undefined), initialValue, options.equalsFn ?? strictEquals, debugLocation);\n }\n return new ObservableValue(new DebugNameData(options.owner, options.debugName, undefined), initialValue, options.equalsFn ?? strictEquals, debugLocation);\n}\n\nexport { observableValueOpts };\n//# sourceMappingURL=observableValueOpts.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { transaction } from '../transaction.js';\nimport { derived } from '../observables/derived.js';\nimport { observableValue } from '../observables/observableValue.js';\n\nclass ObservableLazy {\n /**\n * The cached value.\n * Does not force a computation of the value.\n */\n get cachedValue() { return this._value; }\n constructor(_computeValue) {\n this._computeValue = _computeValue;\n this._value = observableValue(this, undefined);\n }\n /**\n * Returns the cached value.\n * Computes the value if the value has not been cached yet.\n */\n getValue() {\n let v = this._value.get();\n if (!v) {\n v = this._computeValue();\n this._value.set(v, undefined);\n }\n return v;\n }\n}\n/**\n * A promise whose state is observable.\n */\nclass ObservablePromise {\n static fromFn(fn) {\n return new ObservablePromise(fn());\n }\n constructor(promise) {\n this._value = observableValue(this, undefined);\n /**\n * The current state of the promise.\n * Is `undefined` if the promise didn't resolve yet.\n */\n this.promiseResult = this._value;\n this.resolvedValue = derived(this, reader => {\n const result = this.promiseResult.read(reader);\n if (!result) {\n return undefined;\n }\n return result.getDataOrThrow();\n });\n this.promise = promise.then(value => {\n transaction(tx => {\n /** @description onPromiseResolved */\n this._value.set(new PromiseResult(value, undefined), tx);\n });\n return value;\n }, error => {\n transaction(tx => {\n /** @description onPromiseRejected */\n this._value.set(new PromiseResult(undefined, error), tx);\n });\n throw error;\n });\n }\n}\nclass PromiseResult {\n constructor(\n /**\n * The value of the resolved promise.\n * Undefined if the promise rejected.\n */\n data, \n /**\n * The error in case of a rejected promise.\n * Undefined if the promise resolved.\n */\n error) {\n this.data = data;\n this.error = error;\n }\n /**\n * Returns the value if the promise resolved, otherwise throws the error.\n */\n getDataOrThrow() {\n if (this.error) {\n throw this.error;\n }\n return this.data;\n }\n}\n/**\n * A lazy promise whose state is observable.\n */\nclass ObservableLazyPromise {\n constructor(_computePromise) {\n this._computePromise = _computePromise;\n this._lazyValue = new ObservableLazy(() => new ObservablePromise(this._computePromise()));\n /**\n * Does not enforce evaluation of the promise compute function.\n * Is undefined if the promise has not been computed yet.\n */\n this.cachedPromiseResult = derived(this, reader => this._lazyValue.cachedValue.read(reader)?.promiseResult.read(reader));\n }\n getPromise() {\n return this._lazyValue.getValue().promise;\n }\n}\n\nexport { ObservableLazy, ObservableLazyPromise, ObservablePromise, PromiseResult };\n//# sourceMappingURL=promise.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DebugNameData } from '../debugName.js';\nimport { CancellationError, CancellationTokenSource } from '../commonFacade/cancellation.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { autorun } from '../reactions/autorun.js';\nimport { Derived } from '../observables/derivedImpl.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction waitForState(observable, predicate, isError, cancellationToken) {\n if (!predicate) {\n predicate = state => state !== null && state !== undefined;\n }\n return new Promise((resolve, reject) => {\n let isImmediateRun = true;\n let shouldDispose = false;\n const stateObs = observable.map(state => {\n /** @description waitForState.state */\n return {\n isFinished: predicate(state),\n error: isError ? isError(state) : false,\n state\n };\n });\n const d = autorun(reader => {\n /** @description waitForState */\n const { isFinished, error, state } = stateObs.read(reader);\n if (isFinished || error) {\n if (isImmediateRun) {\n // The variable `d` is not initialized yet\n shouldDispose = true;\n }\n else {\n d.dispose();\n }\n if (error) {\n reject(error === true ? state : error);\n }\n else {\n resolve(state);\n }\n }\n });\n if (cancellationToken) {\n const dc = cancellationToken.onCancellationRequested(() => {\n d.dispose();\n dc.dispose();\n reject(new CancellationError());\n });\n if (cancellationToken.isCancellationRequested) {\n d.dispose();\n dc.dispose();\n reject(new CancellationError());\n return;\n }\n }\n isImmediateRun = false;\n if (shouldDispose) {\n d.dispose();\n }\n });\n}\nfunction derivedWithCancellationToken(computeFnOrOwner, computeFnOrUndefined) {\n let computeFn;\n let owner;\n if (computeFnOrUndefined === undefined) {\n computeFn = computeFnOrOwner;\n owner = undefined;\n }\n else {\n owner = computeFnOrOwner;\n computeFn = computeFnOrUndefined;\n }\n let cancellationTokenSource = undefined;\n return new Derived(new DebugNameData(owner, undefined, computeFn), r => {\n if (cancellationTokenSource) {\n cancellationTokenSource.dispose();\n }\n cancellationTokenSource = new CancellationTokenSource();\n return computeFn(r, cancellationTokenSource.token);\n }, undefined, () => cancellationTokenSource?.dispose(), strictEquals, DebugLocation.ofCaller());\n}\n\nexport { derivedWithCancellationToken, waitForState };\n//# sourceMappingURL=utilsCancellation.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from './commonFacade/deps.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Subscribes to and records changes and the last value of the given observables.\n * Don't use the key \"changes\", as it is reserved for the changes array!\n*/\nfunction recordChanges(obs) {\n return {\n createChangeSummary: (_previousChangeSummary) => {\n return {\n changes: [],\n };\n },\n handleChange(ctx, changeSummary) {\n for (const key in obs) {\n if (ctx.didChange(obs[key])) {\n changeSummary.changes.push({ key, change: ctx.change });\n }\n }\n return true;\n },\n beforeUpdate(reader, changeSummary) {\n for (const key in obs) {\n if (key === 'changes') {\n throw new BugIndicatingError('property name \"changes\" is reserved for change tracking');\n }\n changeSummary[key] = obs[key].read(reader);\n }\n }\n };\n}\n/**\n * Subscribes to and records changes and the last value of the given observables.\n * Don't use the key \"changes\", as it is reserved for the changes array!\n*/\nfunction recordChangesLazy(getObs) {\n let obs = undefined;\n return {\n createChangeSummary: (_previousChangeSummary) => {\n return {\n changes: [],\n };\n },\n handleChange(ctx, changeSummary) {\n if (!obs) {\n obs = getObs();\n }\n for (const key in obs) {\n if (ctx.didChange(obs[key])) {\n changeSummary.changes.push({ key, change: ctx.change });\n }\n }\n return true;\n },\n beforeUpdate(reader, changeSummary) {\n if (!obs) {\n obs = getObs();\n }\n for (const key in obs) {\n if (key === 'changes') {\n throw new BugIndicatingError('property name \"changes\" is reserved for change tracking');\n }\n changeSummary[key] = obs[key].read(reader);\n }\n }\n };\n}\n\nexport { recordChanges, recordChangesLazy };\n//# sourceMappingURL=changeTracker.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { ConvenientObservable } from './baseObservable.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Represents an efficient observable whose value never changes.\n */\nfunction constObservable(value) {\n return new ConstObservable(value);\n}\nclass ConstObservable extends ConvenientObservable {\n constructor(value) {\n super();\n this.value = value;\n }\n get debugName() {\n return this.toString();\n }\n get() {\n return this.value;\n }\n addObserver(observer) {\n // NO OP\n }\n removeObserver(observer) {\n // NO OP\n }\n log() {\n return this;\n }\n toString() {\n return `Const: ${this.value}`;\n }\n}\n\nexport { constObservable };\n//# sourceMappingURL=constObservable.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { transaction } from '../transaction.js';\nimport { DebugNameData } from '../debugName.js';\nimport { BaseObservable } from './baseObservable.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableSignalFromEvent(owner, event, debugLocation = DebugLocation.ofCaller()) {\n return new FromEventObservableSignal(typeof owner === 'string' ? owner : new DebugNameData(owner, undefined, undefined), event, debugLocation);\n}\nclass FromEventObservableSignal extends BaseObservable {\n constructor(debugNameDataOrName, event, debugLocation) {\n super(debugLocation);\n this.event = event;\n this.handleEvent = () => {\n transaction((tx) => {\n for (const o of this._observers) {\n tx.updateObserver(o, this);\n o.handleChange(this, undefined);\n }\n }, () => this.debugName);\n };\n this.debugName = typeof debugNameDataOrName === 'string'\n ? debugNameDataOrName\n : debugNameDataOrName.getDebugName(this) ?? 'Observable Signal From Event';\n }\n onFirstObserverAdded() {\n this.subscription = this.event(this.handleEvent);\n }\n onLastObserverRemoved() {\n this.subscription.dispose();\n this.subscription = undefined;\n }\n get() {\n // NO OP\n }\n}\n\nexport { observableSignalFromEvent };\n//# sourceMappingURL=observableSignalFromEvent.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { observableFromEvent } from '../observables/observableFromEvent.js';\nimport { autorun } from '../reactions/autorun.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Creates an Event from an observable that fires whenever the observable changes.\n */\nfunction eventFromObservable(observable) {\n return (listener) => {\n let isFirst = true;\n return autorun(reader => {\n observable.read(reader);\n if (isFirst) {\n isFirst = false;\n }\n else {\n listener();\n }\n });\n };\n}\nclass ValueWithChangeEventFromObservable {\n constructor(observable) {\n this.observable = observable;\n }\n get onDidChange() {\n return eventFromObservable(this.observable);\n }\n get value() {\n return this.observable.get();\n }\n}\nfunction observableFromValueWithChangeEvent(owner, value) {\n if (value instanceof ValueWithChangeEventFromObservable) {\n return value.observable;\n }\n return observableFromEvent(owner, value.onDidChange, () => value.value);\n}\n\nexport { ValueWithChangeEventFromObservable, observableFromValueWithChangeEvent };\n//# sourceMappingURL=valueWithChangeEvent.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../commonFacade/deps.js';\nimport { getDebugName, DebugNameData } from '../debugName.js';\nimport { observableFromEvent } from '../observables/observableFromEvent.js';\nimport { autorunOpts } from '../reactions/autorun.js';\nimport { derivedObservableWithCache } from '../utils/utils.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Creates an observable that has the latest changed value of the given observables.\n * Initially (and when not observed), it has the value of the last observable.\n * When observed and any of the observables change, it has the value of the last changed observable.\n * If multiple observables change in the same transaction, the last observable wins.\n*/\nfunction latestChangedValue(owner, observables) {\n if (observables.length === 0) {\n throw new BugIndicatingError();\n }\n let hasLastChangedValue = false;\n let lastChangedValue = undefined;\n const result = observableFromEvent(owner, cb => {\n const store = new DisposableStore();\n for (const o of observables) {\n store.add(autorunOpts({ debugName: () => getDebugName(result, new DebugNameData(owner, undefined, undefined)) + '.updateLastChangedValue' }, reader => {\n hasLastChangedValue = true;\n lastChangedValue = o.read(reader);\n cb();\n }));\n }\n store.add({\n dispose() {\n hasLastChangedValue = false;\n lastChangedValue = undefined;\n },\n });\n return store;\n }, () => {\n if (hasLastChangedValue) {\n return lastChangedValue;\n }\n else {\n return observables[observables.length - 1].get();\n }\n });\n return result;\n}\n/**\n * Works like a derived.\n * However, if the value is not undefined, it is cached and will not be recomputed anymore.\n * In that case, the derived will unsubscribe from its dependencies.\n*/\nfunction derivedConstOnceDefined(owner, fn) {\n return derivedObservableWithCache(owner, (reader, lastValue) => lastValue ?? fn(reader));\n}\n\nexport { derivedConstOnceDefined, latestChangedValue };\n//# sourceMappingURL=utils.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BugIndicatingError } from '../commonFacade/deps.js';\nimport { derived } from '../observables/derived.js';\nimport { observableSignalFromEvent } from '../observables/observableSignalFromEvent.js';\nimport { keepObserved } from '../utils/utils.js';\n\n/**\n * Wraps an observable so that its source remains observed for a grace period\n * after the wrapping observable loses all its observers.\n *\n * When the wrapping observable has observers, an autorun keeps `obs` observed\n * and forwards changes. When the last observer is removed, `obs` stays observed\n * via `keepObserved` for `maxIdleTimeMs` before being released. If a new observer\n * arrives during the grace period, the keep-alive is cancelled seamlessly.\n *\n * @param store - Controls the hard lifetime; disposing it cancels any pending grace period.\n * @param obs - The source observable to keep alive longer.\n * @param maxIdleTimeMs - Grace period in milliseconds.\n */\nfunction deferUnobserve(store, obs, maxIdleTimeMs) {\n let keepAliveHandle;\n let timeoutHandle;\n let disposed = false;\n const lifetimeTracker = observableSignalFromEvent('deferUnobserve', _ => {\n if (disposed) {\n throw new BugIndicatingError('deferUnobserve: Cannot add observer after disposal');\n }\n // First observer added to `lifetimeTracker`\n if (timeoutHandle !== undefined) {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n if (!keepAliveHandle) {\n keepAliveHandle = keepObserved(obs);\n }\n return {\n dispose() {\n // Keep source observed during the grace period\t\n timeoutHandle = setTimeout(() => {\n timeoutHandle = undefined;\n keepAliveHandle?.dispose();\n keepAliveHandle = undefined;\n }, maxIdleTimeMs);\n },\n };\n });\n store.add({\n dispose() {\n if (timeoutHandle !== undefined) {\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n keepAliveHandle?.dispose();\n keepAliveHandle = undefined;\n disposed = true;\n },\n });\n return derived(reader => {\n lifetimeTracker.read(reader);\n return obs.read(reader);\n });\n}\n\nexport { deferUnobserve };\n//# sourceMappingURL=deferUnobserve.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { observableValueOpts } from './observables/observableValueOpts.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass ObservableSet {\n constructor() {\n this._data = new Set();\n this._obs = observableValueOpts({ equalsFn: () => false }, this);\n this.observable = this._obs;\n }\n get size() {\n return this._data.size;\n }\n has(value) {\n return this._data.has(value);\n }\n add(value, tx) {\n const hadValue = this._data.has(value);\n if (!hadValue) {\n this._data.add(value);\n this._obs.set(this, tx);\n }\n return this;\n }\n delete(value, tx) {\n const result = this._data.delete(value);\n if (result) {\n this._obs.set(this, tx);\n }\n return result;\n }\n clear(tx) {\n if (this._data.size > 0) {\n this._data.clear();\n this._obs.set(this, tx);\n }\n }\n forEach(callbackfn, thisArg) {\n this._data.forEach((value, value2, _set) => {\n callbackfn.call(thisArg, value, value2, this);\n });\n }\n *entries() {\n for (const value of this._data) {\n yield [value, value];\n }\n }\n *keys() {\n yield* this._data.keys();\n }\n *values() {\n yield* this._data.values();\n }\n [Symbol.iterator]() {\n return this.values();\n }\n get [Symbol.toStringTag]() {\n return 'ObservableSet';\n }\n}\n\nexport { ObservableSet };\n//# sourceMappingURL=set.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { observableValueOpts } from './observables/observableValueOpts.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass ObservableMap {\n constructor() {\n this._data = new Map();\n this._obs = observableValueOpts({ equalsFn: () => false }, this);\n this.observable = this._obs;\n }\n get size() {\n return this._data.size;\n }\n has(key) {\n return this._data.has(key);\n }\n get(key) {\n return this._data.get(key);\n }\n set(key, value, tx) {\n const hadKey = this._data.has(key);\n const oldValue = this._data.get(key);\n if (!hadKey || oldValue !== value) {\n this._data.set(key, value);\n this._obs.set(this, tx);\n }\n return this;\n }\n delete(key, tx) {\n const result = this._data.delete(key);\n if (result) {\n this._obs.set(this, tx);\n }\n return result;\n }\n clear(tx) {\n if (this._data.size > 0) {\n this._data.clear();\n this._obs.set(this, tx);\n }\n }\n forEach(callbackfn, thisArg) {\n this._data.forEach((value, key, _map) => {\n callbackfn.call(thisArg, value, key, this);\n });\n }\n *entries() {\n yield* this._data.entries();\n }\n *keys() {\n yield* this._data.keys();\n }\n *values() {\n yield* this._data.values();\n }\n [Symbol.iterator]() {\n return this.entries();\n }\n get [Symbol.toStringTag]() {\n return 'ObservableMap';\n }\n}\n\nexport { ObservableMap };\n//# sourceMappingURL=map.js.map\n"],"names":["LazyObservableValue","BaseObservable","_debugNameData","initialValue","_equalityComparator","debugLocation","change","getLogger","observer","observers","r","shouldCallBeginUpdate","shouldCallEndUpdate","value","tx","_tx","TransactionImpl","observable","newValue","observableValueOpts","options","DebugLocation","DebugNameData","strictEquals","ObservableValue","ObservableLazy","_computeValue","observableValue","v","ObservablePromise","fn","promise","derived","reader","result","transaction","PromiseResult","error","data","ObservableLazyPromise","_computePromise","waitForState","predicate","isError","cancellationToken","state","resolve","reject","isImmediateRun","shouldDispose","stateObs","d","autorun","isFinished","dc","CancellationError","derivedWithCancellationToken","computeFnOrOwner","computeFnOrUndefined","computeFn","owner","cancellationTokenSource","Derived","CancellationTokenSource","recordChanges","obs","_previousChangeSummary","ctx","changeSummary","key","BugIndicatingError","recordChangesLazy","getObs","constObservable","ConstObservable","ConvenientObservable","observableSignalFromEvent","event","FromEventObservableSignal","debugNameDataOrName","o","eventFromObservable","listener","isFirst","ValueWithChangeEventFromObservable","observableFromValueWithChangeEvent","observableFromEvent","latestChangedValue","observables","hasLastChangedValue","lastChangedValue","cb","store","DisposableStore","autorunOpts","getDebugName","derivedConstOnceDefined","derivedObservableWithCache","lastValue","deferUnobserve","maxIdleTimeMs","keepAliveHandle","timeoutHandle","disposed","lifetimeTracker","_","keepObserved","ObservableSet","callbackfn","thisArg","value2","_set","ObservableMap","hadKey","oldValue","_map"],"mappings":";;AAeA,MAAMA,UAA4BC,EAAe;AAAA,EAC7C,IAAI,YAAY;AACZ,WAAO,KAAK,eAAe,aAAa,IAAI,KAAK;AAAA,EACrD;AAAA,EACA,YAAYC,GAAgBC,GAAcC,GAAqBC,GAAe;AAC1E,UAAMA,CAAa,GACnB,KAAK,iBAAiBH,GACtB,KAAK,sBAAsBE,GAC3B,KAAK,cAAc,IACnB,KAAK,UAAU,CAAA,GACf,KAAK,iBAAiB,GACtB,KAAK,SAASD;AAAA,EAClB;AAAA,EACA,MAAM;AACF,gBAAK,QAAO,GACL,KAAK;AAAA,EAChB;AAAA,EACA,UAAU;AACN,QAAI,MAAK;AAIT,UADA,KAAK,cAAc,IACf,KAAK,QAAQ,SAAS,GAAG;AACzB,mBAAWG,KAAU,KAAK,SAAS;AAC/B,UAAAC,EAAS,GAAI,wBAAwB,MAAM,EAAE,QAAAD,GAAQ,WAAW,IAAM,UAAU,aAAa,UAAU,KAAK,QAAQ,UAAU,G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AAAA,EACA,IAAIA,GAAK;AACL,WAAO,KAAK,MAAM,IAAIA,CAAG;AAAA,EAC7B;AAAA,EACA,IAAIA,GAAKxD,GAAOC,GAAI;AAChB,UAAMmG,IAAS,KAAK,MAAM,IAAI5C,CAAG,GAC3B6C,IAAW,KAAK,MAAM,IAAI7C,CAAG;AACnC,YAAI,CAAC4C,KAAUC,MAAarG,OACxB,KAAK,MAAM,IAAIwD,GAAKxD,CAAK,GACzB,KAAK,KAAK,IAAI,MAAMC,CAAE,IAEnB;AAAA,EACX;AAAA,EACA,OAAOuD,GAAKvD,GAAI;AACZ,UAAMoB,IAAS,KAAK,MAAM,OAAOmC,CAAG;AACpC,WAAInC,KACA,KAAK,KAAK,IAAI,MAAMpB,CAAE,GAEnBoB;AAAA,EACX;AAAA,EACA,MAAMpB,GAAI;AACN,IAAI,KAAK,MAAM,OAAO,MAClB,KAAK,MAAM,MAAK,GAChB,KAAK,KAAK,IAAI,MAAMA,CAAE;AAAA,EAE9B;AAAA,EACA,QAAQ8F,GAAYC,GAAS;AACzB,SAAK,MAAM,QAAQ,CAAChG,GAAOwD,GAAK8C,MAAS;AACrC,MAAAP,EAAW,KAAKC,GAAShG,GAAOwD,GAAK,IAAI;AAAA,IAC7C,CAAC;AAAA,EACL;AAAA,EACA,CAAC,UAAU;AACP,WAAO,KAAK,MAAM,QAAO;AAAA,EAC7B;AAAA,EACA,CAAC,OAAO;AACJ,WAAO,KAAK,MAAM,KAAI;AAAA,EAC1B;AAAA,EACA,CAAC,SAAS;AACN,WAAO,KAAK,MAAM,OAAM;AAAA,EAC5B;AAAA,EACA,CAAC,OAAO,QAAQ,IAAI;AAChB,WAAO,KAAK,QAAO;AAAA,EACvB;AAAA,EACA,KAAK,OAAO,WAAW,IAAI;AACvB,WAAO;AAAA,EACX;AACJ;"}
@@ -0,0 +1,7 @@
1
+ export interface MicromarkEvent {
2
+ readonly type: 'enter' | 'exit';
3
+ readonly tokenType: string;
4
+ readonly startOffset: number;
5
+ readonly endOffset: number;
6
+ }
7
+ export declare function tokenize(source: string): MicromarkEvent[];
@@ -0,0 +1,274 @@
1
+ import { OffsetRange } from '../core/offsetRange.js';
2
+ import { StringEdit } from '../core/stringEdit.js';
3
+ export declare function _resetNodeIds(): void;
4
+ export declare abstract class AstNode {
5
+ abstract readonly kind: string;
6
+ abstract get children(): readonly AstNode[];
7
+ /**
8
+ * A stable identity. Every node has one: it is minted on construction and
9
+ * carried across edits by reconciliation, so a node that survives an edit
10
+ * (even with changed content) keeps the same id.
11
+ */
12
+ readonly id: number;
13
+ /** Rebuild this node with each child replaced by `map.get(child) ?? child`. */
14
+ abstract mapChildren(map: ReadonlyMap<AstNode, AstNode>): AstNode;
15
+ private _length;
16
+ get length(): number;
17
+ /**
18
+ * True when `other` has the same content. Containers compare children *by
19
+ * identity* (`===`): bottom-up reconciliation substitutes reused old
20
+ * instances into the fresh tree first, so equal children already share
21
+ * instances — keeping this O(children), not O(subtree). Leaves have no
22
+ * children, so {@link _localEquals} is their whole comparison.
23
+ */
24
+ structurallyEqual(other: AstNode): boolean;
25
+ /** Compares only this node's own scalar fields (kind/length already match). */
26
+ protected _localEquals(_other: this): boolean;
27
+ /**
28
+ * A copy of this node that adopts `id`. Reconciliation uses this to carry an
29
+ * old identity onto a node whose content changed. Nodes are immutable value
30
+ * holders, so a shallow prototype copy with `id` overridden is sound.
31
+ */
32
+ cloneWithId(id: number): this;
33
+ }
34
+ declare abstract class LeafAstNode extends AstNode {
35
+ abstract readonly content: string;
36
+ get children(): readonly AstNode[];
37
+ get length(): number;
38
+ mapChildren(): AstNode;
39
+ }
40
+ /** Real document text (an {@link InlineAstNode}). */
41
+ export declare class TextAstNode extends LeafAstNode {
42
+ readonly content: string;
43
+ readonly kind = "text";
44
+ constructor(content: string);
45
+ protected _localEquals(o: this): boolean;
46
+ }
47
+ /** A semantic syntax marker (heading `#`, fences, brackets, list bullet, …). */
48
+ export declare class MarkerAstNode extends LeafAstNode {
49
+ readonly markerKind: string;
50
+ readonly content: string;
51
+ readonly kind = "marker";
52
+ constructor(markerKind: string, content: string);
53
+ protected _localEquals(o: this): boolean;
54
+ }
55
+ /** Non-semantic syntactic glue: whitespace, padding, table pipes. */
56
+ export declare class GlueAstNode extends LeafAstNode {
57
+ readonly content: string;
58
+ readonly glueKind?: string | undefined;
59
+ readonly kind = "glue";
60
+ constructor(content: string, glueKind?: string | undefined);
61
+ protected _localEquals(o: this): boolean;
62
+ }
63
+ export declare class ThematicBreakAstNode extends AstNode {
64
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
65
+ readonly kind = "thematicBreak";
66
+ constructor(content: readonly (MarkerAstNode | GlueAstNode)[]);
67
+ get children(): readonly AstNode[];
68
+ get marker(): MarkerAstNode | undefined;
69
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
70
+ }
71
+ export type InlineAstNode = TextAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode;
72
+ export declare class StrongAstNode extends AstNode {
73
+ readonly openMarker: MarkerAstNode;
74
+ readonly content: readonly (InlineAstNode | GlueAstNode)[];
75
+ readonly closeMarker: MarkerAstNode;
76
+ readonly kind = "strong";
77
+ constructor(openMarker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], closeMarker: MarkerAstNode);
78
+ get children(): readonly AstNode[];
79
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
80
+ }
81
+ export declare class EmphasisAstNode extends AstNode {
82
+ readonly openMarker: MarkerAstNode;
83
+ readonly content: readonly (InlineAstNode | GlueAstNode)[];
84
+ readonly closeMarker: MarkerAstNode;
85
+ readonly kind = "emphasis";
86
+ constructor(openMarker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], closeMarker: MarkerAstNode);
87
+ get children(): readonly AstNode[];
88
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
89
+ }
90
+ export declare class StrikethroughAstNode extends AstNode {
91
+ readonly openMarker: MarkerAstNode;
92
+ readonly content: readonly (InlineAstNode | GlueAstNode)[];
93
+ readonly closeMarker: MarkerAstNode;
94
+ readonly kind = "strikethrough";
95
+ constructor(openMarker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[], closeMarker: MarkerAstNode);
96
+ get children(): readonly AstNode[];
97
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
98
+ }
99
+ export declare class InlineCodeAstNode extends AstNode {
100
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
101
+ readonly kind = "inlineCode";
102
+ constructor(content: readonly (MarkerAstNode | GlueAstNode)[]);
103
+ get children(): readonly AstNode[];
104
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
105
+ }
106
+ export declare class InlineMathAstNode extends AstNode {
107
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
108
+ readonly kind = "inlineMath";
109
+ constructor(content: readonly (MarkerAstNode | GlueAstNode)[]);
110
+ get children(): readonly AstNode[];
111
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
112
+ }
113
+ export declare class LinkAstNode extends AstNode {
114
+ readonly url: string;
115
+ readonly content: readonly (MarkerAstNode | InlineAstNode | GlueAstNode)[];
116
+ readonly kind = "link";
117
+ constructor(url: string, content: readonly (MarkerAstNode | InlineAstNode | GlueAstNode)[]);
118
+ get children(): readonly AstNode[];
119
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
120
+ protected _localEquals(o: this): boolean;
121
+ }
122
+ export declare class ImageAstNode extends AstNode {
123
+ readonly alt: string;
124
+ readonly url: string;
125
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
126
+ readonly kind = "image";
127
+ constructor(alt: string, url: string, content: readonly (MarkerAstNode | GlueAstNode)[]);
128
+ get children(): readonly AstNode[];
129
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
130
+ protected _localEquals(o: this): boolean;
131
+ }
132
+ export type BlockAstNode = HeadingAstNode | ParagraphAstNode | CodeBlockAstNode | MathBlockAstNode | ThematicBreakAstNode | BlockQuoteAstNode | ListAstNode | TableAstNode;
133
+ export declare class HeadingAstNode extends AstNode {
134
+ readonly level: 1 | 2 | 3 | 4 | 5 | 6;
135
+ readonly marker: MarkerAstNode;
136
+ readonly content: readonly (InlineAstNode | GlueAstNode)[];
137
+ readonly kind = "heading";
138
+ constructor(level: 1 | 2 | 3 | 4 | 5 | 6, marker: MarkerAstNode, content: readonly (InlineAstNode | GlueAstNode)[]);
139
+ get children(): readonly AstNode[];
140
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
141
+ protected _localEquals(o: this): boolean;
142
+ }
143
+ export declare class ParagraphAstNode extends AstNode {
144
+ readonly content: readonly (InlineAstNode | GlueAstNode)[];
145
+ readonly kind = "paragraph";
146
+ constructor(content: readonly (InlineAstNode | GlueAstNode)[]);
147
+ get children(): readonly AstNode[];
148
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
149
+ }
150
+ export declare class CodeBlockAstNode extends AstNode {
151
+ readonly language: string;
152
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
153
+ readonly kind = "codeBlock";
154
+ private _previous?;
155
+ private _contentEdit?;
156
+ constructor(language: string, content: readonly (MarkerAstNode | GlueAstNode)[]);
157
+ get children(): readonly AstNode[];
158
+ get openFence(): MarkerAstNode | undefined;
159
+ get closeFence(): MarkerAstNode | undefined;
160
+ get code(): MarkerAstNode | undefined;
161
+ /** Relative start offset of the {@link code} marker within this block. */
162
+ get codeOffset(): number;
163
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
164
+ protected _localEquals(o: this): boolean;
165
+ /**
166
+ * A copy of this block carrying an incremental link to `previous`:
167
+ * `contentEdit` (in the block's *content* coordinates) turns `previous`'s
168
+ * content into this one. Uses a weak reference so the previous tree can be
169
+ * garbage-collected.
170
+ */
171
+ withCodeDiff(previous: CodeBlockAstNode, contentEdit: StringEdit): CodeBlockAstNode;
172
+ /**
173
+ * When this block was incrementally derived from `previous` (same
174
+ * fences/language, edit entirely within the content), returns the
175
+ * content-coordinate edit; otherwise `undefined`.
176
+ */
177
+ getDiff(previous: CodeBlockAstNode): CodeBlockDiff | undefined;
178
+ }
179
+ /**
180
+ * Describes how a {@link CodeBlockAstNode} was incrementally derived from a previous
181
+ * one: {@link stringEdit} (in the block's *content* coordinates) turns the
182
+ * previous content into this one.
183
+ */
184
+ export interface CodeBlockDiff {
185
+ readonly stringEdit: StringEdit;
186
+ }
187
+ export declare class MathBlockAstNode extends AstNode {
188
+ readonly content: readonly (MarkerAstNode | GlueAstNode)[];
189
+ readonly kind = "mathBlock";
190
+ constructor(content: readonly (MarkerAstNode | GlueAstNode)[]);
191
+ get children(): readonly AstNode[];
192
+ get code(): MarkerAstNode | undefined;
193
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
194
+ }
195
+ export declare class BlockQuoteAstNode extends AstNode {
196
+ readonly content: readonly (MarkerAstNode | BlockAstNode | GlueAstNode)[];
197
+ readonly kind = "blockQuote";
198
+ constructor(content: readonly (MarkerAstNode | BlockAstNode | GlueAstNode)[]);
199
+ get children(): readonly AstNode[];
200
+ get blocks(): readonly BlockAstNode[];
201
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
202
+ }
203
+ export declare class ListAstNode extends AstNode {
204
+ readonly ordered: boolean;
205
+ readonly content: readonly (ListItemAstNode | GlueAstNode)[];
206
+ readonly kind = "list";
207
+ constructor(ordered: boolean, content: readonly (ListItemAstNode | GlueAstNode)[]);
208
+ get children(): readonly AstNode[];
209
+ get items(): readonly ListItemAstNode[];
210
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
211
+ protected _localEquals(o: this): boolean;
212
+ }
213
+ export declare class ListItemAstNode extends AstNode {
214
+ readonly marker: MarkerAstNode;
215
+ readonly content: readonly (BlockAstNode | GlueAstNode)[];
216
+ readonly checked?: boolean | undefined;
217
+ readonly leadingTrivia?: GlueAstNode | undefined;
218
+ readonly kind = "listItem";
219
+ constructor(marker: MarkerAstNode, content: readonly (BlockAstNode | GlueAstNode)[], checked?: boolean | undefined, leadingTrivia?: GlueAstNode | undefined);
220
+ get children(): readonly AstNode[];
221
+ get blocks(): readonly BlockAstNode[];
222
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
223
+ protected _localEquals(o: this): boolean;
224
+ }
225
+ export declare class TableAstNode extends AstNode {
226
+ readonly content: readonly (TableRowAstNode | GlueAstNode)[];
227
+ readonly kind = "table";
228
+ constructor(content: readonly (TableRowAstNode | GlueAstNode)[]);
229
+ get children(): readonly AstNode[];
230
+ private get _rows();
231
+ get headerRow(): TableRowAstNode | undefined;
232
+ get delimiterRow(): TableRowAstNode | undefined;
233
+ get bodyRows(): readonly TableRowAstNode[];
234
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
235
+ }
236
+ export declare class TableRowAstNode extends AstNode {
237
+ readonly content: readonly (TableCellAstNode | GlueAstNode)[];
238
+ readonly kind = "tableRow";
239
+ constructor(content: readonly (TableCellAstNode | GlueAstNode)[]);
240
+ get children(): readonly AstNode[];
241
+ get cells(): readonly TableCellAstNode[];
242
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
243
+ }
244
+ export declare class TableCellAstNode extends AstNode {
245
+ readonly content: readonly (InlineAstNode | MarkerAstNode | GlueAstNode)[];
246
+ readonly kind = "tableCell";
247
+ constructor(content: readonly (InlineAstNode | MarkerAstNode | GlueAstNode)[]);
248
+ get children(): readonly AstNode[];
249
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
250
+ }
251
+ export declare class DocumentAstNode extends AstNode {
252
+ readonly content: readonly (BlockAstNode | GlueAstNode)[];
253
+ readonly kind = "document";
254
+ constructor(content: readonly (BlockAstNode | GlueAstNode)[]);
255
+ get children(): readonly AstNode[];
256
+ get blocks(): readonly BlockAstNode[];
257
+ mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
258
+ }
259
+ /** Every concrete node kind, for exhaustive consumer-side dispatch. */
260
+ export type AnyAstNode = TextAstNode | MarkerAstNode | GlueAstNode | ThematicBreakAstNode | StrongAstNode | EmphasisAstNode | StrikethroughAstNode | InlineCodeAstNode | InlineMathAstNode | LinkAstNode | ImageAstNode | HeadingAstNode | ParagraphAstNode | CodeBlockAstNode | MathBlockAstNode | BlockQuoteAstNode | ListAstNode | ListItemAstNode | TableAstNode | TableRowAstNode | TableCellAstNode | DocumentAstNode;
261
+ /**
262
+ * Source offset (relative to `root`) of the node with `target`'s id, or
263
+ * `undefined` when it is not in the tree. Ids are stable across edits, so this
264
+ * locates a node even after reconciliation has rebuilt the tree around it.
265
+ */
266
+ export declare function findNodeOffsetById(root: AstNode, target: AstNode): number | undefined;
267
+ /**
268
+ * Source range (relative to `item`) of a task list item's `[x]`/`[ ]`
269
+ * checkbox, or `undefined` when the item is not a task item. The checkbox is
270
+ * plain glue in the AST, so a host that wants to toggle it locates the literal
271
+ * `[x]`/`[ ]` token here.
272
+ */
273
+ export declare function taskCheckboxRange(item: ListItemAstNode): OffsetRange | undefined;
274
+ export {};
@@ -0,0 +1,4 @@
1
+ export { MarkdownParser } from './parser.js';
2
+ export { getAnnotatedSource } from './test/getAnnotatedSource.js';
3
+ export { visualizeAst, type AstVisualization } from './visualizeAst.js';
4
+ export { BlockQuoteAstNode, CodeBlockAstNode, DocumentAstNode, EmphasisAstNode, GlueAstNode, HeadingAstNode, ImageAstNode, InlineCodeAstNode, InlineMathAstNode, LinkAstNode, ListAstNode, ListItemAstNode, MarkerAstNode, MathBlockAstNode, AstNode, findNodeOffsetById, taskCheckboxRange, ParagraphAstNode, StrikethroughAstNode, StrongAstNode, TableAstNode, TableCellAstNode, TableRowAstNode, TextAstNode, ThematicBreakAstNode, type AnyAstNode, type BlockAstNode, type InlineAstNode, } from './ast.js';
@@ -0,0 +1,2 @@
1
+ import { DocumentAstNode } from './ast.js';
2
+ export declare function parse(source: string): DocumentAstNode;
@@ -0,0 +1,14 @@
1
+ import { StringValue } from '../core/stringValue.js';
2
+ import { StringEdit } from '../core/stringEdit.js';
3
+ import { DocumentAstNode } from './ast.js';
4
+ /**
5
+ * Parses markdown into a {@link DocumentAstNode}.
6
+ *
7
+ * When given the `previous` document and the `edit` that produced the new
8
+ * text, it reuses unchanged subtrees and carries node identities across the
9
+ * edit (see {@link parseIncremental}), so views can diff cheaply and code
10
+ * blocks keep their incremental highlighting sessions.
11
+ */
12
+ export declare class MarkdownParser {
13
+ parse(text: StringValue, previous?: DocumentAstNode, edit?: StringEdit): DocumentAstNode;
14
+ }
@@ -0,0 +1,33 @@
1
+ import { OffsetRange } from '../core/offsetRange.js';
2
+ import { StringEdit } from '../core/stringEdit.js';
3
+ import { DocumentAstNode, AstNode } from './ast.js';
4
+ /** Maps offsets/ranges from modified (new) coordinates back to original (previous). */
5
+ export declare class EditMapper {
6
+ private readonly _edit;
7
+ constructor(_edit: StringEdit);
8
+ /**
9
+ * The original range corresponding to `mod`, or `undefined` if `mod`
10
+ * overlaps any replaced/inserted text (i.e. is not provably unchanged).
11
+ */
12
+ getOriginalRange(mod: OffsetRange): OffsetRange | undefined;
13
+ /** The original offset for `mod`, or `undefined` if it falls inside inserted text. */
14
+ getOriginalOffset(mod: number): number | undefined;
15
+ }
16
+ /** Indexes the previous tree for O(1) lookup by exact range or by stable id. */
17
+ export declare class OldTreeIndex {
18
+ private readonly _byRange;
19
+ private readonly _byId;
20
+ constructor(root: AstNode);
21
+ private _walk;
22
+ /** The old node spanning exactly `range` with the given `kind`, if any. */
23
+ lookupExact(range: OffsetRange, kind: string): AstNode | undefined;
24
+ /** The old node that began at `originalStart` with the given `kind`. */
25
+ lookupId(originalStart: number, kind: string): AstNode | undefined;
26
+ }
27
+ export declare function reconcile(fresh: AstNode, previous: AstNode, edit: StringEdit): AstNode;
28
+ /**
29
+ * Parses `text`; when `previous` and `edit` are given, reconciles the fresh
30
+ * tree against `previous` so unchanged subtrees keep their old instances and
31
+ * edited id-bearing nodes keep their old ids.
32
+ */
33
+ export declare function parseIncremental(text: string, previous?: DocumentAstNode, edit?: StringEdit): DocumentAstNode;
@@ -0,0 +1,2 @@
1
+ import { AstNode } from '../ast.js';
2
+ export declare function getAnnotatedSource(node: AstNode, source: string, offset?: number): string;
@@ -0,0 +1,9 @@
1
+ import { DocumentAstNode, AstNode } from '../ast.js';
2
+ /** Assigns a small stable number to each distinct object instance, in first-seen order. */
3
+ export declare class InstanceIds {
4
+ private readonly _map;
5
+ private _next;
6
+ get(n: AstNode): number;
7
+ }
8
+ export declare function snapshot(root: AstNode, ids: InstanceIds): string;
9
+ export declare function snapshotDoc(doc: DocumentAstNode, ids: InstanceIds): string;
@@ -0,0 +1,33 @@
1
+ import { AstNode } from './ast.js';
2
+ export interface AstVisualizationNode {
3
+ label: string;
4
+ range: [start: number, endExclusive: number];
5
+ children?: AstVisualizationNode[];
6
+ }
7
+ export interface AstVisualization {
8
+ $fileExtension: 'ast.w';
9
+ source: string;
10
+ root: AstVisualizationNode;
11
+ }
12
+ /**
13
+ * Globally-stable per-object-instance id, assigned in first-seen order across
14
+ * every visualization (AST, view-data, view-node). A single registry — not one
15
+ * per tree — is the whole point: the same object always renders the same `#N`,
16
+ * so you can correlate instances across the different trees and across edits.
17
+ */
18
+ export declare function objectInstanceId(n: object): number;
19
+ export declare function visualizeAst(root: AstNode, source: string): AstVisualization;
20
+ /**
21
+ * Adapts the raw micromark token stream into the same `ast.w` visualization
22
+ * payload, as a flat list (no nesting): one child per event, in document order.
23
+ * This is the input the {@link visualizeAst} tree is built from, so showing both
24
+ * side by side makes the parser's tokens → AST step inspectable.
25
+ *
26
+ * Both `enter` and `exit` events are emitted — the open/close structure is the
27
+ * one piece of micromark's information that is NOT derivable from a flat list of
28
+ * ranges (tokens can share a range, and ranges alone don't disambiguate nesting
29
+ * order). Everything else a token carries is here too: its type, its
30
+ * `[start, end)` range, and the source slice that range covers (so the length,
31
+ * which the AST view derives, is visible directly).
32
+ */
33
+ export declare function visualizeTokens(source: string): AstVisualization;