svg-table 0.0.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.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/d3types.ts +17 -0
  4. package/dist/d3types.d.ts +12 -0
  5. package/dist/d3types.d.ts.map +1 -0
  6. package/dist/d3types.js +3 -0
  7. package/dist/d3types.js.map +1 -0
  8. package/dist/index.d.ts +10 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +36 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/stylings.d.ts +206 -0
  13. package/dist/stylings.d.ts.map +1 -0
  14. package/dist/stylings.js +123 -0
  15. package/dist/stylings.js.map +1 -0
  16. package/dist/tableData.d.ts +168 -0
  17. package/dist/tableData.d.ts.map +1 -0
  18. package/dist/tableData.js +329 -0
  19. package/dist/tableData.js.map +1 -0
  20. package/dist/tableData.test.d.ts +2 -0
  21. package/dist/tableData.test.d.ts.map +1 -0
  22. package/dist/tableData.test.js +259 -0
  23. package/dist/tableData.test.js.map +1 -0
  24. package/dist/tableFormatter.d.ts +179 -0
  25. package/dist/tableFormatter.d.ts.map +1 -0
  26. package/dist/tableFormatter.js +298 -0
  27. package/dist/tableFormatter.js.map +1 -0
  28. package/dist/tableFormatter.test.d.ts +2 -0
  29. package/dist/tableFormatter.test.d.ts.map +1 -0
  30. package/dist/tableFormatter.test.js +101 -0
  31. package/dist/tableFormatter.test.js.map +1 -0
  32. package/dist/tableStyler.d.ts +310 -0
  33. package/dist/tableStyler.d.ts.map +1 -0
  34. package/dist/tableStyler.js +665 -0
  35. package/dist/tableStyler.js.map +1 -0
  36. package/dist/tableStyler.test.d.ts +2 -0
  37. package/dist/tableStyler.test.d.ts.map +1 -0
  38. package/dist/tableStyler.test.js +225 -0
  39. package/dist/tableStyler.test.js.map +1 -0
  40. package/dist/tableSvg.d.ts +41 -0
  41. package/dist/tableSvg.d.ts.map +1 -0
  42. package/dist/tableSvg.js +634 -0
  43. package/dist/tableSvg.js.map +1 -0
  44. package/dist/tableUtils.d.ts +14 -0
  45. package/dist/tableUtils.d.ts.map +1 -0
  46. package/dist/tableUtils.js +18 -0
  47. package/dist/tableUtils.js.map +1 -0
  48. package/eslint.config.js +23 -0
  49. package/index.ts +82 -0
  50. package/jest.config.js +5 -0
  51. package/package.json +44 -0
  52. package/stylings.ts +311 -0
  53. package/svg-table-0.0.1-snapshot.tgz +0 -0
  54. package/tableData.test.ts +290 -0
  55. package/tableData.ts +359 -0
  56. package/tableFormatter.test.ts +122 -0
  57. package/tableFormatter.ts +306 -0
  58. package/tableStyler.test.ts +268 -0
  59. package/tableStyler.ts +798 -0
  60. package/tableSvg.ts +820 -0
  61. package/tableUtils.ts +20 -0
  62. package/tsconfig.json +102 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableFormatter.test.js","sourceRoot":"","sources":["../tableFormatter.test.ts"],"names":[],"mappings":";;AAAA,yCAAsC;AACtC,+CAAuC;AACvC,mDAAkE;AAGlE,QAAQ,CAAC,uCAAuC,EAAE;IAC9C,SAAS,WAAW,CAAC,GAAW,EAAE,IAAY;QAC1C,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,IAAM,IAAI,GAAG,yBAAS,CAAC,IAAI,CAAyB;QAChD,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAChD,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;QAChD,CAAC,WAAW,CAAC,C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AAC,KAAgB,CAAC,WAAW,EAAE,EAA/B,CAA+B,CAAC,EAAlE,CAAkE,CAAC;YAClF,yDAAyD;aACxD,OAAO,CAAC,UAAA,EAAE,IAAI,OAAA,EAAE,CAAC,WAAW,EAAE,EAAhB,CAAgB,CAAC,EARd,CAQc,CACnC,CAAA;QAEL,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAA;QAClC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CACxB,mfAIX,CACQ,CAAA;IACL,CAAC,CAAC,CAAA;AAEN,CAAC,CAAC,CAAA"}
