@tangle-network/ui 11.51.11 → 11.51.12
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 11.51.12
|
|
2
|
+
|
|
3
|
+
### Patch Changes
|
|
4
|
+
|
|
5
|
+
- e5f85bd: Preserve sequence zero when a named native stream reconnects; omit the cursor before any event arrives.
|
|
6
|
+
|
|
1
7
|
## 11.51.11
|
|
2
8
|
|
|
3
9
|
- Keep tool-row actions and navigation reachable after a hover preview. HoverCard uses its anchor for placement, preserves keyboard inspection, and dismisses previews when a nested control commits an action. Touch actions do not become hover intent.
|
|
@@ -12,4 +12,4 @@ export interface EventStreamHandlers {
|
|
|
12
12
|
onLiveChange?: (live: boolean) => void;
|
|
13
13
|
}
|
|
14
14
|
/** Producer-owned named events; host transports keep their authenticated reconnect lifecycle. */
|
|
15
|
-
export declare function useEventStream(url: string | undefined, handlers: EventStreamHandlers): void;
|
|
15
|
+
export declare function useEventStream(url: string | (() => string) | undefined, handlers: EventStreamHandlers): void;
|
|
@@ -8,7 +8,7 @@ function openNativeStream(url, handlers) {
|
|
|
8
8
|
const open = () => {
|
|
9
9
|
handlers.onConnecting?.(attempt);
|
|
10
10
|
const target = new URL(typeof url === "function" ? url() : url, globalThis.location?.href), after = handlers.after?.();
|
|
11
|
-
if (after !== void 0 && after
|
|
11
|
+
if (after !== void 0 && after >= 0) target.searchParams.set("after", String(after));
|
|
12
12
|
let connection;
|
|
13
13
|
const live = (value) => {
|
|
14
14
|
if (!stopped && (!connection || source === connection)) handlers.onLiveChange?.(value);
|
|
@@ -56,7 +56,7 @@ function useEventStream(url, handlers) {
|
|
|
56
56
|
const connection = openNativeStream(url, {
|
|
57
57
|
opener: handlers.opener,
|
|
58
58
|
events: Object.fromEntries(Object.keys(handlers.events).map((name) => [name, (event) => latest.current.events[name]?.(event)])),
|
|
59
|
-
after: () => latest.current.after?.() ??
|
|
59
|
+
after: () => latest.current.after?.() ?? -1,
|
|
60
60
|
onStart: () => latest.current.onStart?.(),
|
|
61
61
|
onLiveChange: (live) => latest.current.onLiveChange?.(live),
|
|
62
62
|
terminalEvent: "end"
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ export function openNativeStream(url: string | (() => string), handlers: NativeP
|
|
|
25
25
|
const open = () => {
|
|
26
26
|
handlers.onConnecting?.(attempt)
|
|
27
27
|
const target = new URL(typeof url === 'function' ? url() : url, globalThis.location?.href), after = handlers.after?.()
|
|
28
|
-
if (after !== undefined && after
|
|
28
|
+
if (after !== undefined && after >= 0) target.searchParams.set('after', String(after))
|
|
29
29
|
let connection: EventStreamSource
|
|
30
30
|
const live = (value: boolean) => { if (!stopped && (!connection || source === connection)) handlers.onLiveChange?.(value) }
|
|
31
31
|
connection = handlers.opener ? handlers.opener(target.toString(), live) : new EventSource(target.toString())
|
|
@@ -52,7 +52,7 @@ export function openNativeStream(url: string | (() => string), handlers: NativeP
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/** Producer-owned named events; host transports keep their authenticated reconnect lifecycle. */
|
|
55
|
-
export function useEventStream(url: string | undefined, handlers: EventStreamHandlers): void {
|
|
55
|
+
export function useEventStream(url: string | (() => string) | undefined, handlers: EventStreamHandlers): void {
|
|
56
56
|
const latest = useRef(handlers)
|
|
57
57
|
latest.current = handlers
|
|
58
58
|
const names = Object.keys(handlers.events).sort().join(',')
|
|
@@ -61,7 +61,7 @@ export function useEventStream(url: string | undefined, handlers: EventStreamHan
|
|
|
61
61
|
const current: EventStreamHandlers = {
|
|
62
62
|
opener: handlers.opener,
|
|
63
63
|
events: Object.fromEntries(Object.keys(handlers.events).map(name => [name, (event: MessageEvent<string>) => latest.current.events[name]?.(event)])),
|
|
64
|
-
after: () => latest.current.after?.() ??
|
|
64
|
+
after: () => latest.current.after?.() ?? -1,
|
|
65
65
|
onStart: () => latest.current.onStart?.(),
|
|
66
66
|
onLiveChange: live => latest.current.onLiveChange?.(live),
|
|
67
67
|
}
|