@typbase/codemirror 0.3.1 → 0.3.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.
package/dist/index.d.mts CHANGED
@@ -20,7 +20,7 @@ export interface NotebookCell {
20
20
  }
21
21
  /** Per-cell state the host owns: run counters and visibility. */
22
22
  export interface NotebookCellState {
23
- /** Execution counter shown as `[n]`; undefined until the cell is run. */
23
+ /** Execution counter shown as `[n]`. Undefined until the cell is run. */
24
24
  count?: number;
25
25
  /** Output hidden until the next run. */
26
26
  cleared?: boolean;
@@ -47,7 +47,7 @@ export interface NotebookCompileResult {
47
47
  diagnostics: TypstDiagnostic[];
48
48
  }
49
49
  export interface NotebookOptions {
50
- /** Cells for a document text; the host reads them from the engine. */
50
+ /** Cells for a document text. The host reads them from the engine. */
51
51
  cells: (text: string) => NotebookCell[];
52
52
  /** Run/visibility state per cell index. */
53
53
  state?: (index: number) => NotebookCellState | undefined;
@@ -58,7 +58,7 @@ export interface NotebookOptions {
58
58
  onCells?: (cells: NotebookCell[]) => void;
59
59
  /** Fires when the cursor moves to a different cell. */
60
60
  onActiveCell?: (index: number | null) => void;
61
- /** Fires after every compile that ran; `run` carries the requested cell. */
61
+ /** Fires after every compile that ran. `run` carries the requested cell. */
62
62
  onRun?: (index: number | "all") => void;
63
63
  /** Fires after a compile with the fresh frames and diagnostics. */
64
64
  onCompile?: (result: NotebookCompileResult) => void;
@@ -79,7 +79,7 @@ export declare const notebookRunEffect: import("@codemirror/state").StateEffectT
79
79
  /** First position that belongs to the cell (marker line, or content). */
80
80
  export declare function cellStart(cell: NotebookCell): number;
81
81
  export declare function hasMarker(cell: NotebookCell): boolean;
82
- /** Index of the cell containing `pos`; gaps belong to the cell above. */
82
+ /** Index of the cell containing `pos`. Gaps belong to the cell above. */
83
83
  export declare function cellIndexAt(cells: NotebookCell[], pos: number): number;
84
84
  export declare function cellsOf(state: EditorState): NotebookCell[];
85
85
  /** The marker line for a cell type. Markup is the unlabeled default. */
@@ -106,7 +106,7 @@ export declare function setCellTypeText(text: string, cells: NotebookCell[], ind
106
106
  * convention.
107
107
  */
108
108
  export declare function stripCellMarkers(text: string): string;
109
- /** Compiles and reports through `onRun`; does not move the cursor. */
109
+ /** Compiles and reports through `onRun`, but does not move the cursor. */
110
110
  export declare function runCell(view: EditorView, index: number): boolean;
111
111
  export declare function runAllCells(view: EditorView): boolean;
112
112
  export declare function focusCell(view: EditorView, index: number, edge?: "start" | "end"): boolean;
@@ -152,15 +152,15 @@ export interface TypstPluginOptions {
152
152
  /**
153
153
  * Called when a compile into the wasm instance threw. On wasm32 a panic
154
154
  * aborts the instance, so the host must recreate `typstState` and remount
155
- * the editor; the plugin drops the decorations for the failed pass.
155
+ * the editor. The plugin drops the decorations for the failed pass.
156
156
  */
157
157
  onPanic?: (fileId: FileId) => void;
158
- /** Called after a compile pass succeeds; the host resets its health and
158
+ /** Called after a compile pass succeeds. The host resets its health and
159
159
  * heap watchdog on it. */
160
160
  onCompile?: () => void;
161
161
  /**
162
162
  * Opens a link clicked inside a rendered frame. Defaults to a new browser
163
- * tab; the app passes its Tauri-aware `openExternal`.
163
+ * tab. The app passes its Tauri-aware `openExternal`.
164
164
  */
165
165
  onExternalLink?: (url: string) => void;
166
166
  /**
@@ -209,14 +209,14 @@ export interface TypstLinterOptions {
209
209
  *
210
210
  * This runs in every editor mode and combines with other sources (the
211
211
  * spellcheck linter), so neither one replaces the other. The WYSIWYG plugin's
212
- * compile feeds the cache; split and source mode fall back to a compile here
212
+ * compile feeds the cache. Split and source mode fall back to a compile here
213
213
  * so they get diagnostics too.
214
214
  */
215
215
  export declare const typstLinter: (fileId: FileId, spaceId: string, path: string, prelude: TextRef, typstState: TypstState, options?: TypstLinterOptions) => import("@codemirror/state").Extension;
216
216
  //#endregion
217
217
  //#region src/frames.d.ts
218
218
  /**
219
- * Opens an external link for the host. Browsers get a new tab; the app passes
219
+ * Opens an external link for the host. Browsers get a new tab. The app passes
220
220
  * its `openExternal`, which hands the URL to the system browser in Tauri
221
221
  * (a webview has no tab strip, so `window.open` is dropped there).
222
222
  */
@@ -241,8 +241,8 @@ export declare function frameSize(frame: SvgRangedFrame): {
241
241
  * container keeps max-width: 100% so it never exceeds the line. An explicit
242
242
  * container width would make CodeMirror's flex layout grow the content width
243
243
  * forever (resize -> wider widget -> wider content). The pinned SVG overflows
244
- * the clamped container while the pane is narrower than the compiled width;
245
- * the scroller clips it, so the render stays its size instead of scaling.
244
+ * the clamped container while the pane is narrower than the compiled width.
245
+ * The scroller clips it, so the render stays its size instead of scaling.
246
246
  */
247
247
  export declare function syncFrameContainer(container: HTMLElement, frame: SvgRangedFrame): void;
248
248
  /** Fresh frame container for widgets that own their DOM (notebook outputs). */
@@ -266,7 +266,7 @@ export declare function frameIsInactive(view: EditorView, state: EditorState, st
266
266
  * the source stays visible with the frame's height reserved, so the pane does
267
267
  * not jump between render and source. Matches the inline WYSIWYG behavior.
268
268
  *
269
- * `lineHeights` carries measured source heights from the remeasure pass; when
269
+ * `lineHeights` carries measured source heights from the remeasure pass. When
270
270
  * it is absent the view still reports the widget's height for those lines.
271
271
  */
272
272
  export declare function frameActiveDecorations(view: EditorView, state: EditorState, frame: SvgRangedFrame, lineHeights?: Map<number, number>): Range<Decoration>[];
@@ -330,7 +330,7 @@ export interface TypstViewPluginOptions {
330
330
  revision?: () => string | number | undefined;
331
331
  /** See TypstPluginOptions#onPanic. */
332
332
  onPanic?: (fileId: FileId) => void;
333
- /** Called after a compile pass succeeds; the host resets its health and
333
+ /** Called after a compile pass succeeds. The host resets its health and
334
334
  * heap watchdog on it. */
335
335
  onCompile?: () => void;
336
336
  /** See TypstPluginOptions#onExternalLink. */
package/dist/index.mjs CHANGED
@@ -599,7 +599,7 @@ function cellStart(cell) {
599
599
  function hasMarker(cell) {
600
600
  return cell.marker_end > cell.marker_start;
601
601
  }
602
- /** Index of the cell containing `pos`; gaps belong to the cell above. */
602
+ /** Index of the cell containing `pos`. Gaps belong to the cell above. */
603
603
  function cellIndexAt(cells, pos) {
604
604
  let index = cells.length ? 0 : -1;
605
605
  for (let i = 0; i < cells.length; i++) if (pos >= cellStart(cells[i])) index = i;
@@ -746,7 +746,7 @@ function dispatchEdit(view, edit) {
746
746
  });
747
747
  return true;
748
748
  }
749
- /** Compiles and reports through `onRun`; does not move the cursor. */
749
+ /** Compiles and reports through `onRun`, but does not move the cursor. */
750
750
  function runCell(view, index) {
751
751
  if (!notebookOptions(view.state) || index < 0) return false;
752
752
  view.dispatch({ effects: notebookRunEffect.of({ index }) });
@@ -961,7 +961,7 @@ function toLintDiagnostics(typstDiagnostics) {
961
961
  *
962
962
  * This runs in every editor mode and combines with other sources (the
963
963
  * spellcheck linter), so neither one replaces the other. The WYSIWYG plugin's
964
- * compile feeds the cache; split and source mode fall back to a compile here
964
+ * compile feeds the cache. Split and source mode fall back to a compile here
965
965
  * so they get diagnostics too.
966
966
  */
967
967
  const typstLinter = (fileId, spaceId, path, prelude, typstState, options = {}) => linter(async (view) => {
@@ -1012,8 +1012,8 @@ function frameSize(frame) {
1012
1012
  * container keeps max-width: 100% so it never exceeds the line. An explicit
1013
1013
  * container width would make CodeMirror's flex layout grow the content width
1014
1014
  * forever (resize -> wider widget -> wider content). The pinned SVG overflows
1015
- * the clamped container while the pane is narrower than the compiled width;
1016
- * the scroller clips it, so the render stays its size instead of scaling.
1015
+ * the clamped container while the pane is narrower than the compiled width.
1016
+ * The scroller clips it, so the render stays its size instead of scaling.
1017
1017
  */
1018
1018
  function syncFrameContainer(container, frame) {
1019
1019
  const size = frameSize(frame);
@@ -1082,7 +1082,7 @@ function frameIsInactive(view, state, start, end) {
1082
1082
  * the source stays visible with the frame's height reserved, so the pane does
1083
1083
  * not jump between render and source. Matches the inline WYSIWYG behavior.
1084
1084
  *
1085
- * `lineHeights` carries measured source heights from the remeasure pass; when
1085
+ * `lineHeights` carries measured source heights from the remeasure pass. When
1086
1086
  * it is absent the view still reports the widget's height for those lines.
1087
1087
  */
1088
1088
  function frameActiveDecorations(view, state, frame, lineHeights) {
@@ -1251,7 +1251,7 @@ var NotebookOutputWidget = class extends WidgetType {
1251
1251
  this.args = args;
1252
1252
  this.openExternal = openExternal;
1253
1253
  }
1254
- /** Hash of everything the DOM depends on; DOM identity is expensive. */
1254
+ /** Hash of everything the DOM depends on, since DOM identity is expensive. */
1255
1255
  get key() {
1256
1256
  const frames = this.args.frames.map((frame) => {
1257
1257
  const size = frameSize(frame);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typbase/codemirror",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "CodeMirror 6 editing experience for Typst: WYSIWYG inline preview, highlighting, hover, autocomplete.",
5
5
  "keywords": [
6
6
  "atproto",
@@ -40,7 +40,7 @@
40
40
  "typescript": "^5.9.3"
41
41
  },
42
42
  "peerDependencies": {
43
- "@typbase/engine": "^0.3.1"
43
+ "@typbase/engine": "^0.3.2"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsdown",