v0.2.16: jsImports prop and incremented minimal squiggle-lang
Value: [1e-5 to 1e-3]
This commit is contained in:
parent
9fe7034c51
commit
93ef7c76a0
|
@ -1,9 +1,9 @@
|
||||||
[![npm version](https://badge.fury.io/js/@quri%2Fsquiggle-components.svg)](https://www.npmjs.com/package/@quri/squiggle-components)
|
[![npm version](https://badge.fury.io/js/@quri%2Fsquiggle-components.svg)](https://www.npmjs.com/package/@quri/squiggle-components)
|
||||||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/quantified-uncertainty/squiggle/blob/develop/LICENSE)
|
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/quantified-uncertainty/squiggle/blob/develop/LICENSE)
|
||||||
|
|
||||||
# Squiggle Components
|
# Squiggle components
|
||||||
|
|
||||||
This package contains all the components for squiggle. These can be used either as a library or hosted as a [storybook](https://storybook.js.org/).
|
This package contains the react components for squiggle. These can be used either as a library or hosted as a [storybook](https://storybook.js.org/).
|
||||||
|
|
||||||
# Usage in a `react` project
|
# Usage in a `react` project
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ Add to `App.js`:
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
import { SquiggleEditor } from "@quri/squiggle-components";
|
import { SquiggleEditor } from "@quri/squiggle-components";
|
||||||
<SquiggleEditor initialSquiggleString="x = beta(3, 10); x + 20" />;
|
<SquiggleEditor initialSquiggleString="x = beta($alpha, 10); x + $shift" jsImports={alpha: 3, shift: 20} />;
|
||||||
```
|
```
|
||||||
|
|
||||||
# Build storybook for development
|
# Build storybook for development
|
||||||
|
@ -38,9 +38,3 @@ Run a development server
|
||||||
```sh
|
```sh
|
||||||
yarn start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
And build artefacts for production,
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn build # builds storybook app
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "@quri/squiggle-components",
|
"name": "@quri/squiggle-components",
|
||||||
"version": "0.2.15",
|
"version": "0.2.16",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@quri/squiggle-lang": "^0.2.7",
|
"@quri/squiggle-lang": "^0.2.8",
|
||||||
"@react-hook/size": "^2.1.2",
|
"@react-hook/size": "^2.1.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"react": "^18.1.0",
|
"react": "^18.1.0",
|
||||||
|
@ -49,11 +49,11 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "cross-env REACT_APP_FAST_REFRESH=false && start-storybook -p 6006 -s public",
|
"start": "cross-env REACT_APP_FAST_REFRESH=false && start-storybook -p 6006 -s public",
|
||||||
"build": "tsc -b && build-storybook -s public",
|
"build": "tsc -b && build-storybook -s public",
|
||||||
"build:package": "tsc -b",
|
|
||||||
"bundle": "webpack",
|
"bundle": "webpack",
|
||||||
"all": "yarn bundle && yarn build",
|
"all": "yarn bundle && yarn build",
|
||||||
"lint": "prettier --check .",
|
"lint": "prettier --check .",
|
||||||
"format": "prettier --write ."
|
"format": "prettier --write .",
|
||||||
|
"prepack": "yarn bundle && tsc -b"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
"@types/react": "17.0.43"
|
"@types/react": "17.0.43"
|
||||||
},
|
},
|
||||||
"source": "./src/index.ts",
|
"source": "./src/index.ts",
|
||||||
"browser": "dist/bundle.js",
|
"browser": "./dist/bundle.js",
|
||||||
"main": "dist/src/index.js",
|
"main": "./dist/src/index.js",
|
||||||
"types": "dist/src/index.d.ts"
|
"types": "./dist/src/index.d.ts"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,22 +3,26 @@
|
||||||
|
|
||||||
# Squiggle language
|
# Squiggle language
|
||||||
|
|
||||||
## Use the `npm` package
|
_An estimation language_
|
||||||
|
|
||||||
For instance, in a fresh `create-react-app`, you can
|
# Use the `npm` package
|
||||||
|
|
||||||
|
For instance, in a javascript project, you can
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
yarn add @quri/squiggle-lang
|
yarn add @quri/squiggle-lang
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import {run} from '@quri/squiggle-lang';
|
import { run } from "@quri/squiggle-lang";
|
||||||
run("normal(0, 1) * fromSamples([-3,-2,-1,1,2,3,3,3,4,9]").value.value.toSparkline().value)
|
run(
|
||||||
|
"normal(0, 1) * fromSamples([-3,-2,-1,1,2,3,3,3,4,9]"
|
||||||
|
).value.value.toSparkline().value;
|
||||||
```
|
```
|
||||||
|
|
||||||
**However, for most use cases you'll prefer to use our [library of react components](https://www.npmjs.com/package/@quri/squiggle-components)**, and let your app transitively depend on `@quri/squiggle-lang`.
|
**However, for most use cases you'll prefer to use our [library of react components](https://www.npmjs.com/package/@quri/squiggle-components)**, and let your app transitively depend on `@quri/squiggle-lang`.
|
||||||
|
|
||||||
## Build for development
|
# Build for development
|
||||||
|
|
||||||
We assume that you ran `yarn` at the monorepo level.
|
We assume that you ran `yarn` at the monorepo level.
|
||||||
|
|
||||||
|
@ -38,7 +42,7 @@ yarn test
|
||||||
yarn coverage:rescript; o _coverage/index.html # produces coverage report and opens it in browser
|
yarn coverage:rescript; o _coverage/index.html # produces coverage report and opens it in browser
|
||||||
```
|
```
|
||||||
|
|
||||||
## Distributing this package or using this package from other monorepo packages
|
# Distributing this package or using this package from other monorepo packages
|
||||||
|
|
||||||
As it says in the other `packages/*/README.md`s, building this package is an essential step of building other packages.
|
As it says in the other `packages/*/README.md`s, building this package is an essential step of building other packages.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user