@bimetal/calendar-svelte-components 0.29.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.
Files changed (87) hide show
  1. package/LICENSE +129 -0
  2. package/dist/binding/config.d.ts +6 -0
  3. package/dist/binding/config.d.ts.map +1 -0
  4. package/dist/binding/config.js +5 -0
  5. package/dist/binding/context.d.ts +31 -0
  6. package/dist/binding/context.d.ts.map +1 -0
  7. package/dist/binding/context.js +55 -0
  8. package/dist/binding/controller.d.ts +24 -0
  9. package/dist/binding/controller.d.ts.map +1 -0
  10. package/dist/binding/controller.js +9 -0
  11. package/dist/binding/index.d.ts +23 -0
  12. package/dist/binding/index.d.ts.map +1 -0
  13. package/dist/binding/index.js +24 -0
  14. package/dist/binding/types.d.ts +95 -0
  15. package/dist/binding/types.d.ts.map +1 -0
  16. package/dist/binding/types.js +11 -0
  17. package/dist/binding/view-configs.d.ts +6 -0
  18. package/dist/binding/view-configs.d.ts.map +1 -0
  19. package/dist/binding/view-configs.js +5 -0
  20. package/dist/components/Calendar.svelte +263 -0
  21. package/dist/components/Calendar.svelte.d.ts +24 -0
  22. package/dist/components/Calendar.svelte.d.ts.map +1 -0
  23. package/dist/components/CalendarHeader.svelte +47 -0
  24. package/dist/components/CalendarHeader.svelte.d.ts +15 -0
  25. package/dist/components/CalendarHeader.svelte.d.ts.map +1 -0
  26. package/dist/components/CategoryFilter.svelte +29 -0
  27. package/dist/components/CategoryFilter.svelte.d.ts +10 -0
  28. package/dist/components/CategoryFilter.svelte.d.ts.map +1 -0
  29. package/dist/components/EventBar.svelte +187 -0
  30. package/dist/components/EventBar.svelte.d.ts +10 -0
  31. package/dist/components/EventBar.svelte.d.ts.map +1 -0
  32. package/dist/components/EventDialog.svelte +312 -0
  33. package/dist/components/EventDialog.svelte.d.ts +15 -0
  34. package/dist/components/EventDialog.svelte.d.ts.map +1 -0
  35. package/dist/components/EventHistory.svelte +89 -0
  36. package/dist/components/EventHistory.svelte.d.ts +10 -0
  37. package/dist/components/EventHistory.svelte.d.ts.map +1 -0
  38. package/dist/components/ResourceFilter.svelte +28 -0
  39. package/dist/components/ResourceFilter.svelte.d.ts +10 -0
  40. package/dist/components/ResourceFilter.svelte.d.ts.map +1 -0
  41. package/dist/components/UndoToast.svelte +47 -0
  42. package/dist/components/UndoToast.svelte.d.ts +4 -0
  43. package/dist/components/UndoToast.svelte.d.ts.map +1 -0
  44. package/dist/index.d.ts +20 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +23 -0
  47. package/dist/styles/index.css +1 -0
  48. package/dist/views/agenda/AgendaEvent.svelte +55 -0
  49. package/dist/views/agenda/AgendaEvent.svelte.d.ts +14 -0
  50. package/dist/views/agenda/AgendaEvent.svelte.d.ts.map +1 -0
  51. package/dist/views/agenda/AgendaView.svelte +155 -0
  52. package/dist/views/agenda/AgendaView.svelte.d.ts +8 -0
  53. package/dist/views/agenda/AgendaView.svelte.d.ts.map +1 -0
  54. package/dist/views/day/AllDayEvent.svelte +49 -0
  55. package/dist/views/day/AllDayEvent.svelte.d.ts +12 -0
  56. package/dist/views/day/AllDayEvent.svelte.d.ts.map +1 -0
  57. package/dist/views/day/DayView.svelte +252 -0
  58. package/dist/views/day/DayView.svelte.d.ts +8 -0
  59. package/dist/views/day/DayView.svelte.d.ts.map +1 -0
  60. package/dist/views/month/MonthView.svelte +66 -0
  61. package/dist/views/month/MonthView.svelte.d.ts +8 -0
  62. package/dist/views/month/MonthView.svelte.d.ts.map +1 -0
  63. package/dist/views/month/TimedEntry.svelte +51 -0
  64. package/dist/views/month/TimedEntry.svelte.d.ts +12 -0
  65. package/dist/views/month/TimedEntry.svelte.d.ts.map +1 -0
  66. package/dist/views/month/WeekRow.svelte +224 -0
  67. package/dist/views/month/WeekRow.svelte.d.ts +12 -0
  68. package/dist/views/month/WeekRow.svelte.d.ts.map +1 -0
  69. package/dist/views/resource/ResourceView.svelte +227 -0
  70. package/dist/views/resource/ResourceView.svelte.d.ts +11 -0
  71. package/dist/views/resource/ResourceView.svelte.d.ts.map +1 -0
  72. package/dist/views/timeline/TimelineView.svelte +178 -0
  73. package/dist/views/timeline/TimelineView.svelte.d.ts +12 -0
  74. package/dist/views/timeline/TimelineView.svelte.d.ts.map +1 -0
  75. package/dist/views/week/AllDayRow.svelte +74 -0
  76. package/dist/views/week/AllDayRow.svelte.d.ts +9 -0
  77. package/dist/views/week/AllDayRow.svelte.d.ts.map +1 -0
  78. package/dist/views/week/TimeEvent.svelte +192 -0
  79. package/dist/views/week/TimeEvent.svelte.d.ts +25 -0
  80. package/dist/views/week/TimeEvent.svelte.d.ts.map +1 -0
  81. package/dist/views/week/WeekView.svelte +232 -0
  82. package/dist/views/week/WeekView.svelte.d.ts +8 -0
  83. package/dist/views/week/WeekView.svelte.d.ts.map +1 -0
  84. package/dist/views/year/YearView.svelte +92 -0
  85. package/dist/views/year/YearView.svelte.d.ts +8 -0
  86. package/dist/views/year/YearView.svelte.d.ts.map +1 -0
  87. package/package.json +56 -0
