@forcecalendar/interface 1.1.0 → 1.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/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@forcecalendar/interface",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "Official interface layer for forceCalendar Core - Enterprise calendar components",
6
6
  "main": "dist/force-calendar-interface.umd.js",
7
7
  "module": "dist/force-calendar-interface.esm.js",
8
8
  "exports": {
9
9
  ".": {
10
+ "types": "./types/index.d.ts",
10
11
  "import": "./dist/force-calendar-interface.esm.js",
11
12
  "require": "./dist/force-calendar-interface.umd.js"
12
13
  }
@@ -15,7 +16,8 @@
15
16
  "jsdelivr": "dist/force-calendar-interface.umd.js",
16
17
  "files": [
17
18
  "dist",
18
- "src"
19
+ "src",
20
+ "types/**/*.d.ts"
19
21
  ],
20
22
  "sideEffects": [
21
23
  "./src/index.js",
@@ -26,7 +28,9 @@
26
28
  "dev": "vite",
27
29
  "build": "vite build",
28
30
  "preview": "vite preview",
29
- "test": "jest --testTimeout=10000"
31
+ "test": "jest --testTimeout=10000",
32
+ "build:types": "tsc -p tsconfig.types.json",
33
+ "prepublishOnly": "npm run build && npm run build:types"
30
34
  },
31
35
  "repository": {
32
36
  "type": "git",
@@ -60,6 +64,8 @@
60
64
  "jest": "^30.2.0",
61
65
  "jest-environment-jsdom": "^30.2.0",
62
66
  "prettier": "^3.8.1",
67
+ "typescript": "^7.0.2",
63
68
  "vite": "^8.1.4"
64
- }
69
+ },
70
+ "types": "./types/index.d.ts"
65
71
  }
