@ashley-shrok/viewmodel-shell 0.8.0 → 0.9.0

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/dist/browser.js CHANGED
@@ -690,7 +690,10 @@ export class BrowserAdapter {
690
690
  copyButton(n, parent) {
691
691
  const btn = document.createElement("button");
692
692
  btn.type = "button";
693
- btn.className = "vms-button";
693
+ // 0.9.0 (#14): variant modifier class, mirroring button() exactly. The
694
+ // existing .vms-button--{primary,secondary,danger} CSS rules apply
695
+ // automatically — no new style surface.
696
+ btn.className = `vms-button${n.variant ? ` vms-button--${n.variant}` : ""}`;
694
697
  btn.textContent = n.label ?? "Copy";
695
698
  btn.addEventListener("click", () => {
696
699
  const write = navigator.clipboard?.writeText(n.text);
package/dist/index.d.ts CHANGED
@@ -196,6 +196,11 @@ export interface CopyButtonNode {
196
196
  label?: string;
197
197
  /** Ephemeral label shown after a successful copy, reverts after ~1.5 s. Adapter default: "Copied!". */
198
198
  copiedLabel?: string;
199
+ /** Visual variant — mirrors ButtonNode.variant (issue #14). Adapter emits
200
+ * `vms-button vms-button--{variant}` (browser) / variant-tinted text
201
+ * (TUI), so a copy-button can read distinctly from neighboring default
202
+ * buttons. Closed union; omitted = current behavior (no modifier). */
203
+ variant?: "primary" | "secondary" | "danger";
199
204
  }
200
205
  export interface ShellOptions {
201
206
  endpoint: string;
package/dist/tui.js CHANGED
@@ -1019,7 +1019,13 @@ function CopyButtonView({ node, ctx }) {
1019
1019
  const label = isCopied
1020
1020
  ? (node.copiedLabel ?? "Copied!")
1021
1021
  : (node.label ?? "Copy");
1022
- return (_jsxs("text", { onMouseDown: () => ctx.copy(node.text), children: ["[ ", label, " ]"] }));
1022
+ // 0.9.0 (#14): variant coloring mirrors ButtonView's fg derivation
1023
+ // verbatim. Adapter-medium-adaptation parity: the browser uses CSS
1024
+ // classes; the TUI uses ANSI fg colors. Same semantic mapping.
1025
+ const fg = node.variant === "danger" ? "#ff5555"
1026
+ : node.variant === "primary" ? "#88aaff"
1027
+ : undefined;
1028
+ return (_jsxs("text", { ...(fg != null ? { fg } : {}), onMouseDown: () => ctx.copy(node.text), children: ["[ ", label, " ]"] }));
1023
1029
  }
1024
1030
  // ── form ──────────────────────────────────────────────────────────────────
1025
1031
  // Renders children + the submit button (decorative for B3 — Enter on any
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ashley-shrok/viewmodel-shell",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "A server-driven UI framework where the wire format is structured enough that agents can build full-stack apps without ever opening a browser and all UI tests are pure unit tests with no browser runtime. Server returns a JSON tree of typed nodes; a thin TypeScript adapter renders it to DOM. Backend-agnostic — a .NET reference backend ships with the repo, but any language can produce the JSON contract.",
5
5
  "type": "module",
6
6
  "license": "MIT",