@liteforge/calendar 0.1.0 → 0.2.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/css/styles.css ADDED
@@ -0,0 +1,612 @@
1
+ /* ─── CSS Variables ─────────────────────────────────────── */
2
+
3
+ :root {
4
+ --lf-cal-bg: var(--lf-color-surface, #ffffff);
5
+ --lf-cal-border: var(--lf-color-border, #e2e8f0);
6
+ --lf-cal-border-radius: var(--lf-radius-lg, 8px);
7
+ --lf-cal-slot-height: 40px;
8
+ --lf-cal-header-bg: var(--lf-color-bg-subtle, #f8fafc);
9
+ --lf-cal-header-color: var(--lf-color-text, #374151);
10
+ --lf-cal-header-font-weight: var(--lf-font-semibold, 600);
11
+ --lf-cal-today-bg: var(--lf-color-accent-subtle, #eff6ff);
12
+ --lf-cal-weekend-bg: var(--lf-color-bg-subtle, #fafafa);
13
+ --lf-cal-now-color: var(--lf-color-danger, #ef4444);
14
+ --lf-cal-now-width: 2px;
15
+ --lf-cal-event-radius: var(--lf-radius-sm, 4px);
16
+ --lf-cal-event-font-size: var(--lf-text-xs, 12px);
17
+ --lf-cal-event-padding: 2px 6px;
18
+ --lf-cal-event-default-bg: var(--lf-color-accent, #3b82f6);
19
+ --lf-cal-event-default-color: var(--lf-color-text-on-accent, #ffffff);
20
+ --lf-cal-blocked-bg: var(--lf-color-bg-muted, #f1f5f9);
21
+ --lf-cal-blocked-pattern: repeating-linear-gradient(
22
+ 45deg, transparent, transparent 5px, rgba(0,0,0,0.03) 5px, rgba(0,0,0,0.03) 10px
23
+ );
24
+ --lf-cal-selection-bg: var(--lf-color-accent-subtle, rgba(59, 130, 246, 0.15));
25
+ --lf-cal-selection-border: var(--lf-color-accent, #3b82f6);
26
+ --lf-cal-drag-opacity: 0.7;
27
+ --lf-cal-time-color: var(--lf-color-text-subtle, #94a3b8);
28
+ --lf-cal-time-font-size: var(--lf-text-xs, 11px);
29
+ --lf-cal-time-width: 60px;
30
+ }
31
+
32
+ /* Dark mode overrides */
33
+ [data-theme="dark"],
34
+ .dark {
35
+ --lf-cal-today-bg: rgba(137, 180, 250, 0.1);
36
+ --lf-cal-weekend-bg: var(--lf-color-bg-subtle, #181825);
37
+ --lf-cal-blocked-bg: var(--lf-color-bg, #11111b);
38
+ --lf-cal-time-color: #6c7086;
39
+ }
40
+
41
+ @media (prefers-color-scheme: dark) {
42
+ :root:not([data-theme="light"]) {
43
+ --lf-cal-today-bg: rgba(137, 180, 250, 0.1);
44
+ --lf-cal-weekend-bg: var(--lf-color-bg-subtle, #181825);
45
+ --lf-cal-blocked-bg: var(--lf-color-bg, #11111b);
46
+ --lf-cal-time-color: #6c7086;
47
+ }
48
+ }
49
+
50
+ /* ─── Root Container ────────────────────────────────────── */
51
+
52
+ .lf-cal {
53
+ background: var(--lf-cal-bg);
54
+ border: 1px solid var(--lf-cal-border);
55
+ border-radius: var(--lf-cal-border-radius);
56
+ overflow: hidden;
57
+ font-family: var(--lf-font-sans, system-ui, -apple-system, sans-serif);
58
+ font-size: var(--lf-text-base, 14px);
59
+ }
60
+
61
+ /* ─── Toolbar ───────────────────────────────────────────── */
62
+
63
+ .lf-cal-toolbar {
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: space-between;
67
+ padding: 12px 16px;
68
+ background: var(--lf-cal-header-bg);
69
+ border-bottom: 1px solid var(--lf-cal-border);
70
+ gap: 16px;
71
+ }
72
+
73
+ .lf-cal-toolbar-nav {
74
+ display: flex;
75
+ align-items: center;
76
+ gap: 8px;
77
+ }
78
+
79
+ .lf-cal-toolbar-nav button {
80
+ padding: 6px 12px;
81
+ border: 1px solid var(--lf-cal-border);
82
+ border-radius: var(--lf-radius-sm, 4px);
83
+ background: var(--lf-cal-bg);
84
+ cursor: pointer;
85
+ font-size: var(--lf-text-sm, 13px);
86
+ transition: background-color var(--lf-transition-fast, 0.15s);
87
+ }
88
+
89
+ .lf-cal-toolbar-nav button:hover {
90
+ background: var(--lf-cal-today-bg);
91
+ }
92
+
93
+ .lf-cal-toolbar-title {
94
+ font-size: var(--lf-text-md, 16px);
95
+ font-weight: var(--lf-cal-header-font-weight);
96
+ color: var(--lf-cal-header-color);
97
+ min-width: 200px;
98
+ text-align: center;
99
+ }
100
+
101
+ .lf-cal-toolbar-views {
102
+ display: flex;
103
+ gap: 4px;
104
+ }
105
+
106
+ .lf-cal-toolbar-views button {
107
+ padding: 6px 12px;
108
+ border: 1px solid var(--lf-cal-border);
109
+ background: var(--lf-cal-bg);
110
+ cursor: pointer;
111
+ font-size: var(--lf-text-sm, 13px);
112
+ transition: all var(--lf-transition-fast, 0.15s);
113
+ }
114
+
115
+ .lf-cal-toolbar-views button:first-child {
116
+ border-radius: var(--lf-radius-sm, 4px) 0 0 var(--lf-radius-sm, 4px);
117
+ }
118
+
119
+ .lf-cal-toolbar-views button:last-child {
120
+ border-radius: 0 var(--lf-radius-sm, 4px) var(--lf-radius-sm, 4px) 0;
121
+ }
122
+
123
+ .lf-cal-toolbar-views button:not(:first-child) {
124
+ margin-left: -1px;
125
+ }
126
+
127
+ .lf-cal-toolbar-views button:hover {
128
+ background: var(--lf-cal-today-bg);
129
+ }
130
+
131
+ .lf-cal-toolbar-views button.active {
132
+ background: var(--lf-cal-event-default-bg);
133
+ color: var(--lf-cal-event-default-color);
134
+ border-color: var(--lf-cal-event-default-bg);
135
+ }
136
+
137
+ /* ─── Header ────────────────────────────────────────────── */
138
+
139
+ .lf-cal-header {
140
+ display: flex;
141
+ border-bottom: 1px solid var(--lf-cal-border);
142
+ background: var(--lf-cal-header-bg);
143
+ }
144
+
145
+ .lf-cal-header-time-spacer {
146
+ width: var(--lf-cal-time-width);
147
+ flex-shrink: 0;
148
+ border-right: 1px solid var(--lf-cal-border);
149
+ }
150
+
151
+ .lf-cal-header-cell {
152
+ flex: 1;
153
+ padding: 8px 4px;
154
+ text-align: center;
155
+ font-size: var(--lf-text-sm, 13px);
156
+ font-weight: var(--lf-cal-header-font-weight);
157
+ color: var(--lf-cal-header-color);
158
+ border-right: 1px solid var(--lf-cal-border);
159
+ }
160
+
161
+ .lf-cal-header-cell:last-child {
162
+ border-right: none;
163
+ }
164
+
165
+ .lf-cal-header-cell--today {
166
+ background: var(--lf-cal-today-bg);
167
+ color: var(--lf-cal-event-default-bg);
168
+ }
169
+
170
+ .lf-cal-header-cell--weekend {
171
+ background: var(--lf-cal-weekend-bg);
172
+ }
173
+
174
+ .lf-cal-header-day-name {
175
+ font-size: 11px;
176
+ text-transform: uppercase;
177
+ letter-spacing: 0.5px;
178
+ opacity: 0.7;
179
+ }
180
+
181
+ .lf-cal-header-day-number {
182
+ font-size: 18px;
183
+ font-weight: var(--lf-font-semibold, 600);
184
+ }
185
+
186
+ /* ─── All-Day Row ───────────────────────────────────────── */
187
+
188
+ .lf-cal-allday-row {
189
+ display: flex;
190
+ border-bottom: 1px solid var(--lf-cal-border);
191
+ background: var(--lf-cal-header-bg);
192
+ min-height: 28px;
193
+ }
194
+
195
+ .lf-cal-allday-label {
196
+ width: var(--lf-cal-time-width);
197
+ flex-shrink: 0;
198
+ border-right: 1px solid var(--lf-cal-border);
199
+ padding: 4px 8px;
200
+ font-size: var(--lf-cal-time-font-size);
201
+ color: var(--lf-cal-time-color);
202
+ text-align: right;
203
+ }
204
+
205
+ .lf-cal-allday-cells {
206
+ flex: 1;
207
+ display: flex;
208
+ }
209
+
210
+ .lf-cal-allday-cell {
211
+ flex: 1;
212
+ padding: 2px;
213
+ border-right: 1px solid var(--lf-cal-border);
214
+ min-height: 24px;
215
+ display: flex;
216
+ flex-direction: column;
217
+ gap: 2px;
218
+ }
219
+
220
+ .lf-cal-allday-cell:last-child {
221
+ border-right: none;
222
+ }
223
+
224
+ /* ─── Body / Grid ───────────────────────────────────────── */
225
+
226
+ .lf-cal-body {
227
+ display: flex;
228
+ overflow-y: auto;
229
+ max-height: 600px;
230
+ }
231
+
232
+ .lf-cal-time-column {
233
+ width: var(--lf-cal-time-width);
234
+ flex-shrink: 0;
235
+ border-right: 1px solid var(--lf-cal-border);
236
+ }
237
+
238
+ .lf-cal-time-label {
239
+ height: var(--lf-cal-slot-height);
240
+ padding: 0 8px;
241
+ font-size: var(--lf-cal-time-font-size);
242
+ color: var(--lf-cal-time-color);
243
+ text-align: right;
244
+ line-height: 1;
245
+ position: relative;
246
+ top: -6px;
247
+ }
248
+
249
+ .lf-cal-grid {
250
+ flex: 1;
251
+ display: flex;
252
+ position: relative;
253
+ }
254
+
255
+ .lf-cal-day-column {
256
+ flex: 1;
257
+ position: relative;
258
+ border-right: 1px solid var(--lf-cal-border);
259
+ }
260
+
261
+ .lf-cal-day-column:last-child {
262
+ border-right: none;
263
+ }
264
+
265
+ .lf-cal-day-column--today {
266
+ background: var(--lf-cal-today-bg);
267
+ }
268
+
269
+ .lf-cal-day-column--weekend {
270
+ background: var(--lf-cal-weekend-bg);
271
+ }
272
+
273
+ .lf-cal-resource-column {
274
+ flex: 1;
275
+ position: relative;
276
+ border-right: 1px solid var(--lf-cal-border);
277
+ }
278
+
279
+ .lf-cal-resource-column:last-child {
280
+ border-right: none;
281
+ }
282
+
283
+ /* ─── Time Slots ────────────────────────────────────────── */
284
+
285
+ .lf-cal-time-slot {
286
+ height: var(--lf-cal-slot-height);
287
+ border-bottom: 1px solid var(--lf-cal-border);
288
+ box-sizing: border-box;
289
+ }
290
+
291
+ .lf-cal-time-slot:last-child {
292
+ border-bottom: none;
293
+ }
294
+
295
+ .lf-cal-time-slot--blocked {
296
+ background: var(--lf-cal-blocked-bg);
297
+ background-image: var(--lf-cal-blocked-pattern);
298
+ }
299
+
300
+ .lf-cal-time-slot--selected {
301
+ background: var(--lf-cal-selection-bg);
302
+ }
303
+
304
+ .lf-cal-time-slot--hour {
305
+ border-bottom-color: var(--lf-color-border-strong, #cbd5e1);
306
+ }
307
+
308
+ /* ─── Events ────────────────────────────────────────────── */
309
+
310
+ .lf-cal-event {
311
+ position: absolute;
312
+ left: 2px;
313
+ right: 2px;
314
+ padding: var(--lf-cal-event-padding);
315
+ border-radius: var(--lf-cal-event-radius);
316
+ font-size: var(--lf-cal-event-font-size);
317
+ background: var(--lf-cal-event-default-bg);
318
+ color: var(--lf-cal-event-default-color);
319
+ overflow: hidden;
320
+ cursor: pointer;
321
+ transition: box-shadow var(--lf-transition-fast, 0.15s);
322
+ z-index: 1;
323
+ box-sizing: border-box;
324
+ border-left: 3px solid rgba(0,0,0,0.2);
325
+ }
326
+
327
+ .lf-cal-event:hover {
328
+ box-shadow: var(--lf-shadow-md, 0 4px 12px rgba(0,0,0,0.2));
329
+ z-index: 50;
330
+ min-width: 150px;
331
+ max-width: 250px;
332
+ width: max-content;
333
+ }
334
+
335
+ .lf-cal-event:hover .lf-cal-event-title {
336
+ white-space: normal;
337
+ word-break: break-word;
338
+ }
339
+
340
+ .lf-cal-event--dragging {
341
+ opacity: var(--lf-cal-drag-opacity);
342
+ box-shadow: var(--lf-shadow-md, 0 4px 12px rgba(0,0,0,0.2));
343
+ z-index: 100;
344
+ cursor: grabbing;
345
+ }
346
+
347
+ .lf-cal-event--ghost {
348
+ pointer-events: none;
349
+ z-index: 10000;
350
+ border: 2px dashed rgba(255,255,255,0.5);
351
+ }
352
+
353
+ .lf-cal-event--resizing {
354
+ z-index: 100;
355
+ }
356
+
357
+ .lf-cal-event[data-editable="true"] {
358
+ cursor: grab;
359
+ }
360
+
361
+ .lf-cal-day-column--drop-target {
362
+ background: var(--lf-cal-selection-bg);
363
+ }
364
+
365
+ .lf-cal-time-slot--drop-target {
366
+ background: var(--lf-cal-selection-bg);
367
+ border: 1px dashed var(--lf-cal-selection-border);
368
+ }
369
+
370
+ .lf-cal-event--selected {
371
+ box-shadow: 0 0 0 2px var(--lf-cal-selection-border);
372
+ }
373
+
374
+ .lf-cal-event--allday {
375
+ position: relative;
376
+ left: auto;
377
+ right: auto;
378
+ top: auto;
379
+ width: auto;
380
+ height: auto;
381
+ margin: 0;
382
+ padding: 2px 6px;
383
+ font-size: 11px;
384
+ border-left: none;
385
+ border-radius: 3px;
386
+ }
387
+
388
+ .lf-cal-event-title {
389
+ font-weight: var(--lf-font-medium, 500);
390
+ white-space: nowrap;
391
+ overflow: hidden;
392
+ text-overflow: ellipsis;
393
+ }
394
+
395
+ .lf-cal-event-time {
396
+ font-size: 10px;
397
+ opacity: 0.8;
398
+ }
399
+
400
+ .lf-cal-event-resize-handle {
401
+ position: absolute;
402
+ bottom: 0;
403
+ left: 0;
404
+ right: 0;
405
+ height: 8px;
406
+ cursor: ns-resize;
407
+ }
408
+
409
+ /* ─── Now Indicator ─────────────────────────────────────── */
410
+
411
+ .lf-cal-now-indicator {
412
+ position: absolute;
413
+ left: 0;
414
+ right: 0;
415
+ height: var(--lf-cal-now-width, 2px);
416
+ background: var(--lf-cal-now-color);
417
+ z-index: 100;
418
+ pointer-events: none;
419
+ box-shadow: 0 0 3px var(--lf-cal-now-color);
420
+ }
421
+
422
+ .lf-cal-now-indicator::before {
423
+ content: '';
424
+ position: absolute;
425
+ left: 0;
426
+ top: -4px;
427
+ width: 10px;
428
+ height: 10px;
429
+ border-radius: 50%;
430
+ background: var(--lf-cal-now-color);
431
+ transform: translateX(-4px);
432
+ }
433
+
434
+ .lf-cal-now-indicator--no-dot::before {
435
+ display: none;
436
+ }
437
+
438
+ /* ─── Month View ────────────────────────────────────────── */
439
+
440
+ .lf-cal-month-grid {
441
+ display: grid;
442
+ grid-template-columns: repeat(7, 1fr);
443
+ }
444
+
445
+ .lf-cal-month-header {
446
+ display: grid;
447
+ grid-template-columns: repeat(7, 1fr);
448
+ background: var(--lf-cal-header-bg);
449
+ border-bottom: 1px solid var(--lf-cal-border);
450
+ }
451
+
452
+ .lf-cal-month-header-cell {
453
+ padding: 8px;
454
+ text-align: center;
455
+ font-size: var(--lf-text-xs, 12px);
456
+ font-weight: var(--lf-cal-header-font-weight);
457
+ color: var(--lf-cal-header-color);
458
+ text-transform: uppercase;
459
+ }
460
+
461
+ .lf-cal-month-cell {
462
+ min-height: 100px;
463
+ padding: 4px;
464
+ border-right: 1px solid var(--lf-cal-border);
465
+ border-bottom: 1px solid var(--lf-cal-border);
466
+ background: var(--lf-cal-bg);
467
+ }
468
+
469
+ .lf-cal-month-cell:nth-child(7n) {
470
+ border-right: none;
471
+ }
472
+
473
+ .lf-cal-month-cell--today {
474
+ background: var(--lf-cal-today-bg);
475
+ }
476
+
477
+ .lf-cal-month-cell--other-month {
478
+ background: var(--lf-cal-weekend-bg);
479
+ opacity: 0.6;
480
+ }
481
+
482
+ .lf-cal-month-cell--weekend {
483
+ background: var(--lf-cal-weekend-bg);
484
+ }
485
+
486
+ .lf-cal-month-day-number {
487
+ font-size: var(--lf-text-base, 14px);
488
+ font-weight: var(--lf-font-medium, 500);
489
+ color: var(--lf-cal-header-color);
490
+ margin-bottom: 4px;
491
+ }
492
+
493
+ .lf-cal-month-cell--today .lf-cal-month-day-number {
494
+ display: inline-flex;
495
+ align-items: center;
496
+ justify-content: center;
497
+ width: 24px;
498
+ height: 24px;
499
+ background: var(--lf-cal-event-default-bg);
500
+ color: var(--lf-cal-event-default-color);
501
+ border-radius: 50%;
502
+ }
503
+
504
+ .lf-cal-month-event {
505
+ padding: 2px 4px;
506
+ margin-bottom: 2px;
507
+ font-size: 11px;
508
+ border-radius: 2px;
509
+ background: var(--lf-cal-event-default-bg);
510
+ color: var(--lf-cal-event-default-color);
511
+ white-space: nowrap;
512
+ overflow: hidden;
513
+ text-overflow: ellipsis;
514
+ cursor: pointer;
515
+ }
516
+
517
+ .lf-cal-month-event:hover {
518
+ filter: brightness(0.9);
519
+ }
520
+
521
+ .lf-cal-month-more {
522
+ font-size: 11px;
523
+ color: var(--lf-cal-event-default-bg);
524
+ cursor: pointer;
525
+ padding: 2px 4px;
526
+ }
527
+
528
+ .lf-cal-month-more:hover {
529
+ text-decoration: underline;
530
+ }
531
+
532
+ /* ─── Agenda View ───────────────────────────────────────── */
533
+
534
+ .lf-cal-agenda {
535
+ padding: 0;
536
+ overflow-y: auto;
537
+ max-height: 600px;
538
+ }
539
+
540
+ .lf-cal-agenda-day {
541
+ border-bottom: 1px solid var(--lf-cal-border);
542
+ }
543
+
544
+ .lf-cal-agenda-day:last-child {
545
+ border-bottom: none;
546
+ }
547
+
548
+ .lf-cal-agenda-day-header {
549
+ padding: 12px 16px;
550
+ background: var(--lf-cal-header-bg);
551
+ font-weight: var(--lf-cal-header-font-weight);
552
+ color: var(--lf-cal-header-color);
553
+ font-size: var(--lf-text-sm, 13px);
554
+ position: sticky;
555
+ top: 0;
556
+ }
557
+
558
+ .lf-cal-agenda-day-header--today {
559
+ background: var(--lf-cal-today-bg);
560
+ color: var(--lf-cal-event-default-bg);
561
+ }
562
+
563
+ .lf-cal-agenda-item {
564
+ display: flex;
565
+ align-items: flex-start;
566
+ padding: 12px 16px;
567
+ gap: 16px;
568
+ cursor: pointer;
569
+ transition: background-color var(--lf-transition-fast, 0.15s);
570
+ }
571
+
572
+ .lf-cal-agenda-item:hover {
573
+ background: var(--lf-cal-today-bg);
574
+ }
575
+
576
+ .lf-cal-agenda-item-time {
577
+ width: 100px;
578
+ flex-shrink: 0;
579
+ font-size: var(--lf-text-sm, 13px);
580
+ color: var(--lf-cal-time-color);
581
+ }
582
+
583
+ .lf-cal-agenda-item-indicator {
584
+ width: 4px;
585
+ height: 40px;
586
+ border-radius: 2px;
587
+ background: var(--lf-cal-event-default-bg);
588
+ flex-shrink: 0;
589
+ }
590
+
591
+ .lf-cal-agenda-item-content {
592
+ flex: 1;
593
+ }
594
+
595
+ .lf-cal-agenda-item-title {
596
+ font-weight: var(--lf-font-medium, 500);
597
+ color: var(--lf-cal-header-color);
598
+ margin-bottom: 2px;
599
+ }
600
+
601
+ .lf-cal-agenda-item-details {
602
+ font-size: var(--lf-text-sm, 13px);
603
+ color: var(--lf-cal-time-color);
604
+ }
605
+
606
+ /* ─── Empty State ───────────────────────────────────────── */
607
+
608
+ .lf-cal-empty {
609
+ padding: 40px;
610
+ text-align: center;
611
+ color: var(--lf-cal-time-color);
612
+ }
package/dist/styles.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * @liteforge/calendar - Default CSS Theme
3
- */
4
1
  export declare function injectCalendarStyles(): void;
5
2
  export declare function resetCalendarStylesInjection(): void;
6
3
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAsmBH,wBAAgB,oBAAoB,IAAI,IAAI,CAU3C;AAED,wBAAgB,4BAA4B,IAAI,IAAI,CAMnD"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,IAAI,IAAI,CAS3C;AAED,wBAAgB,4BAA4B,IAAI,IAAI,CAGnD"}
package/dist/styles.js CHANGED
@@ -1,632 +1,19 @@
1
- /**
2
- * @liteforge/calendar - Default CSS Theme
3
- */
1
+ import stylesUrl from '../css/styles.css?url';
4
2
  let stylesInjected = false;
5
- const DEFAULT_STYLES = `
6
- /* ─── CSS Variables ─────────────────────────────────────── */
7
-
8
- :root {
9
- --lf-cal-bg: #ffffff;
10
- --lf-cal-border: #e2e8f0;
11
- --lf-cal-border-radius: 8px;
12
- --lf-cal-slot-height: 40px;
13
- --lf-cal-header-bg: #f8fafc;
14
- --lf-cal-header-color: #374151;
15
- --lf-cal-header-font-weight: 600;
16
- --lf-cal-today-bg: #eff6ff;
17
- --lf-cal-weekend-bg: #fafafa;
18
- --lf-cal-now-color: #ef4444;
19
- --lf-cal-now-width: 2px;
20
- --lf-cal-event-radius: 4px;
21
- --lf-cal-event-font-size: 12px;
22
- --lf-cal-event-padding: 2px 6px;
23
- --lf-cal-event-default-bg: #3b82f6;
24
- --lf-cal-event-default-color: #ffffff;
25
- --lf-cal-blocked-bg: #f1f5f9;
26
- --lf-cal-blocked-pattern: repeating-linear-gradient(
27
- 45deg, transparent, transparent 5px, rgba(0,0,0,0.03) 5px, rgba(0,0,0,0.03) 10px
28
- );
29
- --lf-cal-selection-bg: rgba(59, 130, 246, 0.15);
30
- --lf-cal-selection-border: #3b82f6;
31
- --lf-cal-drag-opacity: 0.7;
32
- --lf-cal-time-color: #94a3b8;
33
- --lf-cal-time-font-size: 11px;
34
- --lf-cal-time-width: 60px;
35
- }
36
-
37
- /* ─── Root Container ────────────────────────────────────── */
38
-
39
- .lf-cal {
40
- background: var(--lf-cal-bg);
41
- border: 1px solid var(--lf-cal-border);
42
- border-radius: var(--lf-cal-border-radius);
43
- overflow: hidden;
44
- font-family: system-ui, -apple-system, sans-serif;
45
- font-size: 14px;
46
- }
47
-
48
- /* ─── Toolbar ───────────────────────────────────────────── */
49
-
50
- .lf-cal-toolbar {
51
- display: flex;
52
- align-items: center;
53
- justify-content: space-between;
54
- padding: 12px 16px;
55
- background: var(--lf-cal-header-bg);
56
- border-bottom: 1px solid var(--lf-cal-border);
57
- gap: 16px;
58
- }
59
-
60
- .lf-cal-toolbar-nav {
61
- display: flex;
62
- align-items: center;
63
- gap: 8px;
64
- }
65
-
66
- .lf-cal-toolbar-nav button {
67
- padding: 6px 12px;
68
- border: 1px solid var(--lf-cal-border);
69
- border-radius: 4px;
70
- background: white;
71
- cursor: pointer;
72
- font-size: 13px;
73
- transition: background-color 0.15s;
74
- }
75
-
76
- .lf-cal-toolbar-nav button:hover {
77
- background: var(--lf-cal-today-bg);
78
- }
79
-
80
- .lf-cal-toolbar-title {
81
- font-size: 16px;
82
- font-weight: var(--lf-cal-header-font-weight);
83
- color: var(--lf-cal-header-color);
84
- min-width: 200px;
85
- text-align: center;
86
- }
87
-
88
- .lf-cal-toolbar-views {
89
- display: flex;
90
- gap: 4px;
91
- }
92
-
93
- .lf-cal-toolbar-views button {
94
- padding: 6px 12px;
95
- border: 1px solid var(--lf-cal-border);
96
- background: white;
97
- cursor: pointer;
98
- font-size: 13px;
99
- transition: all 0.15s;
100
- }
101
-
102
- .lf-cal-toolbar-views button:first-child {
103
- border-radius: 4px 0 0 4px;
104
- }
105
-
106
- .lf-cal-toolbar-views button:last-child {
107
- border-radius: 0 4px 4px 0;
108
- }
109
-
110
- .lf-cal-toolbar-views button:not(:first-child) {
111
- margin-left: -1px;
112
- }
113
-
114
- .lf-cal-toolbar-views button:hover {
115
- background: var(--lf-cal-today-bg);
116
- }
117
-
118
- .lf-cal-toolbar-views button.active {
119
- background: var(--lf-cal-event-default-bg);
120
- color: white;
121
- border-color: var(--lf-cal-event-default-bg);
122
- }
123
-
124
- /* ─── Header ────────────────────────────────────────────── */
125
-
126
- .lf-cal-header {
127
- display: flex;
128
- border-bottom: 1px solid var(--lf-cal-border);
129
- background: var(--lf-cal-header-bg);
130
- }
131
-
132
- .lf-cal-header-time-spacer {
133
- width: var(--lf-cal-time-width);
134
- flex-shrink: 0;
135
- border-right: 1px solid var(--lf-cal-border);
136
- }
137
-
138
- .lf-cal-header-cell {
139
- flex: 1;
140
- padding: 8px 4px;
141
- text-align: center;
142
- font-size: 13px;
143
- font-weight: var(--lf-cal-header-font-weight);
144
- color: var(--lf-cal-header-color);
145
- border-right: 1px solid var(--lf-cal-border);
146
- }
147
-
148
- .lf-cal-header-cell:last-child {
149
- border-right: none;
150
- }
151
-
152
- .lf-cal-header-cell--today {
153
- background: var(--lf-cal-today-bg);
154
- color: var(--lf-cal-event-default-bg);
155
- }
156
-
157
- .lf-cal-header-cell--weekend {
158
- background: var(--lf-cal-weekend-bg);
159
- }
160
-
161
- .lf-cal-header-day-name {
162
- font-size: 11px;
163
- text-transform: uppercase;
164
- letter-spacing: 0.5px;
165
- opacity: 0.7;
166
- }
167
-
168
- .lf-cal-header-day-number {
169
- font-size: 18px;
170
- font-weight: 600;
171
- }
172
-
173
- /* ─── All-Day Row ───────────────────────────────────────── */
174
-
175
- .lf-cal-allday-row {
176
- display: flex;
177
- border-bottom: 1px solid var(--lf-cal-border);
178
- background: var(--lf-cal-header-bg);
179
- min-height: 28px;
180
- }
181
-
182
- .lf-cal-allday-label {
183
- width: var(--lf-cal-time-width);
184
- flex-shrink: 0;
185
- border-right: 1px solid var(--lf-cal-border);
186
- padding: 4px 8px;
187
- font-size: var(--lf-cal-time-font-size);
188
- color: var(--lf-cal-time-color);
189
- text-align: right;
190
- }
191
-
192
- .lf-cal-allday-cells {
193
- flex: 1;
194
- display: flex;
195
- }
196
-
197
- .lf-cal-allday-cell {
198
- flex: 1;
199
- padding: 2px;
200
- border-right: 1px solid var(--lf-cal-border);
201
- min-height: 24px;
202
- display: flex;
203
- flex-direction: column;
204
- gap: 2px;
205
- }
206
-
207
- .lf-cal-allday-cell:last-child {
208
- border-right: none;
209
- }
210
-
211
- /* ─── Body / Grid ───────────────────────────────────────── */
212
-
213
- .lf-cal-body {
214
- display: flex;
215
- overflow-y: auto;
216
- max-height: 600px;
217
- }
218
-
219
- .lf-cal-time-column {
220
- width: var(--lf-cal-time-width);
221
- flex-shrink: 0;
222
- border-right: 1px solid var(--lf-cal-border);
223
- }
224
-
225
- .lf-cal-time-label {
226
- height: var(--lf-cal-slot-height);
227
- padding: 0 8px;
228
- font-size: var(--lf-cal-time-font-size);
229
- color: var(--lf-cal-time-color);
230
- text-align: right;
231
- line-height: 1;
232
- position: relative;
233
- top: -6px;
234
- }
235
-
236
- .lf-cal-grid {
237
- flex: 1;
238
- display: flex;
239
- position: relative;
240
- }
241
-
242
- .lf-cal-day-column {
243
- flex: 1;
244
- position: relative;
245
- border-right: 1px solid var(--lf-cal-border);
246
- }
247
-
248
- .lf-cal-day-column:last-child {
249
- border-right: none;
250
- }
251
-
252
- .lf-cal-day-column--today {
253
- background: var(--lf-cal-today-bg);
254
- }
255
-
256
- .lf-cal-day-column--weekend {
257
- background: var(--lf-cal-weekend-bg);
258
- }
259
-
260
- .lf-cal-resource-column {
261
- flex: 1;
262
- position: relative;
263
- border-right: 1px solid var(--lf-cal-border);
264
- }
265
-
266
- .lf-cal-resource-column:last-child {
267
- border-right: none;
268
- }
269
-
270
- /* ─── Time Slots ────────────────────────────────────────── */
271
-
272
- .lf-cal-time-slot {
273
- height: var(--lf-cal-slot-height);
274
- border-bottom: 1px solid var(--lf-cal-border);
275
- box-sizing: border-box;
276
- }
277
-
278
- .lf-cal-time-slot:last-child {
279
- border-bottom: none;
280
- }
281
-
282
- .lf-cal-time-slot--blocked {
283
- background: var(--lf-cal-blocked-bg);
284
- background-image: var(--lf-cal-blocked-pattern);
285
- }
286
-
287
- .lf-cal-time-slot--selected {
288
- background: var(--lf-cal-selection-bg);
289
- }
290
-
291
- .lf-cal-time-slot--hour {
292
- border-bottom-color: #cbd5e1;
293
- }
294
-
295
- /* ─── Events ────────────────────────────────────────────── */
296
-
297
- .lf-cal-event {
298
- position: absolute;
299
- left: 2px;
300
- right: 2px;
301
- padding: var(--lf-cal-event-padding);
302
- border-radius: var(--lf-cal-event-radius);
303
- font-size: var(--lf-cal-event-font-size);
304
- background: var(--lf-cal-event-default-bg);
305
- color: var(--lf-cal-event-default-color);
306
- overflow: hidden;
307
- cursor: pointer;
308
- transition: box-shadow 0.15s;
309
- z-index: 1;
310
- box-sizing: border-box;
311
- border-left: 3px solid rgba(0,0,0,0.2);
312
- }
313
-
314
- .lf-cal-event:hover {
315
- box-shadow: 0 4px 12px rgba(0,0,0,0.2);
316
- z-index: 50;
317
- min-width: 150px;
318
- max-width: 250px;
319
- width: max-content;
320
- }
321
-
322
- .lf-cal-event:hover .lf-cal-event-title {
323
- white-space: normal;
324
- word-break: break-word;
325
- }
326
-
327
- .lf-cal-event--dragging {
328
- opacity: var(--lf-cal-drag-opacity);
329
- box-shadow: 0 4px 12px rgba(0,0,0,0.2);
330
- z-index: 100;
331
- cursor: grabbing;
332
- }
333
-
334
- .lf-cal-event--ghost {
335
- pointer-events: none;
336
- z-index: 10000;
337
- border: 2px dashed rgba(255,255,255,0.5);
338
- }
339
-
340
- .lf-cal-event--resizing {
341
- z-index: 100;
342
- }
343
-
344
- .lf-cal-event[data-editable="true"] {
345
- cursor: grab;
346
- }
347
-
348
- .lf-cal-day-column--drop-target {
349
- background: var(--lf-cal-selection-bg);
350
- }
351
-
352
- .lf-cal-time-slot--drop-target {
353
- background: var(--lf-cal-selection-bg);
354
- border: 1px dashed var(--lf-cal-selection-border);
355
- }
356
-
357
- .lf-cal-event--selected {
358
- box-shadow: 0 0 0 2px var(--lf-cal-selection-border);
359
- }
360
-
361
- .lf-cal-event--allday {
362
- position: relative;
363
- left: auto;
364
- right: auto;
365
- top: auto;
366
- width: auto;
367
- height: auto;
368
- margin: 0;
369
- padding: 2px 6px;
370
- font-size: 11px;
371
- border-left: none;
372
- border-radius: 3px;
373
- }
374
-
375
- .lf-cal-event-title {
376
- font-weight: 500;
377
- white-space: nowrap;
378
- overflow: hidden;
379
- text-overflow: ellipsis;
380
- }
381
-
382
- .lf-cal-event-time {
383
- font-size: 10px;
384
- opacity: 0.8;
385
- }
386
-
387
- .lf-cal-event-resize-handle {
388
- position: absolute;
389
- bottom: 0;
390
- left: 0;
391
- right: 0;
392
- height: 8px;
393
- cursor: ns-resize;
394
- }
395
-
396
- /* ─── Now Indicator ─────────────────────────────────────── */
397
-
398
- .lf-cal-now-indicator {
399
- position: absolute;
400
- left: 0;
401
- right: 0;
402
- height: var(--lf-cal-now-width, 2px);
403
- background: var(--lf-cal-now-color);
404
- z-index: 100;
405
- pointer-events: none;
406
- box-shadow: 0 0 3px var(--lf-cal-now-color);
407
- }
408
-
409
- .lf-cal-now-indicator::before {
410
- content: '';
411
- position: absolute;
412
- left: 0;
413
- top: -4px;
414
- width: 10px;
415
- height: 10px;
416
- border-radius: 50%;
417
- background: var(--lf-cal-now-color);
418
- transform: translateX(-4px);
419
- }
420
-
421
- .lf-cal-now-indicator--no-dot::before {
422
- display: none;
423
- }
424
-
425
- /* ─── Month View ────────────────────────────────────────── */
426
-
427
- .lf-cal-month-grid {
428
- display: grid;
429
- grid-template-columns: repeat(7, 1fr);
430
- }
431
-
432
- .lf-cal-month-header {
433
- display: grid;
434
- grid-template-columns: repeat(7, 1fr);
435
- background: var(--lf-cal-header-bg);
436
- border-bottom: 1px solid var(--lf-cal-border);
437
- }
438
-
439
- .lf-cal-month-header-cell {
440
- padding: 8px;
441
- text-align: center;
442
- font-size: 12px;
443
- font-weight: var(--lf-cal-header-font-weight);
444
- color: var(--lf-cal-header-color);
445
- text-transform: uppercase;
446
- }
447
-
448
- .lf-cal-month-cell {
449
- min-height: 100px;
450
- padding: 4px;
451
- border-right: 1px solid var(--lf-cal-border);
452
- border-bottom: 1px solid var(--lf-cal-border);
453
- background: var(--lf-cal-bg);
454
- }
455
-
456
- .lf-cal-month-cell:nth-child(7n) {
457
- border-right: none;
458
- }
459
-
460
- .lf-cal-month-cell--today {
461
- background: var(--lf-cal-today-bg);
462
- }
463
-
464
- .lf-cal-month-cell--other-month {
465
- background: var(--lf-cal-weekend-bg);
466
- opacity: 0.6;
467
- }
468
-
469
- .lf-cal-month-cell--weekend {
470
- background: var(--lf-cal-weekend-bg);
471
- }
472
-
473
- .lf-cal-month-day-number {
474
- font-size: 14px;
475
- font-weight: 500;
476
- color: var(--lf-cal-header-color);
477
- margin-bottom: 4px;
478
- }
479
-
480
- .lf-cal-month-cell--today .lf-cal-month-day-number {
481
- display: inline-flex;
482
- align-items: center;
483
- justify-content: center;
484
- width: 24px;
485
- height: 24px;
486
- background: var(--lf-cal-event-default-bg);
487
- color: white;
488
- border-radius: 50%;
489
- }
490
-
491
- .lf-cal-month-event {
492
- padding: 2px 4px;
493
- margin-bottom: 2px;
494
- font-size: 11px;
495
- border-radius: 2px;
496
- background: var(--lf-cal-event-default-bg);
497
- color: var(--lf-cal-event-default-color);
498
- white-space: nowrap;
499
- overflow: hidden;
500
- text-overflow: ellipsis;
501
- cursor: pointer;
502
- }
503
-
504
- .lf-cal-month-event:hover {
505
- filter: brightness(0.9);
506
- }
507
-
508
- .lf-cal-month-more {
509
- font-size: 11px;
510
- color: var(--lf-cal-event-default-bg);
511
- cursor: pointer;
512
- padding: 2px 4px;
513
- }
514
-
515
- .lf-cal-month-more:hover {
516
- text-decoration: underline;
517
- }
518
-
519
- /* ─── Agenda View ───────────────────────────────────────── */
520
-
521
- .lf-cal-agenda {
522
- padding: 0;
523
- overflow-y: auto;
524
- max-height: 600px;
525
- }
526
-
527
- .lf-cal-agenda-day {
528
- border-bottom: 1px solid var(--lf-cal-border);
529
- }
530
-
531
- .lf-cal-agenda-day:last-child {
532
- border-bottom: none;
533
- }
534
-
535
- .lf-cal-agenda-day-header {
536
- padding: 12px 16px;
537
- background: var(--lf-cal-header-bg);
538
- font-weight: var(--lf-cal-header-font-weight);
539
- color: var(--lf-cal-header-color);
540
- font-size: 13px;
541
- position: sticky;
542
- top: 0;
543
- }
544
-
545
- .lf-cal-agenda-day-header--today {
546
- background: var(--lf-cal-today-bg);
547
- color: var(--lf-cal-event-default-bg);
548
- }
549
-
550
- .lf-cal-agenda-item {
551
- display: flex;
552
- align-items: flex-start;
553
- padding: 12px 16px;
554
- gap: 16px;
555
- cursor: pointer;
556
- transition: background-color 0.15s;
557
- }
558
-
559
- .lf-cal-agenda-item:hover {
560
- background: var(--lf-cal-today-bg);
561
- }
562
-
563
- .lf-cal-agenda-item-time {
564
- width: 100px;
565
- flex-shrink: 0;
566
- font-size: 13px;
567
- color: var(--lf-cal-time-color);
568
- }
569
-
570
- .lf-cal-agenda-item-indicator {
571
- width: 4px;
572
- height: 40px;
573
- border-radius: 2px;
574
- background: var(--lf-cal-event-default-bg);
575
- flex-shrink: 0;
576
- }
577
-
578
- .lf-cal-agenda-item-content {
579
- flex: 1;
580
- }
581
-
582
- .lf-cal-agenda-item-title {
583
- font-weight: 500;
584
- color: var(--lf-cal-header-color);
585
- margin-bottom: 2px;
586
- }
587
-
588
- .lf-cal-agenda-item-details {
589
- font-size: 13px;
590
- color: var(--lf-cal-time-color);
591
- }
592
-
593
- /* ─── Empty State ───────────────────────────────────────── */
594
-
595
- .lf-cal-empty {
596
- padding: 40px;
597
- text-align: center;
598
- color: var(--lf-cal-time-color);
599
- }
600
-
601
- /* ─── Dark Mode ─────────────────────────────────────────── */
602
-
603
- [data-theme="dark"] {
604
- --lf-cal-bg: #1e1e2e;
605
- --lf-cal-border: #313244;
606
- --lf-cal-header-bg: #181825;
607
- --lf-cal-header-color: #cdd6f4;
608
- --lf-cal-today-bg: rgba(137, 180, 250, 0.1);
609
- --lf-cal-weekend-bg: #181825;
610
- --lf-cal-blocked-bg: #11111b;
611
- --lf-cal-time-color: #6c7086;
612
- }
613
- `;
614
3
  export function injectCalendarStyles() {
615
4
  if (stylesInjected)
616
5
  return;
617
6
  if (typeof document === 'undefined')
618
- return;
619
- const style = document.createElement('style');
620
- style.id = 'lf-calendar-styles';
621
- style.textContent = DEFAULT_STYLES;
622
- document.head.appendChild(style);
7
+ return; // SSR safety
8
+ const link = document.createElement('link');
9
+ link.rel = 'stylesheet';
10
+ link.href = stylesUrl;
11
+ link.setAttribute('data-lf-calendar', '');
12
+ document.head.appendChild(link);
623
13
  stylesInjected = true;
624
14
  }
625
15
  export function resetCalendarStylesInjection() {
626
16
  stylesInjected = false;
627
- const existing = document.getElementById('lf-calendar-styles');
628
- if (existing) {
629
- existing.remove();
630
- }
17
+ document.querySelector('link[data-lf-calendar]')?.remove();
631
18
  }
632
19
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,IAAI,cAAc,GAAG,KAAK,CAAA;AAE1B,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgmBtB,CAAA;AAED,MAAM,UAAU,oBAAoB;IAClC,IAAI,cAAc;QAAE,OAAM;IAC1B,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAM;IAE3C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC7C,KAAK,CAAC,EAAE,GAAG,oBAAoB,CAAA;IAC/B,KAAK,CAAC,WAAW,GAAG,cAAc,CAAA;IAClC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;IAEhC,cAAc,GAAG,IAAI,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,4BAA4B;IAC1C,cAAc,GAAG,KAAK,CAAA;IACtB,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAA;IAC9D,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,MAAM,EAAE,CAAA;IACnB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAE9C,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B,MAAM,UAAU,oBAAoB;IAClC,IAAI,cAAc;QAAE,OAAO;IAC3B,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,CAAC,aAAa;IAC1D,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC;IACxB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACtB,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC1C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,4BAA4B;IAC1C,cAAc,GAAG,KAAK,CAAC;IACvB,QAAQ,CAAC,aAAa,CAAC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;AAC7D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liteforge/calendar",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Full scheduling calendar with day/week/month/agenda views, drag & drop, resize, and resource columns.",
5
5
  "author": "SchildW3rk <contact@schildw3rk.dev>",
6
6
  "license": "MIT",
@@ -32,14 +32,18 @@
32
32
  ".": {
33
33
  "types": "./dist/index.d.ts",
34
34
  "import": "./dist/index.js"
35
- }
35
+ },
36
+ "./styles": "./css/styles.css"
36
37
  },
37
38
  "files": [
38
39
  "dist",
40
+ "css",
39
41
  "README.md",
40
42
  "LICENSE"
41
43
  ],
42
- "sideEffects": false,
44
+ "sideEffects": [
45
+ "css/*.css"
46
+ ],
43
47
  "engines": {
44
48
  "node": ">=18"
45
49
  },