@typbase/engine 0.2.4 → 0.3.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/engine.d.ts CHANGED
@@ -80,7 +80,7 @@ export interface LinkSpan {
80
80
  kind: string;
81
81
  /**
82
82
  * The page reference: the id argument for `page-link` and `embed`, or the
83
- * id part of a `typbase://page/<id>` URL.
83
+ * id part of a `typbase://page/<id>` URL. Empty for a dynamic call.
84
84
  */
85
85
  target: string;
86
86
  /**
@@ -89,10 +89,16 @@ export interface LinkSpan {
89
89
  from: number;
90
90
  to: number;
91
91
  /**
92
- * UTF-16 range of the target string's contents, inside the quotes.
92
+ * UTF-16 range of the target string's contents (inside the quotes) or of
93
+ * the target expression for a dynamic call.
93
94
  */
94
95
  target_from: number;
95
96
  target_to: number;
97
+ /**
98
+ * True when the target is computed at compile time; the index resolves
99
+ * the ids from a compile and this span only locates the call.
100
+ */
101
+ dynamic: boolean;
96
102
  }
97
103
 
98
104
  /**
@@ -262,6 +268,15 @@ export interface TypstDiagnostic {
262
268
  severity: TypstDiagnosticSeverity;
263
269
  message: string;
264
270
  hints: string[];
271
+ /**
272
+ * Virtual path of the imported file the diagnostic points into, when it
273
+ * is not one of the note's own compile sources. Plugin errors land here.
274
+ */
275
+ file?: string;
276
+ /**
277
+ * 1-based line in `file`. Unset when `file` is.
278
+ */
279
+ line?: number;
265
280
  }
266
281
 
267
282
  export interface TypstHighlight {
@@ -428,6 +443,13 @@ export class TypstState {
428
443
  revision(): number;
429
444
  setCodeFont(id: FileId, code_font?: string | null): void;
430
445
  setFont(id: FileId, font: string): void;
446
+ /**
447
+ * Host values for `sys.inputs`: the compiling page and workspace (both
448
+ * optional) plus the compile reason (`editor`, `resolve`, `render`,
449
+ * `chat`). The library bakes them into its global scope, so a change
450
+ * rebuilds it and drops memoized compiles.
451
+ */
452
+ setInputs(page: string | null | undefined, workspace: string | null | undefined, reason: string): void;
431
453
  /**
432
454
  * The editor's line-height as a multiple of the text size. Frame crops
433
455
  * move their top to the editor's line box so the rendered text sits on
@@ -531,6 +553,7 @@ export interface InitOutput {
531
553
  readonly typststate_revision: (a: number) => number;
532
554
  readonly typststate_setCodeFont: (a: number, b: number, c: number, d: number) => void;
533
555
  readonly typststate_setFont: (a: number, b: number, c: number, d: number) => void;
556
+ readonly typststate_setInputs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
534
557
  readonly typststate_setLineHeightRatio: (a: number, b: number, c: number) => void;
535
558
  readonly typststate_setLocale: (a: number, b: number, c: number, d: number) => void;
536
559
  readonly typststate_setMathFont: (a: number, b: number, c: number, d: number) => void;
package/engine.js CHANGED
@@ -857,6 +857,24 @@ export class TypstState {
857
857
  const len0 = WASM_VECTOR_LEN;
858
858
  wasm.typststate_setFont(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0);
859
859
  }
860
+ /**
861
+ * Host values for `sys.inputs`: the compiling page and workspace (both
862
+ * optional) plus the compile reason (`editor`, `resolve`, `render`,
863
+ * `chat`). The library bakes them into its global scope, so a change
864
+ * rebuilds it and drops memoized compiles.
865
+ * @param {string | null | undefined} page
866
+ * @param {string | null | undefined} workspace
867
+ * @param {string} reason
868
+ */
869
+ setInputs(page, workspace, reason) {
870
+ var ptr0 = isLikeNone(page) ? 0 : passStringToWasm0(page, wasm.__wbindgen_export, wasm.__wbindgen_export2);
871
+ var len0 = WASM_VECTOR_LEN;
872
+ var ptr1 = isLikeNone(workspace) ? 0 : passStringToWasm0(workspace, wasm.__wbindgen_export, wasm.__wbindgen_export2);
873
+ var len1 = WASM_VECTOR_LEN;
874
+ const ptr2 = passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
875
+ const len2 = WASM_VECTOR_LEN;
876
+ wasm.typststate_setInputs(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
877
+ }
860
878
  /**
861
879
  * The editor's line-height as a multiple of the text size. Frame crops
862
880
  * move their top to the editor's line box so the rendered text sits on
@@ -1049,10 +1067,10 @@ function __wbg_get_imports() {
1049
1067
  __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
1050
1068
  throw new Error(getStringFromWasm0(arg0, arg1));
1051
1069
  },
1052
- __wbg_debug_9c64921ec90ca447: function(arg0, arg1) {
1070
+ __wbg_debug_3284c30a5576e6fc: function(arg0, arg1) {
1053
1071
  console.debug(getStringFromWasm0(arg0, arg1));
1054
1072
  },
1055
- __wbg_error_30e43835774fba47: function(arg0, arg1) {
1073
+ __wbg_error_f23bf8472456aabd: function(arg0, arg1) {
1056
1074
  console.error(getStringFromWasm0(arg0, arg1));
1057
1075
  },
1058
1076
  __wbg_getTime_63fb0332e6c4ec17: function(arg0) {
package/engine_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typbase/engine",
3
3
  "type": "module",
4
4
  "description": "Local-first knowledge base made for Typst and the Atmosphere.",
5
- "version": "0.2.4",
5
+ "version": "0.3.0",
6
6
  "license": "AGPL-3.0",
7
7
  "repository": {
8
8
  "type": "git",