desy-html 6.4.1 → 6.5.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/docs/index.html +25 -3
- package/gulpfile.js +3 -2
- package/package.json +7 -3
- package/src/templates/components/header-advanced/_examples.header-advanced.njk +101 -14
- package/src/templates/components/header-advanced/_template.header-advanced.njk +2 -2
- package/test/backstop_config/backstop.config.js +35 -0
- package/test/backstop_config/scenarios/components_a.js +31 -0
- package/test/backstop_config/scenarios/components_b.js +31 -0
- package/test/backstop_config/scenarios/components_c.js +31 -0
- package/test/backstop_config/scenarios/components_d.js +49 -0
- package/test/backstop_config/scenarios/components_e.js +22 -0
- package/test/backstop_config/scenarios/components_f.js +31 -0
- package/test/backstop_config/scenarios/components_h.js +40 -0
- package/test/backstop_config/scenarios/components_i.js +40 -0
- package/test/backstop_config/scenarios/components_l.js +22 -0
- package/test/backstop_config/scenarios/components_m.js +58 -0
- package/test/backstop_config/scenarios/components_n.js +22 -0
- package/test/backstop_config/scenarios/components_p.js +22 -0
- package/test/backstop_config/scenarios/components_r.js +13 -0
- package/test/backstop_config/scenarios/components_s.js +58 -0
- package/test/backstop_config/scenarios/components_t.js +67 -0
- package/test/backstop_config/scenarios/home.js +12 -0
- package/test/backstop_config/scenarios/styles.js +13 -0
- package/test/backstop_config/scenarios.js +39 -0
- package/test/backstop_data/bitmaps_reference/Desy_Accordion_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Accordion_history_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Alert_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Breadcrumbs_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Button_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Button_loader_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Character_count_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Checkboxes_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Collapsible_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Date_input_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Description_list_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Details_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Dialog_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Dropdown_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Error_message_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Error_summary_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Fieldset_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_File_upload_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Footer_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Header_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Header_advanced_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Header_mini_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Hint_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Home_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Input_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Input_group_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Item_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Label_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Listbox_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Media_object_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Menu_horizontal_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Menu_navigation_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Menu_vertical_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Menubar_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Modal_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Nav_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Notification_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Pagination_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Pill_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Searchbar_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Select_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Skip_link_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Spinner_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Status_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Status_item_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Styles_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Table_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Table_advanced_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Tabs_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Textarea_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Toggle_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Tooltip_0_document_0_desktop.png +0 -0
- package/test/backstop_data/bitmaps_reference/Desy_Tree_0_document_0_desktop.png +0 -0
- package/test/backstop_data/engine_scripts/cookies.json +14 -0
- package/test/backstop_data/engine_scripts/imageStub.jpg +0 -0
- package/test/backstop_data/engine_scripts/playwright/clickAndHoverHelper.js +43 -0
- package/test/backstop_data/engine_scripts/playwright/interceptImages.js +31 -0
- package/test/backstop_data/engine_scripts/playwright/loadCookies.js +16 -0
- package/test/backstop_data/engine_scripts/playwright/onBefore.js +5 -0
- package/test/backstop_data/engine_scripts/playwright/onReady.js +6 -0
- package/test/backstop_data/engine_scripts/playwright/overrideCSS.js +27 -0
- package/test/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js +39 -0
- package/test/backstop_data/engine_scripts/puppet/ignoreCSP.js +65 -0
- package/test/backstop_data/engine_scripts/puppet/interceptImages.js +37 -0
- package/test/backstop_data/engine_scripts/puppet/loadCookies.js +33 -0
- package/test/backstop_data/engine_scripts/puppet/onBefore.js +3 -0
- package/test/backstop_data/engine_scripts/puppet/onReady.js +6 -0
- package/test/backstop_data/engine_scripts/puppet/overrideCSS.js +15 -0
- package/test/backstop_data/html_report/a96f14595379b7c348d66e115ec65a93.png +0 -0
- package/test/backstop_data/html_report/assets/fonts/Lato-Bold.ttf +0 -0
- package/test/backstop_data/html_report/assets/fonts/Lato-Regular.ttf +0 -0
- package/test/backstop_data/html_report/assets/fonts/lato-bold-webfont.woff +0 -0
- package/test/backstop_data/html_report/assets/fonts/lato-bold-webfont.woff2 +0 -0
- package/test/backstop_data/html_report/assets/fonts/lato-regular-webfont.woff +0 -0
- package/test/backstop_data/html_report/assets/fonts/lato-regular-webfont.woff2 +0 -0
- package/test/backstop_data/html_report/b815e28b1e230cff6e9d7b749edcd562.png +0 -0
- package/test/backstop_data/html_report/config.js +1335 -0
- package/test/backstop_data/html_report/diff.js +1843 -0
- package/test/backstop_data/html_report/diverged.js +340 -0
- package/test/backstop_data/html_report/divergedWorker.js +6 -0
- package/test/backstop_data/html_report/index.html +49 -0
- package/test/backstop_data/html_report/index_bundle.js +2 -0
- package/docs/examples-header-advanced-2.html +0 -5
- package/src/templates/components/header-advanced/_examples.header-advanced-2.njk +0 -911
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const noop = function (){};
|
|
3
|
+
let LCS_DIFF_ARRAY_METHOD = undefined;
|
|
4
|
+
// debugger
|
|
5
|
+
if (typeof require !== 'undefined') {
|
|
6
|
+
LCS_DIFF_ARRAY_METHOD = require('diff').diffArrays;
|
|
7
|
+
} else {
|
|
8
|
+
try {
|
|
9
|
+
LCS_DIFF_ARRAY_METHOD = JsDiff.diffArrays;
|
|
10
|
+
} catch(err) {
|
|
11
|
+
console.error(err);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const rowSpread = 1;
|
|
16
|
+
|
|
17
|
+
const spread = 50; // range of adjacent pixels to aggregate when calculating diff
|
|
18
|
+
const IS_ADDED_WORD = '0_255_0_255';
|
|
19
|
+
const IS_REMOVED_WORD = '255_0_0_255';
|
|
20
|
+
const IS_ADDED_AND_REMOVED_WORD = '0_255_255_255';
|
|
21
|
+
const IS_SAME_WORD = '';
|
|
22
|
+
const OPACITY = '40'; // 0-255 range
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Applies Longest-Common-Subsequence-Diff algorithm to imageData formatted arrays
|
|
26
|
+
*
|
|
27
|
+
* @param {Uint8ClampedArray} [reference] baseline image
|
|
28
|
+
* @param {Uint8ClampedArray} [test] test image
|
|
29
|
+
*
|
|
30
|
+
* @returns {Uint8ClampedArray} diff image
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
if (typeof module !== 'undefined') {
|
|
34
|
+
module.exports = diverged;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function diverged(reference, test, h, w) {
|
|
38
|
+
console.time("diverged_total_time");
|
|
39
|
+
|
|
40
|
+
const spread = Math.floor(h / 80); //override
|
|
41
|
+
|
|
42
|
+
console.log('spread:', spread);
|
|
43
|
+
|
|
44
|
+
console.time("imgDataToWords");
|
|
45
|
+
const img1wordArr = imgDataToWords(reference);
|
|
46
|
+
const img2wordArr = imgDataToWords(test);
|
|
47
|
+
console.timeEnd("imgDataToWords");
|
|
48
|
+
|
|
49
|
+
console.time("imgDataWordArrToColsAndRows");
|
|
50
|
+
let cols_rows_ref = imgDataWordArrToColsAndRows(img1wordArr, h, w);
|
|
51
|
+
let cols_rows_test = imgDataWordArrToColsAndRows(img2wordArr, h, w);
|
|
52
|
+
console.timeEnd("imgDataWordArrToColsAndRows");
|
|
53
|
+
|
|
54
|
+
console.time("groupAdjacent");
|
|
55
|
+
const columnRef = groupAdjacent(cols_rows_ref.columns, spread, h, w);
|
|
56
|
+
const columnTest = groupAdjacent(cols_rows_test.columns, spread, h, w);
|
|
57
|
+
console.timeEnd("groupAdjacent");
|
|
58
|
+
|
|
59
|
+
console.time("columnDiffRaw");
|
|
60
|
+
const columnDiffRaw = diffArr(columnRef, columnTest, h, w);
|
|
61
|
+
console.timeEnd("columnDiffRaw");
|
|
62
|
+
|
|
63
|
+
console.time("reduceColumnDiffRaw");
|
|
64
|
+
const reducedColumnDiff = reduceColumnDiffRaw(columnDiffRaw, h, w);
|
|
65
|
+
console.timeEnd("reduceColumnDiffRaw");
|
|
66
|
+
// console.log("reducedColumnDiff>>>", reducedColumnDiff);
|
|
67
|
+
|
|
68
|
+
console.time("unGroupAdjacent");
|
|
69
|
+
const expandedColumns = ungroupAdjacent(reducedColumnDiff, spread, cols_rows_test.columns, h, w);
|
|
70
|
+
console.timeEnd("unGroupAdjacent");
|
|
71
|
+
|
|
72
|
+
console.time("columnWordDataToImgDataFormatAsWords");
|
|
73
|
+
const convertedColumnDiffImgData = columnWordDataToImgDataFormatAsWords(expandedColumns, h, w);
|
|
74
|
+
console.timeEnd("columnWordDataToImgDataFormatAsWords");
|
|
75
|
+
// console.log("convertedColumnDiffImgData>>>", convertedColumnDiffImgData);
|
|
76
|
+
|
|
77
|
+
console.time("imgDataWordsToClampedImgData");
|
|
78
|
+
const imgDataArr = convertImgDataWordsToClampedImgData(convertedColumnDiffImgData);
|
|
79
|
+
console.timeEnd("imgDataWordsToClampedImgData");
|
|
80
|
+
// console.log("imgDataArr>>>", imgDataArr);
|
|
81
|
+
|
|
82
|
+
console.timeEnd("diverged_total_time");
|
|
83
|
+
return imgDataArr;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* ========= HELPERS ========
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
function columnWordDataToImgDataFormatAsWords(columns, h, w) {
|
|
91
|
+
const imgDataWordsLength = w * h;
|
|
92
|
+
|
|
93
|
+
let convertedArr = new Array(imgDataWordsLength);
|
|
94
|
+
for (var i = 0; i < imgDataWordsLength; i++) {
|
|
95
|
+
const {column, depth} = serialToColumnMap(i, h, w);
|
|
96
|
+
convertedArr[i] = columns[column][depth];
|
|
97
|
+
}
|
|
98
|
+
return convertedArr;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function convertImgDataWordsToClampedImgData(wordsArr) {
|
|
102
|
+
let convertedArr = new Uint8ClampedArray(wordsArr.length * 4);
|
|
103
|
+
for (var i = 0; i < wordsArr.length; i++) {
|
|
104
|
+
const convertedOffset = i * 4;
|
|
105
|
+
const segments = wordsArr[i].split('_');
|
|
106
|
+
convertedArr[convertedOffset] = segments[0];
|
|
107
|
+
convertedArr[convertedOffset+1] = segments[1];
|
|
108
|
+
convertedArr[convertedOffset+2] = segments[2];
|
|
109
|
+
convertedArr[convertedOffset+3] = segments[3];
|
|
110
|
+
}
|
|
111
|
+
return convertedArr;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function reduceColumnDiffRaw(columnDiffs, h, w) {
|
|
115
|
+
let reducedColumns = new Array(columnDiffs.length);
|
|
116
|
+
for (let columnIndex = 0; columnIndex < columnDiffs.length; columnIndex++) {
|
|
117
|
+
const columnDiff = columnDiffs[columnIndex];
|
|
118
|
+
let resultColumn = new Array();
|
|
119
|
+
let removedCounter = 0;
|
|
120
|
+
let resultClass = '';
|
|
121
|
+
let segment = [];
|
|
122
|
+
let debug = false;
|
|
123
|
+
|
|
124
|
+
for (let depthIndex = 0; depthIndex < columnDiff.length; depthIndex++) {
|
|
125
|
+
let segmentLength = 0;
|
|
126
|
+
|
|
127
|
+
// Categorize the current segment
|
|
128
|
+
if (columnDiff[depthIndex].removed) {
|
|
129
|
+
segmentLength = columnDiff[depthIndex].count;
|
|
130
|
+
removedCounter += segmentLength;
|
|
131
|
+
resultClass = IS_REMOVED_WORD;
|
|
132
|
+
} else {
|
|
133
|
+
if (columnDiff[depthIndex].added) {
|
|
134
|
+
if (removedCounter) {
|
|
135
|
+
resultClass = IS_ADDED_AND_REMOVED_WORD;
|
|
136
|
+
} else {
|
|
137
|
+
resultClass = IS_ADDED_WORD;
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
resultClass = IS_SAME_WORD;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
segmentLength = columnDiff[depthIndex].count;
|
|
144
|
+
|
|
145
|
+
if (removedCounter > 0) {
|
|
146
|
+
if (segmentLength > removedCounter) {
|
|
147
|
+
segmentLength -= removedCounter;
|
|
148
|
+
removedCounter = 0;
|
|
149
|
+
} else {
|
|
150
|
+
removedCounter -= segmentLength;
|
|
151
|
+
segmentLength = 0;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Limit segmentLength to total length of column
|
|
157
|
+
if (!segmentLength) {
|
|
158
|
+
continue;
|
|
159
|
+
} else {
|
|
160
|
+
segmentLength = Math.min(segmentLength, h - resultColumn.length);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const printSampleMap = false;
|
|
164
|
+
if (!printSampleMap || resultClass !== IS_SAME_WORD){
|
|
165
|
+
segment = new Array(segmentLength).fill(resultClass);
|
|
166
|
+
} else {
|
|
167
|
+
// reduced resolution image
|
|
168
|
+
segment = columnDiff[depthIndex].value.slice(0,segmentLength).map((value, i) => {
|
|
169
|
+
if (/|/.test(value)) {
|
|
170
|
+
return value.split('|')[0];
|
|
171
|
+
}
|
|
172
|
+
return value;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
resultColumn = resultColumn.concat(segment);
|
|
178
|
+
|
|
179
|
+
if (resultColumn.length > h) {
|
|
180
|
+
console.log('WARNING -- this value is out of bounds!')
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
reducedColumns[columnIndex] = resultColumn;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return reducedColumns;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function diffArr(refArr, testArr, h, w) {
|
|
191
|
+
let rawResultArr = [];
|
|
192
|
+
for (let i = 0; i < refArr.length; i++) {
|
|
193
|
+
rawResultArr.push(LCS_DIFF_ARRAY_METHOD(refArr[i], testArr[i]));
|
|
194
|
+
}
|
|
195
|
+
return rawResultArr;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function groupAdjacent(columns, spread, h, w) {
|
|
199
|
+
if (!spread) {
|
|
200
|
+
return columns;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* [getAdjacentArrayBounds retuns existing adjacent lower and upper column bounds]
|
|
205
|
+
* @param {[int]} pointer [current index]
|
|
206
|
+
* @param {[int]} spread [distance from index]
|
|
207
|
+
* @param {[int]} length [total length]
|
|
208
|
+
* @return {[array]} [0] lower bound, [1] upper bound
|
|
209
|
+
*/
|
|
210
|
+
function getAdjacentArrayBounds(pointer, spread, length) {
|
|
211
|
+
return [
|
|
212
|
+
// Math.max(0, pointer - spread),
|
|
213
|
+
Math.max(0, pointer),
|
|
214
|
+
Math.min(length - 1, pointer + spread)
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function getInterpolatedSequence(beginning, end) {
|
|
219
|
+
const interpolated = [];
|
|
220
|
+
for (let step = beginning; step <= end; step++) {
|
|
221
|
+
interpolated.push(step);
|
|
222
|
+
}
|
|
223
|
+
return interpolated;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function getCompositeColumnDepthValues(columns, sequence, depth) {
|
|
227
|
+
return sequence.reduce((acc, column) => {
|
|
228
|
+
return acc.concat(columns[column][depth]);
|
|
229
|
+
}, [])
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function getCompositeRowIndexValues(groupedColumns, sequence, column) {
|
|
233
|
+
return sequence.reduce((acc, depth) => {
|
|
234
|
+
return acc.concat(groupedColumns[column][depth]);
|
|
235
|
+
}, [])
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const groupedColumns = new Array();
|
|
239
|
+
let columnPointer = 0;
|
|
240
|
+
while (columnPointer < w) {
|
|
241
|
+
const adjacentColumnBounds = getAdjacentArrayBounds(columnPointer, spread, w);
|
|
242
|
+
const interpolatedColumns = getInterpolatedSequence(...adjacentColumnBounds);
|
|
243
|
+
|
|
244
|
+
const columnComposite = new Array();
|
|
245
|
+
for (var depth = 0; depth < h; depth++) {
|
|
246
|
+
columnComposite[depth] = getCompositeColumnDepthValues(columns, interpolatedColumns, depth).join('|');
|
|
247
|
+
}
|
|
248
|
+
groupedColumns.push(columnComposite);
|
|
249
|
+
columnPointer += spread;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const groupedRows = new Array();
|
|
253
|
+
if (rowSpread > 1) {
|
|
254
|
+
for (var index = 0; index < groupedColumns.length; index++) {
|
|
255
|
+
const rowComposite = new Array();
|
|
256
|
+
let depthPointer = 0;
|
|
257
|
+
while (depthPointer < h) {
|
|
258
|
+
const adjacentRowBounds = getAdjacentArrayBounds(depthPointer, rowSpread, h);
|
|
259
|
+
const interpolatedRows = getInterpolatedSequence(...adjacentRowBounds);
|
|
260
|
+
rowComposite.push(getCompositeRowIndexValues(groupedColumns, interpolatedRows, index).join(','));
|
|
261
|
+
depthPointer += rowSpread;
|
|
262
|
+
}
|
|
263
|
+
groupedRows[index] = rowComposite;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return groupedRows.length ? groupedRows : groupedColumns ;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function ungroupAdjacent(grouped, spread, columnUnderlay, h, w) {
|
|
270
|
+
if (!spread) {
|
|
271
|
+
return grouped;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function mapUngroupedColumnIndexToGroupedIndex(index, spread) {
|
|
275
|
+
return Math.floor(index / spread);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// expand columns
|
|
279
|
+
const ungrouped = new Array(w);
|
|
280
|
+
for (let index = 0; index < w; index++) {
|
|
281
|
+
if (!ungrouped[index]) {
|
|
282
|
+
ungrouped[index] = new Array(h);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const groupedIndexMap = mapUngroupedColumnIndexToGroupedIndex(index, spread);
|
|
286
|
+
for (let depth = 0; depth < h; depth++) {
|
|
287
|
+
const groupedDepthMap = rowSpread > 1 ? mapUngroupedColumnIndexToGroupedIndex(depth, rowSpread) : depth;
|
|
288
|
+
const value = grouped[groupedIndexMap][groupedDepthMap].split('|')[0];
|
|
289
|
+
ungrouped[index][depth] = value ? value : columnUnderlay[index][depth].replace(/\d+$/, OPACITY);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return ungrouped
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
function imgDataWordArrToColsAndRows(arr, h, w) {
|
|
299
|
+
let columns = new Array(w);
|
|
300
|
+
let rows = new Array(h);
|
|
301
|
+
|
|
302
|
+
for (var i = 0; i < arr.length; i++) {
|
|
303
|
+
const word = arr[i];
|
|
304
|
+
|
|
305
|
+
var {column, depth} = serialToColumnMap(i, h, w);
|
|
306
|
+
if (!columns[column]) {
|
|
307
|
+
columns[column] = new Array(h);
|
|
308
|
+
}
|
|
309
|
+
columns[column][depth] = word;
|
|
310
|
+
|
|
311
|
+
var {row, index} = serialToRowMap(i, h, w);
|
|
312
|
+
if (!rows[row]) {
|
|
313
|
+
rows[row] = new Array(w);
|
|
314
|
+
}
|
|
315
|
+
rows[row][index] = word;
|
|
316
|
+
}
|
|
317
|
+
return {columns, rows}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function serialToColumnMap(index, h, w) {
|
|
321
|
+
return {
|
|
322
|
+
column: index % w,
|
|
323
|
+
depth: Math.floor(index / w)
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function serialToRowMap(index, h, w) {
|
|
328
|
+
return {
|
|
329
|
+
row: Math.floor(index / w),
|
|
330
|
+
index: index % w
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function imgDataToWords(arr) {
|
|
335
|
+
let result = [];
|
|
336
|
+
for (let i = 0; i < arr.length-1; i += 4) {
|
|
337
|
+
result.push(`${arr[i]}_${arr[i+1]}_${arr[i+2]}_${arr[i+3]}`)
|
|
338
|
+
}
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<!-- Disable Cache -->
|
|
6
|
+
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
|
7
|
+
<meta http-equiv="Pragma" content="no-cache">
|
|
8
|
+
<meta http-equiv="Expires" content="0">
|
|
9
|
+
|
|
10
|
+
<title>BackstopJS Report</title>
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
@font-face {
|
|
14
|
+
font-family: 'latoregular';
|
|
15
|
+
src: url('./assets/fonts/lato-regular-webfont.woff2') format('woff2'),
|
|
16
|
+
url('./assets/fonts/lato-regular-webfont.woff') format('woff');
|
|
17
|
+
font-weight: 400;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
}
|
|
20
|
+
@font-face {
|
|
21
|
+
font-family: 'latobold';
|
|
22
|
+
src: url('./assets/fonts/lato-bold-webfont.woff2') format('woff2'),
|
|
23
|
+
url('./assets/fonts/lato-bold-webfont.woff') format('woff');
|
|
24
|
+
font-weight: 700;
|
|
25
|
+
font-style: normal;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ReactModal__Body--open {
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
}
|
|
31
|
+
.ReactModal__Body--open .header {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
</style>
|
|
36
|
+
</head>
|
|
37
|
+
<body style="background-color: #E2E7EA">
|
|
38
|
+
<div id="root">
|
|
39
|
+
|
|
40
|
+
</div>
|
|
41
|
+
<script>
|
|
42
|
+
function report (report) { // eslint-disable-line no-unused-vars
|
|
43
|
+
window.tests = report;
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
<script src="config.js"></script>
|
|
47
|
+
<script src="index_bundle.js"></script>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|