diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 60a035fb..1f1ac6f3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,7 +1,7 @@ { "packages/cli": "0.0.3", - "packages/components": "0.2.24", - "packages/squiggle-lang": "0.2.11", + "packages/components": "0.3.1", + "packages/squiggle-lang": "0.3.0", "packages/vscode-ext": "0.3.1", - "packages/website": "0.2.1" + "packages/website": "0.3.0" } diff --git a/packages/components/package.json b/packages/components/package.json index 0ffbed0a..77e5e263 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,26 +1,26 @@ { "name": "@quri/squiggle-components", - "version": "0.2.24", + "version": "0.3.1", "license": "MIT", "dependencies": { "@floating-ui/react-dom": "^1.0.0", - "@floating-ui/react-dom-interactions": "^0.9.1", + "@floating-ui/react-dom-interactions": "^0.9.2", "@headlessui/react": "^1.6.6", "@heroicons/react": "^1.0.6", "@hookform/resolvers": "^2.9.7", - "@quri/squiggle-lang": "^0.2.8", + "@quri/squiggle-lang": "^0.3.0", "@react-hook/size": "^2.1.2", "clsx": "^1.2.1", - "framer-motion": "^7.0.0", + "framer-motion": "^7.2.0", "lodash": "^4.17.21", "react": "^18.1.0", "react-ace": "^10.1.0", - "react-hook-form": "^7.34.0", + "react-hook-form": "^7.34.2", "react-use": "^17.4.0", "react-vega": "^7.6.0", "vega": "^5.22.1", "vega-embed": "^6.21.0", - "vega-lite": "^5.4.0", + "vega-lite": "^5.5.0", "vscode-uri": "^3.0.3", "yup": "^0.32.11" }, @@ -36,12 +36,12 @@ "@storybook/react": "^6.5.10", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.3.0", - "@testing-library/user-event": "^14.4.2", + "@testing-library/user-event": "^14.4.3", "@types/jest": "^27.5.0", - "@types/lodash": "^4.14.182", - "@types/node": "^18.6.4", + "@types/lodash": "^4.14.184", + "@types/node": "^18.7.9", "@types/react": "^18.0.9", - "@types/styled-components": "^5.1.24", + "@types/styled-components": "^5.1.26", "@types/webpack": "^5.28.0", "cross-env": "^7.0.3", "mini-css-extract-plugin": "^2.6.1", @@ -58,7 +58,7 @@ "web-vitals": "^2.1.4", "webpack": "^5.74.0", "webpack-cli": "^4.10.0", - "webpack-dev-server": "^4.9.3" + "webpack-dev-server": "^4.10.0" }, "peerDependencies": { "react": "^16.8.0 || ^17 || ^18", diff --git a/packages/components/src/components/DistributionChart.tsx b/packages/components/src/components/DistributionChart.tsx index 1e1c3822..79536e12 100644 --- a/packages/components/src/components/DistributionChart.tsx +++ b/packages/components/src/components/DistributionChart.tsx @@ -4,6 +4,8 @@ import { result, distributionError, distributionErrorToString, + squiggleExpression, + resultMap, } from "@quri/squiggle-lang"; import { Vega } from "react-vega"; import { ErrorAlert } from "./Alert"; @@ -14,6 +16,8 @@ import { DistributionChartSpecOptions, } from "../lib/distributionSpecBuilder"; import { NumberShower } from "./NumberShower"; +import { Plot, parsePlot } from "../lib/plotParser"; +import { flattenResult } from "../lib/utility"; import { hasMassBelowZero } from "../lib/distributionUtils"; export type DistributionPlottingSettings = { @@ -23,26 +27,41 @@ export type DistributionPlottingSettings = { } & DistributionChartSpecOptions; export type DistributionChartProps = { - distribution: Distribution; + plot: Plot; width?: number; height: number; } & DistributionPlottingSettings; +export function defaultPlot(distribution: Distribution): Plot { + return { distributions: [{ name: "default", distribution }] }; +} + +export function makePlot(record: { + [key: string]: squiggleExpression; +}): Plot | void { + const plotResult = parsePlot(record); + if (plotResult.tag === "Ok") { + return plotResult.value; + } +} + export const DistributionChart: React.FC = (props) => { - const { - distribution, - height, - showSummary, - width, - logX, - actions = false, - } = props; - const shape = distribution.pointSet(); + const { plot, height, showSummary, width, logX, actions = false } = props; const [sized] = useSize((size) => { - if (shape.tag === "Error") { + let shapes = flattenResult( + plot.distributions.map((x) => + resultMap(x.distribution.pointSet(), (shape) => ({ + name: x.name, + // color: x.color, // not supported yet + continuous: shape.continuous, + discrete: shape.discrete, + })) + ) + ); + if (shapes.tag === "Error") { return ( - {distributionErrorToString(shape.value)} + {distributionErrorToString(shapes.value)} ); } @@ -56,24 +75,29 @@ export const DistributionChart: React.FC = (props) => { ); widthProp = 20; } + const domain = shapes.value.flatMap((shape) => + shape.discrete.concat(shape.continuous) + ); return (
- {logX && hasMassBelowZero(shape.value) ? ( + {logX && shapes.value.some(hasMassBelowZero) ? ( Cannot graph distribution with negative values on logarithmic scale. ) : ( )}
- {showSummary && } + {showSummary && plot.distributions.length === 1 && ( + + )}
); diff --git a/packages/components/src/components/FunctionChart1Dist.tsx b/packages/components/src/components/FunctionChart1Dist.tsx index f8d072d7..402bebe0 100644 --- a/packages/components/src/components/FunctionChart1Dist.tsx +++ b/packages/components/src/components/FunctionChart1Dist.tsx @@ -16,6 +16,7 @@ import * as percentilesSpec from "../vega-specs/spec-percentiles.json"; import { DistributionChart, DistributionPlottingSettings, + defaultPlot, } from "./DistributionChart"; import { NumberShower } from "./NumberShower"; import { ErrorAlert } from "./Alert"; @@ -179,7 +180,7 @@ export const FunctionChart1Dist: React.FC = ({ let showChart = mouseItem.tag === "Ok" && mouseItem.value.tag === "distribution" ? ( = ({ title, minX, maxX, - color = defaultColor, tickFormat = defaultTickFormat, distributionChartActions, code: controlledCode, @@ -268,7 +264,6 @@ export const SquigglePlayground: FC = ({ title, minX, maxX, - color, tickFormat, distributionChartActions, showSummary, diff --git a/packages/components/src/components/SquiggleViewer/ExpressionViewer.tsx b/packages/components/src/components/SquiggleViewer/ExpressionViewer.tsx index 9a3e266e..51f8dcb4 100644 --- a/packages/components/src/components/SquiggleViewer/ExpressionViewer.tsx +++ b/packages/components/src/components/SquiggleViewer/ExpressionViewer.tsx @@ -1,7 +1,7 @@ import React from "react"; import { squiggleExpression, declaration } from "@quri/squiggle-lang"; import { NumberShower } from "../NumberShower"; -import { DistributionChart } from "../DistributionChart"; +import { DistributionChart, defaultPlot, makePlot } from "../DistributionChart"; import { FunctionChart, FunctionChartSettings } from "../FunctionChart"; import clsx from "clsx"; import { VariableBox } from "./VariableBox"; @@ -102,7 +102,7 @@ export const ExpressionViewer: React.FC = ({ {(settings) => { return ( = ({ case "module": { return ( - {(settings) => + {(_) => Object.entries(expression.value) - .filter(([key, r]) => !key.match(/^(Math|System)\./)) + .filter(([key, _]) => !key.match(/^(Math|System)\./)) .map(([key, r]) => ( = ({ ); } case "record": - return ( - - {(settings) => - Object.entries(expression.value).map(([key, r]) => ( - - )) - } - - ); + const plot = makePlot(expression.value); + if (plot) { + return ( + { + let disableLogX = plot.distributions.some((x) => { + let pointSet = x.distribution.pointSet(); + return ( + pointSet.tag === "Ok" && hasMassBelowZero(pointSet.value) + ); + }); + return ( + + ); + }} + > + {(settings) => { + return ( + + ); + }} + + ); + } else { + return ( + + {(_) => + Object.entries(expression.value).map(([key, r]) => ( + + )) + } + + ); + } case "array": return ( - {(settings) => + {(_) => expression.value.map((r, i) => ( - diff --git a/packages/components/src/lib/distributionSpecBuilder.ts b/packages/components/src/lib/distributionSpecBuilder.ts index 4dc87baa..2b3ac952 100644 --- a/packages/components/src/lib/distributionSpecBuilder.ts +++ b/packages/components/src/lib/distributionSpecBuilder.ts @@ -10,8 +10,6 @@ export type DistributionChartSpecOptions = { minX?: number; /** The maximum x coordinate shown on the chart */ maxX?: number; - /** The color of the chart */ - color?: string; /** The title of the chart */ title?: string; /** The formatting of the ticks */ @@ -25,36 +23,14 @@ export let linearXScale: LinearScale = { range: "width", zero: false, nice: false, - domain: { - fields: [ - { - data: "con", - field: "x", - }, - { - data: "dis", - field: "x", - }, - ], - }, + domain: { data: "domain", field: "x" }, }; export let linearYScale: LinearScale = { name: "yscale", type: "linear", range: "height", zero: true, - domain: { - fields: [ - { - data: "con", - field: "y", - }, - { - data: "dis", - field: "y", - }, - ], - }, + domain: { data: "domain", field: "y" }, }; export let logXScale: LogScale = { @@ -65,18 +41,7 @@ export let logXScale: LogScale = { base: 10, nice: false, clamp: true, - domain: { - fields: [ - { - data: "con", - field: "x", - }, - { - data: "dis", - field: "x", - }, - ], - }, + domain: { data: "domain", field: "x" }, }; export let expYScale: PowScale = { @@ -86,29 +51,16 @@ export let expYScale: PowScale = { range: "height", zero: true, nice: false, - domain: { - fields: [ - { - data: "con", - field: "y", - }, - { - data: "dis", - field: "y", - }, - ], - }, + domain: { data: "domain", field: "y" }, }; export const defaultTickFormat = ".9~s"; -export const defaultColor = "#739ECC"; export function buildVegaSpec( specOptions: DistributionChartSpecOptions ): VisualizationSpec { - let { + const { format = defaultTickFormat, - color = defaultColor, title, minX, maxX, @@ -127,20 +79,32 @@ export function buildVegaSpec( let spec: VisualizationSpec = { $schema: "https://vega.github.io/schema/vega/v5.json", - description: "A basic area chart example", + description: "Squiggle plot chart", width: 500, height: 100, padding: 5, data: [ { - name: "con", + name: "data", }, { - name: "dis", + name: "domain", }, ], signals: [], - scales: [xScale, expY ? expYScale : linearYScale], + scales: [ + xScale, + expY ? expYScale : linearYScale, + { + name: "color", + type: "ordinal", + domain: { + data: "data", + field: "name", + }, + range: { scheme: "blues" }, + }, + ], axes: [ { orient: "bottom", @@ -152,108 +116,178 @@ export function buildVegaSpec( domainOpacity: 0.0, format: format, tickCount: 10, + labelOverlap: "greedy", }, ], marks: [ { - type: "area", + name: "all_distributions", + type: "group", from: { - data: "con", - }, - encode: { - update: { - interpolate: { value: "linear" }, - x: { - scale: "xscale", - field: "x", - }, - y: { - scale: "yscale", - field: "y", - }, - y2: { - scale: "yscale", - value: 0, - }, - fill: { - value: color, - }, - fillOpacity: { - value: 1, - }, + facet: { + name: "distribution_facet", + data: "data", + groupby: ["name"], }, }, + marks: [ + { + name: "continuous_distribution", + type: "group", + from: { + facet: { + name: "continuous_facet", + data: "distribution_facet", + field: "continuous", + }, + }, + encode: { + update: {}, + }, + marks: [ + { + name: "continuous_area", + type: "area", + from: { + data: "continuous_facet", + }, + encode: { + update: { + interpolate: { value: "linear" }, + x: { + scale: "xscale", + field: "x", + }, + y: { + scale: "yscale", + field: "y", + }, + fill: { + scale: "color", + field: { parent: "name" }, + }, + y2: { + scale: "yscale", + value: 0, + }, + fillOpacity: { + value: 1, + }, + }, + }, + }, + ], + }, + { + name: "discrete_distribution", + type: "group", + from: { + facet: { + name: "discrete_facet", + data: "distribution_facet", + field: "discrete", + }, + }, + marks: [ + { + type: "rect", + from: { + data: "discrete_facet", + }, + encode: { + enter: { + width: { + value: 1, + }, + }, + update: { + x: { + scale: "xscale", + field: "x", + }, + y: { + scale: "yscale", + field: "y", + }, + y2: { + scale: "yscale", + value: 0, + }, + fill: { + scale: "color", + field: { parent: "name" }, + }, + }, + }, + }, + { + type: "symbol", + from: { + data: "discrete_facet", + }, + encode: { + enter: { + shape: { + value: "circle", + }, + size: [{ value: 100 }], + tooltip: { + signal: "{ probability: datum.y, value: datum.x }", + }, + }, + update: { + x: { + scale: "xscale", + field: "x", + }, + y: { + scale: "yscale", + field: "y", + }, + fill: { + scale: "color", + field: { parent: "name" }, + }, + }, + }, + }, + ], + }, + ], }, + ], + legends: [ { - type: "rect", - from: { - data: "dis", - }, + fill: "color", + orient: "top", + labelFontSize: 12, encode: { - enter: { - width: { - value: 1, + symbols: { + update: { + fill: [ + { test: "length(domain('color')) == 1", value: "transparent" }, + { scale: "color", field: "value" }, + ], }, }, - update: { - x: { - scale: "xscale", - field: "x", - }, - y: { - scale: "yscale", - field: "y", - }, - y2: { - scale: "yscale", - value: 0, - }, - fill: { - value: "#2f65a7", - }, - }, - }, - }, - { - type: "symbol", - from: { - data: "dis", - }, - encode: { - enter: { - shape: { - value: "circle", - }, - size: [{ value: 100 }], - tooltip: { - signal: "{ probability: datum.y, value: datum.x }", - }, - }, - update: { - x: { - scale: "xscale", - field: "x", - }, - y: { - scale: "yscale", - field: "y", - }, - fill: { - value: "#1e4577", + labels: { + interactive: true, + update: { + fill: [ + { test: "length(domain('color')) == 1", value: "transparent" }, + { value: "black" }, + ], }, }, }, }, ], - }; - if (title) { - spec = { - ...spec, + ...(title && { title: { text: title, }, - }; - } + }), + }; return spec; } diff --git a/packages/components/src/lib/plotParser.ts b/packages/components/src/lib/plotParser.ts new file mode 100644 index 00000000..9d5e224a --- /dev/null +++ b/packages/components/src/lib/plotParser.ts @@ -0,0 +1,72 @@ +import * as yup from "yup"; +import { Distribution, result, squiggleExpression } from "@quri/squiggle-lang"; + +export type LabeledDistribution = { + name: string; + distribution: Distribution; + color?: string; +}; + +export type Plot = { + distributions: LabeledDistribution[]; +}; + +function error(err: b): result { + return { tag: "Error", value: err }; +} + +function ok(x: a): result { + return { tag: "Ok", value: x }; +} + +const schema = yup + .object() + .strict() + .noUnknown() + .shape({ + distributions: yup.object().shape({ + tag: yup.mixed().oneOf(["array"]), + value: yup + .array() + .of( + yup.object().shape({ + tag: yup.mixed().oneOf(["record"]), + value: yup.object({ + name: yup.object().shape({ + tag: yup.mixed().oneOf(["string"]), + value: yup.string().required(), + }), + // color: yup + // .object({ + // tag: yup.mixed().oneOf(["string"]), + // value: yup.string().required(), + // }) + // .default(undefined), + distribution: yup.object({ + tag: yup.mixed().oneOf(["distribution"]), + value: yup.mixed(), + }), + }), + }) + ) + .required(), + }), + }); + +export function parsePlot(record: { + [key: string]: squiggleExpression; +}): result { + try { + const plotRecord = schema.validateSync(record); + return ok({ + distributions: plotRecord.distributions.value.map((x) => ({ + name: x.value.name.value, + // color: x.value.color?.value, // not supported yet + distribution: x.value.distribution.value, + })), + }); + } catch (e) { + const message = e instanceof Error ? e.message : "Unknown error"; + return error(message); + } +} diff --git a/packages/components/src/lib/utility.ts b/packages/components/src/lib/utility.ts new file mode 100644 index 00000000..d4d3661b --- /dev/null +++ b/packages/components/src/lib/utility.ts @@ -0,0 +1,37 @@ +import { result } from "@quri/squiggle-lang"; + +export function flattenResult(x: result[]): result { + if (x.length === 0) { + return { tag: "Ok", value: [] }; + } else { + if (x[0].tag === "Error") { + return x[0]; + } else { + let rest = flattenResult(x.splice(1)); + if (rest.tag === "Error") { + return rest; + } else { + return { tag: "Ok", value: [x[0].value].concat(rest.value) }; + } + } + } +} + +export function resultBind( + x: result, + fn: (y: a) => result +): result { + if (x.tag === "Ok") { + return fn(x.value); + } else { + return x; + } +} + +export function all(arr: boolean[]): boolean { + return arr.reduce((x, y) => x && y, true); +} + +export function some(arr: boolean[]): boolean { + return arr.reduce((x, y) => x || y, false); +} diff --git a/packages/components/src/stories/SquiggleChart.stories.mdx b/packages/components/src/stories/SquiggleChart.stories.mdx index bc289c36..3c272982 100644 --- a/packages/components/src/stories/SquiggleChart.stories.mdx +++ b/packages/components/src/stories/SquiggleChart.stories.mdx @@ -93,6 +93,33 @@ could be continuous, discrete or mixed. +## Multiple plots + + + + {Template.bind({})} + + + ## Constants A constant is a simple number as a result. This has special formatting rules diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Category/Reducer_Category_Module_TypeChecker_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Category/Reducer_Category_Module_TypeChecker_test.res deleted file mode 100644 index b5351787..00000000 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Category/Reducer_Category_Module_TypeChecker_test.res +++ /dev/null @@ -1,4 +0,0 @@ -open Jest -open Expect - -test("todo", () => expect("1")->toBe("1")) diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_TypeChecker_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_TypeChecker_test.res index efd9bb18..a3ee2712 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_TypeChecker_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_TypeChecker_test.res @@ -68,3 +68,5 @@ myTypeCheckTest(test, "number | string", "1", "Ok") myTypeCheckTest(test, "date | string", "1", "Expected type: (date | string) but got: 1") myTypeCheckTest(test, "number<-min(10)", "10", "Ok") myTypeCheckTest(test, "number<-min(10)", "0", "Expected type: number<-min(10) but got: 0") +myTypeCheckTest(test, "any", "0", "Ok") +myTypeCheckTest(test, "any", "'a'", "Ok") diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_switch_replacement_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_switch_replacement_test.res new file mode 100644 index 00000000..16f0f118 --- /dev/null +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Type/Reducer_Type_switch_replacement_test.res @@ -0,0 +1,123 @@ +open Jest +open Expect + +module DispatchT = Reducer_Dispatch_T +module Expression = Reducer_Expression +module ExpressionT = Reducer_Expression_T +module TypeCompile = Reducer_Type_Compile +module TypeChecker = Reducer_Type_TypeChecker +open ReducerInterface_InternalExpressionValue + +type errorValue = Reducer_ErrorValue.errorValue + +// Let's build a function to replace switch statements +// In dispatchChainPiece, we execute an return the result of execution if there is a type match. +// Otherwise we return None so that the call chain can continue. +// So we want to build a function like +// dispatchChainPiece = (call: functionCall, environment): option> + +// Now lets make the dispatchChainPiece itself. +// Note that I am not passing the reducer to the dispatchChainPiece as an argument because it is in the context anyway. +// Keep in mind that reducerFn is necessary for map/reduce so dispatchChainPiece should have a reducerFn in context. + +let makeMyDispatchChainPiece = (reducer: ExpressionT.reducerFn): DispatchT.dispatchChainPiece => { + // Let's have a pure implementations + module Implementation = { + let stringConcat = (a: string, b: string): string => Js.String2.concat(a, b) + let arrayConcat = ( + a: Js.Array2.t, + b: Js.Array2.t, + ): Js.Array2.t => Js.Array2.concat(a, b) + let plot = _r => "yey, plotted" + } + + let extractStringString = args => + switch args { + | [IEvString(a), IEvString(b)] => (a, b) + | _ => raise(Reducer_Exception.ImpossibleException("extractStringString developer error")) + } + + let extractArrayArray = args => + switch args { + | [IEvArray(a), IEvArray(b)] => (a, b) + | _ => raise(Reducer_Exception.ImpossibleException("extractArrayArray developer error")) + } + + // Let's bridge the pure implementation to expression values + module Bridge = { + let stringConcat: DispatchT.genericIEvFunction = (args, _environment) => { + let (a, b) = extractStringString(args) + Implementation.stringConcat(a, b)->IEvString->Ok + } + let arrayConcat: DispatchT.genericIEvFunction = (args, _environment) => { + let (a, b) = extractArrayArray(args) + Implementation.arrayConcat(a, b)->IEvArray->Ok + } + let plot: DispatchT.genericIEvFunction = (args, _environment) => { + switch args { + // Just assume that we are doing the business of extracting and converting the deep record + | [IEvRecord(_)] => Implementation.plot({"title": "This is a plot"})->IEvString->Ok + | _ => raise(Reducer_Exception.ImpossibleException("plot developer error")) + } + } + } + + // concat functions are to illustrate polymoprhism. And the plot function is to illustrate complex types + let jumpTable = [ + ( + "concat", + TypeCompile.fromTypeExpressionExn("string=>string=>string", reducer), + Bridge.stringConcat, + ), + ( + "concat", + TypeCompile.fromTypeExpressionExn("[any]=>[any]=>[any]", reducer), + Bridge.arrayConcat, + ), + ( + "plot", + TypeCompile.fromTypeExpressionExn( + // Nested complex types are available + // records {property: type} + // arrays [type] + // tuples [type, type] + // <- type contracts are available naturally and they become part of dispatching + // Here we are not enumerating the possibilities because type checking has a dedicated test + "{title: string, line: {width: number, color: string}}=>string", + reducer, + ), + Bridge.plot, + ), + ] + + //Here we are creating a dispatchChainPiece function that will do the actual dispatch from the jumpTable + Reducer_Dispatch_ChainPiece.makeFromTypes(jumpTable) +} + +// And finally, let's write a library dispatch for our external library +// Exactly the same as the one used in real life +let _dispatch = ( + call: functionCall, + environment, + reducer: Reducer_Expression_T.reducerFn, + chain, +): result => { + let dispatchChainPiece = makeMyDispatchChainPiece(reducer) + dispatchChainPiece(call, environment)->E.O2.defaultFn(() => chain(call, environment, reducer)) +} + +// What is important about this implementation? +// A) Exactly the same function jump table can be used to create type guarded lambda functions +// Guarded lambda functions will be the basis of the next version of Squiggle +// B) Complicated recursive record types are not a problem. + +describe("Type Dispatch", () => { + let reducerFn = Expression.reduceExpression + let dispatchChainPiece = makeMyDispatchChainPiece(reducerFn) + test("stringConcat", () => { + let call: functionCall = ("concat", [IEvString("hello"), IEvString("world")]) + + let result = dispatchChainPiece(call, defaultEnvironment) + expect(result)->toEqual(Some(Ok(IEvString("helloworld")))) + }) +}) diff --git a/packages/squiggle-lang/package.json b/packages/squiggle-lang/package.json index 0709737a..9c0d56f2 100644 --- a/packages/squiggle-lang/package.json +++ b/packages/squiggle-lang/package.json @@ -1,6 +1,6 @@ { "name": "@quri/squiggle-lang", - "version": "0.2.11", + "version": "0.3.0", "homepage": "https://squiggle-language.com", "license": "MIT", "scripts": { diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Pointset.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Pointset.res index 4f4e1731..44b6abd2 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Pointset.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Pointset.res @@ -23,6 +23,30 @@ let inputsTodist = (inputs: array, makeDist) => { expressionValue } +module Internal = { + type t = PointSetDist.t + + let toType = (r): result< + ReducerInterface_InternalExpressionValue.t, + Reducer_ErrorValue.errorValue, + > => + switch r { + | Ok(r) => Ok(Wrappers.evDistribution(PointSet(r))) + | Error(err) => Error(REOperationError(err)) + } + + let doLambdaCall = (aLambdaValue, list, environment, reducer) => + switch Reducer_Expression_Lambda.doLambdaCall(aLambdaValue, list, environment, reducer) { + | Ok(IEvNumber(f)) => Ok(f) + | _ => Error(Operation.SampleMapNeedsNtoNFunction) + } + + let mapY = (pointSetDist: t, aLambdaValue, env, reducer) => { + let fn = r => doLambdaCall(aLambdaValue, list{IEvNumber(r)}, env, reducer) + PointSetDist.T.mapYResult(~fn, pointSetDist)->toType + } +} + let library = [ Function.make( ~name="fromDist", @@ -53,6 +77,27 @@ let library = [ ], (), ), + Function.make( + ~name="mapY", + ~nameSpace, + ~requiresNamespace=true, + ~examples=[`PointSet.mapY(mx(normal(5,2)), {|x| x + 1})`], + ~output=ReducerInterface_InternalExpressionValue.EvtDistribution, + ~definitions=[ + FnDefinition.make( + ~name="mapY", + ~inputs=[FRTypeDist, FRTypeLambda], + ~run=(inputs, _, env, reducer) => + switch inputs { + | [IEvDistribution(PointSet(dist)), IEvLambda(lambda)] => + Internal.mapY(dist, lambda, env, reducer)->E.R2.errMap(Reducer_ErrorValue.errorToString) + | _ => Error(impossibleError) + }, + (), + ), + ], + (), + ), Function.make( ~name="makeContinuous", ~nameSpace, diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Sampleset.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Sampleset.res index 27b870ee..c40fe349 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Sampleset.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Sampleset.res @@ -92,7 +92,7 @@ let library = [ GenericDist.toSampleSetDist(dist, env.sampleCount) ->E.R2.fmap(Wrappers.sampleSet) ->E.R2.fmap(Wrappers.evDistribution) - ->E.R2.errMap(_ => "") + ->E.R2.errMap(DistributionTypes.Error.toString) | _ => Error(impossibleError) }, (), @@ -158,7 +158,7 @@ let library = [ | [IEvLambda(lambda)] => switch Internal.fromFn(lambda, env, reducer) { | Ok(r) => Ok(r->Wrappers.sampleSet->Wrappers.evDistribution) - | Error(_) => Error("issue") + | Error(e) => Error(Operation.Error.toString(e)) } | _ => Error(impossibleError) }, @@ -180,7 +180,7 @@ let library = [ ~run=(inputs, _, env, reducer) => switch inputs { | [IEvDistribution(SampleSet(dist)), IEvLambda(lambda)] => - Internal.map1(dist, lambda, env, reducer)->E.R2.errMap(_ => "") + Internal.map1(dist, lambda, env, reducer)->E.R2.errMap(Reducer_ErrorValue.errorToString) | _ => Error(impossibleError) }, (), @@ -207,7 +207,9 @@ let library = [ IEvDistribution(SampleSet(dist2)), IEvLambda(lambda), ] => - Internal.map2(dist1, dist2, lambda, env, reducer)->E.R2.errMap(_ => "") + Internal.map2(dist1, dist2, lambda, env, reducer)->E.R2.errMap( + Reducer_ErrorValue.errorToString, + ) | _ => Error(impossibleError) } }, @@ -236,7 +238,9 @@ let library = [ IEvDistribution(SampleSet(dist3)), IEvLambda(lambda), ] => - Internal.map3(dist1, dist2, dist3, lambda, env, reducer)->E.R2.errMap(_ => "") + Internal.map3(dist1, dist2, dist3, lambda, env, reducer)->E.R2.errMap( + Reducer_ErrorValue.errorToString, + ) | _ => Error(impossibleError) }, (), @@ -259,9 +263,9 @@ let library = [ ~run=(inputs, _, env, reducer) => switch inputs { | [IEvArray(dists), IEvLambda(lambda)] => - Internal.mapN(dists, lambda, env, reducer)->E.R2.errMap(_e => { - "AHHH doesn't work" - }) + Internal.mapN(dists, lambda, env, reducer)->E.R2.errMap( + Reducer_ErrorValue.errorToString, + ) | _ => Error(impossibleError) }, (), diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_ChainPiece.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_ChainPiece.res new file mode 100644 index 00000000..6cebfef5 --- /dev/null +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_ChainPiece.res @@ -0,0 +1,19 @@ +module TypeChecker = Reducer_Type_TypeChecker +module T = Reducer_Dispatch_T +open ReducerInterface_InternalExpressionValue + +type errorValue = Reducer_ErrorValue.errorValue + +let makeFromTypes = jumpTable => { + let dispatchChainPiece: T.dispatchChainPiece = ((fnName, fnArgs): functionCall, environment) => { + let jumpTableEntry = jumpTable->Js.Array2.find(elem => { + let (candidName, candidType, _) = elem + candidName == fnName && TypeChecker.checkITypeArgumentsBool(candidType, fnArgs) + }) + switch jumpTableEntry { + | Some((_, _, bridgeFn)) => bridgeFn(fnArgs, environment)->Some + | _ => None + } + } + dispatchChainPiece +} diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_T.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_T.res new file mode 100644 index 00000000..f6234976 --- /dev/null +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_T.res @@ -0,0 +1,20 @@ +module InternalExpressionValue = ReducerInterface_InternalExpressionValue +module ExpressionT = Reducer_Expression_T + +// Each piece of the dispatch chain computes the result or returns None so that the chain can continue +type dispatchChainPiece = ( + InternalExpressionValue.functionCall, + InternalExpressionValue.environment, +) => option> + +type dispatchChainPieceWithReducer = ( + InternalExpressionValue.functionCall, + InternalExpressionValue.environment, + ExpressionT.reducerFn, +) => option> + +// This is a switch statement case implementation: get the arguments and compute the result +type genericIEvFunction = ( + array, + InternalExpressionValue.environment, +) => result diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy index 15837da4..00467d86 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy @@ -250,8 +250,8 @@ float 'float' d = [0-9] boolean 'boolean' - = ('true'/'false') - { return h.nodeBoolean(text() === 'true')} + = ('true'/'false') ! [a-z]i ! [_$] + { return h.nodeBoolean(text() === 'true')} valueConstructor = recordConstructor diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_Compile.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_Compile.res index 2119ee62..896f4a12 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_Compile.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_Compile.res @@ -38,3 +38,12 @@ let fromTypeExpression = ( (reducerFn: ExpressionT.reducerFn), )->Belt.Result.map(T.fromIEvValue) } + +let fromTypeExpressionExn = ( + typeExpressionSourceCode: string, + reducerFn: ExpressionT.reducerFn, +): T.t => + switch fromTypeExpression(typeExpressionSourceCode, reducerFn) { + | Ok(value) => value + | _ => `Cannot compile ${typeExpressionSourceCode}`->Reducer_Exception.ImpossibleException->raise + } diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_TypeChecker.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_TypeChecker.res index e4336df5..33cbbeca 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_TypeChecker.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Type/Reducer_Type_TypeChecker.res @@ -7,10 +7,15 @@ open InternalExpressionValue let rec isITypeOf = (anIType: T.iType, aValue): result => { let caseTypeIdentifier = (anUpperTypeName, aValue) => { let aTypeName = anUpperTypeName->Js.String2.toLowerCase - let valueTypeName = aValue->valueToValueType->valueTypeToString->Js.String2.toLowerCase - switch aTypeName == valueTypeName { - | true => Ok(true) - | false => T.TypeMismatch(anIType, aValue)->Error + switch aTypeName { + | "any" => Ok(true) + | _ => { + let valueTypeName = aValue->valueToValueType->valueTypeToString->Js.String2.toLowerCase + switch aTypeName == valueTypeName { + | true => Ok(true) + | false => T.TypeMismatch(anIType, aValue)->Error + } + } } } @@ -149,6 +154,13 @@ let checkITypeArguments = (anIType: T.iType, args: array): bool => { + switch checkITypeArguments(anIType, args) { + | Ok(_) => true + | _ => false + } +} + let checkArguments = ( typeExpressionSourceCode: string, args: array, diff --git a/packages/vscode-ext/package.json b/packages/vscode-ext/package.json index b4e00587..73ca9dd6 100644 --- a/packages/vscode-ext/package.json +++ b/packages/vscode-ext/package.json @@ -7,7 +7,7 @@ "publisher": "QURI", "repository": { "type": "git", - "url": "git+https://github.com/quantified-uncertainty/squiggle.git" + "url": "https://github.com/quantified-uncertainty/squiggle.git" }, "icon": "media/vendor/icon.png", "engines": { @@ -129,9 +129,9 @@ "@types/glob": "^7.2.0", "@types/node": "18.x", "@types/vscode": "^1.70.0", - "@typescript-eslint/eslint-plugin": "^5.32.0", - "@typescript-eslint/parser": "^5.32.0", - "eslint": "^8.21.0", + "@typescript-eslint/eslint-plugin": "^5.33.1", + "@typescript-eslint/parser": "^5.33.1", + "eslint": "^8.22.0", "glob": "^8.0.3", "js-yaml": "^4.1.0", "typescript": "^4.7.4", @@ -143,4 +143,4 @@ "vscode-languageserver-textdocument": "^1.0.5", "@quri/squiggle-lang": "^0.2.11" } -} +} \ No newline at end of file diff --git a/packages/website/docs/Api/DistPointSet.md b/packages/website/docs/Api/DistPointSet.md index 9c9c3d0d..bfd8ae82 100644 --- a/packages/website/docs/Api/DistPointSet.md +++ b/packages/website/docs/Api/DistPointSet.md @@ -46,3 +46,13 @@ PointSet.makeDiscrete([ { x: 3, y: 0.1 }, ]); ``` + +### mapY + +``` +PointSet.mapY: (pointSetDist, (number => number)) => pointSetDist +``` + +```javascript +normal(5,3) |> PointSet.fromDist |> PointSet.mapY({|x| x ^ 2}) |> normalize +``` diff --git a/packages/website/docusaurus.config.js b/packages/website/docusaurus.config.js index f48ac952..1f712dab 100644 --- a/packages/website/docusaurus.config.js +++ b/packages/website/docusaurus.config.js @@ -52,6 +52,29 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ + algolia: { + // The application ID provided by Algolia + appId: "KBED3M1CMD", + + // Public API key: it is safe to commit it + apiKey: "c61bc7603893cf287ed6971983af8bad", + + indexName: "squiggle_docs", + + // Optional: see doc section below + contextualSearch: true, + + // Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them. + // externalUrlRegex: 'external\\.com|domain\\.com', + + // Optional: Algolia search parameters + searchParameters: {}, + + // Optional: path for search page that enabled by default (`false` to disable it) + searchPagePath: "search", + + //... other Algolia params + }, navbar: { title: "Squiggle", hideOnScroll: true, diff --git a/packages/website/package.json b/packages/website/package.json index 9f21ad98..53d94c2d 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "squiggle-website", - "version": "0.2.1", + "version": "0.3.0", "private": true, "license": "MIT", "scripts": { @@ -15,7 +15,7 @@ "@docusaurus/core": "2.0.1", "@docusaurus/preset-classic": "2.0.1", "@heroicons/react": "^1.0.6", - "@quri/squiggle-components": "^0.2.23", + "@quri/squiggle-components": "^0.3", "base64-js": "^1.5.1", "clsx": "^1.2.1", "hast-util-is-element": "2.1.2", diff --git a/yarn.lock b/yarn.lock index 6accd635..acdc5bf0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2200,10 +2200,10 @@ dependencies: "@floating-ui/core" "^1.0.0" -"@floating-ui/react-dom-interactions@^0.9.1": - version "0.9.1" - resolved "https://registry.yarnpkg.com/@floating-ui/react-dom-interactions/-/react-dom-interactions-0.9.1.tgz#93f17ed89b664795251ce5a2f228c50fc8ada059" - integrity sha512-LNWB7FvGn/mI4Gw4DKbt/VblEhQOe3LUljBwp6BayFC2hEe+vhUMq2ExPFwMkgpKpoZVQPRYU8ejCKffBY5UMQ== +"@floating-ui/react-dom-interactions@^0.9.2": + version "0.9.2" + resolved "https://registry.yarnpkg.com/@floating-ui/react-dom-interactions/-/react-dom-interactions-0.9.2.tgz#9a364cc44ecbc242b5218dff0e0d071de115e13a" + integrity sha512-1I0urs4jlGuo4FRukvjtMmdUwxqvgwtTlESEPVwEvFGHXVh1PKkKaPZJ0Dcp9B8DQt4ewQEbwJxsoker2pDYTQ== dependencies: "@floating-ui/react-dom" "^1.0.0" aria-hidden "^1.1.3" @@ -2777,6 +2777,18 @@ resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1" integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g== +"@quri/squiggle-lang@^0.2.11": + version "0.2.12" + resolved "https://registry.yarnpkg.com/@quri/squiggle-lang/-/squiggle-lang-0.2.12.tgz#e8fdb22a84aa75df71c071d1ed4ae5c55f15d447" + integrity sha512-fgv9DLvPlX/TqPSacKSW3GZ5S9H/YwqaMoRdFrn5SJjHnnMh/xJW/9iyzzgOxPCXov9xFeDvL159tkbStMm7vw== + dependencies: + "@rescript/std" "^9.1.4" + "@stdlib/stats" "^0.0.13" + jstat "^1.9.5" + lodash "^4.17.21" + mathjs "^11.0.1" + pdfast "^0.2.0" + "@react-hook/latest@^1.0.2": version "1.0.3" resolved "https://registry.yarnpkg.com/@react-hook/latest/-/latest-1.0.3.tgz#c2d1d0b0af8b69ec6e2b3a2412ba0768ac82db80" @@ -4406,10 +4418,10 @@ "@testing-library/dom" "^8.5.0" "@types/react-dom" "^18.0.0" -"@testing-library/user-event@^14.4.2": - version "14.4.2" - resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.4.2.tgz#d3fb5d24e2d7d019a7d2e9978a8deb90b0aa230b" - integrity sha512-1gVTWtueNimveOjcm2ApFCnCTeky7WqY3EX31/GRKLWyCd+HfH+Gd2l1J8go9FpDNe+0Mx8X4zbQHTg0WWNJwg== +"@testing-library/user-event@^14.4.3": + version "14.4.3" + resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.4.3.tgz#af975e367743fa91989cd666666aec31a8f50591" + integrity sha512-kCUc5MEwaEMakkO5x7aoD+DLi02ehmEM2QCGWvNqAS1dV/fAvORWEjnjsEIvml59M7Y5kCkWN6fCCyPOe8OL6Q== "@tootallnate/once@1": version "1.1.2" @@ -4684,10 +4696,10 @@ resolved "https://registry.yarnpkg.com/@types/katex/-/katex-0.11.1.tgz#34de04477dcf79e2ef6c8d23b41a3d81f9ebeaf5" integrity sha512-DUlIj2nk0YnJdlWgsFuVKcX27MLW0KbKmGVoUHmFr+74FYYNUDAaj9ZqTADvsbE8rfxuVmSFc7KczYn5Y09ozg== -"@types/lodash@^4.14.167", "@types/lodash@^4.14.175", "@types/lodash@^4.14.182": - version "4.14.182" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.182.tgz#05301a4d5e62963227eaafe0ce04dd77c54ea5c2" - integrity sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q== +"@types/lodash@^4.14.167", "@types/lodash@^4.14.175", "@types/lodash@^4.14.184": + version "4.14.184" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.184.tgz#23f96cd2a21a28e106dc24d825d4aa966de7a9fe" + integrity sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q== "@types/mdast@^3.0.0": version "3.0.10" @@ -4714,10 +4726,10 @@ "@types/node" "*" form-data "^3.0.0" -"@types/node@*", "@types/node@18.x", "@types/node@^18.6.4": - version "18.6.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.6.4.tgz#fd26723a8a3f8f46729812a7f9b4fc2d1608ed39" - integrity sha512-I4BD3L+6AWiUobfxZ49DlU43gtI+FTHSv9pE2Zekg6KjMpre4ByusaljW3vYSLJrvQ1ck1hUaeVu8HVlY3vzHg== +"@types/node@*", "@types/node@18.x", "@types/node@^18.7.9": + version "18.7.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.9.tgz#180bfc495c91dc62573967edf047e15dbdce1491" + integrity sha512-0N5Y1XAdcl865nDdjbO0m3T6FdmQ4ijE89/urOHLREyTXbpMWbSafx9y7XIsgWGtwUP2iYTinLyyW3FatAxBLQ== "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0": version "16.11.41" @@ -4882,10 +4894,10 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== -"@types/styled-components@^5.1.24": - version "5.1.25" - resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-5.1.25.tgz#0177c4ab5fa7c6ed0565d36f597393dae3f380ad" - integrity sha512-fgwl+0Pa8pdkwXRoVPP9JbqF0Ivo9llnmsm+7TCI330kbPIFd9qv1Lrhr37shf4tnxCOSu+/IgqM7uJXLWZZNQ== +"@types/styled-components@^5.1.26": + version "5.1.26" + resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-5.1.26.tgz#5627e6812ee96d755028a98dae61d28e57c233af" + integrity sha512-KuKJ9Z6xb93uJiIyxo/+ksS7yLjS1KzG6iv5i78dhVg/X3u5t1H7juRWqVmodIdz6wGVaIApo1u01kmFRdJHVw== dependencies: "@types/hoist-non-react-statics" "*" "@types/react" "*" @@ -4993,14 +5005,14 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^5.32.0", "@typescript-eslint/eslint-plugin@^5.5.0": - version "5.32.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.32.0.tgz#e27e38cffa4a61226327c874a7be965e9a861624" - integrity sha512-CHLuz5Uz7bHP2WgVlvoZGhf0BvFakBJKAD/43Ty0emn4wXWv5k01ND0C0fHcl/Im8Td2y/7h44E9pca9qAu2ew== +"@typescript-eslint/eslint-plugin@^5.33.1", "@typescript-eslint/eslint-plugin@^5.5.0": + version "5.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.33.1.tgz#c0a480d05211660221eda963cc844732fe9b1714" + integrity sha512-S1iZIxrTvKkU3+m63YUOxYPKaP+yWDQrdhxTglVDVEVBf+aCSw85+BmJnyUaQQsk5TXFG/LpBu9fa+LrAQ91fQ== dependencies: - "@typescript-eslint/scope-manager" "5.32.0" - "@typescript-eslint/type-utils" "5.32.0" - "@typescript-eslint/utils" "5.32.0" + "@typescript-eslint/scope-manager" "5.33.1" + "@typescript-eslint/type-utils" "5.33.1" + "@typescript-eslint/utils" "5.33.1" debug "^4.3.4" functional-red-black-tree "^1.0.1" ignore "^5.2.0" @@ -5015,14 +5027,14 @@ dependencies: "@typescript-eslint/utils" "5.29.0" -"@typescript-eslint/parser@^5.32.0", "@typescript-eslint/parser@^5.5.0": - version "5.32.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.32.0.tgz#1de243443bc6186fb153b9e395b842e46877ca5d" - integrity sha512-IxRtsehdGV9GFQ35IGm5oKKR2OGcazUoiNBxhRV160iF9FoyuXxjY+rIqs1gfnd+4eL98OjeGnMpE7RF/NBb3A== +"@typescript-eslint/parser@^5.33.1", "@typescript-eslint/parser@^5.5.0": + version "5.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.33.1.tgz#e4b253105b4d2a4362cfaa4e184e2d226c440ff3" + integrity sha512-IgLLtW7FOzoDlmaMoXdxG8HOCByTBXrB1V2ZQYSEV1ggMmJfAkMWTwUjjzagS6OkfpySyhKFkBw7A9jYmcHpZA== dependencies: - "@typescript-eslint/scope-manager" "5.32.0" - "@typescript-eslint/types" "5.32.0" - "@typescript-eslint/typescript-estree" "5.32.0" + "@typescript-eslint/scope-manager" "5.33.1" + "@typescript-eslint/types" "5.33.1" + "@typescript-eslint/typescript-estree" "5.33.1" debug "^4.3.4" "@typescript-eslint/scope-manager@5.29.0": @@ -5033,20 +5045,20 @@ "@typescript-eslint/types" "5.29.0" "@typescript-eslint/visitor-keys" "5.29.0" -"@typescript-eslint/scope-manager@5.32.0": - version "5.32.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.32.0.tgz#763386e963a8def470580cc36cf9228864190b95" - integrity sha512-KyAE+tUON0D7tNz92p1uetRqVJiiAkeluvwvZOqBmW9z2XApmk5WSMV9FrzOroAcVxJZB3GfUwVKr98Dr/OjOg== +"@typescript-eslint/scope-manager@5.33.1": + version "5.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.33.1.tgz#8d31553e1b874210018ca069b3d192c6d23bc493" + integrity sha512-8ibcZSqy4c5m69QpzJn8XQq9NnqAToC8OdH/W6IXPXv83vRyEDPYLdjAlUx8h/rbusq6MkW4YdQzURGOqsn3CA== dependencies: - "@typescript-eslint/types" "5.32.0" - "@typescript-eslint/visitor-keys" "5.32.0" + "@typescript-eslint/types" "5.33.1" + "@typescript-eslint/visitor-keys" "5.33.1" -"@typescript-eslint/type-utils@5.32.0": - version "5.32.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.32.0.tgz#45a14506fe3fb908600b4cef2f70778f7b5cdc79" - integrity sha512-0gSsIhFDduBz3QcHJIp3qRCvVYbqzHg8D6bHFsDMrm0rURYDj+skBK2zmYebdCp+4nrd9VWd13egvhYFJj/wZg== +"@typescript-eslint/type-utils@5.33.1": + version "5.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.33.1.tgz#1a14e94650a0ae39f6e3b77478baff002cec4367" + integrity sha512-X3pGsJsD8OiqhNa5fim41YtlnyiWMF/eKsEZGsHID2HcDqeSC5yr/uLOeph8rNF2/utwuI0IQoAK3fpoxcLl2g== dependencies: - "@typescript-eslint/utils" "5.32.0" + "@typescript-eslint/utils" "5.33.1" debug "^4.3.4" tsutils "^3.21.0" @@ -5055,10 +5067,10 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.29.0.tgz#7861d3d288c031703b2d97bc113696b4d8c19aab" integrity sha512-X99VbqvAXOMdVyfFmksMy3u8p8yoRGITgU1joBJPzeYa0rhdf5ok9S56/itRoUSh99fiDoMtarSIJXo7H/SnOg== -"@typescript-eslint/types@5.32.0": - version "5.32.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.32.0.tgz#484273021eeeae87ddb288f39586ef5efeb6dcd8" - integrity sha512-EBUKs68DOcT/EjGfzywp+f8wG9Zw6gj6BjWu7KV/IYllqKJFPlZlLSYw/PTvVyiRw50t6wVbgv4p9uE2h6sZrQ== +"@typescript-eslint/types@5.33.1": + version "5.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.33.1.tgz#3faef41793d527a519e19ab2747c12d6f3741ff7" + integrity sha512-7K6MoQPQh6WVEkMrMW5QOA5FO+BOwzHSNd0j3+BlBwd6vtzfZceJ8xJ7Um2XDi/O3umS8/qDX6jdy2i7CijkwQ== "@typescript-eslint/typescript-estree@5.29.0": version "5.29.0" @@ -5073,13 +5085,13 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@5.32.0": - version "5.32.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.32.0.tgz#282943f34babf07a4afa7b0ff347a8e7b6030d12" - integrity sha512-ZVAUkvPk3ITGtCLU5J4atCw9RTxK+SRc6hXqLtllC2sGSeMFWN+YwbiJR9CFrSFJ3w4SJfcWtDwNb/DmUIHdhg== +"@typescript-eslint/typescript-estree@5.33.1": + version "5.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.33.1.tgz#a573bd360790afdcba80844e962d8b2031984f34" + integrity sha512-JOAzJ4pJ+tHzA2pgsWQi4804XisPHOtbvwUyqsuuq8+y5B5GMZs7lI1xDWs6V2d7gE/Ez5bTGojSK12+IIPtXA== dependencies: - "@typescript-eslint/types" "5.32.0" - "@typescript-eslint/visitor-keys" "5.32.0" + "@typescript-eslint/types" "5.33.1" + "@typescript-eslint/visitor-keys" "5.33.1" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" @@ -5098,15 +5110,15 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/utils@5.32.0", "@typescript-eslint/utils@^5.13.0": - version "5.32.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.32.0.tgz#eccb6b672b94516f1afc6508d05173c45924840c" - integrity sha512-W7lYIAI5Zlc5K082dGR27Fczjb3Q57ECcXefKU/f0ajM5ToM0P+N9NmJWip8GmGu/g6QISNT+K6KYB+iSHjXCQ== +"@typescript-eslint/utils@5.33.1", "@typescript-eslint/utils@^5.13.0": + version "5.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.33.1.tgz#171725f924fe1fe82bb776522bb85bc034e88575" + integrity sha512-uphZjkMaZ4fE8CR4dU7BquOV6u0doeQAr8n6cQenl/poMaIyJtBu8eys5uk6u5HiDH01Mj5lzbJ5SfeDz7oqMQ== dependencies: "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.32.0" - "@typescript-eslint/types" "5.32.0" - "@typescript-eslint/typescript-estree" "5.32.0" + "@typescript-eslint/scope-manager" "5.33.1" + "@typescript-eslint/types" "5.33.1" + "@typescript-eslint/typescript-estree" "5.33.1" eslint-scope "^5.1.1" eslint-utils "^3.0.0" @@ -5118,12 +5130,12 @@ "@typescript-eslint/types" "5.29.0" eslint-visitor-keys "^3.3.0" -"@typescript-eslint/visitor-keys@5.32.0": - version "5.32.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.32.0.tgz#b9715d0b11fdb5dd10fd0c42ff13987470525394" - integrity sha512-S54xOHZgfThiZ38/ZGTgB2rqx51CMJ5MCfVT2IplK4Q7hgzGfe0nLzLCcenDnc/cSjP568hdeKfeDcBgqNHD/g== +"@typescript-eslint/visitor-keys@5.33.1": + version "5.33.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.33.1.tgz#0155c7571c8cd08956580b880aea327d5c34a18b" + integrity sha512-nwIxOK8Z2MPWltLKMLOEZwmfBZReqUdbEoHQXeCpa+sRVARe5twpJGHCB4dk9903Yaf0nMAlGbQfaAH92F60eg== dependencies: - "@typescript-eslint/types" "5.32.0" + "@typescript-eslint/types" "5.33.1" eslint-visitor-keys "^3.3.0" "@webassemblyjs/ast@1.11.1": @@ -8953,10 +8965,10 @@ eslint-webpack-plugin@^3.1.1: normalize-path "^3.0.0" schema-utils "^3.1.1" -eslint@^8.21.0, eslint@^8.3.0: - version "8.21.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.21.0.tgz#1940a68d7e0573cef6f50037addee295ff9be9ef" - integrity sha512-/XJ1+Qurf1T9G2M5IHrsjp+xrGT73RZf23xA1z5wB1ZzzEAWSZKvRwhWxTFp1rvkvCfwcvAUNAP31bhKTTGfDA== +eslint@^8.22.0, eslint@^8.3.0: + version "8.22.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.22.0.tgz#78fcb044196dfa7eef30a9d65944f6f980402c48" + integrity sha512-ci4t0sz6vSRKdmkOGmprBo6fmI4PrphDFMy5JEq/fNS0gQkJM3rLmrqcp8ipMcdobH3KtUP40KniAE9W19S4wA== dependencies: "@eslint/eslintrc" "^1.3.0" "@humanwhocodes/config-array" "^0.10.4" @@ -9608,26 +9620,26 @@ fragment-cache@^0.2.1: dependencies: map-cache "^0.2.2" -framer-motion@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-7.0.0.tgz#5fb580d0fe5a2a3ec055d2b7b5b57313a96683b7" - integrity sha512-mOUKle6LouYVP4KLz+cMiNI6fL3qP9hQY4PBaN3E1FyPhcvuAgvs/JPgYktvK5zdRbIRU0gpBsr0CW5hP2KzKA== +framer-motion@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-7.2.0.tgz#1abc8090e185eaac8a3b3729e2529154d2edcb17" + integrity sha512-D24ZHtbtdpiaByamNYiVXafVU6JfBxjrVlR1beyNupJL80haaDE23xS4dR0b/Qb64frtw/Mpdd9VYwSCv+UtSw== dependencies: "@motionone/dom" "10.13.1" - framesync "6.0.1" + framesync "6.1.2" hey-listen "^1.0.8" - popmotion "11.0.3" - style-value-types "5.1.0" - tslib "^2.1.0" + popmotion "11.0.5" + style-value-types "5.1.2" + tslib "2.4.0" optionalDependencies: "@emotion/is-prop-valid" "^0.8.2" -framesync@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/framesync/-/framesync-6.0.1.tgz#5e32fc01f1c42b39c654c35b16440e07a25d6f20" - integrity sha512-fUY88kXvGiIItgNC7wcTOl0SNRCVXMKSWW2Yzfmn7EKNc+MpCzcz9DhdHcdjbrtN3c6R4H5dTY2jiCpPdysEjA== +framesync@6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/framesync/-/framesync-6.1.2.tgz#755eff2fb5b8f3b4d2b266dd18121b300aefea27" + integrity sha512-jBTqhX6KaQVDyus8muwZbBeGGP0XgujBRbQ7gM7BRdS3CadCZIHiawyzYLnafYcvZIh5j8WE7cxZKFn7dXhu9g== dependencies: - tslib "^2.1.0" + tslib "2.4.0" fresh@0.5.2: version "0.5.2" @@ -13829,15 +13841,15 @@ polished@^4.2.2: dependencies: "@babel/runtime" "^7.17.8" -popmotion@11.0.3: - version "11.0.3" - resolved "https://registry.yarnpkg.com/popmotion/-/popmotion-11.0.3.tgz#565c5f6590bbcddab7a33a074bb2ba97e24b0cc9" - integrity sha512-Y55FLdj3UxkR7Vl3s7Qr4e9m0onSnP8W7d/xQLsoJM40vs6UKHFdygs6SWryasTZYqugMjm3BepCF4CWXDiHgA== +popmotion@11.0.5: + version "11.0.5" + resolved "https://registry.yarnpkg.com/popmotion/-/popmotion-11.0.5.tgz#8e3e014421a0ffa30ecd722564fd2558954e1f7d" + integrity sha512-la8gPM1WYeFznb/JqF4GiTkRRPZsfaj2+kCxqQgr2MJylMmIKUwBfWW8Wa5fml/8gmtlD5yI01MP1QCZPWmppA== dependencies: - framesync "6.0.1" + framesync "6.1.2" hey-listen "^1.0.8" - style-value-types "5.0.0" - tslib "^2.1.0" + style-value-types "5.1.2" + tslib "2.4.0" posix-character-classes@^0.1.0: version "0.1.1" @@ -15021,10 +15033,10 @@ react-helmet-async@*, react-helmet-async@^1.3.0: react-fast-compare "^3.2.0" shallowequal "^1.1.0" -react-hook-form@^7.34.0: - version "7.34.0" - resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.34.0.tgz#22883b5e014e5c5e35f3061d0e3862153b0df2ec" - integrity sha512-s0/TJ09NVlEk2JPp3yit1WnMuPNBXFmUKEQPulgDi9pYBw/ZmmAFHe6AXWq73Y+kp8ye4OcMf0Jv+i/qLPektg== +react-hook-form@^7.34.2: + version "7.34.2" + resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.34.2.tgz#9ac6d1a309a7c4aaa369d1269357a70e9e9bf4de" + integrity sha512-1lYWbEqr0GW7HHUjMScXMidGvV0BE2RJV3ap2BL7G0EJirkqpccTaawbsvBO8GZaB3JjCeFBEbnEWI1P8ZoLRQ== react-inspector@^5.1.0: version "5.1.1" @@ -16828,21 +16840,13 @@ style-to-object@0.3.0, style-to-object@^0.3.0: dependencies: inline-style-parser "0.1.1" -style-value-types@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/style-value-types/-/style-value-types-5.0.0.tgz#76c35f0e579843d523187989da866729411fc8ad" - integrity sha512-08yq36Ikn4kx4YU6RD7jWEv27v4V+PUsOGa4n/as8Et3CuODMJQ00ENeAVXAeydX4Z2j1XHZF1K2sX4mGl18fA== +style-value-types@5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/style-value-types/-/style-value-types-5.1.2.tgz#6be66b237bd546048a764883528072ed95713b62" + integrity sha512-Vs9fNreYF9j6W2VvuDTP7kepALi7sk0xtk2Tu8Yxi9UoajJdEVpNpCov0HsLTqXvNGKX+Uv09pkozVITi1jf3Q== dependencies: hey-listen "^1.0.8" - tslib "^2.1.0" - -style-value-types@5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/style-value-types/-/style-value-types-5.1.0.tgz#228b02bd9418c57db46c1f450b85577e634a877f" - integrity sha512-DRIfBtjxQ4ztBZpexkFcI+UR7pODC5qLMf2Syt+bH98PAHHRH2tQnzxBuDQlqcAoYar6GzWnj8iAfqfwnEzCiQ== - dependencies: - hey-listen "^1.0.8" - tslib "^2.3.1" + tslib "2.4.0" stylehacks@^5.1.0: version "5.1.0" @@ -17405,16 +17409,16 @@ tsconfig-paths@^4.0.0: minimist "^1.2.6" strip-bom "^3.0.0" +tslib@2.4.0, tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.1, tslib@^2.4.0, tslib@~2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + tslib@^1.0.0, tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.1, tslib@^2.4.0, tslib@~2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== - tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" @@ -18092,10 +18096,10 @@ vega-label@~1.2.0: vega-scenegraph "^4.9.2" vega-util "^1.15.2" -vega-lite@^5.4.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/vega-lite/-/vega-lite-5.4.0.tgz#d09331e2a1c87843d5865de0fa7704919796ab56" - integrity sha512-e/P5iOtBE62WEWZhKP7sLcBd92YS9prfUQafelxoOeloooSSrkUwM/ZDmN5Q5ffByEZTiKfODtnwD6/xKDYUmw== +vega-lite@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/vega-lite/-/vega-lite-5.5.0.tgz#07345713d538cd63278748ec119c261722be66ff" + integrity sha512-MQBJt/iaUegvhRTS/hZVWfMOSF5ai4awlR2qtwTgHd84bErf9v7GtaZ9ArhJqXCb+FizvZ2jatmoYCzovgAhkg== dependencies: "@types/clone" "~2.1.1" array-flat-polyfill "^1.0.1" @@ -18583,10 +18587,10 @@ webpack-dev-middleware@^5.3.1: range-parser "^1.2.1" schema-utils "^4.0.0" -webpack-dev-server@^4.6.0, webpack-dev-server@^4.9.3: - version "4.9.3" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.9.3.tgz#2360a5d6d532acb5410a668417ad549ee3b8a3c9" - integrity sha512-3qp/eoboZG5/6QgiZ3llN8TUzkSpYg1Ko9khWX1h40MIEUNS2mDoIa8aXsPfskER+GbTvs/IJZ1QTBBhhuetSw== +webpack-dev-server@^4.10.0, webpack-dev-server@^4.6.0, webpack-dev-server@^4.9.3: + version "4.10.0" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-4.10.0.tgz#de270d0009eba050546912be90116e7fd740a9ca" + integrity sha512-7dezwAs+k6yXVFZ+MaL8VnE+APobiO3zvpp3rBHe/HmWQ+avwh0Q3d0xxacOiBybZZ3syTZw9HXzpa3YNbAZDQ== dependencies: "@types/bonjour" "^3.5.9" "@types/connect-history-api-fallback" "^1.3.5"