@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/menu/index.js
CHANGED
|
@@ -85,7 +85,8 @@ export const Message = defineMessageUnion({
|
|
|
85
85
|
},
|
|
86
86
|
});
|
|
87
87
|
// OUT MESSAGE
|
|
88
|
-
/** Union of
|
|
88
|
+
/** Union of OutMessages the menu component can produce. The parent's
|
|
89
|
+
* `Update.foldChild` config handles them through `foldOutMessage`. */
|
|
89
90
|
export const OutMessage = defineMessageUnion({
|
|
90
91
|
Selected: { value: S.String, index: S.Number },
|
|
91
92
|
});
|
|
@@ -190,21 +191,21 @@ export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnim
|
|
|
190
191
|
}))))), "@foldkit/ui/menu/index.js#execute~8"),
|
|
191
192
|
});
|
|
192
193
|
const foldAnimationOutMessage = M.type().pipe(M.withReturnType(), M.tagsExhaustive({
|
|
193
|
-
StartedLeaveAnimating: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult((
|
|
194
|
+
StartedLeaveAnimating: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({
|
|
194
195
|
model,
|
|
195
|
-
[DetectMovementOrAnimationEnd({ id: model.id })],
|
|
196
|
-
|
|
197
|
-
TransitionedOut: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult((
|
|
196
|
+
commands: [DetectMovementOrAnimationEnd({ id: model.id })],
|
|
197
|
+
}), "@foldkit/ui/menu/index.js#anonymous"))), "@foldkit/ui/menu/index.js#StartedLeaveAnimating"),
|
|
198
|
+
TransitionedOut: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#anonymous~2"))), "@foldkit/ui/menu/index.js#TransitionedOut"),
|
|
198
199
|
}));
|
|
199
200
|
const foldAnimation = Update.foldChild({
|
|
200
201
|
update: animationUpdate,
|
|
201
202
|
read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/menu/index.js#read"),
|
|
202
203
|
write: (model, nextAnimation) => __foldkitBrandViewResult((evo(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/menu/index.js#animation") })), "@foldkit/ui/menu/index.js#write"),
|
|
203
204
|
toParentMessage: message => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/menu/index.js#toParentMessage"),
|
|
204
|
-
toParentOutMessage: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#toParentOutMessage"),
|
|
205
205
|
foldOutMessage: foldAnimationOutMessage,
|
|
206
206
|
});
|
|
207
|
-
/** Processes a
|
|
207
|
+
/** Processes a Menu Message and returns the next Model, optional Commands, and
|
|
208
|
+
* an optional OutMessage. */
|
|
208
209
|
export const update = (model, message) => {
|
|
209
210
|
const maybeLockScroll = OptionExt.when(model.isModal, LockScroll());
|
|
210
211
|
const maybeUnlockScroll = OptionExt.when(model.isModal, UnlockScroll());
|
|
@@ -218,44 +219,47 @@ export const update = (model, message) => {
|
|
|
218
219
|
FocusButton({ id: model.id }),
|
|
219
220
|
...Array.getSomes([maybeUnlockScroll, maybeRestoreInert]),
|
|
220
221
|
];
|
|
221
|
-
const closeWithoutFocusCommands = Array.getSomes([
|
|
222
|
-
maybeUnlockScroll,
|
|
223
|
-
maybeRestoreInert,
|
|
224
|
-
]);
|
|
222
|
+
const closeWithoutFocusCommands = Array.getSomes([maybeUnlockScroll, maybeRestoreInert]);
|
|
225
223
|
const openMenu = (baseModel) => {
|
|
226
224
|
if (model.isAnimated) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
return __foldkitBrandViewResult((Update.combine(baseModel, [
|
|
226
|
+
stepModel => (__foldkitBrandViewResult(({ model: stepModel, commands: openCommands }), "@foldkit/ui/menu/index.js#anonymous~3")),
|
|
227
|
+
foldAnimation(AnimationMessage.Showed()),
|
|
228
|
+
stepModel => (__foldkitBrandViewResult(({
|
|
229
|
+
model: evo(stepModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/menu/index.js#isOpen~2") }),
|
|
230
|
+
}), "@foldkit/ui/menu/index.js#anonymous~4")),
|
|
231
|
+
])), "@foldkit/ui/menu/index.js#openMenu");
|
|
233
232
|
}
|
|
234
|
-
return __foldkitBrandViewResult((
|
|
233
|
+
return __foldkitBrandViewResult(({
|
|
234
|
+
model: evo(baseModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/menu/index.js#isOpen~3") }),
|
|
235
|
+
commands: openCommands,
|
|
236
|
+
}), "@foldkit/ui/menu/index.js#openMenu");
|
|
235
237
|
};
|
|
236
|
-
const closeMenu = (baseModel, commands
|
|
238
|
+
const closeMenu = (baseModel, commands) => {
|
|
237
239
|
if (!baseModel.isOpen) {
|
|
238
|
-
return __foldkitBrandViewResult((
|
|
240
|
+
return __foldkitBrandViewResult(({ model: baseModel }), "@foldkit/ui/menu/index.js#closeMenu");
|
|
239
241
|
}
|
|
240
242
|
const closed = closedModel(baseModel);
|
|
241
243
|
if (model.isAnimated) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
+
return __foldkitBrandViewResult((Update.combine(closed, [
|
|
245
|
+
stepModel => (__foldkitBrandViewResult(({ model: stepModel, commands }), "@foldkit/ui/menu/index.js#anonymous~5")),
|
|
246
|
+
foldAnimation(AnimationMessage.Hid()),
|
|
247
|
+
])), "@foldkit/ui/menu/index.js#closeMenu");
|
|
244
248
|
}
|
|
245
|
-
return __foldkitBrandViewResult((
|
|
249
|
+
return __foldkitBrandViewResult(({ model: closed, commands }), "@foldkit/ui/menu/index.js#closeMenu");
|
|
246
250
|
};
|
|
247
251
|
return __foldkitBrandViewResult((Message.match(message, {
|
|
248
|
-
CompletedFocusItems: () => __foldkitBrandViewResult((
|
|
249
|
-
CompletedFocusButton: () => __foldkitBrandViewResult((
|
|
250
|
-
CompletedLockScroll: () => __foldkitBrandViewResult((
|
|
251
|
-
CompletedUnlockScroll: () => __foldkitBrandViewResult((
|
|
252
|
-
CompletedInertOthers: () => __foldkitBrandViewResult((
|
|
253
|
-
CompletedRestoreInert: () => __foldkitBrandViewResult((
|
|
254
|
-
CompletedScrollIntoView: () => __foldkitBrandViewResult((
|
|
255
|
-
CompletedClickItem: () => __foldkitBrandViewResult((
|
|
256
|
-
SuppressedSpaceScroll: () => __foldkitBrandViewResult((
|
|
257
|
-
CompletedAnchorMenu: () => __foldkitBrandViewResult((
|
|
258
|
-
CompletedPortalMenuBackdrop: () => __foldkitBrandViewResult((
|
|
252
|
+
CompletedFocusItems: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedFocusItems")),
|
|
253
|
+
CompletedFocusButton: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedFocusButton")),
|
|
254
|
+
CompletedLockScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedLockScroll")),
|
|
255
|
+
CompletedUnlockScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedUnlockScroll")),
|
|
256
|
+
CompletedInertOthers: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedInertOthers")),
|
|
257
|
+
CompletedRestoreInert: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedRestoreInert")),
|
|
258
|
+
CompletedScrollIntoView: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedScrollIntoView")),
|
|
259
|
+
CompletedClickItem: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedClickItem")),
|
|
260
|
+
SuppressedSpaceScroll: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#SuppressedSpaceScroll")),
|
|
261
|
+
CompletedAnchorMenu: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedAnchorMenu")),
|
|
262
|
+
CompletedPortalMenuBackdrop: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedPortalMenuBackdrop")),
|
|
259
263
|
Opened: ({ maybeActiveItemIndex }) => __foldkitBrandViewResult((openMenu(evo(model, {
|
|
260
264
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((maybeActiveItemIndex), "@foldkit/ui/menu/index.js#maybeActiveItemIndex~2"),
|
|
261
265
|
activationTrigger: () => __foldkitBrandViewResult((Option.match(maybeActiveItemIndex, {
|
|
@@ -269,66 +273,57 @@ export const update = (model, message) => {
|
|
|
269
273
|
Closed: () => __foldkitBrandViewResult((closeMenu(model, closeWithFocusCommands)), "@foldkit/ui/menu/index.js#Closed"),
|
|
270
274
|
BlurredItems: () => {
|
|
271
275
|
if (Option.exists(model.maybeLastButtonPointerType, Equal.equals('mouse'))) {
|
|
272
|
-
return __foldkitBrandViewResult((
|
|
276
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#BlurredItems");
|
|
273
277
|
}
|
|
274
278
|
return __foldkitBrandViewResult((closeMenu(model, closeWithoutFocusCommands)), "@foldkit/ui/menu/index.js#BlurredItems");
|
|
275
279
|
},
|
|
276
|
-
ActivatedItem: ({ index, activationTrigger }) => __foldkitBrandViewResult((
|
|
277
|
-
evo(model, {
|
|
280
|
+
ActivatedItem: ({ index, activationTrigger }) => (__foldkitBrandViewResult(({
|
|
281
|
+
model: evo(model, {
|
|
278
282
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/menu/index.js#maybeActiveItemIndex~3"),
|
|
279
283
|
activationTrigger: () => __foldkitBrandViewResult((activationTrigger), "@foldkit/ui/menu/index.js#activationTrigger~2"),
|
|
280
284
|
}),
|
|
281
|
-
activationTrigger === 'Keyboard'
|
|
285
|
+
commands: activationTrigger === 'Keyboard'
|
|
282
286
|
? [ScrollIntoView({ id: model.id, index })]
|
|
283
287
|
: [],
|
|
284
|
-
|
|
285
|
-
]), "@foldkit/ui/menu/index.js#ActivatedItem"),
|
|
288
|
+
}), "@foldkit/ui/menu/index.js#ActivatedItem")),
|
|
286
289
|
MovedPointerOverItem: ({ index, screenX, screenY }) => {
|
|
287
|
-
const isSamePosition = Option.exists(model.maybeLastPointerPosition, position => __foldkitBrandViewResult((position.screenX === screenX && position.screenY === screenY), "@foldkit/ui/menu/index.js#anonymous~
|
|
290
|
+
const isSamePosition = Option.exists(model.maybeLastPointerPosition, position => __foldkitBrandViewResult((position.screenX === screenX && position.screenY === screenY), "@foldkit/ui/menu/index.js#anonymous~6"));
|
|
288
291
|
if (isSamePosition) {
|
|
289
|
-
return __foldkitBrandViewResult((
|
|
292
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#MovedPointerOverItem");
|
|
290
293
|
}
|
|
291
|
-
return __foldkitBrandViewResult((
|
|
292
|
-
evo(model, {
|
|
294
|
+
return __foldkitBrandViewResult(({
|
|
295
|
+
model: evo(model, {
|
|
293
296
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/menu/index.js#maybeActiveItemIndex~4"),
|
|
294
297
|
activationTrigger: () => __foldkitBrandViewResult(('Pointer'), "@foldkit/ui/menu/index.js#activationTrigger~3"),
|
|
295
298
|
maybeLastPointerPosition: () => __foldkitBrandViewResult((Option.some({ screenX, screenY })), "@foldkit/ui/menu/index.js#maybeLastPointerPosition~3"),
|
|
296
299
|
}),
|
|
297
|
-
|
|
298
|
-
Option.none(),
|
|
299
|
-
]), "@foldkit/ui/menu/index.js#MovedPointerOverItem");
|
|
300
|
+
}), "@foldkit/ui/menu/index.js#MovedPointerOverItem");
|
|
300
301
|
},
|
|
301
302
|
DeactivatedItem: () => __foldkitBrandViewResult((model.activationTrigger === 'Pointer'
|
|
302
|
-
?
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
]
|
|
307
|
-
: [model, [], Option.none()]), "@foldkit/ui/menu/index.js#DeactivatedItem"),
|
|
308
|
-
SelectedItem: ({ index, item }) => __foldkitBrandViewResult((closeMenu(model, closeWithFocusCommands, Option.some(OutMessage.Selected({ value: item, index })))), "@foldkit/ui/menu/index.js#SelectedItem"),
|
|
309
|
-
RequestedItemClick: ({ index }) => __foldkitBrandViewResult(([
|
|
303
|
+
? { model: evo(model, { maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeActiveItemIndex~5") }) }
|
|
304
|
+
: { model }), "@foldkit/ui/menu/index.js#DeactivatedItem"),
|
|
305
|
+
SelectedItem: ({ index, item }) => __foldkitBrandViewResult((pipe(closeMenu(model, closeWithFocusCommands), Update.withOutMessage(OutMessage.Selected({ value: item, index })))), "@foldkit/ui/menu/index.js#SelectedItem"),
|
|
306
|
+
RequestedItemClick: ({ index }) => (__foldkitBrandViewResult(({
|
|
310
307
|
model,
|
|
311
|
-
[ClickItem({ id: model.id, index })],
|
|
312
|
-
|
|
313
|
-
]), "@foldkit/ui/menu/index.js#RequestedItemClick"),
|
|
308
|
+
commands: [ClickItem({ id: model.id, index })],
|
|
309
|
+
}), "@foldkit/ui/menu/index.js#RequestedItemClick")),
|
|
314
310
|
Searched: ({ key, maybeTargetIndex }) => {
|
|
315
311
|
const nextSearchQuery = model.searchQuery + key;
|
|
316
312
|
const nextSearchVersion = model.searchVersion + 1;
|
|
317
|
-
return __foldkitBrandViewResult((
|
|
318
|
-
evo(model, {
|
|
313
|
+
return __foldkitBrandViewResult(({
|
|
314
|
+
model: evo(model, {
|
|
319
315
|
searchQuery: () => __foldkitBrandViewResult((nextSearchQuery), "@foldkit/ui/menu/index.js#searchQuery~3"),
|
|
320
316
|
searchVersion: () => __foldkitBrandViewResult((nextSearchVersion), "@foldkit/ui/menu/index.js#searchVersion~3"),
|
|
321
|
-
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.orElse(maybeTargetIndex, () => __foldkitBrandViewResult((model.maybeActiveItemIndex), "@foldkit/ui/menu/index.js#anonymous~
|
|
317
|
+
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.orElse(maybeTargetIndex, () => __foldkitBrandViewResult((model.maybeActiveItemIndex), "@foldkit/ui/menu/index.js#anonymous~7"))), "@foldkit/ui/menu/index.js#maybeActiveItemIndex~6"),
|
|
322
318
|
}),
|
|
323
|
-
[DelayClearSearch({ version: nextSearchVersion })],
|
|
324
|
-
|
|
325
|
-
]), "@foldkit/ui/menu/index.js#Searched");
|
|
319
|
+
commands: [DelayClearSearch({ version: nextSearchVersion })],
|
|
320
|
+
}), "@foldkit/ui/menu/index.js#Searched");
|
|
326
321
|
},
|
|
327
322
|
CompletedDelayClearSearch: ({ version }) => {
|
|
328
323
|
if (version !== model.searchVersion) {
|
|
329
|
-
return __foldkitBrandViewResult((
|
|
324
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#CompletedDelayClearSearch");
|
|
330
325
|
}
|
|
331
|
-
return __foldkitBrandViewResult((
|
|
326
|
+
return __foldkitBrandViewResult(({ model: evo(model, { searchQuery: () => __foldkitBrandViewResult((''), "@foldkit/ui/menu/index.js#searchQuery~4") }) }), "@foldkit/ui/menu/index.js#CompletedDelayClearSearch");
|
|
332
327
|
},
|
|
333
328
|
GotAnimationMessage: ({ message: animationMessage }) => __foldkitBrandViewResult((foldAnimation(model, animationMessage)), "@foldkit/ui/menu/index.js#GotAnimationMessage"),
|
|
334
329
|
PressedPointerOnButton: ({ pointerType, button, screenX, screenY, timeStamp, }) => {
|
|
@@ -336,17 +331,17 @@ export const update = (model, message) => {
|
|
|
336
331
|
maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.some(pointerType)), "@foldkit/ui/menu/index.js#maybeLastButtonPointerType~2"),
|
|
337
332
|
});
|
|
338
333
|
if (pointerType !== 'mouse' || button !== LEFT_MOUSE_BUTTON) {
|
|
339
|
-
return __foldkitBrandViewResult((
|
|
334
|
+
return __foldkitBrandViewResult(({ model: withPointerType }), "@foldkit/ui/menu/index.js#PressedPointerOnButton");
|
|
340
335
|
}
|
|
341
336
|
if (model.isOpen) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
]), "@foldkit/ui/menu/index.js#PressedPointerOnButton");
|
|
337
|
+
return __foldkitBrandViewResult((Update.combine(withPointerType, [
|
|
338
|
+
stepModel => __foldkitBrandViewResult((closeMenu(stepModel, closeWithFocusCommands)), "@foldkit/ui/menu/index.js#anonymous~8"),
|
|
339
|
+
stepModel => (__foldkitBrandViewResult(({
|
|
340
|
+
model: evo(stepModel, {
|
|
341
|
+
maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.some(pointerType)), "@foldkit/ui/menu/index.js#maybeLastButtonPointerType~3"),
|
|
342
|
+
}),
|
|
343
|
+
}), "@foldkit/ui/menu/index.js#anonymous~9")),
|
|
344
|
+
])), "@foldkit/ui/menu/index.js#PressedPointerOnButton");
|
|
350
345
|
}
|
|
351
346
|
return __foldkitBrandViewResult((openMenu(evo(withPointerType, {
|
|
352
347
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeActiveItemIndex~7"),
|
|
@@ -363,30 +358,27 @@ export const update = (model, message) => {
|
|
|
363
358
|
const isMovementBelowThreshold = Option.exists(model.maybePointerOrigin, origin => __foldkitBrandViewResult((Math.abs(screenX - origin.screenX) <
|
|
364
359
|
POINTER_MOVEMENT_THRESHOLD_PIXELS &&
|
|
365
360
|
Math.abs(screenY - origin.screenY) <
|
|
366
|
-
POINTER_MOVEMENT_THRESHOLD_PIXELS), "@foldkit/ui/menu/index.js#anonymous~
|
|
367
|
-
const isHoldTimeBelowThreshold = Option.exists(model.maybePointerOrigin, origin => __foldkitBrandViewResult((timeStamp - origin.timeStamp < POINTER_HOLD_THRESHOLD_MILLISECONDS), "@foldkit/ui/menu/index.js#anonymous~
|
|
361
|
+
POINTER_MOVEMENT_THRESHOLD_PIXELS), "@foldkit/ui/menu/index.js#anonymous~10"));
|
|
362
|
+
const isHoldTimeBelowThreshold = Option.exists(model.maybePointerOrigin, origin => __foldkitBrandViewResult((timeStamp - origin.timeStamp < POINTER_HOLD_THRESHOLD_MILLISECONDS), "@foldkit/ui/menu/index.js#anonymous~11"));
|
|
368
363
|
if (hasNoOrigin ||
|
|
369
364
|
isMovementBelowThreshold ||
|
|
370
365
|
isHoldTimeBelowThreshold ||
|
|
371
366
|
hasNoActiveItem) {
|
|
372
|
-
return __foldkitBrandViewResult((
|
|
367
|
+
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/menu/index.js#ReleasedPointerOnItems");
|
|
373
368
|
}
|
|
374
|
-
return __foldkitBrandViewResult((
|
|
369
|
+
return __foldkitBrandViewResult(({
|
|
375
370
|
model,
|
|
376
|
-
[
|
|
371
|
+
commands: [
|
|
377
372
|
ClickItem({
|
|
378
373
|
id: model.id,
|
|
379
374
|
index: model.maybeActiveItemIndex.value,
|
|
380
375
|
}),
|
|
381
376
|
],
|
|
382
|
-
|
|
383
|
-
]), "@foldkit/ui/menu/index.js#ReleasedPointerOnItems");
|
|
377
|
+
}), "@foldkit/ui/menu/index.js#ReleasedPointerOnItems");
|
|
384
378
|
},
|
|
385
|
-
IgnoredMouseClick: () => __foldkitBrandViewResult((
|
|
386
|
-
evo(model, { maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeLastButtonPointerType~4") }),
|
|
387
|
-
|
|
388
|
-
Option.none(),
|
|
389
|
-
]), "@foldkit/ui/menu/index.js#IgnoredMouseClick"),
|
|
379
|
+
IgnoredMouseClick: () => (__foldkitBrandViewResult(({
|
|
380
|
+
model: evo(model, { maybeLastButtonPointerType: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#maybeLastButtonPointerType~4") }),
|
|
381
|
+
}), "@foldkit/ui/menu/index.js#IgnoredMouseClick")),
|
|
390
382
|
})), "@foldkit/ui/menu/index.js#update");
|
|
391
383
|
};
|
|
392
384
|
/** The anchor-positioning Mount this Menu renders on its panel. The panel is
|
|
@@ -408,26 +400,26 @@ export const AnchorMenu = Mount.define('AnchorMenu', { buttonId: S.String, ancho
|
|
|
408
400
|
buttonId,
|
|
409
401
|
anchor,
|
|
410
402
|
focusAfterPosition: true,
|
|
411
|
-
})), "@foldkit/ui/menu/index.js#anonymous~
|
|
412
|
-
return __foldkitBrandViewResult((Message.CompletedAnchorMenu()), "@foldkit/ui/menu/index.js#anonymous~
|
|
413
|
-
})), "@foldkit/ui/menu/index.js#anonymous~
|
|
403
|
+
})), "@foldkit/ui/menu/index.js#anonymous~15")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/menu/index.js#anonymous~16"));
|
|
404
|
+
return __foldkitBrandViewResult((Message.CompletedAnchorMenu()), "@foldkit/ui/menu/index.js#anonymous~14");
|
|
405
|
+
})), "@foldkit/ui/menu/index.js#anonymous~13")), "@foldkit/ui/menu/index.js#anonymous~12"));
|
|
414
406
|
/** The backdrop-portaling Mount this Menu renders. Exposed so Scene tests can
|
|
415
407
|
* call `Scene.Mount.resolve(PortalMenuBackdrop, Message.CompletedPortalMenuBackdrop())` to
|
|
416
408
|
* acknowledge the mount produced by the rendered backdrop. */
|
|
417
409
|
export const PortalMenuBackdrop = Mount.define('PortalMenuBackdrop', Message.CompletedPortalMenuBackdrop)(element => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
418
|
-
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((portalToContainingRoot(element)), "@foldkit/ui/menu/index.js#anonymous~
|
|
419
|
-
return __foldkitBrandViewResult((Message.CompletedPortalMenuBackdrop()), "@foldkit/ui/menu/index.js#anonymous~
|
|
420
|
-
})), "@foldkit/ui/menu/index.js#anonymous~
|
|
421
|
-
/** Programmatically opens the
|
|
422
|
-
*
|
|
410
|
+
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((portalToContainingRoot(element)), "@foldkit/ui/menu/index.js#anonymous~19")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/menu/index.js#anonymous~20"));
|
|
411
|
+
return __foldkitBrandViewResult((Message.CompletedPortalMenuBackdrop()), "@foldkit/ui/menu/index.js#anonymous~18");
|
|
412
|
+
})), "@foldkit/ui/menu/index.js#anonymous~17"));
|
|
413
|
+
/** Programmatically opens the Menu, updating the Model and returning focus and
|
|
414
|
+
* modal Commands. Use this in domain-event handlers. */
|
|
423
415
|
export const open = (model) => __foldkitBrandViewResult((update(model, Message.Opened({ maybeActiveItemIndex: Option.none() }))), "@foldkit/ui/menu/index.js#open");
|
|
424
416
|
/** Programmatically closes the menu. If it is open, returns the closed Model
|
|
425
417
|
* with focus and modal Commands. If it is already closed, returns the Model
|
|
426
418
|
* unchanged with no Commands. Use this in domain-event handlers to close the
|
|
427
419
|
* menu. */
|
|
428
420
|
export const close = (model) => __foldkitBrandViewResult((update(model, Message.Closed())), "@foldkit/ui/menu/index.js#close");
|
|
429
|
-
/** Programmatically selects a
|
|
430
|
-
*
|
|
421
|
+
/** Programmatically selects a Menu item, closing the Menu and returning focus
|
|
422
|
+
* Commands plus a `Selected` OutMessage. Use this in domain-event handlers. */
|
|
431
423
|
export const selectItem = (model, item, index) => __foldkitBrandViewResult((update(model, Message.SelectedItem({ index, item }))), "@foldkit/ui/menu/index.js#selectItem");
|
|
432
424
|
export { groupContiguous, resolveTypeaheadMatch };
|
|
433
425
|
const itemId = (id, index) => __foldkitBrandViewResult((`${id}-item-${index}`), "@foldkit/ui/menu/index.js#itemId");
|
|
@@ -436,7 +428,7 @@ const internalView = () =>
|
|
|
436
428
|
__foldkitBrandViewResult((menuViewImpl), "@foldkit/ui/menu/index.js#internalView");
|
|
437
429
|
const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
438
430
|
const { id, isOpen, animation: { transitionState }, maybeActiveItemIndex, searchQuery, maybeLastButtonPointerType, } = model;
|
|
439
|
-
const { items, itemToConfig, isItemDisabled, itemToSearchText = (item) => __foldkitBrandViewResult((item), "@foldkit/ui/menu/index.js#anonymous~
|
|
431
|
+
const { items, itemToConfig, isItemDisabled, itemToSearchText = (item) => __foldkitBrandViewResult((item), "@foldkit/ui/menu/index.js#anonymous~22"), isButtonDisabled, buttonContent, buttonClassName, buttonAttributes = [], itemsClassName, itemsAttributes = [], itemsScrollClassName, itemsScrollAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], itemGroupKey, groupToHeading, groupClassName, groupAttributes = [], separatorClassName, separatorAttributes = [], anchor = {}, ariaLabel, ariaLabelledBy, } = viewInputs;
|
|
440
432
|
const dispatchSelectedItem = (item, index) => __foldkitBrandViewResult((Message.SelectedItem({ index, item })), "@foldkit/ui/menu/index.js#dispatchSelectedItem");
|
|
441
433
|
const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
|
|
442
434
|
const isVisible = isOpen || isLeaving;
|
|
@@ -444,19 +436,19 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
444
436
|
h.DataAttribute('closed', ''),
|
|
445
437
|
h.DataAttribute('enter', ''),
|
|
446
438
|
h.DataAttribute('transition', ''),
|
|
447
|
-
]), "@foldkit/ui/menu/index.js#anonymous~
|
|
439
|
+
]), "@foldkit/ui/menu/index.js#anonymous~23")), M.when('EnterAnimating', () => __foldkitBrandViewResult(([
|
|
448
440
|
h.DataAttribute('enter', ''),
|
|
449
441
|
h.DataAttribute('transition', ''),
|
|
450
|
-
]), "@foldkit/ui/menu/index.js#anonymous~
|
|
442
|
+
]), "@foldkit/ui/menu/index.js#anonymous~24")), M.when('LeaveStart', () => __foldkitBrandViewResult(([
|
|
451
443
|
h.DataAttribute('leave', ''),
|
|
452
444
|
h.DataAttribute('transition', ''),
|
|
453
|
-
]), "@foldkit/ui/menu/index.js#anonymous~
|
|
445
|
+
]), "@foldkit/ui/menu/index.js#anonymous~25")), M.when('LeaveAnimating', () => __foldkitBrandViewResult(([
|
|
454
446
|
h.DataAttribute('closed', ''),
|
|
455
447
|
h.DataAttribute('leave', ''),
|
|
456
448
|
h.DataAttribute('transition', ''),
|
|
457
|
-
]), "@foldkit/ui/menu/index.js#anonymous~
|
|
449
|
+
]), "@foldkit/ui/menu/index.js#anonymous~26")), M.orElse(() => __foldkitBrandViewResult(([]), "@foldkit/ui/menu/index.js#anonymous~27")));
|
|
458
450
|
const isDisabled = (index) => __foldkitBrandViewResult((Predicate.isNotUndefined(isItemDisabled) &&
|
|
459
|
-
pipe(items, Array.get(index), Option.exists(item => __foldkitBrandViewResult((isItemDisabled(item, index)), "@foldkit/ui/menu/index.js#anonymous~
|
|
451
|
+
pipe(items, Array.get(index), Option.exists(item => __foldkitBrandViewResult((isItemDisabled(item, index)), "@foldkit/ui/menu/index.js#anonymous~28")))), "@foldkit/ui/menu/index.js#isDisabled");
|
|
460
452
|
const firstEnabledIndex = findFirstEnabledIndex(items.length, 0, isDisabled)(0, 1);
|
|
461
453
|
const lastEnabledIndex = findFirstEnabledIndex(items.length, 0, isDisabled)(items.length - 1, -1);
|
|
462
454
|
const handleButtonKeyDown = (key) => {
|
|
@@ -465,9 +457,9 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
465
457
|
}
|
|
466
458
|
return __foldkitBrandViewResult((M.value(key).pipe(M.whenOr('Enter', ' ', 'ArrowDown', () => __foldkitBrandViewResult((Option.some(Message.Opened({
|
|
467
459
|
maybeActiveItemIndex: Option.some(firstEnabledIndex),
|
|
468
|
-
}))), "@foldkit/ui/menu/index.js#anonymous~
|
|
460
|
+
}))), "@foldkit/ui/menu/index.js#anonymous~29")), M.when('ArrowUp', () => __foldkitBrandViewResult((Option.some(Message.Opened({
|
|
469
461
|
maybeActiveItemIndex: Option.some(lastEnabledIndex),
|
|
470
|
-
}))), "@foldkit/ui/menu/index.js#anonymous~
|
|
462
|
+
}))), "@foldkit/ui/menu/index.js#anonymous~30")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#anonymous~31")))), "@foldkit/ui/menu/index.js#handleButtonKeyDown");
|
|
471
463
|
};
|
|
472
464
|
const handleButtonPointerDown = (pointerType, button, screenX, screenY, timeStamp) => __foldkitBrandViewResult((Option.some(Message.PressedPointerOnButton({
|
|
473
465
|
pointerType,
|
|
@@ -477,7 +469,7 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
477
469
|
timeStamp,
|
|
478
470
|
}))), "@foldkit/ui/menu/index.js#handleButtonPointerDown");
|
|
479
471
|
const handleButtonClick = () => {
|
|
480
|
-
const isMouse = Option.exists(maybeLastButtonPointerType, type => __foldkitBrandViewResult((type === 'mouse'), "@foldkit/ui/menu/index.js#anonymous~
|
|
472
|
+
const isMouse = Option.exists(maybeLastButtonPointerType, type => __foldkitBrandViewResult((type === 'mouse'), "@foldkit/ui/menu/index.js#anonymous~32"));
|
|
481
473
|
if (isMouse) {
|
|
482
474
|
return __foldkitBrandViewResult((Message.IgnoredMouseClick()), "@foldkit/ui/menu/index.js#handleButtonClick");
|
|
483
475
|
}
|
|
@@ -489,18 +481,18 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
489
481
|
}
|
|
490
482
|
};
|
|
491
483
|
const handleSpaceKeyUp = (key) => __foldkitBrandViewResult((OptionExt.when(key === ' ', Message.SuppressedSpaceScroll())), "@foldkit/ui/menu/index.js#handleSpaceKeyUp");
|
|
492
|
-
const resolveActiveIndex = keyToIndex('ArrowDown', 'ArrowUp', items.length, Option.getOrElse(maybeActiveItemIndex, () => __foldkitBrandViewResult((0), "@foldkit/ui/menu/index.js#anonymous~
|
|
484
|
+
const resolveActiveIndex = keyToIndex('ArrowDown', 'ArrowUp', items.length, Option.getOrElse(maybeActiveItemIndex, () => __foldkitBrandViewResult((0), "@foldkit/ui/menu/index.js#anonymous~33")), isDisabled);
|
|
493
485
|
const searchForKey = (key) => {
|
|
494
486
|
const nextQuery = searchQuery + key;
|
|
495
487
|
const maybeTargetIndex = resolveTypeaheadMatch(items, nextQuery, maybeActiveItemIndex, isDisabled, itemToSearchText, Str.isNonEmpty(searchQuery));
|
|
496
488
|
return __foldkitBrandViewResult((Option.some(Message.Searched({ key, maybeTargetIndex }))), "@foldkit/ui/menu/index.js#searchForKey");
|
|
497
489
|
};
|
|
498
|
-
const handleItemsKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.Closed())), "@foldkit/ui/menu/index.js#anonymous~
|
|
490
|
+
const handleItemsKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.when('Escape', () => __foldkitBrandViewResult((Option.some(Message.Closed())), "@foldkit/ui/menu/index.js#anonymous~34")), M.when('Enter', () => __foldkitBrandViewResult((Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/menu/index.js#anonymous~36"))), "@foldkit/ui/menu/index.js#anonymous~35")), M.when(' ', () => __foldkitBrandViewResult((Str.isNonEmpty(searchQuery)
|
|
499
491
|
? searchForKey(' ')
|
|
500
|
-
: Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/menu/index.js#anonymous~
|
|
492
|
+
: Option.map(maybeActiveItemIndex, index => __foldkitBrandViewResult((Message.RequestedItemClick({ index })), "@foldkit/ui/menu/index.js#anonymous~38"))), "@foldkit/ui/menu/index.js#anonymous~37")), M.whenOr('ArrowDown', 'ArrowUp', 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((Option.some(Message.ActivatedItem({
|
|
501
493
|
index: resolveActiveIndex(key),
|
|
502
494
|
activationTrigger: 'Keyboard',
|
|
503
|
-
}))), "@foldkit/ui/menu/index.js#anonymous~
|
|
495
|
+
}))), "@foldkit/ui/menu/index.js#anonymous~39")), M.when(isPrintableKey, () => __foldkitBrandViewResult((searchForKey(key)), "@foldkit/ui/menu/index.js#anonymous~40")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/menu/index.js#anonymous~41")))), "@foldkit/ui/menu/index.js#handleItemsKeyDown");
|
|
504
496
|
const handleItemsPointerUp = (screenX, screenY, pointerType, timeStamp) => __foldkitBrandViewResult((OptionExt.when(pointerType === 'mouse', Message.ReleasedPointerOnItems({ screenX, screenY, timeStamp }))), "@foldkit/ui/menu/index.js#handleItemsPointerUp");
|
|
505
497
|
const resolveButtonLabel = () => {
|
|
506
498
|
if (Predicate.isNotUndefined(ariaLabel)) {
|
|
@@ -566,7 +558,7 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
566
558
|
...itemsAttributes,
|
|
567
559
|
];
|
|
568
560
|
const menuItems = Array.map(items, (item, index) => {
|
|
569
|
-
const isActiveItem = Option.exists(maybeActiveItemIndex, activeIndex => __foldkitBrandViewResult((activeIndex === index), "@foldkit/ui/menu/index.js#anonymous~
|
|
561
|
+
const isActiveItem = Option.exists(maybeActiveItemIndex, activeIndex => __foldkitBrandViewResult((activeIndex === index), "@foldkit/ui/menu/index.js#anonymous~43"));
|
|
570
562
|
const isDisabledItem = isDisabled(index);
|
|
571
563
|
const itemConfig = itemToConfig(item, {
|
|
572
564
|
isActive: isActiveItem,
|
|
@@ -590,13 +582,13 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
590
582
|
index,
|
|
591
583
|
screenX,
|
|
592
584
|
screenY,
|
|
593
|
-
}))), "@foldkit/ui/menu/index.js#anonymous~
|
|
585
|
+
}))), "@foldkit/ui/menu/index.js#anonymous~44")),
|
|
594
586
|
]),
|
|
595
|
-
h.OnPointerLeave(pointerType => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', Message.DeactivatedItem())), "@foldkit/ui/menu/index.js#anonymous~
|
|
587
|
+
h.OnPointerLeave(pointerType => __foldkitBrandViewResult((OptionExt.when(pointerType !== 'touch', Message.DeactivatedItem())), "@foldkit/ui/menu/index.js#anonymous~45")),
|
|
596
588
|
]
|
|
597
589
|
: []),
|
|
598
590
|
...(itemConfig.className ? [h.Class(itemConfig.className)] : []),
|
|
599
|
-
], [itemConfig.content])), "@foldkit/ui/menu/index.js#anonymous~
|
|
591
|
+
], [itemConfig.content])), "@foldkit/ui/menu/index.js#anonymous~42");
|
|
600
592
|
});
|
|
601
593
|
const renderGroupedItems = () => {
|
|
602
594
|
if (!itemGroupKey) {
|
|
@@ -605,7 +597,7 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
605
597
|
const segments = groupContiguous(menuItems, (_, index) => __foldkitBrandViewResult((Array.get(items, index).pipe(Option.match({
|
|
606
598
|
onNone: () => __foldkitBrandViewResult((''), "@foldkit/ui/menu/index.js#onNone~3"),
|
|
607
599
|
onSome: item => __foldkitBrandViewResult((itemGroupKey(item, index)), "@foldkit/ui/menu/index.js#onSome~3"),
|
|
608
|
-
}))), "@foldkit/ui/menu/index.js#anonymous~
|
|
600
|
+
}))), "@foldkit/ui/menu/index.js#anonymous~46"));
|
|
609
601
|
return __foldkitBrandViewResult((Array.flatMap(segments, (segment, segmentIndex) => {
|
|
610
602
|
const maybeHeading = Option.fromNullishOr(groupToHeading && groupToHeading(segment.key));
|
|
611
603
|
const headingId = `${id}-heading-${segment.key}`;
|
|
@@ -639,7 +631,7 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
639
631
|
]),
|
|
640
632
|
]
|
|
641
633
|
: [];
|
|
642
|
-
return __foldkitBrandViewResult(([...separator, groupElement]), "@foldkit/ui/menu/index.js#anonymous~
|
|
634
|
+
return __foldkitBrandViewResult(([...separator, groupElement]), "@foldkit/ui/menu/index.js#anonymous~47");
|
|
643
635
|
})), "@foldkit/ui/menu/index.js#renderGroupedItems");
|
|
644
636
|
};
|
|
645
637
|
const backdrop = h.keyed('div')(`${id}-backdrop`, [
|
|
@@ -674,7 +666,7 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
674
666
|
buttonContent,
|
|
675
667
|
]),
|
|
676
668
|
...(isVisible ? visibleContent : []),
|
|
677
|
-
])), "@foldkit/ui/menu/index.js#anonymous~
|
|
669
|
+
])), "@foldkit/ui/menu/index.js#anonymous~21");
|
|
678
670
|
});
|
|
679
671
|
/** Pairs the menu's `view` and `update` (and programmatic helpers)
|
|
680
672
|
* behind a single Item-typed entry point. Declaring the menu once at
|
|
@@ -687,9 +679,8 @@ const menuViewImpl = defineView((model, viewInputs, h) => {
|
|
|
687
679
|
* // In view:
|
|
688
680
|
* h.submodel({ view: ActionMenu.view, ... })
|
|
689
681
|
*
|
|
690
|
-
* // In update
|
|
691
|
-
*
|
|
692
|
-
* // maybeOutMessage: Option<Menu.OutMessage<Action>>
|
|
682
|
+
* // In the parent update, pass ActionMenu.update to Update.foldChild and
|
|
683
|
+
* // handle Menu.OutMessage<Action> in foldOutMessage.
|
|
693
684
|
* ```
|
|
694
685
|
*/
|
|
695
686
|
export const create = () => {
|
package/dist/popover/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Effect, Option, Schema as S } from 'effect';
|
|
|
2
2
|
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
|
+
import * as Update from 'foldkit/update';
|
|
5
6
|
import { AnchorConfig } from '../anchor/index.js';
|
|
6
7
|
/** Schema for the popover component's state, tracking open/closed status and animation lifecycle. */
|
|
7
8
|
export declare const Model: S.Struct<{
|
|
@@ -53,7 +54,9 @@ export type PressedPointerOnButton = typeof Message.PressedPointerOnButton.Type;
|
|
|
53
54
|
export type IgnoredMouseClick = typeof Message.IgnoredMouseClick.Type;
|
|
54
55
|
export type SuppressedSpaceScroll = typeof Message.SuppressedSpaceScroll.Type;
|
|
55
56
|
export type Message = typeof Message.Type;
|
|
56
|
-
/** Union of
|
|
57
|
+
/** Union of OutMessages the popover component can produce. Handle open and
|
|
58
|
+
* close transitions in the `foldOutMessage` of the Popover's
|
|
59
|
+
* `Update.foldChild` config. */
|
|
57
60
|
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
58
61
|
readonly Opened: {};
|
|
59
62
|
readonly Closed: {};
|
|
@@ -75,11 +78,7 @@ export declare const init: (config: InitConfig) => Model;
|
|
|
75
78
|
* trigger via a native `<label for={Popover.buttonId(id)}>` or an
|
|
76
79
|
* `aria-labelledby` reference. */
|
|
77
80
|
export declare const buttonId: (id: string) => string;
|
|
78
|
-
type UpdateReturn =
|
|
79
|
-
Model,
|
|
80
|
-
ReadonlyArray<Command.Command<Message>>,
|
|
81
|
-
Option.Option<OutMessage>
|
|
82
|
-
];
|
|
81
|
+
type UpdateReturn = Update.ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
83
82
|
/** Prevents page scrolling while the popover is open in modal mode. */
|
|
84
83
|
export declare const LockScroll: Command.CommandDefinitionNoArgs<"LockScroll", Effect.Effect<{
|
|
85
84
|
readonly _tag: "CompletedLockScroll";
|
|
@@ -127,8 +126,70 @@ export declare const DetectMovementOrAnimationEnd: Command.CommandDefinitionWith
|
|
|
127
126
|
readonly _tag: "EndedAnimation";
|
|
128
127
|
};
|
|
129
128
|
}, never, never>>;
|
|
130
|
-
/** Processes a
|
|
131
|
-
|
|
129
|
+
/** Processes a Popover Message and returns the next Model, optional Commands,
|
|
130
|
+
* and an optional OutMessage. */
|
|
131
|
+
export declare const update: (model: Model, message: Message) => Readonly<{
|
|
132
|
+
model: {
|
|
133
|
+
readonly id: string;
|
|
134
|
+
readonly isOpen: boolean;
|
|
135
|
+
readonly isAnimated: boolean;
|
|
136
|
+
readonly isModal: boolean;
|
|
137
|
+
readonly contentFocus: boolean;
|
|
138
|
+
readonly animation: {
|
|
139
|
+
readonly id: string;
|
|
140
|
+
readonly isShowing: boolean;
|
|
141
|
+
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
142
|
+
};
|
|
143
|
+
readonly maybeLastButtonPointerType: Option.Option<string>;
|
|
144
|
+
};
|
|
145
|
+
commands?: Update.Commands<{
|
|
146
|
+
readonly _tag: "RequestedOpen";
|
|
147
|
+
} | {
|
|
148
|
+
readonly _tag: "RequestedClose";
|
|
149
|
+
} | {
|
|
150
|
+
readonly _tag: "BlurredPanel";
|
|
151
|
+
} | {
|
|
152
|
+
readonly _tag: "PressedPointerOnButton";
|
|
153
|
+
readonly pointerType: string;
|
|
154
|
+
readonly button: number;
|
|
155
|
+
} | {
|
|
156
|
+
readonly _tag: "IgnoredMouseClick";
|
|
157
|
+
} | {
|
|
158
|
+
readonly _tag: "SuppressedSpaceScroll";
|
|
159
|
+
} | {
|
|
160
|
+
readonly _tag: "CompletedFocusPanel";
|
|
161
|
+
} | {
|
|
162
|
+
readonly _tag: "CompletedFocusButton";
|
|
163
|
+
} | {
|
|
164
|
+
readonly _tag: "CompletedLockScroll";
|
|
165
|
+
} | {
|
|
166
|
+
readonly _tag: "CompletedUnlockScroll";
|
|
167
|
+
} | {
|
|
168
|
+
readonly _tag: "CompletedInertOthers";
|
|
169
|
+
} | {
|
|
170
|
+
readonly _tag: "CompletedRestoreInert";
|
|
171
|
+
} | {
|
|
172
|
+
readonly _tag: "CompletedAnchorPopover";
|
|
173
|
+
} | {
|
|
174
|
+
readonly _tag: "CompletedPortalPopoverBackdrop";
|
|
175
|
+
} | {
|
|
176
|
+
readonly _tag: "GotAnimationMessage";
|
|
177
|
+
readonly message: {
|
|
178
|
+
readonly _tag: "Showed";
|
|
179
|
+
} | {
|
|
180
|
+
readonly _tag: "Hid";
|
|
181
|
+
} | {
|
|
182
|
+
readonly _tag: "CompletedWaitForPaint";
|
|
183
|
+
} | {
|
|
184
|
+
readonly _tag: "EndedAnimation";
|
|
185
|
+
};
|
|
186
|
+
}, never>;
|
|
187
|
+
outMessage?: {
|
|
188
|
+
readonly _tag: "Opened";
|
|
189
|
+
} | {
|
|
190
|
+
readonly _tag: "Closed";
|
|
191
|
+
};
|
|
192
|
+
}>;
|
|
132
193
|
/** The anchor-positioning Mount this Popover renders on its panel. Exposed so
|
|
133
194
|
* Scene tests can call `Scene.Mount.resolve(AnchorPopover, CompletedAnchorPopover())`
|
|
134
195
|
* to acknowledge the mount produced by the rendered panel. */
|
|
@@ -157,8 +218,8 @@ export declare const AnchorPopover: Mount.MountDefinitionWithArgs<"AnchorPopover
|
|
|
157
218
|
export declare const PortalPopoverBackdrop: Mount.MountDefinitionNoArgs<"PortalPopoverBackdrop", {
|
|
158
219
|
readonly _tag: "CompletedPortalPopoverBackdrop";
|
|
159
220
|
}>;
|
|
160
|
-
/** Programmatically opens the
|
|
161
|
-
* focus and modal
|
|
221
|
+
/** Programmatically opens the Popover, updating the Model and returning
|
|
222
|
+
* focus and modal Commands plus an `Opened` OutMessage. */
|
|
162
223
|
export declare const open: (model: Model) => UpdateReturn;
|
|
163
224
|
/** Programmatically closes the popover. When it was open, updates the Model
|
|
164
225
|
* and returns focus and modal Commands plus a `Closed` OutMessage. When it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAGN,MAAM,EAEN,MAAM,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.ts"],"names":[],"mappings":"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"}
|