foldkit 0.79.0 → 0.81.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 +1 -0
- package/dist/html/index.d.ts +34 -27
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +31 -26
- package/dist/html/public.d.ts +1 -1
- package/dist/html/public.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/mount/index.d.ts +42 -0
- package/dist/mount/index.d.ts.map +1 -0
- package/dist/mount/index.js +38 -0
- package/dist/mount/public.d.ts +3 -0
- package/dist/mount/public.d.ts.map +1 -0
- package/dist/mount/public.js +1 -0
- package/dist/runtime/public.d.ts +1 -1
- package/dist/runtime/public.d.ts.map +1 -1
- package/dist/runtime/runtime.d.ts +1 -23
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +1 -2
- package/dist/ui/anchor.d.ts +13 -6
- package/dist/ui/anchor.d.ts.map +1 -1
- package/dist/ui/anchor.js +91 -86
- package/dist/ui/calendar/index.d.ts +117 -28
- package/dist/ui/calendar/index.d.ts.map +1 -1
- package/dist/ui/calendar/index.js +393 -105
- package/dist/ui/calendar/public.d.ts +2 -2
- package/dist/ui/calendar/public.d.ts.map +1 -1
- package/dist/ui/calendar/public.js +1 -1
- package/dist/ui/combobox/multi.d.ts +15 -3
- package/dist/ui/combobox/multi.d.ts.map +1 -1
- package/dist/ui/combobox/public.d.ts +2 -2
- package/dist/ui/combobox/public.d.ts.map +1 -1
- package/dist/ui/combobox/public.js +1 -1
- package/dist/ui/combobox/shared.d.ts +22 -7
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +73 -37
- package/dist/ui/combobox/single.d.ts +15 -3
- package/dist/ui/combobox/single.d.ts.map +1 -1
- package/dist/ui/datePicker/index.d.ts +7 -4
- package/dist/ui/datePicker/index.d.ts.map +1 -1
- package/dist/ui/datePicker/index.js +8 -2
- package/dist/ui/listbox/multi.d.ts +10 -2
- package/dist/ui/listbox/multi.d.ts.map +1 -1
- package/dist/ui/listbox/public.d.ts +2 -2
- package/dist/ui/listbox/public.d.ts.map +1 -1
- package/dist/ui/listbox/public.js +1 -1
- package/dist/ui/listbox/shared.d.ts +16 -6
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +37 -25
- package/dist/ui/listbox/single.d.ts +10 -2
- package/dist/ui/listbox/single.d.ts.map +1 -1
- package/dist/ui/menu/index.d.ts +11 -5
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +36 -24
- package/dist/ui/menu/public.d.ts +2 -2
- package/dist/ui/menu/public.d.ts.map +1 -1
- package/dist/ui/menu/public.js +1 -1
- package/dist/ui/popover/index.d.ts +8 -5
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +23 -16
- package/dist/ui/popover/public.d.ts +2 -2
- package/dist/ui/popover/public.d.ts.map +1 -1
- package/dist/ui/popover/public.js +1 -1
- package/dist/ui/tooltip/index.d.ts +5 -2
- package/dist/ui/tooltip/index.d.ts.map +1 -1
- package/dist/ui/tooltip/index.js +17 -10
- package/dist/ui/tooltip/public.d.ts +1 -1
- package/dist/ui/tooltip/public.d.ts.map +1 -1
- package/dist/ui/tooltip/public.js +1 -1
- package/package.json +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE9E,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4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AC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACnD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACtD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF,yKAAyK;AACzK,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAqN3D,CAAA;AAED;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAChB,UAAU,CAAC,OAAO,CAAC,EACnB,OAAO,GAAG,iBAAiB,GAAG,UAAU,GAAG,UAAU,CACtD,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,KACpD,IAAI,CAgBR,CAAA"}
|
package/dist/ui/popover/index.js
CHANGED
|
@@ -3,9 +3,10 @@ import * as Command from '../../command/index.js';
|
|
|
3
3
|
import { OptionExt } from '../../effectExtensions/index.js';
|
|
4
4
|
import { createLazy, html, } from '../../html/index.js';
|
|
5
5
|
import { m } from '../../message/index.js';
|
|
6
|
+
import * as Mount from '../../mount/index.js';
|
|
6
7
|
import { evo } from '../../struct/index.js';
|
|
7
8
|
import * as Task from '../../task/index.js';
|
|
8
|
-
import {
|
|
9
|
+
import { anchorSetup } from '../anchor.js';
|
|
9
10
|
// NOTE: Animation imports are split across schema + update to avoid a circular
|
|
10
11
|
// dependency: animation → html → runtime → devtools → popover → animation.
|
|
11
12
|
// The barrel (../animation) imports from html, which starts the cycle.
|
|
@@ -27,8 +28,8 @@ export const Model = S.Struct({
|
|
|
27
28
|
export const Opened = m('Opened');
|
|
28
29
|
/** Sent when the popover closes via Escape key or backdrop click. Returns focus to the button. */
|
|
29
30
|
export const Closed = m('Closed');
|
|
30
|
-
/** Sent when
|
|
31
|
-
export const
|
|
31
|
+
/** Sent when the popover panel loses focus. Does NOT return focus to the button. */
|
|
32
|
+
export const BlurredPanel = m('BlurredPanel');
|
|
32
33
|
/** Sent when the user presses a pointer device on the popover button. Records pointer type and toggles for mouse. */
|
|
33
34
|
export const PressedPointerOnButton = m('PressedPointerOnButton', {
|
|
34
35
|
pointerType: S.String,
|
|
@@ -50,12 +51,14 @@ export const CompletedTeardownInert = m('CompletedTeardownInert');
|
|
|
50
51
|
export const IgnoredMouseClick = m('IgnoredMouseClick');
|
|
51
52
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
52
53
|
export const SuppressedSpaceScroll = m('SuppressedSpaceScroll');
|
|
54
|
+
/** Sent when the popover panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
55
|
+
export const CompletedAnchorMount = m('CompletedAnchorMount');
|
|
53
56
|
/** Wraps an Animation submodel message for delegation. */
|
|
54
57
|
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
55
58
|
message: AnimationMessage,
|
|
56
59
|
});
|
|
57
60
|
/** Union of all messages the popover component can produce. */
|
|
58
|
-
export const Message = S.Union(Opened, Closed,
|
|
61
|
+
export const Message = S.Union(Opened, Closed, BlurredPanel, PressedPointerOnButton, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, IgnoredMouseClick, SuppressedSpaceScroll, CompletedAnchorMount, GotAnimationMessage);
|
|
59
62
|
// INIT
|
|
60
63
|
const LEFT_MOUSE_BUTTON = 0;
|
|
61
64
|
/** Creates an initial popover model from a config. Defaults to closed. */
|
|
@@ -151,7 +154,7 @@ export const update = (model, message) => {
|
|
|
151
154
|
return M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
152
155
|
Opened: () => openPopover(model),
|
|
153
156
|
Closed: () => closePopover(model, closeWithFocusCommands),
|
|
154
|
-
|
|
157
|
+
BlurredPanel: () => {
|
|
155
158
|
if (Option.exists(model.maybeLastButtonPointerType, Equal.equals('mouse'))) {
|
|
156
159
|
return [model, []];
|
|
157
160
|
}
|
|
@@ -187,8 +190,10 @@ export const update = (model, message) => {
|
|
|
187
190
|
[],
|
|
188
191
|
],
|
|
189
192
|
SuppressedSpaceScroll: () => [model, []],
|
|
193
|
+
CompletedAnchorMount: () => [model, []],
|
|
190
194
|
}));
|
|
191
195
|
};
|
|
196
|
+
const PopoverAnchor = Mount.define('PopoverAnchor', CompletedAnchorMount);
|
|
192
197
|
/** Programmatically opens the popover, updating the model and returning
|
|
193
198
|
* focus and modal commands. Use this in domain-event handlers when the popover uses `onOpened`. */
|
|
194
199
|
export const open = (model) => update(model, Opened());
|
|
@@ -197,7 +202,7 @@ export const open = (model) => update(model, Opened());
|
|
|
197
202
|
export const close = (model) => update(model, Closed());
|
|
198
203
|
/** Renders a headless popover with a trigger button and a floating panel. Uses the disclosure ARIA pattern (aria-expanded + aria-controls) with no role on the panel. */
|
|
199
204
|
export const view = (config) => {
|
|
200
|
-
const { div, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Id, OnBlur, OnClick,
|
|
205
|
+
const { div, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Id, OnBlur, OnClick, OnKeyDownPreventDefault, OnKeyUpPreventDefault, OnMount, OnPointerDown, Style, Tabindex, Type, keyed, } = html();
|
|
201
206
|
const { model: { id, isOpen, contentFocus, animation: { transitionState }, maybeLastButtonPointerType, }, toParentMessage, onOpened, onClosed, anchor, buttonContent, buttonClassName, buttonAttributes = [], panelContent, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], isDisabled, focusSelector, className, attributes = [], } = config;
|
|
202
207
|
const dispatchOpened = () => onOpened ? onOpened() : toParentMessage(Opened());
|
|
203
208
|
const dispatchClosed = () => onClosed ? onClosed() : toParentMessage(Closed());
|
|
@@ -259,17 +264,19 @@ export const view = (config) => {
|
|
|
259
264
|
...(buttonClassName ? [Class(buttonClassName)] : []),
|
|
260
265
|
...buttonAttributes,
|
|
261
266
|
];
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
const anchorAction = Mount.mapMessage(PopoverAnchor((items) => Effect.sync(() => ({
|
|
268
|
+
message: CompletedAnchorMount(),
|
|
269
|
+
cleanup: anchorSetup({
|
|
270
|
+
buttonId: `${id}-button`,
|
|
271
|
+
anchor,
|
|
272
|
+
interceptTab: false,
|
|
273
|
+
focusAfterPosition: true,
|
|
274
|
+
...(focusSelector !== undefined && { focusSelector }),
|
|
275
|
+
})(items),
|
|
276
|
+
}))), toParentMessage);
|
|
269
277
|
const anchorAttributes = [
|
|
270
278
|
Style({ position: 'absolute', margin: '0', visibility: 'hidden' }),
|
|
271
|
-
|
|
272
|
-
OnDestroy(hooks.onDestroy),
|
|
279
|
+
OnMount(anchorAction),
|
|
273
280
|
];
|
|
274
281
|
const resolvedPanelAttributes = [
|
|
275
282
|
Id(`${id}-panel`),
|
|
@@ -280,7 +287,7 @@ export const view = (config) => {
|
|
|
280
287
|
? []
|
|
281
288
|
: [
|
|
282
289
|
OnKeyDownPreventDefault(handlePanelKeyDown),
|
|
283
|
-
...(contentFocus ? [] : [OnBlur(toParentMessage(
|
|
290
|
+
...(contentFocus ? [] : [OnBlur(toParentMessage(BlurredPanel()))]),
|
|
284
291
|
]),
|
|
285
292
|
...(panelClassName ? [Class(panelClassName)] : []),
|
|
286
293
|
...panelAttributes,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
2
|
-
export type {
|
|
1
|
+
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedAnchorMount, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
2
|
+
export type { BlurredPanel, PressedPointerOnButton, IgnoredMouseClick, SuppressedSpaceScroll, InitConfig, ViewConfig, } from './index.js';
|
|
3
3
|
export type { AnchorConfig } from '../anchor.js';
|
|
4
4
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,GAC7B,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,GAC7B,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,UAAU,GACX,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
1
|
+
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedAnchorMount, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
@@ -37,6 +37,8 @@ export declare const ElapsedShowDelay: import("../../schema/index.js").CallableT
|
|
|
37
37
|
export declare const ChangedShowDelay: import("../../schema/index.js").CallableTaggedStruct<"ChangedShowDelay", {
|
|
38
38
|
showDelay: typeof S.DurationFromMillis;
|
|
39
39
|
}>;
|
|
40
|
+
/** Sent when the tooltip panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
41
|
+
export declare const CompletedAnchorMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedAnchorMount", {}>;
|
|
40
42
|
/** Union of all messages the tooltip component can produce. */
|
|
41
43
|
export declare const Message: S.Union<[
|
|
42
44
|
typeof EnteredTrigger,
|
|
@@ -46,7 +48,8 @@ export declare const Message: S.Union<[
|
|
|
46
48
|
typeof PressedEscape,
|
|
47
49
|
typeof PressedPointerOnTrigger,
|
|
48
50
|
typeof ElapsedShowDelay,
|
|
49
|
-
typeof ChangedShowDelay
|
|
51
|
+
typeof ChangedShowDelay,
|
|
52
|
+
typeof CompletedAnchorMount
|
|
50
53
|
]>;
|
|
51
54
|
export type EnteredTrigger = typeof EnteredTrigger.Type;
|
|
52
55
|
export type LeftTrigger = typeof LeftTrigger.Type;
|
|
@@ -75,7 +78,7 @@ export declare const setShowDelay: (model: Model, showDelay: Duration.DurationIn
|
|
|
75
78
|
/** Configuration for rendering a tooltip with `view`. */
|
|
76
79
|
export type ViewConfig<Message> = Readonly<{
|
|
77
80
|
model: Model;
|
|
78
|
-
toParentMessage: (message: EnteredTrigger | LeftTrigger | FocusedTrigger | BlurredTrigger | PressedEscape | PressedPointerOnTrigger) => Message;
|
|
81
|
+
toParentMessage: (message: EnteredTrigger | LeftTrigger | FocusedTrigger | BlurredTrigger | PressedEscape | PressedPointerOnTrigger | typeof CompletedAnchorMount.Type) => Message;
|
|
79
82
|
anchor: AnchorConfig;
|
|
80
83
|
triggerContent: Html;
|
|
81
84
|
triggerClassName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMR,MAAM,IAAI,CAAC,EACZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMR,MAAM,IAAI,CAAC,EACZ,MAAM,QAAQ,CAAA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AAI,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iBAAiB,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACrD,OAAO,EAAE,IAAI,CAAA;IACb,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACnD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF,8SAA8S;AAC9S,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAsH3D,CAAA;AAED;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC,KACnE,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,KACpD,IAAI,CAgBR,CAAA"}
|
package/dist/ui/tooltip/index.js
CHANGED
|
@@ -3,9 +3,10 @@ import * as Command from '../../command/index.js';
|
|
|
3
3
|
import { OptionExt } from '../../effectExtensions/index.js';
|
|
4
4
|
import { createLazy, html, } from '../../html/index.js';
|
|
5
5
|
import { m } from '../../message/index.js';
|
|
6
|
+
import * as Mount from '../../mount/index.js';
|
|
6
7
|
import { evo } from '../../struct/index.js';
|
|
7
8
|
import * as Task from '../../task/index.js';
|
|
8
|
-
import {
|
|
9
|
+
import { anchorSetup } from '../anchor.js';
|
|
9
10
|
// MODEL
|
|
10
11
|
/** Schema for the tooltip component's state. `isOpen` is visibility; `isHovered` tracks pointer on trigger; `isFocused` tracks tooltip-affirming focus on the trigger (focus arriving without a preceding mouse press — keyboard, touch, or pen; mouse-click-induced focus is excluded since it doesn't affirm the user wants the tooltip visible); `isDismissed` suppresses re-opening after the user dismissed the tooltip (via Escape or left-click) until they disengage (leave or blur). `showDelay` is the hover-to-show duration. `maybeLastPointerType` records the most recent pointer type that pressed the trigger, so a mouse-click-induced focus can be distinguished from other focus. */
|
|
11
12
|
export const Model = S.Struct({
|
|
@@ -42,8 +43,10 @@ export const ElapsedShowDelay = m('ElapsedShowDelay', {
|
|
|
42
43
|
export const ChangedShowDelay = m('ChangedShowDelay', {
|
|
43
44
|
showDelay: S.DurationFromMillis,
|
|
44
45
|
});
|
|
46
|
+
/** Sent when the tooltip panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
47
|
+
export const CompletedAnchorMount = m('CompletedAnchorMount');
|
|
45
48
|
/** Union of all messages the tooltip component can produce. */
|
|
46
|
-
export const Message = S.Union(EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay);
|
|
49
|
+
export const Message = S.Union(EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, CompletedAnchorMount);
|
|
47
50
|
// INIT
|
|
48
51
|
const DEFAULT_SHOW_DELAY = Duration.millis(500);
|
|
49
52
|
const LEFT_MOUSE_BUTTON = 0;
|
|
@@ -63,6 +66,7 @@ export const init = (config) => ({
|
|
|
63
66
|
const withUpdateReturn = M.withReturnType();
|
|
64
67
|
/** Waits for the tooltip's show delay before emitting `ElapsedShowDelay`. The version is echoed back so a stale timer is ignored when the user leaves before the delay fires. */
|
|
65
68
|
export const ShowAfterDelay = Command.define('ShowAfterDelay', ElapsedShowDelay);
|
|
69
|
+
const TooltipAnchor = Mount.define('TooltipAnchor', CompletedAnchorMount);
|
|
66
70
|
/** Processes a tooltip message and returns the next model and commands. */
|
|
67
71
|
export const update = (model, message) => M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
68
72
|
EnteredTrigger: () => {
|
|
@@ -169,12 +173,13 @@ export const update = (model, message) => M.value(message).pipe(withUpdateReturn
|
|
|
169
173
|
evo(model, { showDelay: () => showDelay }),
|
|
170
174
|
[],
|
|
171
175
|
],
|
|
176
|
+
CompletedAnchorMount: () => [model, []],
|
|
172
177
|
}));
|
|
173
178
|
/** Programmatically updates the tooltip's hover show-delay. Use this in response to user preference changes, input-method switches, or reduced-motion settings. The new delay applies to the next hover; any pending timer is unaffected (its stale version will discard harmlessly when it fires). */
|
|
174
179
|
export const setShowDelay = (model, showDelay) => update(model, ChangedShowDelay({ showDelay: Duration.decode(showDelay) }));
|
|
175
180
|
/** Renders a headless tooltip with an anchored non-interactive panel. Shows on hover (after delay) or focus (from keyboard, touch, or pen; mouse-click focus is excluded); hides on leave, blur, Escape, or left-click of the trigger. Uses `role="tooltip"` and links the trigger via `aria-describedby`. */
|
|
176
181
|
export const view = (config) => {
|
|
177
|
-
const { div, AriaDescribedBy, AriaDisabled, Class, DataAttribute, Id, OnBlur,
|
|
182
|
+
const { div, AriaDescribedBy, AriaDisabled, Class, DataAttribute, Id, OnBlur, OnFocus, OnKeyDownPreventDefault, OnMount, OnMouseEnter, OnMouseLeave, OnPointerDown, Role, Style, Type, keyed, } = html();
|
|
178
183
|
const { model: { id, isOpen }, toParentMessage, anchor, triggerContent, triggerClassName, triggerAttributes = [], content, panelClassName, panelAttributes = [], isDisabled, className, attributes = [], } = config;
|
|
179
184
|
const handleTriggerKeyDown = (key) => M.value(key).pipe(M.when('Escape', () => OptionExt.when(isOpen, toParentMessage(PressedEscape()))), M.orElse(() => Option.none()));
|
|
180
185
|
const handleTriggerPointerDown = (pointerType, button) => Option.some(toParentMessage(PressedPointerOnTrigger({ pointerType, button })));
|
|
@@ -196,11 +201,14 @@ export const view = (config) => {
|
|
|
196
201
|
...(triggerClassName ? [Class(triggerClassName)] : []),
|
|
197
202
|
...triggerAttributes,
|
|
198
203
|
];
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
+
const anchorAction = Mount.mapMessage(TooltipAnchor((items) => Effect.sync(() => ({
|
|
205
|
+
message: CompletedAnchorMount(),
|
|
206
|
+
cleanup: anchorSetup({
|
|
207
|
+
buttonId: `${id}-trigger`,
|
|
208
|
+
anchor,
|
|
209
|
+
interceptTab: false,
|
|
210
|
+
})(items),
|
|
211
|
+
}))), toParentMessage);
|
|
204
212
|
const anchorAttributes = [
|
|
205
213
|
Style({
|
|
206
214
|
position: 'absolute',
|
|
@@ -208,8 +216,7 @@ export const view = (config) => {
|
|
|
208
216
|
visibility: 'hidden',
|
|
209
217
|
pointerEvents: 'none',
|
|
210
218
|
}),
|
|
211
|
-
|
|
212
|
-
OnDestroy(hooks.onDestroy),
|
|
219
|
+
OnMount(anchorAction),
|
|
213
220
|
];
|
|
214
221
|
const resolvedPanelAttributes = [
|
|
215
222
|
Id(`${id}-panel`),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, update, view, lazy, setShowDelay, Model, Message, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, ShowAfterDelay, } from './index.js';
|
|
1
|
+
export { init, update, view, lazy, setShowDelay, Model, Message, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, ShowAfterDelay, CompletedAnchorMount, } from './index.js';
|
|
2
2
|
export type { InitConfig, ViewConfig } from './index.js';
|
|
3
3
|
export type { AnchorConfig } from '../anchor.js';
|
|
4
4
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/tooltip/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/tooltip/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,GACrB,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAExD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, view, lazy, setShowDelay, Model, Message, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, ShowAfterDelay, } from './index.js';
|
|
1
|
+
export { init, update, view, lazy, setShowDelay, Model, Message, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, ShowAfterDelay, CompletedAnchorMount, } from './index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.0",
|
|
4
4
|
"description": "A frontend framework for TypeScript, built on Effect, using The Elm Architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"types": "./dist/message/public.d.ts",
|
|
32
32
|
"import": "./dist/message/public.js"
|
|
33
33
|
},
|
|
34
|
+
"./mount": {
|
|
35
|
+
"types": "./dist/mount/public.d.ts",
|
|
36
|
+
"import": "./dist/mount/public.js"
|
|
37
|
+
},
|
|
34
38
|
"./navigation": {
|
|
35
39
|
"types": "./dist/navigation/public.d.ts",
|
|
36
40
|
"import": "./dist/navigation/public.js"
|