@vizhub/runtime 0.0.1 → 0.0.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.
Files changed (52) hide show
  1. package/dist/assets/setupV3Runtime-BVr5lyKp.js +240 -0
  2. package/{src/v2Runtime/bundle/rollup.browser.js → dist/index.js} +9286 -12810
  3. package/package.json +12 -6
  4. package/src/computeSrcDoc.ts +0 -68
  5. package/src/index.ts +0 -7
  6. package/src/useRuntime.ts +0 -394
  7. package/src/v2Runtime/bundle/bubleJSXOnly.ts +0 -34
  8. package/src/v2Runtime/bundle/getLibraries.js +0 -31
  9. package/src/v2Runtime/bundle/hypothetical.js +0 -232
  10. package/src/v2Runtime/bundle/index.js +0 -88
  11. package/src/v2Runtime/bundle/packageJson.ts +0 -49
  12. package/src/v2Runtime/bundle.test.js +0 -151
  13. package/src/v2Runtime/computeSrcDocV2.test.ts +0 -163
  14. package/src/v2Runtime/computeSrcDocV2.ts +0 -34
  15. package/src/v2Runtime/getComputedIndexHtml.test.ts +0 -33
  16. package/src/v2Runtime/getComputedIndexHtml.ts +0 -106
  17. package/src/v2Runtime/getText.ts +0 -19
  18. package/src/v2Runtime/magicSandbox.js +0 -291
  19. package/src/v2Runtime/packageJson.js +0 -42
  20. package/src/v2Runtime/transformFiles.test.js +0 -18
  21. package/src/v2Runtime/transformFiles.ts +0 -15
  22. package/src/v2Runtime/v3FilesToV2Files.test.ts +0 -20
  23. package/src/v2Runtime/v3FilesToV2Files.ts +0 -14
  24. package/src/v3Runtime/build.test.ts +0 -474
  25. package/src/v3Runtime/build.ts +0 -270
  26. package/src/v3Runtime/cleanRollupErrorMessage.ts +0 -15
  27. package/src/v3Runtime/computeSrcDocV3.ts +0 -151
  28. package/src/v3Runtime/extractVizImport.test.ts +0 -41
  29. package/src/v3Runtime/extractVizImport.ts +0 -34
  30. package/src/v3Runtime/generateRollupErrorMessage.ts +0 -84
  31. package/src/v3Runtime/importFromViz.ts +0 -36
  32. package/src/v3Runtime/index.ts +0 -1
  33. package/src/v3Runtime/parseId.ts +0 -14
  34. package/src/v3Runtime/setupV3Runtime.ts +0 -478
  35. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/bundle-modified-src.js +0 -121
  36. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/bundle-modified.js +0 -121
  37. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/bundle.js +0 -239
  38. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/index.js +0 -1
  39. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/package-lock.json +0 -475
  40. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/package.json +0 -19
  41. package/src/v3Runtime/transformDSV/d3-dsv-custom-build/rollup.config.js +0 -9
  42. package/src/v3Runtime/transformDSV/index.ts +0 -71
  43. package/src/v3Runtime/transformSvelte.ts +0 -111
  44. package/src/v3Runtime/types.ts +0 -158
  45. package/src/v3Runtime/urlLoad.ts +0 -33
  46. package/src/v3Runtime/virtual.ts +0 -27
  47. package/src/v3Runtime/vizCache.test.ts +0 -126
  48. package/src/v3Runtime/vizCache.ts +0 -60
  49. package/src/v3Runtime/vizLoad.ts +0 -68
  50. package/src/v3Runtime/vizLoadSvelte.ts +0 -46
  51. package/src/v3Runtime/vizResolve.ts +0 -100
  52. package/src/v3Runtime/worker.ts +0 -231
