Merge branch 'develop' into component-testing

This commit is contained in:
Sam Nolan 2022-10-04 10:35:48 +11:00
commit 2ed234b83b
16 changed files with 110 additions and 122 deletions

View File

@ -26,27 +26,27 @@ jobs:
steps:
- id: skip_lang_check
name: Check if the changes are about squiggle-lang src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/squiggle-lang/**"]'
- id: skip_components_check
name: Check if the changes are about components src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/components/**"]'
- id: skip_website_check
name: Check if the changes are about website src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/website/**"]'
- id: skip_vscodeext_check
name: Check if the changes are about vscode extension src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/vscode-ext/**"]'
- id: skip_cli_check
name: Check if the changes are about cli src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/cli/**"]'

View File

@ -18,27 +18,27 @@ jobs:
steps:
- id: skip_lang_check
name: Check if the changes are about squiggle-lang src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/squiggle-lang/**"]'
- id: skip_components_check
name: Check if the changes are about components src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/components/**"]'
- id: skip_website_check
name: Check if the changes are about website src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/website/**"]'
- id: skip_vscodeext_check
name: Check if the changes are about vscode extension src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/vscode-ext/**"]'
- id: skip_cli_check
name: Check if the changes are about cli src files
uses: fkirc/skip-duplicate-actions@v5.1.0
uses: fkirc/skip-duplicate-actions@v5.2.0
with:
paths: '["packages/cli/**"]'

View File

@ -13,7 +13,7 @@
"dependencies": {
"chalk": "^5.0.1",
"chokidar": "^3.5.3",
"commander": "^9.4.0",
"commander": "^9.4.1",
"fs": "^0.0.1-security",
"glob": "^8.0.3",
"indent-string": "^5.0.0"

View File

@ -1,17 +1,17 @@
{
"name": "@quri/squiggle-components",
"version": "0.5.0-alpha.2",
"version": "0.5.0",
"license": "MIT",
"dependencies": {
"@floating-ui/react-dom": "^1.0.0",
"@floating-ui/react-dom-interactions": "^0.10.1",
"@headlessui/react": "^1.7.2",
"@headlessui/react": "^1.7.3",
"@heroicons/react": "^1.0.6",
"@hookform/resolvers": "^2.9.8",
"@quri/squiggle-lang": "^0.5.0-alpha.2",
"@quri/squiggle-lang": "^0.5.0",
"@react-hook/size": "^2.1.2",
"clsx": "^1.2.1",
"framer-motion": "^7.4.0",
"framer-motion": "^7.5.1",
"lodash": "^4.17.21",
"react": "^18.1.0",
"react-ace": "^10.1.0",
@ -38,8 +38,8 @@
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^27.5.0",
"@types/lodash": "^4.14.185",
"@types/node": "^18.7.22",
"@types/lodash": "^4.14.186",
"@types/node": "^18.8.0",
"@types/react": "^18.0.21",
"@types/styled-components": "^5.1.26",
"@types/webpack": "^5.28.0",
@ -58,9 +58,9 @@
"style-loader": "^3.3.1",
"tailwindcss": "^3.1.8",
"ts-jest": "^29.0.2",
"ts-loader": "^9.4.0",
"ts-loader": "^9.4.1",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typescript": "^4.8.3",
"typescript": "^4.8.4",
"web-vitals": "^3.0.2",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",

View File

@ -96,7 +96,11 @@ export const DistributionChart: React.FC<DistributionChartProps> = (props) => {
// I think size.width is sometimes not finite due to the component not being in a visible context
// This occurs during testing
let widthProp = width ? width : Number.isFinite(size.width) ? size.width : 400;
let widthProp = width
? width
: Number.isFinite(size.width)
? size.width
: 400;
if (widthProp < 20) {
console.warn(
`Width of Distribution is set to ${widthProp}, which is too small`

View File

@ -1,51 +0,0 @@
import { SquigglePartial, SquiggleEditor } from "../components/SquiggleEditor";
import { useState } from "react";
import { Canvas, Meta, Story, Props } from "@storybook/addon-docs";
<Meta title="Squiggle/SquigglePartial" component={SquigglePartial} />
export const Template = (props) => <SquigglePartial {...props} />;
# Squiggle Partial
A Squiggle Partial is an editor that does not return a graph to the user, but
instead returns bindings that can be used by further Squiggle Editors.
<Canvas>
<Story
name="Standalone"
args={{
defaultCode: "x = normal(5,2)",
}}
>
{Template.bind({})}
</Story>
</Canvas>
<Canvas>
<Story
name="With Editor"
args={{
initialPartialString: "x = normal(5,2)",
initialEditorString: "x",
}}
>
{(props) => {
let [bindings, setBindings] = useState({});
return (
<>
<SquigglePartial
{...props}
defaultCode={props.initialPartialString}
onChange={setBindings}
/>
<SquiggleEditor
{...props}
defaultCode={props.initialEditorString}
bindings={bindings}
/>
</>
);
}}
</Story>
</Canvas>

View File

@ -112,6 +112,25 @@ describe("project2", () => {
})
})
describe("removing sources", () => {
let project = Project.createProject()
Project.setContinues(project, "main", ["second"])
Project.setContinues(project, "second", ["first"])
Project.setSource(project, "first", "x=1")
Project.setSource(project, "second", "y=2")
Project.setSource(project, "main", "y")
Project.removeSource(project, "main")
test("project doesn't have source", () => {
expect(Project.getSource(project, "main")) == None
})
test("dependents get updated", () => {
expect(Project.getDependents(project, "second")) == []
})
})
describe("project with include", () => {
let project = Project.createProject()
Project.setContinues(project, "main", ["second"])

View File

@ -1,6 +1,6 @@
{
"name": "@quri/squiggle-lang",
"version": "0.5.0-alpha.2",
"version": "0.5.0",
"homepage": "https://squiggle-language.com",
"license": "MIT",
"scripts": {
@ -68,9 +68,9 @@
"rescript-fast-check": "^1.1.1",
"rescript-js-map": "^1.1.0",
"ts-jest": "^27.1.4",
"ts-loader": "^9.4.0",
"ts-loader": "^9.4.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.3",
"typescript": "^4.8.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},

View File

@ -22,6 +22,10 @@ export class SqProject {
return RSProject.setSource(this._value, sourceId, value);
}
removeSource(sourceId: string) {
RSProject.removeSource(this._value, sourceId);
}
getSource(sourceId: string) {
return RSProject.getSource(this._value, sourceId);
}

View File

@ -50,6 +50,13 @@ Sets the source for a given source Id.
let setSource = (project: reducerProject, sourceId: string, value: string): unit =>
project->Private.setSource(sourceId, value)
/*
Removes the source for a given source Id.
*/
@genType
let removeSource = (project: reducerProject, sourceId: string): unit =>
project->Private.removeSource(sourceId)
/*
Gets the source for a given source id.
*/

