mdast-control 0.1.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 (45) hide show
  1. package/README.md +359 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +534 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/index.d.ts +7 -0
  6. package/dist/index.js +5 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/lsp/requests.d.ts +215 -0
  9. package/dist/lsp/requests.js +613 -0
  10. package/dist/lsp/requests.js.map +1 -0
  11. package/dist/lsp/server.d.ts +1 -0
  12. package/dist/lsp/server.js +110 -0
  13. package/dist/lsp/server.js.map +1 -0
  14. package/dist/lsp-methods.d.ts +25 -0
  15. package/dist/lsp-methods.js +26 -0
  16. package/dist/lsp-methods.js.map +1 -0
  17. package/dist/markdown.d.ts +17 -0
  18. package/dist/markdown.js +140 -0
  19. package/dist/markdown.js.map +1 -0
  20. package/dist/plugins.d.ts +144 -0
  21. package/dist/plugins.js +833 -0
  22. package/dist/plugins.js.map +1 -0
  23. package/dist/query.d.ts +8 -0
  24. package/dist/query.js +518 -0
  25. package/dist/query.js.map +1 -0
  26. package/dist/table-interchange.d.ts +22 -0
  27. package/dist/table-interchange.js +191 -0
  28. package/dist/table-interchange.js.map +1 -0
  29. package/dist/table-model.d.ts +15 -0
  30. package/dist/table-model.js +105 -0
  31. package/dist/table-model.js.map +1 -0
  32. package/dist/table-structural.d.ts +9 -0
  33. package/dist/table-structural.js +190 -0
  34. package/dist/table-structural.js.map +1 -0
  35. package/dist/table.d.ts +49 -0
  36. package/dist/table.js +131 -0
  37. package/dist/table.js.map +1 -0
  38. package/dist/transport.d.ts +6 -0
  39. package/dist/transport.js +7 -0
  40. package/dist/transport.js.map +1 -0
  41. package/dist/types.d.ts +57 -0
  42. package/dist/types.js +2 -0
  43. package/dist/types.js.map +1 -0
  44. package/package.json +60 -0
  45. package/scripts/verify-package.mjs +252 -0