@@ -1,239 +0,0 @@
1
- var EOL = {},
2
- EOF = {},
3
- QUOTE = 34,
4
- NEWLINE = 10,
5
- RETURN = 13;
6
-
7
- function objectConverter(columns) {
8
- return new Function(
9
- 'd',
10
- 'return {' +
11
- columns
12
- .map(function (name, i) {
13
- return (
14
- JSON.stringify(name) + ': d[' + i + '] || ""'
15
- );
16
- })
17
- .join(',') +
18
- '}',
19
- );
20
- }
21
-
22
- function customConverter(columns, f) {
23
- var object = objectConverter(columns);
24
- return function (row, i) {
25
- return f(object(row), i, columns);
26
- };
27
- }
28
-
29
- // Compute unique columns in order of discovery.
30
- function inferColumns(rows) {
31
- var columnSet = Object.create(null),
32
- columns = [];
33
-
34
- rows.forEach(function (row) {
35
- for (var column in row) {
36
- if (!(column in columnSet)) {
37
- columns.push((columnSet[column] = column));
38
- }
39
- }
40
- });
41
-
42
- return columns;
43
- }
44
-
45
- function pad(value, width) {
46
- var s = value + '',
47
- length = s.length;
48
- return length < width
49
- ? new Array(width - length + 1).join(0) + s
50
- : s;
51
- }
52
-
53
- function formatYear(year) {
54
- return year < 0
55
- ? '-' + pad(-year, 6)
56
- : year > 9999
57
- ? '+' + pad(year, 6)
58
- : pad(year, 4);
59
- }
60
-
61
- function formatDate(date) {
62
- var hours = date.getUTCHours(),
63
- minutes = date.getUTCMinutes(),
64
- seconds = date.getUTCSeconds(),
65
- milliseconds = date.getUTCMilliseconds();
66
- return isNaN(date)
67
- ? 'Invalid Date'
68
- : formatYear(date.getUTCFullYear()) +
69
- '-' +
70
- pad(date.getUTCMonth() + 1, 2) +
71
- '-' +
72
- pad(date.getUTCDate(), 2) +
73
- (milliseconds
74
- ? 'T' +
75
- pad(hours, 2) +
76
- ':' +
77
- pad(minutes, 2) +
78
- ':' +
79
- pad(seconds, 2) +
80
- '.' +
81
- pad(milliseconds, 3) +
82
- 'Z'
83
- : seconds
84
- ? 'T' +
85
- pad(hours, 2) +
86
- ':' +
87
- pad(minutes, 2) +
88
- ':' +
89
- pad(seconds, 2) +
90
- 'Z'
91
- : minutes || hours
92
- ? 'T' +
93
- pad(hours, 2) +
94
- ':' +
95
- pad(minutes, 2) +
96
- 'Z'
97
- : '');
98
- }
99
-
100
- function dsv(delimiter) {
101
- var reFormat = new RegExp('["' + delimiter + '\n\r]'),
102
- DELIMITER = delimiter.charCodeAt(0);
103
-
104
- function parse(text, f) {
105
- var convert,
106
- columns,
107
- rows = parseRows(text, function (row, i) {
108
- if (convert) return convert(row, i - 1);
109
- (columns = row),
110
- (convert = f
111
- ? customConverter(row, f)
112
- : objectConverter(row));
113
- });
114
- rows.columns = columns || [];
115
- return rows;
116
- }
117
-
118
- function parseRows(text, f) {
119
- var rows = [], // output rows
120
- N = text.length,
121
- I = 0, // current character index
122
- n = 0, // current line number
123
- t, // current token
124
- eof = N <= 0, // current token followed by EOF?
125
- eol = false; // current token followed by EOL?
126
-
127
- // Strip the trailing newline.
128
- if (text.charCodeAt(N - 1) === NEWLINE) --N;
129
- if (text.charCodeAt(N - 1) === RETURN) --N;
130
-
131
- function token() {
132
- if (eof) return EOF;
133
- if (eol) return (eol = false), EOL;
134
-
135
- // Unescape quotes.
136
- var i,
137
- j = I,
138
- c;
139
- if (text.charCodeAt(j) === QUOTE) {
140
- while (
141
- (I++ < N && text.charCodeAt(I) !== QUOTE) ||
142
- text.charCodeAt(++I) === QUOTE
143
- );
144
- if ((i = I) >= N) eof = true;
145
- else if ((c = text.charCodeAt(I++)) === NEWLINE)
146
- eol = true;
147
- else if (c === RETURN) {
148
- eol = true;
149
- if (text.charCodeAt(I) === NEWLINE) ++I;
150
- }
151
- return text.slice(j + 1, i - 1).replace(/""/g, '"');
152
- }
153
-
154
- // Find next delimiter or newline.
155
- while (I < N) {
156
- if ((c = text.charCodeAt((i = I++))) === NEWLINE)
157
- eol = true;
158
- else if (c === RETURN) {
159
- eol = true;
160
- if (text.charCodeAt(I) === NEWLINE) ++I;
161
- } else if (c !== DELIMITER) continue;
162
- return text.slice(j, i);
163
- }
164
-
165
- // Return last token before EOF.
166
- return (eof = true), text.slice(j, N);
167
- }
168
-
169
- while ((t = token()) !== EOF) {
170
- var row = [];
171
- while (t !== EOL && t !== EOF)
172
- row.push(t), (t = token());
173
- if (f && (row = f(row, n++)) == null) continue;
174
- rows.push(row);
175
- }
176
-
177
- return rows;
178
- }
179
-
180
- function preformatBody(rows, columns) {
181
- return rows.map(function (row) {
182
- return columns
183
- .map(function (column) {
184
- return formatValue(row[column]);
185
- })
186
- .join(delimiter);
187
- });
188
- }
189
-
190
- function format(rows, columns) {
191
- if (columns == null) columns = inferColumns(rows);
192
- return [columns.map(formatValue).join(delimiter)]
193
- .concat(preformatBody(rows, columns))
194
- .join('\n');
195
- }
196
-
197
- function formatBody(rows, columns) {
198
- if (columns == null) columns = inferColumns(rows);
199
- return preformatBody(rows, columns).join('\n');
200
- }
201
-
202
- function formatRows(rows) {
203
- return rows.map(formatRow).join('\n');
204
- }
205
-
206
- function formatRow(row) {
207
- return row.map(formatValue).join(delimiter);
208
- }
209
-
210
- function formatValue(value) {
211
- return value == null
212
- ? ''
213
- : value instanceof Date
214
- ? formatDate(value)
215
- : reFormat.test((value += ''))
216
- ? '"' + value.replace(/"/g, '""') + '"'
217
- : value;
218
- }
219
-
220
- return {
221
- parse: parse,
222
- parseRows: parseRows,
223
- format: format,
224
- formatBody: formatBody,
225
- formatRows: formatRows,
226
- formatRow: formatRow,
227
- formatValue: formatValue,
228
- };
229
- }
230
-
231
- var csv = dsv(',');
232
-
233
- var csvParse = csv.parse;
234
-
235
- var tsv = dsv('\t');
236
-
237
- var tsvParse = tsv.parse;
238
-
239
- export { csvParse, tsvParse };
@@ -1 +0,0 @@
1
- export { csvParse, tsvParse } from 'd3-dsv';