@cosmicdrift/kumiko-headless 0.38.0 → 0.40.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.38.0",
3
+ "version": "0.40.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>",
@@ -28,7 +28,7 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@cosmicdrift/kumiko-framework": "0.37.0",
31
+ "@cosmicdrift/kumiko-framework": "0.38.0",
32
32
  "zod": "^4.4.3"
33
33
  },
34
34
  "publishConfig": {
@@ -12,6 +12,8 @@ export function escapeHtmlAttr(s: string): string {
12
12
  return escapeHtml(s).replace(/'/g, "&#39;");
13
13
  }
14
14
 
15
+ // Shared API for app repos (publicstatus badge-SVG renders XML by hand) —
16
+ // no in-repo consumer yet, deliberately exported for cross-repo dedup.
15
17
  export function escapeXml(s: string): string {
16
18
  return s
17
19
  .replace(/&/g, "&amp;")
@@ -4,6 +4,7 @@ import type {
4
4
  FieldCondition,
5
5
  } from "@cosmicdrift/kumiko-framework/ui-types";
6
6
  import {
7
+ evalFieldCondition,
7
8
  isExtensionEditSection,
8
9
  normalizeEditField,
9
10
  parseRefTarget,
@@ -77,6 +78,13 @@ export function computeEditViewModel<
77
78
  fieldDef.type === "text"
78
79
  ? (fieldDef as unknown as { multiline?: boolean | { rows?: number } }).multiline
79
80
  : undefined;
81
+ // Wall-Clock-Hint bei `type: "timestamp"` mit locatedBy — der
82
+ // Renderer emittiert dann lokale Zeit ohne `Z` statt UTC-Instant.
83
+ const wallClock =
84
+ fieldDef.type === "timestamp" &&
85
+ (fieldDef as unknown as { locatedBy?: string }).locatedBy !== undefined
86
+ ? true
87
+ : undefined;
80
88
  // Tier 2.7e-3: Reference-Field — refEntity + refLabelField in
81
89
  // das ViewModel reichen damit der Renderer die Lookup-Query
82
90
  // bauen kann ohne noch an EntityDefinition zu greifen.
@@ -112,6 +120,7 @@ export function computeEditViewModel<
112
120
  ...(options !== undefined && { options }),
113
121
  ...(optionLabels !== undefined && { optionLabels }),
114
122
  ...(multiline !== undefined && { multiline }),
123
+ ...(wallClock !== undefined && { wallClock }),
115
124
  ...(refEntity !== undefined && { refEntity }),
116
125
  ...(refFeature !== undefined && { refFeature }),
117
126
  ...(refLabelField !== undefined && { refLabelField }),
@@ -146,8 +155,6 @@ function evalCondition<TValues>(
146
155
  values: TValues,
147
156
  ): boolean {
148
157
  if (condition === undefined) return fallback;
149
- if (typeof condition === "boolean") return condition;
150
- const val = (values as Record<string, unknown>)[condition.field];
151
- if ("eq" in condition) return val === condition.eq;
152
- return val !== condition.ne;
158
+ // @cast-boundary view-model: TValues ist strukturell ein Record.
159
+ return evalFieldCondition(condition, values as Record<string, unknown>);
153
160
  }
@@ -107,6 +107,10 @@ export type EditFieldViewModel = {
107
107
  * ist — dann rendert der Renderer textarea statt single-line input.
108
108
  * `true` = Default-Zeilen, `{ rows }` = explizite Höhe. */
109
109
  readonly multiline?: boolean | { readonly rows?: number };
110
+ /** Nur bei `type: "timestamp"` gesetzt wenn TimestampFieldDef.locatedBy
111
+ * existiert — Wall-Clock-Zeit ohne Offset. Der Renderer emittiert
112
+ * dann lokale Zeit ohne `Z` statt eines UTC-Instants. */
113
+ readonly wallClock?: boolean;
110
114
  /** Nur bei `type: "reference"` gesetzt — Tier 2.7e-3.
111
115
  * Die referenced Entity (kurz, ohne feature-prefix). Der Renderer
112
116
  * baut die Query-QN als `<refFeature>:query:<refEntity>:list`. */