@malloydata/render 0.0.116-dev240104225124 → 0.0.116-dev240105181617

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.
@@ -11,7 +11,10 @@ function getAbsolutePath(value) {
11
11
  }
12
12
 
13
13
  const config: StorybookConfig = {
14
- 'stories': ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
14
+ 'stories': [
15
+ '../src/stories/*.mdx',
16
+ '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
17
+ ],
15
18
  staticDirs: ['../src/stories/static'],
16
19
  'addons': [
17
20
  getAbsolutePath('@storybook/addon-links'),
@@ -0,0 +1,16 @@
1
+ <link rel="preconnect" href="https://rsms.me/" />
2
+ <link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
3
+ <link rel="icon" href="./favicon.ico" />
4
+ <style>
5
+ :root {
6
+ font-family: Inter, sans-serif;
7
+ font-feature-settings:
8
+ 'liga' 1,
9
+ 'calt' 1; /* fix for Chrome */
10
+ }
11
+ @supports (font-variation-settings: normal) {
12
+ :root {
13
+ font-family: InterVariable, sans-serif;
14
+ }
15
+ }
16
+ </style>
@@ -0,0 +1,16 @@
1
+ import {addons} from '@storybook/manager-api';
2
+ import theme from './theme';
3
+
4
+ addons.setConfig({
5
+ theme,
6
+ isFullscreen: false,
7
+ showNav: true,
8
+ showPanel: false,
9
+ panelPosition: 'bottom',
10
+ enableShortcuts: true,
11
+ showToolbar: false,
12
+ selectedPanel: undefined,
13
+ initialActive: 'sidebar',
14
+ sidebar: {},
15
+ toolbar: {},
16
+ });
@@ -1,2 +1,15 @@
1
1
  <link rel="preconnect" href="https://rsms.me/" />
2
2
  <link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
3
+ <style>
4
+ :root {
5
+ font-family: Inter, sans-serif;
6
+ font-feature-settings:
7
+ 'liga' 1,
8
+ 'calt' 1; /* fix for Chrome */
9
+ }
10
+ @supports (font-variation-settings: normal) {
11
+ :root {
12
+ font-family: InterVariable, sans-serif;
13
+ }
14
+ }
15
+ </style>
@@ -1,6 +1,7 @@
1
1
  import {DuckDBWASMConnection} from '@malloydata/db-duckdb/wasm';
2
2
  import {Preview} from '@storybook/html';
3
3
  import registeredData from './registered_data.json';
4
+ import theme from './theme';
4
5
 
5
6
  async function createConnection() {
6
7
  const connection = new DuckDBWASMConnection('duckdb', null, undefined, {
@@ -26,6 +27,9 @@ const preview: Preview = {
26
27
  date: /Date$/i,
27
28
  },
28
29
  },
30
+ docs: {
31
+ theme,
32
+ },
29
33
  },
30
34
  globals: {
31
35
  connection: createConnection(),
@@ -0,0 +1,12 @@
1
+ import {create} from '@storybook/theming/create';
2
+
3
+ export default create({
4
+ base: 'light',
5
+ brandTitle:
6
+ '<div style="display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 500;"><img src="https://docs.malloydata.dev/img/logo.png" style="height: 24px"/><div>Renderer</div></div>',
7
+ brandUrl: 'https://malloydata.github.io',
8
+ fontBase: '"Inter", "Open Sans", sans-serif',
9
+ fontCode: 'monospace',
10
+ colorSecondary: '#477DEC',
11
+ appBg: '#ECF1FB',
12
+ });
@@ -1,4 +1,4 @@
1
- import { Result } from '@malloydata/malloy';
1
+ import { Result, Tag } from '@malloydata/malloy';
2
2
  import { LitElement, PropertyValues } from 'lit';
3
3
  import './table';
4
4
  import './bar-chart';
@@ -8,6 +8,7 @@ export declare class MalloyRender extends LitElement {
8
8
  result: Result;
9
9
  metadata: RenderResultMetadata;
10
10
  willUpdate(changedProperties: PropertyValues<this>): void;
11
+ updateTheme(modelTheme?: Tag, localTheme?: Tag): void;
11
12
  render(): import("lit-html").TemplateResult<1>;
12
13
  }
13
14
  declare global {
@@ -53,13 +53,14 @@ let MalloyRender = class MalloyRender extends lit_1.LitElement {
53
53
  willUpdate(changedProperties) {
54
54
  if (changedProperties.has('result')) {
55
55
  this.metadata = (0, render_result_metadata_1.getResultMetadata)(this.result);
56
+ const modelTag = this.result.modelTag;
57
+ const { tag: resultTag } = this.result.tagParse();
58
+ const modelTheme = modelTag.tag('theme');
59
+ const localTheme = resultTag.tag('theme');
60
+ this.updateTheme(modelTheme, localTheme);
56
61
  }
57
62
  }
58
- render() {
59
- const modelTag = this.result.modelTag;
60
- const { tag: resultTag } = this.result.tagParse();
61
- const modelTheme = modelTag.tag('theme');
62
- const localTheme = resultTag.tag('theme');
63
+ updateTheme(modelTheme, localTheme) {
63
64
  const tableRowHeight = getThemeValue('tableRowHeight', localTheme, modelTheme);
64
65
  const tableBodyColor = getThemeValue('tableBodyColor', localTheme, modelTheme);
65
66
  const tableFontSize = getThemeValue('tableFontSize', localTheme, modelTheme);
@@ -72,26 +73,24 @@ let MalloyRender = class MalloyRender extends lit_1.LitElement {
72
73
  const tablePinnedBackground = getThemeValue('tablePinnedBackground', localTheme, modelTheme);
73
74
  const tablePinnedBorder = getThemeValue('tablePinnedBorder', localTheme, modelTheme);
74
75
  const fontFamily = getThemeValue('fontFamily', localTheme, modelTheme);
75
- const dynamicStyle = (0, lit_1.html) `<style>
76
- :host {
77
- --malloy-render--table-row-height: ${tableRowHeight};
78
- --malloy-render--table-body-color: ${tableBodyColor};
79
- --malloy-render--table-font-size: ${tableFontSize};
80
- --malloy-render--font-family: ${fontFamily};
81
- --malloy-render--table-header-color: ${tableHeaderColor};
82
- --malloy-render--table-header-weight: ${tableHeaderWeight};
83
- --malloy-render--table-body-weight: ${tableBodyWeight};
84
- --malloy-render--table-border: ${tableBorder};
85
- --malloy-render--table-background: ${tableBackground};
86
- --malloy-render--table-gutter-size: ${tableGutterSize};
87
- --malloy-render--table-pinned-background: ${tablePinnedBackground};
88
- --malloy-render--table-pinned-border: ${tablePinnedBorder};
89
- }
90
- </style>`;
91
- return (0, lit_1.html) `${dynamicStyle}<malloy-table
92
- exportparts="table-container: container"
93
- .data=${this.result.data}
94
- ></malloy-table>`;
76
+ this.style.setProperty('--malloy-render--table-row-height', tableRowHeight);
77
+ this.style.setProperty('--malloy-render--table-body-color', tableBodyColor);
78
+ this.style.setProperty('--malloy-render--table-font-size', tableFontSize);
79
+ this.style.setProperty('--malloy-render--font-family', fontFamily);
80
+ this.style.setProperty('--malloy-render--table-header-color', tableHeaderColor);
81
+ this.style.setProperty('--malloy-render--table-header-weight', tableHeaderWeight);
82
+ this.style.setProperty('--malloy-render--table-body-weight', tableBodyWeight);
83
+ this.style.setProperty('--malloy-render--table-border', tableBorder);
84
+ this.style.setProperty('--malloy-render--table-background', tableBackground);
85
+ this.style.setProperty('--malloy-render--table-gutter-size', tableGutterSize);
86
+ this.style.setProperty('--malloy-render--table-pinned-background', tablePinnedBackground);
87
+ this.style.setProperty('--malloy-render--table-pinned-border', tablePinnedBorder);
88
+ }
89
+ render() {
90
+ return (0, lit_1.html) `<malloy-table
91
+ exportparts="table-container: container"
92
+ .data=${this.result.data}
93
+ ></malloy-table>`;
95
94
  }
96
95
  };
97
96
  exports.MalloyRender = MalloyRender;
@@ -21,3 +21,9 @@ export declare const Sparks: {
21
21
  view: string;
22
22
  };
23
23
  };
24
+ export declare const SparksNested: {
25
+ args: {
26
+ source: string;
27
+ view: string;
28
+ };
29
+ };
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Sparks = exports.Nested = exports.Products2Column = void 0;
6
+ exports.SparksNested = exports.Sparks = exports.Nested = exports.Products2Column = void 0;
7
7
  const bars_malloy_raw_1 = __importDefault(require("./static/bars.malloy?raw"));
8
8
  const util_1 = require("./util");
9
9
  require("./themes.css");
@@ -43,4 +43,10 @@ exports.Sparks = {
43
43
  view: 'sparks',
44
44
  },
45
45
  };
46
+ exports.SparksNested = {
47
+ args: {
48
+ source: 'products',
49
+ view: 'sparks_nested',
50
+ },
51
+ };
46
52
  //# sourceMappingURL=bars.stories.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/render",
3
- "version": "0.0.116-dev240104225124",
3
+ "version": "0.0.116-dev240105181617",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@lit/context": "^1.1.0",
27
- "@malloydata/malloy": "^0.0.116-dev240104225124",
27
+ "@malloydata/malloy": "^0.0.116-dev240105181617",
28
28
  "@types/luxon": "^2.4.0",
29
29
  "lit": "^3.0.2",
30
30
  "lodash": "^4.17.20",