@algorisys/zen-ui-vanilla 13.11.0 → 13.11.2

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.
Files changed (81) hide show
  1. package/dist/_core/calendar-follow.d.ts +39 -0
  2. package/dist/_core/index.d.ts +1 -0
  3. package/dist/components/event-calendar/event-calendar.d.ts.map +1 -1
  4. package/dist/components/planning-calendar/planning-calendar.d.ts +5 -1
  5. package/dist/components/planning-calendar/planning-calendar.d.ts.map +1 -1
  6. package/dist/index112.js +174 -165
  7. package/dist/index112.js.map +1 -1
  8. package/dist/index113.js +149 -143
  9. package/dist/index113.js.map +1 -1
  10. package/dist/index114.js +1 -1
  11. package/dist/index115.js +1 -1
  12. package/dist/index116.js +1 -1
  13. package/dist/index118.js +2 -2
  14. package/dist/index120.js +2 -2
  15. package/dist/index168.js +1 -1
  16. package/dist/index175.js +1 -1
  17. package/dist/index187.js +1 -1
  18. package/dist/index191.js +1 -1
  19. package/dist/index194.js +2 -2
  20. package/dist/index199.js +1 -1
  21. package/dist/index231.js +1 -1
  22. package/dist/index232.js +7 -7
  23. package/dist/index232.js.map +1 -1
  24. package/dist/index233.js +7 -48
  25. package/dist/index233.js.map +1 -1
  26. package/dist/index234.js +45 -37
  27. package/dist/index234.js.map +1 -1
  28. package/dist/index235.js +38 -149
  29. package/dist/index235.js.map +1 -1
  30. package/dist/index236.js +138 -177
  31. package/dist/index236.js.map +1 -1
  32. package/dist/index237.js +190 -90
  33. package/dist/index237.js.map +1 -1
  34. package/dist/index238.js +90 -444
  35. package/dist/index238.js.map +1 -1
  36. package/dist/index239.js +436 -98
  37. package/dist/index239.js.map +1 -1
  38. package/dist/index240.js +106 -2
  39. package/dist/index240.js.map +1 -1
  40. package/dist/index241.js +2 -18804
  41. package/dist/index241.js.map +1 -1
  42. package/dist/index242.js +18798 -117
  43. package/dist/index242.js.map +1 -1
  44. package/dist/index243.js +122 -13
  45. package/dist/index243.js.map +1 -1
  46. package/dist/index244.js +13 -3012
  47. package/dist/index244.js.map +1 -1
  48. package/dist/index245.js +3006 -123
  49. package/dist/index245.js.map +1 -1
  50. package/dist/index246.js +125 -140
  51. package/dist/index246.js.map +1 -1
  52. package/dist/index247.js +138 -93
  53. package/dist/index247.js.map +1 -1
  54. package/dist/index248.js +91 -104
  55. package/dist/index248.js.map +1 -1
  56. package/dist/index249.js +95 -111
  57. package/dist/index249.js.map +1 -1
  58. package/dist/index250.js +127 -4
  59. package/dist/index250.js.map +1 -1
  60. package/dist/index251.js +5 -34
  61. package/dist/index251.js.map +1 -1
  62. package/dist/index252.js +34 -9
  63. package/dist/index252.js.map +1 -1
  64. package/dist/index253.js +10 -7
  65. package/dist/index253.js.map +1 -1
  66. package/dist/index254.js +6 -15
  67. package/dist/index254.js.map +1 -1
  68. package/dist/index255.js +15 -11
  69. package/dist/index255.js.map +1 -1
  70. package/dist/index256.js +11 -3
  71. package/dist/index256.js.map +1 -1
  72. package/dist/index257.js +7 -0
  73. package/dist/index257.js.map +1 -0
  74. package/dist/previews/analytic-chart.jpg +0 -0
  75. package/dist/previews/code-editor.jpg +0 -0
  76. package/dist/previews/countdown.jpg +0 -0
  77. package/dist/previews/loading.jpg +0 -0
  78. package/dist/previews/map.jpg +0 -0
  79. package/dist/previews/skeleton.jpg +0 -0
  80. package/package.json +1 -1
  81. package/skills/zen-ui/references/api/planning-calendar.md +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index113.js","sources":["../src/components/event-calendar/event-calendar.ts"],"sourcesContent":["import {\n eventCalendarRange,\n eventCalendarTitle,\n formatEventTimeRange,\n shiftEventCalendarAnchor,\n wallMinutes,\n type CalendarProposedSpan,\n type EventCalendarOptions,\n type EventCalendarView,\n} from \"@algorisys/zen-ui-core/event-calendar\";\nimport { eventHourPx, eventRowPx } from \"@algorisys/zen-ui-core/density\";\nimport { cn } from \"../../lib/cn\";\nimport { applyProps, Disposer, toNodes, type AnyZenComponent, type ZenComponent } from \"../../lib/component\";\nimport { Button } from \"../button/button\";\nimport { Icon } from \"../icon/icon\";\nimport { useLocale, type MessageKey } from \"../locale/locale\";\nimport { agenda } from \"./event-calendar-agenda\";\nimport {\n type CalendarContext,\n type CalendarEvent,\n type CalendarMemory,\n type CalendarPreview,\n type CalendarSlot,\n type CalendarViewHandle,\n el,\n type EventCalendarProps,\n type RenderScope,\n sameDay,\n} from \"./event-calendar-model\";\nimport { month } from \"./event-calendar-month\";\nimport { timeGrid } from \"./event-calendar-time-grid\";\nimport { registerMessages } from \"@algorisys/zen-ui-core/message-registry\";\nimport { CALENDAR_MESSAGES } from \"@algorisys/zen-ui-core/messages-calendar\";\n\n// This component's words live outside the base catalogue (see message-registry).\nregisterMessages(CALENDAR_MESSAGES);\n\nexport type {\n CalendarEvent,\n CalendarEventChange,\n CalendarEventRenderContext,\n CalendarEventState,\n CalendarEventVariant,\n CalendarSlot,\n EventCalendarProps,\n} from \"./event-calendar-model\";\n\n/**\n * EventCalendar — one person's or one team's calendar: a month page, week and\n * day time grids, and an agenda.\n *\n * const cal = EventCalendar({ events, onEventChange: (c) => { save(c); cal.update({ events: next }); } });\n * document.body.append(cal.el);\n *\n * Vanilla port of the React reference; same API, same output. It renders and\n * it proposes; it never edits: a drag (or Alt+arrow) calls `onEventChange`\n * with where the event would go, and nothing moves until you call\n * `update({ events })`. The maths and the drag gesture come from\n * @algorisys/zen-ui-core and are shared with every binding.\n *\n * The factory rebuilds its DOM when the data or the view changes, and nothing\n * else: a drag in progress, the slot cursor and the month's focused day update\n * the elements in place, so they keep focus and do not cost a rebuild per\n * frame. What must survive a rebuild (scroll position, cursor, focused day, an\n * open \"+N more\" panel, focus on the control the user was using) is carried\n * across it.\n */\n\nconst VIEW_LABEL: Record<EventCalendarView, MessageKey> = {\n month: \"eventCalendar.views.month\",\n week: \"eventCalendar.views.week\",\n workWeek: \"eventCalendar.views.workWeek\",\n day: \"eventCalendar.views.day\",\n agenda: \"eventCalendar.views.agenda\",\n};\n\nconst DEFAULT_VIEWS: EventCalendarView[] = [\"month\", \"week\", \"day\", \"agenda\"];\n\nlet uid = 0;\n\nexport function EventCalendar(props: EventCalendarProps): ZenComponent<EventCalendarProps> {\n let current: EventCalendarProps = { ...props };\n const loc = useLocale();\n const disposer = new Disposer();\n const hintId = `zen-event-calendar-${++uid}`;\n const views = () => (current.views?.length ? current.views : DEFAULT_VIEWS);\n\n /* Week unless the caller left week out of `views`, in which case the first\n view they did offer: opening on a view the switcher cannot show leaves no\n button pressed and no way back to it. */\n let innerView: EventCalendarView = props.defaultView ?? (views().includes(\"week\") ? \"week\" : views()[0]);\n let innerDate: Date = props.defaultDate ?? new Date();\n let preview: CalendarPreview | null = null;\n const memory: CalendarMemory = {};\n /** Focus to restore after the next rebuild: the control the user was on. */\n let pendingFocus: { id: string; part: \"main\" | \"checkbox\"; until: number } | null = null;\n\n const root = el(\"div\");\n root.setAttribute(\"role\", \"region\");\n root.setAttribute(\"data-cal-owner\", hintId);\n const toolbarHost = el(\"div\");\n const bodyHost = el(\"div\");\n const hint = el(\"span\", \"zen-sr-only\", loc.t(\"eventCalendar.editHint\"));\n hint.id = hintId;\n const slotHint = el(\"span\", \"zen-sr-only\", loc.t(\"eventCalendar.slotHint\"));\n slotHint.id = `${hintId}-slot`;\n // Kept across rebuilds, so an announcement is not dropped with the DOM it described.\n const live = el(\"div\", \"zen-sr-only\");\n live.setAttribute(\"aria-live\", \"polite\");\n live.setAttribute(\"aria-atomic\", \"true\");\n root.append(toolbarHost, bodyHost, hint, slotHint, live);\n\n let owned: AnyZenComponent[] = [];\n let cleanups: Array<() => void> = [];\n let viewHandle: CalendarViewHandle | null = null;\n let removeProps: (() => void) | undefined;\n\n const scope: RenderScope = {\n keep(component) {\n owned.push(component);\n return component;\n },\n on(node, type, listener) {\n node.addEventListener(type, listener as EventListener);\n cleanups.push(() => node.removeEventListener(type, listener as EventListener));\n },\n onRelease(cleanup) {\n cleanups.push(cleanup);\n },\n };\n const release = () => {\n for (const comp of owned) comp.destroy();\n owned = [];\n for (const off of cleanups) off();\n cleanups = [];\n };\n\n const viewOf = () => current.view ?? innerView;\n const dateOf = () => current.date ?? innerDate;\n const nowOf = () => current.now ?? clock;\n const optionsOf = (): EventCalendarOptions => ({\n weekStartsOn: current.weekStartsOn,\n nonWorkingDays: current.nonWorkingDays,\n agendaDays: current.agendaDays,\n locale: loc.locale,\n });\n\n const setView = (next: EventCalendarView) => {\n if (current.view === undefined) innerView = next;\n current.onViewChange?.(next);\n render();\n };\n const setDate = (next: Date) => {\n if (current.date === undefined) innerDate = next;\n current.onDateChange?.(next);\n render();\n };\n\n const timeLabel = (span: { start: Date; end: Date; allDay?: boolean }) =>\n span.allDay ? loc.t(\"eventCalendar.allDay\") : formatEventTimeRange(span.start, span.end, loc.locale);\n\n const announce = (text: string) => {\n // Cleared first so the same words twice in a row are still announced.\n live.textContent = \"\";\n requestAnimationFrame(() => {\n live.textContent = text;\n });\n };\n\n /* Looks in the calendar AND in the \"+N more\" panels it owns, which are\n portaled to <body>. */\n const restoreFocus = () => {\n const want = pendingFocus;\n if (!want) return;\n pendingFocus = null;\n if (Date.now() > want.until) return;\n const part = want.part === \"main\" ? \"[data-cal-event-main]\" : '[role=\"checkbox\"]';\n const selector = `[data-cal-owner=\"${hintId}\"] [data-cal-event=\"${CSS.escape(want.id)}\"] ${part}`;\n root.ownerDocument.querySelector<HTMLElement>(selector)?.focus({ preventScroll: want.part === \"checkbox\" });\n };\n\n /* The real clock, once a minute: the now line moves in place, and only a new\n day rebuilds (today's column changed). Not when the caller pins `now`. */\n let clock = new Date();\n const timer = setInterval(() => {\n if (current.now !== undefined) return;\n const before = clock;\n clock = new Date();\n if (!sameDay(before, clock)) {\n render();\n return;\n }\n for (const line of root.querySelectorAll<HTMLElement>(\"[data-cal-now]\")) {\n line.style.top = `${(wallMinutes(clock) / 1440) * 100}%`;\n }\n }, 60_000);\n disposer.add(() => clearInterval(timer));\n\n const context = (): CalendarContext => {\n const view = viewOf();\n const anchor = dateOf();\n const options = optionsOf();\n return {\n memory,\n props: current,\n loc,\n scope,\n view,\n anchor,\n now: nowOf(),\n options,\n hourPx: Math.max(24, eventHourPx(current.density, current.hourHeight)),\n rowPx: eventRowPx(current.density),\n snap: Math.max(1, current.snapMinutes ?? 15),\n root,\n hintId,\n preview,\n setPreview: (next) => {\n preview = next;\n viewHandle?.applyPreview(next);\n },\n editable: (event: CalendarEvent) =>\n current.onEventChange !== undefined && !event.readOnly && (current.canEditEvent?.(event) ?? true),\n selectable: current.onSlotSelect !== undefined,\n canGoToDay: views().includes(\"day\"),\n goToDay: (date: Date) => {\n if (current.date === undefined) innerDate = date;\n current.onDateChange?.(date);\n setView(\"day\");\n },\n setDate,\n openEvent: (event: CalendarEvent) => current.onEventClick?.(event),\n toggleTask: (event: CalendarEvent) => {\n // Set before the callback: a caller that calls update() at once rebuilds inside it.\n pendingFocus = { id: event.id, part: \"checkbox\", until: Date.now() + 1000 };\n current.onTaskToggle?.(event, !event.done);\n },\n selectSlot: (slot: CalendarSlot) => {\n current.onSlotSelect?.(slot);\n announce(loc.t(\"eventCalendar.newEvent\", { time: timeLabel(slot) }));\n },\n propose: (event: CalendarEvent, span: CalendarProposedSpan, kind: \"move\" | \"resize\", fromKeyboard: boolean) => {\n if (fromKeyboard) pendingFocus = { id: event.id, part: \"main\", until: Date.now() + 1000 };\n current.onEventChange?.({ event, start: span.start, end: span.end, allDay: span.allDay, kind });\n announce(loc.t(\"eventCalendar.proposed\", { title: event.title, time: timeLabel(span) }));\n if (fromKeyboard) {\n /* A keyboard move past the edge of the view follows the event, the\n way a drag would have had to: otherwise it vanishes, focus goes\n with it, and the user cannot see where it went. */\n const range = eventCalendarRange(view, anchor, options);\n if (view !== \"agenda\" && (span.start < range.start || span.start >= range.end)) setDate(span.start);\n else restoreFocus();\n }\n },\n timeLabel,\n announce,\n };\n };\n\n /**\n * Which control has focus, as a key that names the same control after a\n * rebuild (`data-cal-focus`). The factory rebuilds its DOM whenever the\n * caller passes new events, and without this every Enter on the slot cursor\n * or press of Next would drop a keyboard user's focus on <body>.\n */\n const focusedKey = (): string | null => {\n const active = root.ownerDocument.activeElement as HTMLElement | null;\n if (!active || !active.closest(`[data-cal-owner=\"${hintId}\"]`)) return null;\n return active.closest<HTMLElement>(\"[data-cal-focus]\")?.getAttribute(\"data-cal-focus\") ?? null;\n };\n const refocusKey = (key: string | null) => {\n if (!key) return;\n const active = root.ownerDocument.activeElement;\n if (active && active !== root.ownerDocument.body && root.contains(active)) return;\n root.ownerDocument\n .querySelector<HTMLElement>(`[data-cal-owner=\"${hintId}\"] [data-cal-focus=\"${CSS.escape(key)}\"]`)\n ?.focus({ preventScroll: true });\n };\n const tag = <T extends AnyZenComponent>(component: T, key: string): T => {\n (component.el as HTMLElement).setAttribute(\"data-cal-focus\", key);\n return component;\n };\n\n function toolbar(cal: CalendarContext): HTMLElement {\n const bar = el(\"div\", \"zen-flex zen-flex-wrap zen-items-center zen-gap-2\");\n const prev = scope.keep(\n Button({\n variant: \"outline\",\n size: \"sm\",\n \"aria-label\": loc.t(\"eventCalendar.previous\"),\n children: scope.keep(Icon({ name: \"chevron-left\", size: 14, class: \"rtl:zen-rotate-180\" })),\n onClick: () => setDate(shiftEventCalendarAnchor(cal.view, cal.anchor, -1, cal.options)),\n }),\n );\n const today = scope.keep(\n Button({ variant: \"outline\", size: \"sm\", children: loc.t(\"eventCalendar.today\"), onClick: () => setDate(cal.now) }),\n );\n const next = scope.keep(\n Button({\n variant: \"outline\",\n size: \"sm\",\n \"aria-label\": loc.t(\"eventCalendar.next\"),\n children: scope.keep(Icon({ name: \"chevron-right\", size: 14, class: \"rtl:zen-rotate-180\" })),\n onClick: () => setDate(shiftEventCalendarAnchor(cal.view, cal.anchor, 1, cal.options)),\n }),\n );\n // Announced, so a screen reader hears where Previous / Next landed. Not a\n // heading: the page decides its own heading levels.\n const title = el(\"span\", \"zen-mx-1 zen-text-base zen-font-semibold zen-text-zen-foreground\", eventCalendarTitle(cal.view, cal.anchor, cal.options));\n title.setAttribute(\"aria-live\", \"polite\");\n\n const end = el(\"div\", \"zen-ms-auto zen-flex zen-flex-wrap zen-items-center zen-gap-2\");\n end.append(...toNodes(current.toolbarActions));\n if (views().length > 1) {\n const switcher = el(\"div\", \"zen-flex zen-gap-1\");\n switcher.setAttribute(\"role\", \"group\");\n switcher.setAttribute(\"aria-label\", loc.t(\"eventCalendar.view\"));\n for (const v of views()) {\n const button = scope.keep(\n Button({\n variant: cal.view === v ? \"solid\" : \"outline\",\n size: \"sm\",\n \"aria-pressed\": String(cal.view === v),\n children: loc.t(VIEW_LABEL[v]),\n onClick: () => setView(v),\n }),\n );\n switcher.append(tag(button, `view:${v}`).el);\n }\n end.append(switcher);\n }\n tag(prev, \"tool:prev\");\n tag(today, \"tool:today\");\n tag(next, \"tool:next\");\n bar.append(prev.el, today.el, next.el, title, end);\n return bar;\n }\n\n function render(): void {\n const keep = focusedKey();\n release();\n const cal = context();\n\n const {\n events: _e,\n defaultView: _dv,\n view: _v,\n onViewChange: _ovc,\n views: _vs,\n defaultDate: _dd,\n date: _d,\n onDateChange: _odc,\n now: _n,\n weekStartsOn: _ws,\n nonWorkingDays: _nwd,\n workingHours: _wh,\n agendaDays: _ad,\n scrollToHour: _sth,\n hourHeight: _hh,\n density: _den,\n height: _h,\n snapMinutes: _sm,\n newEventMinutes: _nem,\n maxEventsPerDay: _med,\n onEventClick: _oec,\n onSlotSelect: _oss,\n onEventChange: _oech,\n canEditEvent: _cee,\n onTaskToggle: _ott,\n renderEvent: _re,\n eventClassName: _ecn,\n dayClassName: _dcn,\n headerClassName: _hcn,\n toolbarActions: _ta,\n hideToolbar: _ht,\n emptyMessage: _em,\n class: className,\n children: _children,\n ...rest\n } = current;\n root.className = cn(\"zen-flex zen-w-full zen-flex-col zen-gap-3\", className);\n root.setAttribute(\"aria-label\", loc.t(\"eventCalendar.calendar\"));\n\n toolbarHost.replaceChildren(...(current.hideToolbar ? [] : [toolbar(cal)]));\n toolbarHost.style.display = current.hideToolbar ? \"none\" : \"\";\n viewHandle = cal.view === \"month\" ? month(cal) : cal.view === \"agenda\" ? agenda(cal) : timeGrid(cal);\n bodyHost.replaceChildren(viewHandle.el);\n viewHandle.mounted?.();\n if (preview) viewHandle.applyPreview(preview);\n\n // Keyboard paging in the month moved to a day on another page: focus it there.\n if (cal.view === \"month\" && memory.focusDayAfterRender && memory.focusedDay) {\n memory.focusDayAfterRender = false;\n const d = memory.focusedDay;\n const key = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, \"0\")}-${String(d.getDate()).padStart(2, \"0\")}`;\n root.querySelector<HTMLElement>(`[data-cal-cell=\"${key}\"] [data-cal-daynum]`)?.focus();\n }\n refocusKey(keep);\n restoreFocus();\n\n removeProps?.();\n removeProps = applyProps(root, rest as Record<string, unknown>);\n }\n\n render();\n disposer.add(() => removeProps?.());\n disposer.add(release);\n\n return {\n el: root,\n update(next) {\n current = { ...current, ...next };\n render();\n },\n destroy() {\n disposer.dispose();\n root.remove();\n },\n };\n}\n"],"names":["registerMessages","CALENDAR_MESSAGES","VIEW_LABEL","DEFAULT_VIEWS","uid","EventCalendar","props","current","loc","useLocale","disposer","Disposer","hintId","views","innerView","innerDate","preview","memory","pendingFocus","root","el","toolbarHost","bodyHost","hint","slotHint","live","owned","cleanups","viewHandle","removeProps","scope","component","node","type","listener","cleanup","release","comp","off","viewOf","dateOf","nowOf","clock","optionsOf","setView","next","render","setDate","timeLabel","span","formatEventTimeRange","announce","text","restoreFocus","want","part","selector","timer","before","sameDay","line","wallMinutes","context","view","anchor","options","eventHourPx","eventRowPx","event","date","slot","kind","fromKeyboard","range","eventCalendarRange","focusedKey","active","refocusKey","key","tag","toolbar","cal","bar","prev","Button","Icon","shiftEventCalendarAnchor","today","title","eventCalendarTitle","end","toNodes","switcher","v","button","keep","_e","_dv","_v","_ovc","_vs","_dd","_d","_odc","_n","_ws","_nwd","_wh","_ad","_sth","_hh","_den","_h","_sm","_nem","_med","_oec","_oss","_oech","_cee","_ott","_re","_ecn","_dcn","_h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,EAAK,aAAa,cAAcX,EAAI,EAAE,wBAAwB,CAAC,GAE/Da,EAAY,gBAAgB,GAAId,EAAQ,cAAc,CAAA,IAAK,CAACyE,GAAQC,CAAG,CAAC,CAAE,GAC1E5D,EAAY,MAAM,UAAUd,EAAQ,cAAc,SAAS,IAC3DqB,IAAaqD,EAAI,SAAS,UAAUmD,GAAMnD,CAAG,IAAIA,EAAI,SAAS,WAAWoD,GAAOpD,CAAG,IAAIqD,GAASrD,CAAG,GACnG3D,EAAS,gBAAgBM,EAAW,EAAE,GACtCA,EAAW,UAAA,GACPZ,KAASY,EAAW,aAAaZ,CAAO,GAGxCiE,EAAI,SAAS,WAAWhE,EAAO,uBAAuBA,EAAO,YAAY;AAC3E,MAAAA,EAAO,sBAAsB;AAC7B,YAAMsH,IAAItH,EAAO,YACX6D,KAAM,GAAGyD,EAAE,YAAA,CAAa,IAAI,OAAOA,EAAE,SAAA,IAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAOA,EAAE,QAAA,CAAS,EAAE,SAAS,GAAG,GAAG,CAAC;AACnH,MAAApH,EAAK,cAA2B,mBAAmB2D,EAAG,sBAAsB,GAAG,MAAA;AAAA,IACjF;AACA,IAAAD,EAAWkB,CAAI,GACf1C,EAAA,GAEAxB,IAAA,GACAA,IAAc2G,GAAWrH,GAAM+G,EAA+B;AAAA,EAChE;AAEA,SAAApF,EAAA,GACApC,EAAS,IAAI,MAAMmB,KAAe,GAClCnB,EAAS,IAAI0B,CAAO,GAEb;AAAA,IACL,IAAIjB;AAAA,IACJ,OAAO0B,GAAM;AACX,MAAAtC,IAAU,EAAE,GAAGA,GAAS,GAAGsC,EAAA,GAC3BC,EAAA;AAAA,IACF;AAAA,IACA,UAAU;AACR,MAAApC,EAAS,QAAA,GACTS,EAAK,OAAA;AAAA,IACP;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"index113.js","sources":["../src/components/event-calendar/event-calendar.ts"],"sourcesContent":["import { calendarFollow, type PendingFollow } from \"@algorisys/zen-ui-core/calendar-follow\";\nimport {\n eventCalendarRange,\n eventCalendarTitle,\n formatEventTimeRange,\n shiftEventCalendarAnchor,\n wallMinutes,\n type CalendarProposedSpan,\n type EventCalendarOptions,\n type EventCalendarView,\n} from \"@algorisys/zen-ui-core/event-calendar\";\nimport { eventHourPx, eventRowPx } from \"@algorisys/zen-ui-core/density\";\nimport { cn } from \"../../lib/cn\";\nimport { applyProps, Disposer, toNodes, type AnyZenComponent, type ZenComponent } from \"../../lib/component\";\nimport { Button } from \"../button/button\";\nimport { Icon } from \"../icon/icon\";\nimport { useLocale, type MessageKey } from \"../locale/locale\";\nimport { agenda } from \"./event-calendar-agenda\";\nimport {\n type CalendarContext,\n type CalendarEvent,\n type CalendarMemory,\n type CalendarPreview,\n type CalendarSlot,\n type CalendarViewHandle,\n el,\n type EventCalendarProps,\n type RenderScope,\n sameDay,\n} from \"./event-calendar-model\";\nimport { month } from \"./event-calendar-month\";\nimport { timeGrid } from \"./event-calendar-time-grid\";\nimport { registerMessages } from \"@algorisys/zen-ui-core/message-registry\";\nimport { CALENDAR_MESSAGES } from \"@algorisys/zen-ui-core/messages-calendar\";\n\n// This component's words live outside the base catalogue (see message-registry).\nregisterMessages(CALENDAR_MESSAGES);\n\nexport type {\n CalendarEvent,\n CalendarEventChange,\n CalendarEventRenderContext,\n CalendarEventState,\n CalendarEventVariant,\n CalendarSlot,\n EventCalendarProps,\n} from \"./event-calendar-model\";\n\n/**\n * EventCalendar — one person's or one team's calendar: a month page, week and\n * day time grids, and an agenda.\n *\n * const cal = EventCalendar({ events, onEventChange: (c) => { save(c); cal.update({ events: next }); } });\n * document.body.append(cal.el);\n *\n * Vanilla port of the React reference; same API, same output. It renders and\n * it proposes; it never edits: a drag (or Alt+arrow) calls `onEventChange`\n * with where the event would go, and nothing moves until you call\n * `update({ events })`. The maths and the drag gesture come from\n * @algorisys/zen-ui-core and are shared with every binding.\n *\n * The factory rebuilds its DOM when the data or the view changes, and nothing\n * else: a drag in progress, the slot cursor and the month's focused day update\n * the elements in place, so they keep focus and do not cost a rebuild per\n * frame. What must survive a rebuild (scroll position, cursor, focused day, an\n * open \"+N more\" panel, focus on the control the user was using) is carried\n * across it.\n */\n\nconst VIEW_LABEL: Record<EventCalendarView, MessageKey> = {\n month: \"eventCalendar.views.month\",\n week: \"eventCalendar.views.week\",\n workWeek: \"eventCalendar.views.workWeek\",\n day: \"eventCalendar.views.day\",\n agenda: \"eventCalendar.views.agenda\",\n};\n\nconst DEFAULT_VIEWS: EventCalendarView[] = [\"month\", \"week\", \"day\", \"agenda\"];\n\nlet uid = 0;\n\nexport function EventCalendar(props: EventCalendarProps): ZenComponent<EventCalendarProps> {\n let current: EventCalendarProps = { ...props };\n const loc = useLocale();\n const disposer = new Disposer();\n const hintId = `zen-event-calendar-${++uid}`;\n const views = () => (current.views?.length ? current.views : DEFAULT_VIEWS);\n\n /* Week unless the caller left week out of `views`, in which case the first\n view they did offer: opening on a view the switcher cannot show leaves no\n button pressed and no way back to it. */\n let innerView: EventCalendarView = props.defaultView ?? (views().includes(\"week\") ? \"week\" : views()[0]);\n let innerDate: Date = props.defaultDate ?? new Date();\n let preview: CalendarPreview | null = null;\n const memory: CalendarMemory = {};\n /** Focus to restore after the next rebuild: the control the user was on. */\n let pendingFocus: { id: string; part: \"main\" | \"checkbox\"; until: number } | null = null;\n\n const root = el(\"div\");\n root.setAttribute(\"role\", \"region\");\n root.setAttribute(\"data-cal-owner\", hintId);\n const toolbarHost = el(\"div\");\n const bodyHost = el(\"div\");\n const hint = el(\"span\", \"zen-sr-only\", loc.t(\"eventCalendar.editHint\"));\n hint.id = hintId;\n const slotHint = el(\"span\", \"zen-sr-only\", loc.t(\"eventCalendar.slotHint\"));\n slotHint.id = `${hintId}-slot`;\n // Kept across rebuilds, so an announcement is not dropped with the DOM it described.\n const live = el(\"div\", \"zen-sr-only\");\n live.setAttribute(\"aria-live\", \"polite\");\n live.setAttribute(\"aria-atomic\", \"true\");\n root.append(toolbarHost, bodyHost, hint, slotHint, live);\n\n let owned: AnyZenComponent[] = [];\n let cleanups: Array<() => void> = [];\n let viewHandle: CalendarViewHandle | null = null;\n let removeProps: (() => void) | undefined;\n\n const scope: RenderScope = {\n keep(component) {\n owned.push(component);\n return component;\n },\n on(node, type, listener) {\n node.addEventListener(type, listener as EventListener);\n cleanups.push(() => node.removeEventListener(type, listener as EventListener));\n },\n onRelease(cleanup) {\n cleanups.push(cleanup);\n },\n };\n const release = () => {\n for (const comp of owned) comp.destroy();\n owned = [];\n for (const off of cleanups) off();\n cleanups = [];\n };\n\n const viewOf = () => current.view ?? innerView;\n const dateOf = () => current.date ?? innerDate;\n const nowOf = () => current.now ?? clock;\n const optionsOf = (): EventCalendarOptions => ({\n weekStartsOn: current.weekStartsOn,\n nonWorkingDays: current.nonWorkingDays,\n agendaDays: current.agendaDays,\n locale: loc.locale,\n });\n\n /* A keyboard move proposed and not yet seen applied (see `propose`; core's\n calendarFollow decides in update()). Any navigation by the user cancels\n it, so an old move never pulls the view away later; the follow itself uses\n moveTo, which leaves it alone. */\n let pending: PendingFollow | null = null;\n const setView = (next: EventCalendarView) => {\n pending = null;\n if (current.view === undefined) innerView = next;\n current.onViewChange?.(next);\n render();\n };\n const moveTo = (next: Date) => {\n if (current.date === undefined) innerDate = next;\n current.onDateChange?.(next);\n };\n const setDate = (next: Date) => {\n pending = null;\n moveTo(next);\n render();\n };\n\n const timeLabel = (span: { start: Date; end: Date; allDay?: boolean }) =>\n span.allDay ? loc.t(\"eventCalendar.allDay\") : formatEventTimeRange(span.start, span.end, loc.locale);\n\n const announce = (text: string) => {\n // Cleared first so the same words twice in a row are still announced.\n live.textContent = \"\";\n requestAnimationFrame(() => {\n live.textContent = text;\n });\n };\n\n /* Looks in the calendar AND in the \"+N more\" panels it owns, which are\n portaled to <body>. */\n const restoreFocus = () => {\n const want = pendingFocus;\n if (!want) return;\n pendingFocus = null;\n if (Date.now() > want.until) return;\n const part = want.part === \"main\" ? \"[data-cal-event-main]\" : '[role=\"checkbox\"]';\n const selector = `[data-cal-owner=\"${hintId}\"] [data-cal-event=\"${CSS.escape(want.id)}\"] ${part}`;\n root.ownerDocument.querySelector<HTMLElement>(selector)?.focus({ preventScroll: want.part === \"checkbox\" });\n };\n\n /* The real clock, once a minute: the now line moves in place, and only a new\n day rebuilds (today's column changed). Not when the caller pins `now`. */\n let clock = new Date();\n const timer = setInterval(() => {\n if (current.now !== undefined) return;\n const before = clock;\n clock = new Date();\n if (!sameDay(before, clock)) {\n render();\n return;\n }\n for (const line of root.querySelectorAll<HTMLElement>(\"[data-cal-now]\")) {\n line.style.top = `${(wallMinutes(clock) / 1440) * 100}%`;\n }\n }, 60_000);\n disposer.add(() => clearInterval(timer));\n\n const context = (): CalendarContext => {\n const view = viewOf();\n const anchor = dateOf();\n const options = optionsOf();\n return {\n memory,\n props: current,\n loc,\n scope,\n view,\n anchor,\n now: nowOf(),\n options,\n hourPx: Math.max(24, eventHourPx(current.density, current.hourHeight)),\n rowPx: eventRowPx(current.density),\n snap: Math.max(1, current.snapMinutes ?? 15),\n root,\n hintId,\n preview,\n setPreview: (next) => {\n preview = next;\n viewHandle?.applyPreview(next);\n },\n editable: (event: CalendarEvent) =>\n current.onEventChange !== undefined && !event.readOnly && (current.canEditEvent?.(event) ?? true),\n selectable: current.onSlotSelect !== undefined,\n canGoToDay: views().includes(\"day\"),\n goToDay: (date: Date) => {\n if (current.date === undefined) innerDate = date;\n current.onDateChange?.(date);\n setView(\"day\");\n },\n setDate,\n openEvent: (event: CalendarEvent) => current.onEventClick?.(event),\n toggleTask: (event: CalendarEvent) => {\n // Set before the callback: a caller that calls update() at once rebuilds inside it.\n pendingFocus = { id: event.id, part: \"checkbox\", until: Date.now() + 1000 };\n current.onTaskToggle?.(event, !event.done);\n },\n selectSlot: (slot: CalendarSlot) => {\n current.onSlotSelect?.(slot);\n announce(loc.t(\"eventCalendar.newEvent\", { time: timeLabel(slot) }));\n },\n propose: (event: CalendarEvent, span: CalendarProposedSpan, kind: \"move\" | \"resize\", fromKeyboard: boolean) => {\n if (fromKeyboard) pendingFocus = { id: event.id, part: \"main\", until: Date.now() + 1000 };\n /* A keyboard move past the edge of the view should take the view with\n it, or the event vanishes and focus with it. But only once the\n caller has APPLIED it: following the proposal at once left a refused\n move (a cancelled confirm) showing a week the event never went to.\n Decided by core's calendarFollow when update({ events }) arrives.\n Recorded BEFORE the callback: a caller that applies synchronously\n calls update() inside it. Same as Solid and React. */\n pending = fromKeyboard ? { id: event.id, from: event.start.getTime() } : null;\n current.onEventChange?.({ event, start: span.start, end: span.end, allDay: span.allDay, kind });\n announce(loc.t(\"eventCalendar.proposed\", { title: event.title, time: timeLabel(span) }));\n if (fromKeyboard) restoreFocus();\n },\n timeLabel,\n announce,\n };\n };\n\n /**\n * Which control has focus, as a key that names the same control after a\n * rebuild (`data-cal-focus`). The factory rebuilds its DOM whenever the\n * caller passes new events, and without this every Enter on the slot cursor\n * or press of Next would drop a keyboard user's focus on <body>.\n */\n const focusedKey = (): string | null => {\n const active = root.ownerDocument.activeElement as HTMLElement | null;\n if (!active || !active.closest(`[data-cal-owner=\"${hintId}\"]`)) return null;\n return active.closest<HTMLElement>(\"[data-cal-focus]\")?.getAttribute(\"data-cal-focus\") ?? null;\n };\n const refocusKey = (key: string | null) => {\n if (!key) return;\n const active = root.ownerDocument.activeElement;\n if (active && active !== root.ownerDocument.body && root.contains(active)) return;\n root.ownerDocument\n .querySelector<HTMLElement>(`[data-cal-owner=\"${hintId}\"] [data-cal-focus=\"${CSS.escape(key)}\"]`)\n ?.focus({ preventScroll: true });\n };\n const tag = <T extends AnyZenComponent>(component: T, key: string): T => {\n (component.el as HTMLElement).setAttribute(\"data-cal-focus\", key);\n return component;\n };\n\n function toolbar(cal: CalendarContext): HTMLElement {\n const bar = el(\"div\", \"zen-flex zen-flex-wrap zen-items-center zen-gap-2\");\n const prev = scope.keep(\n Button({\n variant: \"outline\",\n size: \"sm\",\n \"aria-label\": loc.t(\"eventCalendar.previous\"),\n children: scope.keep(Icon({ name: \"chevron-left\", size: 14, class: \"rtl:zen-rotate-180\" })),\n onClick: () => setDate(shiftEventCalendarAnchor(cal.view, cal.anchor, -1, cal.options)),\n }),\n );\n const today = scope.keep(\n Button({ variant: \"outline\", size: \"sm\", children: loc.t(\"eventCalendar.today\"), onClick: () => setDate(cal.now) }),\n );\n const next = scope.keep(\n Button({\n variant: \"outline\",\n size: \"sm\",\n \"aria-label\": loc.t(\"eventCalendar.next\"),\n children: scope.keep(Icon({ name: \"chevron-right\", size: 14, class: \"rtl:zen-rotate-180\" })),\n onClick: () => setDate(shiftEventCalendarAnchor(cal.view, cal.anchor, 1, cal.options)),\n }),\n );\n // Announced, so a screen reader hears where Previous / Next landed. Not a\n // heading: the page decides its own heading levels.\n const title = el(\"span\", \"zen-mx-1 zen-text-base zen-font-semibold zen-text-zen-foreground\", eventCalendarTitle(cal.view, cal.anchor, cal.options));\n title.setAttribute(\"aria-live\", \"polite\");\n\n const end = el(\"div\", \"zen-ms-auto zen-flex zen-flex-wrap zen-items-center zen-gap-2\");\n end.append(...toNodes(current.toolbarActions));\n if (views().length > 1) {\n const switcher = el(\"div\", \"zen-flex zen-gap-1\");\n switcher.setAttribute(\"role\", \"group\");\n switcher.setAttribute(\"aria-label\", loc.t(\"eventCalendar.view\"));\n for (const v of views()) {\n const button = scope.keep(\n Button({\n variant: cal.view === v ? \"solid\" : \"outline\",\n size: \"sm\",\n \"aria-pressed\": String(cal.view === v),\n children: loc.t(VIEW_LABEL[v]),\n onClick: () => setView(v),\n }),\n );\n switcher.append(tag(button, `view:${v}`).el);\n }\n end.append(switcher);\n }\n tag(prev, \"tool:prev\");\n tag(today, \"tool:today\");\n tag(next, \"tool:next\");\n bar.append(prev.el, today.el, next.el, title, end);\n return bar;\n }\n\n function render(): void {\n const keep = focusedKey();\n release();\n const cal = context();\n\n const {\n events: _e,\n defaultView: _dv,\n view: _v,\n onViewChange: _ovc,\n views: _vs,\n defaultDate: _dd,\n date: _d,\n onDateChange: _odc,\n now: _n,\n weekStartsOn: _ws,\n nonWorkingDays: _nwd,\n workingHours: _wh,\n agendaDays: _ad,\n scrollToHour: _sth,\n hourHeight: _hh,\n density: _den,\n height: _h,\n snapMinutes: _sm,\n newEventMinutes: _nem,\n maxEventsPerDay: _med,\n onEventClick: _oec,\n onSlotSelect: _oss,\n onEventChange: _oech,\n canEditEvent: _cee,\n onTaskToggle: _ott,\n renderEvent: _re,\n eventClassName: _ecn,\n dayClassName: _dcn,\n headerClassName: _hcn,\n toolbarActions: _ta,\n hideToolbar: _ht,\n emptyMessage: _em,\n class: className,\n children: _children,\n ...rest\n } = current;\n root.className = cn(\"zen-flex zen-w-full zen-flex-col zen-gap-3\", className);\n root.setAttribute(\"aria-label\", loc.t(\"eventCalendar.calendar\"));\n\n toolbarHost.replaceChildren(...(current.hideToolbar ? [] : [toolbar(cal)]));\n toolbarHost.style.display = current.hideToolbar ? \"none\" : \"\";\n viewHandle = cal.view === \"month\" ? month(cal) : cal.view === \"agenda\" ? agenda(cal) : timeGrid(cal);\n bodyHost.replaceChildren(viewHandle.el);\n viewHandle.mounted?.();\n if (preview) viewHandle.applyPreview(preview);\n\n // Keyboard paging in the month moved to a day on another page: focus it there.\n if (cal.view === \"month\" && memory.focusDayAfterRender && memory.focusedDay) {\n memory.focusDayAfterRender = false;\n const d = memory.focusedDay;\n const key = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, \"0\")}-${String(d.getDate()).padStart(2, \"0\")}`;\n root.querySelector<HTMLElement>(`[data-cal-cell=\"${key}\"] [data-cal-daynum]`)?.focus();\n }\n refocusKey(keep);\n restoreFocus();\n\n removeProps?.();\n removeProps = applyProps(root, rest as Record<string, unknown>);\n }\n\n render();\n disposer.add(() => removeProps?.());\n disposer.add(release);\n\n return {\n el: root,\n update(next) {\n current = { ...current, ...next };\n if (pending && next.events) {\n const view = viewOf();\n // The agenda is a list from a date, not a range to leave: it never follows.\n const decision =\n view === \"agenda\"\n ? { done: true, date: null }\n : calendarFollow(pending, next.events, eventCalendarRange(view, dateOf(), optionsOf()));\n if (decision.done) {\n pending = null;\n if (decision.date) moveTo(decision.date);\n }\n }\n // render() puts focus back on the moved event (pendingFocus), in view or not.\n render();\n },\n destroy() {\n disposer.dispose();\n root.remove();\n },\n };\n}\n"],"names":["registerMessages","CALENDAR_MESSAGES","VIEW_LABEL","DEFAULT_VIEWS","uid","EventCalendar","props","current","loc","useLocale","disposer","Disposer","hintId","views","innerView","innerDate","preview","memory","pendingFocus","root","el","toolbarHost","bodyHost","hint","slotHint","live","owned","cleanups","viewHandle","removeProps","scope","component","node","type","listener","cleanup","release","comp","off","viewOf","dateOf","nowOf","clock","optionsOf","pending","setView","next","render","moveTo","setDate","timeLabel","span","formatEventTimeRange","announce","text","restoreFocus","want","part","selector","timer","before","sameDay","line","wallMinutes","context","view","anchor","options","eventHourPx","eventRowPx","event","date","slot","kind","fromKeyboard","focusedKey","active","refocusKey","key","tag","toolbar","cal","bar","prev","Button","Icon","shiftEventCalendarAnchor","today","title","eventCalendarTitle","end","toNodes","switcher","v","button","keep","_e","_dv","_v","_ovc","_vs","_dd","_d","_odc","_n","_ws","_nwd","_wh","_ad","_sth","_hh","_den","_h","_sm","_nem","_med","_oec","_oss","_oech","_cee","_ott","_re","_ecn","_dcn","_hcn","_ta","_ht","_em","className","_children","rest","cn","month","agenda","timeGrid","d","applyProps","decision","calendarFollow","eventCalendarRange"],"mappings":";;;;;;;;;;;;;;AAoCAA,GAAiBC,EAAiB;AAiClC,MAAMC,KAAoD;AAAA,EACxD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,UAAU;AAAA,EACV,KAAK;AAAA,EACL,QAAQ;AACV,GAEMC,KAAqC,CAAC,SAAS,QAAQ,OAAO,QAAQ;AAE5E,IAAIC,KAAM;AAEH,SAASC,GAAcC,GAA6D;AACzF,MAAIC,IAA8B,EAAE,GAAGD,EAAA;AACvC,QAAME,IAAMC,GAAA,GACNC,IAAW,IAAIC,GAAA,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,GACPZ,KAASY,EAAW,aAAaZ,CAAO,GAGxCiE,EAAI,SAAS,WAAWhE,EAAO,uBAAuBA,EAAO,YAAY;AAC3E,MAAAA,EAAO,sBAAsB;AAC7B,YAAMsH,IAAItH,EAAO,YACX6D,KAAM,GAAGyD,EAAE,YAAA,CAAa,IAAI,OAAOA,EAAE,SAAA,IAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAOA,EAAE,QAAA,CAAS,EAAE,SAAS,GAAG,GAAG,CAAC;AACnH,MAAApH,EAAK,cAA2B,mBAAmB2D,EAAG,sBAAsB,GAAG,MAAA;AAAA,IACjF;AACA,IAAAD,GAAWkB,CAAI,GACfxC,EAAA,GAEA1B,IAAA,GACAA,IAAc2G,GAAWrH,GAAM+G,EAA+B;AAAA,EAChE;AAEA,SAAAnF,EAAA,GACArC,EAAS,IAAI,MAAMmB,KAAe,GAClCnB,EAAS,IAAI0B,CAAO,GAEb;AAAA,IACL,IAAIjB;AAAA,IACJ,OAAO2B,GAAM;AAEX,UADAvC,IAAU,EAAE,GAAGA,GAAS,GAAGuC,EAAA,GACvBF,KAAWE,EAAK,QAAQ;AAC1B,cAAMmB,IAAO1B,EAAA,GAEPkG,IACJxE,MAAS,WACL,EAAE,MAAM,IAAM,MAAM,KAAA,IACpByE,GAAe9F,GAASE,EAAK,QAAQ6F,GAAmB1E,GAAMzB,KAAUG,EAAA,CAAW,CAAC;AAC1F,QAAI8F,EAAS,SACX7F,IAAU,MACN6F,EAAS,QAAMzF,EAAOyF,EAAS,IAAI;AAAA,MAE3C;AAEA,MAAA1F,EAAA;AAAA,IACF;AAAA,IACA,UAAU;AACR,MAAArC,EAAS,QAAA,GACTS,EAAK,OAAA;AAAA,IACP;AAAA,EAAA;AAEJ;"}
