|
2 | 2 | import * as d3 from 'd3';
|
3 | 3 | import { postData } from './post-data.js';
|
4 | 4 | import { onMount } from 'svelte';
|
5 |
| - import CodeMirror from "./CodeMirror.svelte"; |
6 | 5 | import CostCentreStackHeap from './CostCentreStackHeap.svelte';
|
7 | 6 | import SourceRangeBox from './SourceRangeBox.svelte';
|
8 | 7 |
|
|
57 | 56 | }
|
58 | 57 | }
|
59 | 58 |
|
60 |
| - const re1 = /.*:(?<line>\d+):(?<column>\d+)$/; |
61 |
| - const re2 = /.*:(?<line>\d+):(?<start_column>\d+)-(?<end_column>\d+)$/; |
62 |
| - const re3 = /.*:\((?<start_line>\d+),(?<start_column>\d+)\)-\((?<end_line>\d+),(?<end_column>\d+)\)$/; |
63 |
| -/* |
64 |
| -
|
65 |
| - isPointRealSpan |
66 |
| - path:line:column |
67 |
| - /.*:(?<line>\d+):(?<column>\d+)$/ |
68 |
| -
|
69 |
| - isOneLineRealSpan |
70 |
| - path:line:start_column-end_column |
71 |
| - /.*:(?<line>\d+):(?<start_column>\d+)-(?<end_column>\d+)$/ |
72 |
| -
|
73 |
| - generic |
74 |
| - path:(start_line,start_column)-(end_line,end_column) |
75 |
| - /.*:\((?<start_line>\d+),(?<start_column>\d+)\)-\((?<end_line>\d+),(?<end_column>\d+)\)$/ |
76 |
| -
|
77 |
| - EXAMPLE: |
78 |
| - src3.match(re4).groups |
79 |
| -
|
80 |
| -*/ |
81 |
| - function getSrcLocLine(srcLoc) { |
82 |
| - let m; |
83 |
| - if (m = srcLoc.match(re1)) { |
84 |
| - // path:line:column |
85 |
| - return +m.groups.line; |
86 |
| - } else if (m = srcLoc.match(re2)) { |
87 |
| - // path:line:start_column-end_column |
88 |
| - return +m.groups.line; |
89 |
| - } else if (m = srcLoc.match(re3)) { |
90 |
| - // path:(start_line,start_column)-(end_line,end_column) |
91 |
| - return +m.groups.start_line; |
92 |
| - } |
93 |
| -
|
94 |
| - return 1; |
95 |
| - } |
96 |
| -
|
97 |
| - function sliceToSrcLoc(sourceCode, srcLoc) { |
98 |
| - const lines = sourceCode.split('\n'); |
99 |
| - let m; |
100 |
| - if (m = srcLoc.match(re1)) { |
101 |
| - // path:line:column |
102 |
| - return lines.slice(+m.groups.line -1, +m.groups.line).join('\n'); |
103 |
| - } else if (m = srcLoc.match(re2)) { |
104 |
| - // path:line:start_column-end_column |
105 |
| - return lines.slice(+m.groups.line -1, +m.groups.line).join('\n'); |
106 |
| - } else if (m = srcLoc.match(re3)) { |
107 |
| - // path:(start_line,start_column)-(end_line,end_column) |
108 |
| - return lines.slice(+m.groups.start_line -1, +m.groups.end_line).join('\n'); |
109 |
| - } |
110 |
| -
|
111 |
| - return sourceCode; |
112 |
| - } |
113 |
| -
|
114 | 59 | async function getSourceCodeForModule(moduleName) {
|
115 | 60 | if (moduleName in stackModuleSource) {
|
116 | 61 | const res = await stackModuleSource[moduleName];
|
|
120 | 65 | return '<not found>';
|
121 | 66 | }
|
122 | 67 |
|
123 |
| -/* |
124 |
| - const btn = () => { |
125 |
| - cm1.slice(src, 19, 29); |
126 |
| - //console.log(cm1.getEditor().getViewport()); |
127 |
| - //cm1.getEditor().scrollIntoView({line:10, ch:1}); |
128 |
| - //cm1.getEditor().getDoc().setCursor(44); |
129 |
| - //cm1.getEditor().getDoc().setSelection({line:19, ch:0},{line:28, ch:0}); |
130 |
| - //cm1.getEditor().scrollIntoView({line:111, ch:1}); |
131 |
| - //cm1.getEditor().getDoc().markText({line:51, ch:0},{line:63, ch:0}, {css: "background-color: #f00e0350"}); |
132 |
| - //console.log(cm1.getEditor().getViewport()); |
133 |
| - cm1.getEditor().setSize(null, 'auto'); |
134 |
| - }; |
135 |
| -*/ |
136 |
| -
|
137 | 68 | function handleKeypress(event) {
|
138 | 69 | console.log(event);
|
139 | 70 |
|
|
184 | 115 | if (currentStack) calculateCurrentStack();
|
185 | 116 | }
|
186 | 117 |
|
187 |
| - function bgImage2(i, ccid) { |
188 |
| - //return 'linear-gradient(#8e508a, #8e508a)'; |
189 |
| - //return 'linear-gradient(#5f5286, #5f5286)'; |
190 |
| -// return 'linear-gradient(#8e508a, #5f5286)'; |
191 |
| - return 'linear-gradient(to right, #8e508a, #5f5286)'; |
192 |
| - return 'linear-gradient(to right, #5f5286, #8e508a)'; |
193 |
| - } |
194 |
| -
|
195 | 118 | function bgImage(i, ccid) {
|
196 | 119 | if (i < 4)
|
197 | 120 | //return 'linear-gradient(to right, #8e508a, #5f5286)';
|
198 | 121 | return 'linear-gradient(#8e508a, #5f5286)';
|
199 | 122 | // return 'linear-gradient(#8e508a, #453b61)';
|
200 | 123 | // return 'linear-gradient(#5f5286, #8e508a)';
|
201 | 124 | return 'linear-gradient(#5f5286, #453b61)'; // super
|
202 |
| - |
| 125 | +
|
203 | 126 | return 'linear-gradient(#8e508a, #453b61)';
|
204 | 127 | return 'linear-gradient(#8e508a, #5f5286, #453b61)';
|
205 | 128 | }
|
206 | 129 |
|
207 |
| - function bgColor(i, ccid) { |
208 |
| -
|
209 |
| - // if (i === 0) |
210 |
| - return '#5f5286'; |
211 |
| - return '#453b61'; |
212 |
| -
|
213 |
| - return '#8e508a'; |
214 |
| - //return 'darkgreen'; |
215 |
| -
|
216 |
| -
|
217 |
| -
|
218 |
| - if (i % 2 === 0) |
219 |
| - return 'orange'; |
220 |
| - return '#8e508a'; |
221 |
| - return '#453b61'; |
222 |
| - return '#5f5286'; |
223 |
| -
|
224 |
| - /* |
225 |
| - 453b61 |
226 |
| - 5f5286 |
227 |
| - 8e508a |
228 |
| - */ |
229 |
| - //return 'orange'; |
230 |
| - if (i % 2 === 0) |
231 |
| - return 'dodgerblue'; |
232 |
| - return 'MediumSeaGreen'; |
233 |
| -
|
234 |
| - if (i % 2 === 0) |
235 |
| - return 'orange'; |
236 |
| - return 'slateblue'; |
237 |
| -
|
238 |
| - if (i % 2 === 0) |
239 |
| - return '#453b61'; |
240 |
| - return '#8e508a'; |
241 |
| - return '#5f5286'; |
242 |
| - } |
243 | 130 | </script>
|
244 | 131 |
|
245 | 132 | <nav class="my-nav">
|
|
0 commit comments