@trebco/treb 23.6.5 → 25.0.0-rc1

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 (217) hide show
  1. package/.eslintignore +8 -0
  2. package/.eslintrc.js +164 -0
  3. package/README-shadow-DOM.md +88 -0
  4. package/README.md +37 -130
  5. package/api-config.json +29 -0
  6. package/api-generator/api-generator-types.ts +82 -0
  7. package/api-generator/api-generator.ts +1172 -0
  8. package/api-generator/package.json +3 -0
  9. package/build/treb-spreadsheet.mjs +14 -0
  10. package/{treb.d.ts → build/treb.d.ts} +285 -269
  11. package/esbuild-custom-element.mjs +336 -0
  12. package/esbuild.js +305 -0
  13. package/package.json +43 -14
  14. package/treb-base-types/package.json +5 -0
  15. package/treb-base-types/src/api_types.ts +36 -0
  16. package/treb-base-types/src/area.ts +583 -0
  17. package/treb-base-types/src/basic_types.ts +45 -0
  18. package/treb-base-types/src/cell.ts +612 -0
  19. package/treb-base-types/src/cells.ts +1066 -0
  20. package/treb-base-types/src/color.ts +124 -0
  21. package/treb-base-types/src/import.ts +71 -0
  22. package/treb-base-types/src/index-standalone.ts +29 -0
  23. package/treb-base-types/src/index.ts +42 -0
  24. package/treb-base-types/src/layout.ts +47 -0
  25. package/treb-base-types/src/localization.ts +187 -0
  26. package/treb-base-types/src/rectangle.ts +145 -0
  27. package/treb-base-types/src/render_text.ts +72 -0
  28. package/treb-base-types/src/style.ts +545 -0
  29. package/treb-base-types/src/table.ts +109 -0
  30. package/treb-base-types/src/text_part.ts +54 -0
  31. package/treb-base-types/src/theme.ts +608 -0
  32. package/treb-base-types/src/union.ts +152 -0
  33. package/treb-base-types/src/value-type.ts +164 -0
  34. package/treb-base-types/style/resizable.css +59 -0
  35. package/treb-calculator/modern.tsconfig.json +11 -0
  36. package/treb-calculator/package.json +5 -0
  37. package/treb-calculator/src/calculator.ts +2546 -0
  38. package/treb-calculator/src/complex-math.ts +558 -0
  39. package/treb-calculator/src/dag/array-vertex.ts +198 -0
  40. package/treb-calculator/src/dag/graph.ts +951 -0
  41. package/treb-calculator/src/dag/leaf_vertex.ts +118 -0
  42. package/treb-calculator/src/dag/spreadsheet_vertex.ts +327 -0
  43. package/treb-calculator/src/dag/spreadsheet_vertex_base.ts +44 -0
  44. package/treb-calculator/src/dag/vertex.ts +352 -0
  45. package/treb-calculator/src/descriptors.ts +162 -0
  46. package/treb-calculator/src/expression-calculator.ts +1069 -0
  47. package/treb-calculator/src/function-error.ts +103 -0
  48. package/treb-calculator/src/function-library.ts +103 -0
  49. package/treb-calculator/src/functions/base-functions.ts +1214 -0
  50. package/treb-calculator/src/functions/checkbox.ts +164 -0
  51. package/treb-calculator/src/functions/complex-functions.ts +253 -0
  52. package/treb-calculator/src/functions/finance-functions.ts +399 -0
  53. package/treb-calculator/src/functions/information-functions.ts +102 -0
  54. package/treb-calculator/src/functions/matrix-functions.ts +182 -0
  55. package/treb-calculator/src/functions/sparkline.ts +335 -0
  56. package/treb-calculator/src/functions/statistics-functions.ts +350 -0
  57. package/treb-calculator/src/functions/text-functions.ts +298 -0
  58. package/treb-calculator/src/index.ts +27 -0
  59. package/treb-calculator/src/notifier-types.ts +59 -0
  60. package/treb-calculator/src/primitives.ts +428 -0
  61. package/treb-calculator/src/utilities.ts +305 -0
  62. package/treb-charts/package.json +5 -0
  63. package/treb-charts/src/chart-functions.ts +156 -0
  64. package/treb-charts/src/chart-types.ts +230 -0
  65. package/treb-charts/src/chart.ts +1288 -0
  66. package/treb-charts/src/index.ts +24 -0
  67. package/treb-charts/src/main.ts +37 -0
  68. package/treb-charts/src/rectangle.ts +52 -0
  69. package/treb-charts/src/renderer.ts +1841 -0
  70. package/treb-charts/src/util.ts +122 -0
  71. package/treb-charts/style/charts.scss +221 -0
  72. package/treb-charts/style/old-charts.scss +250 -0
  73. package/treb-embed/markup/layout.html +137 -0
  74. package/treb-embed/markup/toolbar.html +175 -0
  75. package/treb-embed/modern.tsconfig.json +25 -0
  76. package/treb-embed/src/custom-element/content-types.d.ts +18 -0
  77. package/treb-embed/src/custom-element/global.d.ts +11 -0
  78. package/treb-embed/src/custom-element/spreadsheet-constructor.ts +1227 -0
  79. package/treb-embed/src/custom-element/treb-global.ts +44 -0
  80. package/treb-embed/src/custom-element/treb-spreadsheet-element.ts +52 -0
  81. package/treb-embed/src/embedded-spreadsheet.ts +5362 -0
  82. package/treb-embed/src/index.ts +16 -0
  83. package/treb-embed/src/language-model.ts +41 -0
  84. package/treb-embed/src/options.ts +320 -0
  85. package/treb-embed/src/progress-dialog.ts +228 -0
  86. package/treb-embed/src/selection-state.ts +16 -0
  87. package/treb-embed/src/spinner.ts +42 -0
  88. package/treb-embed/src/toolbar-message.ts +96 -0
  89. package/treb-embed/src/types.ts +167 -0
  90. package/treb-embed/style/autocomplete.scss +103 -0
  91. package/treb-embed/style/dark-theme.scss +114 -0
  92. package/treb-embed/style/defaults.scss +36 -0
  93. package/treb-embed/style/dialog.scss +181 -0
  94. package/treb-embed/style/dropdown-select.scss +101 -0
  95. package/treb-embed/style/formula-bar.scss +193 -0
  96. package/treb-embed/style/grid.scss +374 -0
  97. package/treb-embed/style/layout.scss +424 -0
  98. package/treb-embed/style/mouse-mask.scss +67 -0
  99. package/treb-embed/style/note.scss +92 -0
  100. package/treb-embed/style/overlay-editor.scss +102 -0
  101. package/treb-embed/style/spinner.scss +92 -0
  102. package/treb-embed/style/tab-bar.scss +228 -0
  103. package/treb-embed/style/table.scss +80 -0
  104. package/treb-embed/style/theme-defaults.scss +444 -0
  105. package/treb-embed/style/toolbar.scss +416 -0
  106. package/treb-embed/style/tooltip.scss +68 -0
  107. package/treb-embed/style/treb-icons.scss +130 -0
  108. package/treb-embed/style/treb-spreadsheet-element.scss +20 -0
  109. package/treb-embed/style/z-index.scss +43 -0
  110. package/treb-export/docs/charts.md +68 -0
  111. package/treb-export/modern.tsconfig.json +19 -0
  112. package/treb-export/package.json +4 -0
  113. package/treb-export/src/address-type.ts +77 -0
  114. package/treb-export/src/base-template.ts +22 -0
  115. package/treb-export/src/column-width.ts +85 -0
  116. package/treb-export/src/drawing2/chart-template-components2.ts +389 -0
  117. package/treb-export/src/drawing2/chart2.ts +282 -0
  118. package/treb-export/src/drawing2/column-chart-template2.ts +521 -0
  119. package/treb-export/src/drawing2/donut-chart-template2.ts +296 -0
  120. package/treb-export/src/drawing2/drawing2.ts +355 -0
  121. package/treb-export/src/drawing2/embedded-image.ts +71 -0
  122. package/treb-export/src/drawing2/scatter-chart-template2.ts +555 -0
  123. package/treb-export/src/export-worker/export-worker.ts +99 -0
  124. package/treb-export/src/export-worker/index-modern.ts +22 -0
  125. package/treb-export/src/export2.ts +2204 -0
  126. package/treb-export/src/import2.ts +882 -0
  127. package/treb-export/src/relationship.ts +36 -0
  128. package/treb-export/src/shared-strings2.ts +128 -0
  129. package/treb-export/src/template-2.ts +22 -0
  130. package/treb-export/src/unescape_xml.ts +47 -0
  131. package/treb-export/src/workbook-sheet2.ts +182 -0
  132. package/treb-export/src/workbook-style2.ts +1285 -0
  133. package/treb-export/src/workbook-theme2.ts +88 -0
  134. package/treb-export/src/workbook2.ts +491 -0
  135. package/treb-export/src/xml-utils.ts +201 -0
  136. package/treb-export/template/base/[Content_Types].xml +2 -0
  137. package/treb-export/template/base/_rels/.rels +2 -0
  138. package/treb-export/template/base/docProps/app.xml +2 -0
  139. package/treb-export/template/base/docProps/core.xml +12 -0
  140. package/treb-export/template/base/xl/_rels/workbook.xml.rels +2 -0
  141. package/treb-export/template/base/xl/sharedStrings.xml +2 -0
  142. package/treb-export/template/base/xl/styles.xml +2 -0
  143. package/treb-export/template/base/xl/theme/theme1.xml +2 -0
  144. package/treb-export/template/base/xl/workbook.xml +2 -0
  145. package/treb-export/template/base/xl/worksheets/sheet1.xml +2 -0
  146. package/treb-export/template/base.xlsx +0 -0
  147. package/treb-format/package.json +8 -0
  148. package/treb-format/src/format.test.ts +213 -0
  149. package/treb-format/src/format.ts +942 -0
  150. package/treb-format/src/format_cache.ts +199 -0
  151. package/treb-format/src/format_parser.ts +723 -0
  152. package/treb-format/src/index.ts +25 -0
  153. package/treb-format/src/number_format_section.ts +100 -0
  154. package/treb-format/src/value_parser.ts +337 -0
  155. package/treb-grid/package.json +5 -0
  156. package/treb-grid/src/editors/autocomplete.ts +394 -0
  157. package/treb-grid/src/editors/autocomplete_matcher.ts +260 -0
  158. package/treb-grid/src/editors/formula_bar.ts +473 -0
  159. package/treb-grid/src/editors/formula_editor_base.ts +910 -0
  160. package/treb-grid/src/editors/overlay_editor.ts +511 -0
  161. package/treb-grid/src/index.ts +37 -0
  162. package/treb-grid/src/layout/base_layout.ts +2618 -0
  163. package/treb-grid/src/layout/grid_layout.ts +299 -0
  164. package/treb-grid/src/layout/rectangle_cache.ts +86 -0
  165. package/treb-grid/src/render/selection-renderer.ts +414 -0
  166. package/treb-grid/src/render/svg_header_overlay.ts +93 -0
  167. package/treb-grid/src/render/svg_selection_block.ts +187 -0
  168. package/treb-grid/src/render/tile_renderer.ts +2122 -0
  169. package/treb-grid/src/types/annotation.ts +216 -0
  170. package/treb-grid/src/types/border_constants.ts +34 -0
  171. package/treb-grid/src/types/clipboard_data.ts +31 -0
  172. package/treb-grid/src/types/data_model.ts +334 -0
  173. package/treb-grid/src/types/drag_mask.ts +81 -0
  174. package/treb-grid/src/types/grid.ts +7743 -0
  175. package/treb-grid/src/types/grid_base.ts +3644 -0
  176. package/treb-grid/src/types/grid_command.ts +470 -0
  177. package/treb-grid/src/types/grid_events.ts +124 -0
  178. package/treb-grid/src/types/grid_options.ts +97 -0
  179. package/treb-grid/src/types/grid_selection.ts +60 -0
  180. package/treb-grid/src/types/named_range.ts +369 -0
  181. package/treb-grid/src/types/scale-control.ts +202 -0
  182. package/treb-grid/src/types/serialize_options.ts +72 -0
  183. package/treb-grid/src/types/set_range_options.ts +52 -0
  184. package/treb-grid/src/types/sheet.ts +3099 -0
  185. package/treb-grid/src/types/sheet_types.ts +95 -0
  186. package/treb-grid/src/types/tab_bar.ts +464 -0
  187. package/treb-grid/src/types/tile.ts +59 -0
  188. package/treb-grid/src/types/update_flags.ts +75 -0
  189. package/treb-grid/src/util/dom_utilities.ts +44 -0
  190. package/treb-grid/src/util/fontmetrics2.ts +179 -0
  191. package/treb-grid/src/util/ua.ts +104 -0
  192. package/treb-logo.svg +18 -0
  193. package/treb-parser/package.json +5 -0
  194. package/treb-parser/src/csv-parser.ts +122 -0
  195. package/treb-parser/src/index.ts +25 -0
  196. package/treb-parser/src/md-parser.ts +526 -0
  197. package/treb-parser/src/parser-types.ts +397 -0
  198. package/treb-parser/src/parser.test.ts +298 -0
  199. package/treb-parser/src/parser.ts +2673 -0
  200. package/treb-utils/package.json +5 -0
  201. package/treb-utils/src/dispatch.ts +57 -0
  202. package/treb-utils/src/event_source.ts +147 -0
  203. package/treb-utils/src/ievent_source.ts +33 -0
  204. package/treb-utils/src/index.ts +31 -0
  205. package/treb-utils/src/measurement.ts +174 -0
  206. package/treb-utils/src/resizable.ts +160 -0
  207. package/treb-utils/src/scale.ts +137 -0
  208. package/treb-utils/src/serialize_html.ts +124 -0
  209. package/treb-utils/src/template.ts +70 -0
  210. package/treb-utils/src/validate_uri.ts +61 -0
  211. package/tsconfig.json +10 -0
  212. package/tsproject.json +30 -0
  213. package/util/license-plugin-esbuild.js +86 -0
  214. package/util/list-css-vars.sh +46 -0
  215. package/README-esm.md +0 -37
  216. package/treb-bundle.css +0 -2
  217. package/treb-bundle.mjs +0 -15
