@malloydata/render 0.0.135-dev240325191847 → 0.0.135-dev240326154530

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 (86) hide show
  1. package/dist/component/render-webcomponent.d.ts +6 -0
  2. package/dist/component/render.d.ts +7 -17
  3. package/dist/component/result-context.d.ts +2 -3
  4. package/dist/component/table/table-context.d.ts +9 -0
  5. package/dist/component/{table-layout.d.ts → table/table-layout.d.ts} +2 -2
  6. package/dist/component/table/table.d.ts +9 -0
  7. package/dist/html/html_view.d.ts +1 -1
  8. package/dist/module/index.mjs +145243 -0
  9. package/dist/module/index.umd.js +1643 -0
  10. package/dist/module/style.css +1 -0
  11. package/dist/stories/bars.stories.d.ts +1 -1
  12. package/dist/stories/tables.stories.d.ts +1 -1
  13. package/dist/stories/themes.stories.d.ts +1 -1
  14. package/dist/webcomponent/malloy-render.mjs +90572 -0
  15. package/dist/webcomponent/malloy-render.umd.js +1491 -0
  16. package/dist/webcomponent/style.css +1 -0
  17. package/package.json +21 -7
  18. package/vite.config.ts +25 -0
  19. package/vite.config.webcomponent.ts +25 -0
  20. package/dist/bundle/bundled_renderer.js +0 -139374
  21. package/dist/bundle/bundled_renderer.min.js +0 -2374
  22. package/dist/bundle/main.js +0 -29
  23. package/dist/bundle/renderer.js +0 -71
  24. package/dist/component/bar-chart.js +0 -130
  25. package/dist/component/chart-settings.js +0 -152
  26. package/dist/component/render-numeric-field.js +0 -104
  27. package/dist/component/render-result-metadata.js +0 -91
  28. package/dist/component/render.js +0 -155
  29. package/dist/component/result-context.js +0 -28
  30. package/dist/component/table-layout.js +0 -83
  31. package/dist/component/table.d.ts +0 -35
  32. package/dist/component/table.js +0 -375
  33. package/dist/component/util.js +0 -53
  34. package/dist/component/vega-chart.js +0 -105
  35. package/dist/component/vega-lite-base-spec.js +0 -61
  36. package/dist/component/vega-types.js +0 -34
  37. package/dist/data_styles.js +0 -50
  38. package/dist/drill.js +0 -124
  39. package/dist/html/area_sparkline.js +0 -118
  40. package/dist/html/bar_chart.js +0 -70
  41. package/dist/html/bar_sparkline.js +0 -119
  42. package/dist/html/boolean.js +0 -53
  43. package/dist/html/bytes.js +0 -47
  44. package/dist/html/cartesian_chart.js +0 -110
  45. package/dist/html/chart.js +0 -120
  46. package/dist/html/column_sparkline.js +0 -120
  47. package/dist/html/container.js +0 -44
  48. package/dist/html/currency.js +0 -75
  49. package/dist/html/dashboard.js +0 -242
  50. package/dist/html/data_volume.js +0 -94
  51. package/dist/html/date.js +0 -66
  52. package/dist/html/duration.js +0 -108
  53. package/dist/html/html_view.js +0 -187
  54. package/dist/html/image.js +0 -77
  55. package/dist/html/index.js +0 -28
  56. package/dist/html/json.js +0 -52
  57. package/dist/html/line_chart.js +0 -72
  58. package/dist/html/link.js +0 -57
  59. package/dist/html/list.js +0 -73
  60. package/dist/html/list_detail.js +0 -33
  61. package/dist/html/number.js +0 -73
  62. package/dist/html/percent.js +0 -50
  63. package/dist/html/point_map.js +0 -182
  64. package/dist/html/scatter_chart.js +0 -72
  65. package/dist/html/segment_map.js +0 -151
  66. package/dist/html/shape_map.js +0 -194
  67. package/dist/html/sparkline.js +0 -120
  68. package/dist/html/state_codes.js +0 -137
  69. package/dist/html/table.js +0 -475
  70. package/dist/html/text.js +0 -65
  71. package/dist/html/unsupported.js +0 -72
  72. package/dist/html/utils.js +0 -277
  73. package/dist/html/vega_spec.js +0 -544
  74. package/dist/index.js +0 -47
  75. package/dist/main_renderer_factory.js +0 -101
  76. package/dist/renderer.js +0 -34
  77. package/dist/renderer_factory.js +0 -57
  78. package/dist/renderer_types.js +0 -25
  79. package/dist/stories/bars.stories.js +0 -52
  80. package/dist/stories/basic.stories.js +0 -34
  81. package/dist/stories/image.stories.js +0 -34
  82. package/dist/stories/render-malloy-legacy.js +0 -27
  83. package/dist/stories/tables.stories.js +0 -65
  84. package/dist/stories/themes.stories.js +0 -47
  85. package/dist/stories/util.js +0 -25
  86. package/dist/tags_utils.js +0 -30
