@almadar/ui 5.125.0 → 5.126.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.
@@ -21255,17 +21255,27 @@ function getWeekDays(start) {
21255
21255
  }
21256
21256
  return days;
21257
21257
  }
21258
- function generateDefaultTimeSlots() {
21258
+ function generateDefaultTimeSlots(events2) {
21259
+ let first = DEFAULT_FIRST_HOUR;
21260
+ let last = DEFAULT_LAST_HOUR;
21261
+ for (const ev of events2) {
21262
+ const start = new Date(ev.startTime);
21263
+ if (Number.isNaN(start.getTime())) continue;
21264
+ const hour = start.getHours();
21265
+ if (hour < first) first = hour;
21266
+ if (hour > last) last = hour;
21267
+ }
21259
21268
  const slots = [];
21260
- for (let hour = 9; hour <= 17; hour++) {
21261
- slots.push(`${hour.toString().padStart(2, "0")}:00`);
21269
+ for (let hour = first; hour <= last; hour++) {
21270
+ slots.push(slotLabel(hour));
21262
21271
  }
21263
21272
  return slots;
21264
21273
  }
21265
21274
  function eventInSlot(event, day, slotTime) {
21266
21275
  const eventStart = new Date(event.startTime);
21267
- const [slotHour, slotMinute] = slotTime.split(":").map(Number);
21268
- return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour && eventStart.getMinutes() === slotMinute;
21276
+ if (Number.isNaN(eventStart.getTime())) return false;
21277
+ const [slotHour] = slotTime.split(":").map(Number);
21278
+ return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour;
21269
21279
  }
21270
21280
  function CalendarGrid({
21271
21281
  weekStart,
@@ -21294,8 +21304,8 @@ function CalendarGrid({
21294
21304
  [resolvedWeekStart]
21295
21305
  );
21296
21306
  const resolvedTimeSlots = React91.useMemo(
21297
- () => timeSlots ?? generateDefaultTimeSlots(),
21298
- [timeSlots]
21307
+ () => timeSlots ?? generateDefaultTimeSlots(evs),
21308
+ [timeSlots, evs]
21299
21309
  );
21300
21310
  const visibleCount = useDayWindow(dayWindow);
21301
21311
  const [dayOffset, setDayOffset] = React91.useState(0);
@@ -21482,7 +21492,7 @@ function CalendarGrid({
21482
21492
  }
21483
21493
  );
21484
21494
  }
21485
- var SHORT_DATE;
21495
+ var SHORT_DATE, DEFAULT_FIRST_HOUR, DEFAULT_LAST_HOUR, slotLabel;
21486
21496
  var init_CalendarGrid = __esm({
21487
21497
  "components/core/molecules/CalendarGrid.tsx"() {
21488
21498
  "use client";
@@ -21497,6 +21507,9 @@ var init_CalendarGrid = __esm({
21497
21507
  init_useEventBus();
21498
21508
  init_useSwipeGesture();
21499
21509
  SHORT_DATE = { month: "short", day: "numeric" };
21510
+ DEFAULT_FIRST_HOUR = 9;
21511
+ DEFAULT_LAST_HOUR = 17;
21512
+ slotLabel = (hour) => `${hour.toString().padStart(2, "0")}:00`;
21500
21513
  CalendarGrid.displayName = "CalendarGrid";
21501
21514
  }
21502
21515
  });
@@ -45833,6 +45846,13 @@ function MaybeTraitScope({
45833
45846
  if (wrap) {
45834
45847
  return /* @__PURE__ */ jsxRuntime.jsx(providers.TraitScopeProvider, { orbital, trait: sourceTrait, children });
45835
45848
  }
45849
+ if (sourceTrait !== void 0 && schemaCtx !== null) {
45850
+ scopeWrapLog.warn("decline", {
45851
+ sourceTrait,
45852
+ orbitalsByTraitSize: schemaCtx.orbitalsByTrait.size,
45853
+ reason: "sourceTrait not in orbitalsByTrait \u2014 children render unscoped"
45854
+ });
45855
+ }
45836
45856
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
45837
45857
  }
45838
45858
  function UISlotComponent({
@@ -46130,7 +46150,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
46130
46150
  const childId = `${parentId}-${index}`;
46131
46151
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
46132
46152
  const childAsRecord = child;
46133
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
46153
+ const { type: _childType, props: nestedProps, _id: _childNodeId, _sourceTrait: childSourceTrait, children: _childChildren, ...flatProps } = childAsRecord;
46134
46154
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
46135
46155
  if (_childChildren !== void 0 && nestedProps === void 0) {
46136
46156
  resolvedProps.children = _childChildren;
@@ -46145,11 +46165,14 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
46145
46165
  // (e.g. form-section inside a stack) can resolve entityDef via
46146
46166
  // the trait's linkedEntity for form-field enrichment. The orbCtx
46147
46167
  // (slot/transition/state/entity) propagates the same way so every
46148
- // nested node carries a complete contextual-edit address.
46149
- ...sourceTrait !== void 0 && { sourceTrait },
46168
+ // nested node carries a complete contextual-edit address. A child
46169
+ // carrying its own `_sourceTrait` (multi-source slot stack) owns it
46170
+ // outright — inheriting the synthetic wrapper's sentinel instead
46171
+ // would erase the real owner.
46172
+ ...childSourceTrait !== void 0 ? { sourceTrait: childSourceTrait } : sourceTrait !== void 0 && { sourceTrait },
46150
46173
  ...orbCtx ?? {}
46151
46174
  };
46152
- return /* @__PURE__ */ jsxRuntime.jsx(
46175
+ const renderedChild = /* @__PURE__ */ jsxRuntime.jsx(
46153
46176
  SlotContentRenderer,
46154
46177
  {
46155
46178
  content: childContent,
@@ -46158,6 +46181,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
46158
46181
  },
46159
46182
  childId
46160
46183
  );
46184
+ return childSourceTrait !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MaybeTraitScope, { sourceTrait: childSourceTrait, children: renderedChild }, childId) : renderedChild;
46161
46185
  });
46162
46186
  }
46163
46187
  function toDrawableNodes(children) {