@nomideusz/svelte-calendar 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -46,7 +46,7 @@ Users can also switch via the built-in Day/Week/Month pills.
46
46
  Planner views are designed for direct manipulation:
47
47
 
48
48
  - **Move** — drag an event to another day or time; a ghost previews the target before the move commits.
49
- - **Resize** — drag an event's edge handles (`day-planner`: left/right, `day-mobile`: top/bottom) to change its duration; `minDuration`/`maxDuration` clamp at commit.
49
+ - **Resize** — drag an event's top/bottom edge handles to change its duration; `minDuration`/`maxDuration` clamp at commit.
50
50
  - **Drag-to-create** — press on empty canvas and sweep to draw a new event; a plain click still creates a default-length slot. Both fire `oneventcreate` with the final range, after blocked-slot and disabled-date validation.
51
51
 
52
52
  The month grid lists events as chips per day with a "+N more" overflow; clicking a day fires `ondayclick(date)` — the natural month → day drill-down.
@@ -743,21 +743,6 @@ const now = nowInZone('Asia/Tokyo');
743
743
  formatInTimeZone(date, 'America/New_York', { hour: '2-digit', minute: '2-digit' });
744
744
  ```
745
745
 
746
- ## Text Fitting (optional)
747
-
748
- Event cards fit their labels using character-width heuristics. For pixel-precise fitting (long titles, narrow columns, custom fonts), initialize the optional [Pretext](https://www.npmjs.com/package/pretext) measurement engine once at app startup — everything falls back gracefully if you don't:
749
-
750
- ```svelte
751
- <script>
752
- import { onMount } from 'svelte';
753
- import { initTextMeasure } from '@nomideusz/svelte-calendar';
754
-
755
- onMount(() => initTextMeasure()); // resolves true if Pretext loaded
756
- </script>
757
- ```
758
-
759
- Custom views can measure text themselves via `createTextMeasure(options)` → `fitContent({ title, subtitle, maxWidth, maxHeight, … })`.
760
-
761
746
  ## Utilities
762
747
 
763
748
  Small helpers used by the built-in views, exported for custom rendering:
@@ -838,6 +823,7 @@ The widget renders inside shadow DOM: host-page CSS (resets, theme stylesheets)
838
823
  | `minDuration` | `number` | — | Minimum event duration in minutes (enforced on create & resize) |
839
824
  | `maxDuration` | `number` | — | Maximum event duration in minutes (enforced on create & resize) |
840
825
  | `compact` | `boolean` | `false` | Minimal text-row rendering in Agenda views (dot + time + title) |
826
+ | `columns` | `boolean` | `false` | Timetable layout: week-agenda days as side-by-side columns on desktop (mobile keeps the stacked list). Pairs well with `equalDays`; overrides `compact` while active |
841
827
  | `dayHeader` | `Snippet<[{ date, isToday, dayName }]>` | — | Custom day header snippet for planner/agenda views |
842
828
  | `header` | `Snippet<[HeaderContext]>` | — | Replace entire header chrome (date label + mode pills + nav) |
843
829
  | `navigation` | `Snippet<[NavigationContext]>` | — | Replace just the prev/next/today controls |
@@ -69,6 +69,7 @@ let {
69
69
  maxDuration,
70
70
  disabledDates,
71
71
  compact = false,
72
+ columns = false,
72
73
  mobile: mobileProp = "auto",
73
74
  event: eventSnippet,
74
75
  empty: emptySnippet,
@@ -97,12 +98,16 @@ function handleEventClick(ev) {
97
98
  oneventclick?.(ev);
98
99
  }
99
100
  let containerWidth = $state(
100
- typeof window !== "undefined" && window.matchMedia?.(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`).matches ? MOBILE_BREAKPOINT - 1 : 0
101
+ typeof window !== "undefined" && window.matchMedia?.(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`).matches ? window.innerWidth : 0
101
102
  );
102
103
  const isMobileContainer = $derived(containerWidth > 0 && containerWidth < MOBILE_BREAKPOINT);
103
104
  const useMobile = $derived(
104
105
  mobileProp === "auto" ? isMobileContainer : Boolean(mobileProp)
105
106
  );
107
+ const HEADER_STACK_BREAKPOINT = 520;
108
+ const stackHeader = $derived(
109
+ useMobile && containerWidth > 0 && containerWidth < HEADER_STACK_BREAKPOINT
110
+ );
106
111
  let calEl = $state();
107
112
  let probedTheme = $state("");
108
113
  const needsProbe = $derived(theme === auto && autoTheme !== false);
@@ -290,6 +295,9 @@ setContext("calendar", {
290
295
  get compact() {
291
296
  return compact;
292
297
  },
298
+ get columns() {
299
+ return columns;
300
+ },
293
301
  get labels() {
294
302
  return mergedLabels;
295
303
  },
@@ -480,7 +488,8 @@ const navCtx = $derived({
480
488
 
481
489
  <!-- ─── Mobile header (flow layout, no absolute) ─── -->
482
490
  {:else if useMobile && (showNavigation || (showModePills && modes.length > 1) || dateLabel)}
483
- <div class="cal-m-hd">
491
+ {@const titleBelow = stackHeader && !!dateLabel}
492
+ <div class="cal-m-hd" class:cal-m-hd--stack={stackHeader} class:cal-m-hd--titled={titleBelow}>
484
493
  <div class="cal-m-left">
485
494
  {#if showModePills && modes.length > 1}
486
495
  <div class="cal-m-pills" role="radiogroup" aria-label={L.viewMode}>
@@ -500,7 +509,9 @@ const navCtx = $derived({
500
509
  {/if}
501
510
  </div>
502
511
 
503
- <span class="cal-m-title" role="status" aria-live="polite" aria-atomic="true">{dateLabel}</span>
512
+ {#if !titleBelow}
513
+ <span class="cal-m-title" role="status" aria-live="polite" aria-atomic="true">{dateLabel}</span>
514
+ {/if}
504
515
 
505
516
  <div class="cal-m-right">
506
517
  {#if navigationSnippet}
@@ -525,6 +536,11 @@ const navCtx = $derived({
525
536
  {/if}
526
537
  </div>
527
538
  </div>
539
+ {#if titleBelow}
540
+ <div class="cal-m-titlebar">
541
+ <span class="cal-m-title" role="status" aria-live="polite" aria-atomic="true">{dateLabel}</span>
542
+ </div>
543
+ {/if}
528
544
 
529
545
  <!-- ─── Desktop header ─── -->
530
546
  {:else if showNavigation || (showModePills && modes.length > 1) || dateLabel}
@@ -740,7 +756,9 @@ const navCtx = $derived({
740
756
  transition: background 100ms, color 100ms;
741
757
  }
742
758
 
743
- .cal-pill:hover {
759
+ /* :not(--active) — the hover rule otherwise outranks the active color,
760
+ and iOS keeps :hover stuck after a tap (dark text on the accent). */
761
+ .cal-pill:hover:not(.cal-pill--active) {
744
762
  color: var(--dt-text, rgba(0, 0, 0, 0.87));
745
763
  }
746
764
 
@@ -806,6 +824,26 @@ const navCtx = $derived({
806
824
  min-height: 44px;
807
825
  }
808
826
 
827
+ /* Narrow containers: the date label moves to its own row (.cal-m-titlebar),
828
+ so the controls row spreads pills and nav to the edges. */
829
+ .cal-m-hd--stack {
830
+ justify-content: space-between;
831
+ }
832
+ .cal-m-hd--titled {
833
+ border-bottom: none;
834
+ padding-bottom: 2px;
835
+ }
836
+ .cal-m-titlebar {
837
+ display: flex;
838
+ justify-content: center;
839
+ padding: 0 8px 8px;
840
+ border-bottom: 1px solid var(--dt-border, rgba(0, 0, 0, 0.08));
841
+ flex-shrink: 0;
842
+ }
843
+ .cal-m-titlebar .cal-m-title {
844
+ flex: 0 1 auto;
845
+ }
846
+
809
847
  .cal-m-left,
810
848
  .cal-m-right {
811
849
  display: flex;
@@ -867,7 +905,7 @@ const navCtx = $derived({
867
905
  transition: background 100ms, color 100ms;
868
906
  -webkit-tap-highlight-color: transparent;
869
907
  }
870
- .cal-m-pill:hover {
908
+ .cal-m-pill:hover:not(.cal-m-pill--active) {
871
909
  color: var(--dt-text, rgba(0, 0, 0, 0.87));
872
910
  }
873
911
  .cal-m-pill--active {
@@ -81,6 +81,14 @@ interface Props {
81
81
  disabledDates?: Date[];
82
82
  /** Compact mode: use minimal text-row rendering in Agenda views (dot + time + title). */
83
83
  compact?: boolean;
84
+ /**
85
+ * Timetable layout: week-agenda days render as side-by-side columns
86
+ * (classic class-schedule grid) instead of a vertical list. Desktop
87
+ * only — mobile keeps the stacked layout. Pairs well with `equalDays`
88
+ * for recurring/template schedules. Overrides `compact` while active
89
+ * (single-line rows truncate at column width).
90
+ */
91
+ columns?: boolean;
84
92
  /**
85
93
  * Mobile mode.
86
94
  * - `'auto'` (default): detect via viewport width (< 768 px)
@@ -7,5 +7,3 @@ export type { CalendarLabels } from './locale.js';
7
7
  export { toZonedTime, fromZonedTime, nowInZone, formatInTimeZone, } from './timezone.js';
8
8
  export type { TimelineEvent, BlockedSlot, EventStatus, } from './types.js';
9
9
  export { generatePalette, extractAccent, VIVID_PALETTE } from './palette.js';
10
- export { createTextMeasure, initTextMeasure } from './measure.js';
11
- export type { TextMeasure, TextMeasureOptions, ContentFit } from './measure.js';
@@ -9,5 +9,3 @@ export { setDefaultLocale, getDefaultLocale, is24HourLocale, fmtH, fmtTime, fmtD
9
9
  export { toZonedTime, fromZonedTime, nowInZone, formatInTimeZone, } from './timezone.js';
10
10
  // Palette
11
11
  export { generatePalette, extractAccent, VIVID_PALETTE } from './palette.js';
12
- // Text measurement (optional Pretext integration)
13
- export { createTextMeasure, initTextMeasure } from './measure.js';
@@ -1,15 +1,16 @@
1
1
  import type { DateRange } from '../adapters/types.js';
2
2
  export type { DateRange };
3
3
  /**
4
- * Built-in view IDs. Custom view IDs are also supported — CalendarViewId
5
- * is typed as `string` so consumers can register any ID.
4
+ * Built-in view IDs. Custom view IDs are also supported — see CalendarViewId.
6
5
  */
7
- export type BuiltInViewId = 'day-planner' | 'day-agenda' | 'week-planner' | 'week-agenda' | 'month-grid';
6
+ export type BuiltInViewId = 'day-planner' | 'day-agenda' | 'day-mobile' | 'week-planner' | 'week-agenda' | 'week-mobile' | 'month-grid';
8
7
  /**
9
8
  * Any view identifier. Use built-in strings like 'day-planner' or your own
10
9
  * custom IDs like 'day-kanban', 'week-resource', etc.
10
+ * (`string & {}` keeps the type open while preserving IDE autocomplete
11
+ * for the built-in IDs.)
11
12
  */
12
- export type CalendarViewId = string;
13
+ export type CalendarViewId = BuiltInViewId | (string & {});
13
14
  export type ViewMode = 'day' | 'week' | 'month';
14
15
  export interface ViewStateOptions {
15
16
  view?: CalendarViewId;
package/dist/index.d.ts CHANGED
@@ -4,11 +4,11 @@ export { Planner, Agenda, Mobile } from './views/index.js';
4
4
  export { default as MonthGrid } from './views/month/MonthGrid.svelte';
5
5
  export type { CalendarView } from './calendar/index.js';
6
6
  export { createEventStore, createViewState, createSelection, createDragState, } from './engine/index.js';
7
- export type { EventStore, ViewState, ViewStateOptions, CalendarViewId, BuiltInViewId, ViewMode, Selection, DragState, DragMode, DragPayload, } from './engine/index.js';
7
+ export type { EventStore, ViewState, ViewStateOptions, CalendarViewId, BuiltInViewId, ViewMode, Selection as CalendarSelection, DragState, DragMode, DragPayload, } from './engine/index.js';
8
8
  export { createMemoryAdapter, createRestAdapter, createRecurringAdapter, createMappedAdapter, createCompositeAdapter, createJmapAdapter } from './adapters/index.js';
9
- export type { CalendarAdapter, WritableCalendarAdapter, DateRange, RestAdapterOptions, RecurringEvent, RecurringAdapterOptions, FieldMapping, MappedAdapterOptions, MutationHandler, CompositeAdapterOptions, JmapClient, JmapCalendarAdapterOptions, } from './adapters/index.js';
10
- export { createClock, startOfWeek, fmtH, fmtTime, fmtDuration, weekdayShort, weekdayLong, monthShort, monthLong, dateShort, dateWithWeekday, fmtDay, fmtWeekRange, setDefaultLocale, getDefaultLocale, is24HourLocale, defaultLabels, setLabels, resetLabels, getLabels, toZonedTime, fromZonedTime, nowInZone, formatInTimeZone, generatePalette, extractAccent, VIVID_PALETTE, isMultiDay, isAllDay, segmentForDay, createTextMeasure, initTextMeasure, } from './core/index.js';
11
- export type { Clock, TimelineEvent, BlockedSlot, DaySegment, CalendarLabels, EventStatus, TextMeasure, TextMeasureOptions, ContentFit, } from './core/index.js';
9
+ export type { CalendarAdapter, WritableCalendarAdapter, DateRange, MemoryAdapterOptions, RestAdapterOptions, RecurringEvent, RecurringAdapterOptions, FieldMapping, MappedAdapterOptions, MutationHandler, CompositeAdapterOptions, JmapClient, JmapCalendarAdapterOptions, } from './adapters/index.js';
10
+ export { createClock, startOfWeek, fmtH, fmtTime, fmtDuration, weekdayShort, weekdayLong, monthShort, monthLong, dateShort, dateWithWeekday, fmtDay, fmtWeekRange, setDefaultLocale, getDefaultLocale, is24HourLocale, defaultLabels, setLabels, resetLabels, getLabels, toZonedTime, fromZonedTime, nowInZone, formatInTimeZone, generatePalette, extractAccent, VIVID_PALETTE, isMultiDay, isAllDay, segmentForDay, } from './core/index.js';
11
+ export type { Clock, TimelineEvent, BlockedSlot, DaySegment, CalendarLabels, EventStatus, } from './core/index.js';
12
12
  export { auto, neutral, midnight, presets } from './theme/index.js';
13
13
  export { probeHostTheme, observeHostTheme } from './theme/index.js';
14
14
  export { wrapAdapterWithTimezone } from './core/timezone.js';
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ export { createEventStore, createViewState, createSelection, createDragState, }
10
10
  // ─── Adapters ───────────────────────────────────────────
11
11
  export { createMemoryAdapter, createRestAdapter, createRecurringAdapter, createMappedAdapter, createCompositeAdapter, createJmapAdapter } from './adapters/index.js';
12
12
  // ─── Core: clock, time, locale, types ───────────────────
13
- export { createClock, startOfWeek, fmtH, fmtTime, fmtDuration, weekdayShort, weekdayLong, monthShort, monthLong, dateShort, dateWithWeekday, fmtDay, fmtWeekRange, setDefaultLocale, getDefaultLocale, is24HourLocale, defaultLabels, setLabels, resetLabels, getLabels, toZonedTime, fromZonedTime, nowInZone, formatInTimeZone, generatePalette, extractAccent, VIVID_PALETTE, isMultiDay, isAllDay, segmentForDay, createTextMeasure, initTextMeasure, } from './core/index.js';
13
+ export { createClock, startOfWeek, fmtH, fmtTime, fmtDuration, weekdayShort, weekdayLong, monthShort, monthLong, dateShort, dateWithWeekday, fmtDay, fmtWeekRange, setDefaultLocale, getDefaultLocale, is24HourLocale, defaultLabels, setLabels, resetLabels, getLabels, toZonedTime, fromZonedTime, nowInZone, formatInTimeZone, generatePalette, extractAccent, VIVID_PALETTE, isMultiDay, isAllDay, segmentForDay, } from './core/index.js';
14
14
  // ─── Themes ─────────────────────────────────────────────
15
15
  export { auto, neutral, midnight, presets } from './theme/index.js';
16
16
  export { probeHostTheme, observeHostTheme } from './theme/index.js';
@@ -302,28 +302,59 @@ function probeAccent(root) {
302
302
  return null;
303
303
  }
304
304
  // ── Font detection ──────────────────────────────────────
305
- function probeFonts(el) {
306
- let bodyFont = 'system-ui, sans-serif';
305
+ /** Common CSS variable names for the host's monospace font stack. */
306
+ const MONO_VAR_CANDIDATES = [
307
+ '--font-mono', // Tailwind v4 theme tokens, common convention
308
+ '--font-family-mono',
309
+ '--font-monospace',
310
+ '--mono-font',
311
+ '--code-font',
312
+ ];
313
+ const MONO_FALLBACK = "ui-monospace, 'SFMono-Regular', monospace";
314
+ /**
315
+ * Adopt the host page's fonts.
316
+ *
317
+ * Sans: the host element's *computed* font-family — the resolved authored
318
+ * stack, so webfont names come through verbatim. (Declaring `--dt-sans:
319
+ * inherit` does NOT work: a custom property with no ancestor value computes
320
+ * to guaranteed-invalid, so `var(--dt-sans, fallback)` used the fallback and
321
+ * the host font never applied.)
322
+ *
323
+ * Mono: common CSS variables on :root, then any code-ish element's computed
324
+ * font, then a generic stack.
325
+ */
326
+ function probeFonts(host) {
327
+ let sans = 'system-ui, sans-serif';
307
328
  try {
308
- const cs = getComputedStyle(el);
309
- if (cs.fontFamily)
310
- bodyFont = cs.fontFamily;
329
+ const f = getComputedStyle(host).fontFamily;
330
+ if (f)
331
+ sans = f;
311
332
  }
312
333
  catch {
313
334
  // getComputedStyle may fail in test environments
314
335
  }
315
- // For monospace, check if the page defines one
316
- const pre = el.querySelector('pre, code, .mono, [class*="mono"]');
317
- let mono = "ui-monospace, 'SFMono-Regular', monospace";
318
- if (pre) {
319
- try {
320
- const pf = getComputedStyle(pre).fontFamily;
321
- if (pf)
322
- mono = pf;
336
+ let mono = '';
337
+ try {
338
+ const rootCs = getComputedStyle(document.documentElement);
339
+ for (const name of MONO_VAR_CANDIDATES) {
340
+ const val = rootCs.getPropertyValue(name).trim();
341
+ if (val) {
342
+ mono = val;
343
+ break;
344
+ }
323
345
  }
324
- catch { /* ignore */ }
325
346
  }
326
- return { sans: bodyFont, mono };
347
+ catch { /* ignore */ }
348
+ if (!mono) {
349
+ const code = document.querySelector('pre, code, kbd, samp');
350
+ if (code) {
351
+ try {
352
+ mono = getComputedStyle(code).fontFamily || '';
353
+ }
354
+ catch { /* ignore */ }
355
+ }
356
+ }
357
+ return { sans, mono: mono || MONO_FALLBACK };
327
358
  }
328
359
  // ── Background walking ──────────────────────────────────
329
360
  /**
@@ -436,13 +467,9 @@ export function probeHostTheme(el, options = {}) {
436
467
  }
437
468
  const [aH, aS, aL] = rgbToHsl(...accent);
438
469
  // ── Fonts ──
439
- // When auto-probing, use `inherit` so the calendar naturally inherits the
440
- // host page's font via CSS inheritance. Probing getComputedStyle().fontFamily
441
- // and re-declaring it can break the cascade (resolved names differ from the
442
- // authored font stack). Only use an explicit value if the user overrides.
443
470
  const fonts = options.font
444
- ? { sans: options.font, mono: "ui-monospace, 'SFMono-Regular', monospace" }
445
- : { sans: 'inherit', mono: "ui-monospace, 'SFMono-Regular', monospace" };
471
+ ? { sans: options.font, mono: MONO_FALLBACK }
472
+ : probeFonts(host);
446
473
  // ── Text colors (probe host's actual text, validate contrast) ──
447
474
  const probedText = probeTextColor(host, bg);
448
475
  const textBase = probedText ?? (isDark ? [226, 232, 240] : [30, 30, 46]);
@@ -545,11 +572,19 @@ export function observeHostTheme(el, callback, options = {}) {
545
572
  attributes: true,
546
573
  attributeFilter: ['class', 'style', 'data-theme', 'data-mode', 'color-scheme'],
547
574
  });
575
+ // 3. Re-probe once the document settles. A probe during initial load can
576
+ // read pre-stylesheet values (wrong background → wrong light/dark call);
577
+ // late webfonts change computed font stacks. Both are one-shot events.
578
+ if (document.readyState !== 'complete') {
579
+ window.addEventListener('load', scheduleUpdate, { once: true });
580
+ }
581
+ document.fonts?.ready?.then(scheduleUpdate).catch(() => { });
548
582
  // Initial probe
549
583
  update();
550
584
  return () => {
551
585
  cancelAnimationFrame(rafId);
552
586
  mql?.removeEventListener('change', onScheme);
587
+ window.removeEventListener('load', scheduleUpdate);
553
588
  observer.disconnect();
554
589
  };
555
590
  }
@@ -23,16 +23,17 @@
23
23
  */
24
24
  export declare const auto = "";
25
25
  /**
26
- * Neutral — explicit light theme. White bg, blue accent, inherits host fonts.
26
+ * Neutral — explicit light theme. White bg, blue accent, system font stack
27
+ * (set --dt-sans on an ancestor or via CSS to use a custom font).
27
28
  * Use when embedding standalone without ancestor --dt-* vars.
28
29
  */
29
- export declare const neutral = "\n\t--dt-stage-bg: #ffffff;\n\t--dt-bg: #ffffff;\n\t--dt-surface: #f9fafb;\n\t--dt-border: rgba(0, 0, 0, 0.08);\n\t--dt-border-day: rgba(0, 0, 0, 0.14);\n\t--dt-text: rgba(0, 0, 0, 0.87);\n\t--dt-text-2: rgba(0, 0, 0, 0.54);\n\t--dt-text-3: rgba(0, 0, 0, 0.38);\n\t--dt-accent: var(--asini-accent, #2563eb);\n\t--dt-accent-dim: color-mix(in srgb, var(--dt-accent) 12%, transparent);\n\t--dt-glow: color-mix(in srgb, var(--dt-accent) 25%, transparent);\n\t--dt-today-bg: color-mix(in srgb, var(--dt-accent) 7%, transparent);\n\t--dt-btn-text: #fff;\n\t--dt-scrollbar: rgba(0, 0, 0, 0.1);\n\t--dt-success: rgba(22, 163, 74, 0.7);\n\t--dt-weekend-bg: rgba(0, 0, 0, 0.02);\n\t--dt-hover: rgba(0, 0, 0, 0.04);\n\t--dt-sans: inherit;\n\t--dt-mono: ui-monospace, 'SFMono-Regular', monospace;\n";
30
+ export declare const neutral = "\n\t--dt-stage-bg: #ffffff;\n\t--dt-bg: #ffffff;\n\t--dt-surface: #f9fafb;\n\t--dt-border: rgba(0, 0, 0, 0.08);\n\t--dt-border-day: rgba(0, 0, 0, 0.14);\n\t--dt-text: rgba(0, 0, 0, 0.87);\n\t--dt-text-2: rgba(0, 0, 0, 0.54);\n\t--dt-text-3: rgba(0, 0, 0, 0.38);\n\t--dt-accent: var(--asini-accent, #2563eb);\n\t--dt-accent-dim: color-mix(in srgb, var(--dt-accent) 12%, transparent);\n\t--dt-glow: color-mix(in srgb, var(--dt-accent) 25%, transparent);\n\t--dt-today-bg: color-mix(in srgb, var(--dt-accent) 7%, transparent);\n\t--dt-btn-text: #fff;\n\t--dt-scrollbar: rgba(0, 0, 0, 0.1);\n\t--dt-success: rgba(22, 163, 74, 0.7);\n\t--dt-weekend-bg: rgba(0, 0, 0, 0.02);\n\t--dt-hover: rgba(0, 0, 0, 0.04);\n\t--dt-mono: ui-monospace, 'SFMono-Regular', monospace;\n";
30
31
  /** Midnight Industrial — dark charcoal + red accent, tech monitoring */
31
- export declare const midnight = "\n\t--dt-stage-bg: #080a0f;\n\t--dt-bg: #0b0e14;\n\t--dt-surface: #10141c;\n\t--dt-border: rgba(148, 163, 184, 0.07);\n\t--dt-border-day: rgba(148, 163, 184, 0.14);\n\t--dt-text: rgba(226, 232, 240, 0.85);\n\t--dt-text-2: rgba(148, 163, 184, 0.55);\n\t--dt-text-3: rgba(100, 116, 139, 0.55);\n\t--dt-accent: #ef4444;\n\t--dt-accent-dim: rgba(239, 68, 68, 0.18);\n\t--dt-glow: rgba(239, 68, 68, 0.35);\n\t--dt-today-bg: rgba(239, 68, 68, 0.07);\n\t--dt-btn-text: #fff;\n\t--dt-scrollbar: rgba(148, 163, 184, 0.12);\n\t--dt-success: rgba(74, 222, 128, 0.7);\n\t--dt-weekend-bg: rgba(148, 163, 184, 0.03);\n\t--dt-hover: rgba(148, 163, 184, 0.06);\n\t--dt-sans: inherit;\n\t--dt-mono: ui-monospace, 'SFMono-Regular', monospace;\n";
32
+ export declare const midnight = "\n\t--dt-stage-bg: #080a0f;\n\t--dt-bg: #0b0e14;\n\t--dt-surface: #10141c;\n\t--dt-border: rgba(148, 163, 184, 0.07);\n\t--dt-border-day: rgba(148, 163, 184, 0.14);\n\t--dt-text: rgba(226, 232, 240, 0.85);\n\t--dt-text-2: rgba(148, 163, 184, 0.55);\n\t--dt-text-3: rgba(100, 116, 139, 0.55);\n\t--dt-accent: #ef4444;\n\t--dt-accent-dim: rgba(239, 68, 68, 0.18);\n\t--dt-glow: rgba(239, 68, 68, 0.35);\n\t--dt-today-bg: rgba(239, 68, 68, 0.07);\n\t--dt-btn-text: #fff;\n\t--dt-scrollbar: rgba(148, 163, 184, 0.12);\n\t--dt-success: rgba(74, 222, 128, 0.7);\n\t--dt-weekend-bg: rgba(148, 163, 184, 0.03);\n\t--dt-hover: rgba(148, 163, 184, 0.06);\n\t--dt-mono: ui-monospace, 'SFMono-Regular', monospace;\n";
32
33
  /** All available presets keyed by name */
33
34
  export declare const presets: {
34
35
  readonly auto: "";
35
- readonly neutral: "\n\t--dt-stage-bg: #ffffff;\n\t--dt-bg: #ffffff;\n\t--dt-surface: #f9fafb;\n\t--dt-border: rgba(0, 0, 0, 0.08);\n\t--dt-border-day: rgba(0, 0, 0, 0.14);\n\t--dt-text: rgba(0, 0, 0, 0.87);\n\t--dt-text-2: rgba(0, 0, 0, 0.54);\n\t--dt-text-3: rgba(0, 0, 0, 0.38);\n\t--dt-accent: var(--asini-accent, #2563eb);\n\t--dt-accent-dim: color-mix(in srgb, var(--dt-accent) 12%, transparent);\n\t--dt-glow: color-mix(in srgb, var(--dt-accent) 25%, transparent);\n\t--dt-today-bg: color-mix(in srgb, var(--dt-accent) 7%, transparent);\n\t--dt-btn-text: #fff;\n\t--dt-scrollbar: rgba(0, 0, 0, 0.1);\n\t--dt-success: rgba(22, 163, 74, 0.7);\n\t--dt-weekend-bg: rgba(0, 0, 0, 0.02);\n\t--dt-hover: rgba(0, 0, 0, 0.04);\n\t--dt-sans: inherit;\n\t--dt-mono: ui-monospace, 'SFMono-Regular', monospace;\n";
36
- readonly midnight: "\n\t--dt-stage-bg: #080a0f;\n\t--dt-bg: #0b0e14;\n\t--dt-surface: #10141c;\n\t--dt-border: rgba(148, 163, 184, 0.07);\n\t--dt-border-day: rgba(148, 163, 184, 0.14);\n\t--dt-text: rgba(226, 232, 240, 0.85);\n\t--dt-text-2: rgba(148, 163, 184, 0.55);\n\t--dt-text-3: rgba(100, 116, 139, 0.55);\n\t--dt-accent: #ef4444;\n\t--dt-accent-dim: rgba(239, 68, 68, 0.18);\n\t--dt-glow: rgba(239, 68, 68, 0.35);\n\t--dt-today-bg: rgba(239, 68, 68, 0.07);\n\t--dt-btn-text: #fff;\n\t--dt-scrollbar: rgba(148, 163, 184, 0.12);\n\t--dt-success: rgba(74, 222, 128, 0.7);\n\t--dt-weekend-bg: rgba(148, 163, 184, 0.03);\n\t--dt-hover: rgba(148, 163, 184, 0.06);\n\t--dt-sans: inherit;\n\t--dt-mono: ui-monospace, 'SFMono-Regular', monospace;\n";
36
+ readonly neutral: "\n\t--dt-stage-bg: #ffffff;\n\t--dt-bg: #ffffff;\n\t--dt-surface: #f9fafb;\n\t--dt-border: rgba(0, 0, 0, 0.08);\n\t--dt-border-day: rgba(0, 0, 0, 0.14);\n\t--dt-text: rgba(0, 0, 0, 0.87);\n\t--dt-text-2: rgba(0, 0, 0, 0.54);\n\t--dt-text-3: rgba(0, 0, 0, 0.38);\n\t--dt-accent: var(--asini-accent, #2563eb);\n\t--dt-accent-dim: color-mix(in srgb, var(--dt-accent) 12%, transparent);\n\t--dt-glow: color-mix(in srgb, var(--dt-accent) 25%, transparent);\n\t--dt-today-bg: color-mix(in srgb, var(--dt-accent) 7%, transparent);\n\t--dt-btn-text: #fff;\n\t--dt-scrollbar: rgba(0, 0, 0, 0.1);\n\t--dt-success: rgba(22, 163, 74, 0.7);\n\t--dt-weekend-bg: rgba(0, 0, 0, 0.02);\n\t--dt-hover: rgba(0, 0, 0, 0.04);\n\t--dt-mono: ui-monospace, 'SFMono-Regular', monospace;\n";
37
+ readonly midnight: "\n\t--dt-stage-bg: #080a0f;\n\t--dt-bg: #0b0e14;\n\t--dt-surface: #10141c;\n\t--dt-border: rgba(148, 163, 184, 0.07);\n\t--dt-border-day: rgba(148, 163, 184, 0.14);\n\t--dt-text: rgba(226, 232, 240, 0.85);\n\t--dt-text-2: rgba(148, 163, 184, 0.55);\n\t--dt-text-3: rgba(100, 116, 139, 0.55);\n\t--dt-accent: #ef4444;\n\t--dt-accent-dim: rgba(239, 68, 68, 0.18);\n\t--dt-glow: rgba(239, 68, 68, 0.35);\n\t--dt-today-bg: rgba(239, 68, 68, 0.07);\n\t--dt-btn-text: #fff;\n\t--dt-scrollbar: rgba(148, 163, 184, 0.12);\n\t--dt-success: rgba(74, 222, 128, 0.7);\n\t--dt-weekend-bg: rgba(148, 163, 184, 0.03);\n\t--dt-hover: rgba(148, 163, 184, 0.06);\n\t--dt-mono: ui-monospace, 'SFMono-Regular', monospace;\n";
37
38
  };
38
39
  export type PresetName = keyof typeof presets;
@@ -23,7 +23,8 @@
23
23
  */
24
24
  export const auto = ``;
25
25
  /**
26
- * Neutral — explicit light theme. White bg, blue accent, inherits host fonts.
26
+ * Neutral — explicit light theme. White bg, blue accent, system font stack
27
+ * (set --dt-sans on an ancestor or via CSS to use a custom font).
27
28
  * Use when embedding standalone without ancestor --dt-* vars.
28
29
  */
29
30
  export const neutral = `
@@ -44,7 +45,6 @@ export const neutral = `
44
45
  --dt-success: rgba(22, 163, 74, 0.7);
45
46
  --dt-weekend-bg: rgba(0, 0, 0, 0.02);
46
47
  --dt-hover: rgba(0, 0, 0, 0.04);
47
- --dt-sans: inherit;
48
48
  --dt-mono: ui-monospace, 'SFMono-Regular', monospace;
49
49
  `;
50
50
  /** Midnight Industrial — dark charcoal + red accent, tech monitoring */
@@ -66,7 +66,6 @@ export const midnight = `
66
66
  --dt-success: rgba(74, 222, 128, 0.7);
67
67
  --dt-weekend-bg: rgba(148, 163, 184, 0.03);
68
68
  --dt-hover: rgba(148, 163, 184, 0.06);
69
- --dt-sans: inherit;
70
69
  --dt-mono: ui-monospace, 'SFMono-Regular', monospace;
71
70
  `;
72
71
  /** All available presets keyed by name */
@@ -19,6 +19,8 @@ let {
19
19
  const clock = createClock(ctx.timezone);
20
20
  const viewState = $derived(ctx.viewState);
21
21
  const equalDays = $derived(ctx.equalDays);
22
+ const showDates = $derived(ctx.showDates);
23
+ const hideDayHead = $derived(showDates && !!viewState);
22
24
  const isMobile = $derived(ctx.isMobile);
23
25
  const autoHeight = $derived(ctx.autoHeight);
24
26
  const compact = $derived(ctx.compact);
@@ -106,7 +108,8 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
106
108
  onpointercancel={onPointerCancel}
107
109
  >
108
110
  <div class="ag-body" role="group" aria-label={L.todaysLineup}>
109
- <!-- ─── In-view date header (swipe nav is otherwise unlabelled) ─── -->
111
+ <!-- ─── In-view date header (only when the chrome doesn't label the day) ─── -->
112
+ {#if !hideDayHead}
110
113
  <div class="ag-day-head">
111
114
  {#if !equalDays && isToday}
112
115
  <span class="ag-day-head-badge">{L.today}</span>
@@ -116,6 +119,7 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
116
119
  <span class="ag-day-head-name">{weekdayLong(dayMs, locale)}</span>
117
120
  <span class="ag-day-head-date">{monthLong(dayMs, locale)} {dayNum(dayMs)}</span>
118
121
  </div>
122
+ {/if}
119
123
  {#if allDayBanner.length > 0}
120
124
  <!-- ─── All-day / multi-day events ─── -->
121
125
  <div class="ag-allday">
@@ -160,17 +164,18 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
160
164
  onpointerenter={() => oneventhover?.(ev)}
161
165
  >
162
166
  <EventContent event={ev}>
163
- <span class="ag-compact-row-dot"></span>
164
167
  <span class="ag-compact-row-time">{fmt(ev.start)}</span>
165
- <span class="ag-compact-row-title">{ev.title}</span>
166
- {#if ev.subtitle}
167
- <span class="ag-compact-row-sub">{ev.subtitle}</span>
168
- {/if}
169
- {#if ev.tags?.length}
170
- {#each ev.tags as tag}
171
- <span class="ag-compact-row-tag">{tag}</span>
172
- {/each}
173
- {/if}
168
+ <div class="ag-compact-row-main">
169
+ <span class="ag-compact-row-title">{ev.title}</span>
170
+ {#if ev.subtitle}
171
+ <span class="ag-compact-row-sub">{ev.subtitle}</span>
172
+ {/if}
173
+ {#if ev.tags?.length}
174
+ {#each ev.tags as tag}
175
+ <span class="ag-compact-row-tag">{tag}</span>
176
+ {/each}
177
+ {/if}
178
+ </div>
174
179
  <span class="ag-compact-row-dur">{duration(ev)}</span>
175
180
  </EventContent>
176
181
  </button>
@@ -254,12 +259,13 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
254
259
  onpointerenter={() => oneventhover?.(ev)}
255
260
  >
256
261
  <EventContent event={ev}>
257
- <span class="ag-compact-row-dot"></span>
258
262
  <span class="ag-compact-row-time">{fmt(ev.start)}</span>
259
- <span class="ag-compact-row-title">{ev.title}</span>
260
- {#if ev.subtitle}
261
- <span class="ag-compact-row-sub">{ev.subtitle}</span>
262
- {/if}
263
+ <div class="ag-compact-row-main">
264
+ <span class="ag-compact-row-title">{ev.title}</span>
265
+ {#if ev.subtitle}
266
+ <span class="ag-compact-row-sub">{ev.subtitle}</span>
267
+ {/if}
268
+ </div>
263
269
  </EventContent>
264
270
  </button>
265
271
  {:else}
@@ -715,7 +721,11 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
715
721
  font-size: 16px;
716
722
  font-weight: 700;
717
723
  }
718
- .ag-card--plan .ag-card-sub {
724
+ /* Everything under the title aligns past the order number — the
725
+ subtitle, location, time and tags share one left edge. */
726
+ .ag-card--plan .ag-card-sub,
727
+ .ag-card--plan .ag-card-loc,
728
+ .ag-card--plan .ag-card-meta {
719
729
  padding-left: 22px;
720
730
  }
721
731
  .ag-card--plan .ag-card-tags {
@@ -1063,8 +1073,7 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
1063
1073
  .ag-log-row--selected {
1064
1074
  background: color-mix(in srgb, var(--ev-color) 6%, transparent);
1065
1075
  border-radius: 6px;
1066
- padding-left: 8px;
1067
- padding-right: 8px;
1076
+ box-shadow: 0 0 0 8px color-mix(in srgb, var(--ev-color) 6%, transparent);
1068
1077
  }
1069
1078
  .ag-log-check {
1070
1079
  font-size: 10px;
@@ -1126,8 +1135,10 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
1126
1135
  .ag-compact-row--selected {
1127
1136
  background: color-mix(in srgb, var(--ev-color) 10%, transparent);
1128
1137
  border-radius: 4px;
1129
- padding-left: 6px;
1130
- padding-right: 6px;
1138
+ /* The highlight bleeds into the gutter via a spread shadow — zero
1139
+ layout impact, so nothing shifts or clips even when the host
1140
+ reduces the gutters below the bleed width. */
1141
+ box-shadow: 0 0 0 6px color-mix(in srgb, var(--ev-color) 10%, transparent);
1131
1142
  }
1132
1143
  .ag-compact-row:hover .ag-compact-row-title,
1133
1144
  .ag-compact-row:active .ag-compact-row-title { color: var(--dt-text); }
@@ -1140,27 +1151,49 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
1140
1151
  box-shadow: 0 0 0 2px var(--dt-accent, #2563eb);
1141
1152
  border-radius: 4px;
1142
1153
  }
1143
- .ag-compact-row-dot {
1144
- width: 5px;
1145
- height: 5px;
1146
- border-radius: 50%;
1147
- background: var(--ev-color, var(--dt-accent));
1148
- flex-shrink: 0;
1149
- align-self: center;
1150
- }
1154
+ /* The time label doubles as the class-color signal (replaces the old
1155
+ dot): the event color mixed toward the text color, so it stays
1156
+ legible on any palette and costs zero horizontal space. */
1151
1157
  .ag-compact-row-time {
1152
1158
  font-size: 11px;
1153
1159
  font-family: var(--dt-mono, monospace);
1154
- color: var(--dt-text-2, rgba(0, 0, 0, 0.54));
1160
+ font-weight: 500;
1161
+ color: color-mix(in srgb, var(--ev-color, var(--dt-accent)) 60%, var(--dt-text, rgba(0, 0, 0, 0.87)));
1155
1162
  min-width: 64px;
1156
1163
  flex-shrink: 0;
1157
1164
  line-height: 1.4;
1158
1165
  }
1166
+ /* Title + subtitle + tags cluster. One line while it fits; on mobile the
1167
+ metadata wraps to a second line under the title instead of crushing it. */
1168
+ .ag-compact-row-main {
1169
+ display: flex;
1170
+ align-items: baseline;
1171
+ gap: 8px;
1172
+ flex: 1;
1173
+ min-width: 0;
1174
+ }
1175
+ .ag--mobile .ag-compact-row-main {
1176
+ flex-wrap: wrap;
1177
+ row-gap: 2px;
1178
+ }
1179
+ /* Mobile: size the title by its content when deciding line breaks — a long
1180
+ title claims the first line whole (ellipsizing only against the full row)
1181
+ and pushes subtitle/tags down instead of truncating at 35%. */
1182
+ .ag--mobile .ag-compact-row-title {
1183
+ flex-basis: auto;
1184
+ }
1185
+ /* On its own wrapped line the subtitle gets the full width */
1186
+ .ag--mobile .ag-compact-row-sub {
1187
+ max-width: 100%;
1188
+ }
1159
1189
  .ag-compact-row-title {
1160
1190
  font-size: 12px;
1161
1191
  font-weight: 500;
1162
1192
  color: color-mix(in srgb, var(--dt-text, rgba(0, 0, 0, 0.87)) 82%, transparent);
1163
1193
  flex: 1;
1194
+ /* The title is the row's identity — never let subtitle/tags/duration
1195
+ squeeze it out on narrow screens (flex: 1 alone resolves to 0px). */
1196
+ min-width: 35%;
1164
1197
  white-space: nowrap;
1165
1198
  overflow: hidden;
1166
1199
  text-overflow: ellipsis;
@@ -1178,7 +1211,8 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
1178
1211
  .ag-compact-row-sub {
1179
1212
  font-size: 10px;
1180
1213
  color: var(--dt-text-3, rgba(0, 0, 0, 0.38));
1181
- flex-shrink: 1;
1214
+ flex-shrink: 3;
1215
+ min-width: 0;
1182
1216
  max-width: 45%;
1183
1217
  white-space: nowrap;
1184
1218
  overflow: hidden;
@@ -1192,7 +1226,10 @@ const hiddenDoneCount = $derived(showAllDone ? 0 : Math.max(0, dayCat.past.lengt
1192
1226
  padding: 1px 4px;
1193
1227
  border-radius: 3px;
1194
1228
  white-space: nowrap;
1195
- flex-shrink: 0;
1229
+ flex-shrink: 1;
1230
+ min-width: 2.5em;
1231
+ overflow: hidden;
1232
+ text-overflow: ellipsis;
1196
1233
  }
1197
1234
  .ag-compact-row--cancelled { opacity: 0.5; }
1198
1235
  .ag-compact-row--cancelled .ag-compact-row-title { text-decoration: line-through; }