@almadar/ui 3.4.0 → 3.5.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.
- package/dist/avl/index.cjs +73 -58
- package/dist/avl/index.js +73 -58
- package/dist/components/atoms/Avatar.d.ts +2 -2
- package/dist/components/atoms/Box.d.ts +3 -3
- package/dist/components/atoms/Button.d.ts +2 -2
- package/dist/components/atoms/InfiniteScrollSentinel.d.ts +3 -2
- package/dist/components/atoms/RangeSlider.d.ts +2 -2
- package/dist/components/atoms/Stack.d.ts +2 -2
- package/dist/components/atoms/TextHighlight.d.ts +1 -1
- package/dist/components/atoms/game/ControlButton.d.ts +3 -2
- package/dist/components/index.cjs +73 -55
- package/dist/components/index.js +73 -55
- package/dist/components/molecules/Alert.d.ts +2 -1
- package/dist/components/molecules/CalendarGrid.d.ts +2 -1
- package/dist/components/molecules/Card.d.ts +2 -2
- package/dist/components/molecules/DataGrid.d.ts +2 -2
- package/dist/components/molecules/DataList.d.ts +5 -5
- package/dist/components/molecules/Drawer.d.ts +2 -1
- package/dist/components/molecules/NumberStepper.d.ts +2 -2
- package/dist/components/molecules/PullToRefresh.d.ts +3 -2
- package/dist/components/molecules/SortableList.d.ts +5 -4
- package/dist/components/molecules/StarRating.d.ts +2 -2
- package/dist/components/molecules/SwipeableRow.d.ts +3 -3
- package/dist/components/molecules/UploadDropZone.d.ts +2 -2
- package/dist/components/molecules/game/DialogueBox.d.ts +3 -2
- package/dist/components/molecules/game/GameMenu.d.ts +3 -3
- package/dist/components/molecules/game/GameOverScreen.d.ts +3 -2
- package/dist/components/molecules/game/InventoryPanel.d.ts +3 -2
- package/dist/components/organisms/ComponentPatterns.d.ts +52 -22
- package/dist/components/organisms/CustomPattern.d.ts +3 -3
- package/dist/components/organisms/GraphCanvas.d.ts +3 -2
- package/dist/components/organisms/game/three/index.cjs +0 -3
- package/dist/components/organisms/game/three/index.js +0 -3
- package/dist/docs/index.cjs +0 -3
- package/dist/docs/index.d.cts +5 -5
- package/dist/docs/index.js +0 -3
- package/dist/hooks/event-bus-types.d.ts +10 -10
- package/dist/hooks/index.cjs +0 -3
- package/dist/hooks/index.js +0 -3
- package/dist/hooks/useDraggable.d.ts +2 -1
- package/dist/hooks/useEventBus.d.ts +2 -1
- package/dist/lib/verificationRegistry.d.ts +2 -2
- package/dist/marketing/index.cjs +0 -3
- package/dist/marketing/index.d.cts +5 -5
- package/dist/marketing/index.js +0 -3
- package/dist/providers/index.cjs +73 -58
- package/dist/providers/index.js +73 -58
- package/dist/runtime/createClientEffectHandlers.d.ts +2 -1
- package/dist/runtime/index.cjs +73 -55
- package/dist/runtime/index.js +73 -55
- package/package.json +6 -3
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
* Uses useSwipeGesture for gesture detection and useEventBus for event emission.
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import type { EventKey } from "@almadar/core";
|
|
9
|
+
import type { EventKey, EventPayload } from "@almadar/core";
|
|
10
10
|
export interface SwipeAction {
|
|
11
11
|
label: string;
|
|
12
12
|
icon?: string;
|
|
13
13
|
variant?: 'primary' | 'secondary' | 'danger' | 'ghost';
|
|
14
14
|
event: EventKey;
|
|
15
|
-
eventPayload?:
|
|
15
|
+
eventPayload?: EventPayload;
|
|
16
16
|
}
|
|
17
17
|
export interface SwipeableRowProps {
|
|
18
18
|
leftActions?: SwipeAction[];
|
|
19
19
|
rightActions?: SwipeAction[];
|
|
20
20
|
threshold?: number;
|
|
21
21
|
children: React.ReactNode;
|
|
22
|
-
itemData?:
|
|
22
|
+
itemData?: EventPayload;
|
|
23
23
|
className?: string;
|
|
24
24
|
}
|
|
25
25
|
export declare const SwipeableRow: React.FC<SwipeableRowProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { EventKey } from "@almadar/core";
|
|
2
|
+
import type { EventKey, EventPayload } from "@almadar/core";
|
|
3
3
|
export interface UploadDropZoneProps {
|
|
4
4
|
/** Accepted MIME types (e.g., "image/*", "application/pdf") */
|
|
5
5
|
accept?: string;
|
|
@@ -18,7 +18,7 @@ export interface UploadDropZoneProps {
|
|
|
18
18
|
/** Declarative event name for file selection */
|
|
19
19
|
action?: EventKey;
|
|
20
20
|
/** Payload to include with the action event */
|
|
21
|
-
actionPayload?:
|
|
21
|
+
actionPayload?: EventPayload;
|
|
22
22
|
/** Direct onFiles callback */
|
|
23
23
|
onFiles?: (files: File[]) => void;
|
|
24
24
|
/** Additional CSS classes */
|
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
* concern analogous to Form's `formData`.
|
|
13
13
|
*/
|
|
14
14
|
import React from 'react';
|
|
15
|
-
|
|
15
|
+
import type { EventPayload } from '@almadar/core';
|
|
16
|
+
export type DialogueChoice = EventPayload & {
|
|
16
17
|
text: string;
|
|
17
18
|
action?: string;
|
|
18
19
|
next?: string;
|
|
19
20
|
disabled?: boolean;
|
|
20
|
-
}
|
|
21
|
+
};
|
|
21
22
|
export interface DialogueNode {
|
|
22
23
|
id?: string;
|
|
23
24
|
speaker: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { EventKey } from "@almadar/core";
|
|
1
|
+
import type { EventKey, EventPayload } from "@almadar/core";
|
|
2
2
|
import { type EventBusContextType } from "../../../hooks/useEventBus";
|
|
3
|
-
export
|
|
3
|
+
export type MenuOption = EventPayload & {
|
|
4
4
|
/** Optional ID (generated from index if not provided) */
|
|
5
5
|
id?: string;
|
|
6
6
|
/** Display label */
|
|
@@ -17,7 +17,7 @@ export interface MenuOption {
|
|
|
17
17
|
subLabel?: string;
|
|
18
18
|
/** Action identifier (alternative to event) */
|
|
19
19
|
action?: EventKey;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
export interface GameMenuProps {
|
|
22
22
|
/** Menu title */
|
|
23
23
|
title: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { EventPayload } from "@almadar/core";
|
|
2
3
|
import { type EventBusContextType } from "../../../hooks/useEventBus";
|
|
3
4
|
export interface GameOverStat {
|
|
4
5
|
/** Stat label */
|
|
@@ -16,7 +17,7 @@ export interface GameOverStat {
|
|
|
16
17
|
/** Icon */
|
|
17
18
|
icon?: React.ReactNode;
|
|
18
19
|
}
|
|
19
|
-
export
|
|
20
|
+
export type GameOverAction = EventPayload & {
|
|
20
21
|
/** Display label */
|
|
21
22
|
label: string;
|
|
22
23
|
/** Event to emit on click */
|
|
@@ -25,7 +26,7 @@ export interface GameOverAction {
|
|
|
25
26
|
navigatesTo?: string;
|
|
26
27
|
/** Button variant */
|
|
27
28
|
variant?: "primary" | "secondary" | "ghost";
|
|
28
|
-
}
|
|
29
|
+
};
|
|
29
30
|
export interface GameOverScreenProps {
|
|
30
31
|
/** Screen title (e.g., "Game Over", "Victory!") */
|
|
31
32
|
title: string;
|
|
@@ -11,14 +11,15 @@
|
|
|
11
11
|
* Local state is hover/tooltip only — rendering-only concerns.
|
|
12
12
|
*/
|
|
13
13
|
import React from 'react';
|
|
14
|
-
|
|
14
|
+
import type { EventPayload } from "@almadar/core";
|
|
15
|
+
export type InventoryItem = EventPayload & {
|
|
15
16
|
id: string;
|
|
16
17
|
type: string;
|
|
17
18
|
quantity: number;
|
|
18
19
|
sprite?: string;
|
|
19
20
|
name?: string;
|
|
20
21
|
description?: string;
|
|
21
|
-
}
|
|
22
|
+
};
|
|
22
23
|
export interface InventoryPanelProps {
|
|
23
24
|
/** Array of items in inventory */
|
|
24
25
|
items: InventoryItem[];
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
11
|
import React from 'react';
|
|
12
|
-
import {
|
|
12
|
+
import type { EventKey, EventPayload } from '@almadar/core';
|
|
13
|
+
import { type ButtonProps } from '../atoms/Button';
|
|
13
14
|
import { type BadgeVariant } from '../atoms/Badge';
|
|
14
15
|
import { type AlertVariant } from '../molecules/Alert';
|
|
15
16
|
import { type MapViewProps } from '../molecules/MapView';
|
|
@@ -22,36 +23,54 @@ interface ClosedCircuitProps {
|
|
|
22
23
|
error?: Error | null;
|
|
23
24
|
entity?: string;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Props for {@link ButtonPattern}. A thin pass-through over the Button
|
|
28
|
+
* atom: accepts every Button prop plus wrapper-level aliases for the
|
|
29
|
+
* `.orb` schema convention (`action`/`event`/`onClick` as string
|
|
30
|
+
* event names, `iconPosition` for left/right icon placement).
|
|
31
|
+
*
|
|
32
|
+
* Anything not explicitly named is forwarded to `<Button>` via rest-spread,
|
|
33
|
+
* so a future Button prop lands automatically without needing a wrapper
|
|
34
|
+
* edit. This is the contract that fixes VG17: `action: EventKey` flows
|
|
35
|
+
* through to Button, which owns both `UI:{action}` emit AND the
|
|
36
|
+
* `data-testid="action-{NAME}"` attribute the verifier selects on.
|
|
37
|
+
*/
|
|
38
|
+
export interface ButtonPatternProps extends Omit<ButtonProps, 'onClick'>, ClosedCircuitProps {
|
|
39
|
+
/** Legacy alias for {@link ButtonProps.action} (string event name). */
|
|
40
|
+
onClick?: EventKey;
|
|
41
|
+
/** Legacy alias for {@link ButtonProps.action}. */
|
|
42
|
+
event?: EventKey;
|
|
43
|
+
/** Icon placement — maps to Button's `icon` (left) or `iconRight` (right). */
|
|
33
44
|
iconPosition?: 'left' | 'right';
|
|
34
|
-
className?: string;
|
|
35
45
|
}
|
|
36
46
|
/**
|
|
37
|
-
* Button pattern
|
|
47
|
+
* Button pattern — thin pass-through to the Button atom.
|
|
48
|
+
*
|
|
49
|
+
* Prior to VG17 this wrapper owned a local event-bus emit and
|
|
50
|
+
* hand-enumerated only a narrow slice of props, silently dropping
|
|
51
|
+
* every prop outside that list (including the Pre-Phase `action:
|
|
52
|
+
* EventKey`). The atom already handles emit + data-testid via its
|
|
53
|
+
* `action` prop, so the wrapper simply forwards everything.
|
|
38
54
|
*/
|
|
39
|
-
export declare function ButtonPattern({
|
|
55
|
+
export declare function ButtonPattern({ action, onClick, event, icon, iconPosition, ...rest }: ButtonPatternProps): React.ReactElement;
|
|
40
56
|
export declare namespace ButtonPattern {
|
|
41
57
|
var displayName: string;
|
|
42
58
|
}
|
|
43
|
-
export interface IconButtonPatternProps extends ClosedCircuitProps {
|
|
59
|
+
export interface IconButtonPatternProps extends Omit<ButtonProps, 'onClick'>, ClosedCircuitProps {
|
|
44
60
|
icon: string;
|
|
45
|
-
variant?: ButtonVariant;
|
|
46
|
-
size?: ButtonSize;
|
|
47
|
-
onClick?: string;
|
|
48
61
|
ariaLabel?: string;
|
|
49
|
-
|
|
62
|
+
/** Legacy alias for {@link ButtonProps.action}. */
|
|
63
|
+
onClick?: EventKey;
|
|
64
|
+
/** Legacy alias for {@link ButtonProps.action}. */
|
|
65
|
+
event?: EventKey;
|
|
50
66
|
}
|
|
51
67
|
/**
|
|
52
|
-
* Icon-only button pattern
|
|
68
|
+
* Icon-only button pattern — pass-through to the Button atom with a
|
|
69
|
+
* mandatory icon and optional aria-label. Same VG17 fix as
|
|
70
|
+
* {@link ButtonPattern}: `action` forwards to the atom, which owns the
|
|
71
|
+
* emit + data-testid.
|
|
53
72
|
*/
|
|
54
|
-
export declare function IconButtonPattern({
|
|
73
|
+
export declare function IconButtonPattern({ action, onClick, event, icon, ariaLabel, variant, ...rest }: IconButtonPatternProps): React.ReactElement;
|
|
55
74
|
export declare namespace IconButtonPattern {
|
|
56
75
|
var displayName: string;
|
|
57
76
|
}
|
|
@@ -59,13 +78,24 @@ export interface LinkPatternProps extends ClosedCircuitProps {
|
|
|
59
78
|
label: string;
|
|
60
79
|
href?: string;
|
|
61
80
|
external?: boolean;
|
|
62
|
-
|
|
81
|
+
/** Event key emitted on click (intercepts native navigation when set). */
|
|
82
|
+
action?: EventKey;
|
|
83
|
+
/** Legacy alias for action. */
|
|
84
|
+
onClick?: EventKey;
|
|
85
|
+
/** Legacy alias for action. */
|
|
86
|
+
event?: EventKey;
|
|
87
|
+
/** Payload for the dispatched event. */
|
|
88
|
+
actionPayload?: EventPayload;
|
|
63
89
|
className?: string;
|
|
64
90
|
}
|
|
65
91
|
/**
|
|
66
|
-
* Link pattern for navigation.
|
|
92
|
+
* Link pattern for navigation. When an event key is provided via
|
|
93
|
+
* `action` / `onClick` / `event`, intercepts the native `<a>`
|
|
94
|
+
* navigation and emits `UI:{action}` with the `href` in the payload.
|
|
95
|
+
* Sets `data-testid="action-{NAME}"` so the verifier's click-path
|
|
96
|
+
* gate can select it symmetrically with Button.
|
|
67
97
|
*/
|
|
68
|
-
export declare function LinkPattern({ label, href, external, onClick, className, }: LinkPatternProps): React.ReactElement;
|
|
98
|
+
export declare function LinkPattern({ label, href, external, action, onClick, event, actionPayload, className, }: LinkPatternProps): React.ReactElement;
|
|
69
99
|
export declare namespace LinkPattern {
|
|
70
100
|
var displayName: string;
|
|
71
101
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import React from "react";
|
|
11
|
-
import type { EventKey } from "@almadar/core";
|
|
11
|
+
import type { EventKey, EventPayload } from "@almadar/core";
|
|
12
12
|
/**
|
|
13
13
|
* Allowed element types for custom patterns.
|
|
14
14
|
*/
|
|
@@ -34,7 +34,7 @@ export interface CustomPatternProps {
|
|
|
34
34
|
/** Event to emit on click (REQUIRED for interactive elements) */
|
|
35
35
|
action?: EventKey;
|
|
36
36
|
/** Event payload */
|
|
37
|
-
payload?:
|
|
37
|
+
payload?: EventPayload;
|
|
38
38
|
/** Nested children patterns */
|
|
39
39
|
children?: React.ReactNode;
|
|
40
40
|
/** Image source (for img elements) */
|
|
@@ -83,7 +83,7 @@ export interface CustomPatternConfig {
|
|
|
83
83
|
token?: string | string[];
|
|
84
84
|
content?: string;
|
|
85
85
|
action?: EventKey;
|
|
86
|
-
payload?:
|
|
86
|
+
payload?: EventPayload;
|
|
87
87
|
children?: CustomPatternConfig[];
|
|
88
88
|
src?: string;
|
|
89
89
|
alt?: string;
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* - className for external styling
|
|
12
12
|
*/
|
|
13
13
|
import React from "react";
|
|
14
|
-
|
|
14
|
+
import type { EventPayload } from "@almadar/core";
|
|
15
|
+
export type GraphNode = EventPayload & {
|
|
15
16
|
id: string;
|
|
16
17
|
label?: string;
|
|
17
18
|
group?: string;
|
|
@@ -20,7 +21,7 @@ export interface GraphNode {
|
|
|
20
21
|
/** Position (optional, computed if missing) */
|
|
21
22
|
x?: number;
|
|
22
23
|
y?: number;
|
|
23
|
-
}
|
|
24
|
+
};
|
|
24
25
|
export interface GraphEdge {
|
|
25
26
|
source: string;
|
|
26
27
|
target: string;
|
|
@@ -1439,9 +1439,6 @@ var fallbackEventBus = {
|
|
|
1439
1439
|
emit: (type, payload, source) => {
|
|
1440
1440
|
const event = {
|
|
1441
1441
|
type,
|
|
1442
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
1443
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
1444
|
-
// payload as EventPayload which listeners consume directly.
|
|
1445
1442
|
payload,
|
|
1446
1443
|
timestamp: Date.now(),
|
|
1447
1444
|
source
|
|
@@ -1415,9 +1415,6 @@ var fallbackEventBus = {
|
|
|
1415
1415
|
emit: (type, payload, source) => {
|
|
1416
1416
|
const event = {
|
|
1417
1417
|
type,
|
|
1418
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
1419
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
1420
|
-
// payload as EventPayload which listeners consume directly.
|
|
1421
1418
|
payload,
|
|
1422
1419
|
timestamp: Date.now(),
|
|
1423
1420
|
source
|
package/dist/docs/index.cjs
CHANGED
|
@@ -2573,9 +2573,6 @@ var fallbackEventBus = {
|
|
|
2573
2573
|
emit: (type, payload, source) => {
|
|
2574
2574
|
const event = {
|
|
2575
2575
|
type,
|
|
2576
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
2577
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
2578
|
-
// payload as EventPayload which listeners consume directly.
|
|
2579
2576
|
payload,
|
|
2580
2577
|
timestamp: Date.now(),
|
|
2581
2578
|
source
|
package/dist/docs/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { EventKey } from '@almadar/core';
|
|
2
|
+
import { EventKey, EventPayload } from '@almadar/core';
|
|
3
3
|
import { LucideIcon } from 'lucide-react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -51,9 +51,9 @@ interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
51
51
|
/** Declarative event name — emits UI:{action} via eventBus on click */
|
|
52
52
|
action?: EventKey;
|
|
53
53
|
/** Payload to include with the action event */
|
|
54
|
-
actionPayload?:
|
|
54
|
+
actionPayload?: EventPayload;
|
|
55
55
|
/** Declarative hover event — emits UI:{hoverEvent} with { hovered: true/false } on mouseEnter/mouseLeave */
|
|
56
|
-
hoverEvent?:
|
|
56
|
+
hoverEvent?: EventKey;
|
|
57
57
|
/** Maximum width (CSS value, e.g., "550px", "80rem") */
|
|
58
58
|
maxWidth?: string;
|
|
59
59
|
/** Children elements */
|
|
@@ -109,7 +109,7 @@ interface StackProps {
|
|
|
109
109
|
/** Declarative event name — emits UI:{action} via eventBus on click */
|
|
110
110
|
action?: EventKey;
|
|
111
111
|
/** Payload to include with the action event */
|
|
112
|
-
actionPayload?:
|
|
112
|
+
actionPayload?: EventPayload;
|
|
113
113
|
/** When true, horizontal stacks flip to vertical below the md breakpoint (768px) */
|
|
114
114
|
responsive?: boolean;
|
|
115
115
|
}
|
|
@@ -183,7 +183,7 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
183
183
|
/** Declarative event name — emits UI:{action} via eventBus on click */
|
|
184
184
|
action?: EventKey;
|
|
185
185
|
/** Payload to include with the action event */
|
|
186
|
-
actionPayload?:
|
|
186
|
+
actionPayload?: EventPayload;
|
|
187
187
|
/** Button label text (alternative to children for schema-driven rendering) */
|
|
188
188
|
label?: string;
|
|
189
189
|
}
|
package/dist/docs/index.js
CHANGED
|
@@ -2549,9 +2549,6 @@ var fallbackEventBus = {
|
|
|
2549
2549
|
emit: (type, payload, source) => {
|
|
2550
2550
|
const event = {
|
|
2551
2551
|
type,
|
|
2552
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
2553
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
2554
|
-
// payload as EventPayload which listeners consume directly.
|
|
2555
2552
|
payload,
|
|
2556
2553
|
timestamp: Date.now(),
|
|
2557
2554
|
source
|
|
@@ -7,28 +7,28 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
import type { BusEvent, BusEventSource, BusEventListener, Unsubscribe } from "@almadar/core";
|
|
11
|
-
export type { BusEvent, BusEventSource, Unsubscribe };
|
|
10
|
+
import type { BusEvent, BusEventSource, BusEventListener, EventPayload, Unsubscribe } from "@almadar/core";
|
|
11
|
+
export type { BusEvent, BusEventSource, EventPayload, Unsubscribe };
|
|
12
12
|
export type EventListener = BusEventListener;
|
|
13
13
|
/**
|
|
14
14
|
* Event bus context type.
|
|
15
15
|
*
|
|
16
|
-
* `emit` accepts `
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* `emit` accepts `EventPayload` from `@almadar/core` — the canonical
|
|
17
|
+
* object shape (index signature over `EventPayloadValue`) that the bus
|
|
18
|
+
* envelope stores and listeners consume. Pattern-specific payload types
|
|
19
|
+
* from `@almadar/patterns` (`ItemActionPayload`, `SelectionChangePayload`,
|
|
20
|
+
* `FormSubmitPayload`, ...) are structural subtypes of `EventPayload`,
|
|
21
|
+
* so components can pass them in without casts.
|
|
22
22
|
*/
|
|
23
23
|
export interface EventBusContextType {
|
|
24
24
|
/**
|
|
25
25
|
* Emit an event to all listeners.
|
|
26
26
|
*
|
|
27
27
|
* @param type - Event type identifier
|
|
28
|
-
* @param payload - Optional payload data (
|
|
28
|
+
* @param payload - Optional payload data (shape matches {@link EventPayload})
|
|
29
29
|
* @param source - Optional origin info (orbital/trait/...)
|
|
30
30
|
*/
|
|
31
|
-
emit: (type: string, payload?:
|
|
31
|
+
emit: (type: string, payload?: EventPayload, source?: BusEventSource) => void;
|
|
32
32
|
/**
|
|
33
33
|
* Subscribe to an event type.
|
|
34
34
|
*
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -938,9 +938,6 @@ var fallbackEventBus = {
|
|
|
938
938
|
emit: (type, payload, source) => {
|
|
939
939
|
const event = {
|
|
940
940
|
type,
|
|
941
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
942
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
943
|
-
// payload as EventPayload which listeners consume directly.
|
|
944
941
|
payload,
|
|
945
942
|
timestamp: Date.now(),
|
|
946
943
|
source
|
package/dist/hooks/index.js
CHANGED
|
@@ -932,9 +932,6 @@ var fallbackEventBus = {
|
|
|
932
932
|
emit: (type, payload, source) => {
|
|
933
933
|
const event = {
|
|
934
934
|
type,
|
|
935
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
936
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
937
|
-
// payload as EventPayload which listeners consume directly.
|
|
938
935
|
payload,
|
|
939
936
|
timestamp: Date.now(),
|
|
940
937
|
source
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { EventPayload } from '@almadar/core';
|
|
1
2
|
/** Discriminated payload carried by every drag operation. */
|
|
2
3
|
export interface DraggablePayload {
|
|
3
4
|
kind: 'pattern' | 'behavior' | 'tree-node' | 'event-wire';
|
|
4
|
-
data:
|
|
5
|
+
data: EventPayload;
|
|
5
6
|
}
|
|
6
7
|
export interface UseDraggableOptions {
|
|
7
8
|
/** The payload that will be serialised into dataTransfer. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BusEvent, BusEventSource, EventListener, Unsubscribe, EventBusContextType } from './event-bus-types';
|
|
2
|
+
import type { EventPayload } from '@almadar/core';
|
|
2
3
|
export type { BusEvent, BusEventSource, EventListener, Unsubscribe, EventBusContextType };
|
|
3
4
|
declare global {
|
|
4
5
|
interface Window {
|
|
@@ -92,5 +93,5 @@ export declare const useEventSubscription: typeof useEventListener;
|
|
|
92
93
|
* };
|
|
93
94
|
* ```
|
|
94
95
|
*/
|
|
95
|
-
export declare function useEmitEvent(): (type: string, payload?:
|
|
96
|
+
export declare function useEmitEvent(): (type: string, payload?: EventPayload, source?: BusEventSource) => void;
|
|
96
97
|
export default useEventBus;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @packageDocumentation
|
|
11
11
|
*/
|
|
12
|
-
import type { AssetLoadStatus, BridgeHealth, BusEvent, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary } from '@almadar/core';
|
|
12
|
+
import type { AssetLoadStatus, BridgeHealth, BusEvent, CheckStatus, EffectTrace, EventLogEntry, EventPayload, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary } from '@almadar/core';
|
|
13
13
|
export type { AssetLoadStatus, BridgeHealth, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary, };
|
|
14
14
|
type ChangeListener = () => void;
|
|
15
15
|
/**
|
|
@@ -59,7 +59,7 @@ export declare function waitForTransition(event: string, timeoutMs?: number): Pr
|
|
|
59
59
|
* Call this during app initialization.
|
|
60
60
|
*/
|
|
61
61
|
export declare function bindEventBus(eventBus: {
|
|
62
|
-
emit: (type: string, payload?:
|
|
62
|
+
emit: (type: string, payload?: EventPayload) => void;
|
|
63
63
|
onAny?: (listener: (event: BusEvent) => void) => () => void;
|
|
64
64
|
}): void;
|
|
65
65
|
/**
|
package/dist/marketing/index.cjs
CHANGED
|
@@ -2573,9 +2573,6 @@ var fallbackEventBus = {
|
|
|
2573
2573
|
emit: (type, payload, source) => {
|
|
2574
2574
|
const event = {
|
|
2575
2575
|
type,
|
|
2576
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
2577
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
2578
|
-
// payload as EventPayload which listeners consume directly.
|
|
2579
2576
|
payload,
|
|
2580
2577
|
timestamp: Date.now(),
|
|
2581
2578
|
source
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { EventKey } from '@almadar/core';
|
|
2
|
+
import { EventKey, EventPayload } from '@almadar/core';
|
|
3
3
|
import { LucideIcon } from 'lucide-react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -50,9 +50,9 @@ interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
50
50
|
/** Declarative event name — emits UI:{action} via eventBus on click */
|
|
51
51
|
action?: EventKey;
|
|
52
52
|
/** Payload to include with the action event */
|
|
53
|
-
actionPayload?:
|
|
53
|
+
actionPayload?: EventPayload;
|
|
54
54
|
/** Declarative hover event — emits UI:{hoverEvent} with { hovered: true/false } on mouseEnter/mouseLeave */
|
|
55
|
-
hoverEvent?:
|
|
55
|
+
hoverEvent?: EventKey;
|
|
56
56
|
/** Maximum width (CSS value, e.g., "550px", "80rem") */
|
|
57
57
|
maxWidth?: string;
|
|
58
58
|
/** Children elements */
|
|
@@ -108,7 +108,7 @@ interface StackProps {
|
|
|
108
108
|
/** Declarative event name — emits UI:{action} via eventBus on click */
|
|
109
109
|
action?: EventKey;
|
|
110
110
|
/** Payload to include with the action event */
|
|
111
|
-
actionPayload?:
|
|
111
|
+
actionPayload?: EventPayload;
|
|
112
112
|
/** When true, horizontal stacks flip to vertical below the md breakpoint (768px) */
|
|
113
113
|
responsive?: boolean;
|
|
114
114
|
}
|
|
@@ -182,7 +182,7 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
182
182
|
/** Declarative event name — emits UI:{action} via eventBus on click */
|
|
183
183
|
action?: EventKey;
|
|
184
184
|
/** Payload to include with the action event */
|
|
185
|
-
actionPayload?:
|
|
185
|
+
actionPayload?: EventPayload;
|
|
186
186
|
/** Button label text (alternative to children for schema-driven rendering) */
|
|
187
187
|
label?: string;
|
|
188
188
|
}
|
package/dist/marketing/index.js
CHANGED
|
@@ -2549,9 +2549,6 @@ var fallbackEventBus = {
|
|
|
2549
2549
|
emit: (type, payload, source) => {
|
|
2550
2550
|
const event = {
|
|
2551
2551
|
type,
|
|
2552
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
2553
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
2554
|
-
// payload as EventPayload which listeners consume directly.
|
|
2555
2552
|
payload,
|
|
2556
2553
|
timestamp: Date.now(),
|
|
2557
2554
|
source
|