@almadar/ui 5.156.0 → 5.158.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.
@@ -286,11 +286,32 @@ function isPlainObject(value) {
286
286
  if (typeof value === "function") return false;
287
287
  return true;
288
288
  }
289
+ function subtreeHasMarker(value) {
290
+ const cached = markerPresenceCache.get(value);
291
+ if (cached !== void 0) return cached;
292
+ let found = false;
293
+ const children = Array.isArray(value) ? value : Object.values(value);
294
+ for (const child of children) {
295
+ if (isRenderBindingMarker(child)) {
296
+ found = true;
297
+ break;
298
+ }
299
+ if (Array.isArray(child) || isPlainObject(child)) {
300
+ if (subtreeHasMarker(child)) {
301
+ found = true;
302
+ break;
303
+ }
304
+ }
305
+ }
306
+ markerPresenceCache.set(value, found);
307
+ return found;
308
+ }
289
309
  function walkValue(value, scopeTrait, entity, config, state) {
290
310
  if (isRenderBindingMarker(value)) {
291
311
  return { resolved: resolveMarkerExpression(value.expression, entity, config, state), changed: true };
292
312
  }
293
313
  if (Array.isArray(value)) {
314
+ if (!subtreeHasMarker(value)) return { resolved: value, changed: false };
294
315
  const out = [];
295
316
  let changed = false;
296
317
  for (const item of value) {
@@ -308,6 +329,7 @@ function walkValue(value, scopeTrait, entity, config, state) {
308
329
  return changed ? { resolved: out, changed: true } : { resolved: value, changed: false };
309
330
  }
310
331
  if (isPlainObject(value)) {
332
+ if (!subtreeHasMarker(value)) return { resolved: value, changed: false };
311
333
  const sourceTrait = value._sourceTrait;
312
334
  if (typeof sourceTrait === "string" && sourceTrait !== scopeTrait) {
313
335
  return { resolved: value, changed: false };
@@ -333,9 +355,11 @@ function resolveRenderBindingMarkers(props, scopeTrait, entity, config, state) {
333
355
  }
334
356
  return changed ? out : props;
335
357
  }
358
+ var markerPresenceCache;
336
359
  var init_resolve_render_bindings = __esm({
337
360
  "lib/resolve-render-bindings.ts"() {
338
361
  "use client";
362
+ markerPresenceCache = /* @__PURE__ */ new WeakMap();
339
363
  }
340
364
  });
341
365
  function cn(...inputs) {
@@ -11962,6 +11986,8 @@ function drawShape(ctx, shape, width, height, allShapes) {
11962
11986
  case "path": {
11963
11987
  if (!shape.path) break;
11964
11988
  const p = new Path2D(shape.path);
11989
+ ctx.lineJoin = "round";
11990
+ ctx.lineCap = "round";
11965
11991
  if (fill) {
11966
11992
  ctx.fillStyle = fill;
11967
11993
  ctx.fill(p);
@@ -12170,7 +12196,7 @@ var init_LearningCanvas = __esm({
12170
12196
  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
12171
12197
  ctx.clearRect(0, 0, width, height);
12172
12198
  if (backgroundColor) {
12173
- ctx.fillStyle = backgroundColor;
12199
+ ctx.fillStyle = resolveColor2(backgroundColor, ctx, backgroundColor);
12174
12200
  ctx.fillRect(0, 0, width, height);
12175
12201
  }
12176
12202
  for (const shape of derivedShapes) {
@@ -27366,7 +27392,7 @@ function fileIcon(name) {
27366
27392
  return "file";
27367
27393
  }
27368
27394
  }
27369
- var TreeNodeItem, FileTree;
27395
+ var TreeNodeItem, FlatTreeNodeItem, FileTree;
27370
27396
  var init_FileTree = __esm({
27371
27397
  "components/core/molecules/FileTree.tsx"() {
27372
27398
  "use client";
@@ -27451,14 +27477,101 @@ var init_FileTree = __esm({
27451
27477
  )) })
27452
27478
  ] });
27453
27479
  };
27480
+ FlatTreeNodeItem = ({
27481
+ item,
27482
+ depth,
27483
+ indent,
27484
+ childrenByParent,
27485
+ onNodeSelect,
27486
+ defaultExpanded = false
27487
+ }) => {
27488
+ const [expanded, setExpanded] = useState(defaultExpanded || depth < 1);
27489
+ const children = childrenByParent.get(item.id);
27490
+ const hasChildren = !!children && children.length > 0;
27491
+ const handleClick = useCallback(() => {
27492
+ if (hasChildren) setExpanded((prev) => !prev);
27493
+ onNodeSelect?.(item.id);
27494
+ }, [hasChildren, item.id, onNodeSelect]);
27495
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
27496
+ /* @__PURE__ */ jsxs(
27497
+ Box,
27498
+ {
27499
+ className: "flex items-center gap-1.5 py-0.5 px-2 cursor-pointer rounded-sm transition-colors hover:bg-muted",
27500
+ style: { paddingLeft: depth * indent + 8 },
27501
+ onClick: handleClick,
27502
+ role: "treeitem",
27503
+ "aria-expanded": hasChildren ? expanded : void 0,
27504
+ children: [
27505
+ hasChildren ? /* @__PURE__ */ jsx(
27506
+ Icon,
27507
+ {
27508
+ name: expanded ? "chevron-down" : "chevron-right",
27509
+ size: "xs",
27510
+ className: "text-[var(--color-muted-foreground)] flex-shrink-0"
27511
+ }
27512
+ ) : /* @__PURE__ */ jsx(Box, { style: { width: 12, flexShrink: 0 } }),
27513
+ /* @__PURE__ */ jsx(
27514
+ Icon,
27515
+ {
27516
+ name: item.icon ?? (hasChildren ? expanded ? "folder-open" : "folder" : "file"),
27517
+ size: "xs",
27518
+ className: hasChildren ? "text-[var(--color-warning)]" : "text-[var(--color-muted-foreground)]"
27519
+ }
27520
+ ),
27521
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "truncate font-mono text-xs", children: item.label })
27522
+ ]
27523
+ }
27524
+ ),
27525
+ hasChildren && expanded && /* @__PURE__ */ jsx(Box, { role: "group", children: children.map((child) => /* @__PURE__ */ jsx(
27526
+ FlatTreeNodeItem,
27527
+ {
27528
+ item: child,
27529
+ depth: depth + 1,
27530
+ indent,
27531
+ childrenByParent,
27532
+ onNodeSelect
27533
+ },
27534
+ child.id
27535
+ )) })
27536
+ ] });
27537
+ };
27454
27538
  FileTree = ({
27455
27539
  tree,
27540
+ items,
27456
27541
  selectedPath,
27457
27542
  onFileSelect,
27543
+ onNodeSelect,
27458
27544
  className,
27459
27545
  indent = 16
27460
27546
  }) => {
27461
- if (tree.length === 0) return null;
27547
+ if (items) {
27548
+ if (items.length === 0) return null;
27549
+ const ids = new Set(items.map((node) => node.id));
27550
+ const childrenByParent = /* @__PURE__ */ new Map();
27551
+ const roots = [];
27552
+ for (const item of items) {
27553
+ if (item.parentId && ids.has(item.parentId)) {
27554
+ const siblings = childrenByParent.get(item.parentId);
27555
+ if (siblings) siblings.push(item);
27556
+ else childrenByParent.set(item.parentId, [item]);
27557
+ } else {
27558
+ roots.push(item);
27559
+ }
27560
+ }
27561
+ return /* @__PURE__ */ jsx(Box, { className: `py-1 overflow-y-auto ${className ?? ""}`, role: "tree", children: roots.map((item) => /* @__PURE__ */ jsx(
27562
+ FlatTreeNodeItem,
27563
+ {
27564
+ item,
27565
+ depth: 0,
27566
+ indent,
27567
+ childrenByParent,
27568
+ onNodeSelect,
27569
+ defaultExpanded: true
27570
+ },
27571
+ item.id
27572
+ )) });
27573
+ }
27574
+ if (!tree || tree.length === 0) return null;
27462
27575
  return /* @__PURE__ */ jsx(Box, { className: `py-1 overflow-y-auto ${className ?? ""}`, role: "tree", children: tree.map((node) => /* @__PURE__ */ jsx(
27463
27576
  TreeNodeItem,
27464
27577
  {
@@ -28853,7 +28966,7 @@ var init_debug = __esm({
28853
28966
  createLogger("almadar:ui:debug:game-state");
28854
28967
  }
28855
28968
  });
28856
- var isRelationsDebugEnabled, RelationSelect;
28969
+ var isRelationsDebugEnabled, MANY_CARDINALITIES, RelationSelect;
28857
28970
  var init_RelationSelect = __esm({
28858
28971
  "components/core/molecules/RelationSelect.tsx"() {
28859
28972
  "use client";
@@ -28867,6 +28980,11 @@ var init_RelationSelect = __esm({
28867
28980
  init_Typography();
28868
28981
  init_debug();
28869
28982
  isRelationsDebugEnabled = () => isDebugEnabled();
28983
+ MANY_CARDINALITIES = [
28984
+ "many",
28985
+ "one-to-many",
28986
+ "many-to-many"
28987
+ ];
28870
28988
  RelationSelect = ({
28871
28989
  value,
28872
28990
  onChange,
@@ -30506,6 +30624,9 @@ var init_MathCanvas = __esm({
30506
30624
  showAxes = true,
30507
30625
  showGrid = true,
30508
30626
  gridStep = 1,
30627
+ backgroundColor,
30628
+ gridColor = "var(--color-border, #9ca3af)",
30629
+ axisColor = "var(--color-muted-foreground, #374151)",
30509
30630
  showTickLabels = false,
30510
30631
  showCurveLabels = false,
30511
30632
  curves = [],
@@ -30528,17 +30649,21 @@ var init_MathCanvas = __esm({
30528
30649
  error
30529
30650
  }) => {
30530
30651
  const eventBus = useEventBus();
30652
+ const keyMapKey = keyMap ? JSON.stringify(keyMap) : null;
30653
+ const keyUpMapKey = keyUpMap ? JSON.stringify(keyUpMap) : null;
30654
+ const stableKeyMap = useMemo(() => keyMap, [keyMapKey]);
30655
+ const stableKeyUpMap = useMemo(() => keyUpMap, [keyUpMapKey]);
30531
30656
  useEffect(() => {
30532
- if (!keyMap && !keyUpMap) return;
30657
+ if (!stableKeyMap && !stableKeyUpMap) return;
30533
30658
  const onDown = (e) => {
30534
- const ev = keyMap?.[e.code];
30659
+ const ev = stableKeyMap?.[e.code];
30535
30660
  if (ev) {
30536
30661
  eventBus.emit(`UI:${ev}`, {});
30537
30662
  e.preventDefault();
30538
30663
  }
30539
30664
  };
30540
30665
  const onUp = (e) => {
30541
- const ev = keyUpMap?.[e.code];
30666
+ const ev = stableKeyUpMap?.[e.code];
30542
30667
  if (ev) eventBus.emit(`UI:${ev}`, {});
30543
30668
  };
30544
30669
  window.addEventListener("keydown", onDown);
@@ -30547,7 +30672,7 @@ var init_MathCanvas = __esm({
30547
30672
  window.removeEventListener("keydown", onDown);
30548
30673
  window.removeEventListener("keyup", onUp);
30549
30674
  };
30550
- }, [keyMap, keyUpMap, eventBus]);
30675
+ }, [stableKeyMap, stableKeyUpMap, eventBus]);
30551
30676
  const derivedShapes = useMemo(() => {
30552
30677
  const out = [];
30553
30678
  const margin = 24;
@@ -30560,11 +30685,11 @@ var init_MathCanvas = __esm({
30560
30685
  if (showGrid) {
30561
30686
  for (let x = Math.ceil(xMin / gridStep) * gridStep; x <= xMax; x += gridStep) {
30562
30687
  const px = mapX(x);
30563
- out.push({ type: "line", x1: px, y1: margin, x2: px, y2: height - margin, color: "#9ca3af", opacity: 0.35, lineWidth: 1 });
30688
+ out.push({ type: "line", x1: px, y1: margin, x2: px, y2: height - margin, color: gridColor, opacity: 0.35, lineWidth: 1 });
30564
30689
  }
30565
30690
  for (let y = Math.ceil(yMin / gridStep) * gridStep; y <= yMax; y += gridStep) {
30566
30691
  const py = mapY(y);
30567
- out.push({ type: "line", x1: margin, y1: py, x2: width - margin, y2: py, color: "#9ca3af", opacity: 0.35, lineWidth: 1 });
30692
+ out.push({ type: "line", x1: margin, y1: py, x2: width - margin, y2: py, color: gridColor, opacity: 0.35, lineWidth: 1 });
30568
30693
  }
30569
30694
  }
30570
30695
  if (showTickLabels) {
@@ -30635,8 +30760,8 @@ var init_MathCanvas = __esm({
30635
30760
  });
30636
30761
  }
30637
30762
  if (showAxes) {
30638
- out.push({ type: "line", x1: margin, y1: xAxisY, x2: width - margin, y2: xAxisY, color: "#374151", lineWidth: 2 });
30639
- out.push({ type: "line", x1: yAxisX, y1: margin, x2: yAxisX, y2: height - margin, color: "#374151", lineWidth: 2 });
30763
+ out.push({ type: "line", x1: margin, y1: xAxisY, x2: width - margin, y2: xAxisY, color: axisColor, lineWidth: 2 });
30764
+ out.push({ type: "line", x1: yAxisX, y1: margin, x2: yAxisX, y2: height - margin, color: axisColor, lineWidth: 2 });
30640
30765
  }
30641
30766
  for (const guide of guides) {
30642
30767
  const color = guide.color ?? "#9ca3af";
@@ -30659,23 +30784,36 @@ var init_MathCanvas = __esm({
30659
30784
  }
30660
30785
  for (const curve of curves) {
30661
30786
  if (!curve.samples || curve.samples.length < 2) continue;
30787
+ let d = "";
30788
+ let penDown = false;
30662
30789
  let lastInRange;
30663
30790
  for (let i = 1; i < curve.samples.length; i++) {
30664
30791
  const a = curve.samples[i - 1];
30665
30792
  const b = curve.samples[i];
30666
- if (a.x < xMin || a.x > xMax || b.x < xMin || b.x > xMax) continue;
30667
- out.push({
30668
- type: "line",
30669
- x1: mapX(a.x),
30670
- y1: mapY(a.y),
30671
- x2: mapX(b.x),
30672
- y2: mapY(b.y),
30673
- color: curve.color ?? "#2563eb",
30674
- lineWidth: 2,
30675
- dash: curve.dash
30676
- });
30677
- lastInRange = b;
30678
- }
30793
+ if (a.x < xMin && b.x < xMin || a.x > xMax && b.x > xMax) {
30794
+ penDown = false;
30795
+ continue;
30796
+ }
30797
+ const clip = (p, q, xLim) => {
30798
+ const t = q.x === p.x ? 0 : (xLim - p.x) / (q.x - p.x);
30799
+ return { x: xLim, y: p.y + t * (q.y - p.y) };
30800
+ };
30801
+ const ca = a.x < xMin ? clip(a, b, xMin) : a.x > xMax ? clip(a, b, xMax) : a;
30802
+ const cb = b.x < xMin ? clip(a, b, xMin) : b.x > xMax ? clip(a, b, xMax) : b;
30803
+ const pax = mapX(ca.x);
30804
+ const pay = mapY(ca.y);
30805
+ d += `${penDown ? "L" : "M"} ${pax} ${pay} L ${mapX(cb.x)} ${mapY(cb.y)} `;
30806
+ penDown = true;
30807
+ if (b.x >= xMin && b.x <= xMax) lastInRange = b;
30808
+ }
30809
+ if (!d) continue;
30810
+ out.push({
30811
+ type: "path",
30812
+ path: d,
30813
+ color: curve.color ?? "#2563eb",
30814
+ lineWidth: 2,
30815
+ dash: curve.dash
30816
+ });
30679
30817
  if (showCurveLabels && curve.label && lastInRange) {
30680
30818
  out.push({
30681
30819
  type: "text",
@@ -30790,6 +30928,8 @@ var init_MathCanvas = __esm({
30790
30928
  showAxes,
30791
30929
  showGrid,
30792
30930
  gridStep,
30931
+ gridColor,
30932
+ axisColor,
30793
30933
  showTickLabels,
30794
30934
  showCurveLabels,
30795
30935
  curves,
@@ -30809,6 +30949,7 @@ var init_MathCanvas = __esm({
30809
30949
  {
30810
30950
  width,
30811
30951
  height,
30952
+ backgroundColor,
30812
30953
  shapes: derivedShapes,
30813
30954
  readouts,
30814
30955
  traces,
@@ -42968,6 +43109,9 @@ function determineInputType(field) {
42968
43109
  if (field.type === "relation" || field.relation) {
42969
43110
  return "relation";
42970
43111
  }
43112
+ if (field.type === "array") {
43113
+ return "array";
43114
+ }
42971
43115
  if (field.type === "enum" || field.values || getEnumOptions(field).length > 0) {
42972
43116
  return "select";
42973
43117
  }
@@ -43043,6 +43187,7 @@ var init_Form = __esm({
43043
43187
  init_Typography();
43044
43188
  init_Icon();
43045
43189
  init_RelationSelect();
43190
+ init_TagInput();
43046
43191
  init_UploadDropZone();
43047
43192
  init_Alert();
43048
43193
  init_useEventBus();
@@ -43122,7 +43267,7 @@ var init_Form = __esm({
43122
43267
  values: "values" in f3 ? f3.values : void 0,
43123
43268
  min: f3.min,
43124
43269
  max: f3.max,
43125
- relation: "relation" in f3 ? { entity: f3.relation.entity } : void 0
43270
+ relation: "relation" in f3 ? { entity: f3.relation.entity, cardinality: f3.relation.cardinality } : void 0
43126
43271
  })
43127
43272
  );
43128
43273
  }, [entity, fields]);
@@ -43357,7 +43502,7 @@ var init_Form = __esm({
43357
43502
  values: "values" in entityField ? entityField.values : void 0,
43358
43503
  min: entityField.min,
43359
43504
  max: entityField.max,
43360
- relation: "relation" in entityField ? { entity: entityField.relation.entity } : void 0
43505
+ relation: "relation" in entityField ? { entity: entityField.relation.entity, cardinality: entityField.relation.cardinality } : void 0
43361
43506
  };
43362
43507
  }
43363
43508
  return { name: field, type: "string" };
@@ -43469,6 +43614,22 @@ var init_Form = __esm({
43469
43614
  case "relation": {
43470
43615
  const relationOptions = relationsData[fieldName] || [];
43471
43616
  const relationLoading = relationsLoading[fieldName] || false;
43617
+ if (field.relation?.cardinality !== void 0 && MANY_CARDINALITIES.includes(field.relation.cardinality)) {
43618
+ const selectedValues = Array.isArray(currentValue) ? currentValue.map((v) => String(v)) : [];
43619
+ return /* @__PURE__ */ jsx(
43620
+ Select,
43621
+ {
43622
+ ...commonProps,
43623
+ multiple: true,
43624
+ searchable: true,
43625
+ clearable: true,
43626
+ options: [...relationOptions],
43627
+ value: selectedValues,
43628
+ onValueChange: (value) => handleChange(fieldName, Array.isArray(value) ? value : [value]),
43629
+ placeholder: field.placeholder || `Select ${label}...`
43630
+ }
43631
+ );
43632
+ }
43472
43633
  return /* @__PURE__ */ jsx(
43473
43634
  RelationSelect,
43474
43635
  {
@@ -43483,6 +43644,18 @@ var init_Form = __esm({
43483
43644
  }
43484
43645
  );
43485
43646
  }
43647
+ case "array": {
43648
+ const arrayValue = Array.isArray(currentValue) ? currentValue.map((v) => String(v)) : currentValue != null && currentValue !== "" ? [String(currentValue)] : [];
43649
+ return /* @__PURE__ */ jsx(
43650
+ TagInput,
43651
+ {
43652
+ placeholder: field.placeholder,
43653
+ disabled: isLoading,
43654
+ value: arrayValue,
43655
+ onChange: (next) => handleChange(fieldName, [...next])
43656
+ }
43657
+ );
43658
+ }
43486
43659
  case "number":
43487
43660
  return /* @__PURE__ */ jsx(
43488
43661
  Input,
@@ -49032,7 +49205,10 @@ function enrichFormFields(fields, entityDef) {
49032
49205
  enriched.values = entityField.enumValues;
49033
49206
  }
49034
49207
  if (entityField.relation) {
49035
- enriched.relation = entityField.relation.entity;
49208
+ enriched.relation = {
49209
+ entity: entityField.relation.entity,
49210
+ cardinality: entityField.relation.cardinality
49211
+ };
49036
49212
  }
49037
49213
  return enriched;
49038
49214
  }
@@ -49060,7 +49236,10 @@ function enrichFormFields(fields, entityDef) {
49060
49236
  }
49061
49237
  }
49062
49238
  if (!obj.relation && entityField.relation) {
49063
- enriched.relation = entityField.relation.entity;
49239
+ enriched.relation = {
49240
+ entity: entityField.relation.entity,
49241
+ cardinality: entityField.relation.cardinality
49242
+ };
49064
49243
  }
49065
49244
  return enriched;
49066
49245
  }
@@ -49075,7 +49254,12 @@ function enrichDetailFields(fields, entityDef) {
49075
49254
  const meta = { type: entityField.type };
49076
49255
  const values = entityField.values ?? entityField.enumValues;
49077
49256
  if (values && values.length > 0) meta.values = values;
49078
- if (entityField.relation) meta.relation = entityField.relation.entity;
49257
+ if (entityField.relation) {
49258
+ meta.relation = {
49259
+ entity: entityField.relation.entity,
49260
+ cardinality: entityField.relation.cardinality
49261
+ };
49262
+ }
49079
49263
  return meta;
49080
49264
  };
49081
49265
  return fields.map((field) => {
@@ -49629,6 +49813,32 @@ function isPlainConfigObject(value) {
49629
49813
  const proto = Object.getPrototypeOf(value);
49630
49814
  return proto === Object.prototype || proto === null;
49631
49815
  }
49816
+ function subtreeHasTraitRef(value) {
49817
+ const cached = traitRefPresenceCache.get(value);
49818
+ if (cached !== void 0) return cached;
49819
+ let found = false;
49820
+ const children = Array.isArray(value) ? value : Object.values(value);
49821
+ for (const child of children) {
49822
+ if (typeof child === "string" && TRAIT_BINDING_RE.test(child)) {
49823
+ found = true;
49824
+ break;
49825
+ }
49826
+ if (isRenderBindingMarker(child)) continue;
49827
+ if (Array.isArray(child)) {
49828
+ if (subtreeHasTraitRef(child)) {
49829
+ found = true;
49830
+ break;
49831
+ }
49832
+ } else if (child !== null && typeof child === "object" && isPlainConfigObject(child)) {
49833
+ if (subtreeHasTraitRef(child)) {
49834
+ found = true;
49835
+ break;
49836
+ }
49837
+ }
49838
+ }
49839
+ traitRefPresenceCache.set(value, found);
49840
+ return found;
49841
+ }
49632
49842
  function substituteTraitRefsDeep(value, pathKey) {
49633
49843
  if (isRenderBindingMarker(value)) return value;
49634
49844
  if (typeof value === "string") {
@@ -49643,11 +49853,13 @@ function substituteTraitRefsDeep(value, pathKey) {
49643
49853
  return value;
49644
49854
  }
49645
49855
  if (Array.isArray(value)) {
49856
+ if (!subtreeHasTraitRef(value)) return value;
49646
49857
  return value.map(
49647
49858
  (item, i) => substituteTraitRefsDeep(item, `${pathKey}[${i}]`)
49648
49859
  );
49649
49860
  }
49650
49861
  if (typeof value === "object" && isPlainConfigObject(value)) {
49862
+ if (!subtreeHasTraitRef(value)) return value;
49651
49863
  const out = {};
49652
49864
  for (const [k, v] of Object.entries(value)) {
49653
49865
  out[k] = substituteTraitRefsDeep(v, `${pathKey}.${k}`);
@@ -49936,7 +50148,7 @@ function UISlotRenderer({
49936
50148
  }
49937
50149
  return wrapped;
49938
50150
  }
49939
- var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext, SlotContainedContext, SLOT_SKELETON_MAP, SELF_OVERLAY_PATTERNS, CONTENT_NODE_SLOTS, PATTERNS_WITH_CHILDREN;
50151
+ var scopeWrapLog, TRAIT_BINDING_RE, SuspenseConfigContext, SlotContainedContext, SLOT_SKELETON_MAP, SELF_OVERLAY_PATTERNS, CONTENT_NODE_SLOTS, PATTERNS_WITH_CHILDREN, traitRefPresenceCache;
49940
50152
  var init_UISlotRenderer = __esm({
49941
50153
  "components/core/organisms/UISlotRenderer.tsx"() {
49942
50154
  "use client";
@@ -50010,6 +50222,7 @@ var init_UISlotRenderer = __esm({
50010
50222
  "alert",
50011
50223
  "dialog"
50012
50224
  ]);
50225
+ traitRefPresenceCache = /* @__PURE__ */ new WeakMap();
50013
50226
  UISlotRenderer.displayName = "UISlotRenderer";
50014
50227
  }
50015
50228
  });
@@ -51202,8 +51415,8 @@ function createHttpTransport(serverUrl) {
51202
51415
  } catch {
51203
51416
  }
51204
51417
  },
51205
- sendEvent: async (orbitalName, event, payload, clientId) => {
51206
- const body = { event, payload, clientId };
51418
+ sendEvent: async (orbitalName, event, payload, clientId, tick, sourceTrait) => {
51419
+ const body = { event, payload, clientId, tick, sourceTrait };
51207
51420
  const res = await fetch(`${serverUrl}/${orbitalName}/events`, {
51208
51421
  method: "POST",
51209
51422
  headers: { "Content-Type": "application/json" },
@@ -51248,12 +51461,15 @@ function ServerBridgeProvider({
51248
51461
  async () => transport.unregister(),
51249
51462
  [transport]
51250
51463
  );
51251
- const sendEvent = useCallback(async (orbitalName, event, payload) => {
51464
+ const sendEvent = useCallback(async (orbitalName, event, payload, tick, sourceTrait) => {
51252
51465
  const emptyMeta = { success: false, clientEffects: 0, dataEntities: {}, emittedEvents: [] };
51253
51466
  if (!connected) return { effects: [], meta: emptyMeta };
51254
51467
  try {
51255
- const result = await transport.sendEvent(orbitalName, event, payload, getTabClientId());
51468
+ const result = await transport.sendEvent(orbitalName, event, payload, getTabClientId(), tick, sourceTrait);
51256
51469
  const effects = [];
51470
+ if (tick !== void 0) {
51471
+ return { effects, meta: { ...emptyMeta, success: !!result.success, error: result.error } };
51472
+ }
51257
51473
  const responseData = result.data || {};
51258
51474
  const dataEntities = {};
51259
51475
  for (const [entityName, records] of Object.entries(responseData)) {