@trebco/treb 29.5.0 → 29.5.2

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/treb.d.ts CHANGED
@@ -1091,24 +1091,6 @@ export interface FreezePane {
1091
1091
  rows: number;
1092
1092
  columns: number;
1093
1093
  }
1094
- export declare const StandardGradientsList: {
1095
- readonly 'red-green': {
1096
- readonly color_space: "RGB";
1097
- readonly stops: GradientStop[];
1098
- };
1099
- readonly 'red-yellow-green': {
1100
- readonly color_space: "RGB";
1101
- readonly stops: GradientStop[];
1102
- };
1103
- readonly 'green-red': {
1104
- readonly color_space: "RGB";
1105
- readonly stops: GradientStop[];
1106
- };
1107
- readonly 'green-yellow-red': {
1108
- readonly color_space: "RGB";
1109
- readonly stops: GradientStop[];
1110
- };
1111
- };
1112
1094
 
1113
1095
  /**
1114
1096
  * options for serializing data
@@ -1252,7 +1234,7 @@ export type HorizontalAlign = '' | 'left' | 'center' | 'right';
1252
1234
 
1253
1235
  /** vertical align constants for cell style */
1254
1236
  export type VerticalAlign = '' | 'top' | 'bottom' | 'middle';
1255
- export type ThemeColorType = typeof ThemeColorList[number];
1237
+ export type ThemeColorType = 'Background' | 'Text' | 'Background2' | 'Text2' | 'Accent' | 'Accent2' | 'Accent3' | 'Accent4' | 'Accent5' | 'Accent6';
1256
1238
 
1257
1239
  /**
1258
1240
  * font size for cell style. we generally prefer relative sizes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trebco/treb",
3
- "version": "29.5.0",
3
+ "version": "29.5.2",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "homepage": "https://treb.app",
6
6
  "repository": {
@@ -27,26 +27,36 @@ export type HorizontalAlign = '' | 'left' | 'center' | 'right';
27
27
  /** vertical align constants for cell style */
28
28
  export type VerticalAlign = '' | 'top' | 'bottom' | 'middle';
29
29
 
30
- const ThemeColorList = [
31
- 'Background',
32
- 'Text',
33
- 'Background2',
34
- 'Text2',
35
- 'Accent',
36
- 'Accent2',
37
- 'Accent3',
38
- 'Accent4',
39
- 'Accent5',
40
- 'Accent6',
41
- ] as const;
42
-
43
- export type ThemeColorType = typeof ThemeColorList[number];
44
-
45
- const ThemeColorMap: Record<string, number> = {};
30
+ export type ThemeColorType =
31
+ 'Background'|
32
+ 'Text'|
33
+ 'Background2'|
34
+ 'Text2'|
35
+ 'Accent'|
36
+ 'Accent2'|
37
+ 'Accent3'|
38
+ 'Accent4'|
39
+ 'Accent5'|
40
+ 'Accent6';
41
+
42
+ const ThemeColorMap: Record<string, number> = {
43
+ 'Background': 0,
44
+ 'Text': 1,
45
+ 'Background2': 2,
46
+ 'Text2': 3,
47
+ 'Accent': 4,
48
+ 'Accent2': 5,
49
+ 'Accent3': 6,
50
+ 'Accent4': 7,
51
+ 'Accent5': 8,
52
+ 'Accent6': 9,
53
+ };
46
54
 
55
+ /*
47
56
  for (const [index, entry] of ThemeColorList.entries()) {
48
57
  ThemeColorMap[entry] = index;
49
58
  }
59
+ */
50
60
 
51
61
  export const ThemeColorIndex = (color: ThemeColor) => {
52
62
  if (typeof color.theme === 'number') {
@@ -67,7 +67,14 @@ export interface ConditionalFormatGradientOptions {
67
67
 
68
68
  }
69
69
 
70
-
70
+ /**
71
+ * @internal
72
+ *
73
+ * @privateRemarks
74
+ *
75
+ * this is marked internal temporarily while I figure out why our API
76
+ * generator is not exporting the gradient stop type
77
+ */
71
78
  export const StandardGradientsList = {
72
79
  'red-green': {
73
80
  color_space: 'RGB',
@@ -296,7 +296,7 @@ export class Exporter {
296
296
  if (edge.rgba) {
297
297
  return { rgb: edge.rgba };
298
298
  }
299
- if (edge.theme) {
299
+ if (typeof edge.theme !== 'undefined') {
300
300
  return {
301
301
  theme: edge.theme,
302
302
  tint: edge.tint,
@@ -393,6 +393,8 @@ export class Exporter {
393
393
 
394
394
  };
395
395
 
396
+ // console.info({style_cache});
397
+
396
398
  const fonts: DOMContent[] = style_cache.fonts.map(font => {
397
399
 
398
400
  return {
@@ -413,7 +415,7 @@ export class Exporter {
413
415
 
414
416
  color: font.color_argb ? {
415
417
  a$: { rgb: font.color_argb },
416
- } : font.color_theme ? {
418
+ } : (typeof font.color_theme !== 'undefined') ? {
417
419
  a$: {
418
420
  theme: font.color_theme,
419
421
  tint: font.color_tint,
@@ -501,6 +503,8 @@ export class Exporter {
501
503
  };
502
504
 
503
505
  const xml = XMLDeclaration + this.xmlbuilder1.build(dom);
506
+ // console.info(xml);
507
+
504
508
  this.zip?.Set('xl/styles.xml', xml);
505
509
 
506
510
  }
@@ -274,6 +274,10 @@ export class StyleCache {
274
274
  symbolic_name: composite.number_format, // for reference later
275
275
  };
276
276
 
277
+ if (/Scientific/i.test(composite.number_format)) {
278
+ options.number_format.format = '0.00E+00'
279
+ }
280
+
277
281
  }
278
282
 
279
283
 
@@ -305,6 +309,7 @@ export class StyleCache {
305
309
  //}
306
310
 
307
311
  if (composite.text) {
312
+
308
313
  if (IsHTMLColor(composite.text)) {
309
314
  font.color_argb = composite.text.text;
310
315
  }