@cosmicdrift/kumiko-renderer 0.37.0 → 0.38.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-renderer",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "Platform-agnostic React renderer for Kumiko screens. Contains the shared logic — primitives-contract, hooks, KumikoScreen, navigation & SSE abstractions — that any platform-specific renderer (web, native) composes. No DOM, no EventSource, no react-dom.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -15,8 +15,8 @@
15
15
  }
16
16
  },
17
17
  "dependencies": {
18
- "@cosmicdrift/kumiko-framework": "0.35.0",
19
- "@cosmicdrift/kumiko-headless": "0.35.0",
18
+ "@cosmicdrift/kumiko-framework": "0.37.0",
19
+ "@cosmicdrift/kumiko-headless": "0.37.0",
20
20
  "react": "^19.2.6"
21
21
  },
22
22
  "devDependencies": {
@@ -1,5 +1,3 @@
1
- // feature-schema Pure-Logik Tests (Phase 1, test-luecken-integration, Tier 1).
2
- //
3
1
  // toAppSchema normalisiert FeatureSchema → AppSchema (idempotent),
4
2
  // isAppSchema diskriminiert die beiden Formen. Zero source-change.
5
3
 
@@ -29,3 +27,14 @@ describe("isAppSchema", () => {
29
27
  expect(isAppSchema(feature)).toBe(false);
30
28
  });
31
29
  });
30
+
31
+ describe("toAppSchema — workspaces-Hoist (Legacy-Form)", () => {
32
+ test("hebt feature-lokale workspaces auf App-Ebene und entfernt sie vom Feature", () => {
33
+ const ws = [{ definition: { id: "admin", label: "Admin", navs: [] }, navMembers: [] }];
34
+ const withWs: FeatureSchema = { ...feature, workspaces: ws };
35
+ const app = toAppSchema(withWs);
36
+ expect(app.workspaces).toEqual(ws);
37
+ expect(app.features[0]).not.toHaveProperty("workspaces");
38
+ expect(app.features[0]?.featureName).toBe("tasks");
39
+ });
40
+ });
@@ -19,9 +19,9 @@ export class WriteFailedError extends Error {
19
19
  // unverändert wenn nicht — Renderer-Convention), sonst message, zuletzt code.
20
20
  export function dispatcherErrorText(
21
21
  error: DispatcherError,
22
- translate: (key: string) => string,
22
+ translate: (key: string, params?: Readonly<Record<string, unknown>>) => string,
23
23
  ): string {
24
- const translated = translate(error.i18nKey);
24
+ const translated = translate(error.i18nKey, error.i18nParams);
25
25
  if (translated !== error.i18nKey) return translated;
26
26
  return error.message !== "" ? error.message : error.code;
27
27
  }
@@ -52,12 +52,24 @@ function moneyField(): EditFieldViewModel {
52
52
  };
53
53
  }
54
54
 
55
- function renderUnderLocale(locale: string): void {
55
+ function dateField(): EditFieldViewModel {
56
+ return {
57
+ field: "dueAt",
58
+ label: "Fällig",
59
+ type: "date",
60
+ value: "2026-01-15",
61
+ visible: true,
62
+ readOnly: false,
63
+ required: false,
64
+ };
65
+ }
66
+
67
+ function renderUnderLocale(locale: string, field: EditFieldViewModel = moneyField()): void {
56
68
  captured = undefined;
57
69
  render(
58
70
  <LocaleProvider resolver={createStaticLocaleResolver({ locale })}>
59
71
  <PrimitivesProvider value={testPrimitives}>
60
- <RenderField field={moneyField()} onChange={() => {}} />
72
+ <RenderField field={field} onChange={() => {}} />
61
73
  </PrimitivesProvider>
62
74
  </LocaleProvider>,
63
75
  );
@@ -72,6 +84,16 @@ describe("RenderField — App-Locale an money durchreichen", () => {
72
84
 
73
85
  test("ein anderes App-Locale wird ebenso durchgereicht (en-US)", () => {
74
86
  renderUnderLocale("en-US");
87
+ // Unconditional zuerst — ohne sie wäre der Test bei falschem kind leer.
88
+ expect(captured?.kind).toBe("money");
75
89
  if (captured?.kind === "money") expect(captured.locale).toBe("en-US");
76
90
  });
77
91
  });
92
+
93
+ describe("RenderField — App-Locale an date durchreichen", () => {
94
+ test("date ohne field.locale bekommt das App-Locale (de-DE)", () => {
95
+ renderUnderLocale("de-DE", dateField());
96
+ expect(captured?.kind).toBe("date");
97
+ if (captured?.kind === "date") expect(captured.locale).toBe("de-DE");
98
+ });
99
+ });