@foldkit/ui 0.150.0 → 0.151.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/dist/animation/update.d.ts +10 -9
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +27 -35
- package/dist/calendar/index.d.ts +100 -11
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +66 -80
- package/dist/checkbox/index.d.ts +3 -4
- package/dist/checkbox/index.d.ts.map +1 -1
- package/dist/checkbox/index.js +3 -4
- package/dist/combobox/multi.d.ts +40 -51
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +19 -16
- package/dist/combobox/shared.d.ts +20 -20
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +134 -128
- package/dist/combobox/single.d.ts +38 -51
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +21 -17
- package/dist/datePicker/index.d.ts +182 -15
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +37 -54
- package/dist/dialog/index.d.ts +45 -7
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +54 -49
- package/dist/disclosure/index.d.ts +3 -4
- package/dist/disclosure/index.d.ts.map +1 -1
- package/dist/disclosure/index.js +3 -4
- package/dist/dragAndDrop/index.d.ts +96 -7
- package/dist/dragAndDrop/index.d.ts.map +1 -1
- package/dist/dragAndDrop/index.js +49 -61
- package/dist/fileDrop/index.d.ts +26 -11
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +16 -23
- package/dist/listbox/multi.d.ts +39 -52
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/multi.js +9 -7
- package/dist/listbox/shared.d.ts +14 -22
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +113 -114
- package/dist/listbox/single.d.ts +40 -55
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/listbox/single.js +8 -7
- package/dist/menu/index.d.ts +131 -37
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +111 -120
- package/dist/popover/index.d.ts +71 -10
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +80 -73
- package/dist/radioGroup/index.d.ts +31 -19
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +18 -18
- package/dist/slider/index.d.ts +44 -13
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +33 -38
- package/dist/switch/index.d.ts +3 -4
- package/dist/switch/index.d.ts.map +1 -1
- package/dist/switch/index.js +3 -4
- package/dist/tabs/index.d.ts +31 -17
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +17 -17
- package/dist/test/apps/disabledButton.d.ts +17 -17
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +6 -4
- package/dist/toast/index.d.ts +96 -100
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/update.d.ts +97 -100
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +60 -58
- package/dist/tooltip/index.d.ts +2 -1
- package/dist/tooltip/index.d.ts.map +1 -1
- package/dist/tooltip/index.js +1 -1
- package/dist/tooltip/tooltip.d.ts +5 -10
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +45 -48
- package/dist/virtualList/index.d.ts +30 -29
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +21 -21
- package/package.json +3 -3
package/dist/toast/update.js
CHANGED
|
@@ -63,18 +63,20 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
63
63
|
const writeEntryAnimation = (entryId) => __foldkitBrandViewResult(((model, nextAnimation) => __foldkitBrandViewResult((updateEntry(model, entryId, entry => __foldkitBrandViewResult((evo(entry, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/toast/update.js#animation") })), "@foldkit/ui/toast/update.js#anonymous~7"))), "@foldkit/ui/toast/update.js#anonymous~6")), "@foldkit/ui/toast/update.js#writeEntryAnimation");
|
|
64
64
|
const toGotAnimationMessage = (entryId) => __foldkitBrandViewResult(((message) => __foldkitBrandViewResult((MessageSchema.GotAnimationMessage({ entryId, message })), "@foldkit/ui/toast/update.js#anonymous~8")), "@foldkit/ui/toast/update.js#toGotAnimationMessage");
|
|
65
65
|
const toDismissedToastOutMessage = payload => __foldkitBrandViewResult((M.type().pipe(M.withReturnType(), M.tagsExhaustive({
|
|
66
|
-
StartedLeaveAnimating: () => __foldkitBrandViewResult((
|
|
67
|
-
TransitionedOut: () => __foldkitBrandViewResult((
|
|
66
|
+
StartedLeaveAnimating: () => __foldkitBrandViewResult((undefined), "@foldkit/ui/toast/update.js#StartedLeaveAnimating"),
|
|
67
|
+
TransitionedOut: () => __foldkitBrandViewResult((OutMessageSchema.DismissedToast({ payload })), "@foldkit/ui/toast/update.js#TransitionedOut"),
|
|
68
68
|
}))), "@foldkit/ui/toast/update.js#toDismissedToastOutMessage");
|
|
69
69
|
const foldEntryAnimationOutMessage = entryId => __foldkitBrandViewResult(((outMessage, { liftCommand }) => __foldkitBrandViewResult((AnimationOutMessage.match(outMessage, {
|
|
70
70
|
StartedLeaveAnimating: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult((Option.match(readEntryAnimation(entryId)(model), {
|
|
71
|
-
onNone: () => __foldkitBrandViewResult((
|
|
72
|
-
onSome: animation => __foldkitBrandViewResult((
|
|
71
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/toast/update.js#onNone~2")),
|
|
72
|
+
onSome: animation => (__foldkitBrandViewResult(({
|
|
73
73
|
model,
|
|
74
|
-
[liftCommand(animationDefaultLeaveCommand(animation))],
|
|
75
|
-
|
|
74
|
+
commands: [liftCommand(animationDefaultLeaveCommand(animation))],
|
|
75
|
+
}), "@foldkit/ui/toast/update.js#onSome~2")),
|
|
76
76
|
})), "@foldkit/ui/toast/update.js#anonymous~10")), "@foldkit/ui/toast/update.js#StartedLeaveAnimating~2"),
|
|
77
|
-
TransitionedOut: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult((
|
|
77
|
+
TransitionedOut: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({
|
|
78
|
+
model: removeEntry(model, entryId),
|
|
79
|
+
}), "@foldkit/ui/toast/update.js#anonymous~11"))), "@foldkit/ui/toast/update.js#TransitionedOut~2"),
|
|
78
80
|
})), "@foldkit/ui/toast/update.js#anonymous~9")), "@foldkit/ui/toast/update.js#foldEntryAnimationOutMessage");
|
|
79
81
|
const foldEntryAnimation = (entry) => __foldkitBrandViewResult((Update.foldChild({
|
|
80
82
|
update: animationUpdate,
|
|
@@ -84,8 +86,20 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
84
86
|
toParentOutMessage: toDismissedToastOutMessage(entry.payload),
|
|
85
87
|
foldOutMessage: foldEntryAnimationOutMessage(entry.id),
|
|
86
88
|
})), "@foldkit/ui/toast/update.js#foldEntryAnimation");
|
|
89
|
+
const foldEntryAnimationShow = (entry) => __foldkitBrandViewResult((Update.foldChildStep({
|
|
90
|
+
update: (animation) => __foldkitBrandViewResult((animationUpdate(animation, AnimationMessage.Showed())), "@foldkit/ui/toast/update.js#update"),
|
|
91
|
+
read: readEntryAnimation(entry.id),
|
|
92
|
+
write: writeEntryAnimation(entry.id),
|
|
93
|
+
toParentMessage: toGotAnimationMessage(entry.id),
|
|
94
|
+
})), "@foldkit/ui/toast/update.js#foldEntryAnimationShow");
|
|
95
|
+
const foldEntryAnimationHide = (entry) => __foldkitBrandViewResult((Update.foldChildStep({
|
|
96
|
+
update: (animation) => __foldkitBrandViewResult((animationUpdate(animation, AnimationMessage.Hid())), "@foldkit/ui/toast/update.js#update~2"),
|
|
97
|
+
read: readEntryAnimation(entry.id),
|
|
98
|
+
write: writeEntryAnimation(entry.id),
|
|
99
|
+
toParentMessage: toGotAnimationMessage(entry.id),
|
|
100
|
+
})), "@foldkit/ui/toast/update.js#foldEntryAnimationHide");
|
|
87
101
|
const delegateToEntryAnimation = (model, entryId, animationMessage) => __foldkitBrandViewResult((Option.match(Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~12")), {
|
|
88
|
-
onNone: () => __foldkitBrandViewResult((
|
|
102
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/toast/update.js#onNone~3")),
|
|
89
103
|
onSome: entry => __foldkitBrandViewResult((foldEntryAnimation(entry)(model, animationMessage)), "@foldkit/ui/toast/update.js#onSome~3"),
|
|
90
104
|
})), "@foldkit/ui/toast/update.js#delegateToEntryAnimation");
|
|
91
105
|
const createEntry = (model, input) => {
|
|
@@ -113,94 +127,82 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
113
127
|
entries: [],
|
|
114
128
|
nextEntryKey: 0,
|
|
115
129
|
}), "@foldkit/ui/toast/update.js#init"));
|
|
116
|
-
/** Processes a
|
|
117
|
-
* an optional `DismissedToast` OutMessage emitted once an entry has
|
|
130
|
+
/** Processes a Toast Message and returns the next Model, optional Commands,
|
|
131
|
+
* and an optional `DismissedToast` OutMessage emitted once an entry has
|
|
118
132
|
* finished its leave animation. */
|
|
119
133
|
const update = (model, message) => __foldkitBrandViewResult((MessageSchema.match(message, {
|
|
120
134
|
Added: ({ entry }) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
return __foldkitBrandViewResult((Update.combine(model, [
|
|
136
|
+
stepModel => (__foldkitBrandViewResult(({
|
|
137
|
+
model: evo(stepModel, {
|
|
138
|
+
entries: entries => __foldkitBrandViewResult((Array.append(entries, entry)), "@foldkit/ui/toast/update.js#entries"),
|
|
139
|
+
nextEntryKey: Number.increment,
|
|
140
|
+
}),
|
|
141
|
+
}), "@foldkit/ui/toast/update.js#anonymous~13")),
|
|
142
|
+
foldEntryAnimationShow(entry),
|
|
143
|
+
stepModel => (__foldkitBrandViewResult(({
|
|
144
|
+
model: stepModel,
|
|
145
|
+
commands: Option.match(Array.findFirst(stepModel.entries, ({ id }) => __foldkitBrandViewResult((id === entry.id), "@foldkit/ui/toast/update.js#anonymous~15")), {
|
|
146
|
+
onNone: () => __foldkitBrandViewResult(([]), "@foldkit/ui/toast/update.js#onNone~4"),
|
|
147
|
+
onSome: rescheduleDismissCommands,
|
|
148
|
+
}),
|
|
149
|
+
}), "@foldkit/ui/toast/update.js#anonymous~14")),
|
|
150
|
+
])), "@foldkit/ui/toast/update.js#Added");
|
|
136
151
|
},
|
|
137
152
|
Dismissed: ({ entryId }) => {
|
|
138
|
-
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~
|
|
153
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~16"));
|
|
139
154
|
return __foldkitBrandViewResult((Option.match(maybeEntry, {
|
|
140
|
-
onNone: () => __foldkitBrandViewResult((
|
|
155
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/toast/update.js#onNone~5")),
|
|
141
156
|
onSome: entry => {
|
|
142
157
|
if (isEntryLeaving(entry)) {
|
|
143
|
-
return __foldkitBrandViewResult((
|
|
158
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/toast/update.js#onSome~4");
|
|
144
159
|
}
|
|
145
160
|
else {
|
|
146
|
-
return __foldkitBrandViewResult((
|
|
161
|
+
return __foldkitBrandViewResult((foldEntryAnimationHide(entry)(model)), "@foldkit/ui/toast/update.js#onSome~4");
|
|
147
162
|
}
|
|
148
163
|
},
|
|
149
164
|
})), "@foldkit/ui/toast/update.js#Dismissed");
|
|
150
165
|
},
|
|
151
|
-
DismissedAll: () => __foldkitBrandViewResult((
|
|
152
|
-
if (isEntryLeaving(entry)) {
|
|
153
|
-
return __foldkitBrandViewResult(([currentModel, currentCommands, currentOut]), "@foldkit/ui/toast/update.js#anonymous~15");
|
|
154
|
-
}
|
|
155
|
-
const [nextModel, nextCommands] = delegateToEntryAnimation(currentModel, entry.id, AnimationMessage.Hid());
|
|
156
|
-
return __foldkitBrandViewResult(([
|
|
157
|
-
nextModel,
|
|
158
|
-
[...currentCommands, ...nextCommands],
|
|
159
|
-
currentOut,
|
|
160
|
-
]), "@foldkit/ui/toast/update.js#anonymous~15");
|
|
161
|
-
})), "@foldkit/ui/toast/update.js#DismissedAll"),
|
|
166
|
+
DismissedAll: () => __foldkitBrandViewResult((Update.combine(model, pipe(model.entries, Array.filter(entry => __foldkitBrandViewResult((!isEntryLeaving(entry)), "@foldkit/ui/toast/update.js#anonymous~17")), Array.map(foldEntryAnimationHide)))), "@foldkit/ui/toast/update.js#DismissedAll"),
|
|
162
167
|
CompletedWaitBeforeDismissal: ({ entryId, version }) => {
|
|
163
|
-
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~
|
|
168
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~18"));
|
|
164
169
|
return __foldkitBrandViewResult((Option.match(maybeEntry, {
|
|
165
|
-
onNone: () => __foldkitBrandViewResult((
|
|
170
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/toast/update.js#onNone~6")),
|
|
166
171
|
onSome: entry => {
|
|
167
172
|
const isStale = version !== entry.pendingDismissVersion;
|
|
168
173
|
if (isStale || isEntryLeaving(entry)) {
|
|
169
|
-
return __foldkitBrandViewResult((
|
|
174
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/toast/update.js#onSome~5");
|
|
170
175
|
}
|
|
171
176
|
else {
|
|
172
|
-
return __foldkitBrandViewResult((
|
|
177
|
+
return __foldkitBrandViewResult((foldEntryAnimationHide(entry)(model)), "@foldkit/ui/toast/update.js#onSome~5");
|
|
173
178
|
}
|
|
174
179
|
},
|
|
175
180
|
})), "@foldkit/ui/toast/update.js#CompletedWaitBeforeDismissal");
|
|
176
181
|
},
|
|
177
|
-
HoveredEntry: ({ entryId }) => __foldkitBrandViewResult((
|
|
178
|
-
updateEntry(model, entryId, entry => __foldkitBrandViewResult((evo(entry, {
|
|
182
|
+
HoveredEntry: ({ entryId }) => (__foldkitBrandViewResult(({
|
|
183
|
+
model: updateEntry(model, entryId, entry => __foldkitBrandViewResult((evo(entry, {
|
|
179
184
|
isHovered: () => __foldkitBrandViewResult((true), "@foldkit/ui/toast/update.js#isHovered"),
|
|
180
185
|
pendingDismissVersion: Number.increment,
|
|
181
|
-
})), "@foldkit/ui/toast/update.js#anonymous~
|
|
182
|
-
|
|
183
|
-
Option.none(),
|
|
184
|
-
]), "@foldkit/ui/toast/update.js#HoveredEntry"),
|
|
186
|
+
})), "@foldkit/ui/toast/update.js#anonymous~19")),
|
|
187
|
+
}), "@foldkit/ui/toast/update.js#HoveredEntry")),
|
|
185
188
|
LeftEntry: ({ entryId }) => {
|
|
186
|
-
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~
|
|
189
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~20"));
|
|
187
190
|
return __foldkitBrandViewResult((Option.match(maybeEntry, {
|
|
188
|
-
onNone: () => __foldkitBrandViewResult((
|
|
191
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/toast/update.js#onNone~7")),
|
|
189
192
|
onSome: entry => {
|
|
190
193
|
const nextEntry = evo(entry, {
|
|
191
194
|
isHovered: () => __foldkitBrandViewResult((false), "@foldkit/ui/toast/update.js#isHovered~2"),
|
|
192
195
|
pendingDismissVersion: Number.increment,
|
|
193
196
|
});
|
|
194
|
-
return __foldkitBrandViewResult((
|
|
195
|
-
updateEntry(model, entryId, () => __foldkitBrandViewResult((nextEntry), "@foldkit/ui/toast/update.js#anonymous~
|
|
196
|
-
rescheduleDismissCommands(nextEntry),
|
|
197
|
-
|
|
198
|
-
]), "@foldkit/ui/toast/update.js#onSome~6");
|
|
197
|
+
return __foldkitBrandViewResult(({
|
|
198
|
+
model: updateEntry(model, entryId, () => __foldkitBrandViewResult((nextEntry), "@foldkit/ui/toast/update.js#anonymous~21")),
|
|
199
|
+
commands: rescheduleDismissCommands(nextEntry),
|
|
200
|
+
}), "@foldkit/ui/toast/update.js#onSome~6");
|
|
199
201
|
},
|
|
200
202
|
})), "@foldkit/ui/toast/update.js#LeftEntry");
|
|
201
203
|
},
|
|
202
204
|
GotAnimationMessage: ({ entryId, message: animationMessage }) => __foldkitBrandViewResult((delegateToEntryAnimation(model, entryId, animationMessage)), "@foldkit/ui/toast/update.js#GotAnimationMessage"),
|
|
203
|
-
})), "@foldkit/ui/toast/update.js#update");
|
|
205
|
+
})), "@foldkit/ui/toast/update.js#update~3");
|
|
204
206
|
/** Adds a new toast entry. */
|
|
205
207
|
const show = (model, input) => __foldkitBrandViewResult((update(model, MessageSchema.Added({ entry: createEntry(model, input) }))), "@foldkit/ui/toast/update.js#show");
|
|
206
208
|
/** Begins dismissing a specific entry. */
|
package/dist/tooltip/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { Message, OutMessage } from './message.js';
|
|
2
|
+
export type { BlurredTrigger, EnteredTrigger, FocusedTrigger, Hidden, LeftTrigger, PressedEscape, PressedPointerOnTrigger, Shown, } from './message.js';
|
|
2
3
|
export * from './tooltip.js';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tooltip/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAClD,YAAY,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,MAAM,EACN,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,KAAK,GACN,MAAM,cAAc,CAAA;AACrB,cAAc,cAAc,CAAA"}
|
package/dist/tooltip/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { Message, OutMessage } from './message.js';
|
|
2
2
|
export * from './tooltip.js';
|
|
@@ -3,6 +3,7 @@ import * as Command from 'foldkit/command';
|
|
|
3
3
|
import { type ChildAttribute, type Html } from 'foldkit/html';
|
|
4
4
|
import * as Mount from 'foldkit/mount';
|
|
5
5
|
import { type Reflect } from 'foldkit/submodel';
|
|
6
|
+
import * as Update from 'foldkit/update';
|
|
6
7
|
import { AnchorConfig } from '../anchor/index.js';
|
|
7
8
|
import { Message, OutMessage } from './message.js';
|
|
8
9
|
/** 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. */
|
|
@@ -57,17 +58,12 @@ export declare const AnchorTooltip: Mount.MountDefinitionWithArgs<"AnchorTooltip
|
|
|
57
58
|
}, {
|
|
58
59
|
readonly _tag: "CompletedAnchorTooltip";
|
|
59
60
|
}>;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
ReadonlyArray<Command.Command<Message>>,
|
|
63
|
-
Option.Option<OutMessage>
|
|
64
|
-
];
|
|
65
|
-
/** Processes a tooltip message and returns the next model, commands, and
|
|
66
|
-
* an optional OutMessage. `Shown`/`Hidden` fire only on `isOpen`
|
|
61
|
+
/** Processes a Tooltip Message and returns the next Model, optional Commands,
|
|
62
|
+
* and an optional OutMessage. `Shown`/`Hidden` fire only on `isOpen`
|
|
67
63
|
* transitions, so consumers don't get spurious events for messages that
|
|
68
64
|
* only update hover/focus/delay state without changing visibility. */
|
|
69
|
-
export declare const update: (model: Model, message: Message) =>
|
|
70
|
-
/** Reflects an externally-sourced hover show-delay onto the
|
|
65
|
+
export declare const update: (model: Model, message: Message) => Update.ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
66
|
+
/** Reflects an externally-sourced hover show-delay onto the Model without
|
|
71
67
|
* emitting an OutMessage. Use to mirror an external config value (a user
|
|
72
68
|
* preference, a restored setting) onto the tooltip. */
|
|
73
69
|
export declare const reflectShowDelay: Reflect<Model, Duration.Input>;
|
|
@@ -131,5 +127,4 @@ export declare const view: import("foldkit/submodel").View<{
|
|
|
131
127
|
ariaLabel?: string;
|
|
132
128
|
ariaLabelledBy?: string;
|
|
133
129
|
}>>;
|
|
134
|
-
export {};
|
|
135
130
|
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/tooltip/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,MAAM,EAKN,MAAM,EAEN,MAAM,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/tooltip/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,MAAM,EAKN,MAAM,EAEN,MAAM,IAAI,CAAC,EAEZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM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AAQ,CAAC;IAChC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACtC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF;;uEAEuE;AACvE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAVP,YAAY;YACZ,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;iBACvB,OAAO;gBACR,MAAM;qBACD,MAAM;GAyExB,CAAA"}
|
package/dist/tooltip/tooltip.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
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';
|
|
2
|
+
import { Duration, Effect, Equal, Function, Match as M, Number, Option, Predicate, Schema as S, pipe, } from 'effect';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import { childAttributes } from 'foldkit/html';
|
|
5
5
|
import * as Mount from 'foldkit/mount';
|
|
6
6
|
import { evo } from 'foldkit/struct';
|
|
7
7
|
import { defineView } from 'foldkit/submodel';
|
|
8
|
+
import * as Update from 'foldkit/update';
|
|
8
9
|
import { AnchorConfig, anchorSetup } from '../anchor/index.js';
|
|
9
10
|
import * as OptionExt from '../internal/optionExtensions.js';
|
|
10
11
|
import { Message, OutMessage } from './message.js';
|
|
@@ -42,6 +43,7 @@ export const init = (config) => (__foldkitBrandViewResult(({
|
|
|
42
43
|
pendingShowVersion: 0,
|
|
43
44
|
maybeLastPointerType: Option.none(),
|
|
44
45
|
}), "@foldkit/ui/tooltip/tooltip.js#init"));
|
|
46
|
+
// UPDATE
|
|
45
47
|
/** Waits for the tooltip's show delay before emitting
|
|
46
48
|
* `CompletedWaitBeforeShowing`. */
|
|
47
49
|
export const WaitBeforeShowing = Command.define('WaitBeforeShowing', {
|
|
@@ -61,110 +63,105 @@ export const AnchorTooltip = Mount.define('AnchorTooltip', { buttonId: S.String,
|
|
|
61
63
|
const computeUpdate = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
62
64
|
EnteredTrigger: () => {
|
|
63
65
|
if (model.isOpen || model.isDismissed) {
|
|
64
|
-
return __foldkitBrandViewResult((
|
|
66
|
+
return __foldkitBrandViewResult(({ model: evo(model, { isHovered: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/tooltip.js#isHovered") }) }), "@foldkit/ui/tooltip/tooltip.js#EnteredTrigger");
|
|
65
67
|
}
|
|
66
68
|
const nextVersion = Number.increment(model.pendingShowVersion);
|
|
67
|
-
return __foldkitBrandViewResult((
|
|
68
|
-
evo(model, {
|
|
69
|
+
return __foldkitBrandViewResult(({
|
|
70
|
+
model: evo(model, {
|
|
69
71
|
isHovered: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/tooltip.js#isHovered~2"),
|
|
70
72
|
pendingShowVersion: () => __foldkitBrandViewResult((nextVersion), "@foldkit/ui/tooltip/tooltip.js#pendingShowVersion"),
|
|
71
73
|
}),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
commands: [
|
|
75
|
+
WaitBeforeShowing({ delay: model.showDelay, version: nextVersion }),
|
|
76
|
+
],
|
|
77
|
+
}), "@foldkit/ui/tooltip/tooltip.js#EnteredTrigger");
|
|
74
78
|
},
|
|
75
|
-
LeftTrigger: () => __foldkitBrandViewResult((
|
|
76
|
-
evo(model, {
|
|
79
|
+
LeftTrigger: () => (__foldkitBrandViewResult(({
|
|
80
|
+
model: evo(model, {
|
|
77
81
|
isHovered: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/tooltip.js#isHovered~3"),
|
|
78
82
|
isOpen: () => __foldkitBrandViewResult((model.isFocused && model.isOpen), "@foldkit/ui/tooltip/tooltip.js#isOpen"),
|
|
79
83
|
isDismissed: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/tooltip.js#isDismissed"),
|
|
80
84
|
pendingShowVersion: Number.increment,
|
|
81
85
|
}),
|
|
82
|
-
|
|
83
|
-
]), "@foldkit/ui/tooltip/tooltip.js#LeftTrigger"),
|
|
86
|
+
}), "@foldkit/ui/tooltip/tooltip.js#LeftTrigger")),
|
|
84
87
|
FocusedTrigger: () => {
|
|
85
88
|
const isFromMousePress = Option.exists(model.maybeLastPointerType, Equal.equals('mouse'));
|
|
86
89
|
if (isFromMousePress) {
|
|
87
|
-
return __foldkitBrandViewResult((
|
|
88
|
-
evo(model, {
|
|
90
|
+
return __foldkitBrandViewResult(({
|
|
91
|
+
model: evo(model, {
|
|
89
92
|
maybeLastPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tooltip/tooltip.js#maybeLastPointerType"),
|
|
90
93
|
}),
|
|
91
|
-
|
|
92
|
-
]), "@foldkit/ui/tooltip/tooltip.js#FocusedTrigger");
|
|
94
|
+
}), "@foldkit/ui/tooltip/tooltip.js#FocusedTrigger");
|
|
93
95
|
}
|
|
94
96
|
if (model.isDismissed) {
|
|
95
|
-
return __foldkitBrandViewResult((
|
|
96
|
-
evo(model, {
|
|
97
|
+
return __foldkitBrandViewResult(({
|
|
98
|
+
model: evo(model, {
|
|
97
99
|
isFocused: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/tooltip.js#isFocused"),
|
|
98
100
|
maybeLastPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tooltip/tooltip.js#maybeLastPointerType~2"),
|
|
99
101
|
}),
|
|
100
|
-
|
|
101
|
-
]), "@foldkit/ui/tooltip/tooltip.js#FocusedTrigger");
|
|
102
|
+
}), "@foldkit/ui/tooltip/tooltip.js#FocusedTrigger");
|
|
102
103
|
}
|
|
103
|
-
return __foldkitBrandViewResult((
|
|
104
|
-
evo(model, {
|
|
104
|
+
return __foldkitBrandViewResult(({
|
|
105
|
+
model: evo(model, {
|
|
105
106
|
isFocused: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/tooltip.js#isFocused~2"),
|
|
106
107
|
isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/tooltip.js#isOpen~2"),
|
|
107
108
|
pendingShowVersion: Number.increment,
|
|
108
109
|
}),
|
|
109
|
-
|
|
110
|
-
]), "@foldkit/ui/tooltip/tooltip.js#FocusedTrigger");
|
|
110
|
+
}), "@foldkit/ui/tooltip/tooltip.js#FocusedTrigger");
|
|
111
111
|
},
|
|
112
|
-
BlurredTrigger: () => __foldkitBrandViewResult((
|
|
113
|
-
evo(model, {
|
|
112
|
+
BlurredTrigger: () => (__foldkitBrandViewResult(({
|
|
113
|
+
model: evo(model, {
|
|
114
114
|
isFocused: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/tooltip.js#isFocused~3"),
|
|
115
115
|
isOpen: () => __foldkitBrandViewResult((model.isHovered && model.isOpen), "@foldkit/ui/tooltip/tooltip.js#isOpen~3"),
|
|
116
116
|
isDismissed: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/tooltip.js#isDismissed~2"),
|
|
117
117
|
pendingShowVersion: Number.increment,
|
|
118
118
|
maybeLastPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tooltip/tooltip.js#maybeLastPointerType~3"),
|
|
119
119
|
}),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
evo(model, {
|
|
120
|
+
}), "@foldkit/ui/tooltip/tooltip.js#BlurredTrigger")),
|
|
121
|
+
PressedEscape: () => (__foldkitBrandViewResult(({
|
|
122
|
+
model: evo(model, {
|
|
124
123
|
isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/tooltip/tooltip.js#isOpen~4"),
|
|
125
124
|
isDismissed: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/tooltip.js#isDismissed~3"),
|
|
126
125
|
pendingShowVersion: Number.increment,
|
|
127
126
|
}),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
evo(model, {
|
|
127
|
+
}), "@foldkit/ui/tooltip/tooltip.js#PressedEscape")),
|
|
128
|
+
PressedPointerOnTrigger: ({ pointerType }) => (__foldkitBrandViewResult(({
|
|
129
|
+
model: evo(model, {
|
|
132
130
|
maybeLastPointerType: () => __foldkitBrandViewResult((Option.some(pointerType)), "@foldkit/ui/tooltip/tooltip.js#maybeLastPointerType~4"),
|
|
133
131
|
}),
|
|
134
|
-
|
|
135
|
-
]), "@foldkit/ui/tooltip/tooltip.js#PressedPointerOnTrigger"),
|
|
132
|
+
}), "@foldkit/ui/tooltip/tooltip.js#PressedPointerOnTrigger")),
|
|
136
133
|
CompletedWaitBeforeShowing: ({ version }) => {
|
|
137
134
|
if (version !== model.pendingShowVersion) {
|
|
138
|
-
return __foldkitBrandViewResult((
|
|
135
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/tooltip/tooltip.js#CompletedWaitBeforeShowing");
|
|
139
136
|
}
|
|
140
137
|
if (!model.isHovered) {
|
|
141
|
-
return __foldkitBrandViewResult((
|
|
138
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/tooltip/tooltip.js#CompletedWaitBeforeShowing");
|
|
142
139
|
}
|
|
143
|
-
return __foldkitBrandViewResult((
|
|
140
|
+
return __foldkitBrandViewResult(({ model: evo(model, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/tooltip/tooltip.js#isOpen~5") }) }), "@foldkit/ui/tooltip/tooltip.js#CompletedWaitBeforeShowing");
|
|
144
141
|
},
|
|
145
|
-
CompletedAnchorTooltip: () => __foldkitBrandViewResult((
|
|
142
|
+
CompletedAnchorTooltip: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/tooltip/tooltip.js#CompletedAnchorTooltip")),
|
|
146
143
|
})), "@foldkit/ui/tooltip/tooltip.js#computeUpdate");
|
|
147
|
-
const
|
|
144
|
+
const toVisibilityOutMessage = (isOpen, isNextOpen) => {
|
|
148
145
|
if (!isOpen && isNextOpen) {
|
|
149
|
-
return __foldkitBrandViewResult((
|
|
146
|
+
return __foldkitBrandViewResult((OutMessage.Shown()), "@foldkit/ui/tooltip/tooltip.js#toVisibilityOutMessage");
|
|
150
147
|
}
|
|
151
148
|
else if (isOpen && !isNextOpen) {
|
|
152
|
-
return __foldkitBrandViewResult((
|
|
149
|
+
return __foldkitBrandViewResult((OutMessage.Hidden()), "@foldkit/ui/tooltip/tooltip.js#toVisibilityOutMessage");
|
|
153
150
|
}
|
|
154
151
|
else {
|
|
155
|
-
return __foldkitBrandViewResult((
|
|
152
|
+
return __foldkitBrandViewResult((undefined), "@foldkit/ui/tooltip/tooltip.js#toVisibilityOutMessage");
|
|
156
153
|
}
|
|
157
154
|
};
|
|
158
|
-
/** Processes a
|
|
159
|
-
* an optional OutMessage. `Shown`/`Hidden` fire only on `isOpen`
|
|
155
|
+
/** Processes a Tooltip Message and returns the next Model, optional Commands,
|
|
156
|
+
* and an optional OutMessage. `Shown`/`Hidden` fire only on `isOpen`
|
|
160
157
|
* transitions, so consumers don't get spurious events for messages that
|
|
161
158
|
* only update hover/focus/delay state without changing visibility. */
|
|
162
159
|
export const update = (model, message) => {
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
return __foldkitBrandViewResult((
|
|
160
|
+
const tooltipUpdate = computeUpdate(model, message);
|
|
161
|
+
const outMessage = toVisibilityOutMessage(model.isOpen, tooltipUpdate.model.isOpen);
|
|
162
|
+
return __foldkitBrandViewResult((pipe(tooltipUpdate, Update.withOutMessage(outMessage))), "@foldkit/ui/tooltip/tooltip.js#update");
|
|
166
163
|
};
|
|
167
|
-
/** Reflects an externally-sourced hover show-delay onto the
|
|
164
|
+
/** Reflects an externally-sourced hover show-delay onto the Model without
|
|
168
165
|
* emitting an OutMessage. Use to mirror an external config value (a user
|
|
169
166
|
* preference, a restored setting) onto the tooltip. */
|
|
170
167
|
export const reflectShowDelay = Function.dual(2, (model, showDelay) => __foldkitBrandViewResult((evo(model, { showDelay: () => __foldkitBrandViewResult((Duration.fromInputUnsafe(showDelay)), "@foldkit/ui/tooltip/tooltip.js#showDelay") })), "@foldkit/ui/tooltip/tooltip.js#anonymous~6"));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Effect, Option, Schema as S } from 'effect';
|
|
2
|
+
import { type Update } from 'foldkit';
|
|
2
3
|
import * as Command from 'foldkit/command';
|
|
3
4
|
import { type ChildAttribute, type Html, type TagName } from 'foldkit/html';
|
|
4
5
|
import { type View as SubmodelView } from 'foldkit/submodel';
|
|
@@ -52,30 +53,28 @@ export declare const ApplyScroll: Command.CommandDefinitionWithArgs<"ApplyScroll
|
|
|
52
53
|
readonly _tag: "CompletedApplyScroll";
|
|
53
54
|
readonly version: number;
|
|
54
55
|
}, never, never>>;
|
|
55
|
-
/** Processes a
|
|
56
|
-
export declare const update: (model: Model, message: Message) =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
readonly
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
readonly
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
/** Processes a VirtualList Message and returns the next Model and optional Commands. */
|
|
57
|
+
export declare const update: (model: Model, message: Message) => Readonly<{
|
|
58
|
+
model: {
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly rowHeightPx: number;
|
|
61
|
+
readonly scrollTop: number;
|
|
62
|
+
readonly measurement: {
|
|
63
|
+
readonly _tag: "Unmeasured";
|
|
64
|
+
} | {
|
|
65
|
+
readonly _tag: "Measured";
|
|
66
|
+
readonly containerHeight: number;
|
|
67
|
+
};
|
|
68
|
+
readonly pendingScroll: {
|
|
69
|
+
readonly _tag: "Idle";
|
|
70
|
+
} | {
|
|
71
|
+
readonly _tag: "ScrollingToIndex";
|
|
72
|
+
readonly index: number;
|
|
73
|
+
readonly version: number;
|
|
74
|
+
};
|
|
75
|
+
readonly pendingScrollVersion: number;
|
|
72
76
|
};
|
|
73
|
-
|
|
74
|
-
}, readonly Readonly<{
|
|
75
|
-
name: string;
|
|
76
|
-
args?: Record<string, unknown>;
|
|
77
|
-
key?: string;
|
|
78
|
-
effect: Effect.Effect<{
|
|
77
|
+
commands?: Update.Commands<{
|
|
79
78
|
readonly _tag: "ScrolledContainer";
|
|
80
79
|
readonly scrollTop: number;
|
|
81
80
|
} | {
|
|
@@ -84,10 +83,12 @@ export declare const update: (model: Model, message: Message) => readonly [{
|
|
|
84
83
|
} | {
|
|
85
84
|
readonly _tag: "CompletedApplyScroll";
|
|
86
85
|
readonly version: number;
|
|
87
|
-
}, never
|
|
88
|
-
|
|
86
|
+
}, never>;
|
|
87
|
+
outMessage?: never;
|
|
88
|
+
}>;
|
|
89
|
+
type ScrollReturn = Update.Return<Model, Message>;
|
|
89
90
|
/** Programmatically scrolls the container so the row at `index` is visible.
|
|
90
|
-
* Returns the next
|
|
91
|
+
* Returns the next Model and a Command that mutates `element.scrollTop`. The
|
|
91
92
|
* natural scroll event then flows back through `ScrolledContainer` and the
|
|
92
93
|
* component re-renders the new visible slice.
|
|
93
94
|
*
|
|
@@ -96,13 +97,13 @@ export declare const update: (model: Model, message: Message) => readonly [{
|
|
|
96
97
|
* previous in-flight scroll) is ignored when its version no longer matches.
|
|
97
98
|
*
|
|
98
99
|
* Should be called after the container has rendered. If the container is not
|
|
99
|
-
* yet in the DOM the Command silently no-ops (the
|
|
100
|
+
* yet in the DOM the Command silently no-ops (the Model still transitions
|
|
100
101
|
* through `ScrollingToIndex` → `Idle` via the version-matched completion).
|
|
101
102
|
*
|
|
102
103
|
* Assumes uniform row heights: target scroll position is computed as
|
|
103
104
|
* `index * model.rowHeightPx`. For variable-height rows, use
|
|
104
105
|
* `scrollToIndexVariable`. */
|
|
105
|
-
export declare const scrollToIndex: (model: Model, index: number) =>
|
|
106
|
+
export declare const scrollToIndex: (model: Model, index: number) => ScrollReturn;
|
|
106
107
|
/** Variable-height counterpart of `scrollToIndex`. Walks the heights of items
|
|
107
108
|
* before `index` to compute the target `scrollTop`. Use this when rendering
|
|
108
109
|
* the list with `itemToRowHeightPx`; use `scrollToIndex` for uniform heights.
|
|
@@ -116,7 +117,7 @@ export declare const scrollToIndex: (model: Model, index: number) => readonly [M
|
|
|
116
117
|
* function. Consumers who need an accurate initial scroll on a
|
|
117
118
|
* variable-height list should call `scrollToIndexVariable` after the first
|
|
118
119
|
* `MeasuredContainer` arrives. */
|
|
119
|
-
export declare const scrollToIndexVariable: <Item>(model: Model, items: ReadonlyArray<Item>, itemToRowHeightPx: (item: Item, index: number) => number, index: number) =>
|
|
120
|
+
export declare const scrollToIndexVariable: <Item>(model: Model, items: ReadonlyArray<Item>, itemToRowHeightPx: (item: Item, index: number) => number, index: number) => ScrollReturn;
|
|
120
121
|
/** Slice of the data array that the view should render, plus the spacer
|
|
121
122
|
* heights that keep the scrollbar physically correct. The first row in the
|
|
122
123
|
* slice corresponds to data index `startIndex`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/virtualList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAGN,MAAM,EAEN,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,IAAI,EACT,KAAK,OAAO,EAEb,MAAM,cAAc,CAAA;AAIrB,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,CAAA;AACxE,OAA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