@malloydata/render 0.0.135-dev240322231911 → 0.0.135-dev240326020414

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 +145001 -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
package/dist/renderer.js DELETED
@@ -1,34 +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.RenderTree = void 0;
26
- class RenderTree {
27
- constructor(document, options, tagged) {
28
- this.document = document;
29
- this.options = options;
30
- this.tagged = tagged;
31
- }
32
- }
33
- exports.RenderTree = RenderTree;
34
- //# sourceMappingURL=renderer.js.map
@@ -1,57 +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.RendererFactory = void 0;
26
- class RendererFactory {
27
- constructor() {
28
- this.tagOptionExtractors = {};
29
- }
30
- addExtractor(extractor, ...tags) {
31
- for (const index in tags) {
32
- this.tagOptionExtractors[tags[index]] = extractor;
33
- }
34
- }
35
- activates(_field) {
36
- // Does not activate by default.
37
- return false;
38
- }
39
- isValidMatch(_field) {
40
- return true;
41
- }
42
- matches(renderDef) {
43
- return renderDef.renderer === this.rendererName;
44
- }
45
- parseTagParameters(tags) {
46
- const options = {};
47
- for (const tagName in this.tagOptionExtractors) {
48
- const tagValue = tags.tag(tagName);
49
- if (tagValue) {
50
- this.tagOptionExtractors[tagName](options, tagValue);
51
- }
52
- }
53
- return options;
54
- }
55
- }
56
- exports.RendererFactory = RendererFactory;
57
- //# sourceMappingURL=renderer_factory.js.map
@@ -1,25 +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
- //# sourceMappingURL=renderer_types.js.map
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SparksNested = exports.Sparks = exports.Nested = exports.Products2Column = void 0;
7
- const bars_malloy_raw_1 = __importDefault(require("./static/bars.malloy?raw"));
8
- const util_1 = require("./util");
9
- require("./themes.css");
10
- require("../component/render");
11
- const meta = {
12
- title: 'Malloy Next/Bars',
13
- render: ({ classes }, context) => {
14
- const parent = document.createElement('div');
15
- parent.style.height = 'calc(100vh - 40px)';
16
- parent.style.position = 'relative';
17
- const el = document.createElement('malloy-render');
18
- if (classes)
19
- el.classList.add(classes);
20
- el.result = context.loaded['result'];
21
- parent.appendChild(el);
22
- return parent;
23
- },
24
- loaders: [(0, util_1.createLoader)(bars_malloy_raw_1.default)],
25
- argTypes: {},
26
- };
27
- exports.default = meta;
28
- exports.Products2Column = {
29
- args: {
30
- source: 'products',
31
- view: 'category_bar',
32
- },
33
- };
34
- exports.Nested = {
35
- args: {
36
- source: 'products',
37
- view: 'nested',
38
- },
39
- };
40
- exports.Sparks = {
41
- args: {
42
- source: 'products',
43
- view: 'sparks',
44
- },
45
- };
46
- exports.SparksNested = {
47
- args: {
48
- source: 'products',
49
- view: 'sparks_nested',
50
- },
51
- };
52
- //# sourceMappingURL=bars.stories.js.map
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FlattenNestedMeasures = exports.ProductsBar = exports.ProductsTable = void 0;
7
- const basic_malloy_raw_1 = __importDefault(require("./static/basic.malloy?raw"));
8
- const render_malloy_legacy_1 = require("./render-malloy-legacy");
9
- exports.default = {
10
- title: 'Malloy Legacy/Basic',
11
- render: ({ source, view }, { globals: { connection } }) => {
12
- return (0, render_malloy_legacy_1.renderMalloy)({ script: basic_malloy_raw_1.default, source, view, connection });
13
- },
14
- argTypes: {},
15
- };
16
- exports.ProductsTable = {
17
- args: {
18
- source: 'products',
19
- view: 'records',
20
- },
21
- };
22
- exports.ProductsBar = {
23
- args: {
24
- source: 'products',
25
- view: 'category_bar',
26
- },
27
- };
28
- exports.FlattenNestedMeasures = {
29
- args: {
30
- source: 'products',
31
- view: 'flatten',
32
- },
33
- };
34
- //# sourceMappingURL=basic.stories.js.map
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ImageAltFromGrandparent = exports.ImageAltFromParent = exports.ImageAltFromRecord = void 0;
7
- const image_malloy_raw_1 = __importDefault(require("./static/image.malloy?raw"));
8
- const render_malloy_legacy_1 = require("./render-malloy-legacy");
9
- exports.default = {
10
- title: 'Malloy Legacy/Image',
11
- render: ({ source, view }, { globals: { connection } }) => {
12
- return (0, render_malloy_legacy_1.renderMalloy)({ script: image_malloy_raw_1.default, source, view, connection });
13
- },
14
- argTypes: {},
15
- };
16
- exports.ImageAltFromRecord = {
17
- args: {
18
- source: 'logos',
19
- view: 'img_from_record',
20
- },
21
- };
22
- exports.ImageAltFromParent = {
23
- args: {
24
- source: 'logos',
25
- view: 'img_from_parent',
26
- },
27
- };
28
- exports.ImageAltFromGrandparent = {
29
- args: {
30
- source: 'logos',
31
- view: 'img_from_grandparent',
32
- },
33
- };
34
- //# sourceMappingURL=image.stories.js.map
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderMalloy = void 0;
4
- const html_1 = require("../html");
5
- const util_1 = require("./util");
6
- async function runAndRender({ script, source, view, connection }, options = { dataStyles: {} }) {
7
- const viewer = new html_1.HTMLView(document);
8
- const result = await (0, util_1.runQuery)({ script, source, view, connection });
9
- return await viewer.render(result, options);
10
- }
11
- function renderMalloy(options) {
12
- const div = document.createElement('div');
13
- runAndRender(options, {
14
- dataStyles: {},
15
- isDrillingEnabled: true,
16
- onDrill: (drillQuery, _target, _drillFilters) => {
17
- navigator.clipboard.writeText(drillQuery);
18
- },
19
- }).then(el => {
20
- if (options.classes)
21
- el.classList.add(options.classes);
22
- div.replaceChildren(el);
23
- });
24
- return div;
25
- }
26
- exports.renderMalloy = renderMalloy;
27
- //# sourceMappingURL=render-malloy-legacy.js.map
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NullTest = exports.NumberFormatting = exports.Nested = exports.Products2Column = exports.ProductsTableCustomTheme = exports.ProductsTable = void 0;
7
- const tables_malloy_raw_1 = __importDefault(require("./static/tables.malloy?raw"));
8
- const util_1 = require("./util");
9
- require("./themes.css");
10
- require("../component/render");
11
- const meta = {
12
- title: 'Malloy Next/Tables',
13
- render: ({ classes }, context) => {
14
- const parent = document.createElement('div');
15
- parent.style.height = 'calc(100vh - 40px)';
16
- parent.style.position = 'relative';
17
- const el = document.createElement('malloy-render');
18
- if (classes)
19
- el.classList.add(classes);
20
- el.result = context.loaded['result'];
21
- parent.appendChild(el);
22
- return parent;
23
- },
24
- loaders: [(0, util_1.createLoader)(tables_malloy_raw_1.default)],
25
- argTypes: {},
26
- };
27
- exports.default = meta;
28
- exports.ProductsTable = {
29
- args: {
30
- source: 'products',
31
- view: 'records',
32
- },
33
- };
34
- exports.ProductsTableCustomTheme = {
35
- args: {
36
- source: 'products',
37
- view: 'records',
38
- classes: 'night',
39
- },
40
- };
41
- exports.Products2Column = {
42
- args: {
43
- source: 'products',
44
- view: 'category_bar',
45
- },
46
- };
47
- exports.Nested = {
48
- args: {
49
- source: 'products',
50
- view: 'nested',
51
- },
52
- };
53
- exports.NumberFormatting = {
54
- args: {
55
- source: 'products',
56
- view: 'number_formats',
57
- },
58
- };
59
- exports.NullTest = {
60
- args: {
61
- source: 'null_test',
62
- view: '{ select: * }',
63
- },
64
- };
65
- //# sourceMappingURL=tables.stories.js.map
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ViewThemeOverrideCSS = exports.ViewThemeOverride = exports.ModelThemeOverride = void 0;
7
- const themes_malloy_raw_1 = __importDefault(require("./static/themes.malloy?raw"));
8
- const util_1 = require("./util");
9
- require("./themes.css");
10
- require("../component/render");
11
- const meta = {
12
- title: 'Malloy Next/Themes',
13
- render: ({ classes }, context) => {
14
- const parent = document.createElement('div');
15
- parent.style.height = 'calc(100vh - 40px)';
16
- parent.style.position = 'relative';
17
- const el = document.createElement('malloy-render');
18
- if (classes)
19
- el.classList.add(classes);
20
- el.result = context.loaded['result'];
21
- parent.appendChild(el);
22
- return parent;
23
- },
24
- loaders: [(0, util_1.createLoader)(themes_malloy_raw_1.default)],
25
- argTypes: {},
26
- };
27
- exports.default = meta;
28
- exports.ModelThemeOverride = {
29
- args: {
30
- source: 'products',
31
- view: 'records',
32
- },
33
- };
34
- exports.ViewThemeOverride = {
35
- args: {
36
- source: 'products',
37
- view: 'records_override',
38
- },
39
- };
40
- exports.ViewThemeOverrideCSS = {
41
- args: {
42
- source: 'products',
43
- view: 'records_override',
44
- classes: 'night',
45
- },
46
- };
47
- //# sourceMappingURL=themes.stories.js.map
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runQuery = exports.createLoader = void 0;
4
- const malloy_1 = require("@malloydata/malloy");
5
- function createLoader(script) {
6
- return async (context) => ({
7
- result: await runQuery({
8
- script,
9
- source: context.args['source'],
10
- view: context.args['view'],
11
- connection: context.globals['connection'],
12
- }),
13
- });
14
- }
15
- exports.createLoader = createLoader;
16
- async function runQuery({ script, source, view, connection, }) {
17
- const conn = await connection;
18
- const runtime = new malloy_1.SingleConnectionRuntime(conn);
19
- const model = runtime.loadModel(script);
20
- const runner = model.loadQuery(`run: ${source} -> ${view}`);
21
- const result = await runner.run();
22
- return result;
23
- }
24
- exports.runQuery = runQuery;
25
- //# sourceMappingURL=util.js.map
@@ -1,30 +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.isFieldHidden = void 0;
26
- function isFieldHidden(field) {
27
- return field.tagParse().tag.has('hidden');
28
- }
29
- exports.isFieldHidden = isFieldHidden;
30
- //# sourceMappingURL=tags_utils.js.map