Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into cab/symlog-ticks
Browse files Browse the repository at this point in the history
  • Loading branch information
cab404 committed Sep 11, 2023
2 parents 267d47a + fa62d27 commit 2720d9b
Show file tree
Hide file tree
Showing 51 changed files with 1,101 additions and 647 deletions.
8 changes: 8 additions & 0 deletions .changeset/famous-ties-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@quri/prettier-plugin-squiggle": patch
"@quri/squiggle-lang": patch
"@quri/squiggle-components": patch
"@quri/ui": patch
---

Change Typescript target to ES2021
1 change: 1 addition & 0 deletions .github/workflows/prisma-migrate-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

jobs:
migrate:
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
environment: Preview
steps:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"prettier": "^3.0.0",
"prettier": "^3.0.3",
"turbo": "^1.10.12",
"turbo-ignore": "^1.10.12"
"turbo-ignore": "^1.10.13"
}
}
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"indent-string": "^5.0.0"
},
"devDependencies": {
"prettier": "^3.0.0"
"prettier": "^3.0.3"
}
}
14 changes: 7 additions & 7 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"dependencies": {
"@codemirror/autocomplete": "^6.9.0",
"@codemirror/commands": "^6.2.4",
"@codemirror/language": "^6.8.0",
"@codemirror/language": "^6.9.0",
"@codemirror/lint": "^6.4.0",
"@codemirror/search": "^6.5.0",
"@codemirror/state": "^6.2.1",
"@codemirror/theme-one-dark": "^6.1.2",
"@codemirror/view": "^6.16.0",
"@codemirror/view": "^6.18.0",
"@floating-ui/react": "^0.24.3",
"@heroicons/react": "^1.0.6",
"@hookform/resolvers": "^3.1.1",
"@hookform/resolvers": "^3.3.1",
"@lezer/common": "^1.0.4",
"@quri/prettier-plugin-squiggle": "workspace:*",
"@quri/squiggle-lang": "workspace:*",
Expand All @@ -32,7 +32,7 @@
"d3": "^7.8.5",
"framer-motion": "^10.12.18",
"lodash": "^4.17.21",
"prettier": "^3.0.0",
"prettier": "^3.0.3",
"react": "^18.2.0",
"react-error-boundary": "^4.0.10",
"react-hook-form": "^7.45.2",
Expand All @@ -51,7 +51,7 @@
"@storybook/addon-docs": "^7.2.1",
"@storybook/addon-essentials": "^7.2.1",
"@storybook/addon-links": "^7.2.1",
"@storybook/blocks": "^7.0.24",
"@storybook/blocks": "^7.4.0",
"@storybook/node-logger": "^7.2.1",
"@storybook/react": "^7.0.24",
"@storybook/react-vite": "^7.2.1",
Expand All @@ -65,14 +65,14 @@
"@types/react-resizable": "^3.0.4",
"@types/testing-library__jest-dom": "^5.14.7",
"@types/webpack-bundle-analyzer": "^4.6.0",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.2.1",
"canvas": "^2.11.2",
"eslint": "^8.46.0",
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"jest-environment-jsdom": "^29.6.4",
"jsdom": "^22.1.0",
"postcss": "^8.4.24",
"postcss-cli": "^10.1.0",
Expand Down
13 changes: 4 additions & 9 deletions packages/components/src/components/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ interface CodeEditorProps {
onSubmit?: () => void;
onViewValuePath?: (path: SqValuePath) => void;
width?: number;
height?: number;
height?: number | string;
showGutter?: boolean;
lineWrapping?: boolean;
errors?: SqError[];
Expand Down Expand Up @@ -228,8 +228,8 @@ export const CodeEditor = forwardRef<CodeEditorHandle, CodeEditorProps>(
effects: compTheme.reconfigure(
EditorView.theme({
"&": {
...(width === undefined ? {} : { width: `${width}px` }),
...(height === undefined ? {} : { height: `${height}px` }),
...(width === undefined ? {} : { width }),
...(height === undefined ? {} : { height }),
},
".cm-selectionMatch": { backgroundColor: "#33ae661a" },
".cm-content": { padding: 0 },
Expand Down Expand Up @@ -361,11 +361,6 @@ export const CodeEditor = forwardRef<CodeEditorHandle, CodeEditorProps>(
[view]
);

return (
<div
style={{ minWidth: width, minHeight: height, fontSize: "13px" }}
ref={setViewDom}
></div>
);
return <div style={{ fontSize: "13px" }} ref={setViewDom}></div>;
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ export const LeftPlaygroundPanel = forwardRef<LeftPlaygroundPanelHandle, Props>(
);

const renderBody = () => (
<div data-testid="squiggle-editor">
<div data-testid="squiggle-editor" style={{ display: "contents" }}>
<CodeEditor
ref={editorRef}
// it's important to pass `code` and not `defaultCode` here;
// see https://github.com/quantified-uncertainty/squiggle/issues/1952
defaultValue={code}
errors={errors}
height={"100%"}
project={project}
sourceId={sourceId}
showGutter={true}
Expand Down
31 changes: 24 additions & 7 deletions packages/components/src/lib/hooks/useCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
useLayoutEffect,
useMemo,
useState,
useRef,
} from "react";

export type DrawContext = {
Expand All @@ -13,6 +14,10 @@ export type DrawContext = {

type DrawFunction = (context: DrawContext) => void;

// We throttle to get around a Firefox bug.
// See: https://github.com/quantified-uncertainty/squiggle/issues/2263
const RESIZE_DELAY = 30;

export function useCanvas({
height,
init,
Expand All @@ -30,20 +35,32 @@ export function useCanvas({
const devicePixelRatio =
typeof window === "undefined" ? 1 : window.devicePixelRatio;

const throttleTimeout = useRef<number | null>(null);

const handleResize = useCallback((entries: ResizeObserverEntry[]) => {
if (!entries[0]) return;

if (throttleTimeout.current) {
clearTimeout(throttleTimeout.current);
}

throttleTimeout.current = window.setTimeout(() => {
setWidth(entries[0].contentRect.width);
}, RESIZE_DELAY);
}, []);

const observer = useMemo(() => {
if (typeof window === "undefined") {
return undefined;
}
return new window.ResizeObserver((entries) => {
if (!entries[0]) {
return;
}
setWidth(entries[0].contentRect.width);
});
}, []);
return new window.ResizeObserver(handleResize);
}, [handleResize]);

useEffect(() => {
return () => {
if (throttleTimeout.current) {
clearTimeout(throttleTimeout.current);
}
observer?.disconnect();
};
}, [observer]);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// build settings
"module": "es2020",
"moduleResolution": "node16",
"target": "es2022",
"target": "es2021",
"jsx": "react-jsx",
"esModuleInterop": true,
"composite": true,
Expand Down
10 changes: 5 additions & 5 deletions packages/hub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@pothos/core": "^3.32.1",
"@pothos/plugin-errors": "^3.11.1",
"@pothos/plugin-prisma": "^3.53.0",
"@pothos/plugin-relay": "^3.43.0",
"@pothos/plugin-relay": "^3.43.1",
"@pothos/plugin-scope-auth": "^3.20.0",
"@pothos/plugin-simple-objects": "^3.7.0",
"@pothos/plugin-validation": "^3.9.2",
Expand Down Expand Up @@ -56,20 +56,20 @@
"zod": "^3.21.4"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/forms": "^0.5.6",
"@types/d3": "^7.4.0",
"@types/lodash": "^4.14.196",
"@types/pako": "^2.0.0",
"@types/react": "^18.2.18",
"@types/react-relay": "^14.1.4",
"@types/react-relay": "^14.1.5",
"@types/relay-runtime": "^14.1.12",
"babel-plugin-relay": "^15.0.0",
"eslint": "^8.46.0",
"eslint-config-next": "^13.4.12",
"graphql": "^16.7.1",
"postcss": "^8.4.24",
"prettier": "^2.8.8",
"prisma": "^5.1.1",
"prettier": "^3.0.3",
"prisma": "^5.2.0",
"relay-compiler": "^15.0.0",
"tailwindcss": "^3.3.2",
"tsx": "^3.12.7"
Expand Down
2 changes: 1 addition & 1 deletion packages/hub/src/components/SelectUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const SingleValue = ({

export function SelectUser<
TValues extends FieldValues,
TName extends FieldPath<TValues> = FieldPath<TValues>
TName extends FieldPath<TValues> = FieldPath<TValues>,
>({
name,
label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const SingleValue = ({
export function SelectRelativeValuesDefinition<
TValues extends FieldValues,
TName extends FieldPath<TValues> = FieldPath<TValues>,
TUserName extends FieldPath<TValues> = FieldPath<TValues>
TUserName extends FieldPath<TValues> = FieldPath<TValues>,
>({
name,
label,
Expand Down
2 changes: 1 addition & 1 deletion packages/hub/src/hooks/useAsyncMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function useAsyncMutation<
readonly __typename: string;
};
};
}
},
>({
mutation,
confirmation,
Expand Down
2 changes: 1 addition & 1 deletion packages/hub/src/lib/graphqlHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type ErrorUnionNode<OkTypename extends string, Content> =
*/
export function extractFromGraphqlErrorUnion<
OkTypename extends string,
Content
Content,
>(node: ErrorUnionNode<OkTypename, Content>, typename: OkTypename) {
if (node.__typename === "NotFoundError") {
notFound();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const SingleValue = ({

export function SelectCluster<
TValues extends FieldValues,
TName extends FieldPath<TValues> = FieldPath<TValues>
TName extends FieldPath<TValues> = FieldPath<TValues>,
>({
name,
clusters,
Expand Down
4 changes: 2 additions & 2 deletions packages/hub/src/relay/loadSerializableQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { headers } from "next/headers";

export interface SerializablePreloadedQuery<
TRequest extends ConcreteRequest,
TQuery extends OperationType
TQuery extends OperationType,
> {
params: TRequest["params"];
variables: VariablesOf<TQuery>;
Expand All @@ -23,7 +23,7 @@ export interface SerializablePreloadedQuery<
// to avoid the client fetches.
export async function loadSerializableQuery<
TRequest extends ConcreteRequest,
TQuery extends OperationType
TQuery extends OperationType,
>(
params: RequestParameters,
variables: VariablesOf<TQuery>
Expand Down
4 changes: 2 additions & 2 deletions packages/hub/src/relay/useSerializablePreloadedQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { EnvironmentWithResponseCache } from "./environment";
// the network layer can use these cache results when fetching data in `usePreloadedQuery`.
export function useSerializablePreloadedQuery<
TRequest extends ConcreteRequest,
TQuery extends OperationType
TQuery extends OperationType,
>(
preloadQuery: SerializablePreloadedQuery<TRequest, TQuery>,
fetchPolicy: PreloadFetchPolicy = "store-or-network"
Expand Down Expand Up @@ -45,7 +45,7 @@ export function useSerializablePreloadedQuery<

function writePreloadedQueryToCache<
TRequest extends ConcreteRequest,
TQuery extends OperationType
TQuery extends OperationType,
>(
preloadedQueryObject: SerializablePreloadedQuery<TRequest, TQuery>,
environment: EnvironmentWithResponseCache
Expand Down
2 changes: 1 addition & 1 deletion packages/hub/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"module": "es2020",
"moduleResolution": "node",
"target": "es2022",
"target": "es2021",
"lib": ["dom", "dom.iterable", "esnext"],
"esModuleInterop": true,
"noEmit": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/ops/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"module": "es2020",
"moduleResolution": "node16",
"target": "es2022",
"target": "es2021",
"esModuleInterop": true,
"rootDir": "scripts",
"noEmit": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/prettier-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
},
"dependencies": {
"@quri/squiggle-lang": "workspace:*",
"prettier": "^3.0.0"
"prettier": "^3.0.3"
},
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
"@babel/preset-typescript": "^7.22.15",
"@types/jest": "^29.5.3",
"jest": "^29.6.2",
"typescript": "^5.1.6"
Expand Down
2 changes: 1 addition & 1 deletion packages/prettier-plugin/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// build settings
"module": "es2020",
"moduleResolution": "node16",
"target": "es2022",
"target": "es2021",
"esModuleInterop": true,
"composite": true,
"outDir": "./dist/esm",
Expand Down

0 comments on commit 2720d9b

Please sign in to comment.