View File

@ -61,6 +61,10 @@ let setSource = (project: t, sourceId: string, value: string): unit => {
touchDependents(project, sourceId)
}
let removeSource = (project: t, sourceId: string): unit => {
Belt.MutableMap.String.remove(project.items, sourceId)
}
let clean = (project: t, sourceId: string): unit => {
let newItem = project->getItem(sourceId)->ProjectItem.clean
project->setItem(sourceId, newItem)

View File

@ -3,7 +3,7 @@
"displayName": "Squiggle",
"description": "Squiggle language support",
"license": "MIT",
"version": "0.5.0-alpha.2",
"version": "0.5.0",
"publisher": "QURI",
"repository": {
"type": "git",
@ -131,7 +131,7 @@
"@types/vscode": "^1.70.0",
"glob": "^8.0.3",
"js-yaml": "^4.1.0",
"typescript": "^4.8.3",
"typescript": "^4.8.4",
"vsce-yarn-patch": "^1.66.2"
},
"dependencies": {

View File

@ -12,7 +12,7 @@ All regular distribution function work on sample set distributions. In addition,
### fromDist
```
SampleSet.fromDist: (list<number>) => sampleSet
SampleSet.fromDist: (distribution) => sampleSet
```
### fromList

View File

@ -52,29 +52,30 @@ const config = {
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
algolia: {
// The application ID provided by Algolia
appId: "KBED3M1CMD",
// TODO - disabled until we fix algolia search
// algolia: {
// // The application ID provided by Algolia
// appId: "KBED3M1CMD",
// Public API key: it is safe to commit it
apiKey: "c61bc7603893cf287ed6971983af8bad",
// // Public API key: it is safe to commit it
// apiKey: "c61bc7603893cf287ed6971983af8bad",
indexName: "squiggle_docs",
// indexName: "squiggle_docs",
// Optional: see doc section below
contextualSearch: true,
// // 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: 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: Algolia search parameters
// searchParameters: {},
// Optional: path for search page that enabled by default (`false` to disable it)
searchPagePath: "search",
// // Optional: path for search page that enabled by default (`false` to disable it)
// searchPagePath: "search",
//... other Algolia params
},
// //... other Algolia params
// },
navbar: {
title: "Squiggle",
hideOnScroll: true,

View File

@ -15,7 +15,7 @@
"@docusaurus/core": "2.1.0",
"@docusaurus/preset-classic": "2.1.0",
"@heroicons/react": "^1.0.6",
"@quri/squiggle-components": "^0.5.0-alpha.2",
"@quri/squiggle-components": "^0.5.0",
"base64-js": "^1.5.1",
"clsx": "^1.2.1",
"hast-util-is-element": "2.1.2",

View File

@ -2252,10 +2252,10 @@
dependencies:
"@hapi/hoek" "^9.0.0"
"@headlessui/react@^1.7.2":
version "1.7.2"
resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.7.2.tgz#e6a6a8d38342064a53182f1eb2bf6d9c1e53ba6a"
integrity sha512-snLv2lxwsf2HNTOBNgHYdvoYZ3ChJE8QszPi1d/hl9js8KrFrUulTaQBfSyPbJP5BybVreWh9DxCgz9S0Z6hKQ==
"@headlessui/react@^1.7.3":
version "1.7.3"
resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.7.3.tgz#853c598ff47b37cdd192c5cbee890d9b610c3ec0"
integrity sha512-LGp06SrGv7BMaIQlTs8s2G06moqkI0cb0b8stgq7KZ3xcHdH3qMP+cRyV7qe5x4XEW/IGY48BW4fLesD6NQLng==
"@heroicons/react@^1.0.6":
version "1.0.6"
@ -4950,10 +4950,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.185":
version "4.14.185"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.185.tgz#c9843f5a40703a8f5edfd53358a58ae729816908"
integrity sha512-evMDG1bC4rgQg4ku9tKpuMh5iBNEwNa3tf9zRHdP1qlv+1WUg44xat4IxCE14gIpZRGUUWAx2VhItCZc25NfMA==
"@types/lodash@^4.14.167", "@types/lodash@^4.14.175", "@types/lodash@^4.14.186":
version "4.14.186"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.186.tgz#862e5514dd7bd66ada6c70ee5fce844b06c8ee97"
integrity sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==
"@types/mdast@^3.0.0":
version "3.0.10"
@ -4980,10 +4980,10 @@
"@types/node" "*"
form-data "^3.0.0"
"@types/node@*", "@types/node@18.x", "@types/node@^18.7.22":
version "18.7.22"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.22.tgz#76f7401362ad63d9d7eefa7dcdfa5fcd9baddff3"
integrity sha512-TsmoXYd4zrkkKjJB0URF/mTIKPl+kVcbqClB2F/ykU7vil1BfWZVndOnpEIozPv4fURD28gyPFeIkW2G+KXOvw==
"@types/node@*", "@types/node@18.x", "@types/node@^18.8.0":
version "18.8.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.8.0.tgz#b8ee8d83a99470c0661bd899417fcd77060682fe"
integrity sha512-u+h43R6U8xXDt2vzUaVP3VwjjLyOJk6uEciZS8OSyziUQGOwmk+l+4drxcsDboHXwyTaqS1INebghmWMRxq3LA==
"@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0":
version "16.11.56"
@ -7487,10 +7487,10 @@ commander@^8.0.0, commander@^8.3.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
commander@^9.3.0, commander@^9.4.0:
version "9.4.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.0.tgz#bc4a40918fefe52e22450c111ecd6b7acce6f11c"
integrity sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw==
commander@^9.3.0, commander@^9.4.1:
version "9.4.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd"
integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==
common-path-prefix@^3.0.0:
version "3.0.0"
@ -9911,10 +9911,10 @@ fragment-cache@^0.2.1:
dependencies:
map-cache "^0.2.2"
framer-motion@^7.4.0:
version "7.4.0"
resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-7.4.0.tgz#318c52a76517f9f854aa4a298c292be04941521b"
integrity sha512-tcvL5L1cASYjIeBG6mQHhzfndm7MdyHjOwqIdOzOetIVa1yUqeYMufAoljgqg69XFgsgZet+c4iuSuFF+Vgbjg==
framer-motion@^7.5.1:
version "7.5.1"
resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-7.5.1.tgz#a21d9218999f3f271b39ca6f693093b54465c0f5"
integrity sha512-shqLAFgYT7QMVomusesPurlq9pQGLO64PTbWdQPkMg2cHmxI0ISG9BajGY3krg56yhBMI7QP/3u54bs/To0mOA==
dependencies:
"@motionone/dom" "10.13.1"
framesync "6.1.2"
@ -18148,10 +18148,10 @@ ts-jest@^29.0.2:
semver "7.x"
yargs-parser "^21.0.1"
ts-loader@^9.4.0:
version "9.4.0"
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.4.0.tgz#b3f4b4d8553f3a15bef512f123fb488669a2ffc6"
integrity sha512-0G3UMhk1bjgsgiwF4rnZRAeTi69j9XMDtmDDMghGSqlWESIAS3LFgJe//GYfE4vcjbyzuURLB9Us2RZIWp2clQ==
ts-loader@^9.4.1:
version "9.4.1"
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.4.1.tgz#b6f3d82db0eac5a8295994f8cb5e4940ff6b1060"
integrity sha512-384TYAqGs70rn9F0VBnh6BPTfhga7yFNdC5gXbQpDrBj9/KsT4iRkGqKXhziofHOlE2j6YEaiTYVGKKvPhGWvw==
dependencies:
chalk "^4.1.0"
enhanced-resolve "^5.0.0"
@ -18319,10 +18319,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
typescript@^4.8.3:
version "4.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.3.tgz#d59344522c4bc464a65a730ac695007fdb66dd88"
integrity sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==
typescript@^4.8.4:
version "4.8.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6"
integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==
ua-parser-js@^0.7.30:
version "0.7.31"