@malloydata/render 0.0.210 → 0.0.211-dev241112165721

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.
@@ -139,7 +139,8 @@ export function viteMalloyStoriesPlugin(): PluginOption {
139
139
  };`
140
140
  : `
141
141
  import script from '${id}?raw';
142
- import {createLoader, copyMalloyRenderHTML} from './util';
142
+ import {createLoader} from './util';
143
+ import {copyMalloyRenderHTML} from '../component/copy-to-html';
143
144
  import './themes.css';
144
145
  import '../component/render-webcomponent';
145
146
 
@@ -0,0 +1,2 @@
1
+ import { MalloyRenderProps } from './render';
2
+ export declare function copyMalloyRenderHTML(element: HTMLElement & MalloyRenderProps): Promise<void>;
@@ -1,7 +1,8 @@
1
1
  import { ModelDef, QueryResult, Result } from '@malloydata/malloy';
2
+ import { Accessor } from 'solid-js';
2
3
  import './render.css';
3
4
  import { ComponentOptions, ICustomElement } from 'component-register';
4
- import { MalloyClickEventPayload, VegaConfigHandler } from './types';
5
+ import { DashboardConfig, MalloyClickEventPayload, TableConfig, VegaConfigHandler } from './types';
5
6
  export type MalloyRenderProps = {
6
7
  result?: Result;
7
8
  queryResult?: QueryResult;
@@ -9,13 +10,17 @@ export type MalloyRenderProps = {
9
10
  scrollEl?: HTMLElement;
10
11
  onClick?: (payload: MalloyClickEventPayload) => void;
11
12
  vegaConfigOverride?: VegaConfigHandler;
13
+ tableConfig?: Partial<TableConfig>;
14
+ dashboardConfig?: Partial<DashboardConfig>;
12
15
  };
13
16
  export declare const useConfig: () => {
14
- onClick?: ((payload: MalloyClickEventPayload) => void) | undefined;
15
- vegaConfigOverride?: VegaConfigHandler | undefined;
17
+ tableConfig: Accessor<TableConfig>;
18
+ dashboardConfig: Accessor<DashboardConfig>;
16
19
  element: ICustomElement;
17
20
  addCSSToShadowRoot: (css: string) => void;
18
21
  addCSSToDocument: (id: string, css: string) => void;
22
+ onClick?: ((payload: MalloyClickEventPayload) => void) | undefined;
23
+ vegaConfigOverride?: VegaConfigHandler | undefined;
19
24
  };
20
25
  export declare function MalloyRender(props: MalloyRenderProps, { element }: ComponentOptions): import("solid-js").JSX.Element;
21
26
  export declare function MalloyRenderInner(props: {
@@ -86,4 +86,11 @@ export type Channel = {
86
86
  fields: string[];
87
87
  type: ScaleType | null;
88
88
  };
89
+ export type TableConfig = {
90
+ disableVirtualization: boolean;
91
+ rowLimit: number;
92
+ };
93
+ export type DashboardConfig = {
94
+ disableVirtualization: boolean;
95
+ };
89
96
  export {};
package/dist/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export { HTMLView, JSONView } from './html/html_view';
2
2
  export * from './html/data_styles';
3
3
  export type { MalloyRenderProps } from './component/render';
4
4
  export { getDrillQuery } from './html/drill';
5
+ export { copyMalloyRenderHTML } from './component/copy-to-html';
@@ -51805,7 +51805,7 @@ Cd.exploreQueryWalkerBuilder = dTe;
51805
51805
  var Oe = {}, V5 = {};
51806
51806
  Object.defineProperty(V5, "__esModule", { value: !0 });
51807
51807
  V5.MALLOY_VERSION = void 0;
51808
- V5.MALLOY_VERSION = "0.0.210";
51808
+ V5.MALLOY_VERSION = "0.0.211";
51809
51809
  Object.defineProperty(Oe, "__esModule", { value: !0 });
51810
51810
  Oe.CSVWriter = Oe.JSONWriter = Oe.DataWriter = Oe.DataRecord = Oe.DataArray = Oe.Result = Oe.ExploreMaterializer = Oe.PreparedResultMaterializer = Oe.QueryMaterializer = Oe.ModelMaterializer = Oe.SingleConnectionRuntime = Oe.ConnectionRuntime = Oe.Runtime = Oe.ExploreField = Oe.JoinRelationship = Oe.QueryField = Oe.Query = Oe.StringField = Oe.UnsupportedField = Oe.JSONField = Oe.BooleanField = Oe.NumberField = Oe.TimestampField = Oe.DateField = Oe.TimestampTimeframe = Oe.DateTimeframe = Oe.AtomicField = Oe.AtomicFieldType = Oe.Explore = Oe.SourceRelationship = Oe.FixedConnectionMap = Oe.InMemoryURLReader = Oe.EmptyURLReader = Oe.PreparedResult = Oe.DocumentCompletion = Oe.DocumentSymbol = Oe.DocumentPosition = Oe.DocumentRange = Oe.DocumentTablePath = Oe.Parse = Oe.PreparedQuery = Oe.Model = Oe.MalloyError = Oe.Malloy = void 0;
51811
51811
  const hTe = X8, fr = cs, LM = CK, yn = Su, d6 = rh, pTe = V5;
@@ -145484,12 +145484,61 @@ function iE(t, e, n, r, i) {
145484
145484
  );
145485
145485
  }), s.childRenderers = o, s;
145486
145486
  }
145487
+ async function Wst(t) {
145488
+ let e = "";
145489
+ const n = t.tableConfig ?? {}, r = Object.assign(
145490
+ {
145491
+ disableVirtualization: !0
145492
+ },
145493
+ n
145494
+ );
145495
+ t.tableConfig = r;
145496
+ const i = t.dashboardConfig ?? {}, s = Object.assign(
145497
+ {
145498
+ disableVirtualization: !0
145499
+ },
145500
+ i
145501
+ );
145502
+ if (t.dashboardConfig = s, t.shadowRoot) {
145503
+ let o = "";
145504
+ for (const u of [...t.shadowRoot.adoptedStyleSheets]) {
145505
+ for (let l = 0; l < u.cssRules.length; l++) {
145506
+ const c = u.cssRules.item(l);
145507
+ c && (o += `
145508
+ ` + c.cssText);
145509
+ }
145510
+ o = o.replaceAll(":host", ".malloy_html_host");
145511
+ const a = t.getAttribute("style");
145512
+ e = `
145513
+ <div>
145514
+ <style>
145515
+ ${o}
145516
+
145517
+ form.vega-bindings {
145518
+ margin-block: 0em;
145519
+ }
145520
+ </style>
145521
+ <div class="malloy_html_host" style="${a}">
145522
+ ${t.shadowRoot.innerHTML}
145523
+ </div>
145524
+ </div>
145525
+ `;
145526
+ }
145527
+ } else
145528
+ e = t.innerHTML;
145529
+ try {
145530
+ await navigator.clipboard.writeText(e), t.tableConfig = n, t.dashboardConfig = i;
145531
+ } catch (o) {
145532
+ console.error("Failed to copy text: ", o), t.tableConfig = n, t.dashboardConfig = i;
145533
+ }
145534
+ }
145487
145535
  export {
145488
145536
  I1 as Currency,
145489
145537
  vc as DataVolumeUnit,
145490
145538
  Vn as DurationUnit,
145491
145539
  Qst as HTMLView,
145492
145540
  Gst as JSONView,
145541
+ Wst as copyMalloyRenderHTML,
145493
145542
  BJ as getDrillQuery,
145494
145543
  mit as isDurationUnit
145495
145544
  };