gridmd 1.0.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/README.md +126 -0
- package/dist/bin/chunk-jz0c1a5d.js +5497 -0
- package/dist/bin/gridmd-lint.js +34 -0
- package/dist/bin/gridmd2xlsx.js +43 -0
- package/dist/bin/xlsx2gridmd.js +27 -0
- package/dist/calc.d.ts +41 -0
- package/dist/dump.d.ts +2 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +6286 -0
- package/dist/parser.d.ts +13 -0
- package/dist/refs.d.ts +8 -0
- package/dist/scalar.d.ts +7 -0
- package/dist/types.d.ts +287 -0
- package/dist/validate.d.ts +3 -0
- package/dist/xlsx/chart.d.ts +14 -0
- package/dist/xlsx/chartex.d.ts +9 -0
- package/dist/xlsx/drawing.d.ts +25 -0
- package/dist/xlsx/model.d.ts +5 -0
- package/dist/xlsx/pivot.d.ts +16 -0
- package/dist/xlsx/read-objects.d.ts +24 -0
- package/dist/xlsx/read.d.ts +6 -0
- package/dist/xlsx/styles.d.ts +37 -0
- package/dist/xlsx/units.d.ts +8 -0
- package/dist/xlsx/write.d.ts +7 -0
- package/dist/xlsx/zip.d.ts +7 -0
- package/dist/xml.d.ts +8 -0
- package/package.json +45 -0
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Diagnostic, InfoArgs, Meta, ParsedDocument } from './types';
|
|
2
|
+
export declare const RESERVED_KINDS: Set<string>;
|
|
3
|
+
export declare function parseYaml(text: string, line: number, errors: Diagnostic[]): Meta;
|
|
4
|
+
export declare function tryProps(text: string): Meta | null;
|
|
5
|
+
export declare function findPropsSplit(text: string): {
|
|
6
|
+
scalarText: string;
|
|
7
|
+
propsText: string | null;
|
|
8
|
+
};
|
|
9
|
+
export declare function splitPipeRow(rawLine: string): string[] | null;
|
|
10
|
+
export declare function parseInfoArgs(rest: string, line: number, errors: Diagnostic[]): InfoArgs;
|
|
11
|
+
export declare function parseDocument(source: string, { mode }?: {
|
|
12
|
+
mode?: string;
|
|
13
|
+
}): ParsedDocument;
|
package/dist/refs.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CellPos, Target } from './types';
|
|
2
|
+
export declare const MAX_COL = 16384;
|
|
3
|
+
export declare const MAX_ROW = 1048576;
|
|
4
|
+
export declare function colToNum(letters: string): number;
|
|
5
|
+
export declare function numToCol(n: number): string;
|
|
6
|
+
export declare function parseCell(text: string): CellPos | null;
|
|
7
|
+
export declare function parseTarget(input: string): Target | null;
|
|
8
|
+
export declare const refKey: (col: number, row: number) => string;
|
package/dist/scalar.d.ts
ADDED
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open-ended, YAML-derived data (frontmatter, directive metadata, inline
|
|
3
|
+
* props and `@`-directive bodies). Structurally unconstrained by design; it
|
|
4
|
+
* enters as parsed YAML and is validated by the lint pass, not by the type
|
|
5
|
+
* system. Deliberate, documented divergence from CODING_PRACTICES §1.
|
|
6
|
+
*/
|
|
7
|
+
export type Meta = any;
|
|
8
|
+
export interface Diagnostic {
|
|
9
|
+
line: number;
|
|
10
|
+
msg: string;
|
|
11
|
+
}
|
|
12
|
+
export type ScalarKind = 'blank' | 'text' | 'formula' | 'number' | 'boolean' | 'date' | 'time' | 'error' | 'invalid';
|
|
13
|
+
/**
|
|
14
|
+
* One parsed cell scalar. A wide struct that mirrors the runtime object shape
|
|
15
|
+
* exactly (every field optional) so the parser/serializer round-trip without
|
|
16
|
+
* narrowing churn; `kind` is the discriminant every consumer switches on.
|
|
17
|
+
*/
|
|
18
|
+
export interface Scalar {
|
|
19
|
+
kind: ScalarKind;
|
|
20
|
+
value?: string | number | boolean;
|
|
21
|
+
formula?: string;
|
|
22
|
+
cse?: boolean;
|
|
23
|
+
cached?: Scalar | null;
|
|
24
|
+
problem?: string;
|
|
25
|
+
forced?: boolean;
|
|
26
|
+
quoted?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type TargetKind = 'cell' | 'range' | 'cols' | 'rows';
|
|
29
|
+
export interface Target {
|
|
30
|
+
kind: TargetKind;
|
|
31
|
+
sheet: string | null;
|
|
32
|
+
c1: number;
|
|
33
|
+
r1: number;
|
|
34
|
+
c2: number;
|
|
35
|
+
r2: number;
|
|
36
|
+
line?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface CellPos {
|
|
39
|
+
col: number;
|
|
40
|
+
row: number;
|
|
41
|
+
}
|
|
42
|
+
export interface XmlNode {
|
|
43
|
+
name: string;
|
|
44
|
+
attrs: Record<string, string | undefined>;
|
|
45
|
+
children: XmlNode[];
|
|
46
|
+
text: string;
|
|
47
|
+
}
|
|
48
|
+
export interface InfoArgs {
|
|
49
|
+
positional: string[];
|
|
50
|
+
flags: Record<string, string | undefined>;
|
|
51
|
+
anchor: string | null;
|
|
52
|
+
size: {
|
|
53
|
+
w: number;
|
|
54
|
+
h: number;
|
|
55
|
+
} | null;
|
|
56
|
+
}
|
|
57
|
+
export interface Row {
|
|
58
|
+
cells: string[];
|
|
59
|
+
line: number;
|
|
60
|
+
}
|
|
61
|
+
export interface FenceBlock {
|
|
62
|
+
type: 'fence';
|
|
63
|
+
kind: string;
|
|
64
|
+
args: InfoArgs;
|
|
65
|
+
body: string[];
|
|
66
|
+
line: number;
|
|
67
|
+
meta?: Meta;
|
|
68
|
+
rows?: Row[];
|
|
69
|
+
code?: string;
|
|
70
|
+
payload?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface AtBlock {
|
|
73
|
+
type: 'at';
|
|
74
|
+
targetText: string;
|
|
75
|
+
line: number;
|
|
76
|
+
scalarText: string | null;
|
|
77
|
+
props: Meta | null;
|
|
78
|
+
body: Meta | null;
|
|
79
|
+
}
|
|
80
|
+
export type Block = FenceBlock | AtBlock;
|
|
81
|
+
export interface SheetBlock {
|
|
82
|
+
name: string;
|
|
83
|
+
line: number;
|
|
84
|
+
blocks: Block[];
|
|
85
|
+
}
|
|
86
|
+
export interface ParseStats {
|
|
87
|
+
defs: number;
|
|
88
|
+
blocks: number;
|
|
89
|
+
}
|
|
90
|
+
export interface ParsedDocument {
|
|
91
|
+
frontmatter: Meta;
|
|
92
|
+
workbookBlocks: Block[];
|
|
93
|
+
sheets: SheetBlock[];
|
|
94
|
+
errors: Diagnostic[];
|
|
95
|
+
warnings: Diagnostic[];
|
|
96
|
+
mode: string;
|
|
97
|
+
stats?: ParseStats;
|
|
98
|
+
}
|
|
99
|
+
export interface LintResult {
|
|
100
|
+
doc: ParsedDocument;
|
|
101
|
+
errors: Diagnostic[];
|
|
102
|
+
warnings: Diagnostic[];
|
|
103
|
+
sheets: number;
|
|
104
|
+
cells: number;
|
|
105
|
+
blocks: number;
|
|
106
|
+
}
|
|
107
|
+
export interface CellContent {
|
|
108
|
+
formula?: string;
|
|
109
|
+
cse?: boolean;
|
|
110
|
+
cached?: Scalar | null;
|
|
111
|
+
scalar?: Scalar;
|
|
112
|
+
rich?: Meta;
|
|
113
|
+
arrayRef?: string;
|
|
114
|
+
entityFields?: Meta;
|
|
115
|
+
spillCache?: boolean;
|
|
116
|
+
}
|
|
117
|
+
export interface Cell {
|
|
118
|
+
col: number;
|
|
119
|
+
row: number;
|
|
120
|
+
content: CellContent | null;
|
|
121
|
+
patches: Meta[];
|
|
122
|
+
}
|
|
123
|
+
export interface TableModel {
|
|
124
|
+
name: string;
|
|
125
|
+
anchor: CellPos;
|
|
126
|
+
columns: string[];
|
|
127
|
+
headerRow: boolean;
|
|
128
|
+
bodyRows: number;
|
|
129
|
+
total: Meta;
|
|
130
|
+
style?: Meta;
|
|
131
|
+
banded: Meta;
|
|
132
|
+
filter: Meta;
|
|
133
|
+
sort: Meta[];
|
|
134
|
+
line: number;
|
|
135
|
+
sheetName?: string;
|
|
136
|
+
}
|
|
137
|
+
export interface CfBlock {
|
|
138
|
+
sqref: string;
|
|
139
|
+
rules: Meta;
|
|
140
|
+
line: number;
|
|
141
|
+
}
|
|
142
|
+
export interface ValidationBlock {
|
|
143
|
+
sqref: string;
|
|
144
|
+
meta: Meta;
|
|
145
|
+
}
|
|
146
|
+
export interface FilterBlock {
|
|
147
|
+
sqref: string;
|
|
148
|
+
meta: Meta;
|
|
149
|
+
line: number;
|
|
150
|
+
}
|
|
151
|
+
export interface NoteModel {
|
|
152
|
+
col: number;
|
|
153
|
+
row: number;
|
|
154
|
+
text: string;
|
|
155
|
+
}
|
|
156
|
+
export interface HyperlinkModel {
|
|
157
|
+
col: number;
|
|
158
|
+
row: number;
|
|
159
|
+
target: string;
|
|
160
|
+
tip?: Meta;
|
|
161
|
+
}
|
|
162
|
+
export interface ChartModel {
|
|
163
|
+
type: string | undefined;
|
|
164
|
+
title: string | null;
|
|
165
|
+
anchor: string | null;
|
|
166
|
+
size: {
|
|
167
|
+
w: number;
|
|
168
|
+
h: number;
|
|
169
|
+
} | null;
|
|
170
|
+
meta: Meta;
|
|
171
|
+
line: number;
|
|
172
|
+
}
|
|
173
|
+
export interface SparklineModel {
|
|
174
|
+
sqref: string;
|
|
175
|
+
meta: Meta;
|
|
176
|
+
line: number;
|
|
177
|
+
}
|
|
178
|
+
export interface PivotModel {
|
|
179
|
+
name: string;
|
|
180
|
+
anchor: string | null;
|
|
181
|
+
meta: Meta;
|
|
182
|
+
line: number;
|
|
183
|
+
}
|
|
184
|
+
export interface SlicerModel {
|
|
185
|
+
anchor: string | null;
|
|
186
|
+
size: {
|
|
187
|
+
w: number;
|
|
188
|
+
h: number;
|
|
189
|
+
} | null;
|
|
190
|
+
meta: Meta;
|
|
191
|
+
kind: string;
|
|
192
|
+
line: number;
|
|
193
|
+
_name?: string;
|
|
194
|
+
_timeline?: boolean;
|
|
195
|
+
}
|
|
196
|
+
export interface ImageModel {
|
|
197
|
+
anchor: string | null;
|
|
198
|
+
size: {
|
|
199
|
+
w: number;
|
|
200
|
+
h: number;
|
|
201
|
+
} | null;
|
|
202
|
+
src: string;
|
|
203
|
+
alt: Meta;
|
|
204
|
+
line: number;
|
|
205
|
+
}
|
|
206
|
+
export interface ShapeModel {
|
|
207
|
+
preset: string;
|
|
208
|
+
anchor: string | null;
|
|
209
|
+
size: {
|
|
210
|
+
w: number;
|
|
211
|
+
h: number;
|
|
212
|
+
} | null;
|
|
213
|
+
meta: Meta;
|
|
214
|
+
line: number;
|
|
215
|
+
}
|
|
216
|
+
export interface ThreadModel {
|
|
217
|
+
ref: string;
|
|
218
|
+
comments: Meta;
|
|
219
|
+
line: number;
|
|
220
|
+
}
|
|
221
|
+
export interface ScenarioModel {
|
|
222
|
+
name: string;
|
|
223
|
+
meta: Meta;
|
|
224
|
+
line: number;
|
|
225
|
+
}
|
|
226
|
+
export interface OutlineModel {
|
|
227
|
+
rows: Meta[];
|
|
228
|
+
cols: Meta[];
|
|
229
|
+
}
|
|
230
|
+
export interface Sheet {
|
|
231
|
+
name: string;
|
|
232
|
+
meta: Meta;
|
|
233
|
+
kind: 'worksheet' | 'chart';
|
|
234
|
+
cells: Map<string, Cell>;
|
|
235
|
+
merges: Target[];
|
|
236
|
+
tables: TableModel[];
|
|
237
|
+
cf: CfBlock[];
|
|
238
|
+
validations: ValidationBlock[];
|
|
239
|
+
notes: NoteModel[];
|
|
240
|
+
hyperlinks: HyperlinkModel[];
|
|
241
|
+
outline: OutlineModel;
|
|
242
|
+
page: Meta;
|
|
243
|
+
charts: ChartModel[];
|
|
244
|
+
sparklines: SparklineModel[];
|
|
245
|
+
pivots: PivotModel[];
|
|
246
|
+
slicers: SlicerModel[];
|
|
247
|
+
images: ImageModel[];
|
|
248
|
+
shapes: ShapeModel[];
|
|
249
|
+
threads: ThreadModel[];
|
|
250
|
+
scenarios: ScenarioModel[];
|
|
251
|
+
filters: FilterBlock[];
|
|
252
|
+
}
|
|
253
|
+
export type ReportAction = 'native' | 'carried' | 'partial' | 'not-emitted';
|
|
254
|
+
export interface ReportEntry {
|
|
255
|
+
line?: number;
|
|
256
|
+
feature: string;
|
|
257
|
+
action: ReportAction;
|
|
258
|
+
note?: string;
|
|
259
|
+
}
|
|
260
|
+
export interface RawPart {
|
|
261
|
+
part: string;
|
|
262
|
+
payload: string | undefined;
|
|
263
|
+
encoding: string | undefined;
|
|
264
|
+
line: number;
|
|
265
|
+
}
|
|
266
|
+
export interface CarryEntry {
|
|
267
|
+
kind: string;
|
|
268
|
+
line: number;
|
|
269
|
+
feature?: string;
|
|
270
|
+
args?: InfoArgs | null;
|
|
271
|
+
meta?: Meta;
|
|
272
|
+
code?: string | null;
|
|
273
|
+
body?: Meta;
|
|
274
|
+
}
|
|
275
|
+
export interface TableIndexEntry extends TableModel {
|
|
276
|
+
sheetName: string;
|
|
277
|
+
}
|
|
278
|
+
export interface WorkbookModel {
|
|
279
|
+
fm: Meta;
|
|
280
|
+
themeColors: Record<string, string>;
|
|
281
|
+
sheets: Sheet[];
|
|
282
|
+
report: ReportEntry[];
|
|
283
|
+
rawParts: RawPart[];
|
|
284
|
+
carry: CarryEntry[];
|
|
285
|
+
tableIndex: Map<string, TableIndexEntry>;
|
|
286
|
+
baseDir: string;
|
|
287
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChartModel, ReportEntry, TableIndexEntry } from '../types';
|
|
2
|
+
export declare const CLASSIC_TYPES: Set<string>;
|
|
3
|
+
export declare const CHARTEX_TYPES: Set<string>;
|
|
4
|
+
export declare function isClassicChart(type: unknown): boolean;
|
|
5
|
+
export declare function resolveDataRef(ref: unknown, ownSheet: string, tableIndex: Map<string, TableIndexEntry>): string | null;
|
|
6
|
+
interface ChartSpaceOpts {
|
|
7
|
+
ownSheet: string;
|
|
8
|
+
tableIndex: Map<string, TableIndexEntry>;
|
|
9
|
+
themeColors: Record<string, string>;
|
|
10
|
+
report: ReportEntry[];
|
|
11
|
+
}
|
|
12
|
+
export declare function chartSpaceXml(chart: ChartModel, { ownSheet, tableIndex, themeColors }: ChartSpaceOpts): string;
|
|
13
|
+
export declare function splitTopLevel(text: string): string[];
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChartModel } from '../types';
|
|
2
|
+
export declare const CX_NS = "http://schemas.microsoft.com/office/drawing/2014/chartex";
|
|
3
|
+
export declare const isChartExType: (t: unknown) => boolean;
|
|
4
|
+
export interface LiteralResult {
|
|
5
|
+
f: string;
|
|
6
|
+
values: (string | number | null)[];
|
|
7
|
+
}
|
|
8
|
+
export type LiteralResolver = (ref: string) => LiteralResult | null;
|
|
9
|
+
export declare function chartExXml(chart: ChartModel, resolveLiterals: LiteralResolver): string | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ShapeModel } from '../types';
|
|
2
|
+
export interface AnchorMarker {
|
|
3
|
+
col: number;
|
|
4
|
+
row: number;
|
|
5
|
+
}
|
|
6
|
+
export interface Anchor {
|
|
7
|
+
kind: 'absolute' | 'two' | 'one';
|
|
8
|
+
x?: number;
|
|
9
|
+
y?: number;
|
|
10
|
+
cx?: number;
|
|
11
|
+
cy?: number;
|
|
12
|
+
from?: AnchorMarker;
|
|
13
|
+
to?: AnchorMarker;
|
|
14
|
+
}
|
|
15
|
+
export declare function parseAnchor(anchorStr: string | null, size?: {
|
|
16
|
+
w: number;
|
|
17
|
+
h: number;
|
|
18
|
+
} | null): Anchor;
|
|
19
|
+
export declare function chartFrame(id: number, name: string, relId: string, anchor: Anchor): string;
|
|
20
|
+
export declare function pictureFrame(id: number, name: string, relId: string, anchor: Anchor, alt: string | undefined): string;
|
|
21
|
+
export declare function shapeFrame(id: number, shape: ShapeModel, anchor: Anchor, themeColors: Record<string, string>): string;
|
|
22
|
+
export declare function chartExFrame(id: number, name: string, relId: string, anchor: Anchor): string;
|
|
23
|
+
export declare function timesliceFrame(id: number, name: string, anchor: Anchor): string;
|
|
24
|
+
export declare function slicerFrame(id: number, name: string, anchor: Anchor): string;
|
|
25
|
+
export declare function drawingXml(anchors: string[]): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ParsedDocument, WorkbookModel } from '../types';
|
|
2
|
+
export declare function buildWorkbookModel(doc: ParsedDocument, { baseDir }?: {
|
|
3
|
+
baseDir?: string;
|
|
4
|
+
}): WorkbookModel;
|
|
5
|
+
export declare function translateFormula(formula: string, dr: number, dc: number): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PivotModel, Target, TableIndexEntry } from '../types';
|
|
2
|
+
type HeaderFn = (tgt: Target) => string[] | null;
|
|
3
|
+
export interface PivotParts {
|
|
4
|
+
cacheDef: string;
|
|
5
|
+
cacheRecords: string;
|
|
6
|
+
pivotTable: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PivotBuildOpts {
|
|
9
|
+
pivotId: number;
|
|
10
|
+
cacheId: number;
|
|
11
|
+
tableIndex: Map<string, TableIndexEntry>;
|
|
12
|
+
getHeaderCells: HeaderFn;
|
|
13
|
+
numFmtId: (code: string) => number;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildPivotParts(pivot: PivotModel, { cacheId, tableIndex, getHeaderCells, numFmtId }: PivotBuildOpts): PivotParts | null;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { XmlNode } from '../types';
|
|
2
|
+
export interface AnchorSpec {
|
|
3
|
+
at: string;
|
|
4
|
+
size?: {
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface DrawingAnchor {
|
|
10
|
+
kind: string;
|
|
11
|
+
el: XmlNode;
|
|
12
|
+
}
|
|
13
|
+
export type MediaLookup = (rid: string) => {
|
|
14
|
+
mime: string;
|
|
15
|
+
data: Buffer;
|
|
16
|
+
} | null;
|
|
17
|
+
export declare function anchorsOf(drawingDoc: XmlNode | null): DrawingAnchor[];
|
|
18
|
+
export declare function anchorText(anchor: DrawingAnchor): AnchorSpec;
|
|
19
|
+
export declare function reverseChart(chartDoc: XmlNode, anchorSpec: AnchorSpec): string[] | null;
|
|
20
|
+
export declare function reversePicture(pic: XmlNode, anchorSpec: AnchorSpec, mediaLookup: MediaLookup): string[] | null;
|
|
21
|
+
export declare function reverseShape(sp: XmlNode, anchorSpec: AnchorSpec): string[];
|
|
22
|
+
export declare function reversePivot(ptDoc: XmlNode, cacheDoc: XmlNode | null): string[] | null;
|
|
23
|
+
export declare function reverseSlicer(slicerEl: XmlNode, cacheDoc: XmlNode | null, tableNameById: Map<number, string | undefined>, anchorSpec: AnchorSpec | undefined): string[] | null;
|
|
24
|
+
export declare function reverseChartEx(doc: XmlNode, anchorSpec: AnchorSpec): string[] | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Meta } from '../types';
|
|
2
|
+
export interface BorderEdge {
|
|
3
|
+
style: string;
|
|
4
|
+
color: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface BorderEdges {
|
|
7
|
+
top: BorderEdge | null;
|
|
8
|
+
right: BorderEdge | null;
|
|
9
|
+
bottom: BorderEdge | null;
|
|
10
|
+
left: BorderEdge | null;
|
|
11
|
+
diagUp: BorderEdge | null;
|
|
12
|
+
diagDown: BorderEdge | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function parseBorderEdge(v: Meta, theme: Record<string, string>): BorderEdge | null;
|
|
15
|
+
export declare class StyleRegistry {
|
|
16
|
+
theme: Record<string, string>;
|
|
17
|
+
numFmts: Map<string, number>;
|
|
18
|
+
fonts: string[];
|
|
19
|
+
fontKeys: Map<string, number>;
|
|
20
|
+
fills: string[];
|
|
21
|
+
fillKeys: Map<string, number>;
|
|
22
|
+
borders: string[];
|
|
23
|
+
borderKeys: Map<string, number>;
|
|
24
|
+
xfs: string[];
|
|
25
|
+
xfKeys: Map<string, number>;
|
|
26
|
+
dxfs: string[];
|
|
27
|
+
constructor(themeColors?: Record<string, string>);
|
|
28
|
+
numFmtId(code: string): number;
|
|
29
|
+
fontXml(p: Meta): string;
|
|
30
|
+
fontId(p: Meta): number;
|
|
31
|
+
fillId(p: Meta): number;
|
|
32
|
+
borderId(edges: BorderEdges | null): number;
|
|
33
|
+
alignmentXml(p: Meta): string;
|
|
34
|
+
xfId(p: Meta, borders: BorderEdges | null): number;
|
|
35
|
+
dxfId(fmt: Meta): number;
|
|
36
|
+
toXml(): string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function isoToSerial(iso: string, dateSystem?: number): number;
|
|
2
|
+
export declare function pxToColWidth(px: number): number;
|
|
3
|
+
export declare const pxToPt: (px: number) => number;
|
|
4
|
+
export declare const cmToInch: (cm: number) => number;
|
|
5
|
+
export declare const DEFAULT_THEME: Record<string, string>;
|
|
6
|
+
export declare function resolveColor(value: unknown, themeColors?: Record<string, string>): string | null;
|
|
7
|
+
export declare const NUMFMT_ALIASES: Record<string, string>;
|
|
8
|
+
export declare const BUILTIN_NUMFMT_IDS: Map<string, number>;
|
package/dist/xml.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { XmlNode } from './types';
|
|
2
|
+
export declare function decodeEntities(s: string): string;
|
|
3
|
+
export declare function parseXml(src: string): XmlNode;
|
|
4
|
+
export declare function attr(el: XmlNode | null | undefined, name: string): string | undefined;
|
|
5
|
+
export declare const one: (el: XmlNode | null | undefined, name: string) => XmlNode | null;
|
|
6
|
+
export declare const all: (el: XmlNode | null | undefined, name: string) => XmlNode[];
|
|
7
|
+
export declare function textOf(el: XmlNode | null | undefined): string;
|
|
8
|
+
export declare function findDeep(el: XmlNode | null | undefined, name: string): XmlNode | null;
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gridmd",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GridMD reference parser, linter and two-way XLSX converter (spec: SPEC.md)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": "github:fledgling-co/gridmd",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"gridmd-lint": "dist/bin/gridmd-lint.js",
|
|
19
|
+
"gridmd2xlsx": "dist/bin/gridmd2xlsx.js",
|
|
20
|
+
"xlsx2gridmd": "dist/bin/xlsx2gridmd.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "bun run scripts/build.ts",
|
|
27
|
+
"typecheck": "tsgo -p tsconfig.json --noEmit",
|
|
28
|
+
"test": "bun test",
|
|
29
|
+
"test:coverage": "bun test --coverage",
|
|
30
|
+
"lint:example": "bun bin/gridmd-lint.ts ../examples/quarterly-report.gmd",
|
|
31
|
+
"xlsx:example": "bun bin/gridmd2xlsx.ts ../examples/quarterly-report.gmd -o ../examples/quarterly-report.xlsx",
|
|
32
|
+
"roundtrip:example": "bun bin/gridmd2xlsx.ts ../examples/quarterly-report.gmd -o ../examples/quarterly-report.xlsx && bun bin/xlsx2gridmd.ts ../examples/quarterly-report.xlsx -o ../examples/quarterly-report.roundtrip.gmd && bun bin/gridmd-lint.ts ../examples/quarterly-report.roundtrip.gmd",
|
|
33
|
+
"dump": "bun bin/gridmd-dump.ts",
|
|
34
|
+
"prepublishOnly": "bun run typecheck && bun run build && bun test",
|
|
35
|
+
"typecheck:tsc": "tsc -p tsconfig.json --noEmit"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"yaml": "^2.9.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/bun": "latest",
|
|
42
|
+
"@typescript/native-preview": "^7.0.0-dev.20260704.1",
|
|
43
|
+
"typescript": "latest"
|
|
44
|
+
}
|
|
45
|
+
}
|