@f-ewald/components 1.46.0 → 1.46.1
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/custom-elements.json +200 -68
- package/dist/app-shell.d.ts.map +1 -1
- package/dist/app-shell.js +4 -0
- package/dist/app-shell.js.map +1 -1
- package/dist/calendar-day.d.ts +0 -2
- package/dist/calendar-day.d.ts.map +1 -1
- package/dist/calendar-day.js +3 -30
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-timeline-base.d.ts +4 -0
- package/dist/calendar-timeline-base.d.ts.map +1 -1
- package/dist/calendar-timeline-base.js +31 -2
- package/dist/calendar-timeline-base.js.map +1 -1
- package/dist/calendar-week.d.ts +0 -2
- package/dist/calendar-week.d.ts.map +1 -1
- package/dist/calendar-week.js +5 -32
- package/dist/calendar-week.js.map +1 -1
- package/dist/cron-schedule.d.ts.map +1 -1
- package/dist/cron-schedule.js +4 -2
- package/dist/cron-schedule.js.map +1 -1
- package/dist/distribution-chart.d.ts +1 -0
- package/dist/distribution-chart.d.ts.map +1 -1
- package/dist/distribution-chart.js +23 -2
- package/dist/distribution-chart.js.map +1 -1
- package/dist/multi-select.d.ts.map +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/price-history-chart.d.ts.map +1 -1
- package/dist/price-history-chart.js +12 -7
- package/dist/price-history-chart.js.map +1 -1
- package/dist/range-slider.d.ts.map +1 -1
- package/dist/range-slider.js +1 -1
- package/dist/range-slider.js.map +1 -1
- package/dist/ui-checkbox.d.ts.map +1 -1
- package/dist/ui-checkbox.js +1 -1
- package/dist/ui-checkbox.js.map +1 -1
- package/dist/utils/calendar.d.ts +14 -1
- package/dist/utils/calendar.d.ts.map +1 -1
- package/dist/utils/calendar.js +17 -2
- package/dist/utils/calendar.js.map +1 -1
- package/dist/utils/cron.d.ts.map +1 -1
- package/dist/utils/cron.js +19 -10
- package/dist/utils/cron.js.map +1 -1
- package/dist/utils/layer-stack.d.ts +2 -0
- package/dist/utils/layer-stack.d.ts.map +1 -1
- package/dist/utils/layer-stack.js +4 -0
- package/dist/utils/layer-stack.js.map +1 -1
- package/package.json +1 -1
package/dist/calendar-day.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-day.js","sourceRoot":"","sources":["../src/calendar-day.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,SAAS,GAEV,MAAM,qBAAqB,CAAC;AAE7B,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAEtC,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,kBAAkB,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;AAEnF,yEAAyE;AACzE,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,kBAAkB,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,iBAAiB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EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAsC;AAOI;IAArE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;+CAAoB;AAQpC;IAApD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;6CAAe;AAElD;IAAhB,KAAK,EAAE;yCAA2B;AAnBxB,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA2ZvB","sourcesContent":["import { css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { CalendarTimelineBase } from \"./calendar-timeline-base.js\";\nimport { iconMapPin } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n assignLanes,\n isWeekend,\n minutesSinceMidnight,\n monthName,\n parseIsoDate,\n toIsoDate,\n type LanedEntry,\n} from \"./utils/calendar.js\";\n\nconst NOW_MARKER_INTERVAL_MS = 60_000;\n\nconst HOUR_HEIGHT_REM = 3;\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst hourLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\" });\n\n/** Formats hour `h` (0-23) as a locale-aware hour label, e.g. \"9 AM\". */\nfunction hourLabel(h: number): string {\n return hourLabelFormatter.format(new Date(2000, 0, 1, h));\n}\n\nconst nowLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\", minute: \"2-digit\" });\n\n// Half-heights of the current-time pill and of an hour label, derived from\n// --ui-font-size-sm x --ui-line-height-tight (plus the pill's vertical\n// padding). Used to work out which hour label the pill covers.\nconst NOW_PILL_HALF_HEIGHT_REM = (0.75 * 1.25 + 0.25) / 2;\nconst HOUR_LABEL_HALF_HEIGHT_REM = (0.75 * 1.25) / 2;\n\n/**\n * Formats `date` as a locale-aware clock time without any AM/PM marker, e.g.\n * \"6:37\" in a 12-hour locale and \"18:37\" in a 24-hour one. The meridiem is\n * dropped so the label stays narrow enough for the hour gutter.\n */\nfunction nowLabel(date: Date): string {\n return nowLabelFormatter\n .formatToParts(date)\n .filter((part) => part.type !== \"dayPeriod\")\n .map((part) => part.value)\n .join(\"\")\n .trim();\n}\n\n/**\n * The hour (0-23) whose gutter label the current-time pill overlaps, given the\n * pill's offset in rem from the top of the grid, or `null` when the pill\n * clears every label. Labels sit flush with the top of their own hour cell.\n */\nfunction hourLabelCoveredByNow(nowTopRem: number | null): number | null {\n if (nowTopRem === null) return null;\n const hour = Math.round((nowTopRem - HOUR_LABEL_HALF_HEIGHT_REM) / HOUR_HEIGHT_REM);\n if (hour < 0 || hour > 23) return null;\n const labelCenterRem = hour * HOUR_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n const clearance = NOW_PILL_HALF_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n return Math.abs(nowTopRem - labelCenterRem) < clearance ? hour : null;\n}\n\n/**\n * A single day rendered as an hourly time grid — a Google-Calendar-style\n * view distinct from `calendar-month`'s whole-day table. Declarative\n * `calendar-entry` children with a time-of-day in `start`/`end` (e.g.\n * `start=\"2026-03-05T09:00\"`) render as positioned/sized blocks; entries\n * with only a date (no time) render in an all-day band above the grid.\n * Overlapping timed entries stack into side-by-side columns; overlapping\n * all-day/multi-day entries stack into lanes, same as `calendar-month`.\n * Read-only.\n *\n * Shares its slotted-entry observation, resolution, and hover/focus\n * interaction sync with `calendar-week` via `CalendarTimelineBase`.\n *\n * @element calendar-day\n * @slot - Declarative `calendar-entry` elements to render for this day.\n * @slot actions - Optional controls rendered beside the day name (e.g. day-navigation buttons).\n */\n@customElement(\"calendar-day\")\nexport class CalendarDay extends CalendarTimelineBase {\n /** The day shown, `\"YYYY-MM-DD\"`. */\n @property({ reflect: true }) date: string = toIsoDate(new Date());\n\n /**\n * Shows a fine live line marking the current time, with a rounded pill in\n * the hour gutter reading the current clock time. The hour label the pill\n * covers is hidden while it does. Only rendered when `date` is today.\n */\n @property({ type: Boolean, reflect: true, attribute: \"time-marker\" }) timeMarker = false;\n\n /**\n * Minimum width for the day column, as a CSS length (e.g. `\"18rem\"`).\n * Unset leaves the host's width fully controlled by its container —\n * useful as the sizing floor when placing several `calendar-day`\n * elements in a scrollable row.\n */\n @property({ reflect: true, attribute: \"min-width\" }) minWidth = \"\";\n\n @state() private _now = Date.now();\n\n private _nowTimer: ReturnType<typeof setInterval> | null = null;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n min-width: var(--calendar-day-min-width, 0);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .day-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .day-name {\n margin: 0;\n min-width: 0;\n color: var(--ui-text, #0f172a);\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .day-name.weekend {\n color: var(--ui-text-muted, #64748b);\n }\n .day-name.today {\n color: var(--ui-primary, #4f46e5);\n }\n .actions {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 0.5rem;\n }\n .all-day-band {\n display: flex;\n margin-bottom: 0.5rem;\n }\n .all-day-band.empty {\n display: none;\n }\n .hour-gutter-spacer {\n flex: 0 0 3rem;\n }\n .all-day-lanes {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 0.25rem;\n }\n .all-day-lane {\n display: flex;\n gap: 0.25rem;\n }\n .grid {\n display: flex;\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n /* The hour grid is the day's canvas — .day-column only paints for\n weekend/today, so without this the page showed through every\n ordinary hour. The today tint is translucent and composites over\n this paper rather than over the page. */\n background: var(--ui-surface, #ffffff);\n }\n .hour-gutter {\n flex: 0 0 3rem;\n }\n .hour-label-cell {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n padding-right: 0.5rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n line-height: var(--ui-line-height-tight, 1.25);\n text-align: right;\n white-space: nowrap;\n }\n /* Hidden rather than removed so the cell keeps its own separator line. */\n .hour-label.covered {\n visibility: hidden;\n }\n .day-column {\n position: relative;\n flex: 1 1 auto;\n height: ${HOUR_HEIGHT_REM * 24}rem;\n }\n .day-column.weekend {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .day-column.today {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 6%, transparent);\n }\n .now-line {\n position: absolute;\n left: 0;\n right: 0;\n height: 2px;\n background: var(--ui-danger, #dc2626);\n pointer-events: none;\n z-index: 2;\n }\n /* Overhangs left into the hour gutter; nothing between here and .grid\n clips overflow, and .day-column's z-index stays auto, so the pill\n paints above the (unpositioned) hour labels it overlaps. */\n .now-pill {\n position: absolute;\n top: 50%;\n right: 100%;\n border-radius: var(--ui-radius-pill, 9999px);\n padding: 0.125rem 0.25rem;\n background: var(--ui-danger, #dc2626);\n color: var(--ui-on-accent, #ffffff);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transform: translateY(-50%);\n }\n .hour-line {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .entry-bar {\n position: relative;\n box-sizing: border-box;\n flex: 1 1 auto;\n overflow: hidden;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem 0.5rem;\n transition: box-shadow 120ms ease;\n }\n .entry-bar.entry-block {\n position: absolute;\n }\n .entry-bar.entry-hovered,\n .entry-bar.entry-focused {\n box-shadow: inset 0 0 0 100vmax var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .entry-title {\n display: block;\n overflow: hidden;\n font-weight: var(--ui-font-weight-medium, 500);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n overflow: hidden;\n color: inherit;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location svg {\n flex: 0 0 auto;\n }\n .entry-link {\n position: absolute;\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n color: inherit;\n cursor: pointer;\n text-decoration: none;\n }\n .entry-link:focus-visible {\n outline: 2px solid var(--ui-primary, #4f46e5);\n outline-offset: -2px;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)) inset;\n }\n .entry-bar.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-text-muted, #64748b);\n }\n .entry-bar.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-info, #0ea5e9);\n }\n .entry-bar.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-primary, #4f46e5);\n }\n .entry-bar.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-success, #16a34a);\n }\n .entry-bar.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-warning, #d97706);\n }\n .entry-bar.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .entry-link:focus-visible {\n outline-color: Highlight;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entry-bar {\n transition: none;\n }\n }\n slot:not([name]) {\n display: none;\n }\n `,\n ];\n\n /** Starts the current-time ticker if `time-marker` is already set on connect. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._syncNowTimer();\n }\n\n /** Stops the current-time ticker when this element disconnects. */\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._nowTimer != null) clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n\n /** Starts/stops the current-time ticker and re-syncs the min-width host style to match the latest properties. */\n protected override updated(): void {\n super.updated();\n this._syncNowTimer();\n this._syncMinWidth();\n }\n\n /** Ensures a 60s current-time ticker is running only while `timeMarker` is enabled. */\n private _syncNowTimer(): void {\n if (this.timeMarker && this._nowTimer == null) {\n this._now = Date.now();\n this._nowTimer = setInterval(() => {\n this._now = Date.now();\n }, NOW_MARKER_INTERVAL_MS);\n } else if (!this.timeMarker && this._nowTimer != null) {\n clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n }\n\n /** Reflects `minWidth` onto the `--calendar-day-min-width` custom property the host's own styles read. */\n private _syncMinWidth(): void {\n if (this.minWidth) {\n this.style.setProperty(\"--calendar-day-min-width\", this.minWidth);\n } else {\n this.style.removeProperty(\"--calendar-day-min-width\");\n }\n }\n\n /** Renders one lane's stacked all-day bars, given the entries assigned to it. */\n private _renderAllDayLane(laned: LanedEntry[], lane: number) {\n const entries = laned.filter((entry) => entry.lane === lane);\n return html`\n <div class=\"all-day-lane\">\n ${entries.map((entry) => {\n const bodyText = [entry.label, entry.location].filter(Boolean).join(\" · \");\n return html`\n <div\n class=\"entry-bar ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n })}\n </div>\n `;\n }\n\n /** Renders a positioned/sized block for one timed entry, clamped to this day's bounds. */\n private _renderTimedEntry(entry: LanedEntry, laneCount: number, dayStart: Date, dayEnd: Date) {\n const visibleStart = entry.startDate < dayStart ? dayStart : entry.startDate;\n const visibleEnd = entry.endDate > dayEnd ? dayEnd : entry.endDate;\n const topRem = (minutesSinceMidnight(visibleStart) / 60) * HOUR_HEIGHT_REM;\n const bottomRem = (minutesSinceMidnight(visibleEnd) / 60) * HOUR_HEIGHT_REM;\n const heightRem = Math.max(bottomRem - topRem, HOUR_HEIGHT_REM / 4);\n const widthPercent = 100 / laneCount;\n const bodyText = [entry.label, ...(entry.details ?? []), entry.location].filter(Boolean).join(\"\\n\");\n return html`\n <div\n class=\"entry-bar entry-block ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n style=\"top: ${topRem}rem; height: ${heightRem}rem; left: ${entry.lane * widthPercent}%; width: ${widthPercent}%;\"\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n }\n\n protected override render() {\n const day = parseIsoDate(this.date) ?? new Date();\n const dayStart = new Date(day);\n dayStart.setHours(0, 0, 0, 0);\n const dayEnd = new Date(day);\n dayEnd.setHours(23, 59, 59, 999);\n const isToday = toIsoDate(day) === toIsoDate(new Date());\n const isWeekendDay = isWeekend(day);\n\n const resolved = this.resolveTimedEntriesFor(dayStart, dayEnd);\n const allDay = resolved.filter((entry) => entry.allDay);\n const timed = resolved.filter((entry) => !entry.allDay);\n const { entries: lanedAllDay, laneCount: allDayLaneCount } = assignLanes(allDay);\n const { entries: lanedTimed, laneCount: timedLaneCount } = assignLanes(timed);\n const nowTopRem =\n this.timeMarker && isToday ? (minutesSinceMidnight(new Date(this._now)) / 60) * HOUR_HEIGHT_REM : null;\n const coveredHour = hourLabelCoveredByNow(nowTopRem);\n\n return html`\n <div class=\"day\">\n <div class=\"day-header\">\n <h4 class=\"day-name ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${monthName(day.getMonth() + 1)} ${day.getDate()}, ${day.getFullYear()}\n </h4>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n <div class=\"all-day-band ${allDay.length === 0 ? \"empty\" : \"\"}\">\n <div class=\"hour-gutter-spacer\"></div>\n <div class=\"all-day-lanes\">\n ${repeat(\n Array.from({ length: Math.max(allDayLaneCount, 1) }, (_, i) => i),\n (lane) => lane,\n (lane) => this._renderAllDayLane(lanedAllDay, lane),\n )}\n </div>\n </div>\n <div class=\"grid\">\n <div class=\"hour-gutter\">\n ${HOURS.map(\n (h) =>\n html`<div class=\"hour-label-cell\">\n <span class=\"hour-label ${h === coveredHour ? \"covered\" : \"\"}\">${hourLabel(h)}</span>\n </div>`,\n )}\n </div>\n <div class=\"day-column ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${HOURS.map(() => html`<div class=\"hour-line\"></div>`)}\n ${repeat(\n lanedTimed,\n (entry) => this.entryKey(entry),\n (entry) => this._renderTimedEntry(entry, Math.max(timedLaneCount, 1), dayStart, dayEnd),\n )}\n ${nowTopRem !== null\n ? html`<div class=\"now-line\" style=\"top: ${nowTopRem}rem\" aria-hidden=\"true\">\n <span class=\"now-pill\">${nowLabel(new Date(this._now))}</span>\n </div>`\n : nothing}\n </div>\n </div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"calendar-day\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"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { CalendarTimelineBase, HOUR_HEIGHT_REM } from \"./calendar-timeline-base.js\";\nimport { iconMapPin } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n assignLanes,\n isWeekend,\n minutesSinceMidnight,\n monthName,\n parseIsoDate,\n toIsoDate,\n type LanedEntry,\n} from \"./utils/calendar.js\";\n\nconst NOW_MARKER_INTERVAL_MS = 60_000;\n\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst hourLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\" });\n\n/** Formats hour `h` (0-23) as a locale-aware hour label, e.g. \"9 AM\". */\nfunction hourLabel(h: number): string {\n return hourLabelFormatter.format(new Date(2000, 0, 1, h));\n}\n\nconst nowLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\", minute: \"2-digit\" });\n\n// Half-heights of the current-time pill and of an hour label, derived from\n// --ui-font-size-sm x --ui-line-height-tight (plus the pill's vertical\n// padding). Used to work out which hour label the pill covers.\nconst NOW_PILL_HALF_HEIGHT_REM = (0.75 * 1.25 + 0.25) / 2;\nconst HOUR_LABEL_HALF_HEIGHT_REM = (0.75 * 1.25) / 2;\n\n/**\n * Formats `date` as a locale-aware clock time without any AM/PM marker, e.g.\n * \"6:37\" in a 12-hour locale and \"18:37\" in a 24-hour one. The meridiem is\n * dropped so the label stays narrow enough for the hour gutter.\n */\nfunction nowLabel(date: Date): string {\n return nowLabelFormatter\n .formatToParts(date)\n .filter((part) => part.type !== \"dayPeriod\")\n .map((part) => part.value)\n .join(\"\")\n .trim();\n}\n\n/**\n * The hour (0-23) whose gutter label the current-time pill overlaps, given the\n * pill's offset in rem from the top of the grid, or `null` when the pill\n * clears every label. Labels sit flush with the top of their own hour cell.\n */\nfunction hourLabelCoveredByNow(nowTopRem: number | null): number | null {\n if (nowTopRem === null) return null;\n const hour = Math.round((nowTopRem - HOUR_LABEL_HALF_HEIGHT_REM) / HOUR_HEIGHT_REM);\n if (hour < 0 || hour > 23) return null;\n const labelCenterRem = hour * HOUR_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n const clearance = NOW_PILL_HALF_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n return Math.abs(nowTopRem - labelCenterRem) < clearance ? hour : null;\n}\n\n/**\n * A single day rendered as an hourly time grid — a Google-Calendar-style\n * view distinct from `calendar-month`'s whole-day table. Declarative\n * `calendar-entry` children with a time-of-day in `start`/`end` (e.g.\n * `start=\"2026-03-05T09:00\"`) render as positioned/sized blocks; entries\n * with only a date (no time) render in an all-day band above the grid.\n * Overlapping timed entries stack into side-by-side columns; overlapping\n * all-day/multi-day entries stack into lanes, same as `calendar-month`.\n * Read-only.\n *\n * Shares its slotted-entry observation, resolution, and hover/focus\n * interaction sync with `calendar-week` via `CalendarTimelineBase`.\n *\n * @element calendar-day\n * @slot - Declarative `calendar-entry` elements to render for this day.\n * @slot actions - Optional controls rendered beside the day name (e.g. day-navigation buttons).\n */\n@customElement(\"calendar-day\")\nexport class CalendarDay extends CalendarTimelineBase {\n /** The day shown, `\"YYYY-MM-DD\"`. */\n @property({ reflect: true }) date: string = toIsoDate(new Date());\n\n /**\n * Shows a fine live line marking the current time, with a rounded pill in\n * the hour gutter reading the current clock time. The hour label the pill\n * covers is hidden while it does. Only rendered when `date` is today.\n */\n @property({ type: Boolean, reflect: true, attribute: \"time-marker\" }) timeMarker = false;\n\n /**\n * Minimum width for the day column, as a CSS length (e.g. `\"18rem\"`).\n * Unset leaves the host's width fully controlled by its container —\n * useful as the sizing floor when placing several `calendar-day`\n * elements in a scrollable row.\n */\n @property({ reflect: true, attribute: \"min-width\" }) minWidth = \"\";\n\n @state() private _now = Date.now();\n\n private _nowTimer: ReturnType<typeof setInterval> | null = null;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n min-width: var(--calendar-day-min-width, 0);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .day-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .day-name {\n margin: 0;\n min-width: 0;\n color: var(--ui-text, #0f172a);\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .day-name.weekend {\n color: var(--ui-text-muted, #64748b);\n }\n .day-name.today {\n color: var(--ui-primary, #4f46e5);\n }\n .actions {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 0.5rem;\n }\n .all-day-band {\n display: flex;\n margin-bottom: 0.5rem;\n }\n .all-day-band.empty {\n display: none;\n }\n .hour-gutter-spacer {\n flex: 0 0 3rem;\n }\n .all-day-lanes {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 0.25rem;\n }\n .all-day-lane {\n display: flex;\n gap: 0.25rem;\n }\n .grid {\n display: flex;\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n /* The hour grid is the day's canvas — .day-column only paints for\n weekend/today, so without this the page showed through every\n ordinary hour. The today tint is translucent and composites over\n this paper rather than over the page. */\n background: var(--ui-surface, #ffffff);\n }\n .hour-gutter {\n flex: 0 0 3rem;\n }\n .hour-label-cell {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n padding-right: 0.5rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n line-height: var(--ui-line-height-tight, 1.25);\n text-align: right;\n white-space: nowrap;\n }\n /* Hidden rather than removed so the cell keeps its own separator line. */\n .hour-label.covered {\n visibility: hidden;\n }\n .day-column {\n position: relative;\n flex: 1 1 auto;\n height: ${HOUR_HEIGHT_REM * 24}rem;\n }\n .day-column.weekend {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .day-column.today {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 6%, transparent);\n }\n .now-line {\n position: absolute;\n left: 0;\n right: 0;\n height: 2px;\n background: var(--ui-danger, #dc2626);\n pointer-events: none;\n z-index: 2;\n }\n /* Overhangs left into the hour gutter; nothing between here and .grid\n clips overflow, and .day-column's z-index stays auto, so the pill\n paints above the (unpositioned) hour labels it overlaps. */\n .now-pill {\n position: absolute;\n top: 50%;\n right: 100%;\n border-radius: var(--ui-radius-pill, 9999px);\n padding: 0.125rem 0.25rem;\n background: var(--ui-danger, #dc2626);\n color: var(--ui-on-accent, #ffffff);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transform: translateY(-50%);\n }\n .hour-line {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .entry-bar {\n position: relative;\n box-sizing: border-box;\n flex: 1 1 auto;\n overflow: hidden;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem 0.5rem;\n transition: box-shadow 120ms ease;\n }\n .entry-bar.entry-block {\n position: absolute;\n }\n .entry-bar.entry-hovered,\n .entry-bar.entry-focused {\n box-shadow: inset 0 0 0 100vmax var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .entry-title {\n display: block;\n overflow: hidden;\n font-weight: var(--ui-font-weight-medium, 500);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n overflow: hidden;\n color: inherit;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location svg {\n flex: 0 0 auto;\n }\n .entry-link {\n position: absolute;\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n color: inherit;\n cursor: pointer;\n text-decoration: none;\n }\n .entry-link:focus-visible {\n outline: 2px solid var(--ui-primary, #4f46e5);\n outline-offset: -2px;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)) inset;\n }\n .entry-bar.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-text-muted, #64748b);\n }\n .entry-bar.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-info, #0ea5e9);\n }\n .entry-bar.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-primary, #4f46e5);\n }\n .entry-bar.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-success, #16a34a);\n }\n .entry-bar.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-warning, #d97706);\n }\n .entry-bar.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .entry-link:focus-visible {\n outline-color: Highlight;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entry-bar {\n transition: none;\n }\n }\n slot:not([name]) {\n display: none;\n }\n `,\n ];\n\n /** Starts the current-time ticker if `time-marker` is already set on connect. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._syncNowTimer();\n }\n\n /** Stops the current-time ticker when this element disconnects. */\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._nowTimer != null) clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n\n /** Starts/stops the current-time ticker and re-syncs the min-width host style to match the latest properties. */\n protected override updated(): void {\n super.updated();\n this._syncNowTimer();\n this._syncMinWidth();\n }\n\n /** Ensures a 60s current-time ticker is running only while `timeMarker` is enabled. */\n private _syncNowTimer(): void {\n if (this.timeMarker && this._nowTimer == null) {\n this._now = Date.now();\n this._nowTimer = setInterval(() => {\n this._now = Date.now();\n }, NOW_MARKER_INTERVAL_MS);\n } else if (!this.timeMarker && this._nowTimer != null) {\n clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n }\n\n /** Reflects `minWidth` onto the `--calendar-day-min-width` custom property the host's own styles read. */\n private _syncMinWidth(): void {\n if (this.minWidth) {\n this.style.setProperty(\"--calendar-day-min-width\", this.minWidth);\n } else {\n this.style.removeProperty(\"--calendar-day-min-width\");\n }\n }\n\n /** Renders one lane's stacked all-day bars, given the entries assigned to it. */\n private _renderAllDayLane(laned: LanedEntry[], lane: number) {\n const entries = laned.filter((entry) => entry.lane === lane);\n return html`\n <div class=\"all-day-lane\">\n ${entries.map((entry) => {\n const bodyText = [entry.label, entry.location].filter(Boolean).join(\" · \");\n return html`\n <div\n class=\"entry-bar ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n })}\n </div>\n `;\n }\n\n\n protected override render() {\n const day = parseIsoDate(this.date) ?? new Date();\n const dayStart = new Date(day);\n dayStart.setHours(0, 0, 0, 0);\n const dayEnd = new Date(day);\n dayEnd.setHours(23, 59, 59, 999);\n const isToday = toIsoDate(day) === toIsoDate(new Date());\n const isWeekendDay = isWeekend(day);\n\n const resolved = this.resolveTimedEntriesFor(dayStart, dayEnd);\n const allDay = resolved.filter((entry) => entry.allDay);\n const timed = resolved.filter((entry) => !entry.allDay);\n const { entries: lanedAllDay, laneCount: allDayLaneCount } = assignLanes(allDay);\n const { entries: lanedTimed, laneCount: timedLaneCount } = assignLanes(timed, { exclusiveEnd: true });\n const nowTopRem =\n this.timeMarker && isToday ? (minutesSinceMidnight(new Date(this._now)) / 60) * HOUR_HEIGHT_REM : null;\n const coveredHour = hourLabelCoveredByNow(nowTopRem);\n\n return html`\n <div class=\"day\">\n <div class=\"day-header\">\n <h4 class=\"day-name ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${monthName(day.getMonth() + 1)} ${day.getDate()}, ${day.getFullYear()}\n </h4>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n <div class=\"all-day-band ${allDay.length === 0 ? \"empty\" : \"\"}\">\n <div class=\"hour-gutter-spacer\"></div>\n <div class=\"all-day-lanes\">\n ${repeat(\n Array.from({ length: Math.max(allDayLaneCount, 1) }, (_, i) => i),\n (lane) => lane,\n (lane) => this._renderAllDayLane(lanedAllDay, lane),\n )}\n </div>\n </div>\n <div class=\"grid\">\n <div class=\"hour-gutter\">\n ${HOURS.map(\n (h) =>\n html`<div class=\"hour-label-cell\">\n <span class=\"hour-label ${h === coveredHour ? \"covered\" : \"\"}\">${hourLabel(h)}</span>\n </div>`,\n )}\n </div>\n <div class=\"day-column ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${HOURS.map(() => html`<div class=\"hour-line\"></div>`)}\n ${repeat(\n lanedTimed,\n (entry) => this.entryKey(entry),\n (entry) => this.renderTimedEntry(entry, Math.max(timedLaneCount, 1), dayStart, dayEnd),\n )}\n ${nowTopRem !== null\n ? html`<div class=\"now-line\" style=\"top: ${nowTopRem}rem\" aria-hidden=\"true\">\n <span class=\"now-pill\">${nowLabel(new Date(this._now))}</span>\n </div>`\n : nothing}\n </div>\n </div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"calendar-day\": CalendarDay;\n }\n}\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LitElement, nothing } from "lit";
|
|
2
2
|
import type { CalendarEntry } from "./calendar-entry.js";
|
|
3
3
|
import { type LanedEntry, type ResolvedTimedEntry } from "./utils/calendar.js";
|
|
4
|
+
/** Height of one hour row in the hour grid. */
|
|
5
|
+
export declare const HOUR_HEIGHT_REM = 3;
|
|
4
6
|
/**
|
|
5
7
|
* Shared base for the hour-grid calendar views, `calendar-day` and
|
|
6
8
|
* `calendar-week` — not a registered custom element itself. Holds what both
|
|
@@ -31,6 +33,8 @@ export declare abstract class CalendarTimelineBase extends LitElement {
|
|
|
31
33
|
protected handleSlotChange(): void;
|
|
32
34
|
/** Reads, resolves, and filters slotted entries to those overlapping `[rangeStart, rangeEnd]`. */
|
|
33
35
|
protected resolveTimedEntriesFor(rangeStart: Date, rangeEnd: Date): ResolvedTimedEntry[];
|
|
36
|
+
/** Renders a positioned/sized block for one timed entry, clamped to `[dayStart, dayEnd]`. */
|
|
37
|
+
protected renderTimedEntry(entry: LanedEntry, laneCount: number, dayStart: Date, dayEnd: Date): import("lit-html").TemplateResult<1>;
|
|
34
38
|
/** Current render key shared by an entry's rendered cells/blocks. */
|
|
35
39
|
protected entryKey(entry: LanedEntry): string;
|
|
36
40
|
/** Toggles one interaction class on every rendered element belonging to an entry. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-timeline-base.d.ts","sourceRoot":"","sources":["../src/calendar-timeline-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,OAAO,EAAE,MAAM,KAAK,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"calendar-timeline-base.d.ts","sourceRoot":"","sources":["../src/calendar-timeline-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,U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K,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yDAclE;CACF"}
|
|
@@ -6,7 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { LitElement, html, nothing } from "lit";
|
|
8
8
|
import { queryAssignedElements, state } from "lit/decorators.js";
|
|
9
|
-
import {
|
|
9
|
+
import { iconMapPin } from "./icons.js";
|
|
10
|
+
import { CALENDAR_ENTRY_ATTRIBUTES, minutesSinceMidnight, overlapsTimedRange, readCalendarEntryElement, resolveTimedEntry, } from "./utils/calendar.js";
|
|
11
|
+
/** Height of one hour row in the hour grid. */
|
|
12
|
+
export const HOUR_HEIGHT_REM = 3;
|
|
10
13
|
/**
|
|
11
14
|
* Shared base for the hour-grid calendar views, `calendar-day` and
|
|
12
15
|
* `calendar-week` — not a registered custom element itself. Holds what both
|
|
@@ -60,7 +63,33 @@ export class CalendarTimelineBase extends LitElement {
|
|
|
60
63
|
.map(readCalendarEntryElement)
|
|
61
64
|
.map(resolveTimedEntry)
|
|
62
65
|
.filter((entry) => entry !== null)
|
|
63
|
-
.filter((entry) =>
|
|
66
|
+
.filter((entry) => overlapsTimedRange(entry, rangeStart, rangeEnd));
|
|
67
|
+
}
|
|
68
|
+
/** Renders a positioned/sized block for one timed entry, clamped to `[dayStart, dayEnd]`. */
|
|
69
|
+
renderTimedEntry(entry, laneCount, dayStart, dayEnd) {
|
|
70
|
+
const visibleStart = entry.startDate < dayStart ? dayStart : entry.startDate;
|
|
71
|
+
const visibleEnd = entry.endDate > dayEnd ? dayEnd : entry.endDate;
|
|
72
|
+
const topRem = (minutesSinceMidnight(visibleStart) / 60) * HOUR_HEIGHT_REM;
|
|
73
|
+
const bottomRem = (minutesSinceMidnight(visibleEnd) / 60) * HOUR_HEIGHT_REM;
|
|
74
|
+
const heightRem = Math.max(bottomRem - topRem, HOUR_HEIGHT_REM / 4);
|
|
75
|
+
const widthPercent = 100 / laneCount;
|
|
76
|
+
const bodyText = [entry.label, ...(entry.details ?? []), entry.location].filter(Boolean).join("\n");
|
|
77
|
+
return html `
|
|
78
|
+
<div
|
|
79
|
+
class="entry-bar entry-block ${entry.color}"
|
|
80
|
+
data-entry-key=${this.entryKey(entry)}
|
|
81
|
+
title=${entry.href ? nothing : bodyText}
|
|
82
|
+
style="top: ${topRem}rem; height: ${heightRem}rem; left: ${entry.lane * widthPercent}%; width: ${widthPercent}%;"
|
|
83
|
+
>
|
|
84
|
+
${this.renderEntryLink(entry, bodyText)}
|
|
85
|
+
<span class="entry-title" aria-hidden=${entry.href ? "true" : nothing}>${entry.label}</span>
|
|
86
|
+
${entry.location
|
|
87
|
+
? html `<span class="entry-location" aria-hidden=${entry.href ? "true" : nothing}
|
|
88
|
+
>${iconMapPin(14)}${entry.location}</span
|
|
89
|
+
>`
|
|
90
|
+
: nothing}
|
|
91
|
+
</div>
|
|
92
|
+
`;
|
|
64
93
|
}
|
|
65
94
|
/** Current render key shared by an entry's rendered cells/blocks. */
|
|
66
95
|
entryKey(entry) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-timeline-base.js","sourceRoot":"","sources":["../src/calendar-timeline-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,wBAAwB,EACxB,iBAAiB,GAGlB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAgB,oBAAqB,SAAQ,UAAU;IAA7D;;QAIE,2FAA2F;QACxE,mBAAc,GAAG,CAAC,CAAC;IAuFxC,CAAC;IAnFC,+EAA+E;IACtE,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,I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AC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;0BAC/D,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;mBACvE,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;kBAChE,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;cACpE;YACR,CAAC,CAAC,OAAO,CAAC;IACd,CAAC;CACF;AA1FoB;IADlB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;2DACH;AAGhC;IAAlB,KAAK,EAAE;4DAA8B","sourcesContent":["import { LitElement, html, nothing } from \"lit\";\nimport { queryAssignedElements, state } from \"lit/decorators.js\";\nimport type { CalendarEntry } from \"./calendar-entry.js\";\nimport {\n CALENDAR_ENTRY_ATTRIBUTES,\n overlapsRange,\n readCalendarEntryElement,\n resolveTimedEntry,\n type LanedEntry,\n type ResolvedTimedEntry,\n} from \"./utils/calendar.js\";\n\n/**\n * Shared base for the hour-grid calendar views, `calendar-day` and\n * `calendar-week` — not a registered custom element itself. Holds what both\n * need identically: observing declarative `calendar-entry` children for live\n * updates, resolving them into time-aware entries, and syncing hover/focus\n * interaction classes on rendered entry bars/links. Pure date/geometry math\n * (parsing, lane assignment) stays in `utils/calendar.ts` per this\n * codebase's existing convention; this class holds only the parts that need\n * to be instance state on a `LitElement` (observers, cached query results).\n *\n * Subclasses must render a default `<slot @slotchange=${this.handleSlotChange}>`\n * for `calendar-entry` children, and use the `.entry-bar`/`.entry-link`\n * class-naming convention for `syncEntryInteractions`/`renderEntryLink` to\n * find rendered entry elements.\n */\nexport abstract class CalendarTimelineBase extends LitElement {\n @queryAssignedElements({ selector: \"calendar-entry\" })\n protected readonly entryElements!: CalendarEntry[];\n\n /** Bumped when entry elements, attributes, or slotted text change to force a re-render. */\n @state() protected entriesVersion = 0;\n\n private entriesObserver?: MutationObserver;\n\n /** Observes declarative entry attributes and slotted text for live updates. */\n override connectedCallback(): void {\n super.connectedCallback();\n this.entriesVersion++;\n this.entriesObserver ??= new MutationObserver(() => this.entriesVersion++);\n this.entriesObserver.observe(this, {\n attributes: true,\n attributeFilter: CALENDAR_ENTRY_ATTRIBUTES,\n characterData: true,\n childList: true,\n subtree: true,\n });\n }\n\n /** Releases the entry observer when this element disconnects. */\n override disconnectedCallback(): void {\n this.entriesObserver?.disconnect();\n super.disconnectedCallback();\n }\n\n /** Restores hover/focus classes from the live DOM after Lit updates or reuses cells. */\n protected override updated(): void {\n this.syncEntryInteractions();\n }\n\n /** Re-renders when declarative `calendar-entry` children are added or removed. */\n protected handleSlotChange(): void {\n this.entriesVersion++;\n }\n\n /** Reads, resolves, and filters slotted entries to those overlapping `[rangeStart, rangeEnd]`. */\n protected resolveTimedEntriesFor(rangeStart: Date, rangeEnd: Date): ResolvedTimedEntry[] {\n return this.entryElements\n .map(readCalendarEntryElement)\n .map(resolveTimedEntry)\n .filter((entry): entry is ResolvedTimedEntry => entry !== null)\n .filter((entry) => overlapsRange(entry, rangeStart, rangeEnd));\n }\n\n /** Current render key shared by an entry's rendered cells/blocks. */\n protected entryKey(entry: LanedEntry): string {\n return `${entry.lane}|${entry.start}|${entry.end}|${entry.label}|${entry.href ?? \"\"}`;\n }\n\n /** Toggles one interaction class on every rendered element belonging to an entry. */\n protected setEntryInteraction(entryKey: string, className: string, active: boolean): void {\n for (const cell of this.renderRoot.querySelectorAll<HTMLElement>(\".entry-bar\")) {\n if (cell.dataset.entryKey === entryKey) {\n cell.classList.toggle(className, active);\n }\n }\n }\n\n /** Reconciles classes against the links actually hovered or focused after a render. */\n protected syncEntryInteractions(): void {\n for (const cell of this.renderRoot.querySelectorAll<HTMLElement>(\".entry-bar\")) {\n cell.classList.remove(\"entry-hovered\", \"entry-focused\");\n }\n for (const link of this.renderRoot.querySelectorAll<HTMLElement>(\".entry-link:hover\")) {\n this.setEntryInteraction(link.dataset.entryKey ?? \"\", \"entry-hovered\", true);\n }\n const activeElement = this.shadowRoot?.activeElement;\n if (activeElement instanceof HTMLElement && activeElement.matches(\".entry-link\")) {\n this.setEntryInteraction(activeElement.dataset.entryKey ?? \"\", \"entry-focused\", true);\n }\n }\n\n /** Renders a transparent full-cell link without wrapping the visible text. */\n protected renderEntryLink(entry: LanedEntry, accessibleText: string) {\n const entryKey = this.entryKey(entry);\n return entry.href\n ? html`<a\n class=\"entry-link\"\n href=${entry.href}\n aria-label=${accessibleText}\n data-entry-key=${entryKey}\n @pointerenter=${() => this.setEntryInteraction(entryKey, \"entry-hovered\", true)}\n @pointerleave=${() => this.setEntryInteraction(entryKey, \"entry-hovered\", false)}\n @focus=${() => this.setEntryInteraction(entryKey, \"entry-focused\", true)}\n @blur=${() => this.setEntryInteraction(entryKey, \"entry-focused\", false)}\n ></a>`\n : nothing;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"calendar-timeline-base.js","sourceRoot":"","sources":["../src/calendar-timeline-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,GAGlB,MAAM,qBAAqB,CAAC;AAE7B,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAgB,oBAAqB,SAAQ,UAAU;IAA7D;;QAIE,2FAA2F;QACxE,mBAAc,GAAG,CAAC,CAAC;IAkHxC,CAAC;IA9GC,+EAA+E;IACtE,iBAAiB;QACxB,KAAK,CAAC,i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,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;QACxF,CAAC;IACH,CAAC;IAED,8EAA8E;IACpE,eAAe,CAAC,KAAiB,EAAE,cAAsB;QACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC,IAAI;YACf,CAAC,CAAC,IAAI,CAAA;;iBAEK,KAAK,CAAC,IAAI;uBACJ,cAAc;2BACV,QAAQ;0BACT,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;0BAC/D,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;mBACvE,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;kBAChE,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;cACpE;YACR,CAAC,CAAC,OAAO,CAAC;IACd,CAAC;CACF;AArHoB;IADlB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;2DACH;AAGhC;IAAlB,KAAK,EAAE;4DAA8B","sourcesContent":["import { LitElement, html, nothing } from \"lit\";\nimport { queryAssignedElements, state } from \"lit/decorators.js\";\nimport type { CalendarEntry } from \"./calendar-entry.js\";\nimport { iconMapPin } from \"./icons.js\";\nimport {\n CALENDAR_ENTRY_ATTRIBUTES,\n minutesSinceMidnight,\n overlapsTimedRange,\n readCalendarEntryElement,\n resolveTimedEntry,\n type LanedEntry,\n type ResolvedTimedEntry,\n} from \"./utils/calendar.js\";\n\n/** Height of one hour row in the hour grid. */\nexport const HOUR_HEIGHT_REM = 3;\n\n/**\n * Shared base for the hour-grid calendar views, `calendar-day` and\n * `calendar-week` — not a registered custom element itself. Holds what both\n * need identically: observing declarative `calendar-entry` children for live\n * updates, resolving them into time-aware entries, and syncing hover/focus\n * interaction classes on rendered entry bars/links. Pure date/geometry math\n * (parsing, lane assignment) stays in `utils/calendar.ts` per this\n * codebase's existing convention; this class holds only the parts that need\n * to be instance state on a `LitElement` (observers, cached query results).\n *\n * Subclasses must render a default `<slot @slotchange=${this.handleSlotChange}>`\n * for `calendar-entry` children, and use the `.entry-bar`/`.entry-link`\n * class-naming convention for `syncEntryInteractions`/`renderEntryLink` to\n * find rendered entry elements.\n */\nexport abstract class CalendarTimelineBase extends LitElement {\n @queryAssignedElements({ selector: \"calendar-entry\" })\n protected readonly entryElements!: CalendarEntry[];\n\n /** Bumped when entry elements, attributes, or slotted text change to force a re-render. */\n @state() protected entriesVersion = 0;\n\n private entriesObserver?: MutationObserver;\n\n /** Observes declarative entry attributes and slotted text for live updates. */\n override connectedCallback(): void {\n super.connectedCallback();\n this.entriesVersion++;\n this.entriesObserver ??= new MutationObserver(() => this.entriesVersion++);\n this.entriesObserver.observe(this, {\n attributes: true,\n attributeFilter: CALENDAR_ENTRY_ATTRIBUTES,\n characterData: true,\n childList: true,\n subtree: true,\n });\n }\n\n /** Releases the entry observer when this element disconnects. */\n override disconnectedCallback(): void {\n this.entriesObserver?.disconnect();\n super.disconnectedCallback();\n }\n\n /** Restores hover/focus classes from the live DOM after Lit updates or reuses cells. */\n protected override updated(): void {\n this.syncEntryInteractions();\n }\n\n /** Re-renders when declarative `calendar-entry` children are added or removed. */\n protected handleSlotChange(): void {\n this.entriesVersion++;\n }\n\n /** Reads, resolves, and filters slotted entries to those overlapping `[rangeStart, rangeEnd]`. */\n protected resolveTimedEntriesFor(rangeStart: Date, rangeEnd: Date): ResolvedTimedEntry[] {\n return this.entryElements\n .map(readCalendarEntryElement)\n .map(resolveTimedEntry)\n .filter((entry): entry is ResolvedTimedEntry => entry !== null)\n .filter((entry) => overlapsTimedRange(entry, rangeStart, rangeEnd));\n }\n\n /** Renders a positioned/sized block for one timed entry, clamped to `[dayStart, dayEnd]`. */\n protected renderTimedEntry(entry: LanedEntry, laneCount: number, dayStart: Date, dayEnd: Date) {\n const visibleStart = entry.startDate < dayStart ? dayStart : entry.startDate;\n const visibleEnd = entry.endDate > dayEnd ? dayEnd : entry.endDate;\n const topRem = (minutesSinceMidnight(visibleStart) / 60) * HOUR_HEIGHT_REM;\n const bottomRem = (minutesSinceMidnight(visibleEnd) / 60) * HOUR_HEIGHT_REM;\n const heightRem = Math.max(bottomRem - topRem, HOUR_HEIGHT_REM / 4);\n const widthPercent = 100 / laneCount;\n const bodyText = [entry.label, ...(entry.details ?? []), entry.location].filter(Boolean).join(\"\\n\");\n return html`\n <div\n class=\"entry-bar entry-block ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n style=\"top: ${topRem}rem; height: ${heightRem}rem; left: ${entry.lane * widthPercent}%; width: ${widthPercent}%;\"\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n }\n\n /** Current render key shared by an entry's rendered cells/blocks. */\n protected entryKey(entry: LanedEntry): string {\n return `${entry.lane}|${entry.start}|${entry.end}|${entry.label}|${entry.href ?? \"\"}`;\n }\n\n /** Toggles one interaction class on every rendered element belonging to an entry. */\n protected setEntryInteraction(entryKey: string, className: string, active: boolean): void {\n for (const cell of this.renderRoot.querySelectorAll<HTMLElement>(\".entry-bar\")) {\n if (cell.dataset.entryKey === entryKey) {\n cell.classList.toggle(className, active);\n }\n }\n }\n\n /** Reconciles classes against the links actually hovered or focused after a render. */\n protected syncEntryInteractions(): void {\n for (const cell of this.renderRoot.querySelectorAll<HTMLElement>(\".entry-bar\")) {\n cell.classList.remove(\"entry-hovered\", \"entry-focused\");\n }\n for (const link of this.renderRoot.querySelectorAll<HTMLElement>(\".entry-link:hover\")) {\n this.setEntryInteraction(link.dataset.entryKey ?? \"\", \"entry-hovered\", true);\n }\n const activeElement = this.shadowRoot?.activeElement;\n if (activeElement instanceof HTMLElement && activeElement.matches(\".entry-link\")) {\n this.setEntryInteraction(activeElement.dataset.entryKey ?? \"\", \"entry-focused\", true);\n }\n }\n\n /** Renders a transparent full-cell link without wrapping the visible text. */\n protected renderEntryLink(entry: LanedEntry, accessibleText: string) {\n const entryKey = this.entryKey(entry);\n return entry.href\n ? html`<a\n class=\"entry-link\"\n href=${entry.href}\n aria-label=${accessibleText}\n data-entry-key=${entryKey}\n @pointerenter=${() => this.setEntryInteraction(entryKey, \"entry-hovered\", true)}\n @pointerleave=${() => this.setEntryInteraction(entryKey, \"entry-hovered\", false)}\n @focus=${() => this.setEntryInteraction(entryKey, \"entry-focused\", true)}\n @blur=${() => this.setEntryInteraction(entryKey, \"entry-focused\", false)}\n ></a>`\n : nothing;\n }\n}\n"]}
|
package/dist/calendar-week.d.ts
CHANGED
|
@@ -24,8 +24,6 @@ export declare class CalendarWeek extends CalendarTimelineBase {
|
|
|
24
24
|
static styles: import("lit").CSSResult[];
|
|
25
25
|
/** Renders one all-day/multi-day bar, spanning the visible-week columns it covers. */
|
|
26
26
|
private _renderAllDayEntry;
|
|
27
|
-
/** Renders a positioned/sized block for one timed entry, clamped to `day`'s bounds. */
|
|
28
|
-
private _renderTimedEntry;
|
|
29
27
|
/** Renders one day's hour column: grid lines plus its own independently laned timed entries. */
|
|
30
28
|
private _renderDayColumn;
|
|
31
29
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-week.d.ts","sourceRoot":"","sources":["../src/calendar-week.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"calendar-week.d.ts","sourceRoot":"","sources":["../src/calendar-week.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,6BAA6B,CAAC;AA4BpF;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,YAAa,SAAQ,oBAAoB;IACpD,mGAAmG;IACtE,IAAI,EAAE,MAAM,CAAyB;IAElE,OAAgB,MAAM,4BAoMpB;IAEF,sFAAsF;IACtF,OAAO,CAAC,kBAAkB;IAyB1B,gGAAgG;IAChG,OAAO,CAAC,gBAAgB;IAoBxB,UAAmB,MAAM,yCAkDxB;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
|
package/dist/calendar-week.js
CHANGED
|
@@ -7,11 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { css, html, nothing } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
9
|
import { repeat } from "lit/directives/repeat.js";
|
|
10
|
-
import { CalendarTimelineBase } from "./calendar-timeline-base.js";
|
|
10
|
+
import { CalendarTimelineBase, HOUR_HEIGHT_REM } from "./calendar-timeline-base.js";
|
|
11
11
|
import { iconMapPin } from "./icons.js";
|
|
12
12
|
import { tokens } from "./tokens.js";
|
|
13
|
-
import { WEEKDAY_ABBR, addDays, assignLanes,
|
|
14
|
-
const HOUR_HEIGHT_REM = 3;
|
|
13
|
+
import { WEEKDAY_ABBR, addDays, assignLanes, overlapsTimedRange, parseIsoDate, startOfWeek, toIsoDate, } from "./utils/calendar.js";
|
|
15
14
|
const HOURS = Array.from({ length: 24 }, (_, i) => i);
|
|
16
15
|
const hourLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: "numeric" });
|
|
17
16
|
/** Formats hour `h` (0-23) as a locale-aware hour label, e.g. "9 AM". */
|
|
@@ -268,45 +267,19 @@ let CalendarWeek = class CalendarWeek extends CalendarTimelineBase {
|
|
|
268
267
|
</div>
|
|
269
268
|
`;
|
|
270
269
|
}
|
|
271
|
-
/** Renders a positioned/sized block for one timed entry, clamped to `day`'s bounds. */
|
|
272
|
-
_renderTimedEntry(entry, laneCount, dayStart, dayEnd) {
|
|
273
|
-
const visibleStart = entry.startDate < dayStart ? dayStart : entry.startDate;
|
|
274
|
-
const visibleEnd = entry.endDate > dayEnd ? dayEnd : entry.endDate;
|
|
275
|
-
const topRem = (minutesSinceMidnight(visibleStart) / 60) * HOUR_HEIGHT_REM;
|
|
276
|
-
const bottomRem = (minutesSinceMidnight(visibleEnd) / 60) * HOUR_HEIGHT_REM;
|
|
277
|
-
const heightRem = Math.max(bottomRem - topRem, HOUR_HEIGHT_REM / 4);
|
|
278
|
-
const widthPercent = 100 / laneCount;
|
|
279
|
-
const bodyText = [entry.label, ...(entry.details ?? []), entry.location].filter(Boolean).join("\n");
|
|
280
|
-
return html `
|
|
281
|
-
<div
|
|
282
|
-
class="entry-bar entry-block ${entry.color}"
|
|
283
|
-
data-entry-key=${this.entryKey(entry)}
|
|
284
|
-
title=${entry.href ? nothing : bodyText}
|
|
285
|
-
style="top: ${topRem}rem; height: ${heightRem}rem; left: ${entry.lane * widthPercent}%; width: ${widthPercent}%;"
|
|
286
|
-
>
|
|
287
|
-
${this.renderEntryLink(entry, bodyText)}
|
|
288
|
-
<span class="entry-title" aria-hidden=${entry.href ? "true" : nothing}>${entry.label}</span>
|
|
289
|
-
${entry.location
|
|
290
|
-
? html `<span class="entry-location" aria-hidden=${entry.href ? "true" : nothing}
|
|
291
|
-
>${iconMapPin(14)}${entry.location}</span
|
|
292
|
-
>`
|
|
293
|
-
: nothing}
|
|
294
|
-
</div>
|
|
295
|
-
`;
|
|
296
|
-
}
|
|
297
270
|
/** Renders one day's hour column: grid lines plus its own independently laned timed entries. */
|
|
298
271
|
_renderDayColumn(day, timedWeek, todayIso) {
|
|
299
272
|
const dayStart = new Date(day);
|
|
300
273
|
dayStart.setHours(0, 0, 0, 0);
|
|
301
274
|
const dayEnd = new Date(day);
|
|
302
275
|
dayEnd.setHours(23, 59, 59, 999);
|
|
303
|
-
const dayTimed = timedWeek.filter((entry) =>
|
|
304
|
-
const { entries: laned, laneCount } = assignLanes(dayTimed);
|
|
276
|
+
const dayTimed = timedWeek.filter((entry) => overlapsTimedRange(entry, dayStart, dayEnd));
|
|
277
|
+
const { entries: laned, laneCount } = assignLanes(dayTimed, { exclusiveEnd: true });
|
|
305
278
|
const isToday = toIsoDate(day) === todayIso;
|
|
306
279
|
return html `
|
|
307
280
|
<div class="day-column ${isToday ? "today" : ""}">
|
|
308
281
|
${HOURS.map(() => html `<div class="hour-line"></div>`)}
|
|
309
|
-
${repeat(laned, (entry) => this.entryKey(entry), (entry) => this.
|
|
282
|
+
${repeat(laned, (entry) => this.entryKey(entry), (entry) => this.renderTimedEntry(entry, Math.max(laneCount, 1), dayStart, dayEnd))}
|
|
310
283
|
</div>
|
|
311
284
|
`;
|
|
312
285
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-week.js","sourceRoot":"","sources":["../src/calendar-week.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,OAAO,EACP,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,SAAS,GAGV,MAAM,qBAAqB,CAAC;AAE7B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,E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,CAAC,OAAO,EAAE;;eAE1C,CACF;;;;mCAIsB,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;;yEAEI,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC;cACvF,MAAM,CACN,WAAW,EACX,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC/B,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAC9D;;;;;cAKC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAA,gCAAgC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;;;cAG1E,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;;;4BAGhD,IAAI,CAAC,gBAAgB;;KAE5C,CAAC;IACJ,CAAC;CACF,CAAA;AApU8B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAsC;AAFvD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAsUxB","sourcesContent":["import { css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { CalendarTimelineBase } from \"./calendar-timeline-base.js\";\nimport { iconMapPin } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n WEEKDAY_ABBR,\n addDays,\n assignLanes,\n minutesSinceMidnight,\n overlapsRange,\n parseIsoDate,\n startOfWeek,\n toIsoDate,\n type LanedEntry,\n type ResolvedTimedEntry,\n} from \"./utils/calendar.js\";\n\nconst HOUR_HEIGHT_REM = 3;\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst hourLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\" });\n\n/** Formats hour `h` (0-23) as a locale-aware hour label, e.g. \"9 AM\". */\nfunction hourLabel(h: number): string {\n return hourLabelFormatter.format(new Date(2000, 0, 1, h));\n}\n\n/** 0-based day-of-week offset between `date` (local midnight) and `weekStart`. */\nfunction dayIndex(date: Date, weekStart: Date): number {\n return Math.round((date.getTime() - weekStart.getTime()) / 86_400_000);\n}\n\n/**\n * Sunday-through-Saturday week rendered as one shared hourly time grid — the\n * seven-day sibling of `calendar-day`. Unlike `calendar-year` composing 12\n * `calendar-month` children, this is its own independent 7-column layout\n * (not 7 nested `<calendar-day>` elements): a single hour gutter is drawn\n * once, and multi-day/all-day entries span the days they cover as one\n * continuous bar in a shared all-day band, since lanes for that band are\n * assigned once across the whole visible week (unlike `calendar-month`'s\n * documented per-instance lane limitation). Timed entries stack into\n * side-by-side columns independently per day, same as `calendar-day`.\n * Read-only.\n *\n * Shares its slotted-entry observation, resolution, and hover/focus\n * interaction sync with `calendar-day` via `CalendarTimelineBase`.\n *\n * @element calendar-week\n * @slot - Declarative `calendar-entry` elements to render for this week.\n * @slot actions - Optional controls rendered beside the day headers (e.g. week-navigation buttons).\n */\n@customElement(\"calendar-week\")\nexport class CalendarWeek extends CalendarTimelineBase {\n /** Any date within the displayed week (`\"YYYY-MM-DD\"`) — the week runs Sunday through Saturday. */\n @property({ reflect: true }) date: string = toIsoDate(new Date());\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .week-header-row {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .week-header {\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n }\n .actions {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 0.5rem;\n }\n .hour-gutter-spacer {\n flex: 0 0 3rem;\n }\n .day-header {\n flex: 1 1 0;\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-semibold, 600);\n text-align: center;\n }\n .day-header .day-number {\n color: var(--ui-text, #0f172a);\n font-size: var(--ui-font-size-lg, 1rem);\n }\n .day-header.today,\n .day-header.today .day-number {\n color: var(--ui-primary, #4f46e5);\n }\n .all-day-band {\n display: flex;\n margin-bottom: 0.5rem;\n }\n .all-day-band.empty {\n display: none;\n }\n .all-day-lanes {\n display: grid;\n flex: 1 1 auto;\n grid-auto-rows: min-content;\n grid-template-columns: repeat(7, 1fr);\n gap: 0.25rem;\n }\n .grid {\n display: flex;\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n /* The hour grid is the week's canvas — .day-column only paints for\n weekend/today, so without this the page showed through every\n ordinary hour. The today tint is translucent and composites over\n this paper rather than over the page. */\n background: var(--ui-surface, #ffffff);\n }\n .hour-gutter {\n flex: 0 0 3rem;\n }\n .hour-label-cell {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n padding-right: 0.5rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n text-align: right;\n white-space: nowrap;\n }\n .week-days {\n display: flex;\n flex: 1 1 auto;\n }\n .day-column {\n position: relative;\n flex: 1 1 0;\n height: ${HOUR_HEIGHT_REM * 24}rem;\n border-left: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .day-column.today {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 6%, transparent);\n }\n .hour-line {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .entry-bar {\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem 0.5rem;\n transition: box-shadow 120ms ease;\n }\n .entry-bar.entry-block {\n position: absolute;\n }\n .entry-bar.entry-hovered,\n .entry-bar.entry-focused {\n box-shadow: inset 0 0 0 100vmax var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .entry-title {\n display: block;\n overflow: hidden;\n font-weight: var(--ui-font-weight-medium, 500);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n overflow: hidden;\n color: inherit;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location svg {\n flex: 0 0 auto;\n }\n .entry-link {\n position: absolute;\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n color: inherit;\n cursor: pointer;\n text-decoration: none;\n }\n .entry-link:focus-visible {\n outline: 2px solid var(--ui-primary, #4f46e5);\n outline-offset: -2px;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)) inset;\n }\n .entry-bar.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-text-muted, #64748b);\n }\n .entry-bar.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-info, #0ea5e9);\n }\n .entry-bar.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-primary, #4f46e5);\n }\n .entry-bar.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-success, #16a34a);\n }\n .entry-bar.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-warning, #d97706);\n }\n .entry-bar.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .entry-link:focus-visible {\n outline-color: Highlight;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entry-bar {\n transition: none;\n }\n }\n slot:not([name]) {\n display: none;\n }\n `,\n ];\n\n /** Renders one all-day/multi-day bar, spanning the visible-week columns it covers. */\n private _renderAllDayEntry(entry: LanedEntry, weekStart: Date, weekEnd: Date) {\n const visibleStart = entry.startDate < weekStart ? weekStart : entry.startDate;\n const visibleEnd = entry.endDate > weekEnd ? weekEnd : entry.endDate;\n const startCol = dayIndex(visibleStart, weekStart) + 1;\n const endCol = dayIndex(visibleEnd, weekStart) + 2;\n const bodyText = [entry.label, entry.location].filter(Boolean).join(\" · \");\n return html`\n <div\n class=\"entry-bar ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n style=\"grid-column: ${startCol} / ${endCol}; grid-row: ${entry.lane + 1};\"\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n }\n\n /** Renders a positioned/sized block for one timed entry, clamped to `day`'s bounds. */\n private _renderTimedEntry(entry: LanedEntry, laneCount: number, dayStart: Date, dayEnd: Date) {\n const visibleStart = entry.startDate < dayStart ? dayStart : entry.startDate;\n const visibleEnd = entry.endDate > dayEnd ? dayEnd : entry.endDate;\n const topRem = (minutesSinceMidnight(visibleStart) / 60) * HOUR_HEIGHT_REM;\n const bottomRem = (minutesSinceMidnight(visibleEnd) / 60) * HOUR_HEIGHT_REM;\n const heightRem = Math.max(bottomRem - topRem, HOUR_HEIGHT_REM / 4);\n const widthPercent = 100 / laneCount;\n const bodyText = [entry.label, ...(entry.details ?? []), entry.location].filter(Boolean).join(\"\\n\");\n return html`\n <div\n class=\"entry-bar entry-block ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n style=\"top: ${topRem}rem; height: ${heightRem}rem; left: ${entry.lane * widthPercent}%; width: ${widthPercent}%;\"\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n }\n\n /** Renders one day's hour column: grid lines plus its own independently laned timed entries. */\n private _renderDayColumn(day: Date, timedWeek: ResolvedTimedEntry[], todayIso: string) {\n const dayStart = new Date(day);\n dayStart.setHours(0, 0, 0, 0);\n const dayEnd = new Date(day);\n dayEnd.setHours(23, 59, 59, 999);\n const dayTimed = timedWeek.filter((entry) => overlapsRange(entry, dayStart, dayEnd));\n const { entries: laned, laneCount } = assignLanes(dayTimed);\n const isToday = toIsoDate(day) === todayIso;\n return html`\n <div class=\"day-column ${isToday ? \"today\" : \"\"}\">\n ${HOURS.map(() => html`<div class=\"hour-line\"></div>`)}\n ${repeat(\n laned,\n (entry) => this.entryKey(entry),\n (entry) => this._renderTimedEntry(entry, Math.max(laneCount, 1), dayStart, dayEnd),\n )}\n </div>\n `;\n }\n\n protected override render() {\n const anyDayInWeek = parseIsoDate(this.date) ?? new Date();\n const weekStart = startOfWeek(anyDayInWeek);\n const days = Array.from({ length: 7 }, (_, i) => addDays(weekStart, i));\n const weekEnd = new Date(days[6]);\n weekEnd.setHours(23, 59, 59, 999);\n const todayIso = toIsoDate(new Date());\n\n const resolved = this.resolveTimedEntriesFor(weekStart, weekEnd);\n const allDay = resolved.filter((entry) => entry.allDay);\n const timed = resolved.filter((entry) => !entry.allDay);\n const { entries: lanedAllDay, laneCount: allDayLaneCount } = assignLanes(allDay);\n\n return html`\n <div class=\"week\">\n <div class=\"week-header-row\">\n <div class=\"week-header\">\n <div class=\"hour-gutter-spacer\"></div>\n ${days.map(\n (day) => html`\n <div class=\"day-header ${toIsoDate(day) === todayIso ? \"today\" : \"\"}\">\n <div>${WEEKDAY_ABBR[day.getDay()]}</div>\n <div class=\"day-number\">${day.getDate()}</div>\n </div>\n `,\n )}\n </div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n <div class=\"all-day-band ${allDay.length === 0 ? \"empty\" : \"\"}\">\n <div class=\"hour-gutter-spacer\"></div>\n <div class=\"all-day-lanes\" style=\"grid-template-rows: repeat(${Math.max(allDayLaneCount, 1)}, min-content);\">\n ${repeat(\n lanedAllDay,\n (entry) => this.entryKey(entry),\n (entry) => this._renderAllDayEntry(entry, weekStart, weekEnd),\n )}\n </div>\n </div>\n <div class=\"grid\">\n <div class=\"hour-gutter\">\n ${HOURS.map((h) => html`<div class=\"hour-label-cell\">${hourLabel(h)}</div>`)}\n </div>\n <div class=\"week-days\">\n ${days.map((day) => this._renderDayColumn(day, timed, todayIso))}\n </div>\n </div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"calendar-week\": CalendarWeek;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"calendar-week.js","sourceRoot":"","sources":["../src/calendar-week.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO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AAE,CAAC;4CACP,GAAG,CAAC,OAAO,EAAE;;eAE1C,CACF;;;;mCAIsB,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;;yEAEI,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC;cACvF,MAAM,CACN,WAAW,EACX,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC/B,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAC9D;;;;;cAKC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAA,gCAAgC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;;;cAG1E,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;;;4BAGhD,IAAI,CAAC,gBAAgB;;KAE5C,CAAC;IACJ,CAAC;CACF,CAAA;AA1S8B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAsC;AAFvD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA4SxB","sourcesContent":["import { css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { CalendarTimelineBase, HOUR_HEIGHT_REM } from \"./calendar-timeline-base.js\";\nimport { iconMapPin } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n WEEKDAY_ABBR,\n addDays,\n assignLanes,\n overlapsTimedRange,\n parseIsoDate,\n startOfWeek,\n toIsoDate,\n type LanedEntry,\n type ResolvedTimedEntry,\n} from \"./utils/calendar.js\";\n\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst hourLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\" });\n\n/** Formats hour `h` (0-23) as a locale-aware hour label, e.g. \"9 AM\". */\nfunction hourLabel(h: number): string {\n return hourLabelFormatter.format(new Date(2000, 0, 1, h));\n}\n\n/** 0-based day-of-week offset between `date` (local midnight) and `weekStart`. */\nfunction dayIndex(date: Date, weekStart: Date): number {\n return Math.round((date.getTime() - weekStart.getTime()) / 86_400_000);\n}\n\n/**\n * Sunday-through-Saturday week rendered as one shared hourly time grid — the\n * seven-day sibling of `calendar-day`. Unlike `calendar-year` composing 12\n * `calendar-month` children, this is its own independent 7-column layout\n * (not 7 nested `<calendar-day>` elements): a single hour gutter is drawn\n * once, and multi-day/all-day entries span the days they cover as one\n * continuous bar in a shared all-day band, since lanes for that band are\n * assigned once across the whole visible week (unlike `calendar-month`'s\n * documented per-instance lane limitation). Timed entries stack into\n * side-by-side columns independently per day, same as `calendar-day`.\n * Read-only.\n *\n * Shares its slotted-entry observation, resolution, and hover/focus\n * interaction sync with `calendar-day` via `CalendarTimelineBase`.\n *\n * @element calendar-week\n * @slot - Declarative `calendar-entry` elements to render for this week.\n * @slot actions - Optional controls rendered beside the day headers (e.g. week-navigation buttons).\n */\n@customElement(\"calendar-week\")\nexport class CalendarWeek extends CalendarTimelineBase {\n /** Any date within the displayed week (`\"YYYY-MM-DD\"`) — the week runs Sunday through Saturday. */\n @property({ reflect: true }) date: string = toIsoDate(new Date());\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .week-header-row {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .week-header {\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n }\n .actions {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 0.5rem;\n }\n .hour-gutter-spacer {\n flex: 0 0 3rem;\n }\n .day-header {\n flex: 1 1 0;\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-semibold, 600);\n text-align: center;\n }\n .day-header .day-number {\n color: var(--ui-text, #0f172a);\n font-size: var(--ui-font-size-lg, 1rem);\n }\n .day-header.today,\n .day-header.today .day-number {\n color: var(--ui-primary, #4f46e5);\n }\n .all-day-band {\n display: flex;\n margin-bottom: 0.5rem;\n }\n .all-day-band.empty {\n display: none;\n }\n .all-day-lanes {\n display: grid;\n flex: 1 1 auto;\n grid-auto-rows: min-content;\n grid-template-columns: repeat(7, 1fr);\n gap: 0.25rem;\n }\n .grid {\n display: flex;\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n /* The hour grid is the week's canvas — .day-column only paints for\n weekend/today, so without this the page showed through every\n ordinary hour. The today tint is translucent and composites over\n this paper rather than over the page. */\n background: var(--ui-surface, #ffffff);\n }\n .hour-gutter {\n flex: 0 0 3rem;\n }\n .hour-label-cell {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n padding-right: 0.5rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n text-align: right;\n white-space: nowrap;\n }\n .week-days {\n display: flex;\n flex: 1 1 auto;\n }\n .day-column {\n position: relative;\n flex: 1 1 0;\n height: ${HOUR_HEIGHT_REM * 24}rem;\n border-left: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .day-column.today {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 6%, transparent);\n }\n .hour-line {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .entry-bar {\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem 0.5rem;\n transition: box-shadow 120ms ease;\n }\n .entry-bar.entry-block {\n position: absolute;\n }\n .entry-bar.entry-hovered,\n .entry-bar.entry-focused {\n box-shadow: inset 0 0 0 100vmax var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .entry-title {\n display: block;\n overflow: hidden;\n font-weight: var(--ui-font-weight-medium, 500);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n overflow: hidden;\n color: inherit;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location svg {\n flex: 0 0 auto;\n }\n .entry-link {\n position: absolute;\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n color: inherit;\n cursor: pointer;\n text-decoration: none;\n }\n .entry-link:focus-visible {\n outline: 2px solid var(--ui-primary, #4f46e5);\n outline-offset: -2px;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)) inset;\n }\n .entry-bar.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-text-muted, #64748b);\n }\n .entry-bar.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-info, #0ea5e9);\n }\n .entry-bar.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-primary, #4f46e5);\n }\n .entry-bar.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-success, #16a34a);\n }\n .entry-bar.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-warning, #d97706);\n }\n .entry-bar.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .entry-link:focus-visible {\n outline-color: Highlight;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entry-bar {\n transition: none;\n }\n }\n slot:not([name]) {\n display: none;\n }\n `,\n ];\n\n /** Renders one all-day/multi-day bar, spanning the visible-week columns it covers. */\n private _renderAllDayEntry(entry: LanedEntry, weekStart: Date, weekEnd: Date) {\n const visibleStart = entry.startDate < weekStart ? weekStart : entry.startDate;\n const visibleEnd = entry.endDate > weekEnd ? weekEnd : entry.endDate;\n const startCol = dayIndex(visibleStart, weekStart) + 1;\n const endCol = dayIndex(visibleEnd, weekStart) + 2;\n const bodyText = [entry.label, entry.location].filter(Boolean).join(\" · \");\n return html`\n <div\n class=\"entry-bar ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n style=\"grid-column: ${startCol} / ${endCol}; grid-row: ${entry.lane + 1};\"\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n }\n\n\n /** Renders one day's hour column: grid lines plus its own independently laned timed entries. */\n private _renderDayColumn(day: Date, timedWeek: ResolvedTimedEntry[], todayIso: string) {\n const dayStart = new Date(day);\n dayStart.setHours(0, 0, 0, 0);\n const dayEnd = new Date(day);\n dayEnd.setHours(23, 59, 59, 999);\n const dayTimed = timedWeek.filter((entry) => overlapsTimedRange(entry, dayStart, dayEnd));\n const { entries: laned, laneCount } = assignLanes(dayTimed, { exclusiveEnd: true });\n const isToday = toIsoDate(day) === todayIso;\n return html`\n <div class=\"day-column ${isToday ? \"today\" : \"\"}\">\n ${HOURS.map(() => html`<div class=\"hour-line\"></div>`)}\n ${repeat(\n laned,\n (entry) => this.entryKey(entry),\n (entry) => this.renderTimedEntry(entry, Math.max(laneCount, 1), dayStart, dayEnd),\n )}\n </div>\n `;\n }\n\n protected override render() {\n const anyDayInWeek = parseIsoDate(this.date) ?? new Date();\n const weekStart = startOfWeek(anyDayInWeek);\n const days = Array.from({ length: 7 }, (_, i) => addDays(weekStart, i));\n const weekEnd = new Date(days[6]);\n weekEnd.setHours(23, 59, 59, 999);\n const todayIso = toIsoDate(new Date());\n\n const resolved = this.resolveTimedEntriesFor(weekStart, weekEnd);\n const allDay = resolved.filter((entry) => entry.allDay);\n const timed = resolved.filter((entry) => !entry.allDay);\n const { entries: lanedAllDay, laneCount: allDayLaneCount } = assignLanes(allDay);\n\n return html`\n <div class=\"week\">\n <div class=\"week-header-row\">\n <div class=\"week-header\">\n <div class=\"hour-gutter-spacer\"></div>\n ${days.map(\n (day) => html`\n <div class=\"day-header ${toIsoDate(day) === todayIso ? \"today\" : \"\"}\">\n <div>${WEEKDAY_ABBR[day.getDay()]}</div>\n <div class=\"day-number\">${day.getDate()}</div>\n </div>\n `,\n )}\n </div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n <div class=\"all-day-band ${allDay.length === 0 ? \"empty\" : \"\"}\">\n <div class=\"hour-gutter-spacer\"></div>\n <div class=\"all-day-lanes\" style=\"grid-template-rows: repeat(${Math.max(allDayLaneCount, 1)}, min-content);\">\n ${repeat(\n lanedAllDay,\n (entry) => this.entryKey(entry),\n (entry) => this._renderAllDayEntry(entry, weekStart, weekEnd),\n )}\n </div>\n </div>\n <div class=\"grid\">\n <div class=\"hour-gutter\">\n ${HOURS.map((h) => html`<div class=\"hour-label-cell\">${hourLabel(h)}</div>`)}\n </div>\n <div class=\"week-days\">\n ${days.map((day) => this._renderDayColumn(day, timed, todayIso))}\n </div>\n </div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"calendar-week\": CalendarWeek;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron-schedule.d.ts","sourceRoot":"","sources":["../src/cron-schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AA4B/F,OAAO,mBAAmB,CAAC;AAC3B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,kBAAkB,CAAC;AA4C1B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBACa,YAAa,SAAQ,UAAU;;IAC1C,OAAgB,MAAM,4BAqOpB;IAEF,+CAA+C;IACnC,KAAK,SAAsB;IACvC,wCAAwC;IAC5B,KAAK,SAAM;IACvB,sCAAsC;IACT,QAAQ,UAAS;IAC9C,0CAA0C;IACE,IAAI,UAAS;IAEhD,OAAO,CAAC,KAAK,CAA2B;IAKjD,iEAAiE;IACjE,IAAI,WAAW,IAAI,MAAM,CAExB;IAEQ,oBAAoB,IAAI,IAAI,CAIpC;IAED,UAAmB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAK3D;IAED,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAexD;
|
|
1
|
+
{"version":3,"file":"cron-schedule.d.ts","sourceRoot":"","sources":["../src/cron-schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AA4B/F,OAAO,mBAAmB,CAAC;AAC3B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,kBAAkB,CAAC;AA4C1B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBACa,YAAa,SAAQ,UAAU;;IAC1C,OAAgB,MAAM,4BAqOpB;IAEF,+CAA+C;IACnC,KAAK,SAAsB;IACvC,wCAAwC;IAC5B,KAAK,SAAM;IACvB,sCAAsC;IACT,QAAQ,UAAS;IAC9C,0CAA0C;IACE,IAAI,UAAS;IAEhD,OAAO,CAAC,KAAK,CAA2B;IAKjD,iEAAiE;IACjE,IAAI,WAAW,IAAI,MAAM,CAExB;IAEQ,oBAAoB,IAAI,IAAI,CAIpC;IAED,UAAmB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAK3D;IAED,UAAmB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAexD;IA0bQ,MAAM,sBAkBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
|
package/dist/cron-schedule.js
CHANGED
|
@@ -593,6 +593,8 @@ let CronSchedule = class CronSchedule extends LitElement {
|
|
|
593
593
|
#renderTermInputs(name, index, term) {
|
|
594
594
|
const [min, max] = CRON_FIELD_BOUNDS[name];
|
|
595
595
|
const options = fieldOptions(name);
|
|
596
|
+
// A weekday range may end on 7 (Sunday), e.g. Fri–Sun is `5-7`.
|
|
597
|
+
const endOptions = name === "dayOfWeek" ? [...options, { value: "7", label: "Sun" }] : options;
|
|
596
598
|
const change = (next) => this.#onTermChange(name, index, next);
|
|
597
599
|
if (term.kind === "all")
|
|
598
600
|
return nothing;
|
|
@@ -612,7 +614,7 @@ let CronSchedule = class CronSchedule extends LitElement {
|
|
|
612
614
|
change({ kind: "range", from, to: Math.max(from, term.to) });
|
|
613
615
|
})}
|
|
614
616
|
<span class="inline-label">to</span>
|
|
615
|
-
${this.#renderSelect(`${CRON_FIELD_LABELS[name]} range end`,
|
|
617
|
+
${this.#renderSelect(`${CRON_FIELD_LABELS[name]} range end`, endOptions, term.to, (raw) => {
|
|
616
618
|
const to = Number(raw);
|
|
617
619
|
change({ kind: "range", from: Math.min(term.from, to), to });
|
|
618
620
|
})}
|
|
@@ -630,7 +632,7 @@ let CronSchedule = class CronSchedule extends LitElement {
|
|
|
630
632
|
change({ ...term, from, to: term.to === null ? null : Math.max(from, term.to) });
|
|
631
633
|
})}
|
|
632
634
|
<span class="inline-label">to</span>
|
|
633
|
-
${this.#renderSelect(`${CRON_FIELD_LABELS[name]} step end`,
|
|
635
|
+
${this.#renderSelect(`${CRON_FIELD_LABELS[name]} step end`, endOptions, to, (raw) => {
|
|
634
636
|
const end = Number(raw);
|
|
635
637
|
change({ ...term, from: Math.min(term.from, end), to: end });
|
|
636
638
|
})}
|