@foldkit/ui 0.136.0 → 0.138.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.
Files changed (105) hide show
  1. package/dist/anchor.d.ts +7 -1
  2. package/dist/anchor.d.ts.map +1 -1
  3. package/dist/anchor.js +74 -26
  4. package/dist/animation/index.d.ts +5 -5
  5. package/dist/animation/index.d.ts.map +1 -1
  6. package/dist/animation/index.js +4 -4
  7. package/dist/animation/public.d.ts +1 -1
  8. package/dist/animation/public.d.ts.map +1 -1
  9. package/dist/animation/public.js +1 -1
  10. package/dist/animation/schema.d.ts +2 -2
  11. package/dist/animation/schema.d.ts.map +1 -1
  12. package/dist/animation/schema.js +2 -2
  13. package/dist/animation/update.d.ts +3 -3
  14. package/dist/animation/update.d.ts.map +1 -1
  15. package/dist/animation/update.js +8 -8
  16. package/dist/checkbox/index.d.ts +4 -0
  17. package/dist/checkbox/index.d.ts.map +1 -1
  18. package/dist/checkbox/index.js +4 -2
  19. package/dist/checkbox/public.d.ts +1 -1
  20. package/dist/checkbox/public.d.ts.map +1 -1
  21. package/dist/checkbox/public.js +1 -1
  22. package/dist/combobox/multi.d.ts +30 -8
  23. package/dist/combobox/multi.d.ts.map +1 -1
  24. package/dist/combobox/multiPublic.d.ts +1 -1
  25. package/dist/combobox/multiPublic.d.ts.map +1 -1
  26. package/dist/combobox/public.d.ts +3 -3
  27. package/dist/combobox/public.d.ts.map +1 -1
  28. package/dist/combobox/public.js +1 -1
  29. package/dist/combobox/shared.d.ts +4 -3
  30. package/dist/combobox/shared.d.ts.map +1 -1
  31. package/dist/combobox/shared.js +2 -2
  32. package/dist/combobox/single.d.ts +30 -8
  33. package/dist/combobox/single.d.ts.map +1 -1
  34. package/dist/datePicker/index.d.ts +2 -2
  35. package/dist/datePicker/index.d.ts.map +1 -1
  36. package/dist/datePicker/index.js +1 -1
  37. package/dist/dialog/index.d.ts +2 -2
  38. package/dist/dragAndDrop/index.d.ts +7 -7
  39. package/dist/dragAndDrop/index.d.ts.map +1 -1
  40. package/dist/dragAndDrop/index.js +8 -8
  41. package/dist/dragAndDrop/public.d.ts +1 -1
  42. package/dist/dragAndDrop/public.d.ts.map +1 -1
  43. package/dist/dragAndDrop/public.js +1 -1
  44. package/dist/listbox/multi.d.ts +31 -9
  45. package/dist/listbox/multi.d.ts.map +1 -1
  46. package/dist/listbox/multiPublic.d.ts +1 -1
  47. package/dist/listbox/multiPublic.d.ts.map +1 -1
  48. package/dist/listbox/public.d.ts +3 -3
  49. package/dist/listbox/public.d.ts.map +1 -1
  50. package/dist/listbox/public.js +1 -1
  51. package/dist/listbox/shared.d.ts +19 -10
  52. package/dist/listbox/shared.d.ts.map +1 -1
  53. package/dist/listbox/shared.js +22 -12
  54. package/dist/listbox/single.d.ts +31 -9
  55. package/dist/listbox/single.d.ts.map +1 -1
  56. package/dist/menu/index.d.ts +47 -19
  57. package/dist/menu/index.d.ts.map +1 -1
  58. package/dist/menu/index.js +24 -15
  59. package/dist/menu/public.d.ts +2 -2
  60. package/dist/menu/public.d.ts.map +1 -1
  61. package/dist/menu/public.js +1 -1
  62. package/dist/popover/index.d.ts +4 -3
  63. package/dist/popover/index.d.ts.map +1 -1
  64. package/dist/popover/public.d.ts +2 -2
  65. package/dist/popover/public.d.ts.map +1 -1
  66. package/dist/popover/public.js +1 -1
  67. package/dist/slider/public.d.ts +2 -2
  68. package/dist/slider/public.d.ts.map +1 -1
  69. package/dist/slider/public.js +1 -1
  70. package/dist/tabs/index.d.ts +13 -4
  71. package/dist/tabs/index.d.ts.map +1 -1
  72. package/dist/tabs/public.d.ts +2 -2
  73. package/dist/tabs/public.d.ts.map +1 -1
  74. package/dist/tabs/public.js +1 -1
  75. package/dist/test/apps/disabledButton.d.ts +2 -2
  76. package/dist/test/apps/disabledButton.js +1 -1
  77. package/dist/toast/index.d.ts +19 -18
  78. package/dist/toast/index.d.ts.map +1 -1
  79. package/dist/toast/index.js +5 -4
  80. package/dist/toast/public.d.ts +1 -1
  81. package/dist/toast/public.d.ts.map +1 -1
  82. package/dist/toast/public.js +1 -1
  83. package/dist/toast/schema.d.ts +5 -5
  84. package/dist/toast/schema.d.ts.map +1 -1
  85. package/dist/toast/schema.js +2 -2
  86. package/dist/toast/test.d.ts +6 -5
  87. package/dist/toast/test.d.ts.map +1 -1
  88. package/dist/toast/test.js +8 -7
  89. package/dist/toast/update.d.ts +14 -14
  90. package/dist/toast/update.d.ts.map +1 -1
  91. package/dist/toast/update.js +7 -7
  92. package/dist/tooltip/index.d.ts +2 -177
  93. package/dist/tooltip/index.d.ts.map +1 -1
  94. package/dist/tooltip/index.js +2 -260
  95. package/dist/tooltip/message.d.ts +53 -0
  96. package/dist/tooltip/message.d.ts.map +1 -0
  97. package/dist/tooltip/message.js +45 -0
  98. package/dist/tooltip/public.d.ts +1 -1
  99. package/dist/tooltip/public.d.ts.map +1 -1
  100. package/dist/tooltip/public.js +1 -1
  101. package/dist/tooltip/tooltip.d.ts +130 -0
  102. package/dist/tooltip/tooltip.d.ts.map +1 -0
  103. package/dist/tooltip/tooltip.js +226 -0
  104. package/dist/virtualList/index.js +5 -2
  105. package/package.json +2 -2
