@almadar/ui 6.27.0 → 6.29.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.
@@ -2936,6 +2936,13 @@ var init_slot_types = __esm({
2936
2936
  nextRefId = 1;
2937
2937
  }
2938
2938
  });
2939
+ var SlotContainedContext;
2940
+ var init_slotContained = __esm({
2941
+ "lib/slotContained.ts"() {
2942
+ "use client";
2943
+ SlotContainedContext = React87.createContext(false);
2944
+ }
2945
+ });
2939
2946
  function buildForkPaths(x, y, branches, scale) {
2940
2947
  const inLength = 30 * scale;
2941
2948
  const outLength = 30 * scale;
@@ -35697,7 +35704,6 @@ function TableView({
35697
35704
  columns,
35698
35705
  fields,
35699
35706
  itemActions,
35700
- maxInlineActions,
35701
35707
  itemClickEvent = "",
35702
35708
  selectable = false,
35703
35709
  selectEvent,
@@ -35731,8 +35737,7 @@ function TableView({
35731
35737
  const [localSelected, setLocalSelected] = React87__namespace.default.useState(/* @__PURE__ */ new Set());
35732
35738
  const colDefs = (Array.isArray(columns) ? columns : void 0) ?? (Array.isArray(fields) ? fields : void 0) ?? [];
35733
35739
  const actionDefs = Array.isArray(itemActions) ? itemActions : [];
35734
- const inlineActions = maxInlineActions != null ? actionDefs.slice(0, maxInlineActions) : [];
35735
- const overflowActions = maxInlineActions != null ? actionDefs.slice(maxInlineActions) : actionDefs;
35740
+ const overflowActions = actionDefs;
35736
35741
  const fireAction = (action, row) => eventBus.emit(`UI:${action.event}`, {
35737
35742
  id: row.id,
35738
35743
  row
@@ -35914,7 +35919,7 @@ function TableView({
35914
35919
  }
35915
35920
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-foreground", children: formatCell(raw, col.format, relationsData?.[col.field ?? col.key]) }) }, col.key);
35916
35921
  }),
35917
- hasActions && /* @__PURE__ */ jsxRuntime.jsxs(
35922
+ hasActions && /* @__PURE__ */ jsxRuntime.jsx(
35918
35923
  HStack,
35919
35924
  {
35920
35925
  gap: "xs",
@@ -35928,38 +35933,20 @@ function TableView({
35928
35933
  "border-l border-[var(--color-border)]",
35929
35934
  lk.striped && index % 2 === 1 ? "bg-[var(--color-surface-subtle)]" : "bg-[var(--color-card)] group-hover:bg-[var(--color-surface-subtle)]"
35930
35935
  ),
35931
- children: [
35932
- inlineActions.map((action) => /* @__PURE__ */ jsxRuntime.jsxs(
35933
- Button,
35934
- {
35935
- variant: action.variant ?? "ghost",
35936
- size: "sm",
35937
- onClick: () => fireAction(action, row),
35938
- "data-testid": `action-${action.event}`,
35939
- "data-row-id": String(row.id),
35940
- className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
35941
- children: [
35942
- action.icon && renderIconInput3(action.icon, { size: "xs", className: "mr-1" }),
35943
- action.label
35944
- ]
35945
- },
35946
- action.event
35947
- )),
35948
- overflowActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
35949
- Menu,
35950
- {
35951
- position: "bottom-end",
35952
- trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", "data-row-id": String(row.id), children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
35953
- items: overflowActions.map((action) => ({
35954
- label: action.label,
35955
- icon: action.icon,
35956
- event: action.event,
35957
- variant: action.variant === "danger" ? "danger" : "default",
35958
- onClick: () => fireAction(action, row)
35959
- }))
35960
- }
35961
- )
35962
- ]
35936
+ children: overflowActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
35937
+ Menu,
35938
+ {
35939
+ position: "bottom-end",
35940
+ trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", "data-row-id": String(row.id), children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
35941
+ items: overflowActions.map((action) => ({
35942
+ label: action.label,
35943
+ icon: action.icon,
35944
+ event: action.event,
35945
+ variant: action.variant === "danger" ? "danger" : "default",
35946
+ onClick: () => fireAction(action, row)
35947
+ }))
35948
+ }
35949
+ )
35963
35950
  }
35964
35951
  )
35965
35952
  ]
@@ -45247,6 +45234,7 @@ var init_DetailPanel = __esm({
45247
45234
  init_EmptyState();
45248
45235
  init_cn();
45249
45236
  init_portalRoot();
45237
+ init_slotContained();
45250
45238
  init_format();
45251
45239
  init_getNestedValue();
45252
45240
  init_relationLabel();
@@ -45278,6 +45266,7 @@ var init_DetailPanel = __esm({
45278
45266
  }) => {
45279
45267
  const eventBus = useEventBus();
45280
45268
  const { t } = hooks.useTranslate();
45269
+ const contained = React87.useContext(SlotContainedContext);
45281
45270
  const [titleDraft, setTitleDraft] = React87__namespace.default.useState(null);
45282
45271
  const isFieldDefArray = (arr) => {
45283
45272
  if (!arr || arr.length === 0) return false;
@@ -45665,8 +45654,9 @@ var init_DetailPanel = __esm({
45665
45654
  if (!slideOver) {
45666
45655
  return /* @__PURE__ */ jsxRuntime.jsx(Box, { className, children: content });
45667
45656
  }
45668
- const panel = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("fixed inset-y-0 right-0 w-full max-w-2xl bg-card shadow-lg z-50 overflow-y-auto p-6", className), children: content });
45669
- return typeof document === "undefined" ? panel : reactDom.createPortal(panel, getOrCreatePortalRoot());
45657
+ const panel = /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn(contained ? "absolute" : "fixed", "inset-y-0 right-0 w-full max-w-2xl bg-card shadow-lg z-50 overflow-y-auto p-6", className), children: content });
45658
+ if (contained || typeof document === "undefined") return panel;
45659
+ return reactDom.createPortal(panel, getOrCreatePortalRoot());
45670
45660
  };
45671
45661
  DetailPanel.displayName = "DetailPanel";
45672
45662
  }
@@ -52163,6 +52153,7 @@ var init_component_registry_generated = __esm({
52163
52153
  // components/core/organisms/UISlotRenderer.tsx
52164
52154
  var UISlotRenderer_exports = {};
52165
52155
  __export(UISlotRenderer_exports, {
52156
+ SlotContainedContext: () => SlotContainedContext,
52166
52157
  SlotContentRenderer: () => SlotContentRenderer,
52167
52158
  SuspenseConfigProvider: () => SuspenseConfigProvider,
52168
52159
  UISlotComponent: () => UISlotComponent,
@@ -52335,6 +52326,25 @@ function renderContainedPortal(t, slot, content, onDismiss) {
52335
52326
  }
52336
52327
  );
52337
52328
  case "drawer":
52329
+ if (content.pattern === "detail-panel" && content.props.slideOver === true) {
52330
+ return /* @__PURE__ */ jsxRuntime.jsx(
52331
+ Box,
52332
+ {
52333
+ id: slotId,
52334
+ className: "absolute inset-0 z-50 overflow-hidden",
52335
+ style: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
52336
+ onClick: onDismiss,
52337
+ children: /* @__PURE__ */ jsxRuntime.jsx(
52338
+ Box,
52339
+ {
52340
+ className: "absolute inset-y-0 right-0 pointer-events-auto",
52341
+ onClick: (e) => e.stopPropagation(),
52342
+ children: slotContent
52343
+ }
52344
+ )
52345
+ }
52346
+ );
52347
+ }
52338
52348
  return /* @__PURE__ */ jsxRuntime.jsx(
52339
52349
  Box,
52340
52350
  {
@@ -53186,7 +53196,7 @@ function UISlotRenderer({
53186
53196
  }
53187
53197
  return wrapped;
53188
53198
  }
53189
- var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext, SlotContainedContext, SLOT_SKELETON_MAP, CONTENT_NODE_SLOTS, PATTERNS_WITH_CHILDREN, traitRefPresenceCache;
53199
+ var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext, SLOT_SKELETON_MAP, CONTENT_NODE_SLOTS, PATTERNS_WITH_CHILDREN, traitRefPresenceCache;
53190
53200
  var init_UISlotRenderer = __esm({
53191
53201
  "components/core/organisms/UISlotRenderer.tsx"() {
53192
53202
  "use client";
@@ -53201,6 +53211,7 @@ var init_UISlotRenderer = __esm({
53201
53211
  init_cn();
53202
53212
  init_format();
53203
53213
  init_portalRoot();
53214
+ init_slotContained();
53204
53215
  init_ErrorBoundary();
53205
53216
  init_Skeleton();
53206
53217
  init_renderer();
@@ -53210,7 +53221,6 @@ var init_UISlotRenderer = __esm({
53210
53221
  scopeWrapLog = logger.createLogger("almadar:ui:scope-wrap");
53211
53222
  TRAIT_BINDING_RE = /^@trait\.([A-Z][A-Za-z0-9]*)$/;
53212
53223
  SuspenseConfigContext = React87.createContext({ enabled: false });
53213
- SlotContainedContext = React87.createContext(false);
53214
53224
  SuspenseConfigProvider.displayName = "SuspenseConfigProvider";
53215
53225
  SLOT_SKELETON_MAP = {
53216
53226
  main: "table",
@@ -54678,6 +54688,9 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
54678
54688
  const normalizedEvent = normalizeEventKey(eventKey);
54679
54689
  return managerRef.current.canHandleEvent(traitName, normalizedEvent);
54680
54690
  }, []);
54691
+ const commitServerEntity = React87.useCallback((traitName, entity) => {
54692
+ traitFieldStatesRef.current.set(traitName, entity);
54693
+ }, []);
54681
54694
  React87.useEffect(() => {
54682
54695
  const allEvents = /* @__PURE__ */ new Set();
54683
54696
  for (const binding of traitBindings) {
@@ -54841,7 +54854,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
54841
54854
  sendEvent,
54842
54855
  getTraitState,
54843
54856
  canHandleEvent,
54844
- entityBindingSource
54857
+ entityBindingSource,
54858
+ commitServerEntity
54845
54859
  };
54846
54860
  }
54847
54861
  var resolvedSchemaLog = logger.createLogger("almadar:ui:resolved-schema");
@@ -55062,7 +55076,7 @@ function NavStackRefBridge({ apiRef }) {
55062
55076
  }, [api, apiRef]);
55063
55077
  return null;
55064
55078
  }
55065
- function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, children }) {
55079
+ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, serverActiveTraits, user, children }) {
55066
55080
  const bridge = providers.useServerBridge();
55067
55081
  const activeTraitNames = React87.useMemo(
55068
55082
  () => new Set(traits2.map((b) => b.trait.name).filter((n) => !!n)),
@@ -55080,6 +55094,8 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
55080
55094
  [serverActiveTraits]
55081
55095
  );
55082
55096
  const uiSlots = context.useUISlots();
55097
+ const commitServerEntityRef = React87.useRef(() => {
55098
+ });
55083
55099
  const onEventProcessed = React87.useCallback((event, payload, dispatchedOrbitals, tick, sourceTrait, locallyEmitted, results, entityByTrait) => {
55084
55100
  if (!bridge.connected || !orbitalNames?.length) return;
55085
55101
  const targets = dispatchedOrbitals && dispatchedOrbitals.size > 0 ? orbitalNames.filter((n) => dispatchedOrbitals.has(n)) : orbitalNames;
@@ -55094,14 +55110,20 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
55094
55110
  void bridge.sendEvent(name, event, withActiveTraits(payload), tick, sourceTrait);
55095
55111
  continue;
55096
55112
  }
55097
- void bridge.sendEvent(name, event, withActiveTraits(payload), void 0, void 0, locallyEmitted, results, entityByTrait).then(({ effects, meta }) => {
55113
+ void bridge.sendEvent(name, event, withActiveTraits(payload), void 0, void 0, locallyEmitted, results, entityByTrait, user ?? void 0).then(({ effects, meta }) => {
55098
55114
  recordServerResponse(name, event, { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
55115
+ if (meta.entityByTrait) {
55116
+ for (const [traitName, entity] of Object.entries(meta.entityByTrait)) {
55117
+ commitServerEntityRef.current(traitName, entity);
55118
+ }
55119
+ }
55099
55120
  applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraitNamesRef.current, onNavigateBack);
55100
55121
  });
55101
55122
  }
55102
- }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits]);
55123
+ }, [bridge.connected, bridge.sendEvent, orbitalNames, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits, user]);
55103
55124
  const opts = orbitalNames ? { onEventProcessed, navigate: onNavigate, navigateBack: onNavigateBack, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, initPayload: routeParams } : { navigate: onNavigate, navigateBack: onNavigateBack, persistence, traitConfigsByName, orbitalsByTrait, embeddedTraits, callsiteCaptureChildrenByTrait, initPayload: routeParams };
55104
- const { sendEvent, entityBindingSource } = useTraitStateMachine(traits2, uiSlots, opts);
55125
+ const { sendEvent, entityBindingSource, commitServerEntity } = useTraitStateMachine(traits2, uiSlots, opts);
55126
+ commitServerEntityRef.current = commitServerEntity;
55105
55127
  const initSentRef = React87.useRef(false);
55106
55128
  const prevTraitsRef = React87.useRef(void 0);
55107
55129
  const paramsKey = JSON.stringify(routeParams ?? {});
@@ -55141,8 +55163,23 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
55141
55163
  initSentRef.current = true;
55142
55164
  (async () => {
55143
55165
  for (const name of orbitalNames) {
55144
- const { effects, meta } = await bridge.sendEvent(name, "INIT", withActiveTraits({ ...routeParams ?? {} }));
55166
+ const { effects, meta } = await bridge.sendEvent(
55167
+ name,
55168
+ "INIT",
55169
+ withActiveTraits({ ...routeParams ?? {} }),
55170
+ void 0,
55171
+ void 0,
55172
+ void 0,
55173
+ void 0,
55174
+ void 0,
55175
+ user ?? void 0
55176
+ );
55145
55177
  recordServerResponse(name, "INIT", { ...meta, effectResults: effectResultsToTraces(meta.effectResults) });
55178
+ if (meta.entityByTrait) {
55179
+ for (const [traitName, entity] of Object.entries(meta.entityByTrait)) {
55180
+ commitServerEntityRef.current(traitName, entity);
55181
+ }
55182
+ }
55146
55183
  const effectTraces = [
55147
55184
  { type: "fetch", args: [], status: "executed" },
55148
55185
  ...effects.map((eff) => ({
@@ -55162,7 +55199,7 @@ function TraitInitializer({ traits: traits2, routeParams, orbitalNames, onNaviga
55162
55199
  applyServerEffects(effects, uiSlots, onNavigate, embeddedTraits, activeTraitNamesRef.current, onNavigateBack);
55163
55200
  }
55164
55201
  })();
55165
- }, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits, routeParams]);
55202
+ }, [bridge.connected, orbitalNames, bridge.sendEvent, uiSlots, onNavigate, onNavigateBack, embeddedTraits, activeTraitNames, withActiveTraits, routeParams, user]);
55166
55203
  return /* @__PURE__ */ jsxRuntime.jsx(providers.EntityBindingContext.Provider, { value: entityBindingSource, children });
55167
55204
  }
55168
55205
  function FitToBox({ children }) {
@@ -55189,7 +55226,7 @@ function FitToBox({ children }) {
55189
55226
  }, []);
55190
55227
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: outerRef, className: "relative h-full w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: innerRef, style: { transform: `scale(${scale})`, transformOrigin: "top left", width: "fit-content" }, children }) });
55191
55228
  }
55192
- function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routeParams, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence }) {
55229
+ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData, pageName, routeParams, onNavigate, onNavigateBack, onLocalFallback, localFallbackTimeoutMs, persistence, user }) {
55193
55230
  const { traits: traits2, allEntities, allTraits, ir } = useResolvedSchema(schema, pageName);
55194
55231
  const allPageTraits = React87.useMemo(() => {
55195
55232
  let base;
@@ -55354,6 +55391,7 @@ function SchemaRunner({ schema, serverUrl, transport, getAccessToken, mockData,
55354
55391
  onLocalFallback,
55355
55392
  localFallbackTimeoutMs,
55356
55393
  persistence,
55394
+ user,
55357
55395
  children: /* @__PURE__ */ jsxRuntime.jsx(providers.OrbitalThemeProvider, { theme: activeOrbitalTheme, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "h-full min-h-full overflow-auto p-4", children: /* @__PURE__ */ jsxRuntime.jsx(UISlotRenderer, { includeHud: true, hudMode: "inline", includeFloating: true }) }) })
55358
55396
  }
55359
55397
  )
@@ -55560,7 +55598,8 @@ function OrbPreview({
55560
55598
  onNavigateBack: handleNavigateBack,
55561
55599
  onLocalFallback: handleLocalFallback,
55562
55600
  localFallbackTimeoutMs,
55563
- persistence
55601
+ persistence,
55602
+ user
55564
55603
  }
55565
55604
  ) }) : /* @__PURE__ */ jsxRuntime.jsx(
55566
55605
  SchemaRunner,
@@ -55576,7 +55615,8 @@ function OrbPreview({
55576
55615
  onNavigateBack: handleNavigateBack,
55577
55616
  onLocalFallback: handleLocalFallback,
55578
55617
  localFallbackTimeoutMs,
55579
- persistence
55618
+ persistence,
55619
+ user
55580
55620
  }
55581
55621
  ) }) })
55582
55622
  ]
@@ -5,8 +5,8 @@ import * as _almadar_runtime from '@almadar/runtime';
5
5
  import { TraitState, TransitionResult, EffectHandlers } from '@almadar/runtime';
6
6
  import { K as KeyCaptureTable } from '../useKeyboardRouter-CVn8lfiX.cjs';
7
7
  import { c as useUISlots } from '../UISlotContext-BlRDbHDy.cjs';
8
- import { a as EntityBindingSource, h as ServerBridgeTransport, A as AccessTokenProvider } from '../EntityBindingContext-CTZw2DbY.cjs';
9
- export { b as EntitySchemaContextValue, c as EntitySchemaProvider, d as EntitySchemaProviderProps, e as ServerBridgeContextValue, f as ServerBridgeProvider, i as ServerClientEffect, T as TraitContext, k as TraitContextValue, l as TraitInstance, m as TraitProvider, n as TraitProviderProps, o as useEntitySchema, p as useEntitySchemaOptional, q as useServerBridge, r as useTrait, s as useTraitContext } from '../EntityBindingContext-CTZw2DbY.cjs';
8
+ import { a as EntityBindingSource, h as ServerBridgeTransport, A as AccessTokenProvider } from '../EntityBindingContext-UyeCfEBS.cjs';
9
+ export { b as EntitySchemaContextValue, c as EntitySchemaProvider, d as EntitySchemaProviderProps, e as ServerBridgeContextValue, f as ServerBridgeProvider, i as ServerClientEffect, T as TraitContext, k as TraitContextValue, l as TraitInstance, m as TraitProvider, n as TraitProviderProps, o as useEntitySchema, p as useEntitySchemaOptional, q as useServerBridge, r as useTrait, s as useTraitContext } from '../EntityBindingContext-UyeCfEBS.cjs';
10
10
  import '../verificationRegistry-DTrKDRoa.cjs';
11
11
  export { PERF_NAMESPACE, PerfEntry, PreparedPreviewSchema, adjustSchemaForMockData, buildMockData, clearPerf, perfEnd, perfStart, perfTime, prepareSchemaForPreview, wrapCallbackForEvent } from '@almadar/runtime/ui';
12
12
  import React__default, { ReactNode } from 'react';
@@ -30,6 +30,20 @@ interface TraitStateMachineResult {
30
30
  /** Live per-trait binding surface for `EntityBindingContext` — the
31
31
  * renderer resolves `RenderBindingMarker` prop leaves against it. */
32
32
  entityBindingSource: EntityBindingSource;
33
+ /**
34
+ * Commit a trait's authoritative entity row, as returned by a stateless
35
+ * server response's `entityByTrait[traitName]` (Fix C, the entity
36
+ * round-trip). The stateless deployment has no server-held memory
37
+ * across requests, so a `set`-only field a trait wrote on a PRIOR
38
+ * request would otherwise vanish on the next one (`traitFieldStatesRef`
39
+ * only ever reflects THIS client's own local writes) — replacing it
40
+ * here with the server's own post-effects row keeps the two in sync,
41
+ * the same way a fresh `getById` already does within a single request.
42
+ * A full replace, not a merge: the server sends the whole row after its
43
+ * own effects ran, the same authoritative shape a `fetch`/`getById`
44
+ * would return.
45
+ */
46
+ commitServerEntity: (traitName: string, entity: EntityRow) => void;
33
47
  }
34
48
  interface UseTraitStateMachineOptions {
35
49
  /**
@@ -5,8 +5,8 @@ import * as _almadar_runtime from '@almadar/runtime';
5
5
  import { TraitState, TransitionResult, EffectHandlers } from '@almadar/runtime';
6
6
  import { K as KeyCaptureTable } from '../useKeyboardRouter-B1pIi9jo.js';
7
7
  import { c as useUISlots } from '../UISlotContext-CB89mv7N.js';
8
- import { a as EntityBindingSource, h as ServerBridgeTransport, A as AccessTokenProvider } from '../EntityBindingContext-CTZw2DbY.js';
9
- export { b as EntitySchemaContextValue, c as EntitySchemaProvider, d as EntitySchemaProviderProps, e as ServerBridgeContextValue, f as ServerBridgeProvider, i as ServerClientEffect, T as TraitContext, k as TraitContextValue, l as TraitInstance, m as TraitProvider, n as TraitProviderProps, o as useEntitySchema, p as useEntitySchemaOptional, q as useServerBridge, r as useTrait, s as useTraitContext } from '../EntityBindingContext-CTZw2DbY.js';
8
+ import { a as EntityBindingSource, h as ServerBridgeTransport, A as AccessTokenProvider } from '../EntityBindingContext-UyeCfEBS.js';
9
+ export { b as EntitySchemaContextValue, c as EntitySchemaProvider, d as EntitySchemaProviderProps, e as ServerBridgeContextValue, f as ServerBridgeProvider, i as ServerClientEffect, T as TraitContext, k as TraitContextValue, l as TraitInstance, m as TraitProvider, n as TraitProviderProps, o as useEntitySchema, p as useEntitySchemaOptional, q as useServerBridge, r as useTrait, s as useTraitContext } from '../EntityBindingContext-UyeCfEBS.js';
10
10
  import '../verificationRegistry-Cwa52VyK.js';
11
11
  export { PERF_NAMESPACE, PerfEntry, PreparedPreviewSchema, adjustSchemaForMockData, buildMockData, clearPerf, perfEnd, perfStart, perfTime, prepareSchemaForPreview, wrapCallbackForEvent } from '@almadar/runtime/ui';
12
12
  import React__default, { ReactNode } from 'react';
@@ -30,6 +30,20 @@ interface TraitStateMachineResult {
30
30
  /** Live per-trait binding surface for `EntityBindingContext` — the
31
31
  * renderer resolves `RenderBindingMarker` prop leaves against it. */
32
32
  entityBindingSource: EntityBindingSource;
33
+ /**
34
+ * Commit a trait's authoritative entity row, as returned by a stateless
35
+ * server response's `entityByTrait[traitName]` (Fix C, the entity
36
+ * round-trip). The stateless deployment has no server-held memory
37
+ * across requests, so a `set`-only field a trait wrote on a PRIOR
38
+ * request would otherwise vanish on the next one (`traitFieldStatesRef`
39
+ * only ever reflects THIS client's own local writes) — replacing it
40
+ * here with the server's own post-effects row keeps the two in sync,
41
+ * the same way a fresh `getById` already does within a single request.
42
+ * A full replace, not a merge: the server sends the whole row after its
43
+ * own effects ran, the same authoritative shape a `fetch`/`getById`
44
+ * would return.
45
+ */
46
+ commitServerEntity: (traitName: string, entity: EntityRow) => void;
33
47
  }
34
48
  interface UseTraitStateMachineOptions {
35
49
  /**