@sqlrooms/mosaic 0.5.0 → 0.5.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"VgPlotChart.js","sourceRoot":"","sources":["../src/VgPlotChart.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAO,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAK,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAK5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,EAAC,IAAI,EAAC,EAAE,EAAE;IAC1D,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAClD,SAAS,CAAC,GAAG,EAAE;QACb,CAAC,KAAK,IAAI,EAAE;YACV,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;gBACzB,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;gBAClC,MAAM,EACJ,OAAO,EAAE,sCAAsC;kBAChD,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;gBACxB,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;YACjD,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAEzB,OAAO,cAAK,GAAG,EAAE,YAAY,GAAI,CAAC;AACpC,CAAC,CAAC"}
1
+ {"version":3,"file":"VgPlotChart.js","sourceRoot":"","sources":["../src/VgPlotChart.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAO,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAK,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAK5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,EAAC,IAAI,EAAC,EAAE,EAAE;IAC1D,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAClD,SAAS,CAAC,GAAG,EAAE;QACb,CAAC,KAAK,IAAI,EAAE;YACV,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;gBACzB,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;gBAClC,MAAM,EACJ,OAAO,EAAE,sCAAsC;kBAChD,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;gBACxB,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;YACjD,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAEzB,OAAO,cAAK,GAAG,EAAE,YAAY,GAAI,CAAC;AACpC,CAAC,CAAC","sourcesContent":["import {astToDOM, parseSpec, Spec} from '@uwdata/mosaic-spec';\nimport {FC, useEffect, useRef} from 'react';\n\ntype VgPlotChartProps = {\n spec: Spec;\n};\n/**\n * Renders a Vega-Lite chart using the Mosaic library.\n *\n * @param {VgPlotChartProps} props - The component props.\n * @param {Spec} props.spec - The Vega-Lite specification for the chart.\n * @returns {React.ReactElement} The rendered chart component.\n */\nexport const VgPlotChart: FC<VgPlotChartProps> = ({spec}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n (async () => {\n if (containerRef.current) {\n const ast = await parseSpec(spec);\n const {\n element, // root DOM element of the application\n } = await astToDOM(ast);\n containerRef.current?.replaceChildren(element);\n }\n })();\n }, [spec, containerRef]);\n\n return <div ref={containerRef} />;\n};\n"]}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC","sourcesContent":["export {getMosaicConnector, useMosaic} from './use-mosaic';\nexport {VgPlotChart} from './VgPlotChart';\nexport type {Spec} from '@uwdata/mosaic-spec';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"use-mosaic.js","sourceRoot":"","sources":["../src/use-mosaic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAE,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAG1C,IAAI,SAA0B,CAAC;AAE/B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAC;IACjC,SAAS,GAAG,MAAM,WAAW,EAAE,CAAC,iBAAiB,CAC/C,aAAa,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC,EAAE;QACjB,UAAU,EAAE,MAAM,CAAC,IAAI;KACxB,CAAC,CACH,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAmB,CAAC;IAC9D,SAAS,CAAC,GAAG,EAAE;QACb,kBAAkB,EAAE;aACjB,IAAI,CAAC,YAAY,CAAC;aAClB,OA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AAS,EAAE,eAAe,EAAE,SAAS,EAAC,CAAC;AAClE,CAAC","sourcesContent":["import {getDuckDb} from '@sqlrooms/duckdb';\nimport {coordinator, wasmConnector} from '@uwdata/mosaic-core';\nimport {useEffect, useState} from 'react';\n\ntype MosaicConnector = ReturnType<typeof coordinator>['databaseConnector'];\nlet connector: MosaicConnector;\n\n/**\n * Retrieves a Mosaic connector for the DuckDB database.\n *\n * @returns {Promise<MosaicConnector>} The Mosaic connector for the DuckDB database.\n */\nexport async function getMosaicConnector() {\n if (connector) {\n return connector;\n }\n const duckDb = await getDuckDb();\n connector = await coordinator().databaseConnector(\n wasmConnector({\n duckDb: duckDb.db,\n connection: duckDb.conn,\n }),\n );\n return connector;\n}\n\n/**\n * Hook to manage the Mosaic connector.\n *\n * @returns {Object} An object containing the Mosaic connector and a loading state.\n */\nexport function useMosaic() {\n const [isLoading, setIsLoading] = useState(true);\n const [connector, setConnector] = useState<MosaicConnector>();\n useEffect(() => {\n getMosaicConnector()\n .then(setConnector)\n .finally(() => setIsLoading(false));\n }, []);\n return {isMosaicLoading: isLoading, mosaicConnector: connector};\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sqlrooms/mosaic",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@ai-sdk/provider": "^1.0.7",
23
- "@sqlrooms/duckdb": "0.5.0",
23
+ "@sqlrooms/duckdb": "0.5.1",
24
24
  "@uwdata/mosaic-core": "^0.12.2",
25
25
  "@uwdata/mosaic-spec": "^0.12.2",
26
26
  "@uwdata/vgplot": "^0.12.2"
@@ -35,5 +35,5 @@
35
35
  "lint": "eslint .",
36
36
  "typedoc": "typedoc"
37
37
  },
38
- "gitHead": "2a27ef8a774f934c8150dce57aac22699fb6d22f"
38
+ "gitHead": "5e41362f1552ee1f8a661c487fe7cdb606cc6d23"
39
39
  }