@@ -5,19 +5,19 @@ import { evo } from 'foldkit/struct';
5
5
  import { Hid as AnimationHid, Showed as AnimationShowed, init as animationInit, } from '../animation/schema.js';
6
6
  import { defaultLeaveCommand as animationDefaultLeaveCommand, update as animationUpdate, } from '../animation/update.js';
7
7
  import * as OptionExt from '../internal/optionExtensions.js';
8
- import { DEFAULT_DURATION, Dismissed, DismissedAll, ElapsedDuration, GotAnimationMessage, makeAdded, makeDismissedToast, makeEntry, makeMessage, makeModel, makeOutMessage, } from './schema.js';
8
+ import { CompletedWaitBeforeDismissal, DEFAULT_DURATION, Dismissed, DismissedAll, GotAnimationMessage, makeAdded, makeDismissedToast, makeEntry, makeMessage, makeModel, makeOutMessage, } from './schema.js';
9
9
  /** Schedules an auto-dismiss timer for an entry. The result Message carries a
10
10
  * version so stale timers (from hover or manual dismiss) are discarded in
11
11
  * the update function. Static. The Command definition doesn't depend on
12
12
  * payload. */
13
- export const DismissAfter = Command.define('DismissAfter', {
13
+ export const WaitBeforeDismissal = Command.define('WaitBeforeDismissal', {
14
14
  args: {
15
15
  entryId: S.String,
16
16
  version: S.Number,
17
17
  duration: S.DurationFromMillis,
18
18
  },
19
- messages: [ElapsedDuration],
20
- execute: ({ entryId, version, duration }) => __foldkitBrandViewResult((Effect.sleep(duration).pipe(Effect.as(ElapsedDuration({ entryId, version })))), "@foldkit/ui/toast/update.js#execute"),
19
+ messages: [CompletedWaitBeforeDismissal],
20
+ execute: ({ entryId, version, duration }) => __foldkitBrandViewResult((Effect.sleep(duration).pipe(Effect.as(CompletedWaitBeforeDismissal({ entryId, version })))), "@foldkit/ui/toast/update.js#execute"),
21
21
  });
22
22
  const DEFAULT_VARIANT = 'Info';
23
23
  /** Factory that binds Toast's runtime (update fn, helpers, commands) to a
@@ -45,7 +45,7 @@ export const makeRuntime = (payloadSchema) => {
45
45
  const { transitionState } = entry.animation;
46
46
  return (__foldkitBrandViewResult((transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating'), "@foldkit/ui/toast/update.js#isEntryLeaving"));
47
47
  };
48
- const scheduleDismiss = (entryId, version, duration) => __foldkitBrandViewResult((DismissAfter({ entryId, version, duration })), "@foldkit/ui/toast/update.js#scheduleDismiss");
48
+ const scheduleDismiss = (entryId, version, duration) => __foldkitBrandViewResult((WaitBeforeDismissal({ entryId, version, duration })), "@foldkit/ui/toast/update.js#scheduleDismiss");
49
49
  const rescheduleDismissCommands = (entry) => {
50
50
  if (isEntryLeaving(entry) || entry.isHovered) {
51
51
  return __foldkitBrandViewResult(([]), "@foldkit/ui/toast/update.js#rescheduleDismissCommands");
@@ -166,7 +166,7 @@ export const makeRuntime = (payloadSchema) => {
166
166
  currentOut,
167
167
  ]), "@foldkit/ui/toast/update.js#anonymous~8");
168
168
  })), "@foldkit/ui/toast/update.js#DismissedAll"),
169
- ElapsedDuration: ({ entryId, version }) => {
169
+ CompletedWaitBeforeDismissal: ({ entryId, version }) => {
170
170
  const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~9"));
171
171
  return __foldkitBrandViewResult((Option.match(maybeEntry, {
172
172
  onNone: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/toast/update.js#onNone~6"),
@@ -179,7 +179,7 @@ export const makeRuntime = (payloadSchema) => {
179
179
  return __foldkitBrandViewResult((delegateToEntryAnimation(model, entryId, AnimationHid())), "@foldkit/ui/toast/update.js#onSome~4");
180
180
  }
181
181
  },
182
- })), "@foldkit/ui/toast/update.js#ElapsedDuration");
182
+ })), "@foldkit/ui/toast/update.js#CompletedWaitBeforeDismissal");
183
183
  },
184
184
  HoveredEntry: ({ entryId }) => __foldkitBrandViewResult(([
185
185
  updateEntry(model, entryId, entry => __foldkitBrandViewResult((evo(entry, {
@@ -1,178 +1,3 @@
1
- import { Duration, Effect, Option, Schema as S } from 'effect';
2
- import * as Command from 'foldkit/command';
3
- import { type ChildAttribute, type Html } from 'foldkit/html';
4
- import * as Mount from 'foldkit/mount';
5
- import { type Reflect } from 'foldkit/submodel';
6
- import { AnchorConfig } from '../anchor.js';
7
- /** 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, like 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) 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. */
8
- export declare const Model: S.Struct<{
9
- readonly id: S.String;
10
- readonly isOpen: S.Boolean;
11
- readonly isHovered: S.Boolean;
12
- readonly isFocused: S.Boolean;
13
- readonly isDismissed: S.Boolean;
14
- readonly showDelay: S.DurationFromMillis;
15
- readonly pendingShowVersion: S.Number;
16
- readonly maybeLastPointerType: S.Option<S.String>;
17
- }>;
18
- export type Model = typeof Model.Type;
19
- /** Sent when the pointer enters the tooltip trigger. */
20
- export declare const EnteredTrigger: import("foldkit/schema").CallableTaggedStruct<"EnteredTrigger", {}>;
21
- /** Sent when the pointer leaves the tooltip trigger. */
22
- export declare const LeftTrigger: import("foldkit/schema").CallableTaggedStruct<"LeftTrigger", {}>;
23
- /** Sent when focus enters the trigger. */
24
- export declare const FocusedTrigger: import("foldkit/schema").CallableTaggedStruct<"FocusedTrigger", {}>;
25
- /** Sent when focus leaves the trigger. */
26
- export declare const BlurredTrigger: import("foldkit/schema").CallableTaggedStruct<"BlurredTrigger", {}>;
27
- /** Sent when Escape is pressed while the tooltip is visible. */
28
- export declare const PressedEscape: import("foldkit/schema").CallableTaggedStruct<"PressedEscape", {}>;
29
- /** Sent when a pointer presses the trigger. Recorded so the focus that
30
- * follows a mouse press can be told apart from focus that affirms the
31
- * tooltip (keyboard, touch, or pen). */
32
- export declare const PressedPointerOnTrigger: import("foldkit/schema").CallableTaggedStruct<"PressedPointerOnTrigger", {
33
- pointerType: S.String;
34
- }>;
35
- /** Sent when the show-delay timer fires. */
36
- export declare const ElapsedShowDelay: import("foldkit/schema").CallableTaggedStruct<"ElapsedShowDelay", {
37
- version: S.Number;
38
- }>;
39
- /** Sent when the tooltip panel mounts and Floating UI has positioned it. */
40
- export declare const CompletedAnchorTooltip: import("foldkit/schema").CallableTaggedStruct<"CompletedAnchorTooltip", {}>;
41
- /** Union of all messages the tooltip component can produce. */
42
- export declare const Message: S.Union<[
43
- typeof EnteredTrigger,
44
- typeof LeftTrigger,
45
- typeof FocusedTrigger,
46
- typeof BlurredTrigger,
47
- typeof PressedEscape,
48
- typeof PressedPointerOnTrigger,
49
- typeof ElapsedShowDelay,
50
- typeof CompletedAnchorTooltip
51
- ]>;
52
- export type EnteredTrigger = typeof EnteredTrigger.Type;
53
- export type LeftTrigger = typeof LeftTrigger.Type;
54
- export type FocusedTrigger = typeof FocusedTrigger.Type;
55
- export type BlurredTrigger = typeof BlurredTrigger.Type;
56
- export type PressedEscape = typeof PressedEscape.Type;
57
- export type PressedPointerOnTrigger = typeof PressedPointerOnTrigger.Type;
58
- export type Message = typeof Message.Type;
59
- /** Emitted once the tooltip transitions to visible (`isOpen` becomes true).
60
- * Consumers typically use this for analytics, instrumentation, or to
61
- * coordinate with other transient UI. */
62
- export declare const Shown: import("foldkit/schema").CallableTaggedStruct<"Shown", {}>;
63
- /** Emitted once the tooltip transitions to hidden (`isOpen` becomes false). */
64
- export declare const Hidden: import("foldkit/schema").CallableTaggedStruct<"Hidden", {}>;
65
- /** Union of out-messages the tooltip component can produce. */
66
- export declare const OutMessage: S.Union<readonly [import("foldkit/schema").CallableTaggedStruct<"Shown", {}>, import("foldkit/schema").CallableTaggedStruct<"Hidden", {}>]>;
67
- export type Shown = typeof Shown.Type;
68
- export type Hidden = typeof Hidden.Type;
69
- export type OutMessage = typeof OutMessage.Type;
70
- /** Returns the bare DOM id of the tooltip trigger button, derived from the
71
- * tooltip's base id. Use this to associate an external label with the
72
- * trigger via a native `<label for={Tooltip.triggerId(id)}>` or an
73
- * `aria-labelledby` reference. */
74
- export declare const triggerId: (id: string) => string;
75
- /** Configuration for creating a tooltip model with `init`. */
76
- export type InitConfig = Readonly<{
77
- id: string;
78
- showDelay?: Duration.Input;
79
- }>;
80
- /** Creates an initial tooltip model from a config. Defaults to hidden. */
81
- export declare const init: (config: InitConfig) => Model;
82
- /** Waits for the tooltip's show delay before emitting `ElapsedShowDelay`. */
83
- export declare const ShowAfterDelay: Command.CommandDefinitionWithArgs<"ShowAfterDelay", {
84
- delay: S.DurationFromMillis;
85
- version: S.Number;
86
- }, Effect.Effect<{
87
- readonly _tag: "ElapsedShowDelay";
88
- readonly version: number;
89
- }, never, never>>;
90
- /** The anchor-positioning Mount this Tooltip renders on its panel. */
91
- export declare const AnchorTooltip: Mount.MountDefinitionWithArgs<"AnchorTooltip", {
92
- buttonId: S.String;
93
- anchor: S.Struct<{
94
- readonly placement: S.optional<S.Literals<readonly ["top", "right", "bottom", "left", "top-start", "top-end", "right-start", "right-end", "bottom-start", "bottom-end", "left-start", "left-end"]>>;
95
- readonly gap: S.optional<S.Number>;
96
- readonly offset: S.optional<S.Number>;
97
- readonly padding: S.optional<S.Number>;
98
- readonly portal: S.optional<S.Boolean>;
99
- }>;
100
- }, {
101
- readonly _tag: "CompletedAnchorTooltip";
102
- }>;
103
- type UpdateReturn = readonly [
104
- Model,
105
- ReadonlyArray<Command.Command<Message>>,
106
- Option.Option<OutMessage>
107
- ];
108
- /** Processes a tooltip message and returns the next model, commands, and
109
- * an optional OutMessage. `Shown`/`Hidden` fire only on `isOpen`
110
- * transitions, so consumers don't get spurious events for messages that
111
- * only update hover/focus/delay state without changing visibility. */
112
- export declare const update: (model: Model, message: Message) => UpdateReturn;
113
- /** Reflects an externally-sourced hover show-delay onto the model without
114
- * emitting an OutMessage. Use to mirror an external config value (a user
115
- * preference, a restored setting) onto the tooltip. */
116
- export declare const reflectShowDelay: Reflect<Model, Duration.Input>;
117
- /** Render-time payload published to the consumer's `toView`.
118
- *
119
- * - `trigger`: attribute bundle for the trigger element. Carries the
120
- * hover/focus/keyboard handlers + ARIA `aria-describedby` linking to
121
- * the panel.
122
- * - `panel`: attribute bundle for the panel element. Carries the
123
- * `role="tooltip"`, the anchor Mount that positions the panel via
124
- * Floating UI, and a `data-open` attribute when visible.
125
- * - `isVisible`: derived state. The consumer decides whether to render
126
- * the panel conditionally on this. */
127
- export type RenderInfo = Readonly<{
128
- trigger: ReadonlyArray<ChildAttribute>;
129
- panel: ReadonlyArray<ChildAttribute>;
130
- isVisible: boolean;
131
- }>;
132
- /** Per-render view inputs passed to `view` via `h.submodel`'s `viewInputs` field. */
133
- export type ViewInputs = Readonly<{
134
- anchor: AnchorConfig;
135
- toView: (render: RenderInfo) => Html;
136
- isDisabled?: boolean;
137
- ariaLabel?: string;
138
- ariaLabelledBy?: string;
139
- }>;
140
- /** Renders a headless tooltip with an anchored non-interactive panel.
141
- * Shows on hover (after delay) or focus (from keyboard, touch, or pen;
142
- * mouse-click focus is excluded). Hides on leave, blur, or Escape. */
143
- export declare const view: import("foldkit/submodel").View<{
144
- readonly id: string;
145
- readonly isOpen: boolean;
146
- readonly isHovered: boolean;
147
- readonly isFocused: boolean;
148
- readonly isDismissed: boolean;
149
- readonly showDelay: Duration.Duration;
150
- readonly pendingShowVersion: number;
151
- readonly maybeLastPointerType: Option.Option<string>;
152
- }, {
153
- readonly _tag: "EnteredTrigger";
154
- } | {
155
- readonly _tag: "LeftTrigger";
156
- } | {
157
- readonly _tag: "FocusedTrigger";
158
- } | {
159
- readonly _tag: "BlurredTrigger";
160
- } | {
161
- readonly _tag: "PressedEscape";
162
- } | {
163
- readonly _tag: "PressedPointerOnTrigger";
164
- readonly pointerType: string;
165
- } | {
166
- readonly _tag: "ElapsedShowDelay";
167
- readonly version: number;
168
- } | {
169
- readonly _tag: "CompletedAnchorTooltip";
170
- }, Readonly<{
171
- anchor: AnchorConfig;
172
- toView: (render: RenderInfo) => Html;
173
- isDisabled?: boolean;
174
- ariaLabel?: string;
175
- ariaLabelledBy?: string;
176
- }>>;
177
- export {};
1
+ export * from './message.js';
2
+ export * from './tooltip.js';
178
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tooltip/index.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tooltip/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA"}
@@ -1,260 +1,2 @@
1
- import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
- import { Duration, Effect, Equal, Function, Match as M, Number, Option, Predicate, Schema as S, } from 'effect';
3
- import * as Command from 'foldkit/command';
4
- import { childAttributes } from 'foldkit/html';
5
- import { m } from 'foldkit/message';
6
- import * as Mount from 'foldkit/mount';
7
- import { evo } from 'foldkit/struct';
8
- import { defineView } from 'foldkit/submodel';
9
- import { AnchorConfig, anchorSetup } from '../anchor.js';
10
- import * as OptionExt from '../internal/optionExtensions.js';
11
- // MODEL
12
- /** 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, like 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) 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. */
13
- export const Model = S.Struct({
14
- id: S.String,
15
- isOpen: S.Boolean,
16
- isHovered: S.Boolean,
17
- isFocused: S.Boolean,
18
- isDismissed: S.Boolean,
19
- showDelay: S.DurationFromMillis,
20
- pendingShowVersion: S.Number,
21
- maybeLastPointerType: S.Option(S.String),
22
- });
23
- // MESSAGE
24
- /** Sent when the pointer enters the tooltip trigger. */
25
- export const EnteredTrigger = m('EnteredTrigger');
26
- /** Sent when the pointer leaves the tooltip trigger. */
27
- export const LeftTrigger = m('LeftTrigger');
28
- /** Sent when focus enters the trigger. */
29
- export const FocusedTrigger = m('FocusedTrigger');
30
- /** Sent when focus leaves the trigger. */
31
- export const BlurredTrigger = m('BlurredTrigger');
32
- /** Sent when Escape is pressed while the tooltip is visible. */
33
- export const PressedEscape = m('PressedEscape');
34
- /** Sent when a pointer presses the trigger. Recorded so the focus that
35
- * follows a mouse press can be told apart from focus that affirms the
36
- * tooltip (keyboard, touch, or pen). */
37
- export const PressedPointerOnTrigger = m('PressedPointerOnTrigger', {
38
- pointerType: S.String,
39
- });
40
- /** Sent when the show-delay timer fires. */
41
- export const ElapsedShowDelay = m('ElapsedShowDelay', {
42
- version: S.Number,
43
- });
44
- /** Sent when the tooltip panel mounts and Floating UI has positioned it. */
45
- export const CompletedAnchorTooltip = m('CompletedAnchorTooltip');
46
- /** Union of all messages the tooltip component can produce. */
47
- export const Message = S.Union([
48
- EnteredTrigger,
49
- LeftTrigger,
50
- FocusedTrigger,
51
- BlurredTrigger,
52
- PressedEscape,
53
- PressedPointerOnTrigger,
54
- ElapsedShowDelay,
55
- CompletedAnchorTooltip,
56
- ]);
57
- // OUT MESSAGE
58
- /** Emitted once the tooltip transitions to visible (`isOpen` becomes true).
59
- * Consumers typically use this for analytics, instrumentation, or to
60
- * coordinate with other transient UI. */
61
- export const Shown = m('Shown');
62
- /** Emitted once the tooltip transitions to hidden (`isOpen` becomes false). */
63
- export const Hidden = m('Hidden');
64
- /** Union of out-messages the tooltip component can produce. */
65
- export const OutMessage = S.Union([Shown, Hidden]);
66
- // SELECTORS
67
- /** Returns the bare DOM id of the tooltip trigger button, derived from the
68
- * tooltip's base id. Use this to associate an external label with the
69
- * trigger via a native `<label for={Tooltip.triggerId(id)}>` or an
70
- * `aria-labelledby` reference. */
71
- export const triggerId = (id) => __foldkitBrandViewResult((`${id}-trigger`), "@foldkit/ui/tooltip/index.js#triggerId");
72
- // INIT
73
- const DEFAULT_SHOW_DELAY = Duration.millis(500);
74
- /** Creates an initial tooltip model from a config. Defaults to hidden. */
75
- export const init = (config) => (__foldkitBrandViewResult(({
76
- id: config.id,
77
- isOpen: false,
78
- isHovered: false,
79
- isFocused: false,
80
- isDismissed: false,
81
- showDelay: config.showDelay === undefined
82
- ? DEFAULT_SHOW_DELAY
83
- : Duration.fromInputUnsafe(config.showDelay),
84
- pendingShowVersion: 0,
85
- maybeLastPointerType: Option.none(),
86
- }), "@foldkit/ui/tooltip/index.js#init"));
87
- const withUpdateReturn = M.withReturnType();
88
- /** Waits for the tooltip's show delay before emitting `ElapsedShowDelay`. */
89
- export const ShowAfterDelay = Command.define('ShowAfterDelay', {
90
- args: { delay: S.DurationFromMillis, version: S.Number },
91
- messages: [ElapsedShowDelay],
92
- execute: ({ delay, version }) => __foldkitBrandViewResult((Effect.sleep(delay).pipe(Effect.as(ElapsedShowDelay({ version })))), "@foldkit/ui/tooltip/index.js#execute"),
93
- });
94
- /** The anchor-positioning Mount this Tooltip renders on its panel. */
95
- export const AnchorTooltip = Mount.define('AnchorTooltip', { buttonId: S.String, anchor: AnchorConfig }, CompletedAnchorTooltip)(({ buttonId, anchor }) => __foldkitBrandViewResult((element => __foldkitBrandViewResult((Effect.gen(function* () {
96
- yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((anchorSetup({
97
- buttonId,
98
- anchor,
99
- interceptTab: false,
100
- })(element)), "@foldkit/ui/tooltip/index.js#anonymous~4")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/tooltip/index.js#anonymous~5"));
101
- return __foldkitBrandViewResult((CompletedAnchorTooltip()), "@foldkit/ui/tooltip/index.js#anonymous~3");
102
- })), "@foldkit/ui/tooltip/index.js#anonymous~2")), "@foldkit/ui/tooltip/index.js#anonymous"));
103
- const computeUpdate = (model, message) => __foldkitBrandViewResult((M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
104
- EnteredTrigger: () => {
105
- if (model.isOpen || model.isDismissed) {
106
- return __foldkitBrandViewResult(([evo(model, { isHovered: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/index.js#isHovered") }), []]), "@foldkit/ui/tooltip/index.js#EnteredTrigger");
107
- }
108
- const nextVersion = Number.increment(model.pendingShowVersion);
109
- return __foldkitBrandViewResult(([
110
- evo(model, {
111
- isHovered: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/index.js#isHovered~2"),
112
- pendingShowVersion: () => __foldkitBrandViewResult((nextVersion), "@foldkit/ui/tooltip/index.js#pendingShowVersion"),
113
- }),
114
- [ShowAfterDelay({ delay: model.showDelay, version: nextVersion })],
115
- ]), "@foldkit/ui/tooltip/index.js#EnteredTrigger");
116
- },
117
- LeftTrigger: () => __foldkitBrandViewResult(([
118
- evo(model, {
119
- isHovered: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/index.js#isHovered~3"),
120
- isOpen: () => __foldkitBrandViewResult((model.isFocused && model.isOpen), "@foldkit/ui/tooltip/index.js#isOpen"),
121
- isDismissed: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/index.js#isDismissed"),
122
- pendingShowVersion: Number.increment,
123
- }),
124
- [],
125
- ]), "@foldkit/ui/tooltip/index.js#LeftTrigger"),
126
- FocusedTrigger: () => {
127
- const isFromMousePress = Option.exists(model.maybeLastPointerType, Equal.equals('mouse'));
128
- if (isFromMousePress) {
129
- return __foldkitBrandViewResult(([
130
- evo(model, {
131
- maybeLastPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tooltip/index.js#maybeLastPointerType"),
132
- }),
133
- [],
134
- ]), "@foldkit/ui/tooltip/index.js#FocusedTrigger");
135
- }
136
- if (model.isDismissed) {
137
- return __foldkitBrandViewResult(([
138
- evo(model, {
139
- isFocused: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/index.js#isFocused"),
140
- maybeLastPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tooltip/index.js#maybeLastPointerType~2"),
141
- }),
142
- [],
143
- ]), "@foldkit/ui/tooltip/index.js#FocusedTrigger");
144
- }
145
- return __foldkitBrandViewResult(([
146
- evo(model, {
147
- isFocused: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/index.js#isFocused~2"),
148
- isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/index.js#isOpen~2"),
149
- pendingShowVersion: Number.increment,
150
- }),
151
- [],
152
- ]), "@foldkit/ui/tooltip/index.js#FocusedTrigger");
153
- },
154
- BlurredTrigger: () => __foldkitBrandViewResult(([
155
- evo(model, {
156
- isFocused: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/index.js#isFocused~3"),
157
- isOpen: () => __foldkitBrandViewResult((model.isHovered && model.isOpen), "@foldkit/ui/tooltip/index.js#isOpen~3"),
158
- isDismissed: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/index.js#isDismissed~2"),
159
- pendingShowVersion: Number.increment,
160
- maybeLastPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tooltip/index.js#maybeLastPointerType~3"),
161
- }),
162
- [],
163
- ]), "@foldkit/ui/tooltip/index.js#BlurredTrigger"),
164
- PressedEscape: () => __foldkitBrandViewResult(([
165
- evo(model, {
166
- isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/index.js#isOpen~4"),
167
- isDismissed: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/index.js#isDismissed~3"),
168
- pendingShowVersion: Number.increment,
169
- }),
170
- [],
171
- ]), "@foldkit/ui/tooltip/index.js#PressedEscape"),
172
- PressedPointerOnTrigger: ({ pointerType }) => __foldkitBrandViewResult(([
173
- evo(model, {
174
- maybeLastPointerType: () => __foldkitBrandViewResult((Option.some(pointerType)), "@foldkit/ui/tooltip/index.js#maybeLastPointerType~4"),
175
- }),
176
- [],
177
- ]), "@foldkit/ui/tooltip/index.js#PressedPointerOnTrigger"),
178
- ElapsedShowDelay: ({ version }) => {
179
- if (version !== model.pendingShowVersion) {
180
- return __foldkitBrandViewResult(([model, []]), "@foldkit/ui/tooltip/index.js#ElapsedShowDelay");
181
- }
182
- if (!model.isHovered) {
183
- return __foldkitBrandViewResult(([model, []]), "@foldkit/ui/tooltip/index.js#ElapsedShowDelay");
184
- }
185
- return __foldkitBrandViewResult(([evo(model, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/index.js#isOpen~5") }), []]), "@foldkit/ui/tooltip/index.js#ElapsedShowDelay");
186
- },
187
- CompletedAnchorTooltip: () => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/tooltip/index.js#CompletedAnchorTooltip"),
188
- }))), "@foldkit/ui/tooltip/index.js#computeUpdate");
189
- /** Processes a tooltip message and returns the next model, commands, and
190
- * an optional OutMessage. `Shown`/`Hidden` fire only on `isOpen`
191
- * transitions, so consumers don't get spurious events for messages that
192
- * only update hover/focus/delay state without changing visibility. */
193
- export const update = (model, message) => {
194
- const [nextModel, commands] = computeUpdate(model, message);
195
- const maybeOutMessage = !model.isOpen && nextModel.isOpen
196
- ? Option.some(Shown())
197
- : model.isOpen && !nextModel.isOpen
198
- ? Option.some(Hidden())
199
- : Option.none();
200
- return __foldkitBrandViewResult(([nextModel, commands, maybeOutMessage]), "@foldkit/ui/tooltip/index.js#update");
201
- };
202
- /** Reflects an externally-sourced hover show-delay onto the model without
203
- * emitting an OutMessage. Use to mirror an external config value (a user
204
- * preference, a restored setting) onto the tooltip. */
205
- export const reflectShowDelay = Function.dual(2, (model, showDelay) => __foldkitBrandViewResult((evo(model, { showDelay: () => __foldkitBrandViewResult((Duration.fromInputUnsafe(showDelay)), "@foldkit/ui/tooltip/index.js#showDelay") })), "@foldkit/ui/tooltip/index.js#anonymous~6"));
206
- /** Renders a headless tooltip with an anchored non-interactive panel.
207
- * Shows on hover (after delay) or focus (from keyboard, touch, or pen;
208
- * mouse-click focus is excluded). Hides on leave, blur, or Escape. */
209
- export const view = defineView((model, viewInputs, h) => {
210
- const { id, isOpen } = model;
211
- const { anchor, toView, isDisabled, ariaLabel, ariaLabelledBy } = viewInputs;
212
- const resolveTriggerLabel = () => {
213
- if (Predicate.isNotUndefined(ariaLabel)) {
214
- return __foldkitBrandViewResult(([h.AriaLabel(ariaLabel)]), "@foldkit/ui/tooltip/index.js#resolveTriggerLabel");
215
- }
216
- else if (Predicate.isNotUndefined(ariaLabelledBy)) {
217
- return __foldkitBrandViewResult(([h.AriaLabelledBy(ariaLabelledBy)]), "@foldkit/ui/tooltip/index.js#resolveTriggerLabel");
218
- }
219
- else {
220
- return __foldkitBrandViewResult(([]), "@foldkit/ui/tooltip/index.js#resolveTriggerLabel");
221
- }
222
- };
223
- const triggerLabelAttributes = resolveTriggerLabel();
224
- const handleTriggerKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((OptionExt.when(isOpen, PressedEscape())), "@foldkit/ui/tooltip/index.js#anonymous~8")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tooltip/index.js#anonymous~9")))), "@foldkit/ui/tooltip/index.js#handleTriggerKeyDown");
225
- const handleTriggerPointerDown = (pointerType) => __foldkitBrandViewResult((Option.some(PressedPointerOnTrigger({ pointerType }))), "@foldkit/ui/tooltip/index.js#handleTriggerPointerDown");
226
- const triggerAttributes = [
227
- h.Id(`${id}-trigger`),
228
- h.Type('button'),
229
- h.AriaDescribedBy(`${id}-panel`),
230
- ...triggerLabelAttributes,
231
- ...(isOpen ? [h.DataAttribute('open', '')] : []),
232
- ...(isDisabled
233
- ? [h.AriaDisabled(true), h.DataAttribute('disabled', '')]
234
- : [
235
- h.OnMouseEnter(EnteredTrigger()),
236
- h.OnMouseLeave(LeftTrigger()),
237
- h.OnFocus(FocusedTrigger()),
238
- h.OnBlur(BlurredTrigger()),
239
- h.OnKeyDownPreventDefault(handleTriggerKeyDown),
240
- h.OnPointerDown(handleTriggerPointerDown),
241
- ]),
242
- ];
243
- const panelAttributes = [
244
- h.Id(`${id}-panel`),
245
- h.Role('tooltip'),
246
- h.Style({
247
- position: 'absolute',
248
- margin: '0',
249
- visibility: 'hidden',
250
- pointerEvents: 'none',
251
- }),
252
- h.OnMount(AnchorTooltip({ buttonId: `${id}-trigger`, anchor })),
253
- ...(isOpen ? [h.DataAttribute('open', '')] : []),
254
- ];
255
- return __foldkitBrandViewResult((toView({
256
- trigger: childAttributes(triggerAttributes),
257
- panel: childAttributes(panelAttributes),
258
- isVisible: isOpen,
259
- })), "@foldkit/ui/tooltip/index.js#anonymous~7");
260
- });
1
+ export * from './message.js';
2
+ export * from './tooltip.js';
@@ -0,0 +1,53 @@
1
+ import { Schema as S } from 'effect';
2
+ /** Sent when the pointer enters the tooltip trigger. */
3
+ export declare const EnteredTrigger: import("foldkit/schema").CallableTaggedStruct<"EnteredTrigger", {}>;
4
+ /** Sent when the pointer leaves the tooltip trigger. */
5
+ export declare const LeftTrigger: import("foldkit/schema").CallableTaggedStruct<"LeftTrigger", {}>;
6
+ /** Sent when focus enters the trigger. */
7
+ export declare const FocusedTrigger: import("foldkit/schema").CallableTaggedStruct<"FocusedTrigger", {}>;
8
+ /** Sent when focus leaves the trigger. */
9
+ export declare const BlurredTrigger: import("foldkit/schema").CallableTaggedStruct<"BlurredTrigger", {}>;
10
+ /** Sent when Escape is pressed while the tooltip is visible. */
11
+ export declare const PressedEscape: import("foldkit/schema").CallableTaggedStruct<"PressedEscape", {}>;
12
+ /** Sent when a pointer presses the trigger. Recorded so the focus that
13
+ * follows a mouse press can be told apart from focus that affirms the
14
+ * tooltip (keyboard, touch, or pen). */
15
+ export declare const PressedPointerOnTrigger: import("foldkit/schema").CallableTaggedStruct<"PressedPointerOnTrigger", {
16
+ pointerType: S.String;
17
+ }>;
18
+ /** Sent when the show-delay timer fires. */
19
+ export declare const CompletedWaitBeforeShowing: import("foldkit/schema").CallableTaggedStruct<"CompletedWaitBeforeShowing", {
20
+ version: S.Number;
21
+ }>;
22
+ /** Sent when the tooltip panel mounts and Floating UI has positioned it. */
23
+ export declare const CompletedAnchorTooltip: import("foldkit/schema").CallableTaggedStruct<"CompletedAnchorTooltip", {}>;
24
+ /** Union of all messages the tooltip component can produce. */
25
+ export declare const Message: S.Union<[
26
+ typeof EnteredTrigger,
27
+ typeof LeftTrigger,
28
+ typeof FocusedTrigger,
29
+ typeof BlurredTrigger,
30
+ typeof PressedEscape,
31
+ typeof PressedPointerOnTrigger,
32
+ typeof CompletedWaitBeforeShowing,
33
+ typeof CompletedAnchorTooltip
34
+ ]>;
35
+ export type EnteredTrigger = typeof EnteredTrigger.Type;
36
+ export type LeftTrigger = typeof LeftTrigger.Type;
37
+ export type FocusedTrigger = typeof FocusedTrigger.Type;
38
+ export type BlurredTrigger = typeof BlurredTrigger.Type;
39
+ export type PressedEscape = typeof PressedEscape.Type;
40
+ export type PressedPointerOnTrigger = typeof PressedPointerOnTrigger.Type;
41
+ export type Message = typeof Message.Type;
42
+ /** Emitted once the tooltip transitions to visible (`isOpen` becomes true).
43
+ * Consumers typically use this for analytics, instrumentation, or to
44
+ * coordinate with other transient UI. */
45
+ export declare const Shown: import("foldkit/schema").CallableTaggedStruct<"Shown", {}>;
46
+ /** Emitted once the tooltip transitions to hidden (`isOpen` becomes false). */
47
+ export declare const Hidden: import("foldkit/schema").CallableTaggedStruct<"Hidden", {}>;
48
+ /** Union of out-messages the tooltip component can produce. */
49
+ export declare const OutMessage: S.Union<readonly [import("foldkit/schema").CallableTaggedStruct<"Shown", {}>, import("foldkit/schema").CallableTaggedStruct<"Hidden", {}>]>;
50
+ export type Shown = typeof Shown.Type;
51
+ export type Hidden = typeof Hidden.Type;
52
+ export type OutMessage = typeof OutMessage.Type;
53
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/tooltip/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAKpC,wDAAwD;AACxD,eAAO,MAAM,cAAc,qEAAsB,CAAA;AACjD,wDAAwD;AACxD,eAAO,MAAM,WAAW,kEAAmB,CAAA;AAC3C,0CAA0C;AAC1C,eAAO,MAAM,cAAc,qEAAsB,CAAA;AACjD,0CAA0C;AAC1C,eAAO,MAAM,cAAc,qEAAsB,CAAA;AACjD,gEAAgE;AAChE,eAAO,MAAM,aAAa,oEAAqB,CAAA;AAC/C;;yCAEyC;AACzC,eAAO,MAAM,uBAAuB;;EAElC,CAAA;AACF,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B;;EAErC,CAAA;AACF,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,6EAA8B,CAAA;AAEjE,+DAA+D;AAC/D,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,KAAK,CAC3B;IACE,OAAO,cAAc;IACrB,OAAO,WAAW;IAClB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,aAAa;IACpB,OAAO,uBAAuB;IAC9B,OAAO,0BAA0B;IACjC,OAAO,sBAAsB;CAC9B,CAUD,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AACvD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AACjD,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AACvD,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AACvD,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AACrD,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAA;AAEzE,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC;;0CAE0C;AAC1C,eAAO,MAAM,KAAK,4DAAa,CAAA;AAE/B,+EAA+E;AAC/E,eAAO,MAAM,MAAM,6DAAc,CAAA;AAEjC,+DAA+D;AAC/D,eAAO,MAAM,UAAU,6IAA2B,CAAA;AAElD,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AACrC,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AACvC,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA"}
@@ -0,0 +1,45 @@
1
+ import { Schema as S } from 'effect';
2
+ import { m } from 'foldkit/message';
3
+ // MESSAGE
4
+ /** Sent when the pointer enters the tooltip trigger. */
5
+ export const EnteredTrigger = m('EnteredTrigger');
6
+ /** Sent when the pointer leaves the tooltip trigger. */
7
+ export const LeftTrigger = m('LeftTrigger');
8
+ /** Sent when focus enters the trigger. */
9
+ export const FocusedTrigger = m('FocusedTrigger');
10
+ /** Sent when focus leaves the trigger. */
11
+ export const BlurredTrigger = m('BlurredTrigger');
12
+ /** Sent when Escape is pressed while the tooltip is visible. */
13
+ export const PressedEscape = m('PressedEscape');
14
+ /** Sent when a pointer presses the trigger. Recorded so the focus that
15
+ * follows a mouse press can be told apart from focus that affirms the
16
+ * tooltip (keyboard, touch, or pen). */
17
+ export const PressedPointerOnTrigger = m('PressedPointerOnTrigger', {
18
+ pointerType: S.String,
19
+ });
20
+ /** Sent when the show-delay timer fires. */
21
+ export const CompletedWaitBeforeShowing = m('CompletedWaitBeforeShowing', {
22
+ version: S.Number,
23
+ });
24
+ /** Sent when the tooltip panel mounts and Floating UI has positioned it. */
25
+ export const CompletedAnchorTooltip = m('CompletedAnchorTooltip');
26
+ /** Union of all messages the tooltip component can produce. */
27
+ export const Message = S.Union([
28
+ EnteredTrigger,
29
+ LeftTrigger,
30
+ FocusedTrigger,
31
+ BlurredTrigger,
32
+ PressedEscape,
33
+ PressedPointerOnTrigger,
34
+ CompletedWaitBeforeShowing,
35
+ CompletedAnchorTooltip,
36
+ ]);
37
+ // OUT MESSAGE
38
+ /** Emitted once the tooltip transitions to visible (`isOpen` becomes true).
39
+ * Consumers typically use this for analytics, instrumentation, or to
40
+ * coordinate with other transient UI. */
41
+ export const Shown = m('Shown');
42
+ /** Emitted once the tooltip transitions to hidden (`isOpen` becomes false). */
43
+ export const Hidden = m('Hidden');
44
+ /** Union of out-messages the tooltip component can produce. */
45
+ export const OutMessage = S.Union([Shown, Hidden]);
@@ -1,4 +1,4 @@
1
- export { init, update, view, triggerId, reflectShowDelay, Model, Message, OutMessage, Shown, Hidden, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ShowAfterDelay, CompletedAnchorTooltip, AnchorTooltip, } from './index.js';
1
+ export { init, update, view, triggerId, reflectShowDelay, Model, Message, OutMessage, Shown, Hidden, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, CompletedWaitBeforeShowing, WaitBeforeShowing, CompletedAnchorTooltip, AnchorTooltip, } from './index.js';
2
2
  export type { InitConfig, ViewInputs, RenderInfo } 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/tooltip/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,aAAa,GACd,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEpE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/tooltip/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,GACd,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEpE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
@@ -1 +1 @@
1
- export { init, update, view, triggerId, reflectShowDelay, Model, Message, OutMessage, Shown, Hidden, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ShowAfterDelay, CompletedAnchorTooltip, AnchorTooltip, } from './index.js';
1
+ export { init, update, view, triggerId, reflectShowDelay, Model, Message, OutMessage, Shown, Hidden, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, CompletedWaitBeforeShowing, WaitBeforeShowing, CompletedAnchorTooltip, AnchorTooltip, } from './index.js';