forceCalendar

Installation

Install and configure forceCalendar packages.

Core Package

npm install @forcecalendar/core

The core package is published as pure ESM with no dependencies. It requires a JavaScript environment that supports ES modules.

Package Exports

The package exposes the following entry points via exports in package.json:

Import PathModule
@forcecalendar/coreAll exports (Calendar, Event, EventStore, etc.)
@forcecalendar/core/calendarCalendar class
@forcecalendar/core/eventsEvent class
@forcecalendar/core/stateStateManager class
@forcecalendar/core/searchEventSearch class
@forcecalendar/core/icsICSHandler class
@forcecalendar/core/typesTypeScript type definitions

Import Examples

// Import everything
import {
  Calendar,
  Event,
  EventStore,
  StateManager,
  DateUtils,
  ICSParser,
  ICSHandler,
  EventSearch,
  RecurrenceEngine,
  RecurrenceEngineV2,
  RRuleParser,
  EnhancedCalendar,
  SearchWorkerManager,
  InvertedIndex,
} from '@forcecalendar/core';

// Import specific modules (tree-shakeable)
import { Calendar } from '@forcecalendar/core/calendar';
import { Event } from '@forcecalendar/core/events';
import { StateManager } from '@forcecalendar/core/state';
import { ICSHandler } from '@forcecalendar/core/ics';

Interface Package

npm install @forcecalendar/interface

The interface package provides Web Components that consume the core engine. It registers the <forcecal-main> custom element automatically on import.

import '@forcecalendar/interface';
// <forcecal-main> is now available in the DOM

Individual Imports

import {
  ForceCalendar,
  BaseComponent,
  MonthViewRenderer,
  WeekViewRenderer,
  DayViewRenderer,
  EventBus,
  eventBus,         // Singleton instance
  StyleUtils,
  DateUtils,
  StateManager,
} from '@forcecalendar/interface';

Salesforce Deployment

The Salesforce package is deployed as a Lightning Web Component with an Apex controller. It is not published on npm.

Prerequisites

  • Salesforce org with Lightning Experience enabled
  • API version 58.0 or higher
  • Read access to the Event standard object (or your custom object)

Deployment Steps

  1. Deploy the Apex controller: ForceCalendarController.cls
  2. Deploy the LWC component: forceCalendar/
  3. Deploy @forcecalendar/core and @forcecalendar/interface as static resources
  4. Add the component to a Lightning page via App Builder

See the Salesforce guide for detailed deployment instructions.

Browser Compatibility

forceCalendar uses standard Web APIs with no polyfills required in modern browsers:

FeatureUsed ByMinimum Support
ES ModulesCoreAll modern browsers
Intl.DateTimeFormatTimezone handlingAll modern browsers
Map / SetEventStore, StateManagerAll modern browsers
CustomEventInterface eventsAll modern browsers
Shadow DOMWeb ComponentsChrome 53+, Firefox 63+, Safari 10+
Web WorkersSearchWorkerManagerAll modern browsers (optional)
performance.memoryAdaptiveMemoryManagerChrome only (graceful fallback)

The core package works in Node.js 16+ for server-side usage and testing.

CDN Usage

For quick prototyping without a build step:

<script type="module">
  import { Calendar } from 'https://esm.sh/@forcecalendar/core';

  const calendar = new Calendar({ view: 'month' });
</script>

TypeScript Support

Type definitions are included in the core package at @forcecalendar/core/types:

import type {
  CalendarConfig,
  CalendarState,
  EventData,
  RecurrenceRule,
  ICSExportOptions,
  SearchOptions,
} from '@forcecalendar/core/types';