claude-artifact-framework 0.9.0 → 0.9.1
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 +5 -1
- package/dist/index.esm.js +16 -6
- package/dist/index.esm.js.map +2 -2
- package/dist/index.global.js +25 -18
- package/dist/index.global.js.map +3 -3
- package/package.json +1 -1
- package/src/app.js +11 -4
- package/src/blocks.js +1 -1
- package/src/chat.js +4 -1
package/README.md
CHANGED
|
@@ -347,7 +347,8 @@ ArtifactKit.createApp({
|
|
|
347
347
|
{ output: (d) => [{ label: "Palabras", value: countWords(d.nota), big: true }] },
|
|
348
348
|
],
|
|
349
349
|
sidebar: [
|
|
350
|
-
{
|
|
350
|
+
{ title: "Asistente",
|
|
351
|
+
chat: {
|
|
351
352
|
system: (d) => "Sos un copiloto de escritura. Nota actual: " + (d.nota || ""),
|
|
352
353
|
tools: {
|
|
353
354
|
reescribir_nota: {
|
|
@@ -361,6 +362,9 @@ ArtifactKit.createApp({
|
|
|
361
362
|
})
|
|
362
363
|
```
|
|
363
364
|
|
|
365
|
+
Give the chat block a `title` (like every other block) — a chat card that
|
|
366
|
+
opens straight into a bubble is the one block on screen without a heading.
|
|
367
|
+
|
|
364
368
|
`main` is required; `sidebar` is optional. Both take the same blocks as
|
|
365
369
|
`panel`. The panes sit side by side and stack on narrow screens. One chat
|
|
366
370
|
block per app — the conversation persists under `data.chat` and there is
|
package/dist/index.esm.js
CHANGED
|
@@ -507,7 +507,7 @@ function Bubble({ m }) {
|
|
|
507
507
|
dangerouslySetInnerHTML: { __html: renderMarkdown(m.content) }
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
|
-
function ChatPanel({ cfg, ctx }) {
|
|
510
|
+
function ChatPanel({ cfg, ctx, title }) {
|
|
511
511
|
const c = cfg;
|
|
512
512
|
const [draft, setDraft] = useState("");
|
|
513
513
|
const [busy, setBusy] = useState(false);
|
|
@@ -578,6 +578,9 @@ Continue with this information. If you have everything you need, answer in natur
|
|
|
578
578
|
createElement(
|
|
579
579
|
"div",
|
|
580
580
|
{ className: "caf-block caf-chat-log" },
|
|
581
|
+
// Every other block opens with its title label — a chat card that
|
|
582
|
+
// starts straight at a bubble was the one heading-less block on screen.
|
|
583
|
+
title ? createElement("h2", { className: "caf-block-title" }, title) : null,
|
|
581
584
|
c.greeting ? createElement("div", { className: "caf-msg caf-msg-assistant", dangerouslySetInnerHTML: { __html: renderMarkdown(c.greeting) } }) : null,
|
|
582
585
|
log.map((m, i) => createElement(Bubble, { key: i, m })),
|
|
583
586
|
live !== null ? createElement("div", { className: "caf-msg caf-msg-assistant caf-msg-live", dangerouslySetInnerHTML: { __html: renderMarkdown(live || "\u2026") } }) : null,
|
|
@@ -1008,7 +1011,7 @@ var BLOCKS = {
|
|
|
1008
1011
|
chart: ChartBlock,
|
|
1009
1012
|
timer: TimerBlock,
|
|
1010
1013
|
actions: ActionsBlock,
|
|
1011
|
-
chat: ({ spec, ctx }) => createElement(ChatPanel, { cfg: spec.chat, ctx }),
|
|
1014
|
+
chat: ({ spec, ctx }) => createElement(ChatPanel, { cfg: spec.chat, ctx, title: spec.title }),
|
|
1012
1015
|
custom: CustomBlock
|
|
1013
1016
|
};
|
|
1014
1017
|
var BLOCK_NAMES = Object.keys(BLOCKS);
|
|
@@ -1884,7 +1887,9 @@ var BASE_CSS = `
|
|
|
1884
1887
|
}
|
|
1885
1888
|
.caf-block-title { margin: 0; font-size: 0.78rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--caf-muted); }
|
|
1886
1889
|
.caf-field { display: flex; flex-direction: column; gap: 0.3rem; }
|
|
1887
|
-
|
|
1890
|
+
/* A full size+weight step below .caf-block-title \u2014 the uppercase alone was
|
|
1891
|
+
not enough to tell "card title" from "field label" at a glance. */
|
|
1892
|
+
.caf-field label { font-size: 0.68rem; font-weight: 500; color: var(--caf-muted); }
|
|
1888
1893
|
.caf-field input, .caf-field select, .caf-field textarea {
|
|
1889
1894
|
font: inherit; font-size: 0.95rem; padding: 0.5rem 0.6rem;
|
|
1890
1895
|
border-radius: var(--caf-control-radius); border: 1px solid var(--caf-border);
|
|
@@ -1918,7 +1923,9 @@ var BASE_CSS = `
|
|
|
1918
1923
|
.caf-row-sub { font-size: 0.78rem; color: var(--caf-muted); }
|
|
1919
1924
|
.caf-panel-single { grid-template-columns: 1fr; }
|
|
1920
1925
|
.caf-panel-single .caf-slot, .caf-panel-single > * { grid-column: span 1; }
|
|
1921
|
-
|
|
1926
|
+
/* Bottom padding matches the inter-row rhythm so the toolbar doesn't sit
|
|
1927
|
+
closer to the first row than rows sit to each other. */
|
|
1928
|
+
.caf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.3rem 0.3rem 0.75rem; }
|
|
1922
1929
|
.caf-count { font-size: 0.8rem; color: var(--caf-muted); font-variant-numeric: tabular-nums; }
|
|
1923
1930
|
.caf-btn {
|
|
1924
1931
|
font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
|
|
@@ -1943,7 +1950,8 @@ var BASE_CSS = `
|
|
|
1943
1950
|
.caf-line-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; }
|
|
1944
1951
|
.caf-line-last { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--caf-accent); }
|
|
1945
1952
|
.caf-donut { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
|
|
1946
|
-
|
|
1953
|
+
/* -3px optical correction: a circle beside flush-left text reads indented. */
|
|
1954
|
+
.caf-donut-svg { width: 110px; height: 110px; flex: none; transform: rotate(0.001deg); margin-left: -3px; }
|
|
1947
1955
|
.caf-donut-seg { fill: none; stroke-width: 6; }
|
|
1948
1956
|
/* Capped width keeps each value NEXT TO its label in wide cards \u2014 the pair
|
|
1949
1957
|
must read as a pair regardless of container width. */
|
|
@@ -2036,7 +2044,9 @@ var BASE_CSS = `
|
|
|
2036
2044
|
.caf-collapse-head { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
|
|
2037
2045
|
.caf-collapse-head:hover { filter: brightness(0.97); }
|
|
2038
2046
|
.caf-collapse-head:focus-visible { outline: 2px solid var(--caf-accent); outline-offset: 1px; }
|
|
2039
|
-
|
|
2047
|
+
/* Accent chevron: the one interaction cue that distinguishes a collapsible
|
|
2048
|
+
header from a static card title without breaking their shared typography. */
|
|
2049
|
+
.caf-chevron { transition: transform 0.15s ease; color: var(--caf-accent); }
|
|
2040
2050
|
.caf-chevron-closed { transform: rotate(-90deg); }
|
|
2041
2051
|
.caf-block-fill { border: none; background: transparent; padding: 0; overflow: auto; min-height: 320px; }
|
|
2042
2052
|
.caf-empty, .caf-loading { color: var(--caf-muted); font-size: 0.9rem; text-align: center; padding: 1.6rem 1rem; }
|