@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.
package/dist/avl/index.js CHANGED
@@ -21179,17 +21179,27 @@ function getWeekDays(start) {
21179
21179
  }
21180
21180
  return days;
21181
21181
  }
21182
- function generateDefaultTimeSlots() {
21182
+ function generateDefaultTimeSlots(events2) {
21183
+ let first = DEFAULT_FIRST_HOUR;
21184
+ let last = DEFAULT_LAST_HOUR;
21185
+ for (const ev of events2) {
21186
+ const start = new Date(ev.startTime);
21187
+ if (Number.isNaN(start.getTime())) continue;
21188
+ const hour = start.getHours();
21189
+ if (hour < first) first = hour;
21190
+ if (hour > last) last = hour;
21191
+ }
21183
21192
  const slots = [];
21184
- for (let hour = 9; hour <= 17; hour++) {
21185
- slots.push(`${hour.toString().padStart(2, "0")}:00`);
21193
+ for (let hour = first; hour <= last; hour++) {
21194
+ slots.push(slotLabel(hour));
21186
21195
  }
21187
21196
  return slots;
21188
21197
  }
21189
21198
  function eventInSlot(event, day, slotTime) {
21190
21199
  const eventStart = new Date(event.startTime);
21191
- const [slotHour, slotMinute] = slotTime.split(":").map(Number);
21192
- return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour && eventStart.getMinutes() === slotMinute;
21200
+ if (Number.isNaN(eventStart.getTime())) return false;
21201
+ const [slotHour] = slotTime.split(":").map(Number);
21202
+ return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour;
21193
21203
  }
21194
21204
  function CalendarGrid({
21195
21205
  weekStart,
@@ -21218,8 +21228,8 @@ function CalendarGrid({
21218
21228
  [resolvedWeekStart]
21219
21229
  );
21220
21230
  const resolvedTimeSlots = useMemo(
21221
- () => timeSlots ?? generateDefaultTimeSlots(),
21222
- [timeSlots]
21231
+ () => timeSlots ?? generateDefaultTimeSlots(evs),
21232
+ [timeSlots, evs]
21223
21233
  );
21224
21234
  const visibleCount = useDayWindow(dayWindow);
21225
21235
  const [dayOffset, setDayOffset] = useState(0);
@@ -21406,7 +21416,7 @@ function CalendarGrid({
21406
21416
  }
21407
21417
  );
21408
21418
  }
21409
- var SHORT_DATE;
21419
+ var SHORT_DATE, DEFAULT_FIRST_HOUR, DEFAULT_LAST_HOUR, slotLabel;
21410
21420
  var init_CalendarGrid = __esm({
21411
21421
  "components/core/molecules/CalendarGrid.tsx"() {
21412
21422
  "use client";
@@ -21421,6 +21431,9 @@ var init_CalendarGrid = __esm({
21421
21431
  init_useEventBus();
21422
21432
  init_useSwipeGesture();
21423
21433
  SHORT_DATE = { month: "short", day: "numeric" };
21434
+ DEFAULT_FIRST_HOUR = 9;
21435
+ DEFAULT_LAST_HOUR = 17;
21436
+ slotLabel = (hour) => `${hour.toString().padStart(2, "0")}:00`;
21424
21437
  CalendarGrid.displayName = "CalendarGrid";
21425
21438
  }
21426
21439
  });
@@ -45757,6 +45770,13 @@ function MaybeTraitScope({
45757
45770
  if (wrap) {
45758
45771
  return /* @__PURE__ */ jsx(TraitScopeProvider, { orbital, trait: sourceTrait, children });
45759
45772
  }
45773
+ if (sourceTrait !== void 0 && schemaCtx !== null) {
45774
+ scopeWrapLog.warn("decline", {
45775
+ sourceTrait,
45776
+ orbitalsByTraitSize: schemaCtx.orbitalsByTrait.size,
45777
+ reason: "sourceTrait not in orbitalsByTrait \u2014 children render unscoped"
45778
+ });
45779
+ }
45760
45780
  return /* @__PURE__ */ jsx(Fragment, { children });
45761
45781
  }
45762
45782
  function UISlotComponent({
@@ -46054,7 +46074,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
46054
46074
  const childId = `${parentId}-${index}`;
46055
46075
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
46056
46076
  const childAsRecord = child;
46057
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
46077
+ const { type: _childType, props: nestedProps, _id: _childNodeId, _sourceTrait: childSourceTrait, children: _childChildren, ...flatProps } = childAsRecord;
46058
46078
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
46059
46079
  if (_childChildren !== void 0 && nestedProps === void 0) {
46060
46080
  resolvedProps.children = _childChildren;
@@ -46069,11 +46089,14 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
46069
46089
  // (e.g. form-section inside a stack) can resolve entityDef via
46070
46090
  // the trait's linkedEntity for form-field enrichment. The orbCtx
46071
46091
  // (slot/transition/state/entity) propagates the same way so every
46072
- // nested node carries a complete contextual-edit address.
46073
- ...sourceTrait !== void 0 && { sourceTrait },
46092
+ // nested node carries a complete contextual-edit address. A child
46093
+ // carrying its own `_sourceTrait` (multi-source slot stack) owns it
46094
+ // outright — inheriting the synthetic wrapper's sentinel instead
46095
+ // would erase the real owner.
46096
+ ...childSourceTrait !== void 0 ? { sourceTrait: childSourceTrait } : sourceTrait !== void 0 && { sourceTrait },
46074
46097
  ...orbCtx ?? {}
46075
46098
  };
46076
- return /* @__PURE__ */ jsx(
46099
+ const renderedChild = /* @__PURE__ */ jsx(
46077
46100
  SlotContentRenderer,
46078
46101
  {
46079
46102
  content: childContent,
@@ -46082,6 +46105,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
46082
46105
  },
46083
46106
  childId
46084
46107
  );
46108
+ return childSourceTrait !== void 0 ? /* @__PURE__ */ jsx(MaybeTraitScope, { sourceTrait: childSourceTrait, children: renderedChild }, childId) : renderedChild;
46085
46109
  });
46086
46110
  }
46087
46111
  function toDrawableNodes(children) {
@@ -14601,17 +14601,27 @@ function getWeekDays(start) {
14601
14601
  }
14602
14602
  return days;
14603
14603
  }
14604
- function generateDefaultTimeSlots() {
14604
+ function generateDefaultTimeSlots(events2) {
14605
+ let first = DEFAULT_FIRST_HOUR;
14606
+ let last = DEFAULT_LAST_HOUR;
14607
+ for (const ev of events2) {
14608
+ const start = new Date(ev.startTime);
14609
+ if (Number.isNaN(start.getTime())) continue;
14610
+ const hour = start.getHours();
14611
+ if (hour < first) first = hour;
14612
+ if (hour > last) last = hour;
14613
+ }
14605
14614
  const slots = [];
14606
- for (let hour = 9; hour <= 17; hour++) {
14607
- slots.push(`${hour.toString().padStart(2, "0")}:00`);
14615
+ for (let hour = first; hour <= last; hour++) {
14616
+ slots.push(slotLabel(hour));
14608
14617
  }
14609
14618
  return slots;
14610
14619
  }
14611
14620
  function eventInSlot(event, day, slotTime) {
14612
14621
  const eventStart = new Date(event.startTime);
14613
- const [slotHour, slotMinute] = slotTime.split(":").map(Number);
14614
- return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour && eventStart.getMinutes() === slotMinute;
14622
+ if (Number.isNaN(eventStart.getTime())) return false;
14623
+ const [slotHour] = slotTime.split(":").map(Number);
14624
+ return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour;
14615
14625
  }
14616
14626
  function CalendarGrid({
14617
14627
  weekStart,
@@ -14640,8 +14650,8 @@ function CalendarGrid({
14640
14650
  [resolvedWeekStart]
14641
14651
  );
14642
14652
  const resolvedTimeSlots = React74.useMemo(
14643
- () => timeSlots ?? generateDefaultTimeSlots(),
14644
- [timeSlots]
14653
+ () => timeSlots ?? generateDefaultTimeSlots(evs),
14654
+ [timeSlots, evs]
14645
14655
  );
14646
14656
  const visibleCount = useDayWindow(dayWindow);
14647
14657
  const [dayOffset, setDayOffset] = React74.useState(0);
@@ -14828,7 +14838,7 @@ function CalendarGrid({
14828
14838
  }
14829
14839
  );
14830
14840
  }
14831
- var SHORT_DATE;
14841
+ var SHORT_DATE, DEFAULT_FIRST_HOUR, DEFAULT_LAST_HOUR, slotLabel;
14832
14842
  var init_CalendarGrid = __esm({
14833
14843
  "components/core/molecules/CalendarGrid.tsx"() {
14834
14844
  "use client";
@@ -14843,6 +14853,9 @@ var init_CalendarGrid = __esm({
14843
14853
  init_useEventBus();
14844
14854
  init_useSwipeGesture();
14845
14855
  SHORT_DATE = { month: "short", day: "numeric" };
14856
+ DEFAULT_FIRST_HOUR = 9;
14857
+ DEFAULT_LAST_HOUR = 17;
14858
+ slotLabel = (hour) => `${hour.toString().padStart(2, "0")}:00`;
14846
14859
  CalendarGrid.displayName = "CalendarGrid";
14847
14860
  }
14848
14861
  });
@@ -45409,6 +45422,13 @@ function MaybeTraitScope({
45409
45422
  if (wrap) {
45410
45423
  return /* @__PURE__ */ jsxRuntime.jsx(providers.TraitScopeProvider, { orbital, trait: sourceTrait, children });
45411
45424
  }
45425
+ if (sourceTrait !== void 0 && schemaCtx !== null) {
45426
+ scopeWrapLog.warn("decline", {
45427
+ sourceTrait,
45428
+ orbitalsByTraitSize: schemaCtx.orbitalsByTrait.size,
45429
+ reason: "sourceTrait not in orbitalsByTrait \u2014 children render unscoped"
45430
+ });
45431
+ }
45412
45432
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
45413
45433
  }
45414
45434
  function UISlotComponent({
@@ -45706,7 +45726,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
45706
45726
  const childId = `${parentId}-${index}`;
45707
45727
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
45708
45728
  const childAsRecord = child;
45709
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
45729
+ const { type: _childType, props: nestedProps, _id: _childNodeId, _sourceTrait: childSourceTrait, children: _childChildren, ...flatProps } = childAsRecord;
45710
45730
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
45711
45731
  if (_childChildren !== void 0 && nestedProps === void 0) {
45712
45732
  resolvedProps.children = _childChildren;
@@ -45721,11 +45741,14 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
45721
45741
  // (e.g. form-section inside a stack) can resolve entityDef via
45722
45742
  // the trait's linkedEntity for form-field enrichment. The orbCtx
45723
45743
  // (slot/transition/state/entity) propagates the same way so every
45724
- // nested node carries a complete contextual-edit address.
45725
- ...sourceTrait !== void 0 && { sourceTrait },
45744
+ // nested node carries a complete contextual-edit address. A child
45745
+ // carrying its own `_sourceTrait` (multi-source slot stack) owns it
45746
+ // outright — inheriting the synthetic wrapper's sentinel instead
45747
+ // would erase the real owner.
45748
+ ...childSourceTrait !== void 0 ? { sourceTrait: childSourceTrait } : sourceTrait !== void 0 && { sourceTrait },
45726
45749
  ...orbCtx ?? {}
45727
45750
  };
45728
- return /* @__PURE__ */ jsxRuntime.jsx(
45751
+ const renderedChild = /* @__PURE__ */ jsxRuntime.jsx(
45729
45752
  SlotContentRenderer,
45730
45753
  {
45731
45754
  content: childContent,
@@ -45734,6 +45757,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
45734
45757
  },
45735
45758
  childId
45736
45759
  );
45760
+ return childSourceTrait !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MaybeTraitScope, { sourceTrait: childSourceTrait, children: renderedChild }, childId) : renderedChild;
45737
45761
  });
45738
45762
  }
45739
45763
  function toDrawableNodes(children) {
@@ -47282,9 +47306,10 @@ function aggregateSlot(sources) {
47282
47306
  const entries = Object.entries(sources);
47283
47307
  if (entries.length === 0) return null;
47284
47308
  if (entries.length === 1) return entries[0][1];
47285
- const children = entries.map(([, entry]) => ({
47309
+ const children = entries.map(([sourceKey, entry]) => ({
47286
47310
  type: entry.pattern,
47287
- ...entry.props
47311
+ ...entry.props,
47312
+ ...sourceKey !== DEFAULT_SOURCE_KEY && { _sourceTrait: sourceKey }
47288
47313
  }));
47289
47314
  const stackId = `slot-content-stack-${entries.map(([k]) => k).join("-")}`;
47290
47315
  return {
@@ -14526,17 +14526,27 @@ function getWeekDays(start) {
14526
14526
  }
14527
14527
  return days;
14528
14528
  }
14529
- function generateDefaultTimeSlots() {
14529
+ function generateDefaultTimeSlots(events2) {
14530
+ let first = DEFAULT_FIRST_HOUR;
14531
+ let last = DEFAULT_LAST_HOUR;
14532
+ for (const ev of events2) {
14533
+ const start = new Date(ev.startTime);
14534
+ if (Number.isNaN(start.getTime())) continue;
14535
+ const hour = start.getHours();
14536
+ if (hour < first) first = hour;
14537
+ if (hour > last) last = hour;
14538
+ }
14530
14539
  const slots = [];
14531
- for (let hour = 9; hour <= 17; hour++) {
14532
- slots.push(`${hour.toString().padStart(2, "0")}:00`);
14540
+ for (let hour = first; hour <= last; hour++) {
14541
+ slots.push(slotLabel(hour));
14533
14542
  }
14534
14543
  return slots;
14535
14544
  }
14536
14545
  function eventInSlot(event, day, slotTime) {
14537
14546
  const eventStart = new Date(event.startTime);
14538
- const [slotHour, slotMinute] = slotTime.split(":").map(Number);
14539
- return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour && eventStart.getMinutes() === slotMinute;
14547
+ if (Number.isNaN(eventStart.getTime())) return false;
14548
+ const [slotHour] = slotTime.split(":").map(Number);
14549
+ return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour;
14540
14550
  }
14541
14551
  function CalendarGrid({
14542
14552
  weekStart,
@@ -14565,8 +14575,8 @@ function CalendarGrid({
14565
14575
  [resolvedWeekStart]
14566
14576
  );
14567
14577
  const resolvedTimeSlots = useMemo(
14568
- () => timeSlots ?? generateDefaultTimeSlots(),
14569
- [timeSlots]
14578
+ () => timeSlots ?? generateDefaultTimeSlots(evs),
14579
+ [timeSlots, evs]
14570
14580
  );
14571
14581
  const visibleCount = useDayWindow(dayWindow);
14572
14582
  const [dayOffset, setDayOffset] = useState(0);
@@ -14753,7 +14763,7 @@ function CalendarGrid({
14753
14763
  }
14754
14764
  );
14755
14765
  }
14756
- var SHORT_DATE;
14766
+ var SHORT_DATE, DEFAULT_FIRST_HOUR, DEFAULT_LAST_HOUR, slotLabel;
14757
14767
  var init_CalendarGrid = __esm({
14758
14768
  "components/core/molecules/CalendarGrid.tsx"() {
14759
14769
  "use client";
@@ -14768,6 +14778,9 @@ var init_CalendarGrid = __esm({
14768
14778
  init_useEventBus();
14769
14779
  init_useSwipeGesture();
14770
14780
  SHORT_DATE = { month: "short", day: "numeric" };
14781
+ DEFAULT_FIRST_HOUR = 9;
14782
+ DEFAULT_LAST_HOUR = 17;
14783
+ slotLabel = (hour) => `${hour.toString().padStart(2, "0")}:00`;
14771
14784
  CalendarGrid.displayName = "CalendarGrid";
14772
14785
  }
14773
14786
  });
@@ -45334,6 +45347,13 @@ function MaybeTraitScope({
45334
45347
  if (wrap) {
45335
45348
  return /* @__PURE__ */ jsx(TraitScopeProvider, { orbital, trait: sourceTrait, children });
45336
45349
  }
45350
+ if (sourceTrait !== void 0 && schemaCtx !== null) {
45351
+ scopeWrapLog.warn("decline", {
45352
+ sourceTrait,
45353
+ orbitalsByTraitSize: schemaCtx.orbitalsByTrait.size,
45354
+ reason: "sourceTrait not in orbitalsByTrait \u2014 children render unscoped"
45355
+ });
45356
+ }
45337
45357
  return /* @__PURE__ */ jsx(Fragment, { children });
45338
45358
  }
45339
45359
  function UISlotComponent({
@@ -45631,7 +45651,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
45631
45651
  const childId = `${parentId}-${index}`;
45632
45652
  const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
45633
45653
  const childAsRecord = child;
45634
- const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
45654
+ const { type: _childType, props: nestedProps, _id: _childNodeId, _sourceTrait: childSourceTrait, children: _childChildren, ...flatProps } = childAsRecord;
45635
45655
  const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
45636
45656
  if (_childChildren !== void 0 && nestedProps === void 0) {
45637
45657
  resolvedProps.children = _childChildren;
@@ -45646,11 +45666,14 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
45646
45666
  // (e.g. form-section inside a stack) can resolve entityDef via
45647
45667
  // the trait's linkedEntity for form-field enrichment. The orbCtx
45648
45668
  // (slot/transition/state/entity) propagates the same way so every
45649
- // nested node carries a complete contextual-edit address.
45650
- ...sourceTrait !== void 0 && { sourceTrait },
45669
+ // nested node carries a complete contextual-edit address. A child
45670
+ // carrying its own `_sourceTrait` (multi-source slot stack) owns it
45671
+ // outright — inheriting the synthetic wrapper's sentinel instead
45672
+ // would erase the real owner.
45673
+ ...childSourceTrait !== void 0 ? { sourceTrait: childSourceTrait } : sourceTrait !== void 0 && { sourceTrait },
45651
45674
  ...orbCtx ?? {}
45652
45675
  };
45653
- return /* @__PURE__ */ jsx(
45676
+ const renderedChild = /* @__PURE__ */ jsx(
45654
45677
  SlotContentRenderer,
45655
45678
  {
45656
45679
  content: childContent,
@@ -45659,6 +45682,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
45659
45682
  },
45660
45683
  childId
45661
45684
  );
45685
+ return childSourceTrait !== void 0 ? /* @__PURE__ */ jsx(MaybeTraitScope, { sourceTrait: childSourceTrait, children: renderedChild }, childId) : renderedChild;
45662
45686
  });
45663
45687
  }
45664
45688
  function toDrawableNodes(children) {
@@ -47207,9 +47231,10 @@ function aggregateSlot(sources) {
47207
47231
  const entries = Object.entries(sources);
47208
47232
  if (entries.length === 0) return null;
47209
47233
  if (entries.length === 1) return entries[0][1];
47210
- const children = entries.map(([, entry]) => ({
47234
+ const children = entries.map(([sourceKey, entry]) => ({
47211
47235
  type: entry.pattern,
47212
- ...entry.props
47236
+ ...entry.props,
47237
+ ...sourceKey !== DEFAULT_SOURCE_KEY && { _sourceTrait: sourceKey }
47213
47238
  }));
47214
47239
  const stackId = `slot-content-stack-${entries.map(([k]) => k).join("-")}`;
47215
47240
  return {
@@ -40,9 +40,10 @@ function aggregateSlot(sources) {
40
40
  const entries = Object.entries(sources);
41
41
  if (entries.length === 0) return null;
42
42
  if (entries.length === 1) return entries[0][1];
43
- const children = entries.map(([, entry]) => ({
43
+ const children = entries.map(([sourceKey, entry]) => ({
44
44
  type: entry.pattern,
45
- ...entry.props
45
+ ...entry.props,
46
+ ...sourceKey !== DEFAULT_SOURCE_KEY && { _sourceTrait: sourceKey }
46
47
  }));
47
48
  const stackId = `slot-content-stack-${entries.map(([k]) => k).join("-")}`;
48
49
  return {
@@ -38,9 +38,10 @@ function aggregateSlot(sources) {
38
38
  const entries = Object.entries(sources);
39
39
  if (entries.length === 0) return null;
40
40
  if (entries.length === 1) return entries[0][1];
41
- const children = entries.map(([, entry]) => ({
41
+ const children = entries.map(([sourceKey, entry]) => ({
42
42
  type: entry.pattern,
43
- ...entry.props
43
+ ...entry.props,
44
+ ...sourceKey !== DEFAULT_SOURCE_KEY && { _sourceTrait: sourceKey }
44
45
  }));
45
46
  const stackId = `slot-content-stack-${entries.map(([k]) => k).join("-")}`;
46
47
  return {
@@ -1053,9 +1053,10 @@ function aggregateSlot(sources) {
1053
1053
  const entries = Object.entries(sources);
1054
1054
  if (entries.length === 0) return null;
1055
1055
  if (entries.length === 1) return entries[0][1];
1056
- const children = entries.map(([, entry]) => ({
1056
+ const children = entries.map(([sourceKey, entry]) => ({
1057
1057
  type: entry.pattern,
1058
- ...entry.props
1058
+ ...entry.props,
1059
+ ...sourceKey !== DEFAULT_SOURCE_KEY && { _sourceTrait: sourceKey }
1059
1060
  }));
1060
1061
  const stackId = `slot-content-stack-${entries.map(([k]) => k).join("-")}`;
1061
1062
  return {
@@ -1051,9 +1051,10 @@ function aggregateSlot(sources) {
1051
1051
  const entries = Object.entries(sources);
1052
1052
  if (entries.length === 0) return null;
1053
1053
  if (entries.length === 1) return entries[0][1];
1054
- const children = entries.map(([, entry]) => ({
1054
+ const children = entries.map(([sourceKey, entry]) => ({
1055
1055
  type: entry.pattern,
1056
- ...entry.props
1056
+ ...entry.props,
1057
+ ...sourceKey !== DEFAULT_SOURCE_KEY && { _sourceTrait: sourceKey }
1057
1058
  }));
1058
1059
  const stackId = `slot-content-stack-${entries.map(([k]) => k).join("-")}`;
1059
1060
  return {