foldkit-primitives 0.8.0 → 0.10.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/README.md +32 -2
- package/dist/device/index.d.mts +66 -33
- package/dist/device/index.d.mts.map +1 -1
- package/dist/device/index.mjs +34 -34
- package/dist/device/index.mjs.map +1 -1
- package/dist/dom/index.d.mts +78 -18
- package/dist/dom/index.d.mts.map +1 -1
- package/dist/dom/index.mjs +56 -22
- package/dist/dom/index.mjs.map +1 -1
- package/dist/{editable-text-BbsPOATY.d.mts → editable-text-Dvm-Fuqs.d.mts} +65 -3
- package/dist/editable-text-Dvm-Fuqs.d.mts.map +1 -0
- package/dist/events/index.d.mts +52 -31
- package/dist/events/index.d.mts.map +1 -1
- package/dist/events/index.mjs +40 -28
- package/dist/events/index.mjs.map +1 -1
- package/dist/{follow-tab-stop-BDxyoUPQ.mjs → follow-tab-stop-Ci1tqAIW.mjs} +63 -61
- package/dist/follow-tab-stop-Ci1tqAIW.mjs.map +1 -0
- package/dist/{index-Cppf-lBx.d.mts → index-BC8kcar9.d.mts} +35 -16
- package/dist/index-BC8kcar9.d.mts.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/{input-modality-m6v7__Xs.mjs → input-modality-BXD383jg.mjs} +9 -9
- package/dist/input-modality-BXD383jg.mjs.map +1 -0
- package/dist/{input-modality-DGOhAknO.d.mts → input-modality-BY-bSrEc.d.mts} +9 -2
- package/dist/input-modality-BY-bSrEc.d.mts.map +1 -0
- package/dist/interaction/index.d.mts +118 -118
- package/dist/interaction/index.d.mts.map +1 -1
- package/dist/interaction/index.mjs +3 -3
- package/dist/interaction/index.mjs.map +1 -1
- package/dist/media/index.d.mts +24 -3
- package/dist/media/index.d.mts.map +1 -1
- package/dist/media/index.mjs +23 -13
- package/dist/media/index.mjs.map +1 -1
- package/dist/motion/index.d.mts +1 -1
- package/dist/motion/index.mjs +1 -2
- package/dist/{motion-DGGBZ0wt.mjs → motion-DmFDppRn.mjs} +20 -20
- package/dist/{motion-DGGBZ0wt.mjs.map → motion-DmFDppRn.mjs.map} +1 -1
- package/dist/net/index.d.mts +57 -19
- package/dist/net/index.d.mts.map +1 -1
- package/dist/net/index.mjs +31 -31
- package/dist/net/index.mjs.map +1 -1
- package/dist/observers/index.d.mts +25 -0
- package/dist/observers/index.d.mts.map +1 -1
- package/dist/observers/index.mjs +22 -22
- package/dist/observers/index.mjs.map +1 -1
- package/dist/state/index.d.mts +98 -44
- package/dist/state/index.d.mts.map +1 -1
- package/dist/state/index.mjs +39 -39
- package/dist/state/index.mjs.map +1 -1
- package/dist/time/index.d.mts +35 -5
- package/dist/time/index.d.mts.map +1 -1
- package/dist/time/index.mjs +20 -20
- package/dist/time/index.mjs.map +1 -1
- package/package.json +14 -14
- package/dist/editable-text-BbsPOATY.d.mts.map +0 -1
- package/dist/follow-tab-stop-BDxyoUPQ.mjs.map +0 -1
- package/dist/index-Cppf-lBx.d.mts.map +0 -1
- package/dist/input-modality-DGOhAknO.d.mts.map +0 -1
- package/dist/input-modality-m6v7__Xs.mjs.map +0 -1
|
@@ -27,24 +27,30 @@ declare const PresenceMessage: import("foldkit/message").MessageUnion<{
|
|
|
27
27
|
readonly Show: {};
|
|
28
28
|
readonly Hide: {};
|
|
29
29
|
readonly Hidden: {
|
|
30
|
-
|
|
30
|
+
generation: Schema.Number;
|
|
31
31
|
};
|
|
32
32
|
}>;
|
|
33
33
|
type PresenceMessage = typeof PresenceMessage.Type;
|
|
34
34
|
/** Whether the content renders: shown or mid-exit. */
|
|
35
35
|
declare const isVisible: (model: PresenceModel) => boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Presence as a bundle: mount-transition state for exit animations. `Hide`
|
|
38
|
+
* starts a timed `hiding` phase; the `Hidden` fact it yields carries the
|
|
39
|
+
* generation it was scheduled under, so a `Show` in between wins and the
|
|
40
|
+
* late fact is ignored. The clock is Effect's, so tests drive it.
|
|
41
|
+
*/
|
|
36
42
|
declare const Presence: Bundle.Bundle<"Presence", {
|
|
37
43
|
readonly durationMs: number;
|
|
38
44
|
}, {
|
|
39
|
-
readonly phase: "
|
|
45
|
+
readonly phase: "hidden" | "hiding" | "shown";
|
|
40
46
|
readonly generation: number;
|
|
41
47
|
}, {
|
|
42
48
|
readonly _tag: "Hidden";
|
|
43
49
|
readonly generation: number;
|
|
44
|
-
} | {
|
|
45
|
-
readonly _tag: "Show";
|
|
46
50
|
} | {
|
|
47
51
|
readonly _tag: "Hide";
|
|
52
|
+
} | {
|
|
53
|
+
readonly _tag: "Show";
|
|
48
54
|
}, never, never, never, void, {}, {}>;
|
|
49
55
|
//#endregion
|
|
50
56
|
//#region src/motion/spring.d.ts
|
|
@@ -58,15 +64,22 @@ declare const SpringMessage: import("foldkit/message").MessageUnion<{
|
|
|
58
64
|
readonly Started: {};
|
|
59
65
|
readonly Stopped: {};
|
|
60
66
|
readonly Ticked: {
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
value: Schema.Number;
|
|
68
|
+
velocity: Schema.Number;
|
|
63
69
|
};
|
|
64
70
|
/** Carries the exact end value: the integrator stops near it, not on it. */
|
|
65
71
|
readonly Finished: {
|
|
66
|
-
|
|
72
|
+
value: Schema.Number;
|
|
67
73
|
};
|
|
68
74
|
}>;
|
|
69
75
|
type SpringMessage = typeof SpringMessage.Type;
|
|
76
|
+
/**
|
|
77
|
+
* A spring as a bundle: a number pulled toward a target with stiffness and
|
|
78
|
+
* damping, in the Model. Semi-implicit Euler at a fixed 16ms step, so the
|
|
79
|
+
* trajectory is deterministic under TestClock; the stream ends with
|
|
80
|
+
* Finished, and the value rests exactly at `to`. Underdamped springs
|
|
81
|
+
* overshoot — that is the point — but the rest value is still exact.
|
|
82
|
+
*/
|
|
70
83
|
declare const Spring: Bundle.Bundle<"Spring", {
|
|
71
84
|
readonly from: number;
|
|
72
85
|
readonly to: number;
|
|
@@ -77,6 +90,9 @@ declare const Spring: Bundle.Bundle<"Spring", {
|
|
|
77
90
|
readonly velocity: number;
|
|
78
91
|
readonly running: boolean;
|
|
79
92
|
}, {
|
|
93
|
+
readonly _tag: "Finished";
|
|
94
|
+
readonly value: number;
|
|
95
|
+
} | {
|
|
80
96
|
readonly _tag: "Started";
|
|
81
97
|
} | {
|
|
82
98
|
readonly _tag: "Stopped";
|
|
@@ -84,9 +100,6 @@ declare const Spring: Bundle.Bundle<"Spring", {
|
|
|
84
100
|
readonly _tag: "Ticked";
|
|
85
101
|
readonly value: number;
|
|
86
102
|
readonly velocity: number;
|
|
87
|
-
} | {
|
|
88
|
-
readonly _tag: "Finished";
|
|
89
|
-
readonly value: number;
|
|
90
103
|
}, never, never, never, void, {}, {}>;
|
|
91
104
|
//#endregion
|
|
92
105
|
//#region src/motion/tween.d.ts
|
|
@@ -99,14 +112,20 @@ declare const TweenMessage: import("foldkit/message").MessageUnion<{
|
|
|
99
112
|
readonly Started: {};
|
|
100
113
|
readonly Stopped: {};
|
|
101
114
|
readonly Ticked: {
|
|
102
|
-
|
|
115
|
+
value: Schema.Number;
|
|
103
116
|
};
|
|
104
117
|
/** Carries the exact end value: the stream may stop on either side of it. */
|
|
105
118
|
readonly Finished: {
|
|
106
|
-
|
|
119
|
+
value: Schema.Number;
|
|
107
120
|
};
|
|
108
121
|
}>;
|
|
109
122
|
type TweenMessage = typeof TweenMessage.Type;
|
|
123
|
+
/**
|
|
124
|
+
* A tween as a bundle: a number animated from one value to another over a
|
|
125
|
+
* duration, in the Model. Progress comes from Effect's clock, so tests drive
|
|
126
|
+
* it with TestClock; the stream ends with Finished, and the value rests at
|
|
127
|
+
* `to`. Linear interpolation only: easing curves stay the application's job.
|
|
128
|
+
*/
|
|
110
129
|
declare const Tween: Bundle.Bundle<"Tween", {
|
|
111
130
|
readonly from: number;
|
|
112
131
|
readonly to: number;
|
|
@@ -115,16 +134,16 @@ declare const Tween: Bundle.Bundle<"Tween", {
|
|
|
115
134
|
readonly value: number;
|
|
116
135
|
readonly running: boolean;
|
|
117
136
|
}, {
|
|
137
|
+
readonly _tag: "Finished";
|
|
138
|
+
readonly value: number;
|
|
139
|
+
} | {
|
|
118
140
|
readonly _tag: "Started";
|
|
119
141
|
} | {
|
|
120
142
|
readonly _tag: "Stopped";
|
|
121
143
|
} | {
|
|
122
144
|
readonly _tag: "Ticked";
|
|
123
145
|
readonly value: number;
|
|
124
|
-
} | {
|
|
125
|
-
readonly _tag: "Finished";
|
|
126
|
-
readonly value: number;
|
|
127
146
|
}, never, never, never, void, {}, {}>;
|
|
128
147
|
//#endregion
|
|
129
148
|
export { SpringMessage as a, PresenceMessage as c, motion_d_exports as d, Spring as i, PresenceModel as l, TweenMessage as n, SpringModel as o, TweenModel as r, Presence as s, Tween as t, isVisible as u };
|
|
130
|
-
//# sourceMappingURL=index-
|
|
149
|
+
//# sourceMappingURL=index-BC8kcar9.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BC8kcar9.d.mts","names":[],"sources":["../src/motion/motion.ts","../src/motion/presence.ts","../src/motion/spring.ts","../src/motion/tween.ts"],"mappings":";;;;;UAUiB;WACN,SAAS,OAAO;;;cAGd,eAAe;;cAGf,QAAK,qBAAuB,MAAM,MAAM;cAGxC,SAAS,MAAM,MAAM;cACrB,MAAM,MAAM,MAAM;;cAGlB,MAAM,MAAM,MAAM;;cAUlB,eAAe,OAAO;;;cC5BtB,eAAa,OAAA;;;;KAId,uBAAuB,cAAc;cAEpC,2CAAe;;;;IAGhB,YAAU,OAAA;;;KAEV,yBAAyB,gBAAgB;;cAGxC,YAAS,OAAW;;;;;;;cAQpB,UAAQ,OAAA;WAII;;;;;;;;;;;;;;cC1BZ,aAAW,OAAA;;;;;KAKZ,qBAAqB,YAAY;cAEhC,yCAAa;;;;IAGd,OAAK,OAAA;IAAiB,UAAQ,OAAA;;;;IAE5B,OAAK,OAAA;;;KAEP,uBAAuB,cAAc;;;;;;;;cAoBpC,QAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;;cClCN,YAAU,OAAA;;;;KACX,oBAAoB,WAAW;cAE9B,wCAAY;;;;IAGb,OAAK,OAAA;;;;IAEH,OAAK,OAAA;;;KAEP,sBAAsB,aAAa;;;;;;;cAQlC,OAAK,OAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Coordinates, FullscreenMessage, Geolocation, GeolocationMessage, GeolocationModel, LiveStream, LiveStreamService, MediaDevice, MediaDevicesHandle, MediaDevicesMessage, MediaDevicesModel, MediaStreamConstraints, MediaStreamHandle, MediaStreamMessage, MediaStreamModel, MediaTrackHandle, PermissionState, PermissionStatusHandle, PermissionsHandle, PermissionsMessage, PermissionsModel, Watch, WatchService, enterFullscreen, exitFullscreen, fullscreenChanges, mediaDevices, mediaStream, permissions } from "./device/index.mjs";
|
|
2
|
-
import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact, x as TargetPressed, y as TargetFact } from "./editable-text-
|
|
3
|
-
import { Autofocus, ClipboardMessage, ClipboardReadMessage, Focused, FollowTabStop, Input, InputMask, KeepInView, KeepScrollOptions, Measure, ScriptMessage, ShareData, ShareMessage, applyMask, copyText, keepScroll, loadScript, measured, readText, share } from "./dom/index.mjs";
|
|
4
|
-
import { a as modalityOfKey, i as Modality, n as InputModalityMessage, r as InputModalityModel, t as InputModality } from "./input-modality-
|
|
2
|
+
import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact, x as TargetPressed, y as TargetFact } from "./editable-text-Dvm-Fuqs.mjs";
|
|
3
|
+
import { Autofocus, ClipboardMessage, ClipboardReadMessage, Focused, FollowTabStop, Input, InputMask, KeepInView, KeepScrollOptions, Measure, ScriptMessage, ShareData, ShareMessage, applyMask, copyText, keepScroll, loadScript, measured, pointedLinks, readText, share } from "./dom/index.mjs";
|
|
4
|
+
import { a as modalityOfKey, i as Modality, n as InputModalityMessage, r as InputModalityModel, t as InputModality } from "./input-modality-BY-bSrEc.mjs";
|
|
5
5
|
import { ActiveElementMessage, Idle, IdleMessage, IdleModel, KeyPress, KeyboardMessage, PointerMessage, ScrollMessage, Visibility, VisibilityMessage, VisibilityModel, WindowSize, WindowSizeMessage, WindowSizeModel, activeElementEvents, keyboardEvents, matchHotkey, pointerEvents, scrollEvents } from "./events/index.mjs";
|
|
6
6
|
import { Breakpoints, BreakpointsMessage, BreakpointsModel, MediaQuery, MediaQueryMessage, MediaQueryModel, Platform, PlatformHints, PrefersDark, PrefersReducedMotion, breakpointFor, isBrowser, isServer, platformFromUA } from "./media/index.mjs";
|
|
7
|
-
import { a as SpringMessage, c as PresenceMessage, d as motion_d_exports, i as Spring, l as PresenceModel, n as TweenMessage, o as SpringModel, r as TweenModel, s as Presence, t as Tween, u as isVisible } from "./index-
|
|
7
|
+
import { a as SpringMessage, c as PresenceMessage, d as motion_d_exports, i as Spring, l as PresenceModel, n as TweenMessage, o as SpringModel, r as TweenModel, s as Presence, t as Tween, u as isVisible } from "./index-BC8kcar9.mjs";
|
|
8
8
|
import { Acquired, AcquiredSource, BroadcastChannelHandle, BroadcastMessage, Conversation, ConversationHandler, Online, OnlineMessage, OnlineModel, SharedHost, SharedHostConnection, SharedHostOptions, Socket, SocketHandle, SocketService, SocketView, Source, SourceHandle, SourceService, SseMessage, SseModel, SseView, StartHost, WebSocketMessage, WebSocketModel, broadcastMessages, isLive, isOpen, postBroadcast, sse, viewOf, viewOfSse, websocket } from "./net/index.mjs";
|
|
9
9
|
import { Bounds, Intersection, IntersectionChanged, Measured, Mutated, Mutation, Resize, Resized } from "./observers/index.mjs";
|
|
10
10
|
import { History, HistoryModel, Locale, LocaleMessage, LocaleModel, MasonryPlacement, MeasureRow, Pagination, PaginationMessage, PaginationModel, RowMeasured, SelectionSet, SelectionSetMessage, SelectionSetModel, Viewport, ViewportScrolled, Virtual, VirtualLayout, VirtualMessage, VirtualModel, VirtualWindow, canRedo, canUndo, distanceToEnd, history, isAtEnd, isSelected, masonry, offset, offsetFor, pageCount, range, stickyHeader, totalHeight, visibleRange, windowFor } from "./state/index.mjs";
|
|
11
11
|
import { Interval, IntervalMessage, IntervalModel, Throttle, ThrottleMessage, ThrottleModel, Throttled, Timer, TimerMessage, TimerModel, debounce, formatRelativeTime, ticks } from "./time/index.mjs";
|
|
12
|
-
export { Acquired, AcquiredSource, ActiveElementMessage, Autofocus, Bounds, Breakpoints, BreakpointsMessage, BreakpointsModel, BroadcastChannelHandle, BroadcastMessage, ClipboardMessage, ClipboardReadMessage, Conversation, ConversationHandler, Coordinates, DRAG_THRESHOLD, DragCancelled, DragDropped, DragFact, DragPlace, DragStarted, DragZone, DraggedOver, EditAsked, EditableText, Fact, FocusScope, Focused, FollowTabStop, FullscreenMessage, Geolocation, GeolocationMessage, GeolocationModel, HideOutside, History, HistoryModel, Idle, IdleMessage, IdleModel, Input, InputMask, InputModality, InputModalityMessage, InputModalityModel, Intersection, IntersectionChanged, Interval, IntervalMessage, IntervalModel, KeepInView, KeepScrollOptions, KeyPress, KeyboardMessage, LiveStream, LiveStreamService, Locale, LocaleMessage, LocaleModel, MasonryPlacement, Measure, MeasureRow, Measured, MediaDevice, MediaDevicesHandle, MediaDevicesMessage, MediaDevicesModel, MediaQuery, MediaQueryMessage, MediaQueryModel, MediaStreamConstraints, MediaStreamHandle, MediaStreamMessage, MediaStreamModel, MediaTrackHandle, Modality, motion_d_exports as Motion, Move, MoveEnded, MoveStarted, Moved, Mutated, Mutation, Online, OnlineMessage, OnlineModel, Pagination, PaginationMessage, PaginationModel, PermissionState, PermissionStatusHandle, PermissionsHandle, PermissionsMessage, PermissionsModel, Platform, PlatformHints, PointerDrag, PointerMessage, PrefersDark, PrefersReducedMotion, Presence, PresenceMessage, PresenceModel, Resize, Resized, RowMeasured, ScriptMessage, ScrollLock, ScrollMessage, SelectionSet, SelectionSetMessage, SelectionSetModel, ShareData, ShareMessage, SharedHost, SharedHostConnection, SharedHostOptions, Socket, SocketHandle, SocketService, SocketView, Source, SourceHandle, SourceService, Spring, SpringMessage, SpringModel, SseMessage, SseModel, SseView, StartHost, TargetFact, TargetHovered, TargetPressed, Targets, TextCancelled, TextCommitted, TextEdited, TextFact, Throttle, ThrottleMessage, ThrottleModel, Throttled, Timer, TimerMessage, TimerModel, Tween, TweenMessage, TweenModel, Viewport, ViewportScrolled, Virtual, VirtualLayout, VirtualMessage, VirtualModel, VirtualWindow, Visibility, VisibilityMessage, VisibilityModel, Watch, WatchService, WebSocketMessage, WebSocketModel, WindowSize, WindowSizeMessage, WindowSizeModel, activeElementEvents, applyMask, boxOf, breakpointFor, broadcastMessages, canRedo, canUndo, copyText, debounce, distanceToEnd, enterFullscreen, exitFullscreen, formatRelativeTime, fullscreenChanges, history, isAtEnd, isBrowser, isLive, isOpen, isSelected, isServer, isVisible, keepScroll, keyboardEvents, loadScript, masonry, matchHotkey, measured, mediaDevices, mediaStream, modalityOfKey, offset, offsetFor, pageCount, permissions, platformFromUA, pointerEvents, postBroadcast, range, readText, scrollEvents, share, sse, stickyHeader, tabbableWithin, targetOf, textOf, ticks, totalHeight, viewOf, viewOfSse, visibleRange, websocket, windowFor, zoneOf };
|
|
12
|
+
export { Acquired, AcquiredSource, ActiveElementMessage, Autofocus, Bounds, Breakpoints, BreakpointsMessage, BreakpointsModel, BroadcastChannelHandle, BroadcastMessage, ClipboardMessage, ClipboardReadMessage, Conversation, ConversationHandler, Coordinates, DRAG_THRESHOLD, DragCancelled, DragDropped, DragFact, DragPlace, DragStarted, DragZone, DraggedOver, EditAsked, EditableText, Fact, FocusScope, Focused, FollowTabStop, FullscreenMessage, Geolocation, GeolocationMessage, GeolocationModel, HideOutside, History, HistoryModel, Idle, IdleMessage, IdleModel, Input, InputMask, InputModality, InputModalityMessage, InputModalityModel, Intersection, IntersectionChanged, Interval, IntervalMessage, IntervalModel, KeepInView, KeepScrollOptions, KeyPress, KeyboardMessage, LiveStream, LiveStreamService, Locale, LocaleMessage, LocaleModel, MasonryPlacement, Measure, MeasureRow, Measured, MediaDevice, MediaDevicesHandle, MediaDevicesMessage, MediaDevicesModel, MediaQuery, MediaQueryMessage, MediaQueryModel, MediaStreamConstraints, MediaStreamHandle, MediaStreamMessage, MediaStreamModel, MediaTrackHandle, Modality, motion_d_exports as Motion, Move, MoveEnded, MoveStarted, Moved, Mutated, Mutation, Online, OnlineMessage, OnlineModel, Pagination, PaginationMessage, PaginationModel, PermissionState, PermissionStatusHandle, PermissionsHandle, PermissionsMessage, PermissionsModel, Platform, PlatformHints, PointerDrag, PointerMessage, PrefersDark, PrefersReducedMotion, Presence, PresenceMessage, PresenceModel, Resize, Resized, RowMeasured, ScriptMessage, ScrollLock, ScrollMessage, SelectionSet, SelectionSetMessage, SelectionSetModel, ShareData, ShareMessage, SharedHost, SharedHostConnection, SharedHostOptions, Socket, SocketHandle, SocketService, SocketView, Source, SourceHandle, SourceService, Spring, SpringMessage, SpringModel, SseMessage, SseModel, SseView, StartHost, TargetFact, TargetHovered, TargetPressed, Targets, TextCancelled, TextCommitted, TextEdited, TextFact, Throttle, ThrottleMessage, ThrottleModel, Throttled, Timer, TimerMessage, TimerModel, Tween, TweenMessage, TweenModel, Viewport, ViewportScrolled, Virtual, VirtualLayout, VirtualMessage, VirtualModel, VirtualWindow, Visibility, VisibilityMessage, VisibilityModel, Watch, WatchService, WebSocketMessage, WebSocketModel, WindowSize, WindowSizeMessage, WindowSizeModel, activeElementEvents, applyMask, boxOf, breakpointFor, broadcastMessages, canRedo, canUndo, copyText, debounce, distanceToEnd, enterFullscreen, exitFullscreen, formatRelativeTime, fullscreenChanges, history, isAtEnd, isBrowser, isLive, isOpen, isSelected, isServer, isVisible, keepScroll, keyboardEvents, loadScript, masonry, matchHotkey, measured, mediaDevices, mediaStream, modalityOfKey, offset, offsetFor, pageCount, permissions, platformFromUA, pointedLinks, pointerEvents, postBroadcast, range, readText, scrollEvents, share, sse, stickyHeader, tabbableWithin, targetOf, textOf, ticks, totalHeight, viewOf, viewOfSse, visibleRange, websocket, windowFor, zoneOf };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as MoveEnded, D as ScrollLock, E as HideOutside, O as FocusScope, S as Move, T as Moved, _ as zoneOf, a as TextCommitted, b as Targets, c as DRAG_THRESHOLD, d as DragPlace, f as DragStarted, g as boxOf, h as PointerDrag, i as TextCancelled, k as tabbableWithin, l as DragCancelled, m as DraggedOver, n as EditAsked, o as TextEdited, p as DragZone, r as EditableText, s as textOf, t as FollowTabStop, u as DragDropped, v as TargetHovered, w as MoveStarted, x as targetOf, y as TargetPressed } from "./follow-tab-stop-
|
|
2
|
-
import { Autofocus, ClipboardMessage, ClipboardReadMessage, Focused, Input, InputMask, KeepInView, Measure, ScriptMessage, ShareData, ShareMessage, applyMask, copyText, keepScroll, loadScript, measured, readText, share } from "./dom/index.mjs";
|
|
1
|
+
import { C as MoveEnded, D as ScrollLock, E as HideOutside, O as FocusScope, S as Move, T as Moved, _ as zoneOf, a as TextCommitted, b as Targets, c as DRAG_THRESHOLD, d as DragPlace, f as DragStarted, g as boxOf, h as PointerDrag, i as TextCancelled, k as tabbableWithin, l as DragCancelled, m as DraggedOver, n as EditAsked, o as TextEdited, p as DragZone, r as EditableText, s as textOf, t as FollowTabStop, u as DragDropped, v as TargetHovered, w as MoveStarted, x as targetOf, y as TargetPressed } from "./follow-tab-stop-Ci1tqAIW.mjs";
|
|
2
|
+
import { Autofocus, ClipboardMessage, ClipboardReadMessage, Focused, Input, InputMask, KeepInView, Measure, ScriptMessage, ShareData, ShareMessage, applyMask, copyText, keepScroll, loadScript, measured, pointedLinks, readText, share } from "./dom/index.mjs";
|
|
3
3
|
import { Coordinates, FullscreenMessage, Geolocation, GeolocationMessage, GeolocationModel, LiveStream, MediaDevice, MediaDevicesMessage, MediaDevicesModel, MediaStreamMessage, MediaStreamModel, PermissionState, PermissionsMessage, PermissionsModel, Watch, enterFullscreen, exitFullscreen, fullscreenChanges, mediaDevices, mediaStream, permissions } from "./device/index.mjs";
|
|
4
|
-
import { a as modalityOfKey, i as Modality, n as InputModalityMessage, r as InputModalityModel, t as InputModality } from "./input-modality-
|
|
4
|
+
import { a as modalityOfKey, i as Modality, n as InputModalityMessage, r as InputModalityModel, t as InputModality } from "./input-modality-BXD383jg.mjs";
|
|
5
5
|
import { ActiveElementMessage, Idle, IdleMessage, IdleModel, KeyboardMessage, PointerMessage, ScrollMessage, Visibility, VisibilityMessage, VisibilityModel, WindowSize, WindowSizeMessage, WindowSizeModel, activeElementEvents, keyboardEvents, matchHotkey, pointerEvents, scrollEvents } from "./events/index.mjs";
|
|
6
6
|
import { Breakpoints, BreakpointsMessage, BreakpointsModel, MediaQuery, MediaQueryMessage, MediaQueryModel, Platform, PrefersDark, PrefersReducedMotion, breakpointFor, isBrowser, isServer, platformFromUA } from "./media/index.mjs";
|
|
7
|
-
import { a as SpringMessage, c as PresenceMessage, d as motion_exports, i as Spring, l as PresenceModel, n as TweenMessage, o as SpringModel, r as TweenModel, s as Presence, t as Tween, u as isVisible } from "./motion-
|
|
7
|
+
import { a as SpringMessage, c as PresenceMessage, d as motion_exports, i as Spring, l as PresenceModel, n as TweenMessage, o as SpringModel, r as TweenModel, s as Presence, t as Tween, u as isVisible } from "./motion-DmFDppRn.mjs";
|
|
8
8
|
import { BroadcastMessage, Online, OnlineMessage, OnlineModel, SharedHost, Socket, SocketView, Source, SseMessage, SseModel, SseView, WebSocketMessage, WebSocketModel, broadcastMessages, isLive, isOpen, postBroadcast, sse, viewOf, viewOfSse, websocket } from "./net/index.mjs";
|
|
9
9
|
import { Bounds, Intersection, IntersectionChanged, Measured, Mutated, Mutation, Resize, Resized } from "./observers/index.mjs";
|
|
10
10
|
import { History, HistoryModel, Locale, LocaleMessage, LocaleModel, MeasureRow, Pagination, PaginationMessage, PaginationModel, RowMeasured, SelectionSet, SelectionSetMessage, SelectionSetModel, Viewport, ViewportScrolled, Virtual, VirtualMessage, VirtualModel, canRedo, canUndo, distanceToEnd, history, isAtEnd, isSelected, masonry, offset, offsetFor, pageCount, range, stickyHeader, totalHeight, visibleRange, windowFor } from "./state/index.mjs";
|
|
11
11
|
import { Interval, IntervalMessage, IntervalModel, Throttle, ThrottleMessage, ThrottleModel, Throttled, Timer, TimerMessage, TimerModel, debounce, formatRelativeTime, ticks } from "./time/index.mjs";
|
|
12
|
-
export { ActiveElementMessage, Autofocus, Bounds, Breakpoints, BreakpointsMessage, BreakpointsModel, BroadcastMessage, ClipboardMessage, ClipboardReadMessage, Coordinates, DRAG_THRESHOLD, DragCancelled, DragDropped, DragPlace, DragStarted, DragZone, DraggedOver, EditAsked, EditableText, FocusScope, Focused, FollowTabStop, FullscreenMessage, Geolocation, GeolocationMessage, GeolocationModel, HideOutside, History, HistoryModel, Idle, IdleMessage, IdleModel, Input, InputMask, InputModality, InputModalityMessage, InputModalityModel, Intersection, IntersectionChanged, Interval, IntervalMessage, IntervalModel, KeepInView, KeyboardMessage, LiveStream, Locale, LocaleMessage, LocaleModel, Measure, MeasureRow, Measured, MediaDevice, MediaDevicesMessage, MediaDevicesModel, MediaQuery, MediaQueryMessage, MediaQueryModel, MediaStreamMessage, MediaStreamModel, Modality, motion_exports as Motion, Move, MoveEnded, MoveStarted, Moved, Mutated, Mutation, Online, OnlineMessage, OnlineModel, Pagination, PaginationMessage, PaginationModel, PermissionState, PermissionsMessage, PermissionsModel, Platform, PointerDrag, PointerMessage, PrefersDark, PrefersReducedMotion, Presence, PresenceMessage, PresenceModel, Resize, Resized, RowMeasured, ScriptMessage, ScrollLock, ScrollMessage, SelectionSet, SelectionSetMessage, SelectionSetModel, ShareData, ShareMessage, SharedHost, Socket, SocketView, Source, Spring, SpringMessage, SpringModel, SseMessage, SseModel, SseView, TargetHovered, TargetPressed, Targets, TextCancelled, TextCommitted, TextEdited, Throttle, ThrottleMessage, ThrottleModel, Throttled, Timer, TimerMessage, TimerModel, Tween, TweenMessage, TweenModel, Viewport, ViewportScrolled, Virtual, VirtualMessage, VirtualModel, Visibility, VisibilityMessage, VisibilityModel, Watch, WebSocketMessage, WebSocketModel, WindowSize, WindowSizeMessage, WindowSizeModel, activeElementEvents, applyMask, boxOf, breakpointFor, broadcastMessages, canRedo, canUndo, copyText, debounce, distanceToEnd, enterFullscreen, exitFullscreen, formatRelativeTime, fullscreenChanges, history, isAtEnd, isBrowser, isLive, isOpen, isSelected, isServer, isVisible, keepScroll, keyboardEvents, loadScript, masonry, matchHotkey, measured, mediaDevices, mediaStream, modalityOfKey, offset, offsetFor, pageCount, permissions, platformFromUA, pointerEvents, postBroadcast, range, readText, scrollEvents, share, sse, stickyHeader, tabbableWithin, targetOf, textOf, ticks, totalHeight, viewOf, viewOfSse, visibleRange, websocket, windowFor, zoneOf };
|
|
12
|
+
export { ActiveElementMessage, Autofocus, Bounds, Breakpoints, BreakpointsMessage, BreakpointsModel, BroadcastMessage, ClipboardMessage, ClipboardReadMessage, Coordinates, DRAG_THRESHOLD, DragCancelled, DragDropped, DragPlace, DragStarted, DragZone, DraggedOver, EditAsked, EditableText, FocusScope, Focused, FollowTabStop, FullscreenMessage, Geolocation, GeolocationMessage, GeolocationModel, HideOutside, History, HistoryModel, Idle, IdleMessage, IdleModel, Input, InputMask, InputModality, InputModalityMessage, InputModalityModel, Intersection, IntersectionChanged, Interval, IntervalMessage, IntervalModel, KeepInView, KeyboardMessage, LiveStream, Locale, LocaleMessage, LocaleModel, Measure, MeasureRow, Measured, MediaDevice, MediaDevicesMessage, MediaDevicesModel, MediaQuery, MediaQueryMessage, MediaQueryModel, MediaStreamMessage, MediaStreamModel, Modality, motion_exports as Motion, Move, MoveEnded, MoveStarted, Moved, Mutated, Mutation, Online, OnlineMessage, OnlineModel, Pagination, PaginationMessage, PaginationModel, PermissionState, PermissionsMessage, PermissionsModel, Platform, PointerDrag, PointerMessage, PrefersDark, PrefersReducedMotion, Presence, PresenceMessage, PresenceModel, Resize, Resized, RowMeasured, ScriptMessage, ScrollLock, ScrollMessage, SelectionSet, SelectionSetMessage, SelectionSetModel, ShareData, ShareMessage, SharedHost, Socket, SocketView, Source, Spring, SpringMessage, SpringModel, SseMessage, SseModel, SseView, TargetHovered, TargetPressed, Targets, TextCancelled, TextCommitted, TextEdited, Throttle, ThrottleMessage, ThrottleModel, Throttled, Timer, TimerMessage, TimerModel, Tween, TweenMessage, TweenModel, Viewport, ViewportScrolled, Virtual, VirtualMessage, VirtualModel, Visibility, VisibilityMessage, VisibilityModel, Watch, WebSocketMessage, WebSocketModel, WindowSize, WindowSizeMessage, WindowSizeModel, activeElementEvents, applyMask, boxOf, breakpointFor, broadcastMessages, canRedo, canUndo, copyText, debounce, distanceToEnd, enterFullscreen, exitFullscreen, formatRelativeTime, fullscreenChanges, history, isAtEnd, isBrowser, isLive, isOpen, isSelected, isServer, isVisible, keepScroll, keyboardEvents, loadScript, masonry, matchHotkey, measured, mediaDevices, mediaStream, modalityOfKey, offset, offsetFor, pageCount, permissions, platformFromUA, pointedLinks, pointerEvents, postBroadcast, range, readText, scrollEvents, share, sse, stickyHeader, tabbableWithin, targetOf, textOf, ticks, totalHeight, viewOf, viewOfSse, visibleRange, websocket, windowFor, zoneOf };
|
|
@@ -3,13 +3,6 @@ import { defineMessageUnion } from "foldkit/message";
|
|
|
3
3
|
import * as Subscription from "foldkit/subscription";
|
|
4
4
|
import { Bundle } from "foldkit-bundle";
|
|
5
5
|
//#region src/events/input-modality.ts
|
|
6
|
-
/**
|
|
7
|
-
* Input modality as a bundle: whether the user last drove the page by
|
|
8
|
-
* keyboard or by pointer. The browser reports the facts; the Model keeps the
|
|
9
|
-
* answer, so a view can show a focus ring only for keyboard users without
|
|
10
|
-
* reading the DOM, and a replay sees the same answer. CSS `:focus-visible`
|
|
11
|
-
* is the floor; this is for JavaScript that must know.
|
|
12
|
-
*/
|
|
13
6
|
const Modality = Schema.Literals([
|
|
14
7
|
"keyboard",
|
|
15
8
|
"pointer",
|
|
@@ -30,14 +23,21 @@ const modalityStream = () => {
|
|
|
30
23
|
if (typeof window === "undefined") return Stream.empty;
|
|
31
24
|
return Stream.mergeAll([Stream.fromEventListener(window, "keydown", { capture: true }).pipe(Stream.filter((event) => modalityOfKey(event.key) !== null), Stream.map(() => InputModalityMessage.Changed({ modality: "keyboard" }))), Stream.fromEventListener(window, "pointerdown", { capture: true }).pipe(Stream.map(() => InputModalityMessage.Changed({ modality: "pointer" })))], { concurrency: "unbounded" });
|
|
32
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Input modality as a bundle: whether the user last drove the page by
|
|
28
|
+
* keyboard or by pointer. The browser reports the facts; the Model keeps the
|
|
29
|
+
* answer, so a view can show a focus ring only for keyboard users without
|
|
30
|
+
* reading the DOM, and a replay sees the same answer. CSS `:focus-visible`
|
|
31
|
+
* is the floor; this is for JavaScript that must know.
|
|
32
|
+
*/
|
|
33
33
|
const InputModality = Bundle.make("InputModality", {
|
|
34
34
|
Model: InputModalityModel,
|
|
35
35
|
Message: InputModalityMessage,
|
|
36
36
|
init: () => ({ model: { modality: "unknown" } }),
|
|
37
37
|
update: (model, message) => model.modality === message.modality ? { model } : { model: { modality: message.modality } },
|
|
38
|
-
subscriptions: () => Subscription.make()(() => ({ changes: Subscription.
|
|
38
|
+
subscriptions: () => Subscription.make()(() => ({ changes: Subscription.persistentEntry(modalityStream()) }))
|
|
39
39
|
});
|
|
40
40
|
//#endregion
|
|
41
41
|
export { modalityOfKey as a, Modality as i, InputModalityMessage as n, InputModalityModel as r, InputModality as t };
|
|
42
42
|
|
|
43
|
-
//# sourceMappingURL=input-modality-
|
|
43
|
+
//# sourceMappingURL=input-modality-BXD383jg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-modality-BXD383jg.mjs","names":[],"sources":["../src/events/input-modality.ts"],"sourcesContent":["import { Schema, Stream } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Subscription from 'foldkit/subscription'\nimport { Bundle } from 'foldkit-bundle'\n\nexport const Modality = Schema.Literals(['keyboard', 'pointer', 'unknown'])\nexport type Modality = typeof Modality.Type\n\nexport const InputModalityModel = Schema.Struct({ modality: Modality })\nexport type InputModalityModel = typeof InputModalityModel.Type\n\nexport const InputModalityMessage = defineMessageUnion({ Changed: { modality: Modality } })\nexport type InputModalityMessage = typeof InputModalityMessage.Type\n\nconst MODIFIERS = new Set(['Shift', 'Control', 'Alt', 'Meta', 'CapsLock'])\n\n/** A modifier alone says nothing about how the page is being driven. */\nexport const modalityOfKey = (key: string): Modality | null =>\n MODIFIERS.has(key) ? null : 'keyboard'\n\nconst modalityStream = (): Stream.Stream<InputModalityMessage> => {\n if (typeof window === 'undefined') return Stream.empty\n return Stream.mergeAll(\n [\n Stream.fromEventListener<KeyboardEvent>(window, 'keydown', { capture: true }).pipe(\n Stream.filter(event => modalityOfKey(event.key) !== null),\n Stream.map(() => InputModalityMessage.Changed({ modality: 'keyboard' })),\n ),\n Stream.fromEventListener(window, 'pointerdown', { capture: true }).pipe(\n Stream.map(() => InputModalityMessage.Changed({ modality: 'pointer' })),\n ),\n ],\n { concurrency: 'unbounded' },\n )\n}\n\n/**\n * Input modality as a bundle: whether the user last drove the page by\n * keyboard or by pointer. The browser reports the facts; the Model keeps the\n * answer, so a view can show a focus ring only for keyboard users without\n * reading the DOM, and a replay sees the same answer. CSS `:focus-visible`\n * is the floor; this is for JavaScript that must know.\n */\nexport const InputModality = Bundle.make('InputModality', {\n Model: InputModalityModel,\n Message: InputModalityMessage,\n init: () => ({ model: { modality: 'unknown' as const } }),\n update: (model, message) =>\n model.modality === message.modality ? { model } : { model: { modality: message.modality } },\n subscriptions: (): Subscription.Subscriptions<InputModalityModel, InputModalityMessage> =>\n Subscription.make<InputModalityModel, InputModalityMessage>()(() => ({\n changes: Subscription.persistentEntry(modalityStream()),\n })),\n})\n"],"mappings":";;;;;AAKA,MAAa,WAAW,OAAO,SAAS;CAAC;CAAY;CAAW;AAAS,CAAC;AAG1E,MAAa,qBAAqB,OAAO,OAAO,EAAE,UAAU,SAAS,CAAC;AAGtE,MAAa,uBAAuB,mBAAmB,EAAE,SAAS,EAAE,UAAU,SAAS,EAAE,CAAC;AAG1F,MAAM,4BAAY,IAAI,IAAI;CAAC;CAAS;CAAW;CAAO;CAAQ;AAAU,CAAC;;AAGzE,MAAa,iBAAiB,QAC5B,UAAU,IAAI,GAAG,IAAI,OAAO;AAE9B,MAAM,uBAA4D;CAChE,IAAI,OAAO,WAAW,aAAa,OAAO,OAAO;CACjD,OAAO,OAAO,SACZ,CACE,OAAO,kBAAiC,QAAQ,WAAW,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,KAC5E,OAAO,QAAO,UAAS,cAAc,MAAM,GAAG,MAAM,IAAI,GACxD,OAAO,UAAU,qBAAqB,QAAQ,EAAE,UAAU,WAAW,CAAC,CAAC,CACzE,GACA,OAAO,kBAAkB,QAAQ,eAAe,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,KACjE,OAAO,UAAU,qBAAqB,QAAQ,EAAE,UAAU,UAAU,CAAC,CAAC,CACxE,CACF,GACA,EAAE,aAAa,YAAY,CAC7B;AACF;;;;;;;;AASA,MAAa,gBAAgB,OAAO,KAAK,iBAAiB;CACxD,OAAO;CACP,SAAS;CACT,aAAa,EAAE,OAAO,EAAE,UAAU,UAAmB,EAAE;CACvD,SAAS,OAAO,YACd,MAAM,aAAa,QAAQ,WAAW,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,UAAU,QAAQ,SAAS,EAAE;CAC5F,qBACE,aAAa,KAA+C,CAAC,QAAQ,EACnE,SAAS,aAAa,gBAAgB,eAAe,CAAC,EACxD,EAAE;AACN,CAAC"}
|
|
@@ -9,12 +9,19 @@ declare const InputModalityModel: Schema.Struct<{
|
|
|
9
9
|
type InputModalityModel = typeof InputModalityModel.Type;
|
|
10
10
|
declare const InputModalityMessage: import("foldkit/message").MessageUnion<{
|
|
11
11
|
readonly Changed: {
|
|
12
|
-
|
|
12
|
+
modality: Schema.Literals<readonly ["keyboard", "pointer", "unknown"]>;
|
|
13
13
|
};
|
|
14
14
|
}>;
|
|
15
15
|
type InputModalityMessage = typeof InputModalityMessage.Type;
|
|
16
16
|
/** A modifier alone says nothing about how the page is being driven. */
|
|
17
17
|
declare const modalityOfKey: (key: string) => Modality | null;
|
|
18
|
+
/**
|
|
19
|
+
* Input modality as a bundle: whether the user last drove the page by
|
|
20
|
+
* keyboard or by pointer. The browser reports the facts; the Model keeps the
|
|
21
|
+
* answer, so a view can show a focus ring only for keyboard users without
|
|
22
|
+
* reading the DOM, and a replay sees the same answer. CSS `:focus-visible`
|
|
23
|
+
* is the floor; this is for JavaScript that must know.
|
|
24
|
+
*/
|
|
18
25
|
declare const InputModality: Bundle.Bundle<"InputModality", void, {
|
|
19
26
|
readonly modality: "keyboard" | "pointer" | "unknown";
|
|
20
27
|
}, {
|
|
@@ -23,4 +30,4 @@ declare const InputModality: Bundle.Bundle<"InputModality", void, {
|
|
|
23
30
|
}, never, never, never, void, {}, {}>;
|
|
24
31
|
//#endregion
|
|
25
32
|
export { modalityOfKey as a, Modality as i, InputModalityMessage as n, InputModalityModel as r, InputModality as t };
|
|
26
|
-
//# sourceMappingURL=input-modality-
|
|
33
|
+
//# sourceMappingURL=input-modality-BY-bSrEc.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-modality-BY-bSrEc.d.mts","names":[],"sources":["../src/events/input-modality.ts"],"mappings":";;;cAKa,UAAQ,OAAA;KACT,kBAAkB,SAAS;cAE1B,oBAAkB,OAAA;qBAAlB,OAAA;;KACD,4BAA4B,mBAAmB;cAE9C,gDAAoB;;IAAmC,UAAQ,OAAA;;;KAChE,8BAA8B,qBAAqB;;cAKlD,gBAAa,gBAAkB;;;;;;;;cA0B/B,eAAa,OAAA"}
|