claude-artifact-framework 0.7.2 → 0.7.3
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 +26 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# claude-artifact-framework
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
A declarative framework for building apps inside Claude Artifacts: declare
|
|
4
|
+
what the app **is** — fields, records, steps, a chat with tools, a workspace
|
|
5
|
+
with a copilot — and the framework owns how it works. Persistence, hydration,
|
|
6
|
+
validation, empty/loading/error states, light+dark theming, navigation, and
|
|
7
|
+
the Claude tool loop are construction guarantees, not authoring tasks.
|
|
8
|
+
|
|
9
|
+
Five layouts (`panel`, `records`, `steps`, `chat`, `workspace`), ten block
|
|
10
|
+
types, tabs/conditional/collapsible composition, shared multi-viewer data,
|
|
11
|
+
and a `custom` escape hatch that keeps every framework service. Zero
|
|
12
|
+
dependencies, no build step — load it straight from a CDN. The decisions and
|
|
13
|
+
the evidence behind them live in [DESIGN.md](./DESIGN.md).
|
|
6
14
|
|
|
7
15
|
## Usage via CDN
|
|
8
16
|
|
|
@@ -12,8 +20,11 @@ mirrors npm packages automatically.
|
|
|
12
20
|
### As a global script (`<script>` tag)
|
|
13
21
|
|
|
14
22
|
```html
|
|
15
|
-
<script src="https://cdn.jsdelivr.net/npm/claude-artifact-framework@0.7.
|
|
23
|
+
<script src="https://cdn.jsdelivr.net/npm/claude-artifact-framework@0.7.3/dist/index.global.js"></script>
|
|
16
24
|
<script>
|
|
25
|
+
ArtifactKit.useReact(React); // hand over the page's React once
|
|
26
|
+
const App = ArtifactKit.createApp({ title: "Mi app", blocks: [ /* ... */ ] });
|
|
27
|
+
// lower-level utilities are also exported:
|
|
17
28
|
const { storage, createStore, createPersistedStore, createSharedStore } = ArtifactKit;
|
|
18
29
|
</script>
|
|
19
30
|
```
|
|
@@ -27,11 +38,11 @@ mirrors npm packages automatically.
|
|
|
27
38
|
createStore,
|
|
28
39
|
createPersistedStore,
|
|
29
40
|
createSharedStore,
|
|
30
|
-
} from "https://cdn.jsdelivr.net/npm/claude-artifact-framework@0.7.
|
|
41
|
+
} from "https://cdn.jsdelivr.net/npm/claude-artifact-framework@0.7.3/dist/index.esm.js";
|
|
31
42
|
</script>
|
|
32
43
|
```
|
|
33
44
|
|
|
34
|
-
Pin a version (`@0.7.
|
|
45
|
+
Pin a version (`@0.7.3`) for reproducible artifacts, or drop the version
|
|
35
46
|
(`claude-artifact-framework/dist/...`) to always get the latest release.
|
|
36
47
|
|
|
37
48
|
### Inside a React artifact
|
|
@@ -172,6 +183,9 @@ blocks: [
|
|
|
172
183
|
]
|
|
173
184
|
```
|
|
174
185
|
|
|
186
|
+
`timer` takes `minutes` and/or `seconds` (`{ seconds: 90 }` for a rest timer),
|
|
187
|
+
plus optional `label` and `doneText`.
|
|
188
|
+
|
|
175
189
|
`text` blocks also accept a function of data — `{ text: (d) => "Hola " + d.nombre }` —
|
|
176
190
|
with the same contract as `output`.
|
|
177
191
|
|
|
@@ -379,7 +393,8 @@ view state — they survive reload, per viewer. Tabs cannot nest inside tabs;
|
|
|
379
393
|
Everything an app can declare, in one place.
|
|
380
394
|
|
|
381
395
|
**Top-level keys**: `title`, `subtitle`, `theme: { seed }`, `layout`, `blocks`,
|
|
382
|
-
`records`, `steps`, `chat`, `
|
|
396
|
+
`records`, `steps`, `chat`, `main`, `sidebar` (workspace panes), `data`,
|
|
397
|
+
`shared`. Anything else throws.
|
|
383
398
|
|
|
384
399
|
**Layouts** (`layout:`): `panel` (default — grid of blocks), `records` (CRUD
|
|
385
400
|
list), `steps` (wizard), `chat` (conversation with Claude), `workspace`
|
|
@@ -389,7 +404,10 @@ list), `steps` (wizard), `chat` (conversation with Claude), `workspace`
|
|
|
389
404
|
**Block types** (entries of `blocks`, `main`, or `sidebar`): `fields`,
|
|
390
405
|
`output`, `text`, `list`, `chart`, `timer`, `actions`, `chat`, `tabs`,
|
|
391
406
|
`custom`. Any block also accepts `when: (d) => bool` (conditional
|
|
392
|
-
visibility) and `collapsible: true | "collapsed"` (accordion; needs `title`).
|
|
407
|
+
visibility) and `collapsible: true | "collapsed"` (accordion; needs `title`).
|
|
408
|
+
On every block `title` is the heading string; `list` additionally accepts a
|
|
409
|
+
function as `title`, used as the per-row title (rows fall back to
|
|
410
|
+
`r.title ?? r.name ?? r.label ?? r.text`). One type per entry, plus optional `title`, `empty`,
|
|
393
411
|
`wide`. In the `records` layout, `blocks` render below the list (never on the
|
|
394
412
|
detail screen); their functions receive the same `data` object as everywhere
|
|
395
413
|
else — the collection lives at `d.records`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-artifact-framework",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Utilities for building apps inside Claude Artifacts: platform storage, chat tool-calling loops, and other primitives verified against the real runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.esm.js",
|