@bimetal/calendar-headless 0.35.0 → 0.36.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/.tsbuildinfo +1 -1
- package/dist/controller/agenda.d.ts.map +1 -1
- package/dist/controller/agenda.js +15 -7
- package/dist/controller/agenda.js.map +1 -1
- package/dist/controller/config.d.ts.map +1 -1
- package/dist/controller/config.js +21 -0
- package/dist/controller/config.js.map +1 -1
- package/dist/controller/create-controller.d.ts +18 -0
- package/dist/controller/create-controller.d.ts.map +1 -1
- package/dist/controller/create-controller.js +656 -76
- package/dist/controller/create-controller.js.map +1 -1
- package/dist/controller/types.d.ts +181 -21
- package/dist/controller/types.d.ts.map +1 -1
- package/dist/controller/view-configs.d.ts.map +1 -1
- package/dist/controller/view-configs.js +2 -3
- package/dist/controller/view-configs.js.map +1 -1
- package/dist/date-strings.d.ts +9 -1
- package/dist/date-strings.d.ts.map +1 -1
- package/dist/date-strings.js +20 -1
- package/dist/date-strings.js.map +1 -1
- package/dist/dialog-keys.d.ts +44 -0
- package/dist/dialog-keys.d.ts.map +1 -0
- package/dist/dialog-keys.js +32 -0
- package/dist/dialog-keys.js.map +1 -0
- package/dist/drag-helpers.d.ts +0 -11
- package/dist/drag-helpers.d.ts.map +1 -1
- package/dist/drag-helpers.js +13 -20
- package/dist/drag-helpers.js.map +1 -1
- package/dist/event-actions.d.ts +28 -13
- package/dist/event-actions.d.ts.map +1 -1
- package/dist/event-actions.js +31 -27
- package/dist/event-actions.js.map +1 -1
- package/dist/grid-geometry.d.ts +3 -2
- package/dist/grid-geometry.d.ts.map +1 -1
- package/dist/grid-geometry.js +16 -11
- package/dist/grid-geometry.js.map +1 -1
- package/dist/history-entries.d.ts +78 -0
- package/dist/history-entries.d.ts.map +1 -0
- package/dist/history-entries.js +91 -0
- package/dist/history-entries.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/pointer-drag-gesture.d.ts +68 -0
- package/dist/pointer-drag-gesture.d.ts.map +1 -0
- package/dist/pointer-drag-gesture.js +73 -0
- package/dist/pointer-drag-gesture.js.map +1 -0
- package/dist/validate-save.d.ts.map +1 -1
- package/dist/validate-save.js +10 -0
- package/dist/validate-save.js.map +1 -1
- package/package.json +7 -7
package/dist/date-strings.js
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
import { getHours, getMinutes, createDateTime, monthIndex } from '@bimetal/temporal';
|
|
2
2
|
// Date round-trip: single source in the temporal kernel (strict DATE_RE parsing).
|
|
3
3
|
export { toDateStr, parseDateStr } from '@bimetal/temporal';
|
|
4
|
-
/** Convert CalendarDateTime to a time string "HH:MM".
|
|
4
|
+
/** Convert CalendarDateTime to a time string "HH:MM".
|
|
5
|
+
*
|
|
6
|
+
* MACHINE format, not display (mcp-92): this feeds the grid-hit/drop VALUE
|
|
7
|
+
* path (`parseDateTimeStr` round-trip) and must stay fixed-24h ASCII. What
|
|
8
|
+
* the USER sees goes through {@link formatTime}. */
|
|
5
9
|
export function toTimeStr(dt) {
|
|
6
10
|
return `${String(getHours(dt)).padStart(2, '0')}:${String(getMinutes(dt)).padStart(2, '0')}`;
|
|
7
11
|
}
|
|
12
|
+
// Intl.DateTimeFormat construction is expensive and the chips call this per
|
|
13
|
+
// render - cache one formatter per locale+timezone (both change rarely).
|
|
14
|
+
const timeFormatters = new Map();
|
|
15
|
+
/** DISPLAY time for the user's locale (mcp-92): `en-US` -> "2:30 PM", `ar` ->
|
|
16
|
+
* locale digits - the same `Intl` route the history timestamps already take.
|
|
17
|
+
* Distinct from {@link toTimeStr}, which is the machine `HH:MM` value format. */
|
|
18
|
+
export function formatTime(dt, localeCode, timezone) {
|
|
19
|
+
const key = localeCode + ' ' + timezone;
|
|
20
|
+
let fmt = timeFormatters.get(key);
|
|
21
|
+
if (!fmt) {
|
|
22
|
+
fmt = new Intl.DateTimeFormat(localeCode, { hour: 'numeric', minute: '2-digit', timeZone: timezone });
|
|
23
|
+
timeFormatters.set(key, fmt);
|
|
24
|
+
}
|
|
25
|
+
return fmt.format(new Date(dt.epochMs));
|
|
26
|
+
}
|
|
8
27
|
/** Parse date + time strings into a single CalendarDateTime. `timezone` is
|
|
9
28
|
* REQUIRED (no UTC default), mirroring `parseDateStr`: the strings carry no
|
|
10
29
|
* zone, so a silent UTC default would shift the round-trip by a day for
|
package/dist/date-strings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-strings.js","sourceRoot":"","sources":["../src/date-strings.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAErF,kFAAkF;AAClF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"date-strings.js","sourceRoot":"","sources":["../src/date-strings.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAErF,kFAAkF;AAClF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE5D;;;;qDAIqD;AACrD,MAAM,UAAU,SAAS,CAAC,EAAoB;IAC5C,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAC/F,CAAC;AAED,4EAA4E;AAC5E,yEAAyE;AACzE,MAAM,cAAc,GAAG,IAAI,GAAG,EAA+B,CAAC;AAE9D;;kFAEkF;AAClF,MAAM,UAAU,UAAU,CAAC,EAAoB,EAAE,UAAkB,EAAE,QAAgB;IACnF,MAAM,GAAG,GAAG,UAAU,GAAG,GAAG,GAAG,QAAQ,CAAC;IACxC,IAAI,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtG,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;kDAGkD;AAClD,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,OAAe,EACf,QAAgB;IAEhB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/C,OAAO,cAAc,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard policy for the built-in event dialog.
|
|
3
|
+
*
|
|
4
|
+
* The v0.29 keyboard contract splits mechanism from policy: a render layer reads
|
|
5
|
+
* the DOM (`@bimetal/a11y-dom`), the DOM-free headless layer decides. `Enter`
|
|
6
|
+
* inside the dialog was the one keystroke that never got that treatment — all
|
|
7
|
+
* four bindings carried the same inline `if (e.key === 'Enter' && !e.shiftKey)`,
|
|
8
|
+
* a decision duplicated four times and therefore wrong four times at once.
|
|
9
|
+
*
|
|
10
|
+
* It was wrong because it never looked at WHERE the keystroke landed. `Enter` on
|
|
11
|
+
* a focused button inside the dialog bubbled to the container, `preventDefault()`
|
|
12
|
+
* cancelled the button's native click, and the dialog saved instead of activating
|
|
13
|
+
* the button. The series entry added in mcp-116/121 is exactly such a button: by
|
|
14
|
+
* keyboard it closed the dialog rather than opening the series master (review R1).
|
|
15
|
+
* Pointer-clicks never noticed — which is why a click-only e2e stayed green.
|
|
16
|
+
*
|
|
17
|
+
* The decision now lives here once, and the drift-guard holds all four bindings to
|
|
18
|
+
* it, so the next affordance added to the dialog inherits the fix instead of
|
|
19
|
+
* re-opening the hole.
|
|
20
|
+
*/
|
|
21
|
+
/** DOM-free descriptor of an `Enter` candidate inside the dialog. Mirrors the shape
|
|
22
|
+
* of `NormalizedKeyEvent`: the binding reads the DOM, the policy stays framework-
|
|
23
|
+
* and DOM-free. */
|
|
24
|
+
export interface DialogKeyEvent {
|
|
25
|
+
/** `KeyboardEvent.key`. */
|
|
26
|
+
readonly key: string;
|
|
27
|
+
/** `KeyboardEvent.shiftKey` — `Shift+Enter` stays a newline in the description. */
|
|
28
|
+
readonly shiftKey: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Does the focused target activate itself on `Enter` (a button or link)? The
|
|
31
|
+
* binding computes it with `isEnterActivatedTarget` from `@bimetal/a11y-dom`.
|
|
32
|
+
*/
|
|
33
|
+
readonly targetActivatesOnEnter: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `true` when this keystroke means "commit the dialog draft" — and the caller may
|
|
37
|
+
* therefore `preventDefault()` and save.
|
|
38
|
+
*
|
|
39
|
+
* `false` for every other key, for `Shift+Enter` (newline), and — the fix — when the
|
|
40
|
+
* focused control activates itself on `Enter`. In that last case the keystroke
|
|
41
|
+
* belongs to that control: let it bubble untouched so the browser fires its click.
|
|
42
|
+
*/
|
|
43
|
+
export declare function dialogEnterCommits(e: DialogKeyEvent): boolean;
|
|
44
|
+
//# sourceMappingURL=dialog-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-keys.d.ts","sourceRoot":"","sources":["../src/dialog-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;oBAEoB;AACpB,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,cAAc,GAAG,OAAO,CAE7D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard policy for the built-in event dialog.
|
|
3
|
+
*
|
|
4
|
+
* The v0.29 keyboard contract splits mechanism from policy: a render layer reads
|
|
5
|
+
* the DOM (`@bimetal/a11y-dom`), the DOM-free headless layer decides. `Enter`
|
|
6
|
+
* inside the dialog was the one keystroke that never got that treatment — all
|
|
7
|
+
* four bindings carried the same inline `if (e.key === 'Enter' && !e.shiftKey)`,
|
|
8
|
+
* a decision duplicated four times and therefore wrong four times at once.
|
|
9
|
+
*
|
|
10
|
+
* It was wrong because it never looked at WHERE the keystroke landed. `Enter` on
|
|
11
|
+
* a focused button inside the dialog bubbled to the container, `preventDefault()`
|
|
12
|
+
* cancelled the button's native click, and the dialog saved instead of activating
|
|
13
|
+
* the button. The series entry added in mcp-116/121 is exactly such a button: by
|
|
14
|
+
* keyboard it closed the dialog rather than opening the series master (review R1).
|
|
15
|
+
* Pointer-clicks never noticed — which is why a click-only e2e stayed green.
|
|
16
|
+
*
|
|
17
|
+
* The decision now lives here once, and the drift-guard holds all four bindings to
|
|
18
|
+
* it, so the next affordance added to the dialog inherits the fix instead of
|
|
19
|
+
* re-opening the hole.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* `true` when this keystroke means "commit the dialog draft" — and the caller may
|
|
23
|
+
* therefore `preventDefault()` and save.
|
|
24
|
+
*
|
|
25
|
+
* `false` for every other key, for `Shift+Enter` (newline), and — the fix — when the
|
|
26
|
+
* focused control activates itself on `Enter`. In that last case the keystroke
|
|
27
|
+
* belongs to that control: let it bubble untouched so the browser fires its click.
|
|
28
|
+
*/
|
|
29
|
+
export function dialogEnterCommits(e) {
|
|
30
|
+
return e.key === 'Enter' && !e.shiftKey && !e.targetActivatesOnEnter;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=dialog-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-keys.js","sourceRoot":"","sources":["../src/dialog-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAiBH;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,CAAiB;IAClD,OAAO,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC;AACvE,CAAC"}
|
package/dist/drag-helpers.d.ts
CHANGED
|
@@ -34,7 +34,6 @@ export declare function parseDragInfo(dataTransfer: DragDataReader | null | unde
|
|
|
34
34
|
export interface DragDataWriter {
|
|
35
35
|
setData(format: string, data: string): void;
|
|
36
36
|
effectAllowed: string;
|
|
37
|
-
setDragImage(image: unknown, x: number, y: number): void;
|
|
38
37
|
}
|
|
39
38
|
/**
|
|
40
39
|
* Schreibt den DragInfo-Payload (JSON unter `DRAG_MIME`) und setzt
|
|
@@ -43,14 +42,4 @@ export interface DragDataWriter {
|
|
|
43
42
|
* `'application/json'` aufrufen.
|
|
44
43
|
*/
|
|
45
44
|
export declare function writeCalendarDragData(dataTransfer: DragDataWriter, info: DragInfo): void;
|
|
46
|
-
/**
|
|
47
|
-
* Installiert ein transparentes 1×1-Element als Drag-Image und plant
|
|
48
|
-
* dessen Entfernung im nächsten Frame ein. Browser-only — headless ruft
|
|
49
|
-
* `globalThis.document` und `globalThis.requestAnimationFrame` strukturell
|
|
50
|
-
* auf, ohne DOM-lib zu fordern.
|
|
51
|
-
*
|
|
52
|
-
* Wird typischerweise von Resize-Drag-Startern aufgerufen, damit nicht das
|
|
53
|
-
* geklickte Resize-Handle als Drag-Image erscheint.
|
|
54
|
-
*/
|
|
55
|
-
export declare function installTransparentDragImage(dataTransfer: DragDataWriter): void;
|
|
56
45
|
//# sourceMappingURL=drag-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-helpers.d.ts","sourceRoot":"","sources":["../src/drag-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACzB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"drag-helpers.d.ts","sourceRoot":"","sources":["../src/drag-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EACzB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,MAAM,CAgBR;AAED,0DAA0D;AAC1D,eAAO,MAAM,SAAS,qBAAqB,CAAC;AAE5C,8EAA8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI,CAS9F;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAGxF"}
|
package/dist/drag-helpers.js
CHANGED
|
@@ -14,10 +14,20 @@ import { MINUTES_PER_HOUR, HOURS_PER_DAY } from '@bimetal/temporal';
|
|
|
14
14
|
* @param snapMinutes granularity to snap to (e.g. 15)
|
|
15
15
|
*/
|
|
16
16
|
export function snapTimeFromMouseY(clientY, gridRect, hourHeight, snapMinutes) {
|
|
17
|
+
// mcp-51 R1 (Review F5): snapMinutes ist nacktes user-supplied number aus
|
|
18
|
+
// config.core.granularity — 0/negativ/NaN produzierte "NaN:NaN" bzw. nach
|
|
19
|
+
// dem Monotonie-Fix sogar Stunde 24. Auf einen sinnvollen Schritt clampen.
|
|
20
|
+
const step = Number.isFinite(snapMinutes) && snapMinutes >= 1 ? Math.floor(snapMinutes) : 1;
|
|
17
21
|
const totalMinutes = Math.max(0, ((clientY - gridRect.top) / hourHeight) * MINUTES_PER_HOUR);
|
|
18
|
-
const snapped = Math.round(totalMinutes /
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
const snapped = Math.round(totalMinutes / step) * step;
|
|
23
|
+
// mcp-51 C7: clamp to the LAST snap slot strictly before midnight instead of
|
|
24
|
+
// clamping hour and minute separately — the old clamp mapped the very bottom
|
|
25
|
+
// edge (1440) to "23:00" while a slightly higher drop gave "23:45": moving
|
|
26
|
+
// the pointer DOWN jumped the time BACK. Monotonic now.
|
|
27
|
+
const lastSlot = (Math.ceil((HOURS_PER_DAY * MINUTES_PER_HOUR) / step) - 1) * step;
|
|
28
|
+
const clamped = Math.min(snapped, lastSlot);
|
|
29
|
+
const h = Math.floor(clamped / MINUTES_PER_HOUR);
|
|
30
|
+
const m = clamped % MINUTES_PER_HOUR;
|
|
21
31
|
return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`;
|
|
22
32
|
}
|
|
23
33
|
/** MIME type for drag/drop payloads in calendar views. */
|
|
@@ -49,21 +59,4 @@ export function writeCalendarDragData(dataTransfer, info) {
|
|
|
49
59
|
dataTransfer.setData(DRAG_MIME, JSON.stringify(info));
|
|
50
60
|
dataTransfer.effectAllowed = 'move';
|
|
51
61
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Installiert ein transparentes 1×1-Element als Drag-Image und plant
|
|
54
|
-
* dessen Entfernung im nächsten Frame ein. Browser-only — headless ruft
|
|
55
|
-
* `globalThis.document` und `globalThis.requestAnimationFrame` strukturell
|
|
56
|
-
* auf, ohne DOM-lib zu fordern.
|
|
57
|
-
*
|
|
58
|
-
* Wird typischerweise von Resize-Drag-Startern aufgerufen, damit nicht das
|
|
59
|
-
* geklickte Resize-Handle als Drag-Image erscheint.
|
|
60
|
-
*/
|
|
61
|
-
export function installTransparentDragImage(dataTransfer) {
|
|
62
|
-
const host = globalThis;
|
|
63
|
-
const ghost = host.document.createElement('div');
|
|
64
|
-
ghost.style.cssText = 'width:1px;height:1px;opacity:0';
|
|
65
|
-
host.document.body.appendChild(ghost);
|
|
66
|
-
dataTransfer.setDragImage(ghost, 0, 0);
|
|
67
|
-
host.requestAnimationFrame(() => ghost.remove());
|
|
68
|
-
}
|
|
69
62
|
//# sourceMappingURL=drag-helpers.js.map
|
package/dist/drag-helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-helpers.js","sourceRo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/
|
|
18
18
|
import type { CalendarEvent, CalendarDateTime } from '@bimetal/calendar-core';
|
|
19
19
|
import type { CalendarStore, Unsubscribe } from '@bimetal/calendar-data';
|
|
20
|
+
/**
|
|
21
|
+
* bimetal-151 R1 (Review F2/F3): jede mutierende Action meldet, ob sie WIRKLICH
|
|
22
|
+
* dispatcht hat (`true`) oder als No-op zurückkam (`false` — degenerierter
|
|
23
|
+
* Move, leerer Resize). Der Controller braucht genau diese Aussage für seinen
|
|
24
|
+
* Undo-Ledger; die vorherige Sonde („ist die Historie gewachsen?") war zweimal
|
|
25
|
+
* falsch: sie kostete pro Mutation zwei Voll-Stream-Filter samt structuredClone
|
|
26
|
+
* (getHistory klont), und unter Nebenläufigkeit maß sie FREMDE Events mit —
|
|
27
|
+
* ein eingespieltes Kompensations-Event im Await-Fenster hätte einen Ledger-
|
|
28
|
+
* Eintrag ohne eigenen Frame gebucht und die reparierte Tür wieder geöffnet.
|
|
29
|
+
*/
|
|
20
30
|
export interface EventActions {
|
|
21
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Current master events as an OWNED deep copy. Updated on every store change.
|
|
33
|
+
* Consumers that only read should derive from the store's `peekEvents()` instead —
|
|
34
|
+
* this accessor clones the whole list on every call (mcp-74).
|
|
35
|
+
*/
|
|
22
36
|
getEvents(): CalendarEvent[];
|
|
23
37
|
/** Get events expanded for a time range (recurring events produce instances). */
|
|
24
38
|
getEventsInRange(start: CalendarDateTime, end: CalendarDateTime): CalendarEvent[];
|
|
@@ -28,31 +42,32 @@ export interface EventActions {
|
|
|
28
42
|
* as `modifyInstance()` (creates an exception, master series unchanged).
|
|
29
43
|
* Optional `resourceId` reassigns the event's resource.
|
|
30
44
|
*/
|
|
31
|
-
moveEvent(event: CalendarEvent, dropDate: CalendarDateTime, dayOffset: number, resourceId?: string): Promise<
|
|
45
|
+
moveEvent(event: CalendarEvent, dropDate: CalendarDateTime, dayOffset: number, resourceId?: string): Promise<boolean>;
|
|
32
46
|
/** Same as moveEvent for timed events (date+time). Instance-aware. */
|
|
33
|
-
moveTimedEvent(event: CalendarEvent, dropDate: CalendarDateTime, dropTime: string, minuteOffset: number, resourceId?: string): Promise<
|
|
47
|
+
moveTimedEvent(event: CalendarEvent, dropDate: CalendarDateTime, dropTime: string, minuteOffset: number, resourceId?: string): Promise<boolean>;
|
|
34
48
|
/** Resize an allDay event by moving start or end edge. Instance-aware. */
|
|
35
|
-
resizeEvent(event: CalendarEvent, dropDate: CalendarDateTime, edge: 'start' | 'end'): Promise<
|
|
49
|
+
resizeEvent(event: CalendarEvent, dropDate: CalendarDateTime, edge: 'start' | 'end'): Promise<boolean>;
|
|
36
50
|
/** Resize a timed event by moving start or end edge. Instance-aware. */
|
|
37
|
-
resizeTimedEvent(event: CalendarEvent, dropDate: CalendarDateTime, dropTime: string, edge: 'start' | 'end'): Promise<
|
|
51
|
+
resizeTimedEvent(event: CalendarEvent, dropDate: CalendarDateTime, dropTime: string, edge: 'start' | 'end'): Promise<boolean>;
|
|
38
52
|
/**
|
|
39
53
|
* Day-grain resize used by Timeline view: always snaps to day boundaries
|
|
40
54
|
* regardless of event.allDay. Instance-aware.
|
|
41
55
|
*/
|
|
42
|
-
resizeEventByDay(event: CalendarEvent, dropDate: CalendarDateTime, edge: 'start' | 'end'): Promise<
|
|
56
|
+
resizeEventByDay(event: CalendarEvent, dropDate: CalendarDateTime, edge: 'start' | 'end'): Promise<boolean>;
|
|
43
57
|
/** Create or update an event (upsert). */
|
|
44
|
-
saveEvent(event: CalendarEvent): Promise<
|
|
58
|
+
saveEvent(event: CalendarEvent): Promise<boolean>;
|
|
45
59
|
/** Delete an event by id. */
|
|
46
|
-
deleteEvent(eventId: string): Promise<
|
|
60
|
+
deleteEvent(eventId: string): Promise<boolean>;
|
|
47
61
|
/** Modify a single instance of a recurring event. */
|
|
48
|
-
modifyInstance(masterId: string, instanceDate: CalendarDateTime, changes: Partial<CalendarEvent>): Promise<
|
|
62
|
+
modifyInstance(masterId: string, instanceDate: CalendarDateTime, changes: Partial<CalendarEvent>): Promise<boolean>;
|
|
49
63
|
/** Delete a single instance of a recurring event. */
|
|
50
|
-
deleteInstance(masterId: string, instanceDate: CalendarDateTime): Promise<
|
|
64
|
+
deleteInstance(masterId: string, instanceDate: CalendarDateTime): Promise<boolean>;
|
|
51
65
|
/**
|
|
52
|
-
* Subscribe to event changes
|
|
53
|
-
*
|
|
66
|
+
* Subscribe to event changes — **notification-only**, no payload (mcp-74). Called
|
|
67
|
+
* whenever the store state changes; re-read via the store's `peekEvents()` (cheap,
|
|
68
|
+
* stable refs) or `getEvents()` (owned copy). Returns an unsubscribe function.
|
|
54
69
|
*/
|
|
55
|
-
subscribe(
|
|
70
|
+
subscribe(listener: () => void): Unsubscribe;
|
|
56
71
|
/** Unsubscribe from the store. Call when the adapter is no longer needed. */
|
|
57
72
|
destroy(): void;
|
|
58
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-actions.d.ts","sourceRoot":"","sources":["../src/event-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAa,MAAM,wBAAwB,CAAC;AAGzF,OAAO,KAAK,EAAE,aAAa,EAA0C,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGjH,MAAM,WAAW,YAAY;IAC3B
|
|
1
|
+
{"version":3,"file":"event-actions.d.ts","sourceRoot":"","sources":["../src/event-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAa,MAAM,wBAAwB,CAAC;AAGzF,OAAO,KAAK,EAAE,aAAa,EAA0C,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGjH;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,SAAS,IAAI,aAAa,EAAE,CAAC;IAC7B,iFAAiF;IACjF,gBAAgB,CAAC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AC,OAAO,CAAC,CAAC;IACpH,qDAAqD;IACrD,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnF;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;IAC7C,6EAA6E;IAC7E,OAAO,IAAI,IAAI,CAAC;CACjB;AAiCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CA8FrE"}
|
package/dist/event-actions.js
CHANGED
|
@@ -51,83 +51,87 @@ function dispatchInstanceAware(store, event, changes) {
|
|
|
51
51
|
* Framework adapters wrap this with reactive state.
|
|
52
52
|
*/
|
|
53
53
|
export function createEventActions(store) {
|
|
54
|
-
|
|
54
|
+
// mcp-74 Slice B: the store channel is notification-only and the snapshot is the
|
|
55
|
+
// non-cloning `peekEvents()` ref (v0.30 perf spine). Before, ONE dispatch paid three
|
|
56
|
+
// deep clones — the store's per-subscriber `structuredClone(readModel)`, a
|
|
57
|
+
// `structuredClone([...state.events])` here, and one more per listener — all of which
|
|
58
|
+
// the single (read-only) consumer, `createCalendarController`, threw away.
|
|
59
|
+
// `events` is never mutated here; `getEvents()` stays the owning accessor.
|
|
60
|
+
let events = store.peekEvents();
|
|
55
61
|
const listeners = new Set();
|
|
56
|
-
const storeUnsub = store.
|
|
57
|
-
events =
|
|
58
|
-
for (const
|
|
59
|
-
|
|
62
|
+
const storeUnsub = store.subscribeInternal(() => {
|
|
63
|
+
events = store.peekEvents();
|
|
64
|
+
for (const listener of listeners) {
|
|
65
|
+
listener();
|
|
60
66
|
}
|
|
61
67
|
});
|
|
62
68
|
return {
|
|
63
|
-
getEvents: () => structuredClone(events),
|
|
69
|
+
getEvents: () => structuredClone([...events]),
|
|
64
70
|
getEventsInRange: (start, end) => store.getEventsInRange(start, end),
|
|
65
71
|
async moveEvent(event, dropDate, dayOffset, resourceId) {
|
|
66
72
|
const result = computeMoveRange(event, dropDate, dayOffset);
|
|
67
73
|
if (!result)
|
|
68
|
-
return; // v0.13.5: degenerated move → no-op
|
|
74
|
+
return false; // v0.13.5: degenerated move → no-op
|
|
69
75
|
const changes = resourceId !== undefined
|
|
70
76
|
? { ...result, resourceId }
|
|
71
77
|
: result;
|
|
72
|
-
await dispatchInstanceAware(store, event, changes);
|
|
78
|
+
return (await dispatchInstanceAware(store, event, changes)).length > 0;
|
|
73
79
|
},
|
|
74
80
|
async moveTimedEvent(event, dropDate, dropTime, minuteOffset, resourceId) {
|
|
75
81
|
const result = computeTimedMoveRange(event, dropDate, dropTime, minuteOffset);
|
|
76
82
|
if (!result)
|
|
77
|
-
return; // v0.13.5: degenerated move → no-op
|
|
83
|
+
return false; // v0.13.5: degenerated move → no-op
|
|
78
84
|
const changes = resourceId !== undefined
|
|
79
85
|
? { ...result, resourceId }
|
|
80
86
|
: result;
|
|
81
|
-
await dispatchInstanceAware(store, event, changes);
|
|
87
|
+
return (await dispatchInstanceAware(store, event, changes)).length > 0;
|
|
82
88
|
},
|
|
83
89
|
async resizeEvent(event, dropDate, edge) {
|
|
84
90
|
const result = computeResizeRange(event, dropDate, edge);
|
|
85
91
|
if (!result)
|
|
86
|
-
return;
|
|
87
|
-
await dispatchInstanceAware(store, event, result);
|
|
92
|
+
return false;
|
|
93
|
+
return (await dispatchInstanceAware(store, event, result)).length > 0;
|
|
88
94
|
},
|
|
89
95
|
async resizeTimedEvent(event, dropDate, dropTime, edge) {
|
|
90
96
|
const result = computeTimedResizeRange(event, dropDate, dropTime, edge);
|
|
91
97
|
if (!result)
|
|
92
|
-
return;
|
|
93
|
-
await dispatchInstanceAware(store, event, result);
|
|
98
|
+
return false;
|
|
99
|
+
return (await dispatchInstanceAware(store, event, result)).length > 0;
|
|
94
100
|
},
|
|
95
101
|
async resizeEventByDay(event, dropDate, edge) {
|
|
96
102
|
const dayStart = startOfDay(dropDate);
|
|
97
103
|
let newRange;
|
|
98
104
|
if (edge === 'start') {
|
|
99
105
|
if (!isBefore(dayStart, event.timeRange.end))
|
|
100
|
-
return;
|
|
106
|
+
return false;
|
|
101
107
|
newRange = createTimeRange(dayStart, event.timeRange.end);
|
|
102
108
|
}
|
|
103
109
|
else {
|
|
104
110
|
const newEnd = addDays(dayStart, 1);
|
|
105
111
|
if (!isAfter(newEnd, event.timeRange.start))
|
|
106
|
-
return;
|
|
112
|
+
return false;
|
|
107
113
|
newRange = createTimeRange(event.timeRange.start, newEnd);
|
|
108
114
|
}
|
|
109
|
-
await dispatchInstanceAware(store, event, { timeRange: newRange });
|
|
115
|
+
return (await dispatchInstanceAware(store, event, { timeRange: newRange })).length > 0;
|
|
110
116
|
},
|
|
111
117
|
async saveEvent(event) {
|
|
112
118
|
if (events.some(e => e.id === event.id)) {
|
|
113
|
-
await store.dispatch(updateEvent(event.id, buildSaveChanges(event)));
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
await store.dispatch(createEvent(event));
|
|
119
|
+
return (await store.dispatch(updateEvent(event.id, buildSaveChanges(event)))).length > 0;
|
|
117
120
|
}
|
|
121
|
+
return (await store.dispatch(createEvent(event))).length > 0;
|
|
118
122
|
},
|
|
119
123
|
async deleteEvent(eventId) {
|
|
120
|
-
await store.dispatch(deleteCmd(eventId));
|
|
124
|
+
return (await store.dispatch(deleteCmd(eventId))).length > 0;
|
|
121
125
|
},
|
|
122
126
|
async modifyInstance(masterId, instanceDate, changes) {
|
|
123
|
-
await store.dispatch(modifyInstance(masterId, instanceDate, changes));
|
|
127
|
+
return (await store.dispatch(modifyInstance(masterId, instanceDate, changes))).length > 0;
|
|
124
128
|
},
|
|
125
129
|
async deleteInstance(masterId, instanceDate) {
|
|
126
|
-
await store.dispatch(deleteInstance(masterId, instanceDate));
|
|
130
|
+
return (await store.dispatch(deleteInstance(masterId, instanceDate))).length > 0;
|
|
127
131
|
},
|
|
128
|
-
subscribe(
|
|
129
|
-
listeners.add(
|
|
130
|
-
return () => { listeners.delete(
|
|
132
|
+
subscribe(listener) {
|
|
133
|
+
listeners.add(listener);
|
|
134
|
+
return () => { listeners.delete(listener); };
|
|
131
135
|
},
|
|
132
136
|
destroy() {
|
|
133
137
|
storeUnsub();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-actions.js","sourceRoot":"","sources":["../src/event-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE/K,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,IAAI,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"event-actions.js","sourceRoot":"","sources":["../src/event-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAE/K,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,IAAI,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA6D5H;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,KAAoB;IAC9C,MAAM,OAAO,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;IACrD,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO;QACL,QAAQ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O;YACL,UAAU,EAAE,CAAC;YACb,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/grid-geometry.d.ts
CHANGED
|
@@ -14,13 +14,13 @@ export declare const WEEK_NUM_COL_WIDTH = 36;
|
|
|
14
14
|
* Which day column (0..colCount-1) the cursor is over, from the mouse X relative
|
|
15
15
|
* to a week-row's bounding rect (accounting for the leading week-number column).
|
|
16
16
|
*/
|
|
17
|
-
export declare function getColFromX(clientX: number, rowRect: GridRowRect, colCount?: number): number;
|
|
17
|
+
export declare function getColFromX(clientX: number, rowRect: GridRowRect, colCount?: number, rtl?: boolean): number;
|
|
18
18
|
/**
|
|
19
19
|
* Which day column for a TIME grid — the week/day/all-day rows whose leading
|
|
20
20
|
* gutter is a time-LABEL column (`labelWidth` px), NOT the week-number column.
|
|
21
21
|
* Same math as `getColFromX` with a configurable gutter. (B-CAL-3.)
|
|
22
22
|
*/
|
|
23
|
-
export declare function colFromTimeGridX(clientX: number, rowRect: GridRowRect, labelWidth: number, colCount?: number): number;
|
|
23
|
+
export declare function colFromTimeGridX(clientX: number, rowRect: GridRowRect, labelWidth: number, colCount?: number, rtl?: boolean): number;
|
|
24
24
|
/**
|
|
25
25
|
* THE week time-grid hit-test: day column + snapped `HH:MM`, composed from the
|
|
26
26
|
* shared `colFromTimeGridX` + `snapTimeFromMouseY`. Replaces the per-view
|
|
@@ -39,6 +39,7 @@ export declare function timeGridHit(point: {
|
|
|
39
39
|
hourHeight: number;
|
|
40
40
|
snapMinutes: number;
|
|
41
41
|
colCount?: number;
|
|
42
|
+
rtl?: boolean;
|
|
42
43
|
}): {
|
|
43
44
|
col: number;
|
|
44
45
|
time: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-geometry.d.ts","sourceRoot":"","sources":["../src/grid-geometry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,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AG,CAAC,EAAE,OAAO,CAAA;CAAE,GACtG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAK/B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
package/dist/grid-geometry.js
CHANGED
|
@@ -10,22 +10,27 @@ export const WEEK_NUM_COL_WIDTH = 36;
|
|
|
10
10
|
* Which day column (0..colCount-1) the cursor is over, from the mouse X relative
|
|
11
11
|
* to a week-row's bounding rect (accounting for the leading week-number column).
|
|
12
12
|
*/
|
|
13
|
-
export function getColFromX(clientX, rowRect, colCount = 7) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export function getColFromX(clientX, rowRect, colCount = 7, rtl = false) {
|
|
14
|
+
return colFromGutteredRow(clientX, rowRect, WEEK_NUM_COL_WIDTH, colCount, rtl);
|
|
15
|
+
}
|
|
16
|
+
/** Shared guttered-row math (mcp-91 C-5, dir-aware): the gutter (week-number /
|
|
17
|
+
* time-label column) sits at INLINE-START — physically LEFT in ltr, RIGHT in
|
|
18
|
+
* rtl (the bindings position it with logical insets). Logical column 0 is the
|
|
19
|
+
* first date and sits at inline-start of the day area, so under rtl the
|
|
20
|
+
* physical column index inverts. */
|
|
21
|
+
function colFromGutteredRow(clientX, rowRect, gutter, colCount, rtl) {
|
|
22
|
+
const dayAreaWidth = rowRect.width - gutter;
|
|
23
|
+
const x = rtl ? clientX - rowRect.left : clientX - rowRect.left - gutter;
|
|
24
|
+
const phys = Math.max(0, Math.min(colCount - 1, Math.floor((x / dayAreaWidth) * colCount)));
|
|
25
|
+
return rtl ? colCount - 1 - phys : phys;
|
|
18
26
|
}
|
|
19
27
|
/**
|
|
20
28
|
* Which day column for a TIME grid — the week/day/all-day rows whose leading
|
|
21
29
|
* gutter is a time-LABEL column (`labelWidth` px), NOT the week-number column.
|
|
22
30
|
* Same math as `getColFromX` with a configurable gutter. (B-CAL-3.)
|
|
23
31
|
*/
|
|
24
|
-
export function colFromTimeGridX(clientX, rowRect, labelWidth, colCount = 7) {
|
|
25
|
-
|
|
26
|
-
const dayAreaWidth = rowRect.width - labelWidth;
|
|
27
|
-
const col = Math.floor((x / dayAreaWidth) * colCount);
|
|
28
|
-
return Math.max(0, Math.min(colCount - 1, col));
|
|
32
|
+
export function colFromTimeGridX(clientX, rowRect, labelWidth, colCount = 7, rtl = false) {
|
|
33
|
+
return colFromGutteredRow(clientX, rowRect, labelWidth, colCount, rtl);
|
|
29
34
|
}
|
|
30
35
|
/**
|
|
31
36
|
* THE week time-grid hit-test: day column + snapped `HH:MM`, composed from the
|
|
@@ -35,7 +40,7 @@ export function colFromTimeGridX(clientX, rowRect, labelWidth, colCount = 7) {
|
|
|
35
40
|
*/
|
|
36
41
|
export function timeGridHit(point, rect, opts) {
|
|
37
42
|
return {
|
|
38
|
-
col: colFromTimeGridX(point.x, rect, opts.labelWidth, opts.colCount),
|
|
43
|
+
col: colFromTimeGridX(point.x, rect, opts.labelWidth, opts.colCount, opts.rtl ?? false),
|
|
39
44
|
time: snapTimeFromMouseY(point.y, rect, opts.hourHeight, opts.snapMinutes),
|
|
40
45
|
};
|
|
41
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-geometry.js","sourceRoot":"","sources":["../src/grid-geometry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAQvD,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,OAAoB,EAAE,QAAQ,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"grid-geometry.js","sourceRoot":"","sources":["../src/grid-geometry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE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D,IAAuG;IAEvG,OAAO;QACL,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC;QACvF,IAAI,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAiB;IACtD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event → Anzeigezeile: die EINE Ableitung hinter der eingebauten Historie
|
|
3
|
+
* (`EventHistory` in react/vue/svelte/angular).
|
|
4
|
+
*
|
|
5
|
+
* Bis bimetal-147 lag dieselbe `switch (event.type)`-Ableitung vier Mal in den
|
|
6
|
+
* Hüllen — und war deshalb vier Mal unvollständig: keine der vier rendert den
|
|
7
|
+
* Akteur, obwohl der Audit-Pfad ihn seit jeher trägt
|
|
8
|
+
* (`EventMetadataProvider.userId` → `wrapIntents` → `event.metadata.userId`).
|
|
9
|
+
* Genau das ist die Klasse Defekt, die der kanonische Controller ausschließen
|
|
10
|
+
* soll: jedes `if` gehört in den Controller, die Hüllen malen nur.
|
|
11
|
+
*
|
|
12
|
+
* Der Akteur ist eine **Id**, kein Name — Event Sourcing kennt keine
|
|
13
|
+
* Personalstammdaten. Diese Ableitung erfindet deshalb keinen Namen, sondern:
|
|
14
|
+
* - zeigt die Id roh an, wenn der Consumer nichts anderes sagt, und
|
|
15
|
+
* - lässt ihn über den `resolveActor`-Hook (Controller-Option, wie
|
|
16
|
+
* `eventInteraction`) auf einen anzeigbaren Namen abbilden.
|
|
17
|
+
*
|
|
18
|
+
* Der Fall „kein `userId` gesetzt" ist der NORMALFALL — `metadata` am Store ist
|
|
19
|
+
* optional, wer den Provider nie konfiguriert hat, hat in JEDER Zeile keine Id.
|
|
20
|
+
* Ein „Unbekannt" in jeder Zeile wäre für ihn reines Rauschen. Die Entscheidung
|
|
21
|
+
* fällt deshalb über die LISTE, nicht über die einzelne Zeile (und genau darum
|
|
22
|
+
* bekommt die Ableitung die ganze Historie, nicht ein Event):
|
|
23
|
+
* - trägt KEINE Zeile eine `userId` → gar keine Akteur-Spalte (`actor:
|
|
24
|
+
* undefined`), die Zeile bleibt exakt so wie vor bimetal-147;
|
|
25
|
+
* - trägt MINDESTENS EINE Zeile eine → die Lücken der anderen sind eine echte
|
|
26
|
+
* Aussage („hier fehlt der Akteur") und werden mit
|
|
27
|
+
* `locale.historyUnknownActor` beschriftet.
|
|
28
|
+
*/
|
|
29
|
+
import type { DomainEvent } from '@bimetal/calendar-data';
|
|
30
|
+
import type { CalendarLocale } from './controller/types.js';
|
|
31
|
+
/**
|
|
32
|
+
* Eine anzeigefertige Zeile der Event-Historie. Alles, was die vier
|
|
33
|
+
* `EventHistory`-Hüllen zum Malen brauchen — sie leiten nichts mehr selbst ab.
|
|
34
|
+
*/
|
|
35
|
+
export interface CalendarHistoryEntry {
|
|
36
|
+
/** Stabiler Listen-Key: die Envelope-Id des ES-Events. */
|
|
37
|
+
readonly id: string;
|
|
38
|
+
/** Roher Domain-Event-Typ — nur noch für die typabhängige Einfärbung. */
|
|
39
|
+
readonly type: string;
|
|
40
|
+
/** Lokalisiertes Badge-Label (`locale.historyEventTypes[type]`, sonst der Typ). */
|
|
41
|
+
readonly label: string;
|
|
42
|
+
/** Lokalisierter Zeitstempel (`formatHistoryTimestamp`). */
|
|
43
|
+
readonly time: string;
|
|
44
|
+
/** Kurzfassung: Titel beim Anlegen, geänderte Feldnamen beim Ändern, sonst ''. */
|
|
45
|
+
readonly summary: string;
|
|
46
|
+
/**
|
|
47
|
+
* WER — der anzeigbare Text. `undefined` heißt: diese Zeile rendert KEINEN
|
|
48
|
+
* Akteur (siehe Modulkommentar: gilt genau dann, wenn die ganze Historie
|
|
49
|
+
* ohne `userId` läuft).
|
|
50
|
+
*/
|
|
51
|
+
readonly actor?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Die rohe Audit-Id hinter {@link actor} — `undefined`, wenn das Event keine
|
|
54
|
+
* trägt. Bleibt neben dem aufgelösten Namen erhalten, weil die Id die
|
|
55
|
+
* Tatsache ist und der Name nur ihre Darstellung (Avatar, Deep-Link, Test).
|
|
56
|
+
*/
|
|
57
|
+
readonly userId?: string;
|
|
58
|
+
}
|
|
59
|
+
/** Was {@link deriveHistoryEntries} zum Ableiten braucht. */
|
|
60
|
+
export interface HistoryEntryOptions {
|
|
61
|
+
readonly locale: CalendarLocale;
|
|
62
|
+
/**
|
|
63
|
+
* IANA-Zeitzone für den Zeitstempel. Weglassen heißt Runtime-Zeitzone —
|
|
64
|
+
* für SSR-Determinismus explizit setzen (siehe `formatHistoryTimestamp`).
|
|
65
|
+
*/
|
|
66
|
+
readonly timezone?: string;
|
|
67
|
+
/** Akteur-Auflösung Id → Name (siehe `CalendarControllerOptions.resolveActor`). */
|
|
68
|
+
readonly resolveActor?: (userId: string) => string | undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Leitet die anzeigefertigen Zeilen aus der rohen Event-Historie einer Entität
|
|
72
|
+
* ab (`store.getHistory(entityId)` / `controller.getHistory(entityId)`).
|
|
73
|
+
*
|
|
74
|
+
* Rein und ohne DOM — die vier Bindings rufen das über
|
|
75
|
+
* `controller.getHistoryEntries(entityId)` auf, nie selbst.
|
|
76
|
+
*/
|
|
77
|
+
export declare function deriveHistoryEntries(history: readonly DomainEvent[], options: HistoryEntryOptions): CalendarHistoryEntry[];
|
|
78
|
+
//# sourceMappingURL=history-entries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-entries.d.ts","sourceRoot":"","sources":["../src/history-entries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,6DAA6D;AAC7D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,mFAAmF;IACnF,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAChE;AA8BD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,OAAO,EAAE,mBAAmB,GAC3B,oBAAoB,EAAE,CA0BxB"}
|