package/dist/index114.js CHANGED
@@ -6,7 +6,7 @@ import { RadioGroup as H, RadioGroupItem as L } from "./index52.js";
6
6
  import { Select as ie } from "./index17.js";
7
7
  import { useLocale as de } from "./index31.js";
8
8
  import { registerMessages as me } from "./index212.js";
9
- import { CALENDAR_MESSAGES as fe } from "./index237.js";
9
+ import { CALENDAR_MESSAGES as fe } from "./index238.js";
10
10
  import { cn as K } from "./index194.js";
11
11
  me(fe);
12
12
  const W = {
package/dist/index115.js CHANGED
@@ -6,7 +6,7 @@ import { Select as F } from "./index17.js";
6
6
  import { Icon as T } from "./index6.js";
7
7
  import { useLocale as Q } from "./index31.js";
8
8
  import { registerMessages as W } from "./index212.js";
9
- import { CALENDAR_MESSAGES as X } from "./index237.js";
9
+ import { CALENDAR_MESSAGES as X } from "./index238.js";
10
10
  import { cn as Y } from "./index194.js";
11
11
  W(X);
12
12
  const Z = ["minutes", "hours", "days", "weeks"], ee = {
package/dist/index116.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { parseRRule as M, formatRRule as s } from "./index117.js";
2
2
  import { registerMessages as k } from "./index212.js";
3
- import { CALENDAR_MESSAGES as E } from "./index237.js";
3
+ import { CALENDAR_MESSAGES as E } from "./index238.js";
4
4
  k(E);
5
5
  const f = (n) => new Date(n.getFullYear(), n.getMonth() + 1, 0).getDate(), h = (n, t, r) => Math.min(r, Math.max(t, Number.isFinite(n) ? Math.round(n) : t)), Y = 99, b = 999;
6
6
  function R(n) {
package/dist/index118.js CHANGED
@@ -4,7 +4,7 @@ import "./index169.js";
4
4
  import { nowPct as it, placeAppointment as et } from "./index230.js";
5
5
  import "./index116.js";
6
6
  import { flattenGanttTasks as Gt, ganttConnectors as jt, ganttFitRange as Vt, ganttLegendItems as Xt, GANTT_STATUS_COLOR as Ut, formatGanttVariance as Qt, ganttActualLayout as $t, ganttLabelFits as rt, ganttLabelPx as ct, ganttMilestoneLayout as qt } from "./index119.js";
7
- import { ganttBarPx as Yt, scheduleRowPx as Jt } from "./index232.js";
7
+ import { ganttBarPx as Yt, scheduleRowPx as Jt } from "./index233.js";
8
8
  import { AvatarGroup as Kt, Avatar as Zt, AvatarImage as te, AvatarFallback as ee } from "./index24.js";
9
9
  import { Badge as St } from "./index5.js";
10
10
  import { EmptyState as ne, EmptyStateIcon as ae, EmptyStateTitle as se, EmptyStateDescription as oe } from "./index37.js";
@@ -12,7 +12,7 @@ import { Icon as Ct } from "./index6.js";
12
12
  import { Skeleton as dt } from "./index25.js";
13
13
  import { Tooltip as le } from "./index59.js";
14
14
  import { toNodes as ie } from "./index195.js";
15
- import { resolveScheduleAxis as re, INDENT_PX as Tt, ScheduleGrid as ce } from "./index238.js";
15
+ import { resolveScheduleAxis as re, INDENT_PX as Tt, ScheduleGrid as ce } from "./index239.js";
16
16
  import { withLocale as de, useLocale as ue } from "./index31.js";
17
17
  const ut = {
18
18
  name: 180,
package/dist/index120.js CHANGED
@@ -7,7 +7,7 @@ import "./index116.js";
7
7
  import { ganttConnectors as Ce, ganttFitRange as Ae } from "./index119.js";
8
8
  import { flattenProductionResources as Le, productionLoad as ae, productionSequenceConflicts as Pe, productionLateMs as Ee } from "./index121.js";
9
9
  import { durationMessage as Te } from "./index129.js";
10
- import { laneBarPx as ie, scheduleRowPx as $e } from "./index232.js";
10
+ import { laneBarPx as ie, scheduleRowPx as $e } from "./index233.js";
11
11
  import { PRODUCTION_DRAG_TYPE as ce, snapToMinutes as Ie, productionReschedule as ke } from "./index122.js";
12
12
  import { productionCriticalPath as De } from "./index162.js";
13
13
  import { Badge as de } from "./index5.js";
@@ -15,7 +15,7 @@ import { EmptyState as Oe, EmptyStateIcon as Re, EmptyStateTitle as Fe, EmptySta
15
15
  import { Icon as Y } from "./index6.js";
16
16
  import { Skeleton as j } from "./index25.js";
17
17
  import { toNodes as le } from "./index195.js";
18
- import { resolveScheduleAxis as _e, INDENT_PX as ue, ScheduleGrid as We } from "./index238.js";
18
+ import { resolveScheduleAxis as _e, INDENT_PX as ue, ScheduleGrid as We } from "./index239.js";
19
19
  import { withLocale as Be, useLocale as Xe } from "./index31.js";
20
20
  const J = {
21
21
  resource: 180,
package/dist/index168.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { fieldLabel as me, isFilterActive as ne, PIVOT_ZONES as fe, defaultAggregationForField as be, availableFields as ge, hasActiveFilters as he, isLayoutRenderable as ve, createEmptyLayout as ze, updateValueAggregation as xe, moveFieldToZone as ye, isValueSelected as we } from "./index170.js";
2
- import { prunePivotFilterWindows as Ce, VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS as pe, pivotFilterMissingWindowStarts as Ee, pickNearestWindowStart as Le, alignWindowStart as ke, PIVOT_FILTER_LEADING_OVERSCAN_SLACK as ue, pivotFilterWindowValueAt as Se, VIRTUAL_SCROLL_WINDOW_PAGE_SIZE as Ae } from "./index239.js";
2
+ import { prunePivotFilterWindows as Ce, VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS as pe, pivotFilterMissingWindowStarts as Ee, pickNearestWindowStart as Le, alignWindowStart as ke, PIVOT_FILTER_LEADING_OVERSCAN_SLACK as ue, pivotFilterWindowValueAt as Se, VIRTUAL_SCROLL_WINDOW_PAGE_SIZE as Ae } from "./index240.js";
3
3
  import { Disposer as K, toNodes as ie } from "./index195.js";
4
4
  import { Alert as Ne, AlertIcon as Ie, AlertContent as Re, AlertTitle as Te, AlertDescription as Fe } from "./index23.js";
5
5
  import { Badge as De } from "./index5.js";
package/dist/index175.js CHANGED
@@ -41,7 +41,7 @@ function R(k) {
41
41
  const x = async () => {
42
42
  let n;
43
43
  try {
44
- const b = await import("./index240.js"), g = b.default ?? b;
44
+ const b = await import("./index241.js"), g = b.default ?? b;
45
45
  e.loaderConfig && g.config(e.loaderConfig), n = await g.init();
46
46
  } catch {
47
47
  m = "missing", h();
package/dist/index187.js CHANGED
@@ -78,7 +78,7 @@ function et(E) {
78
78
  x = "loading", p();
79
79
  let c;
80
80
  try {
81
- c = await import("./index241.js");
81
+ c = await import("./index242.js");
82
82
  } catch {
83
83
  if (o !== f) return;
84
84
  U("This is a PDF, and pdfjs-dist is not installed. Add it to render PDFs.");
package/dist/index191.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ariaKeyshortcut as _, parseChord as P, chordLabel as S, chordParts as j, isTypingTarget as B, matchesChord as T, isReservedChord as I, sameChord as M } from "./index242.js";
1
+ import { ariaKeyshortcut as _, parseChord as P, chordLabel as S, chordParts as j, isTypingTarget as B, matchesChord as T, isReservedChord as I, sameChord as M } from "./index243.js";
2
2
  import { Disposer as K, applyProps as L, setChildren as R } from "./index195.js";
3
3
  import { Dialog as F } from "./index10.js";
4
4
  import { useLocale as G } from "./index31.js";
package/dist/index194.js CHANGED
@@ -1,5 +1,5 @@
1
- import { clsx as r } from "./index243.js";
2
- import { extendTailwindMerge as c } from "./index244.js";
1
+ import { clsx as r } from "./index244.js";
2
+ import { extendTailwindMerge as c } from "./index245.js";
3
3
  import { zenUnoTheme as e, ZEN_PREFIX as i } from "./index210.js";
4
4
  const m = new RegExp(`^(-?)${i}(.*)$`), d = Object.keys(e.borderRadius), b = Object.keys(e.boxShadow), p = /* @__PURE__ */ new Map([["outline", "outline-solid"]]), l = c({
5
5
  // The density keys are spacing, so `zen-h-zen-control` and a caller's
package/dist/index199.js CHANGED
@@ -1,4 +1,4 @@
1
- import { clsx as O } from "./index243.js";
1
+ import { clsx as O } from "./index244.js";
2
2
  const m = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, y = O, j = (e, l) => (n) => {
3
3
  var s;
4
4
  if (l?.variants == null) return y(e, n?.class, n?.className);
package/dist/index231.js CHANGED
@@ -1,4 +1,4 @@
1
- import { LONG_PRESS_MS as U } from "./index246.js";
1
+ import { LONG_PRESS_MS as U } from "./index247.js";
2
2
  import { planningTimeAt as O, planningPointerMove as K } from "./index230.js";
3
3
  const j = 3, z = 8, m = 40, G = 14;
4
4
  function H(t, n, o) {
package/dist/index232.js CHANGED
@@ -1,10 +1,10 @@
1
- const t = { compact: 28, comfortable: 36, touch: 48 }, a = { compact: 14, comfortable: 18, touch: 32 }, e = { compact: 12, comfortable: 16, touch: 32 }, m = { compact: 24, comfortable: 30, touch: 54 }, n = { compact: 36, comfortable: 48, touch: 64 }, r = { compact: 20, comfortable: 24, touch: 44 }, l = (o = "comfortable", c) => c ?? t[o], s = (o = "comfortable") => a[o], b = (o = "comfortable") => e[o], f = (o = "comfortable", c) => c ?? m[o], E = (o = "comfortable", c) => c ?? n[o], u = (o = "comfortable") => r[o];
1
+ function u(n, r, o) {
2
+ const t = r.find((d) => d.id === n.id);
3
+ if (!t) return { done: !0, date: null };
4
+ const e = t.start.getTime();
5
+ return e === n.from ? { done: !1, date: null } : { done: !0, date: e < o.start.getTime() || e >= o.end.getTime() ? t.start : null };
6
+ }
2
7
  export {
3
- f as calendarLanePx,
4
- E as eventHourPx,
5
- u as eventRowPx,
6
- s as ganttBarPx,
7
- b as laneBarPx,
8
- l as scheduleRowPx
8
+ u as calendarFollow
9
9
  };
10
10
  //# sourceMappingURL=index232.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index232.js","sources":["../../core/src/density.ts"],"sourcesContent":["/**\n * Component density — the opt-in `density` prop on the schedules,\n * PlanningCalendar, SpreadsheetGrid and Tree.\n *\n * bun run check:density\n *\n * The same three names as the `data-density` tokens (tokens.css). This is a\n * PROP rather than a reading of that attribute on purpose: these components\n * never followed data-density, and starting to would reflow every app that\n * already sets data-density=\"touch\" for its controls. A prop changes only the\n * component it is set on.\n *\n * \"comfortable\" is the default and is exactly the size each component always\n * drew. \"touch\" reaches 48px targets, like data-density=\"touch\" for controls.\n * An explicit size (rowHeight, laneHeight) wins over density. The classes for\n * SpreadsheetGrid and Tree live in variants.ts, which Uno scans.\n */\n\nexport type Density = \"compact\" | \"comfortable\" | \"touch\";\nexport const DENSITIES: readonly Density[] = [\"compact\", \"comfortable\", \"touch\"];\n\nconst SCHEDULE_ROW: Record<Density, number> = { compact: 28, comfortable: 36, touch: 48 };\nconst GANTT_BAR: Record<Density, number> = { compact: 14, comfortable: 18, touch: 32 };\nconst LANE_BAR: Record<Density, number> = { compact: 12, comfortable: 16, touch: 32 };\n// A calendar block is its lane less 6px: touch's 54 makes a 48px block.\nconst CALENDAR_LANE: Record<Density, number> = { compact: 24, comfortable: 30, touch: 54 };\n// EventCalendar: one hour of the time grid, and one row of a month cell or the\n// all-day strip. Touch's row is 44, the smallest target WCAG's AAA level allows,\n// rather than 48: a month cell must still fit several of them.\nconst EVENT_HOUR: Record<Density, number> = { compact: 36, comfortable: 48, touch: 64 };\nconst EVENT_ROW: Record<Density, number> = { compact: 20, comfortable: 24, touch: 44 };\n\n/** A Gantt row, or ProductionSchedule's least row height. */\nexport const scheduleRowPx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? SCHEDULE_ROW[density];\n/** A Gantt bar's height. */\nexport const ganttBarPx = (density: Density = \"comfortable\"): number => GANTT_BAR[density];\n/** One lane's bar in ProductionSchedule. */\nexport const laneBarPx = (density: Density = \"comfortable\"): number => LANE_BAR[density];\n/** A PlanningCalendar lane. */\nexport const calendarLanePx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? CALENDAR_LANE[density];\n/** One hour of EventCalendar's time grid. */\nexport const eventHourPx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? EVENT_HOUR[density];\n/** One event row in an EventCalendar month cell or all-day strip. */\nexport const eventRowPx = (density: Density = \"comfortable\"): number => EVENT_ROW[density];\n"],"names":["SCHEDULE_ROW","GANTT_BAR","LANE_BAR","CALENDAR_LANE","EVENT_HOUR","EVENT_ROW","scheduleRowPx","density","explicit","ganttBarPx","laneBarPx","calendarLanePx","eventHourPx","eventRowPx"],"mappings":"AAqBA,MAAMA,IAAwC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC/EC,IAAqC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC5EC,IAAoC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAE3EC,IAAyC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAIhFC,IAAsC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC7EC,IAAqC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAGrEC,IAAgB,CAACC,IAAmB,eAAeC,MAC9DA,KAAYR,EAAaO,CAAO,GAErBE,IAAa,CAACF,IAAmB,kBAA0BN,EAAUM,CAAO,GAE5EG,IAAY,CAACH,IAAmB,kBAA0BL,EAASK,CAAO,GAE1EI,IAAiB,CAACJ,IAAmB,eAAeC,MAC/DA,KAAYL,EAAcI,CAAO,GAEtBK,IAAc,CAACL,IAAmB,eAAeC,MAC5DA,KAAYJ,EAAWG,CAAO,GAEnBM,IAAa,CAACN,IAAmB,kBAA0BF,EAAUE,CAAO;"}
1
+ {"version":3,"file":"index232.js","sources":["../../core/src/calendar-follow.ts"],"sourcesContent":["/**\n * When a keyboard move should take the view with it — for PlanningCalendar and\n * EventCalendar alike.\n *\n * Alt+arrow on an item at the edge of the view proposes a time outside it. The\n * calendars used to move the view to the proposal AT ONCE. But they only\n * propose: the caller may confirm, refuse, or ask first. A refused move left\n * the user looking at a week the item never went to (measured in a CRM with a\n * confirm dialog: Cancel, and the view was a week away from the project).\n *\n * So the view follows the item only once the caller has APPLIED the move,\n * which is visible the only way the calendar can see it: the item's start in\n * the next `rows` / `events` is no longer where it was when the move was\n * proposed. It then follows to where the item ACTUALLY is, which may differ\n * from the proposal if the caller adjusted it (a server snapping to a slot).\n *\n * Pure, so four renderers make the same call. Pinned by scripts/check-planning.ts.\n */\n\n/** A keyboard move proposed and not yet seen applied. */\nexport interface PendingFollow {\n id: string;\n /** The item's start, in ms, when the move was proposed. */\n from: number;\n}\n\nexport interface CalendarFollowRange {\n start: Date;\n /** Exclusive. */\n end: Date;\n}\n\nexport interface CalendarFollowDecision {\n /** The move has been applied (or can no longer be): forget the pending follow. */\n done: boolean;\n /** Move the view here. Null: stay — not applied yet, or applied inside the view. */\n date: Date | null;\n}\n\nexport function calendarFollow(\n pending: PendingFollow,\n items: readonly { id: string; start: Date }[],\n range: CalendarFollowRange,\n): CalendarFollowDecision {\n const item = items.find((i) => i.id === pending.id);\n // Gone (deleted, or filtered out): there is nothing to follow, now or later.\n if (!item) return { done: true, date: null };\n const at = item.start.getTime();\n // Still where it was: not applied yet. A confirm dialog may still be open.\n if (at === pending.from) return { done: false, date: null };\n const outside = at < range.start.getTime() || at >= range.end.getTime();\n return { done: true, date: outside ? item.start : null };\n}\n"],"names":["calendarFollow","pending","items","range","item","i","at"],"mappings":"AAuCO,SAASA,EACdC,GACAC,GACAC,GACwB;AACxB,QAAMC,IAAOF,EAAM,KAAK,CAACG,MAAMA,EAAE,OAAOJ,EAAQ,EAAE;AAElD,MAAI,CAACG,EAAM,QAAO,EAAE,MAAM,IAAM,MAAM,KAAA;AACtC,QAAME,IAAKF,EAAK,MAAM,QAAA;AAEtB,SAAIE,MAAOL,EAAQ,OAAa,EAAE,MAAM,IAAO,MAAM,KAAA,IAE9C,EAAE,MAAM,IAAM,MADLK,IAAKH,EAAM,MAAM,aAAaG,KAAMH,EAAM,IAAI,QAAA,IACzBC,EAAK,QAAQ,KAAA;AACpD;"}
package/dist/index233.js CHANGED
@@ -1,51 +1,10 @@
1
- import { agendaGroups as p, eventCalendarRange as m } from "./index117.js";
2
- import { toNodes as l } from "./index195.js";
3
- import { eventItem as f } from "./index245.js";
4
- import { el as o, sameDay as u, markMoving as c } from "./index234.js";
5
- import { cn as i } from "./index194.js";
6
- function b(n, z, d) {
7
- const s = o("ul", "zen-m-0 zen-flex zen-list-none zen-flex-col zen-gap-0.5 zen-p-0");
8
- for (const t of d) {
9
- const e = z[t.index], r = o("li", "zen-flex zen-min-w-0 zen-items-center zen-gap-3 zen-rounded-zen-sm hover:zen-bg-zen-muted"), a = o(
10
- "span",
11
- "zen-w-32 zen-shrink-0 zen-ps-1.5 zen-text-xs zen-tabular-nums zen-text-zen-muted-fg",
12
- t.allDay ? n.loc.t("eventCalendar.allDay") : n.timeLabel(e)
13
- );
14
- a.setAttribute("aria-hidden", "true"), r.append(
15
- a,
16
- f(n, e, {
17
- variant: "row",
18
- continuesBefore: t.continuesBefore,
19
- continuesAfter: t.continuesAfter,
20
- class: "zen-min-h-8 zen-flex-1"
21
- })
22
- ), s.append(r);
23
- }
24
- return s;
25
- }
26
- function w(n) {
27
- const z = n.props.events ?? [], d = p(z, m("agenda", n.anchor, n.options)), s = (e) => new Intl.DateTimeFormat(n.loc.locale, { weekday: "long", day: "numeric", month: "long" }).format(e), t = o("div", "zen-rounded-zen-md zen-border zen-border-zen-border");
28
- if (d.length === 0) {
29
- const e = o("p", "zen-m-0 zen-py-10 zen-text-center zen-text-sm zen-text-zen-muted-fg");
30
- e.append(...l(n.props.emptyMessage ?? n.loc.t("eventCalendar.noEvents"))), t.append(e);
31
- }
32
- for (const e of d) {
33
- const r = o(
34
- "section",
35
- i("zen-flex zen-flex-col zen-gap-1 zen-border-b zen-border-zen-border zen-px-3 zen-py-2 last:zen-border-b-0", n.props.dayClassName?.(e.date))
36
- );
37
- r.setAttribute("aria-label", s(e.date));
38
- const a = o(
39
- "p",
40
- i("zen-m-0 zen-text-sm zen-font-semibold", u(e.date, n.now) ? "zen-text-zen-primary" : "zen-text-zen-foreground"),
41
- s(e.date)
42
- );
43
- a.setAttribute("aria-hidden", "true"), r.append(a, b(n, z, e.items)), t.append(r);
44
- }
45
- return { el: t, applyPreview: (e) => c(n.root, e?.eventId) };
46
- }
1
+ const t = { compact: 28, comfortable: 36, touch: 48 }, a = { compact: 14, comfortable: 18, touch: 32 }, e = { compact: 12, comfortable: 16, touch: 32 }, m = { compact: 24, comfortable: 30, touch: 54 }, n = { compact: 36, comfortable: 48, touch: 64 }, r = { compact: 20, comfortable: 24, touch: 44 }, l = (o = "comfortable", c) => c ?? t[o], s = (o = "comfortable") => a[o], b = (o = "comfortable") => e[o], f = (o = "comfortable", c) => c ?? m[o], E = (o = "comfortable", c) => c ?? n[o], u = (o = "comfortable") => r[o];
47
2
  export {
48
- w as agenda,
49
- b as dayList
3
+ f as calendarLanePx,
4
+ E as eventHourPx,
5
+ u as eventRowPx,
6
+ s as ganttBarPx,
7
+ b as laneBarPx,
8
+ l as scheduleRowPx
50
9
  };
51
10
  //# sourceMappingURL=index233.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index233.js","sources":["../src/components/event-calendar/event-calendar-agenda.ts"],"sourcesContent":["import { agendaGroups, eventCalendarRange, type AgendaItem } from \"@algorisys/zen-ui-core/event-calendar\";\nimport { cn } from \"../../lib/cn\";\nimport { toNodes } from \"../../lib/component\";\nimport { eventItem } from \"./event-calendar-item\";\nimport { type CalendarContext, type CalendarEvent, type CalendarViewHandle, el, markMoving, sameDay } from \"./event-calendar-model\";\n\n/** One day's events as a list: the agenda's rows, and the month's \"+N more\" panel. */\nexport function dayList(cal: CalendarContext, events: CalendarEvent[], items: AgendaItem[]): HTMLElement {\n const list = el(\"ul\", \"zen-m-0 zen-flex zen-list-none zen-flex-col zen-gap-0.5 zen-p-0\");\n for (const item of items) {\n const event = events[item.index];\n const li = el(\"li\", \"zen-flex zen-min-w-0 zen-items-center zen-gap-3 zen-rounded-zen-sm hover:zen-bg-zen-muted\");\n const time = el(\n \"span\",\n \"zen-w-32 zen-shrink-0 zen-ps-1.5 zen-text-xs zen-tabular-nums zen-text-zen-muted-fg\",\n item.allDay ? cal.loc.t(\"eventCalendar.allDay\") : cal.timeLabel(event),\n );\n time.setAttribute(\"aria-hidden\", \"true\");\n li.append(\n time,\n eventItem(cal, event, {\n variant: \"row\",\n continuesBefore: item.continuesBefore,\n continuesAfter: item.continuesAfter,\n class: \"zen-min-h-8 zen-flex-1\",\n }),\n );\n list.append(li);\n }\n return list;\n}\n\nexport function agenda(cal: CalendarContext): CalendarViewHandle {\n const events = cal.props.events ?? [];\n const groups = agendaGroups(events, eventCalendarRange(\"agenda\", cal.anchor, cal.options));\n const heading = (d: Date) => new Intl.DateTimeFormat(cal.loc.locale, { weekday: \"long\", day: \"numeric\", month: \"long\" }).format(d);\n const box = el(\"div\", \"zen-rounded-zen-md zen-border zen-border-zen-border\");\n\n if (groups.length === 0) {\n const empty = el(\"p\", \"zen-m-0 zen-py-10 zen-text-center zen-text-sm zen-text-zen-muted-fg\");\n empty.append(...toNodes(cal.props.emptyMessage ?? cal.loc.t(\"eventCalendar.noEvents\")));\n box.append(empty);\n }\n for (const group of groups) {\n const section = el(\n \"section\",\n cn(\"zen-flex zen-flex-col zen-gap-1 zen-border-b zen-border-zen-border zen-px-3 zen-py-2 last:zen-border-b-0\", cal.props.dayClassName?.(group.date)),\n );\n section.setAttribute(\"aria-label\", heading(group.date));\n const label = el(\n \"p\",\n cn(\"zen-m-0 zen-text-sm zen-font-semibold\", sameDay(group.date, cal.now) ? \"zen-text-zen-primary\" : \"zen-text-zen-foreground\"),\n heading(group.date),\n );\n label.setAttribute(\"aria-hidden\", \"true\");\n section.append(label, dayList(cal, events, group.items));\n box.append(section);\n }\n\n return { el: box, applyPreview: (preview) => markMoving(cal.root, preview?.eventId) };\n}\n"],"names":["dayList","cal","events","items","list","el","item","event","li","time","eventItem","agenda","groups","agendaGroups","eventCalendarRange","heading","d","box","empty","toNodes","group","section","cn","label","sameDay","preview","markMoving"],"mappings":";;;;;AAOO,SAASA,EAAQC,GAAsBC,GAAyBC,GAAkC;AACvG,QAAMC,IAAOC,EAAG,MAAM,iEAAiE;AACvF,aAAWC,KAAQH,GAAO;AACxB,UAAMI,IAAQL,EAAOI,EAAK,KAAK,GACzBE,IAAKH,EAAG,MAAM,2FAA2F,GACzGI,IAAOJ;AAAA,MACX;AAAA,MACA;AAAA,MACAC,EAAK,SAASL,EAAI,IAAI,EAAE,sBAAsB,IAAIA,EAAI,UAAUM,CAAK;AAAA,IAAA;AAEvE,IAAAE,EAAK,aAAa,eAAe,MAAM,GACvCD,EAAG;AAAA,MACDC;AAAA,MACAC,EAAUT,GAAKM,GAAO;AAAA,QACpB,SAAS;AAAA,QACT,iBAAiBD,EAAK;AAAA,QACtB,gBAAgBA,EAAK;AAAA,QACrB,OAAO;AAAA,MAAA,CACR;AAAA,IAAA,GAEHF,EAAK,OAAOI,CAAE;AAAA,EAChB;AACA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on the schedules,\n * PlanningCalendar, SpreadsheetGrid and Tree.\n *\n * bun run check:density\n *\n * The same three names as the `data-density` tokens (tokens.css). This is a\n * PROP rather than a reading of that attribute on purpose: these components\n * never followed data-density, and starting to would reflow every app that\n * already sets data-density=\"touch\" for its controls. A prop changes only the\n * component it is set on.\n *\n * \"comfortable\" is the default and is exactly the size each component always\n * drew. \"touch\" reaches 48px targets, like data-density=\"touch\" for controls.\n * An explicit size (rowHeight, laneHeight) wins over density. The classes for\n * SpreadsheetGrid and Tree live in variants.ts, which Uno scans.\n */\n\nexport type Density = \"compact\" | \"comfortable\" | \"touch\";\nexport const DENSITIES: readonly Density[] = [\"compact\", \"comfortable\", \"touch\"];\n\nconst SCHEDULE_ROW: Record<Density, number> = { compact: 28, comfortable: 36, touch: 48 };\nconst GANTT_BAR: Record<Density, number> = { compact: 14, comfortable: 18, touch: 32 };\nconst LANE_BAR: Record<Density, number> = { compact: 12, comfortable: 16, touch: 32 };\n// A calendar block is its lane less 6px: touch's 54 makes a 48px block.\nconst CALENDAR_LANE: Record<Density, number> = { compact: 24, comfortable: 30, touch: 54 };\n// EventCalendar: one hour of the time grid, and one row of a month cell or the\n// all-day strip. Touch's row is 44, the smallest target WCAG's AAA level allows,\n// rather than 48: a month cell must still fit several of them.\nconst EVENT_HOUR: Record<Density, number> = { compact: 36, comfortable: 48, touch: 64 };\nconst EVENT_ROW: Record<Density, number> = { compact: 20, comfortable: 24, touch: 44 };\n\n/** A Gantt row, or ProductionSchedule's least row height. */\nexport const scheduleRowPx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? SCHEDULE_ROW[density];\n/** A Gantt bar's height. */\nexport const ganttBarPx = (density: Density = \"comfortable\"): number => GANTT_BAR[density];\n/** One lane's bar in ProductionSchedule. */\nexport const laneBarPx = (density: Density = \"comfortable\"): number => LANE_BAR[density];\n/** A PlanningCalendar lane. */\nexport const calendarLanePx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? CALENDAR_LANE[density];\n/** One hour of EventCalendar's time grid. */\nexport const eventHourPx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? EVENT_HOUR[density];\n/** One event row in an EventCalendar month cell or all-day strip. */\nexport const eventRowPx = (density: Density = \"comfortable\"): number => EVENT_ROW[density];\n"],"names":["SCHEDULE_ROW","GANTT_BAR","LANE_BAR","CALENDAR_LANE","EVENT_HOUR","EVENT_ROW","scheduleRowPx","density","explicit","ganttBarPx","laneBarPx","calendarLanePx","eventHourPx","eventRowPx"],"mappings":"AAqBA,MAAMA,IAAwC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC/EC,IAAqC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC5EC,IAAoC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAE3EC,IAAyC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAIhFC,IAAsC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC7EC,IAAqC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAGrEC,IAAgB,CAACC,IAAmB,eAAeC,MAC9DA,KAAYR,EAAaO,CAAO,GAErBE,IAAa,CAACF,IAAmB,kBAA0BN,EAAUM,CAAO,GAE5EG,IAAY,CAACH,IAAmB,kBAA0BL,EAASK,CAAO,GAE1EI,IAAiB,CAACJ,IAAmB,eAAeC,MAC/DA,KAAYL,EAAcI,CAAO,GAEtBK,IAAc,CAACL,IAAmB,eAAeC,MAC5DA,KAAYJ,EAAWG,CAAO,GAEnBM,IAAa,CAACN,IAAmB,kBAA0BF,EAAUE,CAAO;"}
package/dist/index234.js CHANGED
@@ -1,43 +1,51 @@
1
- import { cn as r } from "./index194.js";
2
- const f = {
3
- default: "zen-bg-zen-primary-soft zen-text-zen-primary-soft-fg zen-border-zen-primary",
4
- info: "zen-bg-zen-info-soft zen-text-zen-info-soft-fg zen-border-zen-info",
5
- success: "zen-bg-zen-success-soft zen-text-zen-success-soft-fg zen-border-zen-success",
6
- warning: "zen-bg-zen-warning-soft zen-text-zen-warning-soft-fg zen-border-zen-warning",
7
- error: "zen-bg-zen-error-soft zen-text-zen-error-soft-fg zen-border-zen-error"
8
- }, g = {
9
- default: "zen-bg-zen-primary",
10
- info: "zen-bg-zen-info",
11
- success: "zen-bg-zen-success",
12
- warning: "zen-bg-zen-warning",
13
- error: "zen-bg-zen-error"
14
- }, s = "zen-opacity-40", z = "zen-bg-zen-primary-soft", i = (n) => !!n && getComputedStyle(n).direction === "rtl", a = (n, e) => n.getFullYear() === e.getFullYear() && n.getMonth() === e.getMonth() && n.getDate() === e.getDate(), l = (n, e, t) => {
15
- const o = document.createElement(n);
16
- return e && (o.className = e), t !== void 0 && (o.textContent = t), o;
17
- };
18
- function u(n, e, t) {
19
- !e || t === "chip" || t === "row" || (n.style.backgroundColor = `color-mix(in srgb, ${e} 18%, var(--zen-color-background))`, n.style.borderColor = e, n.style.color = "var(--zen-color-foreground)");
20
- }
21
- function b(n, e) {
22
- for (const t of n) {
23
- const o = e !== null && t.day >= e.start && t.day < e.end;
24
- t.node.className = r(t.base, o && z);
1
+ import { agendaGroups as p, eventCalendarRange as m } from "./index117.js";
2
+ import { toNodes as l } from "./index195.js";
3
+ import { eventItem as f } from "./index246.js";
4
+ import { el as o, sameDay as u, markMoving as c } from "./index235.js";
5
+ import { cn as i } from "./index194.js";
6
+ function b(n, z, d) {
7
+ const s = o("ul", "zen-m-0 zen-flex zen-list-none zen-flex-col zen-gap-0.5 zen-p-0");
8
+ for (const t of d) {
9
+ const e = z[t.index], r = o("li", "zen-flex zen-min-w-0 zen-items-center zen-gap-3 zen-rounded-zen-sm hover:zen-bg-zen-muted"), a = o(
10
+ "span",
11
+ "zen-w-32 zen-shrink-0 zen-ps-1.5 zen-text-xs zen-tabular-nums zen-text-zen-muted-fg",
12
+ t.allDay ? n.loc.t("eventCalendar.allDay") : n.timeLabel(e)
13
+ );
14
+ a.setAttribute("aria-hidden", "true"), r.append(
15
+ a,
16
+ f(n, e, {
17
+ variant: "row",
18
+ continuesBefore: t.continuesBefore,
19
+ continuesAfter: t.continuesAfter,
20
+ class: "zen-min-h-8 zen-flex-1"
21
+ })
22
+ ), s.append(r);
25
23
  }
24
+ return s;
26
25
  }
27
- function d(n, e) {
28
- for (const t of n.querySelectorAll("[data-cal-event]"))
29
- t.classList.toggle(s, e !== void 0 && t.getAttribute("data-cal-event") === e);
26
+ function w(n) {
27
+ const z = n.props.events ?? [], d = p(z, m("agenda", n.anchor, n.options)), s = (e) => new Intl.DateTimeFormat(n.loc.locale, { weekday: "long", day: "numeric", month: "long" }).format(e), t = o("div", "zen-rounded-zen-md zen-border zen-border-zen-border");
28
+ if (d.length === 0) {
29
+ const e = o("p", "zen-m-0 zen-py-10 zen-text-center zen-text-sm zen-text-zen-muted-fg");
30
+ e.append(...l(n.props.emptyMessage ?? n.loc.t("eventCalendar.noEvents"))), t.append(e);
31
+ }
32
+ for (const e of d) {
33
+ const r = o(
34
+ "section",
35
+ i("zen-flex zen-flex-col zen-gap-1 zen-border-b zen-border-zen-border zen-px-3 zen-py-2 last:zen-border-b-0", n.props.dayClassName?.(e.date))
36
+ );
37
+ r.setAttribute("aria-label", s(e.date));
38
+ const a = o(
39
+ "p",
40
+ i("zen-m-0 zen-text-sm zen-font-semibold", u(e.date, n.now) ? "zen-text-zen-primary" : "zen-text-zen-foreground"),
41
+ s(e.date)
42
+ );
43
+ a.setAttribute("aria-hidden", "true"), r.append(a, b(n, z, e.items)), t.append(r);
44
+ }
45
+ return { el: t, applyPreview: (e) => c(n.root, e?.eventId) };
30
46
  }
31
47
  export {
32
- g as DOT_CLASS,
33
- z as LIT_CLASS,
34
- s as MOVING_CLASS,
35
- f as STATE_CLASS,
36
- u as applyCustomColor,
37
- l as el,
38
- i as isRtl,
39
- d as markMoving,
40
- b as relight,
41
- a as sameDay
48
+ w as agenda,
49
+ b as dayList
42
50
  };
43
51
  //# sourceMappingURL=index234.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index234.js","sources":["../src/components/event-calendar/event-calendar-model.ts"],"sourcesContent":["import type {\n CalendarProposedSpan,\n EventCalendarOptions,\n SlotCursor,\n EventCalendarView,\n Weekday,\n} from \"@algorisys/zen-ui-core/event-calendar\";\nimport type { Density } from \"@algorisys/zen-ui-core/density\";\nimport { cn } from \"../../lib/cn\";\nimport type { AnyZenComponent, BaseProps, Child } from \"../../lib/component\";\nimport type { useLocale } from \"../locale/locale\";\n\nexport type CalendarEventState = \"default\" | \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface CalendarEvent {\n id: string;\n title: string;\n start: Date;\n /** Exclusive. For an all-day event, the first day NOT included (or the same day for a one-day event). */\n end: Date;\n allDay?: boolean;\n /** Token colour. \"default\" is the primary tint. */\n state?: CalendarEventState;\n /** Any CSS colour; wins over `state`. For a per-calendar colour from your own map. */\n color?: string;\n location?: string;\n /** Minutes before the start. Shown as a mark; zen-ui does not fire reminders. */\n reminders?: number[];\n /** Shown as a mark. Expand the occurrences before passing them (see `expandRecurrence`). */\n recurring?: boolean;\n /** \"task\" draws a checkbox; `done` strikes it through. */\n kind?: \"event\" | \"task\";\n done?: boolean;\n /** Never offered for moving or resizing, whatever `canEditEvent` says. */\n readOnly?: boolean;\n /**\n * Render the event as a link to this URL, so middle-click and \"open in new\n * tab\" work. `onEventClick` still fires on a plain click; the browser then\n * follows the link.\n */\n href?: string;\n}\n\nexport interface CalendarSlot {\n start: Date;\n /** Exclusive. */\n end: Date;\n allDay: boolean;\n}\n\nexport interface CalendarEventChange {\n /** The event as you passed it. */\n event: CalendarEvent;\n start: Date;\n end: Date;\n allDay: boolean;\n kind: \"move\" | \"resize\";\n}\n\nexport type CalendarEventVariant = \"block\" | \"bar\" | \"chip\" | \"row\";\n\nexport interface CalendarEventRenderContext {\n view: EventCalendarView;\n /** \"block\" in a time grid, \"bar\" for multi-day and all-day, \"chip\" for a timed event in a month cell, \"row\" in lists. */\n variant: CalendarEventVariant;\n /** \"09:00 – 10:30\" or the localised \"All day\". */\n timeLabel: string;\n /** Too short for a second line. */\n compact: boolean;\n}\n\nexport interface EventCalendarProps extends BaseProps {\n events: CalendarEvent[];\n /** Starting view. The factory owns it after that; pass `view` (or call update) to control it. Default \"week\". */\n defaultView?: EventCalendarView;\n view?: EventCalendarView;\n onViewChange?: (view: EventCalendarView) => void;\n /** Which views the switcher offers, in order. Default month, week, day, agenda. */\n views?: EventCalendarView[];\n /** Any date inside the range to open on. Default today. */\n defaultDate?: Date;\n date?: Date;\n onDateChange?: (date: Date) => void;\n /** Reference \"now\" for today and the now line. Injectable for tests and demos. */\n now?: Date;\n /** First column of a week. Default 1 (Monday). */\n weekStartsOn?: Weekday;\n /** Shaded, and left out of the work-week view. Default [0, 6]. */\n nonWorkingDays?: number[];\n /** [from, to) hours drawn unshaded in the time grid. Default [9, 18]. */\n workingHours?: [number, number];\n /** Days shown by the agenda. Default 14. */\n agendaDays?: number;\n /** Hour scrolled to the top of the time grid when it opens. Default 8. */\n scrollToHour?: number;\n /** Pixels per hour in the time grid. Wins over `density`. */\n hourHeight?: number;\n /** \"compact\", \"comfortable\" (default) or \"touch\" (44px rows, 64px hours). */\n density?: Density;\n /** Height of the time grid's scrolling area in px. Default 576. */\n height?: number;\n /** Minutes a drag snaps to, and a keyboard step. Default 15. */\n snapMinutes?: number;\n /** Length of the slot a single click selects. Default 60. */\n newEventMinutes?: number;\n /** Rows of events in a month cell before \"+N more\". Default 3. */\n maxEventsPerDay?: number;\n onEventClick?: (event: CalendarEvent) => void;\n /** Empty time was clicked or dragged across. Without it, empty time is not interactive. */\n onSlotSelect?: (slot: CalendarSlot) => void;\n /** A move or resize, proposed. Nothing changes until you pass back new `events`. Without it the calendar is read-only. */\n onEventChange?: (change: CalendarEventChange) => void;\n /** Per-event gate for editing. A blocked event is not draggable at all, rather than refused on drop. */\n canEditEvent?: (event: CalendarEvent) => boolean;\n /** A task's checkbox was toggled. Without it the checkbox is shown but disabled. */\n onTaskToggle?: (event: CalendarEvent, done: boolean) => void;\n /** Replace an event's content (title, time, marks). The calendar keeps the box, the colour and the controls. */\n renderEvent?: (event: CalendarEvent, context: CalendarEventRenderContext) => Child;\n /** Extra classes on an event's box. */\n eventClassName?: (event: CalendarEvent) => string | undefined;\n /** Extra classes on a day: a month cell, a time-grid column and its header. Holidays, closures. */\n dayClassName?: (date: Date) => string | undefined;\n /** Extra classes on the row of day headers. */\n headerClassName?: string;\n /** Your own controls, at the end of the toolbar. */\n toolbarActions?: Child;\n /** Hide the toolbar when your page already has one (drive `view` and `date` yourself). */\n hideToolbar?: boolean;\n /** What the agenda says when nothing is on. */\n emptyMessage?: Child;\n}\n\nexport interface CalendarPreview {\n kind: \"move\" | \"resize\" | \"select\";\n /** Where the drag is happening, which decides how the preview is drawn. */\n surface: \"time\" | \"day\";\n /** The event being moved or resized. */\n eventId?: string;\n span: CalendarProposedSpan;\n}\n\n/**\n * What one render owns: the components it built and the listeners it added to\n * nodes it created. Both are released before the next render and on destroy,\n * because a full re-render with nothing released leaks a listener per event\n * per render.\n */\nexport interface RenderScope {\n keep<T extends AnyZenComponent>(component: T): T;\n on<K extends keyof HTMLElementEventMap>(\n node: HTMLElement,\n type: K,\n listener: (event: HTMLElementEventMap[K]) => void,\n ): void;\n /** Run when this render is released (an observer to disconnect, say). */\n onRelease(cleanup: () => void): void;\n}\n\n/**\n * View state that must outlive a render. The factory rebuilds its DOM when the\n * data changes; without this the slot cursor, the focused day and the grid's\n * scroll position would all reset every time the caller passed new events.\n */\nexport interface CalendarMemory {\n cursor?: SlotCursor;\n focusedDay?: Date;\n /** Set by keyboard paging only: focus `focusedDay` once the new page is built. */\n focusDayAfterRender?: boolean;\n scrollTop?: number;\n /** The view the scroll position belongs to; a new view scrolls to scrollToHour instead. */\n scrollView?: string;\n /** The day whose \"+N more\" panel is open, kept open across a re-render. */\n openMore?: string;\n}\n\n/** What the root hands every view for one render. */\nexport interface CalendarContext {\n memory: CalendarMemory;\n props: EventCalendarProps;\n loc: ReturnType<typeof useLocale>;\n scope: RenderScope;\n view: EventCalendarView;\n anchor: Date;\n now: Date;\n options: EventCalendarOptions;\n hourPx: number;\n rowPx: number;\n snap: number;\n root: HTMLElement;\n hintId: string;\n /** The preview in progress when this render started (a re-render during a drag). */\n preview: CalendarPreview | null;\n setPreview: (preview: CalendarPreview | null) => void;\n editable: (event: CalendarEvent) => boolean;\n selectable: boolean;\n canGoToDay: boolean;\n goToDay: (date: Date) => void;\n setDate: (date: Date) => void;\n openEvent: (event: CalendarEvent) => void;\n toggleTask: (event: CalendarEvent) => void;\n selectSlot: (slot: CalendarSlot) => void;\n propose: (event: CalendarEvent, span: CalendarProposedSpan, kind: \"move\" | \"resize\", fromKeyboard: boolean) => void;\n timeLabel: (span: { start: Date; end: Date; allDay?: boolean }) => string;\n announce: (text: string) => void;\n}\n\n/** A built view: its element, and how it shows a drag in progress without being rebuilt. */\nexport interface CalendarViewHandle {\n el: HTMLElement;\n /** Draw (or clear) the preview in place. A drag updates it every frame; rebuilding the view each frame would drop focus and thrash layout. */\n applyPreview(preview: CalendarPreview | null): void;\n /** Called once the view is in the document (scroll position, focus). */\n mounted?(): void;\n}\n\nexport const STATE_CLASS: Record<CalendarEventState, string> = {\n default: \"zen-bg-zen-primary-soft zen-text-zen-primary-soft-fg zen-border-zen-primary\",\n info: \"zen-bg-zen-info-soft zen-text-zen-info-soft-fg zen-border-zen-info\",\n success: \"zen-bg-zen-success-soft zen-text-zen-success-soft-fg zen-border-zen-success\",\n warning: \"zen-bg-zen-warning-soft zen-text-zen-warning-soft-fg zen-border-zen-warning\",\n error: \"zen-bg-zen-error-soft zen-text-zen-error-soft-fg zen-border-zen-error\",\n};\n\nexport const DOT_CLASS: Record<CalendarEventState, string> = {\n default: \"zen-bg-zen-primary\",\n info: \"zen-bg-zen-info\",\n success: \"zen-bg-zen-success\",\n warning: \"zen-bg-zen-warning\",\n error: \"zen-bg-zen-error\",\n};\n\n/** The class a drag adds to the event it is moving. */\nexport const MOVING_CLASS = \"zen-opacity-40\";\n/** The class a preview adds to a day it covers. */\nexport const LIT_CLASS = \"zen-bg-zen-primary-soft\";\n\nexport const isRtl = (node: Element | null | undefined): boolean => !!node && getComputedStyle(node).direction === \"rtl\";\n\nexport const sameDay = (a: Date, b: Date) =>\n a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();\n\nexport const el = <K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className?: string,\n text?: string,\n): HTMLElementTagNameMap[K] => {\n const node = document.createElement(tag);\n if (className) node.className = className;\n if (text !== undefined) node.textContent = text;\n return node;\n};\n\n/**\n * A caller's colour as a tint with a solid edge, mixed against the theme's\n * background so it reads in dark mode; the text stays the theme's foreground.\n */\nexport function applyCustomColor(node: HTMLElement, color: string | undefined, variant: CalendarEventVariant): void {\n if (!color || variant === \"chip\" || variant === \"row\") return;\n node.style.backgroundColor = `color-mix(in srgb, ${color} 18%, var(--zen-color-background))`;\n node.style.borderColor = color;\n node.style.color = \"var(--zen-color-foreground)\";\n}\n\n/**\n * The cells a day-surface preview lights, by recomputing their class from the\n * base they were built with: adding the tint beside a weekend shade would leave\n * the two fighting on stylesheet order.\n */\nexport function relight(cells: Array<{ node: HTMLElement; base: string; day: Date }>, range: { start: Date; end: Date } | null): void {\n for (const cell of cells) {\n const lit = range !== null && cell.day >= range.start && cell.day < range.end;\n cell.node.className = cn(cell.base, lit && LIT_CLASS);\n }\n}\n\n/** Dim the event being dragged (every piece of it) and undim the rest. */\nexport function markMoving(root: HTMLElement, id: string | undefined): void {\n for (const node of root.querySelectorAll<HTMLElement>(\"[data-cal-event]\")) {\n node.classList.toggle(MOVING_CLASS, id !== undefined && node.getAttribute(\"data-cal-event\") === id);\n }\n}\n"],"names":["STATE_CLASS","DOT_CLASS","MOVING_CLASS","LIT_CLASS","isRtl","node","sameDay","a","b","el","tag","className","text","applyCustomColor","color","variant","relight","cells","range","cell","lit","cn","markMoving","root","id"],"mappings":";AAuNO,MAAMA,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","sources":["../src/components/event-calendar/event-calendar-agenda.ts"],"sourcesContent":["import { agendaGroups, eventCalendarRange, type AgendaItem } from \"@algorisys/zen-ui-core/event-calendar\";\nimport { cn } from \"../../lib/cn\";\nimport { toNodes } from \"../../lib/component\";\nimport { eventItem } from \"./event-calendar-item\";\nimport { type CalendarContext, type CalendarEvent, type CalendarViewHandle, el, markMoving, sameDay } from \"./event-calendar-model\";\n\n/** One day's events as a list: the agenda's rows, and the month's \"+N more\" panel. */\nexport function dayList(cal: CalendarContext, events: CalendarEvent[], items: AgendaItem[]): HTMLElement {\n const list = el(\"ul\", \"zen-m-0 zen-flex zen-list-none zen-flex-col zen-gap-0.5 zen-p-0\");\n for (const item of items) {\n const event = events[item.index];\n const li = el(\"li\", \"zen-flex zen-min-w-0 zen-items-center zen-gap-3 zen-rounded-zen-sm hover:zen-bg-zen-muted\");\n const time = el(\n \"span\",\n \"zen-w-32 zen-shrink-0 zen-ps-1.5 zen-text-xs zen-tabular-nums zen-text-zen-muted-fg\",\n item.allDay ? cal.loc.t(\"eventCalendar.allDay\") : cal.timeLabel(event),\n );\n time.setAttribute(\"aria-hidden\", \"true\");\n li.append(\n time,\n eventItem(cal, event, {\n variant: \"row\",\n continuesBefore: item.continuesBefore,\n continuesAfter: item.continuesAfter,\n class: \"zen-min-h-8 zen-flex-1\",\n }),\n );\n list.append(li);\n }\n return list;\n}\n\nexport function agenda(cal: CalendarContext): CalendarViewHandle {\n const events = cal.props.events ?? [];\n const groups = agendaGroups(events, eventCalendarRange(\"agenda\", cal.anchor, cal.options));\n const heading = (d: Date) => new Intl.DateTimeFormat(cal.loc.locale, { weekday: \"long\", day: \"numeric\", month: \"long\" }).format(d);\n const box = el(\"div\", \"zen-rounded-zen-md zen-border zen-border-zen-border\");\n\n if (groups.length === 0) {\n const empty = el(\"p\", \"zen-m-0 zen-py-10 zen-text-center zen-text-sm zen-text-zen-muted-fg\");\n empty.append(...toNodes(cal.props.emptyMessage ?? cal.loc.t(\"eventCalendar.noEvents\")));\n box.append(empty);\n }\n for (const group of groups) {\n const section = el(\n \"section\",\n cn(\"zen-flex zen-flex-col zen-gap-1 zen-border-b zen-border-zen-border zen-px-3 zen-py-2 last:zen-border-b-0\", cal.props.dayClassName?.(group.date)),\n );\n section.setAttribute(\"aria-label\", heading(group.date));\n const label = el(\n \"p\",\n cn(\"zen-m-0 zen-text-sm zen-font-semibold\", sameDay(group.date, cal.now) ? \"zen-text-zen-primary\" : \"zen-text-zen-foreground\"),\n heading(group.date),\n );\n label.setAttribute(\"aria-hidden\", \"true\");\n section.append(label, dayList(cal, events, group.items));\n box.append(section);\n }\n\n return { el: box, applyPreview: (preview) => markMoving(cal.root, preview?.eventId) };\n}\n"],"names":["dayList","cal","events","items","list","el","item","event","li","time","eventItem","agenda","groups","agendaGroups","eventCalendarRange","heading","d","box","empty","toNodes","group","section","cn","label","sameDay","preview","markMoving"],"mappings":";;;;;AAOO,SAASA,EAAQC,GAAsBC,GAAyBC,GAAkC;AACvG,QAAMC,IAAOC,EAAG,MAAM,iEAAiE;AACvF,aAAWC,KAAQH,GAAO;AACxB,UAAMI,IAAQL,EAAOI,EAAK,KAAK,GACzBE,IAAKH,EAAG,MAAM,2FAA2F,GACzGI,IAAOJ;AAAA,MACX;AAAA,MACA;AAAA,MACAC,EAAK,SAASL,EAAI,IAAI,EAAE,sBAAsB,IAAIA,EAAI,UAAUM,CAAK;AAAA,IAAA;AAEvE,IAAAE,EAAK,aAAa,eAAe,MAAM,GACvCD,EAAG;AAAA,MACDC;AAAA,MACAC,EAAUT,GAAKM,GAAO;AAAA,QACpB,SAAS;AAAA,QACT,iBAAiBD,EAAK;AAAA,QACtB,gBAAgBA,EAAK;AAAA,QACrB,OAAO;AAAA,MAAA,CACR;AAAA,IAAA,GAEHF,EAAK,OAAOI,CAAE;AAAA,EAChB;AACA,SAAOJ;AACT;AAEO,SAASO,EAAOV,GAA0C;AAC/D,QAAMC,IAASD,EAAI,MAAM,UAAU,CAAA,GAC7BW,IAASC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