@@ -0,0 +1,42 @@
1
+ import { BaseComponent } from '../core/BaseComponent.js';
2
+ export declare class EventForm extends BaseComponent {
3
+ _isVisible: boolean;
4
+ _cleanupFocusTrap: (() => any) | null;
5
+ config: {
6
+ title: string;
7
+ defaultDuration: number;
8
+ colors: {
9
+ color: string;
10
+ label: string;
11
+ }[];
12
+ };
13
+ _formData: {
14
+ title: string;
15
+ start: Date;
16
+ end: Date;
17
+ allDay: boolean;
18
+ color: string;
19
+ };
20
+ modalContent: any;
21
+ titleInput: any;
22
+ startInput: any;
23
+ endInput: any;
24
+ colorContainer: any;
25
+ titleGroup: any;
26
+ endGroup: any;
27
+ _handleKeyDown: ((e: any) => void) | null | undefined;
28
+ _keydownListenerAdded: boolean | undefined;
29
+ constructor();
30
+ static get observedAttributes(): string[];
31
+ attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
32
+ getStyles(): string;
33
+ template(): string;
34
+ afterRender(): void;
35
+ updateColorSelection(): void;
36
+ open(initialDate?: Date): void;
37
+ close(): void;
38
+ validate(): boolean;
39
+ save(): void;
40
+ formatDateForInput(date: any): string;
41
+ unmount(): void;
42
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * ForceCalendar - Main calendar component
3
+ *
4
+ * The primary interface component that integrates all views and features
5
+ */
6
+ import { BaseComponent } from '../core/BaseComponent.js';
7
+ import StateManager from '../core/StateManager.js';
8
+ import { MonthViewRenderer } from '../renderers/MonthViewRenderer.js';
9
+ import { WeekViewRenderer } from '../renderers/WeekViewRenderer.js';
10
+ import { DayViewRenderer } from '../renderers/DayViewRenderer.js';
11
+ import './EventForm.js';
12
+ export declare class ForceCalendar extends BaseComponent {
13
+ stateManager: StateManager | null;
14
+ currentView: any;
15
+ _hasRendered: boolean;
16
+ _busUnsubscribers: any[];
17
+ _stateUnsubscribe: (() => void) | null | undefined;
18
+ _currentViewInstance: any;
19
+ _viewUnsubscribe: any;
20
+ static RENDERERS: {
21
+ month: typeof MonthViewRenderer;
22
+ week: typeof WeekViewRenderer;
23
+ day: typeof DayViewRenderer;
24
+ };
25
+ static get observedAttributes(): string[];
26
+ constructor();
27
+ /**
28
+ * Route observed-attribute changes into the StateManager.
29
+ * Without this, attribute updates after mount (view, locale, timezone,
30
+ * week-starts-on, date) only re-rendered from stale state and had no
31
+ * visible effect. 'height' is presentational and picked up by render().
32
+ */
33
+ propChanged(name: any, oldValue: any, newValue: any): void;
34
+ initialize(): void;
35
+ setupEventListeners(): void;
36
+ handleStateChange(newState: any, oldState: any): void;
37
+ /**
38
+ * Update only the title text (no DOM recreation)
39
+ */
40
+ _updateTitle(): void;
41
+ /**
42
+ * Update view button active states (no DOM recreation)
43
+ */
44
+ _updateViewButtons(): void;
45
+ /**
46
+ * Switch to a different view type
47
+ */
48
+ _switchView(): void;
49
+ /**
50
+ * Re-render only the view content (not header)
51
+ */
52
+ _updateViewContent(): void;
53
+ /**
54
+ * Toggle loading overlay without rebuilding the component tree.
55
+ */
56
+ _updateLoadingState(isLoading: any): void;
57
+ mount(): void;
58
+ loadView(viewType: any): void;
59
+ getStyles(): string;
60
+ template(): string;
61
+ renderView(): string;
62
+ afterRender(): void;
63
+ handleNavigation(event: any): void;
64
+ handleViewChange(event: any): void;
65
+ getTitle(date: any, view: any): string;
66
+ getIcon(name: any): any;
67
+ addEvent(event: any): any;
68
+ updateEvent(eventId: any, updates: any): any;
69
+ deleteEvent(eventId: any): boolean;
70
+ getEvents(): any;
71
+ setView(view: any): void;
72
+ setDate(date: any): void;
73
+ next(): void;
74
+ previous(): void;
75
+ today(): void;
76
+ unmount(): void;
77
+ destroy(): void;
78
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * BaseComponent - Foundation for all Force Calendar Web Components
3
+ *
4
+ * Provides common functionality:
5
+ * - Shadow DOM setup
6
+ * - Event handling
7
+ * - State management integration
8
+ * - Lifecycle management
9
+ * - Style management
10
+ */
11
+ export declare class BaseComponent extends HTMLElement {
12
+ _listeners: any[];
13
+ _state: any;
14
+ _props: Map<any, any>;
15
+ _initialized: boolean;
16
+ _styleEl: HTMLStyleElement | null | undefined;
17
+ _contentWrapper: HTMLDivElement | null | undefined;
18
+ constructor();
19
+ connectedCallback(): void;
20
+ disconnectedCallback(): void;
21
+ initialize(): void;
22
+ mount(): void;
23
+ unmount(): void;
24
+ cleanup(): void;
25
+ setState(newState: any): void;
26
+ getState(): any;
27
+ stateChanged(_oldState: any, _newState: any): void;
28
+ setProp(key: any, value: any): void;
29
+ getProp(key: any): any;
30
+ propChanged(_key: any, _oldValue: any, _newValue: any): void;
31
+ addListener(element: any, event: any, handler: any): void;
32
+ emit(eventName: any, detail?: {}): void;
33
+ getStyles(): string;
34
+ getBaseStyles(): string;
35
+ render(): void;
36
+ /**
37
+ * Save scroll positions of all scrollable containers within shadow DOM
38
+ * @returns {Map<string, {top: number, left: number}>}
39
+ */
40
+ _saveScrollPositions(): Map<string, {
41
+ top: number;
42
+ left: number;
43
+ }>;
44
+ /**
45
+ * Restore previously saved scroll positions
46
+ * @param {Map<string, {top: number, left: number}>} positions
47
+ */
48
+ _restoreScrollPositions(positions: Map<string, {
49
+ top: number;
50
+ left: number;
51
+ }>): void;
52
+ /**
53
+ * Get a CSS selector for the currently focused element within shadow DOM
54
+ * @returns {string|null}
55
+ */
56
+ _getActiveElementSelector(): string | null;
57
+ /**
58
+ * Restore focus to a previously focused element
59
+ * @param {string|null} selector
60
+ */
61
+ _restoreFocus(selector: string | null): void;
62
+ template(): string;
63
+ afterRender(): void;
64
+ $(selector: any): any;
65
+ $$(selector: any): NodeListOf<any>;
66
+ static get observedAttributes(): never[];
67
+ attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
68
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * EventBus - Central event communication system
3
+ *
4
+ * Enables decoupled communication between components
5
+ * Supports event namespacing and wildcard subscriptions
6
+ */
7
+ declare class EventBus {
8
+ events: Map<any, any>;
9
+ wildcardHandlers: Set<any>;
10
+ constructor();
11
+ /**
12
+ * Subscribe to an event
13
+ * @param {string} eventName - Event name or pattern (supports wildcards)
14
+ * @param {Function} handler - Event handler function
15
+ * @param {Object} options - Subscription options
16
+ * @returns {Function} Unsubscribe function
17
+ */
18
+ on(eventName: string, handler: Function, options?: Object): Function;
19
+ /**
20
+ * Subscribe to an event that fires only once
21
+ */
22
+ once(eventName: any, handler: any, options?: {}): Function;
23
+ /**
24
+ * Unsubscribe from an event
25
+ */
26
+ off(eventName: any, handler: any): void;
27
+ /**
28
+ * Remove all wildcard handlers matching a pattern
29
+ * @param {string} pattern - Pattern to match (e.g., 'event:*')
30
+ */
31
+ offWildcard(pattern: string): void;
32
+ /**
33
+ * Remove all handlers (regular and wildcard) for a specific handler function
34
+ * Useful for cleanup when a component is destroyed
35
+ * @param {Function} handler - Handler function to remove
36
+ */
37
+ offAll(handler: Function): void;
38
+ /**
39
+ * Emit an event synchronously
40
+ * @param {string} eventName - Event name
41
+ * @param {*} data - Event data
42
+ */
43
+ emit(eventName: string, data: any): void;
44
+ /**
45
+ * Check if event name matches a pattern
46
+ * Only `*` acts as a wildcard; all other characters match literally
47
+ */
48
+ matchesPattern(eventName: any, pattern: any): boolean;
49
+ /**
50
+ * Clear all event subscriptions
51
+ */
52
+ clear(): void;
53
+ /**
54
+ * Get all registered event names
55
+ */
56
+ getEventNames(): any[];
57
+ /**
58
+ * Get handler count for an event
59
+ */
60
+ getHandlerCount(eventName: any): any;
61
+ /**
62
+ * Get wildcard handler count
63
+ */
64
+ getWildcardHandlerCount(): number;
65
+ /**
66
+ * Get total handler count (for debugging/monitoring)
67
+ */
68
+ getTotalHandlerCount(): number;
69
+ }
70
+ declare const eventBus: EventBus;
71
+ export { EventBus, eventBus as default };
@@ -0,0 +1,112 @@
1
+ /**
2
+ * StateManager - Centralized state management for Force Calendar
3
+ *
4
+ * Wraps the @forcecalendar/core Calendar instance
5
+ * Provides reactive state updates and component synchronization
6
+ */
7
+ import { EventBus } from './EventBus.js';
8
+ declare class StateManager {
9
+ eventBus: EventBus;
10
+ calendar: any;
11
+ state: {
12
+ view: any;
13
+ currentDate: any;
14
+ events: never[];
15
+ selectedEvent: null;
16
+ selectedDate: null;
17
+ loading: boolean;
18
+ error: null;
19
+ config: {};
20
+ };
21
+ subscribers: Set<any>;
22
+ _subscriberIds: Map<any, any> | null | undefined;
23
+ constructor(config?: {});
24
+ /**
25
+ * Sync state.events from Core calendar (single source of truth)
26
+ * This ensures state.events always matches Core's event store.
27
+ *
28
+ * @param {object} options
29
+ * @param {boolean} options.silent - suppress subscriber notifications
30
+ * @param {boolean} options.force - always update even when IDs match
31
+ * (required after updateEvent where IDs
32
+ * are unchanged but content has changed)
33
+ */
34
+ _syncEventsFromCore(options?: {
35
+ silent: boolean;
36
+ force: boolean;
37
+ }): any;
38
+ /**
39
+ * Check if two event arrays have the same events by id.
40
+ * Only used for add/delete guards — updateEvent must pass force:true
41
+ * to bypass this check because IDs are unchanged after an update.
42
+ */
43
+ _eventsMatch(arr1: any, arr2: any): any;
44
+ getState(): {
45
+ view: any;
46
+ currentDate: any;
47
+ selectedEvent: null;
48
+ selectedDate: null;
49
+ loading: boolean;
50
+ error: null;
51
+ config: {};
52
+ events: never[];
53
+ };
54
+ setState(updates: any, options?: {}): {
55
+ view: any;
56
+ currentDate: any;
57
+ events: never[];
58
+ selectedEvent: null;
59
+ selectedDate: null;
60
+ loading: boolean;
61
+ error: null;
62
+ config: {};
63
+ };
64
+ subscribe(callback: any, subscriberId?: null): () => void;
65
+ unsubscribe(callback: any, subscriberId?: null): void;
66
+ /**
67
+ * Unsubscribe by subscriber ID
68
+ * @param {string} subscriberId - ID used when subscribing
69
+ */
70
+ unsubscribeById(subscriberId: string): boolean;
71
+ /**
72
+ * Get subscriber count (for debugging/monitoring)
73
+ */
74
+ getSubscriberCount(): number;
75
+ notifySubscribers(oldState: any, newState: any): void;
76
+ emitStateChange(oldState: any, newState: any): void;
77
+ setView(view: any): void;
78
+ getView(): any;
79
+ setDate(date: any): void;
80
+ getCurrentDate(): any;
81
+ next(): void;
82
+ previous(): void;
83
+ today(): void;
84
+ goToDate(date: any): void;
85
+ addEvent(event: any): any;
86
+ updateEvent(eventId: any, updates: any): any;
87
+ deleteEvent(eventId: any): boolean;
88
+ getEvents(): any;
89
+ /**
90
+ * Force sync state.events from Core calendar
91
+ * Use this if you've modified events directly on the Core calendar
92
+ */
93
+ syncEvents(): any;
94
+ getEventsForDate(date: any): any;
95
+ getEventsInRange(start: any, end: any): any;
96
+ getViewData(): any;
97
+ enrichViewData(viewData: any): any;
98
+ selectEvent(event: any): void;
99
+ selectEventById(eventId: any): void;
100
+ deselectEvent(): void;
101
+ selectDate(date: any): void;
102
+ deselectDate(): void;
103
+ isToday(date: any): boolean;
104
+ isSelectedDate(date: any): null;
105
+ isWeekend(date: any): boolean;
106
+ setLoading(loading: any): void;
107
+ setError(error: any): void;
108
+ clearError(): void;
109
+ updateConfig(config: any): void;
110
+ destroy(): void;
111
+ }
112
+ export default StateManager;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Force Calendar Interface
3
+ * Main entry point for the component library
4
+ *
5
+ * A solid foundation for calendar interfaces built on @forcecalendar/core
6
+ */
7
+ export { BaseComponent } from './core/BaseComponent.js';
8
+ export { default as StateManager } from './core/StateManager.js';
9
+ export { default as eventBus, EventBus } from './core/EventBus.js';
10
+ export { DateUtils } from './utils/DateUtils.js';
11
+ export { DOMUtils } from './utils/DOMUtils.js';
12
+ export { StyleUtils } from './utils/StyleUtils.js';
13
+ export { BaseViewRenderer } from './renderers/BaseViewRenderer.js';
14
+ export { MonthViewRenderer } from './renderers/MonthViewRenderer.js';
15
+ export { WeekViewRenderer } from './renderers/WeekViewRenderer.js';
16
+ export { DayViewRenderer } from './renderers/DayViewRenderer.js';
17
+ export { ForceCalendar } from './components/ForceCalendar.js';
@@ -0,0 +1,122 @@
1
+ /**
2
+ * BaseViewRenderer - Foundation for all view renderers
3
+ *
4
+ * Pure JavaScript class (no Web Components) for Salesforce Locker Service compatibility.
5
+ * Provides common functionality for rendering calendar views.
6
+ */
7
+ export declare class BaseViewRenderer {
8
+ container: HTMLElement;
9
+ stateManager: StateManager;
10
+ _listeners: any[];
11
+ _scrolled: boolean;
12
+ _nowIndicatorTimer: number | null;
13
+ /**
14
+ * @param {HTMLElement} container - The DOM element to render into
15
+ * @param {StateManager} stateManager - The state manager instance
16
+ */
17
+ constructor(container: HTMLElement, stateManager: StateManager);
18
+ /**
19
+ * Render the view into the container
20
+ * Must be implemented by subclasses
21
+ */
22
+ render(): void;
23
+ /**
24
+ * Clean up event listeners
25
+ */
26
+ cleanup(): void;
27
+ /**
28
+ * Add an event listener with automatic cleanup tracking
29
+ * @param {HTMLElement} element
30
+ * @param {string} event
31
+ * @param {Function} handler
32
+ */
33
+ addListener(element: HTMLElement, event: string, handler: Function): void;
34
+ /**
35
+ * Escape HTML to prevent XSS
36
+ * @param {string} str
37
+ * @returns {string}
38
+ */
39
+ escapeHTML(str: string): string;
40
+ /**
41
+ * Check if a date is today
42
+ * @param {Date} date
43
+ * @returns {boolean}
44
+ */
45
+ isToday(date: Date): boolean;
46
+ /**
47
+ * Check if two dates are the same day
48
+ * @param {Date} date1
49
+ * @param {Date} date2
50
+ * @returns {boolean}
51
+ */
52
+ isSameDay(date1: Date, date2: Date): boolean;
53
+ /**
54
+ * Format hour for display (e.g., "9 AM", "2 PM")
55
+ * @param {number} hour - Hour in 24-hour format (0-23)
56
+ * @returns {string}
57
+ */
58
+ formatHour(hour: number): string;
59
+ /**
60
+ * Format time for display (e.g., "9 AM", "2:30 PM")
61
+ * @param {Date} date
62
+ * @returns {string}
63
+ */
64
+ formatTime(date: Date): string;
65
+ /**
66
+ * Get contrasting text color for a background color.
67
+ * Delegates to StyleUtils.getContrastColor() as the single implementation.
68
+ * @param {string} bgColor - Hex color string
69
+ * @returns {string} '#000000' or '#FFFFFF'
70
+ */
71
+ getContrastingTextColor(bgColor: string): string;
72
+ /**
73
+ * Render the "now" indicator line for time-based views
74
+ * @returns {string} HTML string
75
+ */
76
+ renderNowIndicator(): string;
77
+ /**
78
+ * Start a timer that updates the now indicator position every 60 seconds.
79
+ * Call this after render() in day/week views that show a now indicator.
80
+ */
81
+ startNowIndicatorTimer(): void;
82
+ /**
83
+ * Compute overlap layout columns for a list of timed events.
84
+ * Returns a Map of event.id -> { column, totalColumns }.
85
+ * Uses a greedy left-to-right column packing algorithm.
86
+ * @param {Array} events - Array of event objects with start/end dates
87
+ * @returns {Map<string, {column: number, totalColumns: number}>}
88
+ */
89
+ computeOverlapLayout(events: any[]): Map<string, {
90
+ column: number;
91
+ totalColumns: number;
92
+ }>;
93
+ /**
94
+ * Render a timed event block
95
+ * @param {Object} event - Event object
96
+ * @param {Object} options - Rendering options
97
+ * @param {Object} options.compact - Use compact layout
98
+ * @param {Object} options.overlapLayout - Map from computeOverlapLayout()
99
+ * @returns {string} HTML string
100
+ */
101
+ renderTimedEvent(event: Object, options?: {
102
+ compact: Object;
103
+ overlapLayout: Object;
104
+ }): string;
105
+ /**
106
+ * Get a safe, sanitized event color value.
107
+ * @param {Object} event
108
+ * @returns {string}
109
+ */
110
+ getEventColor(event: Object): string;
111
+ /**
112
+ * Attach common event handlers for day/event clicks
113
+ */
114
+ attachCommonEventHandlers(): void;
115
+ _selectEventFromElement(eventEl: any): void;
116
+ /**
117
+ * Make rendered events keyboard-reachable and screen-reader labeled.
118
+ * Runs after every render, across all views.
119
+ */
120
+ _enhanceEventAccessibility(): void;
121
+ }
122
+ export default BaseViewRenderer;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * DayViewRenderer - Renders single day calendar view
3
+ *
4
+ * Pure JavaScript renderer for day view, compatible with Salesforce Locker Service.
5
+ */
6
+ import { BaseViewRenderer } from './BaseViewRenderer.js';
7
+ export declare class DayViewRenderer extends BaseViewRenderer {
8
+ hourHeight: number;
9
+ totalHeight: number;
10
+ constructor(container: any, stateManager: any);
11
+ render(): void;
12
+ _renderDayView(viewData: any, _config: any): string;
13
+ _extractDayData(viewData: any, currentDate: any): {
14
+ dayDate: Date;
15
+ dayName: any;
16
+ isToday: any;
17
+ allDayEvents: any;
18
+ timedEvents: any;
19
+ } | null;
20
+ _renderHeader(dayDate: any, dayName: any, isToday: any): string;
21
+ _renderAllDayRow(allDayEvents: any, dayDate: any): string;
22
+ _renderTimeGrid(timedEvents: any, isToday: any, dayDate: any, hours: any): string;
23
+ _renderTimeGutter(hours: any): string;
24
+ _renderDayColumn(timedEvents: any, isToday: any, dayDate: any, hours: any): string;
25
+ _attachEventHandlers(): void;
26
+ _scrollToCurrentTime(): void;
27
+ }
28
+ export default DayViewRenderer;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * MonthViewRenderer - Renders month calendar grid
3
+ *
4
+ * Pure JavaScript renderer for month view, compatible with Salesforce Locker Service.
5
+ */
6
+ import { BaseViewRenderer } from './BaseViewRenderer.js';
7
+ export declare class MonthViewRenderer extends BaseViewRenderer {
8
+ maxEventsToShow: number;
9
+ _pendingFocusMs: number | null | undefined;
10
+ _dayLabelFormatter: Intl.DateTimeFormat | undefined;
11
+ constructor(container: any, stateManager: any);
12
+ render(): void;
13
+ _renderMonthView(viewData: any, config: any): string;
14
+ _getDayNames(weekStartsOn: any): string[];
15
+ _renderWeek(week: any): string;
16
+ _renderDay(day: any): string;
17
+ _renderEvent(event: any): string;
18
+ _attachEventHandlers(): void;
19
+ /**
20
+ * Ensure exactly one grid cell participates in the tab order.
21
+ * Priority: requested focus date, selected date, today, first day of
22
+ * the current month.
23
+ * @param {number|null} focusMs - Preferred focus date as a timestamp
24
+ * @returns {HTMLElement|null} The tabbable cell
25
+ */
26
+ _applyRovingTabindex(focusMs?: number | null): HTMLElement | null;
27
+ }
28
+ export default MonthViewRenderer;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * WeekViewRenderer - Renders week calendar view
3
+ *
4
+ * Pure JavaScript renderer for week view, compatible with Salesforce Locker Service.
5
+ */
6
+ import { BaseViewRenderer } from './BaseViewRenderer.js';
7
+ export declare class WeekViewRenderer extends BaseViewRenderer {
8
+ hourHeight: number;
9
+ totalHeight: number;
10
+ constructor(container: any, stateManager: any);
11
+ render(): void;
12
+ _renderWeekView(viewData: any, _config: any): string;
13
+ _renderHeader(days: any): string;
14
+ _renderAllDayRow(days: any): string;
15
+ _renderTimeGrid(days: any, hours: any): string;
16
+ _renderTimeGutter(hours: any): string;
17
+ _renderDayColumn(day: any, hours: any): string;
18
+ _attachEventHandlers(): void;
19
+ _scrollToCurrentTime(): void;
20
+ }
21
+ export default WeekViewRenderer;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * View Renderers
3
+ *
4
+ * Pure JavaScript renderers for calendar views.
5
+ * Compatible with Salesforce Locker Service (no custom elements).
6
+ */
7
+ export { BaseViewRenderer } from './BaseViewRenderer.js';
8
+ export { MonthViewRenderer } from './MonthViewRenderer.js';
9
+ export { WeekViewRenderer } from './WeekViewRenderer.js';
10
+ export { DayViewRenderer } from './DayViewRenderer.js';
@@ -0,0 +1,121 @@
1
+ /**
2
+ * DOMUtils - DOM manipulation and event utilities
3
+ */
4
+ export declare class DOMUtils {
5
+ /**
6
+ * Create element with attributes and children
7
+ */
8
+ static createElement(tag: any, attributes?: {}, children?: any[]): any;
9
+ /**
10
+ * Add multiple event listeners
11
+ */
12
+ static addEventListeners(element: any, events: any): () => void;
13
+ /**
14
+ * Delegate event handling
15
+ */
16
+ static delegate(element: any, selector: any, event: any, handler: any): () => any;
17
+ /**
18
+ * Get element position relative to viewport
19
+ */
20
+ static getPosition(element: any): {
21
+ top: any;
22
+ left: any;
23
+ bottom: any;
24
+ right: any;
25
+ width: any;
26
+ height: any;
27
+ };
28
+ /**
29
+ * Check if element is in viewport
30
+ */
31
+ static isInViewport(element: any, threshold?: number): boolean;
32
+ /**
33
+ * Smooth scroll to element
34
+ */
35
+ static scrollToElement(element: any, options?: {}): void;
36
+ /**
37
+ * Get computed style value
38
+ */
39
+ static getStyle(element: any, property: any): string;
40
+ /**
41
+ * Set multiple styles
42
+ */
43
+ static setStyles(element: any, styles: any): void;
44
+ /**
45
+ * Add/remove classes with animation support
46
+ */
47
+ static animateClass(element: any, className: any, duration?: number): Promise<void>;
48
+ /**
49
+ * Wait for animation/transition to complete
50
+ * Resolves after `timeout` ms even if the event never fires (animation
51
+ * cancelled, element removed from DOM, etc.) so awaiting callers can't hang.
52
+ * @param {Element} element - Element to listen on
53
+ * @param {string} [eventType='animationend'] - Event to wait for
54
+ * @param {number} [timeout=3000] - Max wait in ms; 0 disables the timeout
55
+ */
56
+ static waitForAnimation(element: Element, eventType?: string, timeout?: number): Promise<any>;
57
+ /**
58
+ * Utility wait function
59
+ */
60
+ static wait(ms: any): Promise<any>;
61
+ /**
62
+ * Parse HTML string safely
63
+ * Sanitizes by default: strips script-capable elements, inline event
64
+ * handlers and javascript: URLs so the returned node is inert even if the
65
+ * input contains an XSS payload. Pass { sanitize: false } only for trusted,
66
+ * non-user-controlled markup.
67
+ */
68
+ static parseHTML(htmlString: any, { sanitize }?: {
69
+ sanitize?: boolean | undefined;
70
+ }): ChildNode | null;
71
+ /**
72
+ * Remove script-capable elements, on* handlers and javascript: URLs
73
+ * from a parsed DOM fragment (in place)
74
+ */
75
+ static _sanitizeNode(root: any): void;
76
+ /**
77
+ * Escape HTML to prevent XSS
78
+ */
79
+ static escapeHTML(str: any): string;
80
+ /**
81
+ * Debounce function calls
82
+ */
83
+ static debounce(func: any, wait?: number): (...args: any[]) => void;
84
+ /**
85
+ * Throttle function calls
86
+ */
87
+ static throttle(func: any, limit?: number): (...args: any[]) => void;
88
+ /**
89
+ * Get closest parent matching selector
90
+ */
91
+ static closest(element: any, selector: any): any;
92
+ /**
93
+ * Get all parents matching selector
94
+ */
95
+ static parents(element: any, selector: any): any[];
96
+ /**
97
+ * Measure element dimensions including margins
98
+ */
99
+ static getOuterDimensions(element: any): {
100
+ width: any;
101
+ height: any;
102
+ margin: {
103
+ top: number;
104
+ right: number;
105
+ bottom: number;
106
+ left: number;
107
+ };
108
+ };
109
+ /**
110
+ * Clone an element. Event listeners are NOT copied — the Web Platform
111
+ * provides no way to enumerate listeners, so callers must re-attach their
112
+ * own handlers to the clone.
113
+ * @deprecated Use element.cloneNode(deep) directly and re-bind listeners.
114
+ */
115
+ static cloneWithEvents(element: any, deep?: boolean): any;
116
+ /**
117
+ * Focus trap for modals/dialogs
118
+ */
119
+ static trapFocus(container: any): () => any;
120
+ }
121
+ export default DOMUtils;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * DateUtils - Date formatting and manipulation utilities
3
+ *
4
+ * Extends Core DateUtils with UI-specific formatting
5
+ */
6
+ import { DateUtils as CoreDateUtils } from '@forcecalendar/core';
7
+ export declare class DateUtils extends CoreDateUtils {
8
+ /**
9
+ * Format date for display
10
+ */
11
+ static formatDate(date: any, format?: string, locale?: string): string;
12
+ /**
13
+ * Format time for display
14
+ */
15
+ static formatTime(date: any, showMinutes?: boolean, use24Hour?: boolean, locale?: string): string;
16
+ /**
17
+ * Format date range for display
18
+ */
19
+ static formatDateRange(start: any, end: any, locale?: string): string;
20
+ /**
21
+ * Format time range for display
22
+ */
23
+ static formatTimeRange(start: any, end: any, locale?: string): string;
24
+ /**
25
+ * Get relative time string (e.g., "2 hours ago", "in 3 days")
26
+ */
27
+ static getRelativeTime(date: any, baseDate?: Date, locale?: string): string;
28
+ /**
29
+ * Check if date is today
30
+ */
31
+ static isToday(date: any): any;
32
+ /**
33
+ * Check if date is in the past
34
+ */
35
+ static isPast(date: any): boolean;
36
+ /**
37
+ * Check if date is in the future
38
+ */
39
+ static isFuture(date: any): boolean;
40
+ /**
41
+ * Get calendar week number
42
+ */
43
+ static getWeekNumber(date: any): number;
44
+ /**
45
+ * Get day abbreviation
46
+ */
47
+ static getDayAbbreviation(dayIndex: any, locale?: string): string;
48
+ /**
49
+ * Get full day name
50
+ */
51
+ static getDayName(dayIndex: any, locale?: string): string;
52
+ /**
53
+ * Get month name
54
+ */
55
+ static getMonthName(monthIndex: any, format?: string, locale?: string): string;
56
+ /**
57
+ * Parse time string (e.g., "14:30" or "2:30 PM")
58
+ */
59
+ static parseTimeString(timeStr: any, baseDate?: Date): Date;
60
+ }
61
+ export default DateUtils;
@@ -0,0 +1,146 @@
1
+ /**
2
+ * StyleUtils - Styling utilities and theme management
3
+ */
4
+ export declare class StyleUtils {
5
+ /**
6
+ * Default theme colors
7
+ */
8
+ static colors: {
9
+ primary: string;
10
+ secondary: string;
11
+ accent: string;
12
+ danger: string;
13
+ warning: string;
14
+ info: string;
15
+ success: string;
16
+ light: string;
17
+ dark: string;
18
+ white: string;
19
+ gray: {
20
+ 50: string;
21
+ 100: string;
22
+ 200: string;
23
+ 300: string;
24
+ 400: string;
25
+ 500: string;
26
+ 600: string;
27
+ 700: string;
28
+ 800: string;
29
+ 900: string;
30
+ };
31
+ };
32
+ /**
33
+ * Common CSS variables
34
+ */
35
+ static cssVariables: {
36
+ '--fc-primary-color': string;
37
+ '--fc-primary-hover': string;
38
+ '--fc-primary-light': string;
39
+ '--fc-text-color': string;
40
+ '--fc-text-secondary': string;
41
+ '--fc-text-light': string;
42
+ '--fc-border-color': string;
43
+ '--fc-border-color-hover': string;
44
+ '--fc-background': string;
45
+ '--fc-background-alt': string;
46
+ '--fc-background-hover': string;
47
+ '--fc-background-active': string;
48
+ '--fc-accent-color': string;
49
+ '--fc-danger-color': string;
50
+ '--fc-success-color': string;
51
+ '--fc-font-family': string;
52
+ '--fc-font-size-xs': string;
53
+ '--fc-font-size-sm': string;
54
+ '--fc-font-size-base': string;
55
+ '--fc-font-size-lg': string;
56
+ '--fc-font-size-xl': string;
57
+ '--fc-font-size-2xl': string;
58
+ '--fc-line-height': string;
59
+ '--fc-font-weight-normal': string;
60
+ '--fc-font-weight-medium': string;
61
+ '--fc-font-weight-semibold': string;
62
+ '--fc-font-weight-bold': string;
63
+ '--fc-spacing-xs': string;
64
+ '--fc-spacing-sm': string;
65
+ '--fc-spacing-md': string;
66
+ '--fc-spacing-lg': string;
67
+ '--fc-spacing-xl': string;
68
+ '--fc-spacing-2xl': string;
69
+ '--fc-border-width': string;
70
+ '--fc-border-radius-sm': string;
71
+ '--fc-border-radius': string;
72
+ '--fc-border-radius-lg': string;
73
+ '--fc-border-radius-full': string;
74
+ '--fc-shadow-sm': string;
75
+ '--fc-shadow': string;
76
+ '--fc-shadow-md': string;
77
+ '--fc-shadow-lg': string;
78
+ '--fc-transition-fast': string;
79
+ '--fc-transition': string;
80
+ '--fc-transition-slow': string;
81
+ '--fc-z-dropdown': string;
82
+ '--fc-z-modal': string;
83
+ '--fc-z-tooltip': string;
84
+ };
85
+ /**
86
+ * Get CSS variable value
87
+ */
88
+ static getCSSVariable(name: any, element?: HTMLElement): string;
89
+ /**
90
+ * Set CSS variables
91
+ */
92
+ static setCSSVariables(variables: any, element?: HTMLElement): void;
93
+ /**
94
+ * Generate base styles
95
+ */
96
+ static getBaseStyles(): string;
97
+ /**
98
+ * Generate button styles
99
+ */
100
+ static getButtonStyles(): string;
101
+ /**
102
+ * Darken color by percentage
103
+ */
104
+ static darken(color: any, percent: any): string;
105
+ /**
106
+ * Lighten color by percentage
107
+ */
108
+ static lighten(color: any, percent: any): string;
109
+ /**
110
+ * Get contrast color (black or white) for background
111
+ */
112
+ static getContrastColor(bgColor: any): "#000000" | "#FFFFFF";
113
+ /**
114
+ * Sanitize color value to prevent CSS injection
115
+ * Returns the color if valid, or a fallback color if invalid
116
+ */
117
+ static sanitizeColor(color: any, fallback?: string): string;
118
+ /**
119
+ * Convert hex to rgba
120
+ */
121
+ static hexToRgba(hex: any, alpha?: number): string;
122
+ /**
123
+ * Generate grid styles
124
+ */
125
+ static getGridStyles(): string;
126
+ /**
127
+ * Get responsive breakpoints
128
+ */
129
+ static breakpoints: {
130
+ xs: string;
131
+ sm: string;
132
+ md: string;
133
+ lg: string;
134
+ xl: string;
135
+ '2xl': string;
136
+ };
137
+ /**
138
+ * Generate media query
139
+ */
140
+ static mediaQuery(breakpoint: any, styles: any): string;
141
+ /**
142
+ * Animation keyframes
143
+ */
144
+ static getAnimations(): string;
145
+ }
146
+ export default StyleUtils;