@cosmicdrift/kumiko-renderer 0.401.0 → 0.402.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.
@@ -1,4 +1,5 @@
1
1
  import type { ProjectionDetailScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
2
+ import type { FormatSpec } from "@cosmicdrift/kumiko-types/screen";
2
3
  import { type Translate } from "../headless/index.ts";
3
4
  import { type StatusBadgeOptionTone } from "../primitives.tsx";
4
5
  export declare function headerStatusTone(header: NonNullable<ProjectionDetailScreenDefinition["header"]>, record: Readonly<Record<string, unknown>>): StatusBadgeOptionTone | undefined;
@@ -10,3 +11,6 @@ export type DetailTabItem = {
10
11
  readonly count?: number;
11
12
  };
12
13
  export declare function buildDetailTabItems(sections: ProjectionDetailScreenDefinition["layout"]["sections"], record: Readonly<Record<string, unknown>>, translate: Translate, queryCounts?: Readonly<Record<string, number>>): DetailTabItem[];
14
+ export declare function resolveMetricText(metric: {
15
+ readonly format?: FormatSpec;
16
+ }, raw: unknown, translate: Translate): string;
@@ -62,3 +62,10 @@ export function buildDetailTabItems(sections, record, translate, queryCounts = {
62
62
  };
63
63
  });
64
64
  }
65
+ export function resolveMetricText(metric, raw, translate) {
66
+ const rawText = String(raw ?? "");
67
+ if (metric.format === undefined)
68
+ return rawText;
69
+ const formatted = applyFormatSpec(metric.format, raw, translate);
70
+ return formatted === "" ? rawText : formatted;
71
+ }
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  import { Fragment } from "react";
3
3
  import { ErrorReference } from "./error-reference.js";
4
4
  import { HeaderActionsBar } from "./header-actions-bar.js";
5
- import { headerStatusTone, resolveHeaderStatusText, resolveSubtitleHref, } from "./projection-detail-header-model.js";
5
+ import { headerStatusTone, resolveHeaderStatusText, resolveMetricText, resolveSubtitleHref, } from "./projection-detail-header-model.js";
6
6
  import { buildSubtitleParts, metricNavigateResolves, runMetricNavigate, } from "./projection-detail-navigation.js";
7
7
  import { navigateTargetAllows } from "./screen-access.js";
8
8
  export function renderHeaderActionsContent(model) {
@@ -52,7 +52,7 @@ export function buildMetricItems(model) {
52
52
  const field = metric.field;
53
53
  const label = effectiveTranslate(metric.label);
54
54
  const rawValue = record[field];
55
- const value = String(rawValue ?? "");
55
+ const value = resolveMetricText(metric, rawValue, effectiveTranslate);
56
56
  const tiles = screen.metricsStyle === "tiles";
57
57
  // Same rule as the dashboard stat panels: a fixed tone must not paint an all-clear 0.
58
58
  const tone = rawValue === 0 ? undefined : metric.tone;
@@ -22,7 +22,7 @@ export function EditorPanel({ resolvers }) {
22
22
  const handleClose = useCallback(() => {
23
23
  requestLeave(() => nav.setSearchParams(clearTargetSearchParams(nav.searchParams)));
24
24
  }, [nav]);
25
- return (_jsx("div", { "data-kumiko-layout": "editor-main", className: "flex-1 overflow-y-auto", children: target === undefined ? (_jsx(EditorEmptyState, {})) : (_jsx(EditorPanelInner, { target: target, resolvers: resolvers, onClose: handleClose })) }));
25
+ return (_jsx("div", { "data-kumiko-layout": "editor-main", className: "h-full min-h-0 overflow-y-auto", children: target === undefined ? (_jsx(EditorEmptyState, {})) : (_jsx(EditorPanelInner, { target: target, resolvers: resolvers, onClose: handleClose })) }));
26
26
  }
27
27
  function EditorEmptyState() {
28
28
  return (_jsx("div", { className: "flex h-full items-center justify-center p-8 text-sm text-muted-foreground", children: _jsx("p", { children: "W\u00E4hle einen Knoten links zum Bearbeiten." }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-renderer",
3
- "version": "0.401.0",
3
+ "version": "0.402.0",
4
4
  "description": "React renderer for Kumiko screens. The root export holds the platform-agnostic logic (primitives contract, hooks, KumikoScreen, navigation and SSE abstractions); ./headless the DOM-free UI logic, ./live the HTTP dispatcher, ./web the browser bindings (HTML primitives, history navigation, EventSource live events, createKumikoApp).",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -48,8 +48,8 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
- "@cosmicdrift/kumiko-framework": "0.401.0",
52
- "@cosmicdrift/kumiko-types": "0.401.0",
51
+ "@cosmicdrift/kumiko-framework": "0.402.0",
52
+ "@cosmicdrift/kumiko-types": "0.402.0",
53
53
  "@types/qrcode": "^1.5.5",
54
54
  "class-variance-authority": "^0.7.1",
55
55
  "clsx": "^2.1.1",
@@ -79,8 +79,8 @@
79
79
  }
80
80
  },
81
81
  "devDependencies": {
82
- "@cosmicdrift/kumiko-locale-de": "0.401.0",
83
- "@cosmicdrift/kumiko-testing": "0.401.0",
82
+ "@cosmicdrift/kumiko-locale-de": "0.402.0",
83
+ "@cosmicdrift/kumiko-testing": "0.402.0",
84
84
  "@tailwindcss/cli": "^4.3.3",
85
85
  "@testing-library/react": "^16.3.3",
86
86
  "@testing-library/user-event": "^14.6.8",
package/src/changes.json CHANGED
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "version": "0.402.0",
4
+ "type": "improvement",
5
+ "title": "The editor panel keeps its save bar pinned",
6
+ "detail": "A FormScreenLayout editor inside the editor panel gets the full panel height, so its save bar stays visible while the content scrolls."
7
+ },
8
+ {
9
+ "version": "0.402.0",
10
+ "type": "improvement",
11
+ "title": "projectionDetail metrics can be formatted",
12
+ "detail": "`metrics[].format` takes a `FormatSpec` such as `{ format: \"date\" }`. The metric shows the formatted value (an empty result falls back to the raw text); the tone still resolves on the raw value. Without `format` nothing changes."
13
+ },
2
14
  {
3
15
  "version": "0.401.0",
4
16
  "type": "fix",