calendaryjs-plugin-liturgical 0.1.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.
@@ -0,0 +1,1064 @@
1
+ import { BaseEventProperties, CustomEventResolver, CustomEventConfig, EventConfig, CalendarDay, CalendaryPlugin, EventTypeHandler, EventText, DateString } from 'calendaryjs';
2
+
3
+ /**
4
+ * MassKey - Unique identifier for each liturgical event
5
+ *
6
+ * These keys are used to:
7
+ * 1. Identify events uniquely across the system
8
+ * 2. Map to custom titles via Record<MassKey, string>
9
+ * 3. Reference events in queries and searches
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const titles: Record<MassKey, string> = {
14
+ * EASTER_SUNDAY: 'Easter Sunday',
15
+ * CHRISTMAS: 'Christmas',
16
+ * // ...
17
+ * };
18
+ * ```
19
+ */
20
+ /**
21
+ * Easter Cycle events - dates calculated relative to Easter Sunday
22
+ */
23
+ type EasterCycleKey = "EASTER_SUNDAY" | "ASH_WEDNESDAY" | "PALM_SUNDAY" | "HOLY_THURSDAY" | "GOOD_FRIDAY" | "HOLY_SATURDAY" | "DIVINE_MERCY_SUNDAY" | "ASCENSION" | "PENTECOST" | "TRINITY_SUNDAY" | "CORPUS_CHRISTI" | "SACRED_HEART" | "IMMACULATE_HEART";
24
+ /**
25
+ * Fixed date solemnities - same date every year
26
+ */
27
+ type FixedSolemnityKey = "MARY_MOTHER_OF_GOD" | "EPIPHANY" | "PRESENTATION" | "SAINT_JOSEPH" | "ANNUNCIATION" | "NATIVITY_OF_JOHN_BAPTIST" | "PETER_AND_PAUL" | "TRANSFIGURATION" | "ASSUMPTION" | "EXALTATION_OF_CROSS" | "ALL_SAINTS" | "ALL_SOULS" | "IMMACULATE_CONCEPTION" | "CHRISTMAS" | "HOLY_INNOCENTS" | "HOLY_FAMILY";
28
+ /**
29
+ * Computed dates - calculated based on formulas (e.g., Advent Sundays)
30
+ */
31
+ type ComputedKey = "ADVENT_1" | "ADVENT_2" | "ADVENT_3" | "ADVENT_4" | "BAPTISM_OF_LORD" | "CHRIST_THE_KING";
32
+ /**
33
+ * Memorial saints - fixed date memorials and feasts of saints
34
+ */
35
+ type MemorialSaintKey = "BASIL_GREGORY" | "ANTHONY_ABBOT" | "AGNES" | "FRANCIS_DE_SALES" | "TIMOTHY_TITUS" | "THOMAS_AQUINAS" | "JOHN_BOSCO" | "AGATHA" | "PAUL_MIKI" | "SCHOLASTICA" | "OUR_LADY_OF_LOURDES" | "CYRIL_METHODIUS" | "POLYCARP" | "PERPETUA_FELICITY" | "PATRICK" | "CYRIL_OF_JERUSALEM" | "MARTIN_I" | "ANSELM" | "GEORGE" | "ADALBERT" | "FIDELIS" | "LOUIS_GRIGNION" | "PETER_CHANEL" | "CATHERINE_OF_SIENA" | "PIUS_V" | "JOSEPH_WORKER" | "ATHANASIUS" | "NEREUS_ACHILLEUS" | "PANCRAS" | "OUR_LADY_OF_FATIMA" | "JOHN_I" | "BERNARDINE" | "PHILIP_NERI" | "AUGUSTINE_OF_CANTERBURY" | "JUSTIN" | "MARCELLINUS_PETER" | "CHARLES_LWANGA" | "BONIFACE" | "NORBERT" | "EPHREM" | "BARNABAS" | "ROMUALD" | "JOHN_FISHER_THOMAS_MORE" | "FIRST_MARTYRS_OF_ROME" | "THOMAS_APOSTLE" | "ELIZABETH_OF_PORTUGAL" | "MARIA_GORETTI" | "AUGUSTINE_ZHAO" | "BENEDICT" | "HENRY" | "CAMILLUS" | "BONAVENTURE" | "OUR_LADY_OF_MOUNT_CARMEL" | "APOLLINARIS" | "LAWRENCE_OF_BRINDISI" | "MARY_MAGDALENE" | "BRIDGET" | "SHARBEL" | "JAMES_APOSTLE" | "MARTHA" | "PETER_CHRYSOLOGUS" | "IGNATIUS_OF_LOYOLA" | "ALPHONSUS" | "JOHN_VIANNEY" | "DEDICATION_MARY_MAJOR" | "SIXTUS_II" | "CAJETAN" | "DOMINIC" | "LAWRENCE" | "CLARE" | "JANE_FRANCES" | "PONTIAN_HIPPOLYTUS" | "MAXIMILIAN_KOLBE" | "JOHN_EUDES" | "BERNARD" | "PIUS_X" | "QUEENSHIP_OF_MARY" | "BARTHOLOMEW" | "LOUIS_IX" | "JOSEPH_CALASANZ" | "MONICA" | "AUGUSTINE" | "PASSION_OF_JOHN_BAPTIST" | "GREGORY_THE_GREAT" | "BIRTH_OF_MARY" | "PETER_CLAVER" | "MOST_HOLY_NAME_OF_MARY" | "OUR_LADY_OF_SORROWS" | "CORNELIUS_CYPRIAN" | "ROBERT_BELLARMINE" | "JANUARIUS" | "MATTHEW" | "PADRE_PIO" | "COSMAS_DAMIAN" | "WENCESLAUS" | "LAWRENCE_RUIZ" | "ARCHANGELS" | "JEROME" | "THERESE_OF_LISIEUX" | "GUARDIAN_ANGELS" | "FRANCIS_OF_ASSISI" | "FAUSTINA" | "BRUNO" | "OUR_LADY_OF_ROSARY" | "DENIS" | "CALLISTUS_I" | "TERESA_OF_AVILA" | "HEDWIG" | "MARGARET_MARY" | "IGNATIUS_OF_ANTIOCH" | "LUKE" | "ISAAC_JOGUES" | "PAUL_OF_CROSS" | "JOHN_PAUL_II" | "JOHN_OF_CAPISTRANO" | "ANTHONY_MARY_CLARET" | "SIMON_JUDE" | "DEDICATION_LATERAN" | "LEO_THE_GREAT" | "MARTIN_OF_TOURS" | "JOSAPHAT" | "MARGARET_OF_SCOTLAND" | "GERTRUDE" | "ELIZABETH_OF_HUNGARY" | "DEDICATION_PETER_PAUL" | "PRESENTATION_OF_MARY" | "CLEMENT_I" | "COLUMBAN" | "CATHERINE_OF_ALEXANDRIA" | "ANDREW_APOSTLE" | "FRANCIS_XAVIER" | "LUCY" | "STEPHEN_FIRST_MARTYR" | "JOHN_APOSTLE";
36
+ /**
37
+ * All liturgical event keys combined
38
+ */
39
+ type MassKey = EasterCycleKey | FixedSolemnityKey | ComputedKey | MemorialSaintKey;
40
+ /**
41
+ * Array of all Easter cycle keys for iteration
42
+ */
43
+ declare const EASTER_CYCLE_KEYS: EasterCycleKey[];
44
+ /**
45
+ * Array of all fixed solemnity keys for iteration
46
+ */
47
+ declare const FIXED_SOLEMNITY_KEYS: FixedSolemnityKey[];
48
+ /**
49
+ * Array of all computed keys for iteration
50
+ */
51
+ declare const COMPUTED_KEYS: ComputedKey[];
52
+ /**
53
+ * Array of all memorial saint keys for iteration
54
+ */
55
+ declare const MEMORIAL_SAINT_KEYS: MemorialSaintKey[];
56
+ /**
57
+ * Array of all mass keys for iteration
58
+ */
59
+ declare const ALL_MASS_KEYS: MassKey[];
60
+ /**
61
+ * MassKeys constant object for enum-like usage.
62
+ * Use this to reference keys in title formatters and translations.
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * import { MassKeys } from "calendaryjs-plugin-liturgical";
67
+ *
68
+ * const titles = {
69
+ * [MassKeys.CHRISTMAS]: "Christmas",
70
+ * [MassKeys.EASTER_SUNDAY]: "Easter Sunday",
71
+ * };
72
+ *
73
+ * // With titleFormatter
74
+ * generateLiturgicalEvents({
75
+ * range: { from: "2025-01-01", to: "2025-12-31" },
76
+ * titleFormatter: ({ key }) => titles[key] ?? key,
77
+ * });
78
+ * ```
79
+ */
80
+ declare const MassKeys: {
81
+ readonly EASTER_SUNDAY: "EASTER_SUNDAY";
82
+ readonly ASH_WEDNESDAY: "ASH_WEDNESDAY";
83
+ readonly PALM_SUNDAY: "PALM_SUNDAY";
84
+ readonly HOLY_THURSDAY: "HOLY_THURSDAY";
85
+ readonly GOOD_FRIDAY: "GOOD_FRIDAY";
86
+ readonly HOLY_SATURDAY: "HOLY_SATURDAY";
87
+ readonly DIVINE_MERCY_SUNDAY: "DIVINE_MERCY_SUNDAY";
88
+ readonly ASCENSION: "ASCENSION";
89
+ readonly PENTECOST: "PENTECOST";
90
+ readonly TRINITY_SUNDAY: "TRINITY_SUNDAY";
91
+ readonly CORPUS_CHRISTI: "CORPUS_CHRISTI";
92
+ readonly SACRED_HEART: "SACRED_HEART";
93
+ readonly IMMACULATE_HEART: "IMMACULATE_HEART";
94
+ readonly MARY_MOTHER_OF_GOD: "MARY_MOTHER_OF_GOD";
95
+ readonly EPIPHANY: "EPIPHANY";
96
+ readonly PRESENTATION: "PRESENTATION";
97
+ readonly SAINT_JOSEPH: "SAINT_JOSEPH";
98
+ readonly ANNUNCIATION: "ANNUNCIATION";
99
+ readonly NATIVITY_OF_JOHN_BAPTIST: "NATIVITY_OF_JOHN_BAPTIST";
100
+ readonly PETER_AND_PAUL: "PETER_AND_PAUL";
101
+ readonly TRANSFIGURATION: "TRANSFIGURATION";
102
+ readonly ASSUMPTION: "ASSUMPTION";
103
+ readonly EXALTATION_OF_CROSS: "EXALTATION_OF_CROSS";
104
+ readonly ALL_SAINTS: "ALL_SAINTS";
105
+ readonly ALL_SOULS: "ALL_SOULS";
106
+ readonly IMMACULATE_CONCEPTION: "IMMACULATE_CONCEPTION";
107
+ readonly CHRISTMAS: "CHRISTMAS";
108
+ readonly HOLY_INNOCENTS: "HOLY_INNOCENTS";
109
+ readonly HOLY_FAMILY: "HOLY_FAMILY";
110
+ readonly ADVENT_1: "ADVENT_1";
111
+ readonly ADVENT_2: "ADVENT_2";
112
+ readonly ADVENT_3: "ADVENT_3";
113
+ readonly ADVENT_4: "ADVENT_4";
114
+ readonly BAPTISM_OF_LORD: "BAPTISM_OF_LORD";
115
+ readonly CHRIST_THE_KING: "CHRIST_THE_KING";
116
+ readonly BASIL_GREGORY: "BASIL_GREGORY";
117
+ readonly ANTHONY_ABBOT: "ANTHONY_ABBOT";
118
+ readonly AGNES: "AGNES";
119
+ readonly FRANCIS_DE_SALES: "FRANCIS_DE_SALES";
120
+ readonly TIMOTHY_TITUS: "TIMOTHY_TITUS";
121
+ readonly THOMAS_AQUINAS: "THOMAS_AQUINAS";
122
+ readonly JOHN_BOSCO: "JOHN_BOSCO";
123
+ readonly AGATHA: "AGATHA";
124
+ readonly PAUL_MIKI: "PAUL_MIKI";
125
+ readonly SCHOLASTICA: "SCHOLASTICA";
126
+ readonly OUR_LADY_OF_LOURDES: "OUR_LADY_OF_LOURDES";
127
+ readonly CYRIL_METHODIUS: "CYRIL_METHODIUS";
128
+ readonly POLYCARP: "POLYCARP";
129
+ readonly PERPETUA_FELICITY: "PERPETUA_FELICITY";
130
+ readonly PATRICK: "PATRICK";
131
+ readonly CYRIL_OF_JERUSALEM: "CYRIL_OF_JERUSALEM";
132
+ readonly MARTIN_I: "MARTIN_I";
133
+ readonly ANSELM: "ANSELM";
134
+ readonly GEORGE: "GEORGE";
135
+ readonly ADALBERT: "ADALBERT";
136
+ readonly FIDELIS: "FIDELIS";
137
+ readonly LOUIS_GRIGNION: "LOUIS_GRIGNION";
138
+ readonly PETER_CHANEL: "PETER_CHANEL";
139
+ readonly CATHERINE_OF_SIENA: "CATHERINE_OF_SIENA";
140
+ readonly PIUS_V: "PIUS_V";
141
+ readonly JOSEPH_WORKER: "JOSEPH_WORKER";
142
+ readonly ATHANASIUS: "ATHANASIUS";
143
+ readonly NEREUS_ACHILLEUS: "NEREUS_ACHILLEUS";
144
+ readonly PANCRAS: "PANCRAS";
145
+ readonly OUR_LADY_OF_FATIMA: "OUR_LADY_OF_FATIMA";
146
+ readonly JOHN_I: "JOHN_I";
147
+ readonly BERNARDINE: "BERNARDINE";
148
+ readonly PHILIP_NERI: "PHILIP_NERI";
149
+ readonly AUGUSTINE_OF_CANTERBURY: "AUGUSTINE_OF_CANTERBURY";
150
+ readonly JUSTIN: "JUSTIN";
151
+ readonly MARCELLINUS_PETER: "MARCELLINUS_PETER";
152
+ readonly CHARLES_LWANGA: "CHARLES_LWANGA";
153
+ readonly BONIFACE: "BONIFACE";
154
+ readonly NORBERT: "NORBERT";
155
+ readonly EPHREM: "EPHREM";
156
+ readonly BARNABAS: "BARNABAS";
157
+ readonly ROMUALD: "ROMUALD";
158
+ readonly JOHN_FISHER_THOMAS_MORE: "JOHN_FISHER_THOMAS_MORE";
159
+ readonly FIRST_MARTYRS_OF_ROME: "FIRST_MARTYRS_OF_ROME";
160
+ readonly THOMAS_APOSTLE: "THOMAS_APOSTLE";
161
+ readonly ELIZABETH_OF_PORTUGAL: "ELIZABETH_OF_PORTUGAL";
162
+ readonly MARIA_GORETTI: "MARIA_GORETTI";
163
+ readonly AUGUSTINE_ZHAO: "AUGUSTINE_ZHAO";
164
+ readonly BENEDICT: "BENEDICT";
165
+ readonly HENRY: "HENRY";
166
+ readonly CAMILLUS: "CAMILLUS";
167
+ readonly BONAVENTURE: "BONAVENTURE";
168
+ readonly OUR_LADY_OF_MOUNT_CARMEL: "OUR_LADY_OF_MOUNT_CARMEL";
169
+ readonly APOLLINARIS: "APOLLINARIS";
170
+ readonly LAWRENCE_OF_BRINDISI: "LAWRENCE_OF_BRINDISI";
171
+ readonly MARY_MAGDALENE: "MARY_MAGDALENE";
172
+ readonly BRIDGET: "BRIDGET";
173
+ readonly SHARBEL: "SHARBEL";
174
+ readonly JAMES_APOSTLE: "JAMES_APOSTLE";
175
+ readonly MARTHA: "MARTHA";
176
+ readonly PETER_CHRYSOLOGUS: "PETER_CHRYSOLOGUS";
177
+ readonly IGNATIUS_OF_LOYOLA: "IGNATIUS_OF_LOYOLA";
178
+ readonly ALPHONSUS: "ALPHONSUS";
179
+ readonly JOHN_VIANNEY: "JOHN_VIANNEY";
180
+ readonly DEDICATION_MARY_MAJOR: "DEDICATION_MARY_MAJOR";
181
+ readonly SIXTUS_II: "SIXTUS_II";
182
+ readonly CAJETAN: "CAJETAN";
183
+ readonly DOMINIC: "DOMINIC";
184
+ readonly LAWRENCE: "LAWRENCE";
185
+ readonly CLARE: "CLARE";
186
+ readonly JANE_FRANCES: "JANE_FRANCES";
187
+ readonly PONTIAN_HIPPOLYTUS: "PONTIAN_HIPPOLYTUS";
188
+ readonly MAXIMILIAN_KOLBE: "MAXIMILIAN_KOLBE";
189
+ readonly JOHN_EUDES: "JOHN_EUDES";
190
+ readonly BERNARD: "BERNARD";
191
+ readonly PIUS_X: "PIUS_X";
192
+ readonly QUEENSHIP_OF_MARY: "QUEENSHIP_OF_MARY";
193
+ readonly BARTHOLOMEW: "BARTHOLOMEW";
194
+ readonly LOUIS_IX: "LOUIS_IX";
195
+ readonly JOSEPH_CALASANZ: "JOSEPH_CALASANZ";
196
+ readonly MONICA: "MONICA";
197
+ readonly AUGUSTINE: "AUGUSTINE";
198
+ readonly PASSION_OF_JOHN_BAPTIST: "PASSION_OF_JOHN_BAPTIST";
199
+ readonly GREGORY_THE_GREAT: "GREGORY_THE_GREAT";
200
+ readonly BIRTH_OF_MARY: "BIRTH_OF_MARY";
201
+ readonly PETER_CLAVER: "PETER_CLAVER";
202
+ readonly MOST_HOLY_NAME_OF_MARY: "MOST_HOLY_NAME_OF_MARY";
203
+ readonly OUR_LADY_OF_SORROWS: "OUR_LADY_OF_SORROWS";
204
+ readonly CORNELIUS_CYPRIAN: "CORNELIUS_CYPRIAN";
205
+ readonly ROBERT_BELLARMINE: "ROBERT_BELLARMINE";
206
+ readonly JANUARIUS: "JANUARIUS";
207
+ readonly MATTHEW: "MATTHEW";
208
+ readonly PADRE_PIO: "PADRE_PIO";
209
+ readonly COSMAS_DAMIAN: "COSMAS_DAMIAN";
210
+ readonly WENCESLAUS: "WENCESLAUS";
211
+ readonly LAWRENCE_RUIZ: "LAWRENCE_RUIZ";
212
+ readonly ARCHANGELS: "ARCHANGELS";
213
+ readonly JEROME: "JEROME";
214
+ readonly THERESE_OF_LISIEUX: "THERESE_OF_LISIEUX";
215
+ readonly GUARDIAN_ANGELS: "GUARDIAN_ANGELS";
216
+ readonly FRANCIS_OF_ASSISI: "FRANCIS_OF_ASSISI";
217
+ readonly FAUSTINA: "FAUSTINA";
218
+ readonly BRUNO: "BRUNO";
219
+ readonly OUR_LADY_OF_ROSARY: "OUR_LADY_OF_ROSARY";
220
+ readonly DENIS: "DENIS";
221
+ readonly CALLISTUS_I: "CALLISTUS_I";
222
+ readonly TERESA_OF_AVILA: "TERESA_OF_AVILA";
223
+ readonly HEDWIG: "HEDWIG";
224
+ readonly MARGARET_MARY: "MARGARET_MARY";
225
+ readonly IGNATIUS_OF_ANTIOCH: "IGNATIUS_OF_ANTIOCH";
226
+ readonly LUKE: "LUKE";
227
+ readonly ISAAC_JOGUES: "ISAAC_JOGUES";
228
+ readonly PAUL_OF_CROSS: "PAUL_OF_CROSS";
229
+ readonly JOHN_PAUL_II: "JOHN_PAUL_II";
230
+ readonly JOHN_OF_CAPISTRANO: "JOHN_OF_CAPISTRANO";
231
+ readonly ANTHONY_MARY_CLARET: "ANTHONY_MARY_CLARET";
232
+ readonly SIMON_JUDE: "SIMON_JUDE";
233
+ readonly DEDICATION_LATERAN: "DEDICATION_LATERAN";
234
+ readonly LEO_THE_GREAT: "LEO_THE_GREAT";
235
+ readonly MARTIN_OF_TOURS: "MARTIN_OF_TOURS";
236
+ readonly JOSAPHAT: "JOSAPHAT";
237
+ readonly MARGARET_OF_SCOTLAND: "MARGARET_OF_SCOTLAND";
238
+ readonly GERTRUDE: "GERTRUDE";
239
+ readonly ELIZABETH_OF_HUNGARY: "ELIZABETH_OF_HUNGARY";
240
+ readonly DEDICATION_PETER_PAUL: "DEDICATION_PETER_PAUL";
241
+ readonly PRESENTATION_OF_MARY: "PRESENTATION_OF_MARY";
242
+ readonly CLEMENT_I: "CLEMENT_I";
243
+ readonly COLUMBAN: "COLUMBAN";
244
+ readonly CATHERINE_OF_ALEXANDRIA: "CATHERINE_OF_ALEXANDRIA";
245
+ readonly ANDREW_APOSTLE: "ANDREW_APOSTLE";
246
+ readonly FRANCIS_XAVIER: "FRANCIS_XAVIER";
247
+ readonly LUCY: "LUCY";
248
+ readonly STEPHEN_FIRST_MARTYR: "STEPHEN_FIRST_MARTYR";
249
+ readonly JOHN_APOSTLE: "JOHN_APOSTLE";
250
+ };
251
+
252
+ /**
253
+ * Module augmentation for CalendarDay.
254
+ * When this plugin is imported, TypeScript will recognize the optional `liturgical` property
255
+ * on CalendarDay objects returned by getDays() and getDay().
256
+ */
257
+ declare module "calendaryjs" {
258
+ interface CalendarDay {
259
+ /**
260
+ * Liturgical information (available when liturgical plugin is used with enrichDays: true)
261
+ */
262
+ liturgical?: LiturgicalInfo;
263
+ }
264
+ }
265
+ /**
266
+ * Event category for filtering
267
+ */
268
+ type EventCategory = "easter-cycle" | "solemnities" | "feasts" | "memorials" | "computed" | "daily";
269
+ /**
270
+ * Liturgical season in the Roman Catholic Church (Roman Rite).
271
+ *
272
+ * The liturgical year consists of five seasons.
273
+ * Ordinary Time is a single season, divided here into two periods
274
+ * for calculation and representation purposes.
275
+ *
276
+ * - `advent`: From the First Sunday of Advent until before the Christmas Vigil
277
+ * - `christmas`: From the Christmas Vigil through the Baptism of the Lord
278
+ * - `ordinary-time-1`: From after the Baptism of the Lord until before Ash Wednesday
279
+ * - `lent`: From Ash Wednesday until before the Mass of the Lord's Supper
280
+ * - `easter`: From the Easter Vigil through Pentecost
281
+ * - `ordinary-time-2`: From after Pentecost until before the First Sunday of Advent
282
+ */
283
+ type LiturgicalSeason = "advent" | "christmas" | "ordinary-time-1" | "lent" | "easter" | "ordinary-time-2";
284
+ /**
285
+ * Liturgical rank indicating the importance of a celebration.
286
+ *
287
+ * Ranks in descending order of importance:
288
+ * - `solemnity`: Highest rank (e.g., Easter, Christmas, major feasts)
289
+ * - `feast`: Significant celebrations of saints or mysteries
290
+ * - `memorial`: Remembrance of saints (can be obligatory or optional)
291
+ * - `ordinary`: Regular weekday celebrations with no special observance
292
+ */
293
+ type LiturgicalRank = "solemnity" | "feast" | "memorial" | "ordinary";
294
+ /**
295
+ * Liturgical vestment color used during Mass and other celebrations.
296
+ *
297
+ * Each color has specific symbolic meanings:
298
+ * - `white`: Joy, purity, glory (Christmas, Easter, celebrations of Christ, Mary, saints who were not martyrs)
299
+ * - `green`: Hope, growth (Ordinary Time)
300
+ * - `red`: Fire of the Holy Spirit, blood of martyrs (Pentecost, Palm Sunday, Good Friday, martyrs' feasts)
301
+ * - `violet`: Penance, preparation (Advent, Lent)
302
+ * - `rose`: Joyful anticipation (optional for Gaudete Sunday in Advent and Laetare Sunday in Lent)
303
+ */
304
+ type VestmentColor = "white" | "green" | "red" | "violet" | "rose";
305
+ /**
306
+ * Metadata specific to liturgical events.
307
+ */
308
+ type LiturgicalMetadata<TExtra extends Record<string, unknown> = Record<string, unknown>> = TExtra & {
309
+ season: LiturgicalSeason;
310
+ rank: LiturgicalRank;
311
+ vestmentColor: VestmentColor;
312
+ };
313
+ /**
314
+ * Base properties for liturgical events with typed metadata.
315
+ *
316
+ * This ensures that all liturgical events always have `LiturgicalMetadata`
317
+ * plus any additional, custom metadata provided by the caller.
318
+ *
319
+ * @template TExtra - Additional metadata fields to merge with LiturgicalMetadata
320
+ *
321
+ * @example
322
+ * type LocalizedMetadata = {
323
+ * localName: string;
324
+ * localDescription?: string;
325
+ * };
326
+ *
327
+ * type LocalizedLiturgicalEvent = LiturgicalEventProperties<LocalizedMetadata>;
328
+ * // metadata: LiturgicalMetadata & LocalizedMetadata (and is required)
329
+ */
330
+ interface LiturgicalEventProperties<TExtra extends Record<string, unknown> = Record<string, unknown>> extends Omit<BaseEventProperties<LiturgicalMetadata<TExtra>, EventCategory>, "metadata"> {
331
+ metadata: LiturgicalMetadata<TExtra>;
332
+ }
333
+ /**
334
+ * Easter event configuration.
335
+ *
336
+ * Uses the same metadata merging rules as LiturgicalEventProperties:
337
+ * metadata is required and is `LiturgicalMetadata & TExtra`.
338
+ */
339
+ interface EasterEvent<TExtra extends Record<string, unknown> = Record<string, unknown>> extends LiturgicalEventProperties<TExtra> {
340
+ type: "easter";
341
+ }
342
+ /**
343
+ * Offset event configuration (relative to another event).
344
+ *
345
+ * Uses the same metadata merging rules as LiturgicalEventProperties:
346
+ * metadata is required and is `LiturgicalMetadata & TExtra`.
347
+ */
348
+ interface OffsetEvent<TExtra extends Record<string, unknown> = Record<string, unknown>> extends LiturgicalEventProperties<TExtra> {
349
+ type: "offset";
350
+ baseEvent: string;
351
+ offsetDays: number;
352
+ }
353
+ /**
354
+ * Liturgical event config - any event type with required LiturgicalMetadata.
355
+ * Use this for type-safe liturgical event definitions.
356
+ *
357
+ * @template TExtra - Additional metadata fields to merge with LiturgicalMetadata
358
+ *
359
+ * @example
360
+ * ```typescript
361
+ * // Basic liturgical event
362
+ * const event: LiturgicalEventConfig = {
363
+ * type: "const",
364
+ * id: "christmas",
365
+ * month: 12,
366
+ * day: 25,
367
+ * title: "Christmas",
368
+ * metadata: { season: "christmas", rank: "solemnity", vestmentColor: "white" },
369
+ * };
370
+ * ```
371
+ */
372
+ type LiturgicalEventConfig<TExtra extends Record<string, unknown> = Record<string, unknown>> = EventConfig<LiturgicalMetadata<TExtra>, EventCategory>;
373
+ /**
374
+ * Custom event configuration for liturgical events.
375
+ * Re-exported from core with TExtra for additional metadata fields.
376
+ *
377
+ * @template TExtra - Additional metadata fields to merge with LiturgicalMetadata
378
+ */
379
+ type CustomLiturgicalEventConfig<TExtra extends Record<string, unknown> = Record<string, unknown>> = CustomEventConfig<LiturgicalMetadata<TExtra>, EventCategory>;
380
+ /**
381
+ * Resolver function for liturgical events.
382
+ * Specialized version of core CustomEventResolver with MassKey.
383
+ *
384
+ * @template TExtra - Additional metadata fields to merge with LiturgicalMetadata
385
+ */
386
+ type CustomLiturgicalEventResolver<TExtra extends Record<string, unknown> = Record<string, unknown>, TExclude extends keyof LiturgicalEventProperties<TExtra> = never> = CustomEventResolver<MassKey, LiturgicalMetadata<TExtra>, EventCategory, TExclude>;
387
+
388
+ /**
389
+ * Options for the liturgical plugin
390
+ */
391
+ interface LiturgicalPluginOptions {
392
+ /**
393
+ * Whether Epiphany is celebrated on Sunday (between January 2-8) or fixed January 6
394
+ * @default false (January 6)
395
+ */
396
+ epiphanyOnSunday?: boolean;
397
+ /**
398
+ * Whether to enrich days with liturgical information (season, vestmentColor, etc.)
399
+ * When true, getDays() will return LiturgicalDay objects instead of CalendarDay
400
+ * @default true
401
+ */
402
+ enrichDays?: boolean;
403
+ }
404
+ /**
405
+ * Liturgical info added by liturgical plugin
406
+ */
407
+ interface LiturgicalInfo {
408
+ season: LiturgicalSeason;
409
+ week: number;
410
+ rank: LiturgicalRank;
411
+ vestmentColor: VestmentColor;
412
+ }
413
+ /**
414
+ * CalendarDay with liturgical enrichment
415
+ */
416
+ interface CalendarDayWithLiturgical extends CalendarDay {
417
+ liturgical: LiturgicalInfo;
418
+ }
419
+ /**
420
+ * Liturgical calendar plugin for Calendary.
421
+ *
422
+ * This is a minimal plugin that provides:
423
+ * - Event types: `easter`, `offset`
424
+ * - Formulas: `advent-1`, `advent-2`, `advent-3`, `advent-4`, `baptism-of-lord`, `christ-the-king`
425
+ *
426
+ * For event generation utilities, use `generateLiturgicalEvents` (exported from this package).
427
+ *
428
+ * @param options - Plugin configuration options
429
+ * @returns CalendaryPlugin instance
430
+ *
431
+ * @example
432
+ * ```typescript
433
+ * // Basic usage - register event types and formulas
434
+ * const cal = calendary();
435
+ * cal.use(liturgical());
436
+ *
437
+ * // Now you can use easter and offset event types
438
+ * cal.addGroup({
439
+ * id: 'my-liturgical',
440
+ * name: 'My Liturgical Events',
441
+ * events: [
442
+ * { type: 'easter', id: 'easter', title: 'Easter Sunday', metadata: {...} },
443
+ * { type: 'offset', id: 'pentecost', title: 'Pentecost', baseEvent: 'easter', offsetDays: 49, metadata: {...} },
444
+ * ],
445
+ * });
446
+ *
447
+ * // For auto-generation (same package):
448
+ * // import { generateLiturgicalEvents } from 'calendaryjs-plugin-liturgical';
449
+ * // const { id, name, events } = generateLiturgicalEvents({ range: { from: '2025-01-01', to: '2025-12-31' } });
450
+ * // cal.addGroup({ id, name, events });
451
+ * ```
452
+ */
453
+ declare function liturgical(options?: LiturgicalPluginOptions): CalendaryPlugin;
454
+
455
+ /**
456
+ * Calculate Easter Sunday using the Anonymous Gregorian algorithm (Computus)
457
+ * This is the algorithm used by Western Christianity
458
+ *
459
+ * @param year - The year to calculate Easter for
460
+ * @returns Date object for Easter Sunday
461
+ */
462
+ declare function computeEaster(year: number): Date;
463
+ /**
464
+ * Calculate Orthodox Easter using the Julian calendar algorithm
465
+ * Then convert to Gregorian calendar
466
+ *
467
+ * @param year - The year to calculate Orthodox Easter for
468
+ * @returns Date object for Orthodox Easter Sunday
469
+ */
470
+ declare function computeOrthodoxEaster(year: number): Date;
471
+ /**
472
+ * Get Easter date as ISO string
473
+ */
474
+ declare function getEasterDateString(year: number): string;
475
+ /**
476
+ * Solar date `offsetDays` from Easter Sunday in `year`.
477
+ *
478
+ * Convenience resolver for movable Easter-cycle feasts: offset 0 = Easter,
479
+ * negative = Lent / Holy Week (e.g. -46 = Ash Wednesday), positive = Eastertide
480
+ * (e.g. +49 = Pentecost). Consumers declare only the offset; the Easter computus
481
+ * stays here in the plugin.
482
+ *
483
+ * @param year - Gregorian year
484
+ * @param offsetDays - days relative to Easter Sunday
485
+ * @returns Date object for the resolved day
486
+ */
487
+ declare function easterRelativeDate(year: number, offsetDays: number): Date;
488
+
489
+ /**
490
+ * Generator for EASTER events
491
+ */
492
+ declare const easterEventHandler: EventTypeHandler;
493
+
494
+ /**
495
+ * Generator for OFFSET events (relative to a base event)
496
+ */
497
+ declare const offsetEventHandler: EventTypeHandler;
498
+
499
+ /**
500
+ * Advent and Christmas season date calculations
501
+ */
502
+ /**
503
+ * Get the date of the First Sunday of Advent
504
+ * Advent begins on the fourth Sunday before Christmas
505
+ *
506
+ * @param year - The year to calculate for
507
+ * @returns Date of the First Sunday of Advent
508
+ */
509
+ declare function getAdvent1(year: number): Date;
510
+ /**
511
+ * Get the date of the Second Sunday of Advent
512
+ */
513
+ declare function getAdvent2(year: number): Date;
514
+ /**
515
+ * Get the date of the Third Sunday of Advent (Gaudete Sunday)
516
+ */
517
+ declare function getAdvent3(year: number): Date;
518
+ /**
519
+ * Get the date of the Fourth Sunday of Advent
520
+ */
521
+ declare function getAdvent4(year: number): Date;
522
+ /**
523
+ * Get the date of the Baptism of the Lord
524
+ * Usually the Sunday after Epiphany (January 6)
525
+ * If Epiphany falls on Sunday January 7 or 8, Baptism is the following Monday
526
+ *
527
+ * @param year - The year to calculate for
528
+ * @param epiphanyOnSunday - Whether Epiphany is celebrated on Sunday
529
+ * @returns Date of the Baptism of the Lord
530
+ */
531
+ declare function getBaptismOfLord(year: number, epiphanyOnSunday?: boolean): Date;
532
+ /**
533
+ * Get the date of Christ the King
534
+ * Last Sunday of the liturgical year (Sunday before Advent 1)
535
+ *
536
+ * @param year - The year to calculate for
537
+ * @returns Date of Christ the King
538
+ */
539
+ declare function getChristTheKing(year: number): Date;
540
+ /**
541
+ * Get the date of Holy Family
542
+ * Sunday after Christmas, or December 30 if no Sunday between Dec 25-31
543
+ *
544
+ * @param year - The year to calculate for
545
+ * @returns Date of Holy Family
546
+ */
547
+ declare function getHolyFamily(year: number): Date;
548
+
549
+ /**
550
+ * Internal definition for a liturgical event
551
+ */
552
+ interface LiturgicalEventDef {
553
+ /** Unique key for the event */
554
+ key: MassKey;
555
+ /** Event type for generation */
556
+ type: "easter" | "offset" | "const" | "nth-weekday" | "formula";
557
+ /** Category for filtering */
558
+ category: EventCategory;
559
+ /** Offset days from Easter (for offset type) */
560
+ offsetDays?: number;
561
+ /** Month (1-12) for const type */
562
+ month?: number;
563
+ /** Day (1-31) for const type */
564
+ day?: number;
565
+ /** Formula name for formula type */
566
+ formula?: string;
567
+ /** Day of week (0=Sun … 6=Sat) for nth-weekday type */
568
+ dayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
569
+ /** Nth occurrence (1-4 or -1 for last) for simple mode */
570
+ nth?: 1 | 2 | 3 | 4 | -1;
571
+ /** Simple-mode month (1-12) */
572
+ nthMonth?: number;
573
+ /** Anchored mode: first matching dayOfWeek on/after this fixed date */
574
+ after?: {
575
+ month: number;
576
+ day: number;
577
+ };
578
+ /** Anchored mode: upper bound (use fallback if match falls on/after this) */
579
+ before?: {
580
+ month: number;
581
+ day: number;
582
+ };
583
+ /** Anchored mode: fallback date when no match found before upper bound */
584
+ fallback?: {
585
+ month: number;
586
+ day: number;
587
+ };
588
+ /** Liturgical metadata */
589
+ metadata: LiturgicalMetadata;
590
+ }
591
+ /**
592
+ * Easter cycle events - dates relative to Easter Sunday
593
+ */
594
+ declare const EASTER_CYCLE_EVENTS: LiturgicalEventDef[];
595
+ /**
596
+ * Fixed date solemnities - same date every year
597
+ */
598
+ declare const FIXED_SOLEMNITY_EVENTS: LiturgicalEventDef[];
599
+ /**
600
+ * Computed date events - calculated based on formulas
601
+ */
602
+ declare const COMPUTED_EVENTS: LiturgicalEventDef[];
603
+ /**
604
+ * Memorial saints - fixed date memorials and feasts of saints
605
+ * Organized by month for easy maintenance
606
+ */
607
+ declare const MEMORIAL_SAINT_EVENTS: LiturgicalEventDef[];
608
+ /**
609
+ * All liturgical event definitions
610
+ */
611
+ declare const ALL_LITURGICAL_EVENTS: LiturgicalEventDef[];
612
+ /**
613
+ * Get events by category
614
+ */
615
+ declare function getEventsByCategory(categories: EventCategory[]): LiturgicalEventDef[];
616
+
617
+ /**
618
+ * Complete liturgical event texts mapping.
619
+ * All MassKey entries are required.
620
+ * Used for typing DEFAULT_LITURGICAL_TEXTS.
621
+ *
622
+ * @example
623
+ * ```typescript
624
+ * const enTexts: LiturgicalTexts = {
625
+ * EASTER_SUNDAY: { title: "Easter Sunday", keywords: ["easter"] },
626
+ * CHRISTMAS: { title: "Christmas", keywords: ["christmas", "nativity"] },
627
+ * // ... all keys required - TypeScript enforces completeness
628
+ * };
629
+ * ```
630
+ */
631
+ type LiturgicalTexts = Record<MassKey, EventText>;
632
+
633
+ /**
634
+ * Pre-defined liturgical events
635
+ */
636
+ declare const EASTER: EasterEvent;
637
+ declare const ASH_WEDNESDAY: OffsetEvent;
638
+ declare const PALM_SUNDAY: OffsetEvent;
639
+ declare const HOLY_THURSDAY: OffsetEvent;
640
+ declare const GOOD_FRIDAY: OffsetEvent;
641
+ declare const HOLY_SATURDAY: OffsetEvent;
642
+ declare const ASCENSION: OffsetEvent;
643
+ declare const PENTECOST: OffsetEvent;
644
+ declare const TRINITY_SUNDAY: OffsetEvent;
645
+ declare const CORPUS_CHRISTI: OffsetEvent;
646
+ /**
647
+ * All pre-defined liturgical events
648
+ */
649
+ declare const LITURGICAL_EVENTS: (EasterEvent<Record<string, unknown>> | OffsetEvent<Record<string, unknown>>)[];
650
+
651
+ /**
652
+ * Season information for a specific date
653
+ */
654
+ interface SeasonInfo {
655
+ /** Liturgical season */
656
+ season: LiturgicalSeason;
657
+ /** Primary vestment color for the season */
658
+ vestmentColor: VestmentColor;
659
+ /** Week number within the season (1-based) */
660
+ week: number;
661
+ /** Liturgical year this date belongs to */
662
+ liturgicalYear: number;
663
+ }
664
+ /**
665
+ * Season segment for chart visualization
666
+ */
667
+ interface SeasonSegment {
668
+ /** Liturgical season identifier */
669
+ season: LiturgicalSeason;
670
+ /** Vestment color */
671
+ vestmentColor: VestmentColor;
672
+ /** Start date (inclusive) in YYYY-MM-DD format */
673
+ startDate: string;
674
+ /** End date (inclusive) in YYYY-MM-DD format */
675
+ endDate: string;
676
+ /** Number of days in this segment */
677
+ days: number;
678
+ /** Start angle in degrees (0 = top, clockwise) for pie/donut charts */
679
+ startAngle: number;
680
+ /** End angle in degrees for pie/donut charts */
681
+ endAngle: number;
682
+ /** Percentage of the year this segment occupies */
683
+ percentage: number;
684
+ }
685
+ /**
686
+ * Complete liturgical year data for chart visualization
687
+ */
688
+ interface LiturgicalYearChart {
689
+ /** Liturgical year number */
690
+ liturgicalYear: number;
691
+ /** Calendar year the liturgical year starts in */
692
+ calendarYearStart: number;
693
+ /** Calendar year the liturgical year ends in */
694
+ calendarYearEnd: number;
695
+ /** Start date of the liturgical year (Advent 1) */
696
+ startDate: string;
697
+ /** End date of the liturgical year (Saturday before next Advent 1) */
698
+ endDate: string;
699
+ /** Total days in the liturgical year */
700
+ totalDays: number;
701
+ /** Season segments in chronological order */
702
+ segments: SeasonSegment[];
703
+ }
704
+ /**
705
+ * Options for getSeason function
706
+ */
707
+ interface GetSeasonOptions {
708
+ /** Whether Epiphany is celebrated on Sunday */
709
+ epiphanyOnSunday?: boolean;
710
+ }
711
+ /**
712
+ * Get the liturgical season for a specific date.
713
+ *
714
+ * @param date - Date to check (Date object or YYYY-MM-DD string)
715
+ * @param options - Configuration options
716
+ * @returns Season information
717
+ *
718
+ * @example
719
+ * ```typescript
720
+ * const season = getSeason("2024-12-25");
721
+ * // { season: "christmas", vestmentColor: "white", week: 1, liturgicalYear: 2025 }
722
+ *
723
+ * const today = getSeason(new Date());
724
+ * console.log(`Current season: ${today.season}`);
725
+ * ```
726
+ */
727
+ declare function getSeason(date: Date | string, options?: GetSeasonOptions): SeasonInfo;
728
+ /**
729
+ * Get the current liturgical season (today).
730
+ *
731
+ * @param options - Configuration options
732
+ * @returns Season information for today
733
+ *
734
+ * @example
735
+ * ```typescript
736
+ * const current = getCurrentSeason();
737
+ * console.log(`We are in ${current.season}, week ${current.week}`);
738
+ * ```
739
+ */
740
+ declare function getCurrentSeason(options?: GetSeasonOptions): SeasonInfo;
741
+ /**
742
+ * Options for getLiturgicalYearChart function
743
+ */
744
+ interface GetLiturgicalYearChartOptions {
745
+ /** Whether Epiphany is celebrated on Sunday */
746
+ epiphanyOnSunday?: boolean;
747
+ }
748
+ /**
749
+ * Get liturgical year data optimized for chart visualization.
750
+ *
751
+ * Returns season segments with:
752
+ * - Start/end dates
753
+ * - Number of days
754
+ * - Angles for pie/donut charts (0° = top, clockwise)
755
+ * - Percentages
756
+ * - Colors (both vestment and hex for visualization)
757
+ *
758
+ * @param liturgicalYear - The liturgical year (e.g., 2025)
759
+ * @param options - Configuration options
760
+ * @returns Chart data with season segments
761
+ *
762
+ * @example
763
+ * ```typescript
764
+ * const chart = getLiturgicalYearChart(2025);
765
+ *
766
+ * // Use with a charting library
767
+ * const pieData = chart.segments.map(s => ({
768
+ * label: s.season,
769
+ * value: s.percentage,
770
+ * color: s.vestmentColor,
771
+ * }));
772
+ *
773
+ * // Or for SVG arc rendering
774
+ * chart.segments.forEach(s => {
775
+ * drawArc(s.startAngle, s.endAngle, s.vestmentColor);
776
+ * });
777
+ * ```
778
+ */
779
+ declare function getLiturgicalYearChart(liturgicalYear: number, options?: GetLiturgicalYearChartOptions): LiturgicalYearChart;
780
+ /**
781
+ * Get all season segments for a calendar year (may span two liturgical years).
782
+ *
783
+ * Useful when you want to visualize a calendar year (Jan-Dec) instead of
784
+ * a liturgical year (Advent to Christ the King).
785
+ *
786
+ * @param calendarYear - The calendar year (e.g., 2024)
787
+ * @param options - Configuration options
788
+ * @returns Array of season segments covering the calendar year
789
+ *
790
+ * @example
791
+ * ```typescript
792
+ * const segments = getCalendarYearSeasons(2024);
793
+ * // Returns segments from Jan 1, 2024 to Dec 31, 2024
794
+ * // May include parts of two liturgical years
795
+ * ```
796
+ */
797
+ declare function getCalendarYearSeasons(calendarYear: number, options?: GetLiturgicalYearChartOptions): SeasonSegment[];
798
+
799
+ /**
800
+ * Liturgical day information for any date (used by getLiturgicalDay)
801
+ */
802
+ interface LiturgicalDay {
803
+ /** Date in YYYY-MM-DD format */
804
+ date: string;
805
+ /** Liturgical season */
806
+ season: LiturgicalSeason;
807
+ /** Week number within the season (1-based) */
808
+ week: number;
809
+ /** Day of week (0=Sunday, 1=Monday, etc.) */
810
+ dayOfWeek: number;
811
+ /** Liturgical rank */
812
+ rank: LiturgicalRank;
813
+ /** Vestment color */
814
+ vestmentColor: VestmentColor;
815
+ /** Whether this is a Sunday */
816
+ isSunday: boolean;
817
+ /** Whether this is a weekday (Monday-Saturday) */
818
+ isWeekday: boolean;
819
+ /** Full metadata */
820
+ metadata: LiturgicalMetadata;
821
+ }
822
+ /**
823
+ * Liturgical year boundaries
824
+ */
825
+ interface LiturgicalYearBoundaries {
826
+ /** First Sunday of Advent (start of liturgical year) */
827
+ advent1: Date;
828
+ /** Christmas Day */
829
+ christmas: Date;
830
+ /** Baptism of the Lord (end of Christmas season) */
831
+ baptismOfLord: Date;
832
+ /** Ash Wednesday (start of Lent) */
833
+ ashWednesday: Date;
834
+ /** Easter Sunday */
835
+ easter: Date;
836
+ /** Pentecost Sunday (end of Easter season) */
837
+ pentecost: Date;
838
+ /** Christ the King (last Sunday of liturgical year) */
839
+ christTheKing: Date;
840
+ }
841
+
842
+ /**
843
+ * Options for getLiturgicalDay
844
+ */
845
+ interface GetLiturgicalDayOptions {
846
+ /** Whether Epiphany is celebrated on Sunday */
847
+ epiphanyOnSunday?: boolean;
848
+ }
849
+ /**
850
+ * Get the liturgical day information for a specific date.
851
+ *
852
+ * @param date - Date to get liturgical info for (Date object or YYYY-MM-DD string)
853
+ * @param options - Configuration options
854
+ * @returns Liturgical day information
855
+ */
856
+ declare function getLiturgicalDay(date: Date | string, options?: GetLiturgicalDayOptions): LiturgicalDay;
857
+ /**
858
+ * Generate liturgical days for a date range.
859
+ *
860
+ * @param startDate - Start date (inclusive)
861
+ * @param endDate - End date (inclusive)
862
+ * @param options - Configuration options
863
+ * @returns Array of liturgical days
864
+ */
865
+ declare function getLiturgicalDaysInRange(startDate: Date | string, endDate: Date | string, options?: GetLiturgicalDayOptions): LiturgicalDay[];
866
+ /**
867
+ * Generate all liturgical days for a given month.
868
+ *
869
+ * @param year - Calendar year
870
+ * @param month - Month (1-12)
871
+ * @param options - Configuration options
872
+ * @returns Array of liturgical days for the month
873
+ */
874
+ declare function getLiturgicalDaysForMonth(year: number, month: number, options?: GetLiturgicalDayOptions): LiturgicalDay[];
875
+ /**
876
+ * Generate all liturgical days for a given year.
877
+ *
878
+ * @param year - Calendar year
879
+ * @param options - Configuration options
880
+ * @returns Array of liturgical days for the year
881
+ */
882
+ declare function getLiturgicalDaysForYear(year: number, options?: GetLiturgicalDayOptions): LiturgicalDay[];
883
+
884
+ /**
885
+ * Get the liturgical year for a given date.
886
+ * The liturgical year starts on the First Sunday of Advent.
887
+ *
888
+ * @param date - Date to check
889
+ * @returns The liturgical year number
890
+ */
891
+ declare function getLiturgicalYear(date: Date): number;
892
+ /**
893
+ * Calculate all liturgical year boundaries for a given liturgical year.
894
+ *
895
+ * @param liturgicalYear - The liturgical year (e.g., 2025 means Advent 2024 to Christ the King 2025)
896
+ * @param epiphanyOnSunday - Whether Epiphany is celebrated on Sunday
897
+ * @returns All key dates for the liturgical year
898
+ */
899
+ declare function getLiturgicalYearBoundaries(liturgicalYear: number, epiphanyOnSunday?: boolean): LiturgicalYearBoundaries;
900
+
901
+ /**
902
+ * Date range for event generation
903
+ */
904
+ interface DateRange {
905
+ from: DateString;
906
+ to: DateString;
907
+ }
908
+ /**
909
+ * Options for generating liturgical events
910
+ *
911
+ * Note: Major events (solemnities, feasts, memorials) are always generated.
912
+ * Days without events will have empty events[] - no filler "daily" events are created.
913
+ * Use getDays() to get full day information including season context.
914
+ */
915
+ interface GenerateLiturgicalEventsOptions<TExtra extends Record<string, unknown> = Record<string, unknown>> {
916
+ /**
917
+ * Date range for event generation.
918
+ * Format: { from: 'YYYY-MM-DD', to: 'YYYY-MM-DD' }
919
+ */
920
+ range: DateRange;
921
+ /**
922
+ * Whether Epiphany is celebrated on Sunday (between January 2-8) or fixed January 6
923
+ * @default false (January 6)
924
+ */
925
+ epiphanyOnSunday?: boolean;
926
+ /**
927
+ * Whether Ascension is on Sunday or Thursday (+39 days from Easter)
928
+ * @default false (Thursday)
929
+ */
930
+ ascensionOnSunday?: boolean;
931
+ /**
932
+ * Whether Corpus Christi is on Sunday or Thursday (+60 days from Easter)
933
+ * @default true (Sunday - most countries)
934
+ */
935
+ corpusChristiOnSunday?: boolean;
936
+ /**
937
+ * Filter which event categories to include for major events.
938
+ * @default ['easter-cycle', 'solemnities', 'feasts', 'memorials', 'computed']
939
+ */
940
+ includeCategories?: Array<"easter-cycle" | "solemnities" | "feasts" | "memorials" | "computed">;
941
+ /**
942
+ * Group ID for the generated events
943
+ * @default 'liturgical-calendar'
944
+ */
945
+ groupId?: string;
946
+ /**
947
+ * Custom event resolver - provides custom configuration for each event.
948
+ * Allows overriding any BaseEventProperties field (title, keywords, url, metadata, overrideDates, onConflict, etc.).
949
+ * Metadata from customization will be merged with the original event metadata.
950
+ *
951
+ * - Use `overrideDates` to force reschedule events to different dates unconditionally.
952
+ * - Use `onConflict` to handle date conflicts dynamically (drop, reschedule, or keep).
953
+ *
954
+ * @template TExtra - Additional metadata fields to merge with LiturgicalMetadata
955
+ *
956
+ * @example
957
+ * ```typescript
958
+ * // With custom metadata and date overrides
959
+ * interface LocalizedMetadata {
960
+ * localName: string;
961
+ * }
962
+ *
963
+ * generateLiturgicalEvents<LocalizedMetadata>({
964
+ * range: { from: "2025-01-01", to: "2026-12-31" },
965
+ * customResolver: (key) => ({
966
+ * title: localTexts[key]?.title,
967
+ * keywords: localTexts[key]?.keywords,
968
+ * metadata: { localName: localTexts[key]?.name },
969
+ *
970
+ * // Option 1: Force reschedule unconditionally
971
+ * overrideDates: key === "ASH_WEDNESDAY" ? {
972
+ * "2026-02-18": "2026-02-20",
973
+ * } : undefined,
974
+ *
975
+ * // Option 2: Handle conflicts dynamically
976
+ * onConflict: key === "SAINT_JOSEPH" ? (date) => {
977
+ * if (date === "2026-03-19") {
978
+ * return { action: "reschedule", to: "2026-03-20" };
979
+ * }
980
+ * return { action: "keep" };
981
+ * } : undefined,
982
+ * }),
983
+ * });
984
+ * ```
985
+ */
986
+ customResolver?: CustomLiturgicalEventResolver<TExtra>;
987
+ }
988
+ /**
989
+ * Result of generateLiturgicalEvents
990
+ *
991
+ * @template TExtra - Additional metadata fields merged with LiturgicalMetadata
992
+ */
993
+ interface GeneratedLiturgicalEvents<TExtra extends Record<string, unknown> = Record<string, unknown>> {
994
+ /** Group ID */
995
+ id: string;
996
+ /** Generated events with LiturgicalMetadata & TExtra */
997
+ events: LiturgicalEventConfig<TExtra>[];
998
+ }
999
+ /**
1000
+ * Options for creating a liturgical events generator
1001
+ *
1002
+ * @template TExtra - Additional metadata fields merged with LiturgicalMetadata
1003
+ */
1004
+ interface CreateGeneratorOptions<TExtra extends Record<string, unknown> = Record<string, unknown>> {
1005
+ /**
1006
+ * Default options for all generations
1007
+ */
1008
+ defaults?: Partial<GenerateLiturgicalEventsOptions<TExtra>>;
1009
+ }
1010
+
1011
+ /**
1012
+ * Generate liturgical events for a date range.
1013
+ *
1014
+ * Always generates major liturgical events (solemnities, feasts, memorials).
1015
+ * Days without events will have empty events[] - use getDays() for full day info.
1016
+ *
1017
+ * @param options - Generation options
1018
+ * @returns Generated events ready to be added to a Calendary group
1019
+ *
1020
+ * @example
1021
+ * ```typescript
1022
+ * const cal = calendary();
1023
+ * cal.use(liturgical());
1024
+ *
1025
+ * const { id, events } = generateLiturgicalEvents({
1026
+ * range: { from: "2025-01-01", to: "2025-12-31" },
1027
+ * });
1028
+ *
1029
+ * cal.addGroup({ id, events });
1030
+ *
1031
+ * // Get days with full context (season, lunar date, etc.)
1032
+ * const days = cal.getDays({ from: "2025-12-01", to: "2025-12-31" });
1033
+ * ```
1034
+ */
1035
+ declare function generateLiturgicalEvents<TExtra extends Record<string, unknown> = Record<string, unknown>>(options: GenerateLiturgicalEventsOptions<TExtra>): GeneratedLiturgicalEvents<TExtra>;
1036
+ /**
1037
+ * Create a liturgical events generator with preset options.
1038
+ * Useful when you want to reuse the same configuration.
1039
+ *
1040
+ * @param generatorOptions - Options for the generator
1041
+ * @returns A function that generates events with the preset options
1042
+ *
1043
+ * @example
1044
+ * ```typescript
1045
+ * const generate = createLiturgicalGenerator({
1046
+ * defaults: {
1047
+ * epiphanyOnSunday: true,
1048
+ * ascensionOnSunday: true,
1049
+ * },
1050
+ * });
1051
+ *
1052
+ * const events2025 = generate({ range: { from: "2025-01-01", to: "2025-12-31" } });
1053
+ * const events2026 = generate({ range: { from: "2026-01-01", to: "2026-12-31" } });
1054
+ * ```
1055
+ */
1056
+ declare function createLiturgicalGenerator<TExtra extends Record<string, unknown> = Record<string, unknown>>(generatorOptions?: CreateGeneratorOptions<TExtra>): (options: GenerateLiturgicalEventsOptions<TExtra>) => GeneratedLiturgicalEvents<TExtra>;
1057
+
1058
+ /**
1059
+ * Default English liturgical event texts.
1060
+ * Use as fallback or reference for creating custom translations.
1061
+ */
1062
+ declare const DEFAULT_LITURGICAL_TEXTS: LiturgicalTexts;
1063
+
1064
+ export { ALL_LITURGICAL_EVENTS, ALL_MASS_KEYS, ASCENSION, ASH_WEDNESDAY, COMPUTED_EVENTS, COMPUTED_KEYS, CORPUS_CHRISTI, type CalendarDayWithLiturgical, type ComputedKey, type CreateGeneratorOptions, type CustomLiturgicalEventConfig, type CustomLiturgicalEventResolver, DEFAULT_LITURGICAL_TEXTS, EASTER, EASTER_CYCLE_EVENTS, EASTER_CYCLE_KEYS, type EasterCycleKey, type EasterEvent, type EventCategory, FIXED_SOLEMNITY_EVENTS, FIXED_SOLEMNITY_KEYS, type FixedSolemnityKey, GOOD_FRIDAY, type GenerateLiturgicalEventsOptions, type GeneratedLiturgicalEvents, type GetLiturgicalDayOptions, type GetLiturgicalYearChartOptions, type GetSeasonOptions, HOLY_SATURDAY, HOLY_THURSDAY, LITURGICAL_EVENTS, type LiturgicalDay, type LiturgicalEventConfig, type LiturgicalEventDef, type LiturgicalEventProperties, type LiturgicalInfo, type LiturgicalMetadata, type LiturgicalPluginOptions, type LiturgicalRank, type LiturgicalSeason, type LiturgicalTexts, type LiturgicalYearBoundaries, type LiturgicalYearChart, MEMORIAL_SAINT_EVENTS, MEMORIAL_SAINT_KEYS, type MassKey, MassKeys, type MemorialSaintKey, type OffsetEvent, PALM_SUNDAY, PENTECOST, type SeasonInfo, type SeasonSegment, TRINITY_SUNDAY, type VestmentColor, computeEaster, computeOrthodoxEaster, createLiturgicalGenerator, easterEventHandler, easterRelativeDate, generateLiturgicalEvents, getAdvent1, getAdvent2, getAdvent3, getAdvent4, getBaptismOfLord, getCalendarYearSeasons, getChristTheKing, getCurrentSeason, getEasterDateString, getEventsByCategory, getHolyFamily, getLiturgicalDay, getLiturgicalDaysForMonth, getLiturgicalDaysForYear, getLiturgicalDaysInRange, getLiturgicalYear, getLiturgicalYearBoundaries, getLiturgicalYearChart, getSeason, liturgical, offsetEventHandler };