@@ -0,0 +1,122 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ import { RangeScale, Scale } from 'treb-utils';
23
+
24
+ /* * calculated human-friendly scale for rendering axes * /
25
+ export interface RangeScale {
26
+ scale: number;
27
+ step: number;
28
+ count: number;
29
+ min: number;
30
+ max: number;
31
+ }
32
+ */
33
+
34
+ export class Util {
35
+
36
+ /**
37
+ * given a passed range, find the best scale range. count is just a
38
+ * suggestion -- we try to get as close as possible.
39
+ */
40
+ public static Scale(min: number, max: number, count = 6.5): RangeScale {
41
+
42
+ /*
43
+ const range = max - min;
44
+ const log10 = // Math.log10(range);
45
+ Math.log(range) / Math.log(10); // just avoid the problem
46
+
47
+ const scale = Math.floor(Math.abs(log10)) * (log10 < 0 ? -1 : 1) - 1;
48
+ const steps = [.1, .25, .5, 1, 2.5, 5, 10, 25, 100];
49
+
50
+ let step = -1;
51
+ let delta = 0;
52
+
53
+ for (const x of steps) {
54
+ const test_step = x * Math.pow(10, scale);
55
+ const test_min = Math.floor(min / test_step) * test_step;
56
+ const test_max = Math.ceil(max / test_step) * test_step;
57
+ const test_count = (test_max - test_min) / test_step;
58
+ const test_delta = Math.abs(test_count - count);
59
+
60
+ if (step < 0 || test_delta < delta){
61
+ delta = test_delta;
62
+ step = test_step;
63
+ }
64
+ else if (step >= 0 && test_delta > delta) break;
65
+ }
66
+
67
+ min = Math.floor(min / step) * step;
68
+ max = Math.ceil(max / step) * step;
69
+ count = Math.round((max - min) / step); // accounts for fp errors
70
+
71
+ return { scale, step, count, min, max };
72
+ */
73
+ return Scale(min, max, count);
74
+
75
+ }
76
+
77
+ public static Range(data: Array<number|undefined>) {
78
+
79
+ let min: number|undefined;
80
+ let max: number|undefined;
81
+
82
+ for (const value of data) {
83
+ if (typeof value === 'undefined') { continue; }
84
+ if (typeof min === 'undefined' || min > value) { min = value; }
85
+ if (typeof max === 'undefined' || max < value) { max = value; }
86
+ }
87
+
88
+ const range = (typeof min === 'undefined' || typeof max === 'undefined') ? 0 : max - min;
89
+
90
+ return { min, max, range };
91
+ }
92
+
93
+ public static ApplyScale(value: number, range: number, scale: RangeScale) {
94
+ return range * (value - scale.min) / (scale.max - scale.min);
95
+ }
96
+
97
+ /**
98
+ * flatten. we support holes in data, which means undefined values
99
+ * in arrays, but don't push an empty value at the top level (if
100
+ * that makes sense).
101
+ *
102
+ * @param args
103
+ */
104
+ public static Flatten(args: any) {
105
+ let flat: any[] = [];
106
+ if (Array.isArray(args)) {
107
+ for (const element of args) {
108
+ if (Array.isArray(element)) {
109
+ flat = flat.concat(this.Flatten(element));
110
+ }
111
+ else {
112
+ flat.push(element);
113
+ }
114
+ }
115
+ }
116
+ else if (typeof args !== 'undefined') {
117
+ flat.push(args);
118
+ }
119
+ return flat;
120
+ }
121
+
122
+ }
@@ -0,0 +1,221 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ /**
23
+ * rebuilding, try to keep it sane
24
+ *
25
+ * NOTE: this file uses the color-mod() function and a postcss library
26
+ * to translate it. that function is no longer in the spec and will be
27
+ * implemented differently, so this will probably need to change.
28
+ *
29
+ * originally this file used sass so we used some sass library functions
30
+ * to do the same thing. all we are doing is (1) set alpha on a color and
31
+ * (2) darken a color.
32
+ *
33
+ * UPDATE to support scaling: we won't explicitly set font size (or family).
34
+ * those should be set in containing nodes, possibly from theme or style.
35
+ * we will base our scale 100 at font size 10pt, and scale from there.
36
+ *
37
+ * UPDATE: the color-mod function is no longer used, not sure where it went
38
+ * UPDATE: back to sass, but still using this file (compiles fine)
39
+ */
40
+
41
+
42
+ /* container style */
43
+ .treb-chart {
44
+
45
+ /**
46
+ * default theme. the way we do this now is assign color from the theme,
47
+ * then optionally set fill/stroke via currentColor. that reduces the number
48
+ * of times we have to define the same colors.
49
+ */
50
+
51
+ background: var(--treb-chart-background, #fff);
52
+
53
+ .series-1 { color: var(--treb-chart-color-series-1, #80B1D3); }
54
+ .series-2 { color: var(--treb-chart-color-series-2, #8DD3C7); }
55
+ .series-3 { color: var(--treb-chart-color-series-3, #BEBADA); }
56
+ .series-4 { color: var(--treb-chart-color-series-4, #FB8072); }
57
+ .series-5 { color: var(--treb-chart-color-series-5, #FDB462); }
58
+ .series-6 { color: var(--treb-chart-color-series-6, #B3DE69); }
59
+ .series-7 { color: var(--treb-chart-color-series-7, #FCCDE5); }
60
+ .series-8 { color: var(--treb-chart-color-series-8, #D9D9D9); }
61
+ .series-9 { color: var(--treb-chart-color-series-9, #BC80BD); }
62
+ .series-10 { color: var(--treb-chart-color-series-10, #CCEBC5); }
63
+ .series-11 { color: var(--treb-chart-color-series-11, #FFED6F); }
64
+ .series-12 { color: var(--treb-chart-color-series-12, #FFFFB3); }
65
+
66
+ /* chart title, at top or bottom */
67
+ .chart-title {
68
+ font-size: 1.4em;
69
+ }
70
+
71
+ /* axis labels */
72
+ .axis-group {
73
+ font-size: .9em;
74
+ }
75
+
76
+ /* default text color */
77
+ text {
78
+ fill: var(--treb-chart-text-color, #000);
79
+ stroke: none;
80
+ }
81
+
82
+ /* legend uses matching series colors */
83
+ .legend {
84
+ font-size: 1.05em; // ?
85
+ rect {
86
+ fill: currentColor;
87
+ }
88
+ }
89
+
90
+ /* grid */
91
+ .chart-grid, .chart-ticks {
92
+ stroke: var(--treb-chart-grid-color, #ddd);
93
+ }
94
+
95
+ /* mouse elements */
96
+ .label-target {
97
+ stroke: none;
98
+ fill: transparent;
99
+
100
+ }
101
+
102
+ path.label-target {
103
+ transition: fill .2s;
104
+ }
105
+
106
+ path.label-target:hover {
107
+ fill: rgba(0, 0, 0, .15);
108
+ }
109
+
110
+ .data-label {
111
+ pointer-events: none;
112
+ opacity: 0;
113
+ transition: opacity .2s ease-in-out;
114
+
115
+ & text {
116
+ fill: #fff;
117
+ }
118
+
119
+ & path {
120
+ fill: #000;
121
+ }
122
+
123
+ & .marker-highlight {
124
+ fill: currentColor;
125
+ stroke: none;
126
+ }
127
+
128
+ }
129
+
130
+ .label-target:hover + .data-label {
131
+ opacity: 1;
132
+ }
133
+
134
+ /* old type of line chart */
135
+ .chart-line {
136
+ stroke: currentColor;
137
+ fill: none;
138
+ stroke-width: 2;
139
+ }
140
+
141
+ /**
142
+ * area chart has separate parts for line and area
143
+ * (because the line doesn't go up and down the sides)
144
+ */
145
+ .chart-area {
146
+ .line {
147
+ stroke: currentColor;
148
+ stroke-width: 2px;
149
+ fill: none;
150
+ }
151
+ .fill {
152
+ fill: currentColor;
153
+ opacity: .5;
154
+ }
155
+ }
156
+
157
+ /* scatter plot line (and marker -- change that class name) */
158
+ .scatter-plot {
159
+
160
+ stroke-width: 3;
161
+ fill: none;
162
+ stroke: currentColor;
163
+
164
+ & .fill {
165
+ fill: currentColor;
166
+ opacity: .5;
167
+ stroke: none;
168
+ }
169
+
170
+ /**
171
+ * circle marker
172
+ */
173
+ & .marker {
174
+
175
+ stroke-width: 2.5px;
176
+ fill: #fff;
177
+ transition: stroke-width .15s ease-in;
178
+
179
+ &:hover {
180
+ stroke-width: 5px;
181
+ }
182
+
183
+ }
184
+
185
+ }
186
+
187
+ /* donut/pie */
188
+ .donut {
189
+
190
+ & path {
191
+ fill: currentColor; /* has to be attached to path for IE11 */
192
+ }
193
+
194
+ /* this is the dotted line to callouts */
195
+ & path.callout {
196
+ fill: none;
197
+ stroke: #999;
198
+ stroke-dasharray: 2 2;
199
+ }
200
+
201
+ /* this is the actual label */
202
+ text.callout-label {
203
+ /* font-size: 10pt; */
204
+ font-size: 1em;
205
+ }
206
+
207
+ }
208
+
209
+ /* HISTOGRAM NEEDS CLEANUP (IN LAYOUT) */
210
+ .chart-column {
211
+ fill: currentColor;
212
+ stroke: none;
213
+ }
214
+
215
+ /* SO DOES CORRELATION CHART */
216
+ .mc-correlation {
217
+ stroke: currentColor;
218
+ stroke-width: 1;
219
+ }
220
+
221
+ }
@@ -0,0 +1,250 @@
1
+ /*
2
+ * This file is part of TREB.
3
+ *
4
+ * TREB is free software: you can redistribute it and/or modify it under the
5
+ * terms of the GNU General Public License as published by the Free Software
6
+ * Foundation, either version 3 of the License, or (at your option) any
7
+ * later version.
8
+ *
9
+ * TREB is distributed in the hope that it will be useful, but WITHOUT ANY
10
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
+ * details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License along
15
+ * with TREB. If not, see <https://www.gnu.org/licenses/>.
16
+ *
17
+ * Copyright 2022-2023 trebco, llc.
18
+ * info@treb.app
19
+ *
20
+ */
21
+
22
+ /**
23
+ * NOTE: this file uses the color-mod() function and a postcss library
24
+ * to translate it. that function is no longer in the spec and will be
25
+ * implemented differently, so this will probably need to change.
26
+ *
27
+ * originally this file used sass so we used some sass library functions
28
+ * to do the same thing. all we are doing is (1) set alpha on a color and
29
+ * (2) darken a color.
30
+ */
31
+
32
+ $color1: #8DD3C7;
33
+ $color2: #FFFFB3;
34
+ $color3: #BEBADA;
35
+ $color4: #FB8072;
36
+ $color5: #80B1D3;
37
+ $color6: #FDB462;
38
+ $color7: #B3DE69;
39
+ $color8: #FCCDE5;
40
+ $color9: #D9D9D9;
41
+ $color10: #BC80BD;
42
+ $color11: #CCEBC5;
43
+ $color12: #FFED6F;
44
+
45
+ $font-stack: // "-apple-system",
46
+ "BlinkMacSystemFont",
47
+ "Segoe UI",
48
+ "Roboto",
49
+ "Oxygen-Sans",
50
+ "Ubuntu",
51
+ "Cantarell",
52
+ "Helvetica Neue",
53
+ "sans-serif";
54
+
55
+ .treb-chart {
56
+
57
+ font-family: $font-stack;
58
+
59
+ /* box-shadow:0 3px 7px rgba(0,0,0,.3); // looks good though */
60
+
61
+ background: #fff;
62
+
63
+ .axis-label {
64
+ font-size: 8.5pt;
65
+ }
66
+
67
+ .chart-title {
68
+ font-size: 14pt;
69
+ }
70
+
71
+ .chart-column {
72
+ fill: $color1;
73
+ }
74
+
75
+ .chart-column-shadow {
76
+ fill: color-mod($color1 shade(25%));
77
+ }
78
+
79
+ .chart-grid, .chart-ticks {
80
+ stroke: #ddd;
81
+ }
82
+
83
+ .chart-column, .chart-bar {
84
+ &.chart-column-shadow {
85
+ &.series-1 { fill: color-mod($color1 shade(25%)); }
86
+ &.series-2 { fill: color-mod($color3 shade(25%)); }
87
+ &.series-3 { fill: color-mod($color4 shade(25%)); }
88
+ &.series-4 { fill: color-mod($color5 shade(25%)); }
89
+ &.series-5 { fill: color-mod($color6 shade(25%)); }
90
+ &.series-6 { fill: color-mod($color7 shade(25%)); }
91
+ &.series-7 { fill: color-mod($color8 shade(25%)); }
92
+ &.series-8 { fill: color-mod($color9 shade(25%)); }
93
+ &.series-9 { fill: color-mod($color10 shade(25%)); }
94
+ &.series-10 { fill: color-mod($color11 shade(25%)); }
95
+ &.series-11 { fill: color-mod($color12 shade(25%)); }
96
+ &.series-12 { fill: color-mod($color2 shade(25%)); }
97
+ }
98
+
99
+ &.series-1 { fill: $color1; }
100
+ &.series-2 { fill: $color3; }
101
+ &.series-3 { fill: $color4; }
102
+ &.series-4 { fill: $color5; }
103
+ &.series-5 { fill: $color6; }
104
+ &.series-6 { fill: $color7; }
105
+ &.series-7 { fill: $color8; }
106
+ &.series-8 { fill: $color9; }
107
+ &.series-9 { fill: $color10; }
108
+ &.series-10 { fill: $color11; }
109
+ &.series-11 { fill: $color12; }
110
+ &.series-12 { fill: $color2; }
111
+
112
+
113
+ }
114
+
115
+ .chart-line, .chart-area {
116
+
117
+ .line {
118
+
119
+ fill: none;
120
+ stroke-width: 2px;
121
+ stroke-linecap: round;
122
+ stroke-linejoin: round;
123
+
124
+ }
125
+
126
+ &.scatter-line .line {
127
+ stroke-width: 3px;
128
+ }
129
+
130
+ &.scatter-line .marker {
131
+ stroke-width: 6px;
132
+ fill: #fff;
133
+ /*
134
+ d: path('M-1,-1 L1,-1 L1,1 L-1,1 Z');
135
+ */
136
+ d: path('M0,-1.5 a1.5,1.5,0,1,1,0,3 a1.5,1.5,0,1,1,0,-3'); /* circle */
137
+ transition: d .15s ease-in;
138
+
139
+ &:hover {
140
+ d: path('M0,-3 a3,3,0,1,1,0,6 a3,3,0,1,1,0,-6'); /* circle */
141
+ }
142
+
143
+ }
144
+
145
+ &.series-1 { stroke: $color1; }
146
+ &.series-2 { stroke: $color3; }
147
+ &.series-3 { stroke: $color4; }
148
+ &.series-4 { stroke: $color5; }
149
+ &.series-5 { stroke: $color6; }
150
+ &.series-6 { stroke: $color7; }
151
+ &.series-7 { stroke: $color8; }
152
+ &.series-8 { stroke: $color9; }
153
+ &.series-9 { stroke: $color10; }
154
+ &.series-10 { stroke: $color11; }
155
+ &.series-11 { stroke: $color12; }
156
+ &.series-12 { stroke: $color2; }
157
+
158
+ }
159
+
160
+ .chart-area {
161
+
162
+ &.series-1 { fill: color-mod($color1 a(.75)); }
163
+ &.series-2 { fill: color-mod($color3 a(.75)); }
164
+ &.series-3 { fill: color-mod($color4 a(.75)); }
165
+ &.series-4 { fill: color-mod($color5 a(.75)); }
166
+ &.series-5 { fill: color-mod($color6 a(.75)); }
167
+ &.series-6 { fill: color-mod($color7 a(.75)); }
168
+ &.series-7 { fill: color-mod($color8 a(.75)); }
169
+ &.series-8 { fill: color-mod($color9 a(.75)); }
170
+ &.series-9 { fill: color-mod($color10 a(.75)); }
171
+ &.series-10 { fill: color-mod($color11 a(.75)); }
172
+ &.series-11 { fill: color-mod($color12 a(.75)); }
173
+ &.series-12 { fill: color-mod($color2 a(.75)); }
174
+
175
+ .fill {
176
+ stroke-linecap: round;
177
+ stroke-linejoin: round;
178
+ }
179
+
180
+ }
181
+
182
+ .points {
183
+ stroke-width: 1;
184
+ stroke: #39f;
185
+ }
186
+
187
+ .mouse-layer {
188
+ fill: transparent;
189
+ }
190
+
191
+ .donut path.callout {
192
+ fill: none;
193
+ stroke: #999;
194
+ stroke-dasharray: 2 2;
195
+ }
196
+
197
+ text.callout-label {
198
+ font-size: 10pt;
199
+ }
200
+
201
+ .legend {
202
+ font-size: 10.5pt;
203
+
204
+ & { stroke: none; }
205
+
206
+ .series-1 { fill: $color1; }
207
+ .series-2 { fill: $color3; }
208
+ .series-3 { fill: $color4; }
209
+ .series-4 { fill: $color5; }
210
+ .series-5 { fill: $color6; }
211
+ .series-6 { fill: $color7; }
212
+ .series-7 { fill: $color8; }
213
+ .series-8 { fill: $color9; }
214
+ .series-9 { fill: $color10; }
215
+ .series-10 { fill: $color11; }
216
+ .series-11 { fill: $color12; }
217
+ .series-12 { fill: $color2; }
218
+
219
+
220
+ }
221
+
222
+ .donut path {
223
+
224
+ stroke: none;
225
+
226
+ /*
227
+ don't use child ordering for color, use explicit series values.
228
+ we want to tie color to input order, even if the chart sorts the
229
+ data.
230
+
231
+ I don't like this. we should use order. if necesary, you can
232
+ add the nodes out of order.
233
+ */
234
+
235
+ &.series-1 { fill: $color1; }
236
+ &.series-2 { fill: $color2; }
237
+ &.series-3 { fill: $color3; }
238
+ &.series-4 { fill: $color4; }
239
+ &.series-5 { fill: $color5; }
240
+ &.series-6 { fill: $color6; }
241
+ &.series-7 { fill: $color7; }
242
+ &.series-8 { fill: $color8; }
243
+ &.series-9 { fill: $color9; }
244
+ &.series-10 { fill: $color10; }
245
+ &.series-11 { fill: $color11; }
246
+ &.series-12 { fill: $color12; }
247
+
248
+ }
249
+
250
+ }