@almadar/patterns 2.17.0 → 2.17.1

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 (2) hide show
  1. package/dist/payloads.d.ts +16 -11
  2. package/package.json +1 -1
@@ -26,7 +26,7 @@
26
26
  *
27
27
  * @packageDocumentation
28
28
  */
29
- import type { EventPayloadValue, FieldValue } from '@almadar/core';
29
+ import type { EventPayload, EventPayloadValue, FieldValue } from '@almadar/core';
30
30
  /**
31
31
  * Payload dispatched by per-item action buttons in data patterns
32
32
  * (DataGrid, DataList, Timeline, CardGrid, List, ...).
@@ -39,13 +39,17 @@ import type { EventPayloadValue, FieldValue } from '@almadar/core';
39
39
  *
40
40
  * Generic over the row shape. `DataGridItemAction` used on `CartItem[]`
41
41
  * gives the trait `ItemActionPayload<CartItem>`, not `unknown`.
42
+ *
43
+ * Intersected with `EventPayload` so the whole thing is structurally
44
+ * compatible with `eventBus.emit`'s typed parameter — interfaces alone
45
+ * aren't assignable to `EventPayload`'s index signature in strict mode.
42
46
  */
43
- export interface ItemActionPayload<T extends EventPayloadValue = EventPayloadValue> {
47
+ export type ItemActionPayload<T extends EventPayloadValue = EventPayloadValue> = EventPayload & {
44
48
  /** Row primary key. */
45
49
  id: string | number;
46
50
  /** Full row data at click time. */
47
51
  row: T;
48
- }
52
+ };
49
53
  /**
50
54
  * Payload dispatched when a selection-capable data pattern observes a
51
55
  * selection change (`selectionEvent` on DataGrid / DataList / ...).
@@ -53,19 +57,20 @@ export interface ItemActionPayload<T extends EventPayloadValue = EventPayloadVal
53
57
  * reconcile against its row set to recompute derived state ("bulk
54
58
  * enabled", "3 items selected", etc.).
55
59
  */
56
- export interface SelectionChangePayload {
57
- selectedIds: string[];
58
- }
60
+ export type SelectionChangePayload = EventPayload & {
61
+ selectedIds: readonly string[];
62
+ };
59
63
  /**
60
64
  * Payload dispatched when an infinite-scroll-enabled pattern's sentinel
61
65
  * becomes visible (`loadMoreEvent` on DataGrid / DataList /
62
66
  * InfiniteScrollSentinel).
63
67
  *
64
68
  * No fields required — the receiving trait knows its own cursor (last
65
- * loaded page, current offset). Declared as an empty record so consumers
66
- * can pattern-match on the event without checking payload shape.
69
+ * loaded page, current offset). Declared as `EventPayload` (the empty-
70
+ * object bound) so consumers can pass `{}` and listeners can
71
+ * destructure without runtime checks.
67
72
  */
68
- export type LoadMoreRequestPayload = Record<string, never>;
73
+ export type LoadMoreRequestPayload = EventPayload;
69
74
  /**
70
75
  * Payload dispatched by a schema-driven `Form` on successful submit
71
76
  * (`submitEvent`). `data` holds the form's collected field values.
@@ -75,6 +80,6 @@ export type LoadMoreRequestPayload = Record<string, never>;
75
80
  * handler, and a generic form falls back to the `FieldValue`-keyed
76
81
  * default.
77
82
  */
78
- export interface FormSubmitPayload<T extends Record<string, FieldValue | undefined> = Record<string, FieldValue | undefined>> {
83
+ export type FormSubmitPayload<T extends Record<string, FieldValue | undefined> = Record<string, FieldValue | undefined>> = EventPayload & {
79
84
  data: T;
80
- }
85
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/patterns",
3
- "version": "2.17.0",
3
+ "version": "2.17.1",
4
4
  "description": "Pattern registry and component mappings for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",