@cosmicdrift/kumiko-headless 0.246.0 → 0.248.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-headless",
3
- "version": "0.246.0",
3
+ "version": "0.248.0",
4
4
  "description": "Headless UI logic for Kumiko — Dispatcher contract, Form-Controller, View-Model, Nav-Resolver. Plattform- und React-frei; jeder Renderer (renderer, renderer-web, renderer-native, …) komponiert darauf.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -36,7 +36,7 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@cosmicdrift/kumiko-framework": "0.246.0",
39
+ "@cosmicdrift/kumiko-framework": "0.248.0",
40
40
  "temporal-polyfill": "^0.3.2",
41
41
  "zod": "^4.4.3"
42
42
  },
@@ -232,8 +232,38 @@ describe("resolveNavigation", () => {
232
232
  expect(hero?.actions).toHaveLength(1);
233
233
  });
234
234
 
235
- // Knoten ohne die neuen Felder dürfen sie NICHT als undefined-Keys tragen
236
- // (conditional-spread): hält die resolved Node sauber + Snapshot-stabil.
235
+ // fw#2750: a TreeAction can also carry `screen` (route link) instead of
236
+ // `target` (dispatch) — same polymorphism as the node itself.
237
+ test("action `screen` (route-link variant) passes through alongside target-based actions", () => {
238
+ const editTarget = { featureId: "text-content", action: "edit", args: { slug: "hero" } };
239
+ const source = buildSource([
240
+ {
241
+ id: "tc:nav:content",
242
+ label: "Content",
243
+ provider: true,
244
+ createAction: { icon: "plus", label: "New page", screen: "tc:screen:new-page" },
245
+ },
246
+ {
247
+ id: "tc:nav:hero",
248
+ label: "Hero",
249
+ parent: "tc:nav:content",
250
+ target: editTarget,
251
+ actions: [{ icon: "edit", label: "Edit in editor", screen: "tc:screen:hero" }],
252
+ },
253
+ ]);
254
+
255
+ const tree = resolveNavigation({ source });
256
+ const content = tree[0];
257
+ expect(content?.createAction?.screen).toBe("tc:screen:new-page");
258
+ expect(content?.createAction?.target).toBeUndefined();
259
+ const hero = content?.children[0];
260
+ expect(hero?.actions?.[0]?.screen).toBe("tc:screen:hero");
261
+ expect(hero?.actions?.[0]?.target).toBeUndefined();
262
+ });
263
+
264
+ // A node without the polymorphic fields must NOT carry them as
265
+ // undefined-valued keys (conditional-spread): keeps the resolved node
266
+ // clean and snapshot-stable.
237
267
  test("absent polymorphic fields are omitted, not set to undefined", () => {
238
268
  const source = buildSource([{ id: "a:nav:plain", label: "Plain", screen: "a:screen:x" }]);
239
269
  const node = resolveNavigation({ source })[0];
@@ -147,6 +147,7 @@ export function computeEditViewModel<
147
147
  ...(sectionSpec.parentParam !== undefined && { parentParam: sectionSpec.parentParam }),
148
148
  columns: sectionSpec.columns,
149
149
  ...(sectionSpec.pageSize !== undefined && { pageSize: sectionSpec.pageSize }),
150
+ ...(sectionSpec.defaultSort !== undefined && { defaultSort: sectionSpec.defaultSort }),
150
151
  ...(sectionSpec.rowClick !== undefined && { rowClick: sectionSpec.rowClick }),
151
152
  ...(sectionSpec.rowActions !== undefined && { rowActions: sectionSpec.rowActions }),
152
153
  };
@@ -5,6 +5,7 @@ import type {
5
5
  FieldRenderer,
6
6
  IconKey,
7
7
  ListColumnSpec,
8
+ ListSortSpec,
8
9
  PlatformComponent,
9
10
  RowAction,
10
11
  ScreenSlots,
@@ -290,6 +291,7 @@ export type EditRelatedListSectionViewModel = {
290
291
  readonly parentParam?: string;
291
292
  readonly columns: readonly ListColumnSpec[];
292
293
  readonly pageSize?: number;
294
+ readonly defaultSort?: ListSortSpec;
293
295
  readonly rowClick?: { readonly entity: string; readonly idColumn?: string };
294
296
  readonly rowActions?: readonly RowAction[];
295
297
  };