@@ -0,0 +1,215 @@
1
+ import type { DelimitedExportOptions, DelimitedFormat, DelimitedImportOptions, TableColumnAddress, TableModel, TableSortDirection } from '../table.js';
2
+ import { type TransportQueryMatch } from '../transport.js';
3
+ import type { InsertPosition, MoveTargetPolicy } from '../types.js';
4
+ export { MDAST_REQUEST_METHODS } from '../lsp-methods.js';
5
+ export type QueryRequestParams = {
6
+ uri: string;
7
+ query: string;
8
+ };
9
+ export type InsertRequestParams = {
10
+ uri: string;
11
+ query: string;
12
+ position: InsertPosition;
13
+ markdown: string;
14
+ };
15
+ export type ReplaceRequestParams = {
16
+ uri: string;
17
+ query: string;
18
+ markdown: string;
19
+ };
20
+ export type MoveRequestParams = {
21
+ uri: string;
22
+ query: string;
23
+ target: string;
24
+ position: InsertPosition;
25
+ targetPolicy?: MoveTargetPolicy;
26
+ };
27
+ export type CopyRequestParams = MoveRequestParams;
28
+ export type PluginRequestParams = {
29
+ plugin: string;
30
+ };
31
+ export type ElementRequestParams = {
32
+ element: string;
33
+ };
34
+ export type PluginOperationRequestParams = {
35
+ plugin: string;
36
+ operation: string;
37
+ };
38
+ export type PluginRunRequestParams = {
39
+ uri: string;
40
+ plugin: string;
41
+ operation: string;
42
+ query: string;
43
+ args?: Record<string, unknown>;
44
+ };
45
+ export type TableExportRequestParams = QueryRequestParams & {
46
+ format: DelimitedFormat;
47
+ options?: DelimitedExportOptions;
48
+ };
49
+ type TableImportRequestBase = QueryRequestParams & {
50
+ format: DelimitedFormat;
51
+ data: string;
52
+ options?: DelimitedImportOptions;
53
+ };
54
+ export type TableImportRequestParams = TableImportRequestBase & ({
55
+ mode: 'replace';
56
+ position?: never;
57
+ } | {
58
+ mode: 'insert';
59
+ position: InsertPosition;
60
+ });
61
+ export type TableUpdateCellRequestParams = QueryRequestParams & {
62
+ row: number;
63
+ column: TableColumnAddress;
64
+ value: string;
65
+ };
66
+ export type TableInsertRowRequestParams = QueryRequestParams & {
67
+ index: number;
68
+ values: string[];
69
+ };
70
+ export type TableDeleteRowRequestParams = QueryRequestParams & {
71
+ row: number;
72
+ };
73
+ export type TableAddColumnRequestParams = QueryRequestParams & {
74
+ index: number;
75
+ header: string;
76
+ values?: string[];
77
+ };
78
+ export type TableDeleteColumnRequestParams = QueryRequestParams & {
79
+ column: TableColumnAddress;
80
+ };
81
+ export type TableSortRequestParams = TableDeleteColumnRequestParams & {
82
+ direction: TableSortDirection;
83
+ };
84
+ export declare function capabilitiesRequest(): import("../plugins.js").CapabilitiesSnapshot;
85
+ export declare function pluginListRequest(): import("../plugins.js").PluginCapabilities[];
86
+ export declare function pluginShowRequest(pluginId: string): import("../plugins.js").PluginCapabilities | null;
87
+ export declare function elementCapabilitiesRequest(elementKind: string): import("../plugins.js").ElementCapabilities;
88
+ export declare function pluginOperationRequest(pluginId: string, operationName: string): import("../plugins.js").OperationDescriptor | null;
89
+ export declare function pluginRunRequest(markdown: string | undefined, pluginId: string, operationName: string, query: string, args?: Record<string, unknown>): import("../plugins.js").PluginRunResult | null;
90
+ export declare function queryDocument(markdown: string, query: string): TransportQueryMatch[];
91
+ export declare function queryRequest(markdown: string | undefined, query: string): TransportQueryMatch[];
92
+ export declare function handleQueryRequest(markdown: string | undefined, params: QueryRequestParams): TransportQueryMatch[];
93
+ export declare function insertIntoDocument(markdown: string, query: string, position: InsertPosition, snippet: string): {
94
+ inserted: number;
95
+ markdown: string;
96
+ };
97
+ export declare function insertRequest(markdown: string | undefined, query: string, position: string, snippet: string): {
98
+ inserted: number;
99
+ markdown: string;
100
+ };
101
+ export declare function handleInsertRequest(markdown: string | undefined, params: InsertRequestParams): {
102
+ inserted: number;
103
+ markdown: string;
104
+ };
105
+ export declare function deleteFromDocument(markdown: string, query: string): {
106
+ changed: number;
107
+ markdown: string;
108
+ };
109
+ export declare function deleteRequest(markdown: string | undefined, query: string): {
110
+ changed: number;
111
+ markdown: string;
112
+ };
113
+ export declare function handleDeleteRequest(markdown: string | undefined, params: QueryRequestParams): {
114
+ changed: number;
115
+ markdown: string;
116
+ };
117
+ export declare function replaceInDocument(markdown: string, query: string, snippet: string): {
118
+ changed: number;
119
+ markdown: string;
120
+ };
121
+ export declare function replaceRequest(markdown: string | undefined, query: string, snippet: string): {
122
+ changed: number;
123
+ markdown: string;
124
+ };
125
+ export declare function handleReplaceRequest(markdown: string | undefined, params: ReplaceRequestParams): {
126
+ changed: number;
127
+ markdown: string;
128
+ };
129
+ export declare function wrapInDocument(markdown: string, query: string, wrapper: string): {
130
+ changed: number;
131
+ markdown: string;
132
+ };
133
+ export declare function wrapRequest(markdown: string | undefined, query: string, wrapper: string): {
134
+ changed: number;
135
+ markdown: string;
136
+ };
137
+ export declare function handleWrapRequest(markdown: string | undefined, params: ReplaceRequestParams): {
138
+ changed: number;
139
+ markdown: string;
140
+ };
141
+ export declare function unwrapInDocument(markdown: string, query: string): {
142
+ changed: number;
143
+ markdown: string;
144
+ };
145
+ export declare function unwrapRequest(markdown: string | undefined, query: string): {
146
+ changed: number;
147
+ markdown: string;
148
+ };
149
+ export declare function handleUnwrapRequest(markdown: string | undefined, params: QueryRequestParams): {
150
+ changed: number;
151
+ markdown: string;
152
+ };
153
+ export declare function moveInDocument(markdown: string, query: string, target: string, position: InsertPosition, targetPolicy?: MoveTargetPolicy): {
154
+ changed: number;
155
+ markdown: string;
156
+ };
157
+ export declare function moveRequest(markdown: string | undefined, query: string, target: string, position: string, targetPolicy?: string): {
158
+ changed: number;
159
+ markdown: string;
160
+ };
161
+ export declare function handleMoveRequest(markdown: string | undefined, params: MoveRequestParams): {
162
+ changed: number;
163
+ markdown: string;
164
+ };
165
+ export declare function copyIntoDocument(markdown: string, query: string, target: string, position: InsertPosition, targetPolicy?: MoveTargetPolicy): {
166
+ changed: number;
167
+ markdown: string;
168
+ };
169
+ export declare function copyRequest(markdown: string | undefined, query: string, target: string, position: string, targetPolicy?: string): {
170
+ changed: number;
171
+ markdown: string;
172
+ };
173
+ export declare function handleCopyRequest(markdown: string | undefined, params: CopyRequestParams): {
174
+ changed: number;
175
+ markdown: string;
176
+ };
177
+ export declare function tableQueryRequest(markdown: string | undefined, query: string): TableModel | null;
178
+ export declare function handleTableQueryRequest(markdown: string | undefined, params: QueryRequestParams): TableModel | null;
179
+ export declare function tableExportRequest(markdown: string | undefined, query: string, format: DelimitedFormat, options?: DelimitedExportOptions): string | null;
180
+ export declare function handleTableExportRequest(markdown: string | undefined, params: TableExportRequestParams): string | null;
181
+ export declare function tableImportRequest(markdown: string | undefined, params: TableImportRequestParams): {
182
+ changed: number;
183
+ markdown: string;
184
+ };
185
+ export declare function handleTableImportRequest(markdown: string | undefined, params: TableImportRequestParams): {
186
+ changed: number;
187
+ markdown: string;
188
+ };
189
+ export declare function handleTableUpdateCellRequest(markdown: string | undefined, params: TableUpdateCellRequestParams): {
190
+ changed: number;
191
+ markdown: string;
192
+ };
193
+ export declare function handleTableInsertRowRequest(markdown: string | undefined, params: TableInsertRowRequestParams): {
194
+ changed: number;
195
+ markdown: string;
196
+ };
197
+ export declare function handleTableDeleteRowRequest(markdown: string | undefined, params: TableDeleteRowRequestParams): {
198
+ changed: number;
199
+ markdown: string;
200
+ };
201
+ export declare function handleTableAddColumnRequest(markdown: string | undefined, params: TableAddColumnRequestParams): {
202
+ changed: number;
203
+ markdown: string;
204
+ };
205
+ export declare function handleTableDeleteColumnRequest(markdown: string | undefined, params: TableDeleteColumnRequestParams): {
206
+ changed: number;
207
+ markdown: string;
208
+ };
209
+ export declare function handleTableSortRequest(markdown: string | undefined, params: TableSortRequestParams): {
210
+ changed: number;
211
+ markdown: string;
212
+ };
213
+ export declare function registerMdastRequestHandlers(connection: {
214
+ onRequest(method: string, handler: (params: unknown) => unknown): void;
215
+ }, getText: (uri: string) => string | undefined): void;