@@ -1,544 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2023 Google LLC
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining
6
- * a copy of this software and associated documentation files
7
- * (the "Software"), to deal in the Software without restriction,
8
- * including without limitation the rights to use, copy, modify, merge,
9
- * publish, distribute, sublicense, and/or sell copies of the Software,
10
- * and to permit persons to whom the Software is furnished to do so,
11
- * subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be
14
- * included in all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
- */
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.VegaRendererFactory = exports.HTMLVegaSpecRenderer = exports.isDataContainer = exports.vegaSpecs = exports.DEFAULT_SPEC = void 0;
26
- const chart_1 = require("./chart");
27
- const utils_1 = require("./utils");
28
- const renderer_factory_1 = require("../renderer_factory");
29
- exports.DEFAULT_SPEC = {
30
- $schema: 'https://vega.github.io/schema/vega-lite/v5.json',
31
- config: {
32
- params: [
33
- {
34
- name: 'defaultFont',
35
- value: "var(--malloy-font-family, 'Roboto')",
36
- },
37
- { name: 'titleColor', value: 'var(--malloy-title-color, #505050)' },
38
- { name: 'labelColor', value: 'var(--malloy-label-color, #505050)' },
39
- ],
40
- background: undefined,
41
- color: { expr: 'titleColor' },
42
- header: {
43
- labelFont: { expr: 'defaultFont' },
44
- titleFont: { expr: 'defaultFont' },
45
- titleFontWeight: 500,
46
- },
47
- text: {
48
- font: { expr: 'defaultFont' },
49
- color: { expr: 'labelColor' },
50
- },
51
- mark: {
52
- font: { expr: 'defaultFont' },
53
- color: { expr: 'labelColor' },
54
- },
55
- title: {
56
- font: { expr: 'defaultFont' },
57
- subtitleFont: { expr: 'defaultFont' },
58
- fontWeight: 500,
59
- },
60
- axis: {
61
- labelColor: { expr: 'labelColor' },
62
- labelFont: { expr: 'defaultFont' },
63
- titleFont: { expr: 'defaultFont' },
64
- titleFontWeight: 500,
65
- titleColor: { expr: 'titleColor' },
66
- titleFontSize: 12,
67
- },
68
- legend: {
69
- titleFontWeight: 500,
70
- titleColor: { expr: 'titleColor' },
71
- titleFontSize: 12,
72
- labelColor: { expr: 'labelColor' },
73
- labelFont: { expr: 'defaultFont' },
74
- titleFont: { expr: 'defaultFont' },
75
- },
76
- },
77
- };
78
- const sizeSmall = {
79
- height: 80,
80
- width: 150,
81
- };
82
- const sizeSmallWidth = {
83
- width: 150,
84
- };
85
- const sizeSmallHeightStep = {
86
- height: { step: 13 },
87
- };
88
- const sizeSmallStep = { ...sizeSmallWidth, ...sizeSmallHeightStep };
89
- const sizeMediumStep = { ...sizeSmallWidth };
90
- const sizeMedium = {
91
- height: 150,
92
- width: 200,
93
- };
94
- const sizeLarge = {
95
- // height: 350,
96
- // width: 500,
97
- };
98
- // bar with text in the bars.
99
- const bar_SM = {
100
- // TODO, the following causes errors in Typescript 5.
101
- // config is the only property in DEFAULT_SPEC, just
102
- // reference that directly and ponder the madness of
103
- // Typescript another day.
104
- // ...DEFAULT_SPEC,
105
- config: exports.DEFAULT_SPEC.config,
106
- encoding: {
107
- y: { field: '#{1}', type: 'nominal', axis: null, sort: null },
108
- },
109
- layer: [
110
- {
111
- mark: { type: 'bar', color: '#aec7e8' },
112
- encoding: {
113
- x: {
114
- field: '#{2}',
115
- type: 'quantitative',
116
- sort: null,
117
- },
118
- color: { value: '#4285F4' },
119
- },
120
- },
121
- {
122
- mark: { type: 'text', align: 'left', x: 5 },
123
- encoding: {
124
- text: { field: '#{1}' },
125
- },
126
- },
127
- ],
128
- };
129
- const bar_SM_large = {
130
- ...exports.DEFAULT_SPEC,
131
- mark: 'bar',
132
- data: [],
133
- encoding: {
134
- x: { field: '#{1}', type: 'nominal', sort: null },
135
- y: { field: '#{2}', type: 'quantitative', sort: null },
136
- color: { value: '#4285F4' },
137
- },
138
- };
139
- const bar_SMM_large = {
140
- ...bar_SM_large,
141
- encoding: {
142
- ...bar_SM_large.encoding,
143
- color: {
144
- field: '#{3}',
145
- type: 'quantitative',
146
- scale: (0, utils_1.getColorScale)('quantitative', true, true),
147
- },
148
- },
149
- };
150
- const bar_SMS_large = {
151
- ...bar_SM_large,
152
- encoding: {
153
- ...bar_SM_large.encoding,
154
- color: {
155
- field: '#{3}',
156
- scale: (0, utils_1.getColorScale)('nominal', true, true),
157
- },
158
- },
159
- };
160
- const bar_SMS = {
161
- ...bar_SM,
162
- layer: [
163
- {
164
- ...bar_SM.layer[0],
165
- encoding: {
166
- ...bar_SM.layer[0].encoding,
167
- color: {
168
- field: '#{3}',
169
- scale: (0, utils_1.getColorScale)('nominal', true, true),
170
- },
171
- },
172
- },
173
- bar_SM.layer[1],
174
- ],
175
- };
176
- const bar_SMM = {
177
- ...bar_SM,
178
- layer: [
179
- {
180
- ...bar_SM.layer[0],
181
- encoding: {
182
- ...bar_SM.layer[0].encoding,
183
- color: {
184
- field: '#{3}',
185
- type: 'quantitative',
186
- scale: (0, utils_1.getColorScale)('quantitative', true, true),
187
- },
188
- },
189
- },
190
- bar_SM.layer[1],
191
- ],
192
- };
193
- // simple column chart
194
- const bar_NM = {
195
- ...exports.DEFAULT_SPEC,
196
- mark: 'bar',
197
- data: [],
198
- encoding: {
199
- x: { field: '#{1}', type: 'nominal', sort: null },
200
- y: { field: '#{2}', type: 'quantitative', sort: null },
201
- color: { value: '#4285F4' },
202
- },
203
- };
204
- const bar_NMS = {
205
- ...bar_NM,
206
- encoding: {
207
- ...bar_NM.encoding,
208
- color: {
209
- field: '#{3}',
210
- type: 'nominal',
211
- scale: (0, utils_1.getColorScale)('nominal', true),
212
- },
213
- },
214
- };
215
- const bar_NMM = {
216
- ...bar_NM,
217
- encoding: {
218
- ...bar_NM.encoding,
219
- color: {
220
- field: '#{3}',
221
- type: 'quantitative',
222
- scale: (0, utils_1.getColorScale)('quantitative', true),
223
- },
224
- },
225
- };
226
- exports.vegaSpecs = {
227
- bar_SM,
228
- 'bar_SM_small': { ...bar_SM, ...sizeSmallStep },
229
- 'bar_SM_medium': { ...bar_SM, ...sizeMediumStep }, // just use the default runs long
230
- bar_SM_large,
231
- bar_SMS,
232
- 'bar_SMS_small': { ...bar_SMS, ...sizeSmallStep },
233
- 'bar_SMS_medium': { ...bar_SMS, ...sizeMediumStep },
234
- bar_SMS_large,
235
- bar_SMM,
236
- 'bar_SMM_small': { ...bar_SMM, ...sizeSmallStep },
237
- 'bar_SMM_medium': { ...bar_SMM, ...sizeMediumStep },
238
- bar_SMM_large,
239
- bar_NM,
240
- 'bar_NM_small': { ...bar_NM, ...sizeSmall },
241
- 'bar_NM_medium': { ...bar_NM, ...sizeMedium }, // just use the default runs long
242
- 'bar_NM_large': { ...bar_NM },
243
- bar_NMS,
244
- 'bar_NMS_small': { ...bar_NMS, ...sizeSmall },
245
- 'bar_NMS_medium': { ...bar_NMS, ...sizeMedium },
246
- 'bar_NMS_large': { ...bar_NMS, ...sizeLarge },
247
- bar_NMM,
248
- 'bar_NMM_small': { ...bar_NMM, ...sizeSmall },
249
- 'bar_NMM_medium': { ...bar_NMM, ...sizeMedium },
250
- 'bar_NMM_large': { ...bar_NMM, ...sizeLarge },
251
- 'bar_SSMMM': {
252
- ...exports.DEFAULT_SPEC,
253
- repeat: ['#{3}', '#{4}', '#{5}'],
254
- spec: {
255
- description: 'A simple bar chart with embedded data.',
256
- encoding: {
257
- y: { field: '#{1}', type: 'nominal', axis: null, sort: null },
258
- },
259
- layer: [
260
- {
261
- mark: {
262
- type: 'bar',
263
- },
264
- encoding: {
265
- x: {
266
- field: { repeat: 'repeat' },
267
- type: 'quantitative',
268
- sort: null,
269
- },
270
- color: {
271
- field: '#{2}',
272
- scale: (0, utils_1.getColorScale)('nominal', true, true),
273
- },
274
- },
275
- },
276
- {
277
- mark: { type: 'text', align: 'left', x: 5 },
278
- encoding: {
279
- text: { field: '#{1}' },
280
- detail: { aggregate: 'count' },
281
- },
282
- },
283
- ],
284
- },
285
- },
286
- 'bubble_NNM': {
287
- ...exports.DEFAULT_SPEC,
288
- data: [],
289
- mark: 'circle',
290
- width: 400,
291
- encoding: {
292
- y: {
293
- field: '#{1}',
294
- type: 'ordinal',
295
- sort: null,
296
- },
297
- x: {
298
- field: '#{2}',
299
- type: 'ordinal',
300
- sort: null,
301
- },
302
- size: {
303
- field: '#{3}',
304
- type: 'quantitative',
305
- },
306
- color: { value: '#4285F4' },
307
- },
308
- },
309
- 'heat_NNM': {
310
- ...exports.DEFAULT_SPEC,
311
- data: [],
312
- mark: 'bar',
313
- width: 400,
314
- encoding: {
315
- y: {
316
- field: '#{1}',
317
- type: 'ordinal',
318
- sort: null,
319
- },
320
- x: {
321
- field: '#{2}',
322
- type: 'ordinal',
323
- sort: null,
324
- },
325
- color: {
326
- field: '#{3}',
327
- type: 'quantitative',
328
- scale: (0, utils_1.getColorScale)('quantitative', false),
329
- },
330
- },
331
- },
332
- 'heat_SNM': {
333
- ...exports.DEFAULT_SPEC,
334
- data: [],
335
- mark: 'bar',
336
- width: 400,
337
- encoding: {
338
- y: {
339
- field: '#{1}',
340
- type: 'nominal',
341
- sort: null,
342
- },
343
- x: {
344
- field: '#{2}',
345
- type: 'ordinal',
346
- sort: null,
347
- },
348
- color: {
349
- field: '#{3}',
350
- type: 'quantitative',
351
- scale: (0, utils_1.getColorScale)('quantitative', false),
352
- },
353
- },
354
- },
355
- 'stacked_line_STM': {
356
- ...exports.DEFAULT_SPEC,
357
- height: 50,
358
- data: [],
359
- mark: 'area',
360
- encoding: {
361
- x: {
362
- field: '#{2}',
363
- type: 'temporal',
364
- axis: { grid: false },
365
- sort: null,
366
- },
367
- y: {
368
- field: '#{3}',
369
- type: 'quantitative',
370
- axis: { grid: false },
371
- title: null,
372
- sort: null,
373
- },
374
- color: {
375
- field: '#{1}',
376
- type: 'nominal',
377
- legend: null,
378
- scale: (0, utils_1.getColorScale)('nominal', false),
379
- },
380
- row: {
381
- field: '#{1}',
382
- type: 'nominal',
383
- },
384
- },
385
- },
386
- 'grid_line_SSTM': {
387
- ...exports.DEFAULT_SPEC,
388
- height: 50,
389
- data: [],
390
- mark: 'area',
391
- encoding: {
392
- x: {
393
- field: '#{3}',
394
- type: 'temporal',
395
- axis: { grid: false },
396
- sort: null,
397
- },
398
- y: {
399
- field: '#{4}',
400
- type: 'quantitative',
401
- axis: { grid: false },
402
- title: null,
403
- sort: null,
404
- },
405
- color: {
406
- field: '#{1}',
407
- type: 'nominal',
408
- legend: null,
409
- scale: (0, utils_1.getColorScale)('nominal', false),
410
- },
411
- row: {
412
- field: '#{1}',
413
- type: 'nominal',
414
- },
415
- column: {
416
- field: '#{2}',
417
- type: 'nominal',
418
- },
419
- },
420
- },
421
- };
422
- function isDataContainer(a) {
423
- return Array.isArray(a) || (a !== null && typeof a === 'object');
424
- }
425
- exports.isDataContainer = isDataContainer;
426
- class HTMLVegaSpecRenderer extends chart_1.HTMLChartRenderer {
427
- constructor(document, styleDefaults, options, field, vegaRenderOptions) {
428
- super(document, styleDefaults, options);
429
- const spec = vegaRenderOptions.spec;
430
- if (spec) {
431
- this.spec = spec;
432
- }
433
- else if (vegaRenderOptions.spec_name) {
434
- const vegaRenderer = options.dataStyles[vegaRenderOptions.spec_name];
435
- if (vegaRenderer !== undefined && vegaRenderer.renderer === 'vega') {
436
- if (vegaRenderer.spec) {
437
- this.spec = vegaRenderer.spec;
438
- }
439
- else {
440
- throw new Error(`No spec defined on ${vegaRenderOptions.spec_name}`);
441
- }
442
- }
443
- else {
444
- throw new Error(`No Vega renderer named ${vegaRenderOptions.spec_name}`);
445
- }
446
- }
447
- else {
448
- throw new Error(`No top level vega spec defined for ${field.name}`);
449
- }
450
- }
451
- getDataValue(data) {
452
- if (data.isNull()) {
453
- return null;
454
- }
455
- else if (data.isTimestamp() ||
456
- data.isDate() ||
457
- data.isNumber() ||
458
- data.isString()) {
459
- return data.value;
460
- }
461
- else {
462
- throw new Error('Invalid field type for vega chart.');
463
- }
464
- }
465
- getDataType(field) {
466
- if (field.isAtomicField()) {
467
- if (field.isDate() || field.isTimestamp() || field.isString()) {
468
- return 'nominal';
469
- }
470
- else if (field.isNumber()) {
471
- return 'quantitative';
472
- }
473
- }
474
- throw new Error('Invalid field type for vega chart.');
475
- }
476
- translateField(explore, fieldString) {
477
- const m = fieldString.match(/#\{(\d+)\}/);
478
- if (m && m.groups) {
479
- return explore.intrinsicFields[parseInt(m.groups[1]) - 1].name;
480
- }
481
- return fieldString;
482
- }
483
- translateFields(node, explore) {
484
- if (Array.isArray(node)) {
485
- for (const e of node) {
486
- if (isDataContainer(e)) {
487
- this.translateFields(e, explore);
488
- }
489
- }
490
- }
491
- else if (node && typeof node === 'object') {
492
- for (const [key, value] of Object.entries(node)) {
493
- if (key === 'field' && typeof value === 'string') {
494
- node[key] = this.translateField(explore, value);
495
- }
496
- else if (key === 'repeat' && Array.isArray(value)) {
497
- for (const k of value.keys()) {
498
- const fieldName = value[k];
499
- if (typeof fieldName === 'string') {
500
- value[k] = this.translateField(explore, fieldName);
501
- }
502
- }
503
- }
504
- else {
505
- if (isDataContainer(value)) {
506
- this.translateFields(value, explore);
507
- }
508
- }
509
- }
510
- }
511
- }
512
- // formatData(data: QueryDataRow, metadata: StructDef): VegaData {
513
- // const ret: VegaData = [];
514
- // for (const row of QueryDataRow) {
515
- // forEach){
516
- // }
517
- // }
518
- // return ret;
519
- // }
520
- getVegaLiteSpec(data) {
521
- if (data.isNull() || !data.isArray()) {
522
- throw new Error('Expected struct value not to be null.');
523
- }
524
- const newSpec = structuredClone(this.spec);
525
- this.translateFields(newSpec, data.field);
526
- const rdata = {
527
- values: this.mapData(data),
528
- };
529
- newSpec.data = rdata;
530
- return newSpec;
531
- }
532
- }
533
- exports.HTMLVegaSpecRenderer = HTMLVegaSpecRenderer;
534
- class VegaRendererFactory extends renderer_factory_1.RendererFactory {
535
- create(document, styleDefaults, rendererOptions, field, options) {
536
- return new HTMLVegaSpecRenderer(document, styleDefaults, rendererOptions, field, options);
537
- }
538
- get rendererName() {
539
- return 'vega';
540
- }
541
- }
542
- exports.VegaRendererFactory = VegaRendererFactory;
543
- VegaRendererFactory.instance = new VegaRendererFactory();
544
- //# sourceMappingURL=vega_spec.js.map
package/dist/index.js DELETED
@@ -1,47 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2023 Google LLC
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining
6
- * a copy of this software and associated documentation files
7
- * (the "Software"), to deal in the Software without restriction,
8
- * including without limitation the rights to use, copy, modify, merge,
9
- * publish, distribute, sublicense, and/or sell copies of the Software,
10
- * and to permit persons to whom the Software is furnished to do so,
11
- * subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be
14
- * included in all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
- */
24
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- var desc = Object.getOwnPropertyDescriptor(m, k);
27
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
28
- desc = { enumerable: true, get: function() { return m[k]; } };
29
- }
30
- Object.defineProperty(o, k2, desc);
31
- }) : (function(o, m, k, k2) {
32
- if (k2 === undefined) k2 = k;
33
- o[k2] = m[k];
34
- }));
35
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getDrillQuery = exports.JSONView = exports.HTMLView = void 0;
40
- var html_view_1 = require("./html/html_view");
41
- Object.defineProperty(exports, "HTMLView", { enumerable: true, get: function () { return html_view_1.HTMLView; } });
42
- Object.defineProperty(exports, "JSONView", { enumerable: true, get: function () { return html_view_1.JSONView; } });
43
- __exportStar(require("./data_styles"), exports);
44
- // Needed for test only.
45
- var drill_1 = require("./drill");
46
- Object.defineProperty(exports, "getDrillQuery", { enumerable: true, get: function () { return drill_1.getDrillQuery; } });
47
- //# sourceMappingURL=index.js.map
@@ -1,101 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright 2023 Google LLC
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining
6
- * a copy of this software and associated documentation files
7
- * (the "Software"), to deal in the Software without restriction,
8
- * including without limitation the rights to use, copy, modify, merge,
9
- * publish, distribute, sublicense, and/or sell copies of the Software,
10
- * and to permit persons to whom the Software is furnished to do so,
11
- * subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be
14
- * included in all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
- */
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.MainRendererFactory = void 0;
26
- const shape_map_1 = require("./html/shape_map");
27
- const point_map_1 = require("./html/point_map");
28
- const image_1 = require("./html/image");
29
- const segment_map_1 = require("./html/segment_map");
30
- const json_1 = require("./html/json");
31
- const sparkline_1 = require("./html/sparkline");
32
- const bar_sparkline_1 = require("./html/bar_sparkline");
33
- const area_sparkline_1 = require("./html/area_sparkline");
34
- const column_sparkline_1 = require("./html/column_sparkline");
35
- const scatter_chart_1 = require("./html/scatter_chart");
36
- const bar_chart_1 = require("./html/bar_chart");
37
- const vega_spec_1 = require("./html/vega_spec");
38
- const line_chart_1 = require("./html/line_chart");
39
- const date_1 = require("./html/date");
40
- const currency_1 = require("./html/currency");
41
- const percent_1 = require("./html/percent");
42
- const number_1 = require("./html/number");
43
- const bytes_1 = require("./html/bytes");
44
- const boolean_1 = require("./html/boolean");
45
- const link_1 = require("./html/link");
46
- const unsupported_1 = require("./html/unsupported");
47
- const text_1 = require("./html/text");
48
- const data_volume_1 = require("./html/data_volume");
49
- const duration_1 = require("./html/duration");
50
- class MainRendererFactory {
51
- create(renderDef, tagged, document, styleDefaults, rendererOptions, field, timezone) {
52
- let factory;
53
- for (const f of MainRendererFactory.renderFactories) {
54
- if (((this.matchesRenderDef(renderDef, f) || this.matchesTag(tagged, f)) &&
55
- f.isValidMatch(field)) ||
56
- f.activates(field)) {
57
- factory = f;
58
- // Important to break so the first factory that matches is applied.
59
- break;
60
- }
61
- }
62
- return factory === null || factory === void 0 ? void 0 : factory.create(document, styleDefaults, rendererOptions, field, renderDef || factory.parseTagParameters(tagged) || {}, timezone);
63
- }
64
- matchesRenderDef(renderDef, factory) {
65
- return (renderDef &&
66
- factory.rendererName &&
67
- renderDef.renderer === factory.rendererName);
68
- }
69
- matchesTag(tagged, factory) {
70
- return factory.rendererName && tagged.has(factory.rendererName);
71
- }
72
- }
73
- exports.MainRendererFactory = MainRendererFactory;
74
- MainRendererFactory.renderFactories = [
75
- shape_map_1.ShapeMapRendererFactory.instance,
76
- point_map_1.PointMapRendererFactory.instance,
77
- image_1.ImageRendererFactory.instance,
78
- segment_map_1.SegmentMapRendererFactory.instance,
79
- json_1.JSONRendererFactory.instance,
80
- line_chart_1.LineChartRendererFactory.instance,
81
- column_sparkline_1.ColumnSparkLineRendererFactory.instance,
82
- bar_sparkline_1.BarSparkLineRendererFactory.instance,
83
- area_sparkline_1.AreaSparkLineRendererFactory.instance,
84
- // This factory needs to be after the other Spark Line factories, so it doesn't override them.
85
- sparkline_1.SparkLineRendererFactory.instance,
86
- scatter_chart_1.ScatterChartRendererFactory.instance,
87
- bar_chart_1.BarChartRendererFactory.instance,
88
- vega_spec_1.VegaRendererFactory.instance,
89
- date_1.DateRendererFactory.instance,
90
- currency_1.CurrencyRendererFactory.instance,
91
- percent_1.PercentRendererFactory.instance,
92
- data_volume_1.DataVolumeRendererFactory.instance,
93
- bytes_1.BytesRendererFactory.instance,
94
- link_1.LinkRendererFactory.instance,
95
- duration_1.DurationRendererFactory.instance,
96
- boolean_1.BooleanRendererFactory.instance,
97
- number_1.NumberRendererFactory.instance,
98
- unsupported_1.UnsupportedRendererFactory.instance,
99
- text_1.TextRendererFactory.instance,
100
- ];
101
- //# sourceMappingURL=main_renderer_factory.js.map