@synapxlab/ladder-timeline 0.0.1 → 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.
- package/dist/adapters/FullCalendarAdapter.d.ts +63 -0
- package/dist/adapters/FullCalendarAdapter.d.ts.map +1 -0
- package/dist/components/ladder-timeline/LadderTimeline.d.ts +148 -0
- package/dist/components/ladder-timeline/LadderTimeline.d.ts.map +1 -0
- package/dist/components/ladder-timeline/LadderTimeline.events.d.ts +14 -0
- package/dist/components/ladder-timeline/LadderTimeline.events.d.ts.map +1 -0
- package/dist/components/ladder-timeline/LadderTimeline.types.d.ts +116 -0
- package/dist/components/ladder-timeline/LadderTimeline.types.d.ts.map +1 -0
- package/dist/components/ladder-timeline/LadderTimeline.utils.d.ts +44 -0
- package/dist/components/ladder-timeline/LadderTimeline.utils.d.ts.map +1 -0
- package/dist/components/ladder-timeline/Scale.d.ts +53 -0
- package/dist/components/ladder-timeline/Scale.d.ts.map +1 -0
- package/dist/debug.d.ts +8 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/ladder-timeline.es.js +1033 -0
- package/dist/ladder-timeline.es.js.map +1 -0
- package/dist/ladder-timeline.umd.cjs +2 -0
- package/dist/ladder-timeline.umd.cjs.map +1 -0
- package/dist/main.d.ts +8 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FullCalendarAdapter
|
|
3
|
+
*
|
|
4
|
+
* Bridges LadderTimeline with a FullCalendar instance without creating
|
|
5
|
+
* a direct import dependency on FullCalendar inside the component.
|
|
6
|
+
*
|
|
7
|
+
* The component only depends on the `CalendarAdapter` interface:
|
|
8
|
+
* interface CalendarAdapter { gotoDate(date: Date): void; }
|
|
9
|
+
*
|
|
10
|
+
* Usage example (see also main.ts):
|
|
11
|
+
*
|
|
12
|
+
* import { Calendar } from '@fullcalendar/core';
|
|
13
|
+
* import { createFullCalendarAdapter, bindTimelineToCalendar } from './adapters/FullCalendarAdapter';
|
|
14
|
+
*
|
|
15
|
+
* const calendar = new Calendar(calendarEl, { ... });
|
|
16
|
+
* calendar.render();
|
|
17
|
+
*
|
|
18
|
+
* const timeline = new LadderTimeline({ container: timelineEl });
|
|
19
|
+
* timeline.connectAdapter(createFullCalendarAdapter(calendar));
|
|
20
|
+
*
|
|
21
|
+
* // Or use the convenience helper:
|
|
22
|
+
* const unbind = bindTimelineToCalendar(timeline, calendar);
|
|
23
|
+
*/
|
|
24
|
+
import type { CalendarAdapter } from '../components/ladder-timeline/LadderTimeline.types';
|
|
25
|
+
export interface FullCalendarInstance {
|
|
26
|
+
gotoDate(date: Date | string): void;
|
|
27
|
+
getDate(): Date;
|
|
28
|
+
setOption?(option: string, value: unknown): void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Wrap a FullCalendar instance in the CalendarAdapter interface.
|
|
32
|
+
* The adapter forwards `gotoDate` calls to FullCalendar.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createFullCalendarAdapter(calendar: FullCalendarInstance): CalendarAdapter;
|
|
35
|
+
export interface BindableTimeline {
|
|
36
|
+
connectAdapter(adapter: CalendarAdapter): void;
|
|
37
|
+
getEventTarget(): EventTarget;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Bind a LadderTimeline (class variant) to a FullCalendar instance bidirectionally.
|
|
41
|
+
*
|
|
42
|
+
* - When the user picks a week in the timeline → calendar.gotoDate() is called.
|
|
43
|
+
* - Returns an `unbind` function to clean up listeners.
|
|
44
|
+
*/
|
|
45
|
+
export declare function bindTimelineToCalendar(timeline: BindableTimeline, calendar: FullCalendarInstance): () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Bind a LadderTimelineEventTarget instance to a FullCalendar instance.
|
|
48
|
+
* Use this variant when using the EventTarget-based LadderTimeline.
|
|
49
|
+
*/
|
|
50
|
+
export declare function bindEventTargetTimelineToCalendar(timeline: EventTarget & {
|
|
51
|
+
connectAdapter(a: CalendarAdapter): void;
|
|
52
|
+
}, calendar: FullCalendarInstance): () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Bind a <ladder-timeline> Web Component to a FullCalendar instance.
|
|
55
|
+
*
|
|
56
|
+
* Example:
|
|
57
|
+
* const el = document.querySelector('ladder-timeline')!;
|
|
58
|
+
* bindWebComponentToCalendar(el, calendar);
|
|
59
|
+
*/
|
|
60
|
+
export declare function bindWebComponentToCalendar(el: HTMLElement & {
|
|
61
|
+
connectAdapter?(a: CalendarAdapter): void;
|
|
62
|
+
}, calendar: FullCalendarInstance): () => void;
|
|
63
|
+
//# sourceMappingURL=FullCalendarAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullCalendarAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/FullCalendarAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AAM1F,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAClD;AAID;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,eAAe,CAMzF;AAID,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/C,cAAc,IAAI,WAAW,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,oBAAoB,GAC7B,MAAM,IAAI,CAUZ;AAOD;;;GAGG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,WAAW,GAAG;IAAE,cAAc,CAAC,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;CAAE,EACpE,QAAQ,EAAE,oBAAoB,GAC7B,MAAM,IAAI,CAUZ;AAID;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,WAAW,GAAG;IAAE,cAAc,CAAC,CAAC,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;CAAE,EAC/D,QAAQ,EAAE,oBAAoB,GAC7B,MAAM,IAAI,CAUZ"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LadderTimeline — Carousel multi-échelles
|
|
3
|
+
*
|
|
4
|
+
* Cursor interne unifié = decimal year (float64). L'échelle active fournit
|
|
5
|
+
* via Scale.build() les items à afficher. Le drag/momentum/scroll/visuals
|
|
6
|
+
* ne dépendent pas de l'échelle.
|
|
7
|
+
*/
|
|
8
|
+
import type { LadderTimelineOptions, CalendarAdapter, TimelineMarker } from './LadderTimeline.types';
|
|
9
|
+
import { EVENT_WEEK_CHANGE, EVENT_SELECT, EVENT_NAVIGATE } from './LadderTimeline.events';
|
|
10
|
+
import { type ScaleId } from './Scale';
|
|
11
|
+
export declare class LadderTimeline {
|
|
12
|
+
private readonly container;
|
|
13
|
+
private readonly firstDayOfWeek;
|
|
14
|
+
private readonly locale;
|
|
15
|
+
private readonly compact;
|
|
16
|
+
private readonly theme;
|
|
17
|
+
private readonly storageKey;
|
|
18
|
+
private readonly onWeekChangeCb;
|
|
19
|
+
private readonly onWeekPreviewCb;
|
|
20
|
+
private readonly onItemChangeCb;
|
|
21
|
+
private readonly onItemPreviewCb;
|
|
22
|
+
private readonly onMarkerClickCb;
|
|
23
|
+
private markers;
|
|
24
|
+
private _darkMq;
|
|
25
|
+
private _darkMqHandler;
|
|
26
|
+
private selectedYear;
|
|
27
|
+
private referenceYear;
|
|
28
|
+
private scale;
|
|
29
|
+
private displayMode;
|
|
30
|
+
private readonly minYear;
|
|
31
|
+
private readonly maxYear;
|
|
32
|
+
private readonly coarsestScaleIdx;
|
|
33
|
+
private readonly finestScaleIdx;
|
|
34
|
+
private root;
|
|
35
|
+
private listWrapper;
|
|
36
|
+
private listEl;
|
|
37
|
+
private centerMark;
|
|
38
|
+
private liveRegion;
|
|
39
|
+
private isDragging;
|
|
40
|
+
private dragStartX;
|
|
41
|
+
private dragStartScroll;
|
|
42
|
+
private velX;
|
|
43
|
+
private lastMoveX;
|
|
44
|
+
private lastMoveT;
|
|
45
|
+
private rafId;
|
|
46
|
+
private wheelDebounceId;
|
|
47
|
+
private _isExtending;
|
|
48
|
+
private springRafId;
|
|
49
|
+
private _isPinching;
|
|
50
|
+
private _pinchInitialDist;
|
|
51
|
+
private cleanupFns;
|
|
52
|
+
private resizeObserver?;
|
|
53
|
+
private calendarAdapter?;
|
|
54
|
+
constructor(options: LadderTimelineOptions);
|
|
55
|
+
setDate(date: Date): void;
|
|
56
|
+
getDate(): Date;
|
|
57
|
+
goToToday(): void;
|
|
58
|
+
goToPrevious(): void;
|
|
59
|
+
goToNext(): void;
|
|
60
|
+
/** Change l'échelle courante et re-rend la barre alignée dessus */
|
|
61
|
+
setScale(id: ScaleId): void;
|
|
62
|
+
getScale(): ScaleId;
|
|
63
|
+
setDisplayMode(mode: 'expanded' | 'compact'): void;
|
|
64
|
+
getDisplayMode(): 'expanded' | 'compact';
|
|
65
|
+
/** Remplace tous les markers. */
|
|
66
|
+
setMarkers(markers: TimelineMarker[]): void;
|
|
67
|
+
/** Ajoute un marker (ne dédoublonne pas sur id — c'est à l'appelant). */
|
|
68
|
+
addMarker(marker: TimelineMarker): void;
|
|
69
|
+
/** Supprime tous les markers ayant cet id. No-op si id absent ou inconnu. */
|
|
70
|
+
removeMarker(id: string): void;
|
|
71
|
+
/** Renvoie une copie de la liste courante. */
|
|
72
|
+
getMarkers(): TimelineMarker[];
|
|
73
|
+
/** Renvoie les bornes effectives configurées sur cette instance. */
|
|
74
|
+
getBounds(): {
|
|
75
|
+
minYear: number;
|
|
76
|
+
maxYear: number;
|
|
77
|
+
minScale: ScaleId;
|
|
78
|
+
maxScale: ScaleId;
|
|
79
|
+
};
|
|
80
|
+
private _clampYear;
|
|
81
|
+
/**
|
|
82
|
+
* Snap puis clamp un year en garantissant qu'on reste sur une frontière
|
|
83
|
+
* d'échelle (sauf bornes pathologiques sans aucune frontière dans la plage).
|
|
84
|
+
* Cas géré : snap (souvent Math.floor) tombe juste sous minYear → on monte
|
|
85
|
+
* d'une unité d'échelle pour retomber dans les bornes.
|
|
86
|
+
*/
|
|
87
|
+
private _snapAndClamp;
|
|
88
|
+
private _clampScaleId;
|
|
89
|
+
getEventTarget(): EventTarget;
|
|
90
|
+
connectAdapter(adapter: CalendarAdapter): void;
|
|
91
|
+
render(): void;
|
|
92
|
+
destroy(): void;
|
|
93
|
+
on(event: typeof EVENT_WEEK_CHANGE | typeof EVENT_SELECT | typeof EVENT_NAVIGATE, handler: EventListener): () => void;
|
|
94
|
+
private _buildDOM;
|
|
95
|
+
/**
|
|
96
|
+
* Rend tous les <li> dans listEl à partir de referenceYear / selectedYear
|
|
97
|
+
* et de l'échelle courante. Applique le padding carousel immédiatement.
|
|
98
|
+
*/
|
|
99
|
+
private _renderItems;
|
|
100
|
+
/** Renvoie les markers dont year tombe dans [itemYear, itemYear + step). */
|
|
101
|
+
private _markersForItem;
|
|
102
|
+
private _handleMarkerClick;
|
|
103
|
+
private _updateListDOM;
|
|
104
|
+
/**
|
|
105
|
+
* Vérifie pendant le drag si le centre approche du bord (seuil × 2).
|
|
106
|
+
* Si oui, reconstruit la liste autour de l'item central visible en
|
|
107
|
+
* conservant la position de scroll — le drag continue sans saut.
|
|
108
|
+
*/
|
|
109
|
+
private _checkAndExtend;
|
|
110
|
+
private _applyCarouselPadding;
|
|
111
|
+
private _syncCenterMark;
|
|
112
|
+
private _scrollToItem;
|
|
113
|
+
private _smoothScrollTo;
|
|
114
|
+
private _getCenterItem;
|
|
115
|
+
private _applyScaleEffect;
|
|
116
|
+
private _springSnap;
|
|
117
|
+
private _updateVisuals;
|
|
118
|
+
private _scheduleVisuals;
|
|
119
|
+
private _updateCenterHighlight;
|
|
120
|
+
private _bindDragEvents;
|
|
121
|
+
private _bindWheelEvents;
|
|
122
|
+
private _startMomentum;
|
|
123
|
+
private _snapToCenter;
|
|
124
|
+
private _bindKeyboardEvents;
|
|
125
|
+
private _bindPinchEvents;
|
|
126
|
+
/** Décale l'échelle de `delta` positions (+1 = plus fine, -1 = plus grossière). */
|
|
127
|
+
private _stepScale;
|
|
128
|
+
/** Construit un TimelineItemInfo pour un year donné, à l'échelle courante. */
|
|
129
|
+
private _buildItemInfo;
|
|
130
|
+
private _emitItemChange;
|
|
131
|
+
private _emitItemPreview;
|
|
132
|
+
private _commitSelection;
|
|
133
|
+
private _emitNavigate;
|
|
134
|
+
private _hapticFeedback;
|
|
135
|
+
private _setupTheme;
|
|
136
|
+
/**
|
|
137
|
+
* Format storage : `v1:{year}`. Toute autre forme (ancien format, version
|
|
138
|
+
* future inconnue) est ignorée silencieusement — permet de faire évoluer
|
|
139
|
+
* la sérialisation sans casser les sessions existantes.
|
|
140
|
+
*/
|
|
141
|
+
private static readonly STORAGE_VERSION;
|
|
142
|
+
private _readStorage;
|
|
143
|
+
private _writeStorage;
|
|
144
|
+
private _initResizeObserver;
|
|
145
|
+
debugState(): Record<string, unknown>;
|
|
146
|
+
private _cleanup;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=LadderTimeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LadderTimeline.d.ts","sourceRoot":"","sources":["../../../src/components/ladder-timeline/LadderTimeline.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,qBAAqB,EAErB,eAAe,EAEf,cAAc,EACf,MAAM,wBAAwB,CAAC;AAUhC,OAAO,EA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AC,eAAe,CAAQ;IAE/C,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,mBAAmB;IAa3B,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IA4ErC,OAAO,CAAC,QAAQ;CAIjB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LadderTimelineSelectEventDetail, LadderTimelineNavigateEventDetail } from './LadderTimeline.types';
|
|
2
|
+
/** Fired when the user selects a week (click, keyboard) */
|
|
3
|
+
export type WeekChangeEvent = CustomEvent<LadderTimelineSelectEventDetail>;
|
|
4
|
+
/** Fired when prev / next / today navigation occurs */
|
|
5
|
+
export type WeekNavigateEvent = CustomEvent<LadderTimelineNavigateEventDetail>;
|
|
6
|
+
export declare const EVENT_WEEK_CHANGE: "weekchange";
|
|
7
|
+
export declare const EVENT_NAVIGATE: "navigate";
|
|
8
|
+
export declare const EVENT_SELECT: "select";
|
|
9
|
+
export declare function createWeekChangeEvent(detail: LadderTimelineSelectEventDetail): WeekChangeEvent;
|
|
10
|
+
export declare function createSelectEvent(detail: LadderTimelineSelectEventDetail): CustomEvent<LadderTimelineSelectEventDetail>;
|
|
11
|
+
export declare function createNavigateEvent(detail: LadderTimelineNavigateEventDetail): WeekNavigateEvent;
|
|
12
|
+
export declare function onWeekChange(target: EventTarget, handler: (e: WeekChangeEvent) => void): () => void;
|
|
13
|
+
export declare function onNavigate(target: EventTarget, handler: (e: WeekNavigateEvent) => void): () => void;
|
|
14
|
+
//# sourceMappingURL=LadderTimeline.events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LadderTimeline.events.d.ts","sourceRoot":"","sources":["../../../src/components/ladder-timeline/LadderTimeline.events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,iCAAiC,EAClC,MAAM,wBAAwB,CAAC;AAIhC,2DAA2D;AAC3D,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,+BAA+B,CAAC,CAAC;AAE3E,uDAAuD;AACvD,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,iCAAiC,CAAC,CAAC;AAI/E,eAAO,MAAM,iBAAiB,EAAG,YAAqB,CAAC;AACvD,eAAO,MAAM,cAAc,EAAG,UAAmB,CAAC;AAClD,eAAO,MAAM,YAAY,EAAG,QAAiB,CAAC;AAI9C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,+BAA+B,GACtC,eAAe,CAMjB;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,+BAA+B,GACtC,WAAW,CAAC,+BAA+B,CAAC,CAM9C;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iCAAiC,GACxC,iBAAiB,CAMnB;AAID,wBAAgB,YAAY,CAC1B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,GACpC,MAAM,IAAI,CAIZ;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,GACtC,MAAM,IAAI,CAIZ"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export interface WeekRange {
|
|
2
|
+
start: Date;
|
|
3
|
+
end: Date;
|
|
4
|
+
}
|
|
5
|
+
export interface WeekItem {
|
|
6
|
+
weekNumber: number;
|
|
7
|
+
year: number;
|
|
8
|
+
range: WeekRange;
|
|
9
|
+
/** Short label: e.g. "31 Mar – 6 Apr" */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Secondary label: e.g. "W14" */
|
|
12
|
+
sublabel: string;
|
|
13
|
+
isCurrent: boolean;
|
|
14
|
+
isSelected: boolean;
|
|
15
|
+
}
|
|
16
|
+
import type { ScaleId } from './Scale';
|
|
17
|
+
export interface LadderTimelineOptions {
|
|
18
|
+
/** Required mount point */
|
|
19
|
+
container: HTMLElement;
|
|
20
|
+
/** Initially selected date (defaults to today) */
|
|
21
|
+
selectedDate?: Date;
|
|
22
|
+
/** Centre of the rendered window (defaults to today) */
|
|
23
|
+
referenceDate?: Date;
|
|
24
|
+
/** How many items to render at once (default: 51) */
|
|
25
|
+
weeksVisible?: number;
|
|
26
|
+
/** 0 = Sunday, 1 = Monday (default: 1) */
|
|
27
|
+
firstDayOfWeek?: 0 | 1;
|
|
28
|
+
/** BCP-47 locale for formatting (default: 'fr-FR') */
|
|
29
|
+
locale?: string;
|
|
30
|
+
/** Compact mode – less padding, smaller text (default: false) */
|
|
31
|
+
compact?: boolean;
|
|
32
|
+
/** Échelle temporelle initiale (default: 'week') */
|
|
33
|
+
scale?: ScaleId;
|
|
34
|
+
/**
|
|
35
|
+
* Mode d'affichage des items :
|
|
36
|
+
* - `'expanded'` (default) : label + sublabel sur tous les items.
|
|
37
|
+
* - `'compact'` : seuls les items aux frontières de l'échelle
|
|
38
|
+
* supérieure gardent l'affichage complet ; les autres sont minimisés
|
|
39
|
+
* (juste un compactLabel).
|
|
40
|
+
*/
|
|
41
|
+
displayMode?: 'expanded' | 'compact';
|
|
42
|
+
/**
|
|
43
|
+
* Échelle la plus fine autorisée (unité la plus courte). Default: `'ns'`.
|
|
44
|
+
* Ex: `minScale: 'day'` interdit hour/minute/second/ms/μs/ns.
|
|
45
|
+
*/
|
|
46
|
+
minScale?: ScaleId;
|
|
47
|
+
/**
|
|
48
|
+
* Échelle la plus grossière autorisée (unité la plus longue). Default: `'Ga'`.
|
|
49
|
+
* Ex: `maxScale: 'century'` interdit millennium/10ka/100ka/Ma/100Ma/Ga.
|
|
50
|
+
*/
|
|
51
|
+
maxScale?: ScaleId;
|
|
52
|
+
/** Année minimale navigable (decimal year, ex: -10000 pour 10 000 av. J.-C.). */
|
|
53
|
+
minYear?: number;
|
|
54
|
+
/** Année maximale navigable (decimal year). */
|
|
55
|
+
maxYear?: number;
|
|
56
|
+
/** Date minimale navigable. Convertie en minYear. Ignoré si minYear est fourni. */
|
|
57
|
+
minDate?: Date;
|
|
58
|
+
/** Date maximale navigable. Convertie en maxYear. Ignoré si maxYear est fourni. */
|
|
59
|
+
maxDate?: Date;
|
|
60
|
+
/** Optional callback shortcut (alternative to listening to 'weekchange') */
|
|
61
|
+
onWeekChange?: (detail: LadderTimelineSelectEventDetail) => void;
|
|
62
|
+
/** Fired live during drag as the center item changes (before snap) */
|
|
63
|
+
onWeekPreview?: (detail: LadderTimelineSelectEventDetail) => void;
|
|
64
|
+
/** Fired when the centered item is committed (after snap) — toutes échelles */
|
|
65
|
+
onItemChange?: (info: TimelineItemInfo) => void;
|
|
66
|
+
/** Fired live during drag/scroll for the centered item — toutes échelles */
|
|
67
|
+
onItemPreview?: (info: TimelineItemInfo) => void;
|
|
68
|
+
/** Liste initiale de markers (dates clés) à poser sur la timeline */
|
|
69
|
+
markers?: TimelineMarker[];
|
|
70
|
+
/** Click sur un marker */
|
|
71
|
+
onMarkerClick?: (marker: TimelineMarker) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Thème visuel.
|
|
74
|
+
* - 'light' (défaut) : toujours clair
|
|
75
|
+
* - 'dark' : toujours sombre
|
|
76
|
+
* - 'auto' : suit prefers-color-scheme du système
|
|
77
|
+
*/
|
|
78
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
79
|
+
/**
|
|
80
|
+
* Clé localStorage pour persister la semaine sélectionnée entre les rechargements.
|
|
81
|
+
* Si définie et qu'une valeur valide est stockée, elle prend priorité sur selectedDate.
|
|
82
|
+
*/
|
|
83
|
+
storageKey?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface LadderTimelineSelectEventDetail {
|
|
86
|
+
date: Date;
|
|
87
|
+
week: WeekRange;
|
|
88
|
+
}
|
|
89
|
+
export interface LadderTimelineNavigateEventDetail {
|
|
90
|
+
direction: 'prev' | 'next' | 'today';
|
|
91
|
+
date: Date;
|
|
92
|
+
week: WeekRange;
|
|
93
|
+
}
|
|
94
|
+
export interface CalendarAdapter {
|
|
95
|
+
gotoDate(date: Date): void;
|
|
96
|
+
}
|
|
97
|
+
export interface TimelineItemInfo {
|
|
98
|
+
scale: ScaleId;
|
|
99
|
+
year: number;
|
|
100
|
+
label: string;
|
|
101
|
+
sublabel: string;
|
|
102
|
+
header: string;
|
|
103
|
+
/** Date équivalent si le year est dans la plage Date, sinon null */
|
|
104
|
+
date: Date | null;
|
|
105
|
+
}
|
|
106
|
+
export interface TimelineMarker {
|
|
107
|
+
/** Position en décimal year (ex: 1789.539 pour 14 juillet 1789) */
|
|
108
|
+
year: number;
|
|
109
|
+
/** Texte affiché en tooltip (et dans les payloads d'événement) */
|
|
110
|
+
label: string;
|
|
111
|
+
/** Couleur du marker. Défaut : couleur d'accent du thème. */
|
|
112
|
+
color?: string;
|
|
113
|
+
/** Identifiant optionnel — pour removeMarker() */
|
|
114
|
+
id?: string;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=LadderTimeline.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LadderTimeline.types.d.ts","sourceRoot":"","sources":["../../../src/components/ladder-timeline/LadderTimeline.types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;CACX;AAID,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;AAID,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,qBAAqB;IACpC,2BAA2B;IAC3B,SAAS,EAAE,WAAW,CAAC;IACvB,kDAAkD;IAClD,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,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C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACrC,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;CACjB;AAID,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CAC5B;AAID,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CACnB;AAID,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { WeekItem, WeekRange } from './LadderTimeline.types';
|
|
2
|
+
/** Return a new Date stripped to midnight UTC-local */
|
|
3
|
+
export declare function normalizeDate(d: Date): Date;
|
|
4
|
+
/** Clone a Date instance */
|
|
5
|
+
export declare function cloneDate(d: Date): Date;
|
|
6
|
+
/** Add (or subtract) N days */
|
|
7
|
+
export declare function addDays(d: Date, days: number): Date;
|
|
8
|
+
/** Add (or subtract) N weeks */
|
|
9
|
+
export declare function addWeeks(d: Date, weeks: number): Date;
|
|
10
|
+
/**
|
|
11
|
+
* Return Monday (firstDayOfWeek=1) or Sunday (firstDayOfWeek=0)
|
|
12
|
+
* of the week containing `d`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getWeekStart(d: Date, firstDayOfWeek?: 0 | 1): Date;
|
|
15
|
+
/** Return the last day of the week (6 days after start) */
|
|
16
|
+
export declare function getWeekEnd(weekStart: Date): Date;
|
|
17
|
+
/** ISO-8601 week number */
|
|
18
|
+
export declare function getISOWeekNumber(d: Date): number;
|
|
19
|
+
/** True if two dates fall on the same calendar day */
|
|
20
|
+
export declare function isSameDay(a: Date, b: Date): boolean;
|
|
21
|
+
/** True if two dates fall in the same ISO week */
|
|
22
|
+
export declare function isSameWeek(a: Date, b: Date, firstDayOfWeek?: 0 | 1): boolean;
|
|
23
|
+
/** Numeric comparison: –1, 0, 1 */
|
|
24
|
+
export declare function compareDate(a: Date, b: Date): -1 | 0 | 1;
|
|
25
|
+
/**
|
|
26
|
+
* Format a week date range using Intl.DateTimeFormat.formatRange when available.
|
|
27
|
+
* Same month → "18 – 24 août" / "Aug 18 – 24" (month shown once)
|
|
28
|
+
* Cross-month → "28 mars – 3 avr." / "Mar 28 – Apr 3"
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatWeekLabel(range: WeekRange, locale: string): string;
|
|
31
|
+
/** "W14 · 2025" */
|
|
32
|
+
export declare function formatWeekSublabel(weekNumber: number, year: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* Generate an array of WeekItems centred on `referenceDate`.
|
|
35
|
+
*
|
|
36
|
+
* @param referenceDate Centre of the window
|
|
37
|
+
* @param selectedDate Currently selected date
|
|
38
|
+
* @param weeksVisible Total weeks to generate (should be odd for centring)
|
|
39
|
+
* @param firstDayOfWeek 0 = Sun, 1 = Mon
|
|
40
|
+
* @param locale BCP-47 locale
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildWeekList(referenceDate: Date, selectedDate: Date, weeksVisible: number, firstDayOfWeek: 0 | 1, locale: string): WeekItem[];
|
|
43
|
+
export declare function isValidDate(d: unknown): d is Date;
|
|
44
|
+
//# sourceMappingURL=LadderTimeline.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LadderTimeline.utils.d.ts","sourceRoot":"","sources":["../../../src/components/ladder-timeline/LadderTimeline.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIlE,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAG3C;AAED,4BAA4B;AAC5B,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAEvC;AAED,+BAA+B;AAC/B,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAInD;AAED,gCAAgC;AAChC,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAErD;AAID;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,GAAE,CAAC,GAAG,CAAK,GAAG,IAAI,CAKrE;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,CAEhD;AAED,2BAA2B;AAC3B,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAMhD;AAID,sDAAsD;AACtD,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,OAAO,CAMnD;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,GAAE,CAAC,GAAG,CAAK,GAAG,OAAO,CAI/E;AAED,mCAAmC;AACnC,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAMxD;AAID;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAaxE;AAED,mBAAmB;AACnB,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3E;AAID;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,aAAa,EAAE,IAAI,EACnB,YAAY,EAAE,IAAI,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,CAAC,GAAG,CAAC,EACrB,MAAM,EAAE,MAAM,GACb,QAAQ,EAAE,CA0BZ;AAID,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,IAAI,CAEjD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scale system — 18 échelles temporelles, du milliard d'années à la nanoseconde.
|
|
3
|
+
*
|
|
4
|
+
* Cursor interne unifié = `decimal year` (float64). Chaque Scale fournit :
|
|
5
|
+
* - step : pas entre deux items (en années décimales)
|
|
6
|
+
* - snap(year) : arrondit à la frontière d'unité de cette échelle
|
|
7
|
+
* - build(...) : produit N items autour du curseur
|
|
8
|
+
*
|
|
9
|
+
* Pour les très grandes échelles (>= ka), on travaille uniquement sur le `year`
|
|
10
|
+
* numérique (Date ne supporte pas au-delà de ±271 821 ans depuis 1970).
|
|
11
|
+
* Pour les échelles fines (< seconde), la précision float64 ne suffit pas pour
|
|
12
|
+
* un timestamp absolu — les labels deviennent décoratifs.
|
|
13
|
+
*/
|
|
14
|
+
export type ScaleId = 'Ga' | '100Ma' | 'Ma' | '100ka' | '10ka' | 'millennium' | 'century' | 'decade' | 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'ms';
|
|
15
|
+
export interface ScaleItem {
|
|
16
|
+
/** Identité canonique de l'item — décimal year de son début */
|
|
17
|
+
year: number;
|
|
18
|
+
/** Label principal affiché sur l'item */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Label secondaire (S14 · 2025, 14:00…) */
|
|
21
|
+
sublabel: string;
|
|
22
|
+
/** Header optionnel affiché sur l'item sélectionné ou aux transitions */
|
|
23
|
+
header: string;
|
|
24
|
+
/** Label court pour le mode d'affichage `compact` (ex: "·10" pour 1810 à l'échelle décennie) */
|
|
25
|
+
compactLabel: string;
|
|
26
|
+
/** Marqueur "aujourd'hui" (ou présent pour macro) */
|
|
27
|
+
isCurrent: boolean;
|
|
28
|
+
/** Marqueur "sélectionné" */
|
|
29
|
+
isSelected: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface Scale {
|
|
32
|
+
id: ScaleId;
|
|
33
|
+
label: string;
|
|
34
|
+
/** Pas (en années décimales) entre deux items adjacents */
|
|
35
|
+
step: number;
|
|
36
|
+
/** Snap d'un year libre à la frontière d'unité de l'échelle */
|
|
37
|
+
snap(year: number): number;
|
|
38
|
+
/** Décale le year de n unités */
|
|
39
|
+
add(year: number, n: number): number;
|
|
40
|
+
/** Construit `count` items autour de `centerYear` */
|
|
41
|
+
build(centerYear: number, count: number, selectedYear: number, locale: string): ScaleItem[];
|
|
42
|
+
}
|
|
43
|
+
declare function inDateRange(year: number): boolean;
|
|
44
|
+
declare function yearToDate(year: number): Date;
|
|
45
|
+
declare function dateToYear(d: Date): number;
|
|
46
|
+
declare function todayYear(): number;
|
|
47
|
+
export declare const SCALES: Scale[];
|
|
48
|
+
export declare function getScale(id: ScaleId): Scale;
|
|
49
|
+
export declare function scaleIndex(id: ScaleId): number;
|
|
50
|
+
export declare function scaleAt(index: number): Scale | undefined;
|
|
51
|
+
export declare const SCALE_COUNT: number;
|
|
52
|
+
export { dateToYear, yearToDate, todayYear, inDateRange };
|
|
53
|
+
//# sourceMappingURL=Scale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scale.d.ts","sourceRoot":"","sources":["../../../src/components/ladder-timeline/Scale.ts"],"names":[],"mapp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BAAS,SAAS,IAAI,MAAM,CAE3B;AA6YD,eAAO,MAAM,MAAM,EAAE,KAAK,EAiBzB,CAAC;AAOF,wBAAgB,QAAQ,CAAC,EAAE,EAAE,OAAO,GAAG,KAAK,CAI3C;AASD,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAE9C;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAExD;AAED,eAAO,MAAM,WAAW,QAAgB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/debug.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Panneau de debug LadderTimeline — dev only.
|
|
3
|
+
* Importé dynamiquement depuis main.ts uniquement quand import.meta.env.DEV === true.
|
|
4
|
+
* Jamais inclus dans le bundle de production.
|
|
5
|
+
*/
|
|
6
|
+
import { LadderTimeline } from './components/ladder-timeline/LadderTimeline';
|
|
7
|
+
export declare function initDebugger(timeline: LadderTimeline): void;
|
|
8
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAE7E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CA4H3D"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { LadderTimeline } from './components/ladder-timeline/LadderTimeline';
|
|
2
|
+
export type { LadderTimelineOptions, LadderTimelineSelectEventDetail, LadderTimelineNavigateEventDetail, WeekRange, WeekItem, CalendarAdapter, } from './components/ladder-timeline/LadderTimeline.types';
|
|
3
|
+
export { createFullCalendarAdapter, bindTimelineToCalendar, } from './adapters/FullCalendarAdapter';
|
|
4
|
+
export type { FullCalendarInstance, BindableTimeline, } from './adapters/FullCalendarAdapter';
|
|
5
|
+
import './components/ladder-timeline/LadderTimeline.scss';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAG7E,YAAY,EACV,qBAAqB,EACrB,+BAA+B,EAC/B,iCAAiC,EACjC,SAAS,EACT,QAAQ,EACR,eAAe,GAChB,MAAM,mDAAmD,CAAC;AAG3D,OAAO,EACL,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACV,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,kDAAkD,CAAC"}
|