package/LICENSE ADDED
@@ -0,0 +1,129 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Andreas Biederbeck (https://bimetal.dev)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or any agreement made under them,
97
+ you have 32 calendar days to come into compliance. If you come
98
+ into compliance, your licenses revive and continue as if you had
99
+ never violated.
100
+
101
+ ## No Liability
102
+
103
+ ***As far as the law allows, the software comes as is, without
104
+ any warranty or condition, and the licensor will not be liable
105
+ to you for any damages arising out of these terms or the use
106
+ or nature of the software, under any kind of legal claim.***
107
+
108
+ ## Definitions
109
+
110
+ The **licensor** is the individual or entity offering these
111
+ terms, and the **software** is the software the licensor makes
112
+ available under these terms.
113
+
114
+ **You** refers to the individual or entity agreeing to these
115
+ terms.
116
+
117
+ **Your company** is any legal entity, sole proprietorship,
118
+ or other kind of organization that you work for, plus all
119
+ organizations that have control over, are under the control of,
120
+ or are under common control with that organization. **Control**
121
+ means ownership of substantially all the assets of an entity,
122
+ or the power to direct its management and policies by vote,
123
+ contract, or otherwise. Control can be direct or indirect.
124
+
125
+ **Your licenses** are all the licenses granted to you for the
126
+ software under these terms.
127
+
128
+ **Use** means anything you do with the software requiring one
129
+ of your licenses.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Calendar config defaults + merge — re-exported from the canonical
3
+ * `@bimetal/calendar-headless` source. Previously a per-framework copy that drifted.
4
+ */
5
+ export { defaultLocale, defaultCalendarConfig, mergeCalendarConfig } from '@bimetal/calendar-headless';
6
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/binding/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Calendar config defaults + merge — re-exported from the canonical
3
+ * `@bimetal/calendar-headless` source. Previously a per-framework copy that drifted.
4
+ */
5
+ export { defaultLocale, defaultCalendarConfig, mergeCalendarConfig } from '@bimetal/calendar-headless';
@@ -0,0 +1,31 @@
1
+ import type { CalendarEvent } from '@bimetal/calendar-core';
2
+ import type { CalendarConfig, EventRenderSlots } from './types.js';
3
+ export declare const CALENDAR_CONTEXT_KEY = "bimetal-calendar";
4
+ export declare const CALENDAR_CONFIG_KEY = "bimetal-config";
5
+ /**
6
+ * Provide calendar configuration to child components.
7
+ * Must be called during component initialization.
8
+ */
9
+ export declare function setCalendarConfig(config: CalendarConfig): void;
10
+ /**
11
+ * Retrieve calendar configuration from the nearest ancestor.
12
+ * Must be called during component initialization.
13
+ */
14
+ export declare function getCalendarConfig(): CalendarConfig;
15
+ /**
16
+ * Provide a value in the Svelte context tree.
17
+ * Must be called during component initialization.
18
+ */
19
+ export declare function setCalendarContext<T>(value: T): void;
20
+ /**
21
+ * Retrieve calendar context from the nearest ancestor.
22
+ * Must be called during component initialization.
23
+ */
24
+ export declare function getCalendarContext<T>(): T;
25
+ /**
26
+ * Resolve renderEvent slots for an event. Reads `renderEvent` + `view` from
27
+ * the calendar context (which Calendar.svelte sets at mount). Returning
28
+ * undefined from the hook yields an empty record, so default rendering applies.
29
+ */
30
+ export declare function getEventSlots(event: CalendarEvent): EventRenderSlots;
31
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/binding/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAA8B,MAAM,wBAAwB,CAAC;AAExF,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAiB,MAAM,YAAY,CAAC;AAKlF,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AACvD,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAIpD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,QAEvD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAElD;AAID;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,QAE7C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,KAAK,CAAC,CAIzC;AAID;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,CASpE"}
@@ -0,0 +1,55 @@
1
+ import { setContext, getContext } from 'svelte';
2
+ import { getRecurrenceInstanceMetadata } from '@bimetal/calendar-core';
3
+ import { defaultCalendarConfig } from './config.js';
4
+ // ── Context keys ────────────────────────────────────────────────
5
+ export const CALENDAR_CONTEXT_KEY = 'bimetal-calendar';
6
+ export const CALENDAR_CONFIG_KEY = 'bimetal-config';
7
+ // ── Config context ──────────────────────────────────────────────
8
+ /**
9
+ * Provide calendar configuration to child components.
10
+ * Must be called during component initialization.
11
+ */
12
+ export function setCalendarConfig(config) {
13
+ setContext(CALENDAR_CONFIG_KEY, config);
14
+ }
15
+ /**
16
+ * Retrieve calendar configuration from the nearest ancestor.
17
+ * Must be called during component initialization.
18
+ */
19
+ export function getCalendarConfig() {
20
+ return getContext(CALENDAR_CONFIG_KEY) ?? defaultCalendarConfig;
21
+ }
22
+ // ── Generic context helpers ─────────────────────────────────────
23
+ /**
24
+ * Provide a value in the Svelte context tree.
25
+ * Must be called during component initialization.
26
+ */
27
+ export function setCalendarContext(value) {
28
+ setContext(CALENDAR_CONTEXT_KEY, value);
29
+ }
30
+ /**
31
+ * Retrieve calendar context from the nearest ancestor.
32
+ * Must be called during component initialization.
33
+ */
34
+ export function getCalendarContext() {
35
+ const ctx = getContext(CALENDAR_CONTEXT_KEY);
36
+ if (!ctx)
37
+ throw new Error('getCalendarContext must be used within a CalendarProvider');
38
+ return ctx;
39
+ }
40
+ const EMPTY_SLOTS = {};
41
+ /**
42
+ * Resolve renderEvent slots for an event. Reads `renderEvent` + `view` from
43
+ * the calendar context (which Calendar.svelte sets at mount). Returning
44
+ * undefined from the hook yields an empty record, so default rendering applies.
45
+ */
46
+ export function getEventSlots(event) {
47
+ const ctx = getContext(CALENDAR_CONTEXT_KEY);
48
+ if (!ctx?.renderEvent)
49
+ return EMPTY_SLOTS;
50
+ const markers = getRecurrenceInstanceMetadata(event);
51
+ const instanceDate = markers !== null
52
+ ? { epochMs: markers.instanceDate, timezone: event.timeRange.start.timezone }
53
+ : undefined;
54
+ return ctx.renderEvent(event, { view: ctx.view, instanceDate }) ?? EMPTY_SLOTS;
55
+ }
@@ -0,0 +1,24 @@
1
+ import type { CalendarController, CalendarControllerOptions, CalendarControllerSnapshot } from '@bimetal/calendar-headless';
2
+ /**
3
+ * Svelte binding for the canonical calendar controller.
4
+ *
5
+ * The controller (`@bimetal/calendar-headless`) owns all interaction state and
6
+ * semantics; this binding does nothing but expose it as a Svelte store-contract
7
+ * (`{ subscribe }`) so a component can auto-subscribe via `$store`. The store
8
+ * emits the controller's identity-stable snapshot on every change.
9
+ *
10
+ * Reactive option updates (config/rules/customViews) are pushed via the
11
+ * returned `ctrl.setConfig/setRules/setCustomViews` from `$effect`s — the
12
+ * controller is never recreated for an option change, only when the store
13
+ * identity changes (which recreates the whole binding component-side).
14
+ */
15
+ export interface CalendarControllerBinding {
16
+ /** Svelte store contract — fires immediately with the current snapshot. */
17
+ subscribe(run: (snapshot: CalendarControllerSnapshot) => void): () => void;
18
+ /** The controller itself — intents call straight through. */
19
+ ctrl: CalendarController;
20
+ /** Tear down the controller's store subscriptions. */
21
+ destroy(): void;
22
+ }
23
+ export declare function createCalendarControllerBinding(options: CalendarControllerOptions): CalendarControllerBinding;
24
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/binding/controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,yBAAyB;IACxC,2EAA2E;IAC3E,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC3E,6DAA6D;IAC7D,IAAI,EAAE,kBAAkB,CAAC;IACzB,sDAAsD;IACtD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,yBAAyB,GACjC,yBAAyB,CAS3B"}
@@ -0,0 +1,9 @@
1
+ import { createCalendarController } from '@bimetal/calendar-headless';
2
+ export function createCalendarControllerBinding(options) {
3
+ const ctrl = createCalendarController(options);
4
+ function subscribe(run) {
5
+ run(ctrl.getSnapshot());
6
+ return ctrl.subscribe(() => run(ctrl.getSnapshot()));
7
+ }
8
+ return { subscribe, ctrl, destroy: () => ctrl.destroy() };
9
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Svelte Calendar binding — the calendar-specific Svelte adapter (context,
3
+ * config, the calendar controller binding, calendar types + drag helpers).
4
+ * Lives in the calendar component package, NOT in the generic `@bimetal/svelte`
5
+ * binding: the calendar is a peer of the component family, not a privileged
6
+ * citizen of the framework layer. Built on the generic controller primitive
7
+ * re-exported from `@bimetal/svelte`.
8
+ */
9
+ export { createCalendarControllerBinding } from './controller.js';
10
+ export type { CalendarControllerBinding } from './controller.js';
11
+ export { CALENDAR_CONTEXT_KEY, CALENDAR_CONFIG_KEY, setCalendarConfig, getCalendarConfig, setCalendarContext, getCalendarContext, getEventSlots, } from './context.js';
12
+ export { createCalendarController } from '@bimetal/calendar-headless';
13
+ export type { CalendarController, CalendarControllerOptions, CalendarControllerSnapshot, CustomViewSpec, SelectionState, } from '@bimetal/calendar-headless';
14
+ export type { CalendarConfig, CalendarConfigInput, CalendarLocale, Category, ViewConfig, AnchorRect, CustomViewDefinition, CustomViewProps, EventDialogProps, EventDialogMode, EventRenderContext, EventRenderSlots, RenderEventFn, } from './types.js';
15
+ export type { DragPreview, DragInfo } from '@bimetal/calendar-headless';
16
+ export { snapTimeFromMouseY, parseDragInfo, DRAG_MIME, findExpandedEvent, buildDragInfo, writeCalendarDragData, installTransparentDragImage } from '@bimetal/calendar-headless';
17
+ export { WEEK_NUM_COL_WIDTH, getColFromX } from '@bimetal/calendar-headless';
18
+ export { defaultLocale, defaultCalendarConfig, mergeCalendarConfig } from './config.js';
19
+ export { createViewConfigs } from './view-configs.js';
20
+ export { toDateStr, toTimeStr, parseDateStr, parseDateTimeStr } from '@bimetal/calendar-headless';
21
+ export * from '@bimetal/calendar-data';
22
+ export * from '@bimetal/calendar-rules';
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/binding/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AAClE,YAAY,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAGjE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EACV,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,EAC1B,cAAc,EACd,cAAc,GACf,MAAM,4BAA4B,CAAC;AAGpC,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACR,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAChL,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG7E,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGlG,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Svelte Calendar binding — the calendar-specific Svelte adapter (context,
3
+ * config, the calendar controller binding, calendar types + drag helpers).
4
+ * Lives in the calendar component package, NOT in the generic `@bimetal/svelte`
5
+ * binding: the calendar is a peer of the component family, not a privileged
6
+ * citizen of the framework layer. Built on the generic controller primitive
7
+ * re-exported from `@bimetal/svelte`.
8
+ */
9
+ // ── Controller binding ─────────────────────────────────────────
10
+ export { createCalendarControllerBinding } from './controller.js';
11
+ // ── Context ────────────────────────────────────────────────────
12
+ export { CALENDAR_CONTEXT_KEY, CALENDAR_CONFIG_KEY, setCalendarConfig, getCalendarConfig, setCalendarContext, getCalendarContext, getEventSlots, } from './context.js';
13
+ // ── Canonical controller (re-exported for convenience) ──────────
14
+ export { createCalendarController } from '@bimetal/calendar-headless';
15
+ export { snapTimeFromMouseY, parseDragInfo, DRAG_MIME, findExpandedEvent, buildDragInfo, writeCalendarDragData, installTransparentDragImage } from '@bimetal/calendar-headless';
16
+ export { WEEK_NUM_COL_WIDTH, getColFromX } from '@bimetal/calendar-headless';
17
+ // ── Config ──────────────────────────────────────────────────────
18
+ export { defaultLocale, defaultCalendarConfig, mergeCalendarConfig } from './config.js';
19
+ export { createViewConfigs } from './view-configs.js';
20
+ // ── Utilities ───────────────────────────────────────────────────
21
+ export { toDateStr, toTimeStr, parseDateStr, parseDateTimeStr } from '@bimetal/calendar-headless';
22
+ // ── Re-export calendar data + rules for convenience ─────────────
23
+ export * from '@bimetal/calendar-data';
24
+ export * from '@bimetal/calendar-rules';
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Svelte-specific calendar types.
3
+ *
4
+ * The framework-agnostic core (CalendarConfig, CalendarLocale, Category,
5
+ * ViewConfig, DragInfo, DragPreview, …) now lives in `@bimetal/calendar-headless` and
6
+ * is re-exported here. Only the types that carry a *Svelte component reference*
7
+ * (custom-view component, custom dialog component, render-slot Snippet) stay
8
+ * framework-specific.
9
+ */
10
+ import type { Component, Snippet } from 'svelte';
11
+ import type { CalendarEvent, CalendarDateTime, ViewType } from '@bimetal/calendar-core';
12
+ import type { CalendarConfig, CustomViewSpec, AnchorRect } from '@bimetal/calendar-headless';
13
+ export type { CalendarLocale, Category, ViewConfig, CalendarConfig, CalendarConfigInput, AnchorRect, } from '@bimetal/calendar-headless';
14
+ export type { DragPreview, DragInfo } from '@bimetal/calendar-headless';
15
+ /**
16
+ * Props handed to a custom view's render component. Mirrors what built-in
17
+ * views see — events are pre-filtered by hidden categories, the range is
18
+ * already expanded for recurring instances. Mutations go through the
19
+ * supplied callbacks, not through the store directly.
20
+ */
21
+ export interface CustomViewProps {
22
+ readonly currentDate: CalendarDateTime;
23
+ readonly events: readonly CalendarEvent[];
24
+ readonly config: CalendarConfig;
25
+ /** Open the new-event dialog with an optional pre-filled date and anchor. */
26
+ readonly onNewEvent: (defaultDate: CalendarDateTime, anchorRect?: AnchorRect) => void;
27
+ /**
28
+ * Open the edit dialog for an existing event. `instanceDate` (epochMs)
29
+ * addresses a specific recurring occurrence — pass it through when the
30
+ * event was expanded from a recurrence series.
31
+ */
32
+ readonly onEventClick: (eventId: string, anchorRect: AnchorRect, instanceDate?: number) => void;
33
+ /**
34
+ * Currently selected event id (or `null`). `instanceDate` narrows the
35
+ * selection to a specific recurring occurrence. Matches the click-vs-
36
+ * doubleclick UX so custom views can render selection highlights and let
37
+ * keyboard navigation operate over them.
38
+ */
39
+ readonly selectedEventId: string | null;
40
+ readonly selectedInstanceDate: number | undefined;
41
+ readonly onSelectEvent: (eventId: string, instanceDate?: number) => void;
42
+ readonly onClearSelection: () => void;
43
+ }
44
+ /**
45
+ * A custom view registered via the Calendar `customViews` prop. Extends the
46
+ * agnostic `CustomViewSpec` (id / label / step / formatTitle / visibleRange)
47
+ * with the Svelte 5 component to render when the tab is selected.
48
+ */
49
+ export interface CustomViewDefinition extends CustomViewSpec {
50
+ /** Svelte 5 component receiving CustomViewProps. */
51
+ readonly component: Component<CustomViewProps>;
52
+ }
53
+ /** Props for a custom Event-Dialog Svelte component. */
54
+ export interface EventDialogProps {
55
+ readonly event: CalendarEvent | null;
56
+ readonly defaultDate: CalendarDateTime;
57
+ readonly anchorRect: AnchorRect;
58
+ readonly defaultResourceId?: string;
59
+ readonly config: CalendarConfig;
60
+ readonly onClose: () => void;
61
+ readonly onSave: (event: CalendarEvent) => void;
62
+ readonly onDelete: (eventId: string) => void;
63
+ }
64
+ /**
65
+ * Selects the dialog behavior on `<Calendar>`.
66
+ * - `'builtin'` (default) renders the standard EventDialog.
67
+ * - `'none'` renders nothing; click intents go to onEventClick / onNewEventRequested.
68
+ * - `'custom'` renders the supplied Svelte 5 component instead of the built-in dialog.
69
+ */
70
+ export type EventDialogMode = {
71
+ kind: 'builtin';
72
+ } | {
73
+ kind: 'none';
74
+ } | {
75
+ kind: 'custom';
76
+ component: Component<EventDialogProps>;
77
+ };
78
+ export interface EventRenderContext {
79
+ readonly view: ViewType;
80
+ readonly instanceDate?: CalendarDateTime;
81
+ }
82
+ /**
83
+ * Slots returned by `renderEvent`. `badges`/`content` accept a Svelte Snippet
84
+ * (preferred) or a plain string. Returning `undefined` from the hook (or
85
+ * omitting it) keeps the full default rendering.
86
+ */
87
+ export interface EventRenderSlots {
88
+ readonly title?: string;
89
+ readonly className?: string;
90
+ readonly style?: Record<string, string | number>;
91
+ readonly badges?: Snippet | string;
92
+ readonly content?: Snippet | string;
93
+ }
94
+ export type RenderEventFn = (event: CalendarEvent, ctx: EventRenderContext) => EventRenderSlots | undefined;
95
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/binding/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAA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,CAC1B,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,kBAAkB,KACpB,gBAAgB,GAAG,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Svelte-specific calendar types.
3
+ *
4
+ * The framework-agnostic core (CalendarConfig, CalendarLocale, Category,
5
+ * ViewConfig, DragInfo, DragPreview, …) now lives in `@bimetal/calendar-headless` and
6
+ * is re-exported here. Only the types that carry a *Svelte component reference*
7
+ * (custom-view component, custom dialog component, render-slot Snippet) stay
8
+ * framework-specific.
9
+ */
10
+ export {};
11
+ // ── Layout constant ─────────────────────────────────────────────
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Built-in view configs — re-exported from the canonical `@bimetal/calendar-headless`
3
+ * source. Previously a byte-identical per-framework copy.
4
+ */
5
+ export { createViewConfigs } from '@bimetal/calendar-headless';
6
+ //# sourceMappingURL=view-configs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-configs.d.ts","sourceRoot":"","sources":["../../src/binding/view-configs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Built-in view configs — re-exported from the canonical `@bimetal/calendar-headless`
3
+ * source. Previously a byte-identical per-framework copy.
4
+ */
5
+ export { createViewConfigs } from '@bimetal/calendar-headless';