@vedivad/typst-web-service 0.17.0 → 0.17.1
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.ts +114 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { CompileResult, CompletionResponse, Hover, HlSpan } from 'typsten';
|
|
2
|
-
export { CompileResult, Completion, CompletionKind, CompletionResponse, Diagnostic, HlSpan, Hover, HoverKind, Location, PageInfo, Severity } from 'typsten';
|
|
3
|
-
|
|
4
1
|
/** UTF-16 string offset (CodeMirror position) -> UTF-8 byte offset (typsten). */
|
|
5
2
|
declare function cmOffsetToByte(text: string, offset: number): number;
|
|
6
3
|
/** UTF-8 byte offset (typsten) -> UTF-16 string offset (CodeMirror position). */
|
|
@@ -15,6 +12,119 @@ type Path = string;
|
|
|
15
12
|
/** Ensure a path starts with a leading slash. Idempotent. */
|
|
16
13
|
declare function normalizePath(path: string): Path;
|
|
17
14
|
|
|
15
|
+
/* tslint:disable */
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
/**
|
|
18
|
+
* A highlighted source span: a half-open byte range and its CSS class.
|
|
19
|
+
*/
|
|
20
|
+
interface HlSpan {
|
|
21
|
+
from: number;
|
|
22
|
+
to: number;
|
|
23
|
+
/**
|
|
24
|
+
* Typst\'s own stable highlight class, e.g. `typ-key`, `typ-func`, `typ-str`
|
|
25
|
+
* (see `Tag::css_class`). The editor uses it verbatim as the decoration class.
|
|
26
|
+
*/
|
|
27
|
+
tag: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A hover tooltip.
|
|
32
|
+
*/
|
|
33
|
+
interface Hover {
|
|
34
|
+
kind: HoverKind;
|
|
35
|
+
value: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A single compiler diagnostic, ready for an editor.
|
|
40
|
+
*/
|
|
41
|
+
interface Diagnostic {
|
|
42
|
+
severity: Severity;
|
|
43
|
+
message: string;
|
|
44
|
+
hints: string[];
|
|
45
|
+
/**
|
|
46
|
+
* `None` when the span is detached or cannot be resolved.
|
|
47
|
+
*/
|
|
48
|
+
location: Location | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A single completion candidate.
|
|
53
|
+
*/
|
|
54
|
+
interface Completion {
|
|
55
|
+
kind: CompletionKind;
|
|
56
|
+
label: string;
|
|
57
|
+
/**
|
|
58
|
+
* Insertion text, possibly with snippet placeholders like `${body}`.
|
|
59
|
+
* Falls back to `label` when `None`.
|
|
60
|
+
*/
|
|
61
|
+
apply: string | undefined;
|
|
62
|
+
detail: string | undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The completions at a cursor, plus where the replacement starts.
|
|
67
|
+
*/
|
|
68
|
+
interface CompletionResponse {
|
|
69
|
+
/**
|
|
70
|
+
* Byte offset where the replacement begins; the editor replaces `from..cursor`.
|
|
71
|
+
*/
|
|
72
|
+
from: number;
|
|
73
|
+
completions: Completion[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The kind of thing a completion inserts.
|
|
78
|
+
*/
|
|
79
|
+
type CompletionKind = "syntax" | "func" | "type" | "param" | "constant" | "path" | "package" | "label" | "font" | "symbol";
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The outcome of a compile: one `PageInfo` per renderable page plus all
|
|
83
|
+
* diagnostics. `compile()` does NOT render, pages are drawn on demand via
|
|
84
|
+
* `render_page`/`render_pages`. Diagnostics are DATA, not errors (the editor
|
|
85
|
+
* needs them on success as warnings and on failure as errors), so this is never
|
|
86
|
+
* a `Result` and never throws. On a failed compile the `pages` describe the
|
|
87
|
+
* last successful document (the last-good preview is kept), so the presence of
|
|
88
|
+
* an error diagnostic means `pages` is stale.
|
|
89
|
+
*/
|
|
90
|
+
interface CompileResult {
|
|
91
|
+
pages: PageInfo[];
|
|
92
|
+
diagnostics: Diagnostic[];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The width and height of a rendered page, in points.
|
|
97
|
+
*/
|
|
98
|
+
interface PageInfo {
|
|
99
|
+
width: number;
|
|
100
|
+
height: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Where a diagnostic points, when its span resolves to a real location.
|
|
105
|
+
*
|
|
106
|
+
* Offsets are UTF-8 byte indices (Typst-native); `line`/`column` are 1-based
|
|
107
|
+
* (editor convention). Note these are code-point based; exact UTF-16 mapping
|
|
108
|
+
* for JS editors is a later refinement.
|
|
109
|
+
*/
|
|
110
|
+
interface Location {
|
|
111
|
+
file: string;
|
|
112
|
+
start: number;
|
|
113
|
+
end: number;
|
|
114
|
+
line: number;
|
|
115
|
+
column: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Whether a diagnostic is a fatal error or a non-fatal warning.
|
|
120
|
+
*/
|
|
121
|
+
type Severity = "error" | "warning";
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Whether a hover tooltip is prose or Typst code.
|
|
125
|
+
*/
|
|
126
|
+
type HoverKind = "text" | "code";
|
|
127
|
+
|
|
18
128
|
/** A rendered page: its index, dimensions (in points), and standalone SVG. */
|
|
19
129
|
interface RenderedSvgPage {
|
|
20
130
|
index: number;
|
|
@@ -145,4 +255,4 @@ declare class TypstProject {
|
|
|
145
255
|
destroy(): void;
|
|
146
256
|
}
|
|
147
257
|
|
|
148
|
-
export { type AutoCompileOptions, type CompileListener, type Path, type RenderedSvgPage, TypstProject, type TypstProjectCreateOptions, byteToCmOffset, cmOffsetToByte, normalizePath };
|
|
258
|
+
export { type AutoCompileOptions, type CompileListener, type CompileResult, type Completion, type CompletionKind, type CompletionResponse, type Diagnostic, type HlSpan, type Hover, type HoverKind, type Location, type PageInfo, type Path, type RenderedSvgPage, type Severity, TypstProject, type TypstProjectCreateOptions, byteToCmOffset, cmOffsetToByte, normalizePath };
|