@jigs.design/catalog 0.1.0 → 0.1.2

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.
package/README.md CHANGED
@@ -13,18 +13,18 @@ export const host = defineHost({ components: catalog, procedures });
13
13
  ```tsx
14
14
  // in the browser
15
15
  import { components } from "@jigs.design/catalog/react";
16
- <PickleView client={client} components={components} program={program} />;
16
+ <JigsView client={client} components={components} program={program} />;
17
17
  ```
18
18
 
19
19
  Import `@jigs.design/catalog/styles.css` once, in your root layout.
20
20
 
21
21
  ## Entry points
22
22
 
23
- | Entry | Runs in | What it holds |
24
- | --------------------------------- | ------- | ------------------------------------------- |
25
- | `@jigs.design/catalog` | Server | `catalog` and the `DefaultCatalog` type |
26
- | `@jigs.design/catalog/react` | Browser | `components`, the registry for `PickleView` |
27
- | `@jigs.design/catalog/styles.css` | Browser | The registry's styles |
23
+ | Entry | Runs in | What it holds |
24
+ | --------------------------------- | ------- | ----------------------------------------- |
25
+ | `@jigs.design/catalog` | Server | `catalog` and the `DefaultCatalog` type |
26
+ | `@jigs.design/catalog/react` | Browser | `components`, the registry for `JigsView` |
27
+ | `@jigs.design/catalog/styles.css` | Browser | The registry's styles |
28
28
 
29
29
  ## Components
30
30
 
@@ -34,7 +34,7 @@ Import `@jigs.design/catalog/styles.css` once, in your root layout.
34
34
  - Data: `table`, and on Recharts `chart`, `pieChart`, `scatterChart`, `radarChart` and `sparkline`, and `progress`.
35
35
  - Media: `image`, `icon` (Lucide).
36
36
 
37
- The catalog is at version 3, since `icon` took `color="info"` (version 2 brought the charts and `progress`). A spec's `{@pickle 0 catalog=3}` line names the version it was written for. Field controls take an `ariaLabel`.
37
+ The catalog is at version 3, since `icon` took `color="info"` (version 2 brought the charts and `progress`). A spec's `{@jigs 0 catalog=3}` line names the version it was written for. Field controls take an `ariaLabel`.
38
38
 
39
39
  ## Source
40
40
 
@@ -1,7 +1,7 @@
1
1
  import { buttonColors, controlSizes, controlVariants, fieldVariants } from "../catalog.js";
2
2
  import { classes, isBoolean, isNumber, keyField, oneOf, textField } from "./props.js";
3
3
  import { Glyph, iconLabel } from "./icons.js";
4
- import { controlled, useLocalValue } from "./local-value.js";
4
+ import { controlled, useLocalValue } from "@jigs.design/react";
5
5
  import { ChevronDown, Minus, Plus, X } from "lucide-react";
6
6
  import { useId, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@jigs.design/catalog",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "The default catalog, modeled on ChatKit widgets, and a React registry for it.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/yoamomonstruos/pickle.git",
8
+ "url": "git+https://github.com/yoamomonstruos/jigs.git",
9
9
  "directory": "packages/catalog"
10
10
  },
11
11
  "type": "module",
@@ -34,14 +34,14 @@
34
34
  "dependencies": {
35
35
  "lucide-react": "1.57.0",
36
36
  "recharts": "3.10.1",
37
- "@jigs.design/react": "0.1.0",
38
- "@jigs.design/host": "0.1.0"
37
+ "@jigs.design/host": "0.1.2",
38
+ "@jigs.design/react": "0.1.2"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^18.0.0 || ^19.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@jigs.design/prompt": "0.1.0",
45
- "@jigs.design/server": "0.1.0"
44
+ "@jigs.design/prompt": "0.1.2",
45
+ "@jigs.design/server": "0.1.2"
46
46
  }
47
47
  }
@@ -1,47 +0,0 @@
1
- import { useState } from "react";
2
- import { useHandlerSettled } from "@jigs.design/react";
3
- //#region src/react/local-value.ts
4
- /**
5
- * Whether the program controls a control's value: it sets the value prop
6
- * (`value`, or `checked`) and handles `onChange`. A control with only
7
- * `onChange` is uncontrolled, like a React input without `value`: the
8
- * program hears each edit but the control keeps what the user did.
9
- */
10
- const controlled = (value, onChange) => value !== void 0 && onChange !== void 0;
11
- /**
12
- * A local copy of a value the program owns, so a control can run ahead of the
13
- * round trip to the sandbox. Pass `echoes` when the program controls the
14
- * value (`controlled`): echoes of the edits sent to it then don't reset the
15
- * control, but any other new value does, and so does an edit the program did
16
- * not take: once it has answered every call (`useHandlerSettled`) and `value`
17
- * is still not the edit, the control goes back to `value`. Without `echoes`,
18
- * the control keeps its own state until `value` changes.
19
- */
20
- function useLocalValue(value, echoes) {
21
- const settled = useHandlerSettled();
22
- const [local, setLocal] = useState(value);
23
- const [seen, setSeen] = useState(value);
24
- const [seenSettled, setSeenSettled] = useState(settled);
25
- const [pending, setPending] = useState([]);
26
- if (!Object.is(value, seen)) {
27
- setSeen(value);
28
- const echo = pending.findIndex((sent) => Object.is(sent, value));
29
- if (echo === -1) {
30
- setLocal(value);
31
- setPending([]);
32
- } else setPending(pending.slice(echo + 1));
33
- } else if (settled !== seenSettled) {
34
- setSeenSettled(settled);
35
- if (pending.length > 0) {
36
- setLocal(value);
37
- setPending([]);
38
- }
39
- }
40
- const edit = (next) => {
41
- setLocal(next);
42
- if (echoes) setPending([...pending.slice(-20), next]);
43
- };
44
- return [local, edit];
45
- }
46
- //#endregion
47
- export { controlled, useLocalValue };