@almadar/ui 5.125.0 → 5.127.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.cjs +84 -47
- package/dist/avl/index.d.cts +1859 -0
- package/dist/avl/index.d.ts +1859 -0
- package/dist/avl/index.js +85 -48
- package/dist/components/index.cjs +86 -48
- package/dist/components/index.d.cts +27 -1
- package/dist/components/index.d.ts +27 -1
- package/dist/components/index.js +86 -48
- package/dist/context/index.cjs +3 -2
- package/dist/context/index.js +3 -2
- package/dist/hooks/index.cjs +3 -2
- package/dist/hooks/index.js +3 -2
- package/dist/marketing/index.d.cts +1086 -0
- package/dist/marketing/index.d.ts +1086 -0
- package/dist/providers/index.cjs +83 -46
- package/dist/providers/index.js +83 -46
- package/dist/runtime/index.cjs +84 -47
- package/dist/runtime/index.js +85 -48
- package/package.json +6 -6
package/dist/avl/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import * as LucideIcons2 from 'lucide-react';
|
|
|
10
10
|
import { Loader2, X, Code, FileText, WrapText, Check, Copy, Lightbulb, CheckCircle, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil, Eye, Plus, ArrowRight, Trash, RotateCcw, Play, Terminal, XCircle, AlertTriangle, Trash2, Link2, ZoomOut, ZoomIn, Download, ChevronDown, Menu as Menu$1, Package, Calendar, MoreHorizontal, Image as Image$1, Upload, ArrowLeft, HelpCircle, PauseCircle, Search, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Minus, Eraser, TrendingUp, TrendingDown, AlertCircle, Circle, Clock, CheckCircle2, ChevronUp, Tag, User, DollarSign } from 'lucide-react';
|
|
11
11
|
import { createPortal } from 'react-dom';
|
|
12
12
|
import { UISlotProvider, useUISlots, useTheme } from '@almadar/ui/context';
|
|
13
|
-
import { evaluateGuard, evaluate, createMinimalContext, executeEffects } from '@almadar/evaluator';
|
|
13
|
+
import { evaluateGuard, evaluateListenPayloadExpr, evaluate, createMinimalContext, executeEffects } from '@almadar/evaluator';
|
|
14
14
|
import { prepareSchemaForPreview, collectTraitRefsFromResolvedTrait, buildOrbitalsByTrait, collectEmbeddedTraits, wrapCallbackForEvent, pushPerfEntry, perfStart, perfEnd } from '@almadar/runtime/ui';
|
|
15
15
|
import { Link, Outlet, useLocation } from 'react-router-dom';
|
|
16
16
|
import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light.js';
|
|
@@ -21066,6 +21066,32 @@ var init_ButtonGroup = __esm({
|
|
|
21066
21066
|
ButtonGroup.displayName = "ButtonGroup";
|
|
21067
21067
|
}
|
|
21068
21068
|
});
|
|
21069
|
+
|
|
21070
|
+
// lib/getNestedValue.ts
|
|
21071
|
+
function getNestedValue(obj, path) {
|
|
21072
|
+
if (obj === null || obj === void 0 || !path) {
|
|
21073
|
+
return void 0;
|
|
21074
|
+
}
|
|
21075
|
+
if (!path.includes(".")) {
|
|
21076
|
+
return obj[path];
|
|
21077
|
+
}
|
|
21078
|
+
const parts = path.split(".");
|
|
21079
|
+
let value = obj;
|
|
21080
|
+
for (const part of parts) {
|
|
21081
|
+
if (value === null || value === void 0) {
|
|
21082
|
+
return void 0;
|
|
21083
|
+
}
|
|
21084
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
21085
|
+
return void 0;
|
|
21086
|
+
}
|
|
21087
|
+
value = value[part];
|
|
21088
|
+
}
|
|
21089
|
+
return value;
|
|
21090
|
+
}
|
|
21091
|
+
var init_getNestedValue = __esm({
|
|
21092
|
+
"lib/getNestedValue.ts"() {
|
|
21093
|
+
}
|
|
21094
|
+
});
|
|
21069
21095
|
function useSwipeGesture(callbacks, options = {}) {
|
|
21070
21096
|
const { threshold = 50, velocityThreshold = 0.3, preventDefault = false } = options;
|
|
21071
21097
|
const startX = useRef(0);
|
|
@@ -21179,17 +21205,31 @@ function getWeekDays(start) {
|
|
|
21179
21205
|
}
|
|
21180
21206
|
return days;
|
|
21181
21207
|
}
|
|
21182
|
-
function
|
|
21208
|
+
function eventStartDate(event, startField) {
|
|
21209
|
+
const raw = getNestedValue(event, startField);
|
|
21210
|
+
return new Date(raw ?? "");
|
|
21211
|
+
}
|
|
21212
|
+
function generateDefaultTimeSlots(events2, startField) {
|
|
21213
|
+
let first = DEFAULT_FIRST_HOUR;
|
|
21214
|
+
let last = DEFAULT_LAST_HOUR;
|
|
21215
|
+
for (const ev of events2) {
|
|
21216
|
+
const start = eventStartDate(ev, startField);
|
|
21217
|
+
if (Number.isNaN(start.getTime())) continue;
|
|
21218
|
+
const hour = start.getHours();
|
|
21219
|
+
if (hour < first) first = hour;
|
|
21220
|
+
if (hour > last) last = hour;
|
|
21221
|
+
}
|
|
21183
21222
|
const slots = [];
|
|
21184
|
-
for (let hour =
|
|
21185
|
-
slots.push(
|
|
21223
|
+
for (let hour = first; hour <= last; hour++) {
|
|
21224
|
+
slots.push(slotLabel(hour));
|
|
21186
21225
|
}
|
|
21187
21226
|
return slots;
|
|
21188
21227
|
}
|
|
21189
|
-
function eventInSlot(event, day, slotTime) {
|
|
21190
|
-
const eventStart =
|
|
21191
|
-
|
|
21192
|
-
|
|
21228
|
+
function eventInSlot(event, day, slotTime, startField) {
|
|
21229
|
+
const eventStart = eventStartDate(event, startField);
|
|
21230
|
+
if (Number.isNaN(eventStart.getTime())) return false;
|
|
21231
|
+
const [slotHour] = slotTime.split(":").map(Number);
|
|
21232
|
+
return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour;
|
|
21193
21233
|
}
|
|
21194
21234
|
function CalendarGrid({
|
|
21195
21235
|
weekStart,
|
|
@@ -21203,7 +21243,12 @@ function CalendarGrid({
|
|
|
21203
21243
|
longPressPayload,
|
|
21204
21244
|
swipeLeftEvent,
|
|
21205
21245
|
swipeRightEvent,
|
|
21206
|
-
dayWindow = "auto"
|
|
21246
|
+
dayWindow = "auto",
|
|
21247
|
+
titleField = "title",
|
|
21248
|
+
startField = "startTime",
|
|
21249
|
+
colorField = "color",
|
|
21250
|
+
children,
|
|
21251
|
+
renderItem
|
|
21207
21252
|
}) {
|
|
21208
21253
|
const evs = Array.isArray(events2) ? events2 : events2 ? [events2] : [];
|
|
21209
21254
|
const eventBus = useEventBus();
|
|
@@ -21218,8 +21263,8 @@ function CalendarGrid({
|
|
|
21218
21263
|
[resolvedWeekStart]
|
|
21219
21264
|
);
|
|
21220
21265
|
const resolvedTimeSlots = useMemo(
|
|
21221
|
-
() => timeSlots ?? generateDefaultTimeSlots(),
|
|
21222
|
-
[timeSlots]
|
|
21266
|
+
() => timeSlots ?? generateDefaultTimeSlots(evs, startField),
|
|
21267
|
+
[timeSlots, evs, startField]
|
|
21223
21268
|
);
|
|
21224
21269
|
const visibleCount = useDayWindow(dayWindow);
|
|
21225
21270
|
const [dayOffset, setDayOffset] = useState(0);
|
|
@@ -21256,9 +21301,9 @@ function CalendarGrid({
|
|
|
21256
21301
|
);
|
|
21257
21302
|
const eventsForDayCount = useCallback(
|
|
21258
21303
|
(day) => evs.filter(
|
|
21259
|
-
(ev) =>
|
|
21304
|
+
(ev) => eventStartDate(ev, startField).toDateString() === day.toDateString()
|
|
21260
21305
|
).length,
|
|
21261
|
-
[events2]
|
|
21306
|
+
[events2, startField]
|
|
21262
21307
|
);
|
|
21263
21308
|
const swipeCallbacks = useMemo(() => ({
|
|
21264
21309
|
onSwipeLeft: swipeLeftEvent ? () => eventBus.emit(`UI:${swipeLeftEvent}`, {}) : void 0,
|
|
@@ -21277,8 +21322,11 @@ function CalendarGrid({
|
|
|
21277
21322
|
eventBus.emit(`UI:${longPressEvent}`, { date: day.toISOString(), time, ...longPressPayload });
|
|
21278
21323
|
}, 500);
|
|
21279
21324
|
}, [longPressEvent, longPressPayload, eventBus]);
|
|
21325
|
+
const renderChip = children ?? renderItem;
|
|
21280
21326
|
const renderEvent = (event) => {
|
|
21281
|
-
const color = event
|
|
21327
|
+
const color = getNestedValue(event, colorField);
|
|
21328
|
+
const label = String(getNestedValue(event, titleField) ?? "");
|
|
21329
|
+
const eventIndex = evs.indexOf(event);
|
|
21282
21330
|
return /* @__PURE__ */ jsx(
|
|
21283
21331
|
Box,
|
|
21284
21332
|
{
|
|
@@ -21290,7 +21338,7 @@ function CalendarGrid({
|
|
|
21290
21338
|
color ? color : "bg-primary/10 border-primary/30 text-primary"
|
|
21291
21339
|
),
|
|
21292
21340
|
onClick: (e) => handleEventClick(event, e),
|
|
21293
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "small", className: "truncate font-medium", children:
|
|
21341
|
+
children: renderChip ? renderChip(event, eventIndex) : /* @__PURE__ */ jsx(Typography, { variant: "small", className: "truncate font-medium", children: label })
|
|
21294
21342
|
},
|
|
21295
21343
|
event.id
|
|
21296
21344
|
);
|
|
@@ -21374,7 +21422,7 @@ function CalendarGrid({
|
|
|
21374
21422
|
) }),
|
|
21375
21423
|
visibleDays.map((day) => {
|
|
21376
21424
|
const slotEvents = evs.filter(
|
|
21377
|
-
(ev) => eventInSlot(ev, day, time)
|
|
21425
|
+
(ev) => eventInSlot(ev, day, time, startField)
|
|
21378
21426
|
);
|
|
21379
21427
|
const isToday = day.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
21380
21428
|
return /* @__PURE__ */ jsx(
|
|
@@ -21406,11 +21454,12 @@ function CalendarGrid({
|
|
|
21406
21454
|
}
|
|
21407
21455
|
);
|
|
21408
21456
|
}
|
|
21409
|
-
var SHORT_DATE;
|
|
21457
|
+
var SHORT_DATE, DEFAULT_FIRST_HOUR, DEFAULT_LAST_HOUR, slotLabel;
|
|
21410
21458
|
var init_CalendarGrid = __esm({
|
|
21411
21459
|
"components/core/molecules/CalendarGrid.tsx"() {
|
|
21412
21460
|
"use client";
|
|
21413
21461
|
init_cn();
|
|
21462
|
+
init_getNestedValue();
|
|
21414
21463
|
init_Box();
|
|
21415
21464
|
init_Button();
|
|
21416
21465
|
init_Stack();
|
|
@@ -21421,35 +21470,12 @@ var init_CalendarGrid = __esm({
|
|
|
21421
21470
|
init_useEventBus();
|
|
21422
21471
|
init_useSwipeGesture();
|
|
21423
21472
|
SHORT_DATE = { month: "short", day: "numeric" };
|
|
21473
|
+
DEFAULT_FIRST_HOUR = 9;
|
|
21474
|
+
DEFAULT_LAST_HOUR = 17;
|
|
21475
|
+
slotLabel = (hour) => `${hour.toString().padStart(2, "0")}:00`;
|
|
21424
21476
|
CalendarGrid.displayName = "CalendarGrid";
|
|
21425
21477
|
}
|
|
21426
21478
|
});
|
|
21427
|
-
|
|
21428
|
-
// lib/getNestedValue.ts
|
|
21429
|
-
function getNestedValue(obj, path) {
|
|
21430
|
-
if (obj === null || obj === void 0 || !path) {
|
|
21431
|
-
return void 0;
|
|
21432
|
-
}
|
|
21433
|
-
if (!path.includes(".")) {
|
|
21434
|
-
return obj[path];
|
|
21435
|
-
}
|
|
21436
|
-
const parts = path.split(".");
|
|
21437
|
-
let value = obj;
|
|
21438
|
-
for (const part of parts) {
|
|
21439
|
-
if (value === null || value === void 0) {
|
|
21440
|
-
return void 0;
|
|
21441
|
-
}
|
|
21442
|
-
if (typeof value !== "object" || Array.isArray(value)) {
|
|
21443
|
-
return void 0;
|
|
21444
|
-
}
|
|
21445
|
-
value = value[part];
|
|
21446
|
-
}
|
|
21447
|
-
return value;
|
|
21448
|
-
}
|
|
21449
|
-
var init_getNestedValue = __esm({
|
|
21450
|
-
"lib/getNestedValue.ts"() {
|
|
21451
|
-
}
|
|
21452
|
-
});
|
|
21453
21479
|
var Pagination;
|
|
21454
21480
|
var init_Pagination = __esm({
|
|
21455
21481
|
"components/core/molecules/Pagination.tsx"() {
|
|
@@ -45757,6 +45783,13 @@ function MaybeTraitScope({
|
|
|
45757
45783
|
if (wrap) {
|
|
45758
45784
|
return /* @__PURE__ */ jsx(TraitScopeProvider, { orbital, trait: sourceTrait, children });
|
|
45759
45785
|
}
|
|
45786
|
+
if (sourceTrait !== void 0 && schemaCtx !== null) {
|
|
45787
|
+
scopeWrapLog.warn("decline", {
|
|
45788
|
+
sourceTrait,
|
|
45789
|
+
orbitalsByTraitSize: schemaCtx.orbitalsByTrait.size,
|
|
45790
|
+
reason: "sourceTrait not in orbitalsByTrait \u2014 children render unscoped"
|
|
45791
|
+
});
|
|
45792
|
+
}
|
|
45760
45793
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
45761
45794
|
}
|
|
45762
45795
|
function UISlotComponent({
|
|
@@ -46054,7 +46087,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
46054
46087
|
const childId = `${parentId}-${index}`;
|
|
46055
46088
|
const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
|
|
46056
46089
|
const childAsRecord = child;
|
|
46057
|
-
const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
|
|
46090
|
+
const { type: _childType, props: nestedProps, _id: _childNodeId, _sourceTrait: childSourceTrait, children: _childChildren, ...flatProps } = childAsRecord;
|
|
46058
46091
|
const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
|
|
46059
46092
|
if (_childChildren !== void 0 && nestedProps === void 0) {
|
|
46060
46093
|
resolvedProps.children = _childChildren;
|
|
@@ -46069,11 +46102,14 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
46069
46102
|
// (e.g. form-section inside a stack) can resolve entityDef via
|
|
46070
46103
|
// the trait's linkedEntity for form-field enrichment. The orbCtx
|
|
46071
46104
|
// (slot/transition/state/entity) propagates the same way so every
|
|
46072
|
-
// nested node carries a complete contextual-edit address.
|
|
46073
|
-
|
|
46105
|
+
// nested node carries a complete contextual-edit address. A child
|
|
46106
|
+
// carrying its own `_sourceTrait` (multi-source slot stack) owns it
|
|
46107
|
+
// outright — inheriting the synthetic wrapper's sentinel instead
|
|
46108
|
+
// would erase the real owner.
|
|
46109
|
+
...childSourceTrait !== void 0 ? { sourceTrait: childSourceTrait } : sourceTrait !== void 0 && { sourceTrait },
|
|
46074
46110
|
...orbCtx ?? {}
|
|
46075
46111
|
};
|
|
46076
|
-
|
|
46112
|
+
const renderedChild = /* @__PURE__ */ jsx(
|
|
46077
46113
|
SlotContentRenderer,
|
|
46078
46114
|
{
|
|
46079
46115
|
content: childContent,
|
|
@@ -46082,6 +46118,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
46082
46118
|
},
|
|
46083
46119
|
childId
|
|
46084
46120
|
);
|
|
46121
|
+
return childSourceTrait !== void 0 ? /* @__PURE__ */ jsx(MaybeTraitScope, { sourceTrait: childSourceTrait, children: renderedChild }, childId) : renderedChild;
|
|
46085
46122
|
});
|
|
46086
46123
|
}
|
|
46087
46124
|
function toDrawableNodes(children) {
|
|
@@ -51191,7 +51228,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
51191
51228
|
crossTraitLog.debug("listen:fired", { busKey, targetTrait: binding.trait.name, triggers: listen.triggers });
|
|
51192
51229
|
enqueueAndDrain(
|
|
51193
51230
|
listen.triggers,
|
|
51194
|
-
applyListenPayloadMapping(listen.payloadMapping, event.payload),
|
|
51231
|
+
applyListenPayloadMapping(listen.payloadMapping, event.payload, evaluateListenPayloadExpr),
|
|
51195
51232
|
binding.trait.name
|
|
51196
51233
|
);
|
|
51197
51234
|
});
|
|
@@ -14488,6 +14488,32 @@ var init_ButtonGroup = __esm({
|
|
|
14488
14488
|
exports.ButtonGroup.displayName = "ButtonGroup";
|
|
14489
14489
|
}
|
|
14490
14490
|
});
|
|
14491
|
+
|
|
14492
|
+
// lib/getNestedValue.ts
|
|
14493
|
+
function getNestedValue(obj, path) {
|
|
14494
|
+
if (obj === null || obj === void 0 || !path) {
|
|
14495
|
+
return void 0;
|
|
14496
|
+
}
|
|
14497
|
+
if (!path.includes(".")) {
|
|
14498
|
+
return obj[path];
|
|
14499
|
+
}
|
|
14500
|
+
const parts = path.split(".");
|
|
14501
|
+
let value = obj;
|
|
14502
|
+
for (const part of parts) {
|
|
14503
|
+
if (value === null || value === void 0) {
|
|
14504
|
+
return void 0;
|
|
14505
|
+
}
|
|
14506
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
14507
|
+
return void 0;
|
|
14508
|
+
}
|
|
14509
|
+
value = value[part];
|
|
14510
|
+
}
|
|
14511
|
+
return value;
|
|
14512
|
+
}
|
|
14513
|
+
var init_getNestedValue = __esm({
|
|
14514
|
+
"lib/getNestedValue.ts"() {
|
|
14515
|
+
}
|
|
14516
|
+
});
|
|
14491
14517
|
function useSwipeGesture(callbacks, options = {}) {
|
|
14492
14518
|
const { threshold = 50, velocityThreshold = 0.3, preventDefault = false } = options;
|
|
14493
14519
|
const startX = React74.useRef(0);
|
|
@@ -14601,17 +14627,31 @@ function getWeekDays(start) {
|
|
|
14601
14627
|
}
|
|
14602
14628
|
return days;
|
|
14603
14629
|
}
|
|
14604
|
-
function
|
|
14630
|
+
function eventStartDate(event, startField) {
|
|
14631
|
+
const raw = getNestedValue(event, startField);
|
|
14632
|
+
return new Date(raw ?? "");
|
|
14633
|
+
}
|
|
14634
|
+
function generateDefaultTimeSlots(events2, startField) {
|
|
14635
|
+
let first = DEFAULT_FIRST_HOUR;
|
|
14636
|
+
let last = DEFAULT_LAST_HOUR;
|
|
14637
|
+
for (const ev of events2) {
|
|
14638
|
+
const start = eventStartDate(ev, startField);
|
|
14639
|
+
if (Number.isNaN(start.getTime())) continue;
|
|
14640
|
+
const hour = start.getHours();
|
|
14641
|
+
if (hour < first) first = hour;
|
|
14642
|
+
if (hour > last) last = hour;
|
|
14643
|
+
}
|
|
14605
14644
|
const slots = [];
|
|
14606
|
-
for (let hour =
|
|
14607
|
-
slots.push(
|
|
14645
|
+
for (let hour = first; hour <= last; hour++) {
|
|
14646
|
+
slots.push(slotLabel(hour));
|
|
14608
14647
|
}
|
|
14609
14648
|
return slots;
|
|
14610
14649
|
}
|
|
14611
|
-
function eventInSlot(event, day, slotTime) {
|
|
14612
|
-
const eventStart =
|
|
14613
|
-
|
|
14614
|
-
|
|
14650
|
+
function eventInSlot(event, day, slotTime, startField) {
|
|
14651
|
+
const eventStart = eventStartDate(event, startField);
|
|
14652
|
+
if (Number.isNaN(eventStart.getTime())) return false;
|
|
14653
|
+
const [slotHour] = slotTime.split(":").map(Number);
|
|
14654
|
+
return eventStart.toDateString() === day.toDateString() && eventStart.getHours() === slotHour;
|
|
14615
14655
|
}
|
|
14616
14656
|
function CalendarGrid({
|
|
14617
14657
|
weekStart,
|
|
@@ -14625,7 +14665,12 @@ function CalendarGrid({
|
|
|
14625
14665
|
longPressPayload,
|
|
14626
14666
|
swipeLeftEvent,
|
|
14627
14667
|
swipeRightEvent,
|
|
14628
|
-
dayWindow = "auto"
|
|
14668
|
+
dayWindow = "auto",
|
|
14669
|
+
titleField = "title",
|
|
14670
|
+
startField = "startTime",
|
|
14671
|
+
colorField = "color",
|
|
14672
|
+
children,
|
|
14673
|
+
renderItem
|
|
14629
14674
|
}) {
|
|
14630
14675
|
const evs = Array.isArray(events2) ? events2 : events2 ? [events2] : [];
|
|
14631
14676
|
const eventBus = useEventBus();
|
|
@@ -14640,8 +14685,8 @@ function CalendarGrid({
|
|
|
14640
14685
|
[resolvedWeekStart]
|
|
14641
14686
|
);
|
|
14642
14687
|
const resolvedTimeSlots = React74.useMemo(
|
|
14643
|
-
() => timeSlots ?? generateDefaultTimeSlots(),
|
|
14644
|
-
[timeSlots]
|
|
14688
|
+
() => timeSlots ?? generateDefaultTimeSlots(evs, startField),
|
|
14689
|
+
[timeSlots, evs, startField]
|
|
14645
14690
|
);
|
|
14646
14691
|
const visibleCount = useDayWindow(dayWindow);
|
|
14647
14692
|
const [dayOffset, setDayOffset] = React74.useState(0);
|
|
@@ -14678,9 +14723,9 @@ function CalendarGrid({
|
|
|
14678
14723
|
);
|
|
14679
14724
|
const eventsForDayCount = React74.useCallback(
|
|
14680
14725
|
(day) => evs.filter(
|
|
14681
|
-
(ev) =>
|
|
14726
|
+
(ev) => eventStartDate(ev, startField).toDateString() === day.toDateString()
|
|
14682
14727
|
).length,
|
|
14683
|
-
[events2]
|
|
14728
|
+
[events2, startField]
|
|
14684
14729
|
);
|
|
14685
14730
|
const swipeCallbacks = React74.useMemo(() => ({
|
|
14686
14731
|
onSwipeLeft: swipeLeftEvent ? () => eventBus.emit(`UI:${swipeLeftEvent}`, {}) : void 0,
|
|
@@ -14699,8 +14744,11 @@ function CalendarGrid({
|
|
|
14699
14744
|
eventBus.emit(`UI:${longPressEvent}`, { date: day.toISOString(), time, ...longPressPayload });
|
|
14700
14745
|
}, 500);
|
|
14701
14746
|
}, [longPressEvent, longPressPayload, eventBus]);
|
|
14747
|
+
const renderChip = children ?? renderItem;
|
|
14702
14748
|
const renderEvent = (event) => {
|
|
14703
|
-
const color = event
|
|
14749
|
+
const color = getNestedValue(event, colorField);
|
|
14750
|
+
const label = String(getNestedValue(event, titleField) ?? "");
|
|
14751
|
+
const eventIndex = evs.indexOf(event);
|
|
14704
14752
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14705
14753
|
exports.Box,
|
|
14706
14754
|
{
|
|
@@ -14712,7 +14760,7 @@ function CalendarGrid({
|
|
|
14712
14760
|
color ? color : "bg-primary/10 border-primary/30 text-primary"
|
|
14713
14761
|
),
|
|
14714
14762
|
onClick: (e) => handleEventClick(event, e),
|
|
14715
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "small", className: "truncate font-medium", children:
|
|
14763
|
+
children: renderChip ? renderChip(event, eventIndex) : /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "small", className: "truncate font-medium", children: label })
|
|
14716
14764
|
},
|
|
14717
14765
|
event.id
|
|
14718
14766
|
);
|
|
@@ -14796,7 +14844,7 @@ function CalendarGrid({
|
|
|
14796
14844
|
) }),
|
|
14797
14845
|
visibleDays.map((day) => {
|
|
14798
14846
|
const slotEvents = evs.filter(
|
|
14799
|
-
(ev) => eventInSlot(ev, day, time)
|
|
14847
|
+
(ev) => eventInSlot(ev, day, time, startField)
|
|
14800
14848
|
);
|
|
14801
14849
|
const isToday = day.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
14802
14850
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14828,11 +14876,12 @@ function CalendarGrid({
|
|
|
14828
14876
|
}
|
|
14829
14877
|
);
|
|
14830
14878
|
}
|
|
14831
|
-
var SHORT_DATE;
|
|
14879
|
+
var SHORT_DATE, DEFAULT_FIRST_HOUR, DEFAULT_LAST_HOUR, slotLabel;
|
|
14832
14880
|
var init_CalendarGrid = __esm({
|
|
14833
14881
|
"components/core/molecules/CalendarGrid.tsx"() {
|
|
14834
14882
|
"use client";
|
|
14835
14883
|
init_cn();
|
|
14884
|
+
init_getNestedValue();
|
|
14836
14885
|
init_Box();
|
|
14837
14886
|
init_Button();
|
|
14838
14887
|
init_Stack();
|
|
@@ -14843,6 +14892,9 @@ var init_CalendarGrid = __esm({
|
|
|
14843
14892
|
init_useEventBus();
|
|
14844
14893
|
init_useSwipeGesture();
|
|
14845
14894
|
SHORT_DATE = { month: "short", day: "numeric" };
|
|
14895
|
+
DEFAULT_FIRST_HOUR = 9;
|
|
14896
|
+
DEFAULT_LAST_HOUR = 17;
|
|
14897
|
+
slotLabel = (hour) => `${hour.toString().padStart(2, "0")}:00`;
|
|
14846
14898
|
CalendarGrid.displayName = "CalendarGrid";
|
|
14847
14899
|
}
|
|
14848
14900
|
});
|
|
@@ -16441,32 +16493,6 @@ var init_Canvas = __esm({
|
|
|
16441
16493
|
Canvas.displayName = "Canvas";
|
|
16442
16494
|
}
|
|
16443
16495
|
});
|
|
16444
|
-
|
|
16445
|
-
// lib/getNestedValue.ts
|
|
16446
|
-
function getNestedValue(obj, path) {
|
|
16447
|
-
if (obj === null || obj === void 0 || !path) {
|
|
16448
|
-
return void 0;
|
|
16449
|
-
}
|
|
16450
|
-
if (!path.includes(".")) {
|
|
16451
|
-
return obj[path];
|
|
16452
|
-
}
|
|
16453
|
-
const parts = path.split(".");
|
|
16454
|
-
let value = obj;
|
|
16455
|
-
for (const part of parts) {
|
|
16456
|
-
if (value === null || value === void 0) {
|
|
16457
|
-
return void 0;
|
|
16458
|
-
}
|
|
16459
|
-
if (typeof value !== "object" || Array.isArray(value)) {
|
|
16460
|
-
return void 0;
|
|
16461
|
-
}
|
|
16462
|
-
value = value[part];
|
|
16463
|
-
}
|
|
16464
|
-
return value;
|
|
16465
|
-
}
|
|
16466
|
-
var init_getNestedValue = __esm({
|
|
16467
|
-
"lib/getNestedValue.ts"() {
|
|
16468
|
-
}
|
|
16469
|
-
});
|
|
16470
16496
|
exports.Pagination = void 0;
|
|
16471
16497
|
var init_Pagination = __esm({
|
|
16472
16498
|
"components/core/molecules/Pagination.tsx"() {
|
|
@@ -45409,6 +45435,13 @@ function MaybeTraitScope({
|
|
|
45409
45435
|
if (wrap) {
|
|
45410
45436
|
return /* @__PURE__ */ jsxRuntime.jsx(providers.TraitScopeProvider, { orbital, trait: sourceTrait, children });
|
|
45411
45437
|
}
|
|
45438
|
+
if (sourceTrait !== void 0 && schemaCtx !== null) {
|
|
45439
|
+
scopeWrapLog.warn("decline", {
|
|
45440
|
+
sourceTrait,
|
|
45441
|
+
orbitalsByTraitSize: schemaCtx.orbitalsByTrait.size,
|
|
45442
|
+
reason: "sourceTrait not in orbitalsByTrait \u2014 children render unscoped"
|
|
45443
|
+
});
|
|
45444
|
+
}
|
|
45412
45445
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
45413
45446
|
}
|
|
45414
45447
|
function UISlotComponent({
|
|
@@ -45706,7 +45739,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
45706
45739
|
const childId = `${parentId}-${index}`;
|
|
45707
45740
|
const childPath = parentPath === "root" ? `root.children.${index}` : `${parentPath}.children.${index}`;
|
|
45708
45741
|
const childAsRecord = child;
|
|
45709
|
-
const { type: _childType, props: nestedProps, _id: _childNodeId, children: _childChildren, ...flatProps } = childAsRecord;
|
|
45742
|
+
const { type: _childType, props: nestedProps, _id: _childNodeId, _sourceTrait: childSourceTrait, children: _childChildren, ...flatProps } = childAsRecord;
|
|
45710
45743
|
const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
|
|
45711
45744
|
if (_childChildren !== void 0 && nestedProps === void 0) {
|
|
45712
45745
|
resolvedProps.children = _childChildren;
|
|
@@ -45721,11 +45754,14 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
45721
45754
|
// (e.g. form-section inside a stack) can resolve entityDef via
|
|
45722
45755
|
// the trait's linkedEntity for form-field enrichment. The orbCtx
|
|
45723
45756
|
// (slot/transition/state/entity) propagates the same way so every
|
|
45724
|
-
// nested node carries a complete contextual-edit address.
|
|
45725
|
-
|
|
45757
|
+
// nested node carries a complete contextual-edit address. A child
|
|
45758
|
+
// carrying its own `_sourceTrait` (multi-source slot stack) owns it
|
|
45759
|
+
// outright — inheriting the synthetic wrapper's sentinel instead
|
|
45760
|
+
// would erase the real owner.
|
|
45761
|
+
...childSourceTrait !== void 0 ? { sourceTrait: childSourceTrait } : sourceTrait !== void 0 && { sourceTrait },
|
|
45726
45762
|
...orbCtx ?? {}
|
|
45727
45763
|
};
|
|
45728
|
-
|
|
45764
|
+
const renderedChild = /* @__PURE__ */ jsxRuntime.jsx(
|
|
45729
45765
|
SlotContentRenderer,
|
|
45730
45766
|
{
|
|
45731
45767
|
content: childContent,
|
|
@@ -45734,6 +45770,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
45734
45770
|
},
|
|
45735
45771
|
childId
|
|
45736
45772
|
);
|
|
45773
|
+
return childSourceTrait !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MaybeTraitScope, { sourceTrait: childSourceTrait, children: renderedChild }, childId) : renderedChild;
|
|
45737
45774
|
});
|
|
45738
45775
|
}
|
|
45739
45776
|
function toDrawableNodes(children) {
|
|
@@ -47282,9 +47319,10 @@ function aggregateSlot(sources) {
|
|
|
47282
47319
|
const entries = Object.entries(sources);
|
|
47283
47320
|
if (entries.length === 0) return null;
|
|
47284
47321
|
if (entries.length === 1) return entries[0][1];
|
|
47285
|
-
const children = entries.map(([, entry]) => ({
|
|
47322
|
+
const children = entries.map(([sourceKey, entry]) => ({
|
|
47286
47323
|
type: entry.pattern,
|
|
47287
|
-
...entry.props
|
|
47324
|
+
...entry.props,
|
|
47325
|
+
...sourceKey !== DEFAULT_SOURCE_KEY && { _sourceTrait: sourceKey }
|
|
47288
47326
|
}));
|
|
47289
47327
|
const stackId = `slot-content-stack-${entries.map(([k]) => k).join("-")}`;
|
|
47290
47328
|
return {
|
|
@@ -5307,8 +5307,34 @@ interface CalendarGridProps {
|
|
|
5307
5307
|
* layouts or screenshot tests).
|
|
5308
5308
|
*/
|
|
5309
5309
|
dayWindow?: CalendarDayWindow | 'auto';
|
|
5310
|
+
/**
|
|
5311
|
+
* Row field holding the chip label. Defaults to `title`. Lets a host bound
|
|
5312
|
+
* to its own entity name the column instead of being forced to rename its
|
|
5313
|
+
* fields to this grid's contract (same accessor idiom as `DataList`'s
|
|
5314
|
+
* `senderField` / `DataGrid`'s `imageField`).
|
|
5315
|
+
*/
|
|
5316
|
+
titleField?: string;
|
|
5317
|
+
/** Row field holding the start timestamp (ISO or epoch). Defaults to `startTime`. */
|
|
5318
|
+
startField?: string;
|
|
5319
|
+
/** Row field holding the chip's Tailwind colour class. Defaults to `color`. */
|
|
5320
|
+
colorField?: string;
|
|
5321
|
+
/**
|
|
5322
|
+
* Render function for one event chip's content. Receives the row and its
|
|
5323
|
+
* index in the materialised events array. The grid keeps ownership of
|
|
5324
|
+
* placement, colour and the click target; this replaces only what is drawn
|
|
5325
|
+
* INSIDE the chip, so a host can show a time + instructor + badge stack
|
|
5326
|
+
* instead of the default single label.
|
|
5327
|
+
*/
|
|
5328
|
+
children?: (item: EntityRow, index: number) => React__default.ReactNode;
|
|
5329
|
+
/**
|
|
5330
|
+
* Per-event render function (schema-level alias for the children render
|
|
5331
|
+
* prop). In `.orb`: `["fn", "item", { pattern tree with @item.field bindings }]`.
|
|
5332
|
+
* In `.lolo`: `renderItem: (fn item <Component …={@item.field}/>)` — the same
|
|
5333
|
+
* contract `data-list` / `data-grid` / `carousel` already use.
|
|
5334
|
+
*/
|
|
5335
|
+
renderItem?: (item: EntityRow, index: number) => React__default.ReactNode;
|
|
5310
5336
|
}
|
|
5311
|
-
declare function CalendarGrid({ weekStart, timeSlots, events, onSlotClick, onDayClick, onEventClick, className, longPressEvent, longPressPayload, swipeLeftEvent, swipeRightEvent, dayWindow, }: CalendarGridProps): React__default.JSX.Element;
|
|
5337
|
+
declare function CalendarGrid({ weekStart, timeSlots, events, onSlotClick, onDayClick, onEventClick, className, longPressEvent, longPressPayload, swipeLeftEvent, swipeRightEvent, dayWindow, titleField, startField, colorField, children, renderItem, }: CalendarGridProps): React__default.JSX.Element;
|
|
5312
5338
|
declare namespace CalendarGrid {
|
|
5313
5339
|
var displayName: string;
|
|
5314
5340
|
}
|
|
@@ -5307,8 +5307,34 @@ interface CalendarGridProps {
|
|
|
5307
5307
|
* layouts or screenshot tests).
|
|
5308
5308
|
*/
|
|
5309
5309
|
dayWindow?: CalendarDayWindow | 'auto';
|
|
5310
|
+
/**
|
|
5311
|
+
* Row field holding the chip label. Defaults to `title`. Lets a host bound
|
|
5312
|
+
* to its own entity name the column instead of being forced to rename its
|
|
5313
|
+
* fields to this grid's contract (same accessor idiom as `DataList`'s
|
|
5314
|
+
* `senderField` / `DataGrid`'s `imageField`).
|
|
5315
|
+
*/
|
|
5316
|
+
titleField?: string;
|
|
5317
|
+
/** Row field holding the start timestamp (ISO or epoch). Defaults to `startTime`. */
|
|
5318
|
+
startField?: string;
|
|
5319
|
+
/** Row field holding the chip's Tailwind colour class. Defaults to `color`. */
|
|
5320
|
+
colorField?: string;
|
|
5321
|
+
/**
|
|
5322
|
+
* Render function for one event chip's content. Receives the row and its
|
|
5323
|
+
* index in the materialised events array. The grid keeps ownership of
|
|
5324
|
+
* placement, colour and the click target; this replaces only what is drawn
|
|
5325
|
+
* INSIDE the chip, so a host can show a time + instructor + badge stack
|
|
5326
|
+
* instead of the default single label.
|
|
5327
|
+
*/
|
|
5328
|
+
children?: (item: EntityRow, index: number) => React__default.ReactNode;
|
|
5329
|
+
/**
|
|
5330
|
+
* Per-event render function (schema-level alias for the children render
|
|
5331
|
+
* prop). In `.orb`: `["fn", "item", { pattern tree with @item.field bindings }]`.
|
|
5332
|
+
* In `.lolo`: `renderItem: (fn item <Component …={@item.field}/>)` — the same
|
|
5333
|
+
* contract `data-list` / `data-grid` / `carousel` already use.
|
|
5334
|
+
*/
|
|
5335
|
+
renderItem?: (item: EntityRow, index: number) => React__default.ReactNode;
|
|
5310
5336
|
}
|
|
5311
|
-
declare function CalendarGrid({ weekStart, timeSlots, events, onSlotClick, onDayClick, onEventClick, className, longPressEvent, longPressPayload, swipeLeftEvent, swipeRightEvent, dayWindow, }: CalendarGridProps): React__default.JSX.Element;
|
|
5337
|
+
declare function CalendarGrid({ weekStart, timeSlots, events, onSlotClick, onDayClick, onEventClick, className, longPressEvent, longPressPayload, swipeLeftEvent, swipeRightEvent, dayWindow, titleField, startField, colorField, children, renderItem, }: CalendarGridProps): React__default.JSX.Element;
|
|
5312
5338
|
declare namespace CalendarGrid {
|
|
5313
5339
|
var displayName: string;
|
|
5314
5340
|
}
|