@@ -0,0 +1,310 @@
1
+ import { TableData } from "./tableData";
2
+ import { DataFrame } from "data-frame-ts";
3
+ import { type Result } from "result-fn";
4
+ import { type Background, type Border, type CellStyle, type ColumnHeaderStyle, type ColumnStyle, type Dimension, type FooterStyle, type Padding, type RowHeaderStyle, type RowStyle, type Styling, type TableFont, type TableStylerProps, Margin } from "./stylings";
5
+ /**
6
+ * Represents a table with applied styles.
7
+ * Provides methods to access the styling information for different parts of the table.
8
+ */
9
+ export declare class StyledTable<V> {
10
+ private readonly dataFrame;
11
+ private readonly font;
12
+ private readonly border;
13
+ private readonly background;
14
+ private readonly dimension;
15
+ private readonly padding;
16
+ private readonly margin;
17
+ /**
18
+ * Creates a new StyledTable instance.
19
+ * @param dataFrame The data frame containing the table data
20
+ * @param font The font settings for the table
21
+ * @param border The border settings for the table
22
+ * @param background The background settings for the table
23
+ * @param dimension The dimension settings for the table
24
+ * @param padding The padding settings for the table
25
+ * @param margin The margin settings for the table
26
+ */
27
+ constructor(dataFrame: DataFrame<V>, font: TableFont, border: Border, background: Background, dimension: Pick<Dimension, "width" | "height">, padding: Padding, margin: Margin);
28
+ /**
29
+ * @return A copy of the {@link DataFrame} with all the styling and formatting tags
30
+ */
31
+ data(): DataFrame<V>;
32
+ tableData(): TableData<V>;
33
+ /**
34
+ * Returns the font settings for the table.
35
+ * @returns A copy of the table's font settings
36
+ */
37
+ tableFont(): TableFont;
38
+ /**
39
+ * Returns the border settings for the table.
40
+ * @returns A copy of the table's border settings
41
+ */
42
+ tableBorder(): Border;
43
+ /**
44
+ * Returns the background settings for the table.
45
+ * @returns A copy of the table's background settings
46
+ */
47
+ tableBackground(): Background;
48
+ /**
49
+ * Returns the dimension settings for the table.
50
+ * @returns A copy of the table's dimension settings
51
+ */
52
+ tableDimensions(): Pick<Dimension, "width" | "height">;
53
+ /**
54
+ * Returns the padding settings for the table.
55
+ * @returns A copy of the table's padding settings
56
+ */
57
+ tablePadding(): Padding;
58
+ /**
59
+ * Returns the margin settings for the table.
60
+ * @returns A copy of the table's margin settings
61
+ */
62
+ tableMargin(): Margin;
63
+ /**
64
+ * Retrieves styling tags for a specific column.
65
+ * @param columnIndex The index of the column
66
+ * @param tagStyleType The type of style tag to retrieve
67
+ * @returns A Result containing the tag if found, or an error message
68
+ * @private
69
+ */
70
+ private columnTagsFor;
71
+ /**
72
+ * Retrieves styling tags for a specific row.
73
+ * @param rowIndex The index of the row
74
+ * @param tagStyleType The type of style tag to retrieve (can be more than one)
75
+ * @returns A Result containing the tag if found, or an error message
76
+ * @private
77
+ */
78
+ private rowTagsFor;
79
+ hasRowHeader(): boolean;
80
+ hasColumnHeader(): boolean;
81
+ hasFooter(): boolean;
82
+ /**
83
+ * Gets the style for the row header.
84
+ * @returns A Result containing the row header style if found, or an error message
85
+ */
86
+ rowHeaderStyle(): Result<Styling<RowHeaderStyle>, string>;
87
+ /**
88
+ * Gets the style for the column header.
89
+ * @returns A Result containing the column header style if found, or an error message
90
+ */
91
+ columnHeaderStyle(): Result<Styling<ColumnHeaderStyle>, string>;
92
+ footerStyle(): Result<Styling<FooterStyle>, string>;
93
+ /**
94
+ * Gets the style for a specific row.
95
+ * @param rowIndex The index of the row
96
+ * @returns A Result containing the row style if found, or an error message
97
+ */
98
+ rowStyleFor(rowIndex: number): Result<Styling<RowStyle>, string>;
99
+ /**
100
+ * Gets the style for a specific column.
101
+ * @param columnIndex The index of the column
102
+ * @returns A Result containing the column style if found, or an error message
103
+ */
104
+ columnStyleFor(columnIndex: number): Result<Styling<ColumnStyle>, string>;
105
+ /**
106
+ * Gets the style for a specific cell.
107
+ * @param rowIndex The row index of the cell
108
+ * @param columnIndex The column index of the cell
109
+ * @returns A Result containing the cell style if found, or an error message
110
+ */
111
+ cellStyleFor(rowIndex: number, columnIndex: number): Result<Styling<CellStyle>, string>;
112
+ /**
113
+ * Unlike the methods that retrieve the particular styles, say for a cell, a column header,
114
+ * and so forth, this method returns a {@link CellStyle} calculated from all the styles
115
+ * that apply to the specified cell by using the style properties with the highest priority.
116
+ * <p>
117
+ * Retrieves the styles to be applied to a specific data cell in the table. This method
118
+ * accounts for column headers, row headers, and footers. For example, regardless of whether the
119
+ * table has a column header, a row index of 0 refers to the first row of data. And
120
+ * regardless of whether the table has a row header, a column index of 0 refers to the
121
+ * first column of data.
122
+ *
123
+ * @param rowIndex - The index of the row in the table data for which styles are required.
124
+ * Must be within the valid row index range.
125
+ * @param columnIndex - The index of the column in the table data for which styles are required.
126
+ * Must be within the valid column index range.
127
+ * @return A result object containing the cell style if the indices are valid, or an error
128
+ * message if they are not.
129
+ */
130
+ stylesForDataCoordinates(rowIndex: number, columnIndex: number): Result<CellStyle, string>;
131
+ /**
132
+ * Unlike the methods that retrieve the particular styles, say for a cell, a column header,
133
+ * and so forth, this method returns a {@link CellStyle} calculated from all the styles
134
+ * that apply to the specified cell by using the style properties with the highest priority.
135
+ * <p>
136
+ * Calculates the style for the cell based on the styles applied to the table and their
137
+ * relative priority. The row and column indexes refer to the entire table and do not account
138
+ * for column headers, row headers, or footers.
139
+ * @param rowIndex The index of the row in the entire table. For example, if the table has column
140
+ * headers, then a rowIndex of 0 would be that column header.
141
+ * @param columnIndex The index of the column in the entire table. For example, if the table has
142
+ * row headers, then a column index of 0 would be the row header
143
+ * @return A {@link Result} holding the {@link CellStyle}; or a failure {@link Result} if the
144
+ * row or column indexes are out of range.
145
+ * @see stylesForDataCoordinates
146
+ */
147
+ stylesForTableCoordinates(rowIndex: number, columnIndex: number): Result<CellStyle, string>;
148
+ }
149
+ /**
150
+ * Builder class for creating styled tables.
151
+ * Provides methods to configure various styling aspects of a table.
152
+ */
153
+ export declare class TableStyler<V> {
154
+ private dataFrame;
155
+ private font;
156
+ private border;
157
+ private background;
158
+ private dimension;
159
+ private padding;
160
+ private margin;
161
+ private readonly errors;
162
+ /**
163
+ * Private constructor to enforce factory method usage.
164
+ * @param dataFrame The data frame containing the table data
165
+ * @param font The font settings for the table
166
+ * @param border The border settings for the table
167
+ * @param background The background settings for the table
168
+ * @param dimension The dimension settings for the table
169
+ * @param padding The padding settings for the table
170
+ * @param margin The margin settings for the table
171
+ * @param errors Array to collect error messages during styling operations
172
+ */
173
+ private constructor();
174
+ /**
175
+ * Creates a TableStyler from a TableData object.
176
+ * @param tableData The TableData object to style
177
+ * @returns A new TableStyler instance
178
+ */
179
+ static fromTableData<V>(tableData: TableData<V>): TableStyler<V>;
180
+ /**
181
+ * Creates a TableStyler from a DataFrame object.
182
+ * @param dataFrame The DataFrame object to style
183
+ * @returns A new TableStyler instance
184
+ */
185
+ static fromDataFrame<V>(dataFrame: DataFrame<V>): TableStyler<V>;
186
+ /**
187
+ * Creates a copy of this TableStyler instance.
188
+ * @returns A new TableStyler instance with the same properties
189
+ */
190
+ copy(): TableStyler<V>;
191
+ /**
192
+ * Creates a new TableStyler with updated properties.
193
+ * @param properties Partial properties to update
194
+ * @returns A new TableStyler instance with updated properties
195
+ */
196
+ update(properties: Partial<TableStylerProps<V>>): TableStyler<V>;
197
+ withTableFont(font: Partial<TableFont>): TableStyler<V>;
198
+ /**
199
+ * Sets the background for the table.
200
+ * @param background The background settings to apply
201
+ * @returns A new TableStyler instance with the updated background
202
+ */
203
+ withTableBackground(background: Partial<Background>): TableStyler<V>;
204
+ /**
205
+ * Sets the border for the table.
206
+ * @param border The border settings to apply
207
+ * @returns A new TableStyler instance with the updated border
208
+ */
209
+ withBorder(border: Partial<Border>): TableStyler<V>;
210
+ /**
211
+ * Sets the dimensions for the table.
212
+ * @param width The width of the table
213
+ * @param height The height of the table
214
+ * @returns A new TableStyler instance with the updated dimensions
215
+ */
216
+ withDimensions(width: number, height: number): TableStyler<V>;
217
+ /**
218
+ * Sets the padding for the table.
219
+ * @param padding The padding settings to apply
220
+ * @returns A new TableStyler instance with the updated padding
221
+ */
222
+ withPadding(padding: Partial<Padding>): TableStyler<V>;
223
+ /**
224
+ * Sets the margin for the table.
225
+ * @param margin The margin settings to apply
226
+ * @returns A new TableStyler instance with the updated margin
227
+ */
228
+ withMargin(margin: Partial<Margin>): TableStyler<V>;
229
+ /**
230
+ * Tags a row with a style.
231
+ * @param rowIndex The index of the row to tag
232
+ * @param tagStyleType The type of style to apply
233
+ * @param style The style value to apply
234
+ * @returns A Result containing a new TableStyler with the tagged row, or an error message
235
+ * @private
236
+ */
237
+ private tagRow;
238
+ /**
239
+ * Tags a column with a style.
240
+ * @param columnIndex The index of the column to tag
241
+ * @param tagStyleType The type of style to apply
242
+ * @param style The style value to apply
243
+ * @returns A Result containing a new TableStyler with the tagged column, or an error message
244
+ * @private
245
+ */
246
+ private tagColumn;
247
+ /**
248
+ * Sets the style for the column header row.
249
+ * @param columnHeaderStyle The style to apply to the column header. Style properties that are not specified
250
+ * will be set to their default values.
251
+ * @param priority The priority of this style (higher values take precedence)
252
+ * @returns A new TableStyler instance with the column header style applied
253
+ */
254
+ withColumnHeaderStyle(columnHeaderStyle?: Partial<ColumnHeaderStyle>, priority?: number): TableStyler<V>;
255
+ /**
256
+ * Sets the style for the row header column.
257
+ * @param rowHeaderStyle The style to apply to the row header. Style properties that are not specified
258
+ * will be set to their default values.
259
+ * @param priority The priority of this style (higher values take precedence)
260
+ * @returns A new TableStyler instance with the row header style applied
261
+ */
262
+ withRowHeaderStyle(rowHeaderStyle: Partial<RowHeaderStyle>, priority?: number): TableStyler<V>;
263
+ /**
264
+ * Sets the style for the footer row.
265
+ * @param footerStyle The style to apply to the footer. Style properties that are not specified
266
+ * will be set to their default values.
267
+ * @param priority The priority of this style (higher values take precedence)
268
+ * @returns A new TableStyler instance with the footer style applied
269
+ */
270
+ withFooterStyle(footerStyle: Partial<FooterStyle>, priority?: number): TableStyler<V>;
271
+ /**
272
+ * Sets the style for a specific row.
273
+ * @param rowIndex The index of the row to style
274
+ * @param rowStyle The style to apply to the row. Style properties that are not specified
275
+ * will be set to their default values.
276
+ * @param priority The priority of this style (higher values take precedence)
277
+ * @returns A new TableStyler instance with the row style applied
278
+ */
279
+ withRowStyle(rowIndex: number, rowStyle: Partial<RowStyle>, priority?: number): TableStyler<V>;
280
+ withRowStyles(rowIndexes: Array<number>, rowStyle: Partial<RowStyle>, priority?: number): TableStyler<V>;
281
+ private static withRowStyles;
282
+ /**
283
+ * Sets the style for a specific column.
284
+ * @param columnIndex The index of the column to style
285
+ * @param columnStyle The style to apply to the column. Style properties that are not specified
286
+ * will be set to their default values.
287
+ * @param priority The priority of this style (higher values take precedence)
288
+ * @returns A new TableStyler instance with the column style applied
289
+ */
290
+ withColumnStyle(columnIndex: number, columnStyle: Partial<ColumnStyle>, priority?: number): TableStyler<V>;
291
+ withColumnStyles(columnIndexes: Array<number>, columnStyle: Partial<ColumnStyle>, priority?: number): TableStyler<V>;
292
+ private static withColumnStyles;
293
+ /**
294
+ * Sets the style for a specific cell.
295
+ * @param rowIndex The row index of the cell to style
296
+ * @param columnIndex The column index of the cell to style
297
+ * @param cellStyle The style to apply to the cell. Style properties that are not specified
298
+ * will be set to their default values.
299
+ * @param priority The priority of this style (higher values take precedence)
300
+ * @returns A new TableStyler instance with the cell style applied
301
+ */
302
+ withCellStyle(rowIndex: number, columnIndex: number, cellStyle: Partial<CellStyle>, priority?: number): TableStyler<V>;
303
+ withCellStyleWhen(predicate: (value: V, rowIndex: number, columnIndex: number) => boolean, cellStyle: Partial<CellStyle>, priority?: number): TableStyler<V>;
304
+ /**
305
+ * Finalizes the styling process and creates a StyledTable instance.
306
+ * @returns A StyledTable instance with all the applied styles
307
+ */
308
+ styleTable(): StyledTable<V>;
309
+ }
310
+ //# sourceMappingURL=tableStyler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableStyler.d.ts","sourceRoot":"","sources":["../tableStyler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAmC,SAAS,EAAyC,MAAM,eAAe,CAAC;AAClH,OAAO,EAAgB,KAAK,MAAM,EAAgB,MAAM,WAAW,CAAC;AACpE,OAAO,EACH,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAYhB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,OAAO,EAGZ,KAAK,SAAS,EACd,KAAK,gBAAgB,EACU,MAAM,EACxC,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,qBAAa,WAAW,CAAC,CAAC;IAalB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAjB3B;;;;;;;;;OASG;gBAEkB,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC,EAC9C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM;IAInC;;OAEG;IACH,IAAI,IAAI,SAAS,CAAC,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