@foldkit/ui 0.162.0 → 0.163.0-canary.085c0174a32b
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/anchor/anchor.d.ts +33 -7
- package/dist/anchor/anchor.d.ts.map +1 -1
- package/dist/anchor/anchor.js +102 -15
- package/dist/anchor/public.d.ts +1 -1
- package/dist/anchor/public.d.ts.map +1 -1
- package/dist/anchor/public.js +1 -1
- package/dist/animation/index.d.ts +3 -0
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/animation/schema.d.ts +13 -4
- package/dist/animation/schema.d.ts.map +1 -1
- package/dist/animation/schema.js +8 -4
- package/dist/animation/update.d.ts +15 -5
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +59 -27
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +27 -19
- package/dist/checkbox/index.d.ts +1 -1
- package/dist/checkbox/index.js +1 -1
- package/dist/combobox/multi.d.ts +5 -0
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +2 -2
- package/dist/combobox/shared.d.ts +19 -7
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +28 -28
- package/dist/combobox/single.d.ts +5 -0
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +4 -4
- package/dist/datePicker/index.d.ts +13 -2
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +10 -10
- package/dist/dialog/index.d.ts +13 -2
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +28 -14
- package/dist/disclosure/index.d.ts +2 -2
- package/dist/disclosure/index.js +1 -1
- package/dist/dragAndDrop/index.js +14 -14
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +7 -5
- package/dist/hoverIntent/hoverIntent.d.ts.map +1 -1
- package/dist/hoverIntent/hoverIntent.js +16 -16
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/internal/accessibleName.d.ts +9 -0
- package/dist/internal/accessibleName.d.ts.map +1 -0
- package/dist/internal/accessibleName.js +12 -0
- package/dist/internal/range.d.ts +7 -0
- package/dist/internal/range.d.ts.map +1 -0
- package/dist/internal/range.js +12 -0
- package/dist/listbox/multi.d.ts +5 -0
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/shared.d.ts +15 -4
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +32 -29
- package/dist/listbox/single.d.ts +5 -0
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/menu/index.d.ts +16 -4
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +35 -28
- package/dist/meter/index.d.ts +26 -0
- package/dist/meter/index.d.ts.map +1 -0
- package/dist/meter/index.js +67 -0
- package/dist/meter/public.d.ts +3 -0
- package/dist/meter/public.d.ts.map +1 -0
- package/dist/meter/public.js +1 -0
- package/dist/popover/index.d.ts +20 -4
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +20 -18
- package/dist/progress/index.d.ts +24 -0
- package/dist/progress/index.d.ts.map +1 -0
- package/dist/progress/index.js +85 -0
- package/dist/progress/public.d.ts +3 -0
- package/dist/progress/public.d.ts.map +1 -0
- package/dist/progress/public.js +1 -0
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +5 -3
- package/dist/slider/index.d.ts +61 -28
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +163 -87
- package/dist/slider/public.d.ts +1 -1
- package/dist/slider/public.d.ts.map +1 -1
- package/dist/slider/public.js +1 -1
- package/dist/switch/index.d.ts +1 -1
- package/dist/switch/index.js +1 -1
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +5 -3
- package/dist/test/apps/disabledButton.d.ts +12 -4
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +3 -3
- package/dist/toast/index.d.ts +869 -45
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +77 -17
- package/dist/toast/public.d.ts +2 -2
- package/dist/toast/public.d.ts.map +1 -1
- package/dist/toast/public.js +1 -1
- package/dist/toast/schema.d.ts +160 -6
- package/dist/toast/schema.d.ts.map +1 -1
- package/dist/toast/schema.js +69 -2
- package/dist/toast/swipeTarget.d.ts +5 -0
- package/dist/toast/swipeTarget.d.ts.map +1 -0
- package/dist/toast/swipeTarget.js +18 -0
- package/dist/toast/test.d.ts +7 -1
- package/dist/toast/test.d.ts.map +1 -1
- package/dist/toast/test.js +37 -3
- package/dist/toast/update.d.ts +768 -7
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +283 -68
- package/dist/tooltip/tooltip.d.ts +7 -7
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +14 -12
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +8 -6
- package/package.json +9 -9
package/dist/calendar/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as Command from 'foldkit/command';
|
|
|
5
5
|
import * as Dom from 'foldkit/dom';
|
|
6
6
|
import { childAttributes, } from 'foldkit/html';
|
|
7
7
|
import { defineMessageUnion } from 'foldkit/message';
|
|
8
|
-
import {
|
|
8
|
+
import { modifyFields } from 'foldkit/struct';
|
|
9
9
|
import { defineView } from 'foldkit/submodel';
|
|
10
10
|
import * as Update from 'foldkit/update';
|
|
11
11
|
import * as OptionExt from '../internal/optionExtensions.js';
|
|
@@ -104,7 +104,7 @@ export const selectDate = (model, date) => __foldkitBrandViewResult((update(mode
|
|
|
104
104
|
* example when opening a date picker onto its current value so the selected
|
|
105
105
|
* month is visible. Returns the model directly because it produces no
|
|
106
106
|
* commands and no OutMessage. */
|
|
107
|
-
export const focusDate = Function.dual(2, (model, date) => __foldkitBrandViewResult((
|
|
107
|
+
export const focusDate = Function.dual(2, (model, date) => __foldkitBrandViewResult((modifyFields(model, {
|
|
108
108
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(date)), "@foldkit/ui/calendar/index.js#maybeFocusedDate"),
|
|
109
109
|
viewYear: () => __foldkitBrandViewResult((date.year), "@foldkit/ui/calendar/index.js#viewYear"),
|
|
110
110
|
viewMonth: () => __foldkitBrandViewResult((date.month), "@foldkit/ui/calendar/index.js#viewMonth"),
|
|
@@ -117,17 +117,17 @@ export const focusDate = Function.dual(2, (model, date) => __foldkitBrandViewRes
|
|
|
117
117
|
* Does NOT reconcile the current selection. If a previously-selected date
|
|
118
118
|
* is now below the new minimum, it remains selected. Callers should clear or
|
|
119
119
|
* reassign the selection explicitly if their domain requires it. */
|
|
120
|
-
export const reflectMinDate = Function.dual(2, (model, maybeMinDate) => __foldkitBrandViewResult((
|
|
120
|
+
export const reflectMinDate = Function.dual(2, (model, maybeMinDate) => __foldkitBrandViewResult((modifyFields(model, { maybeMinDate: () => __foldkitBrandViewResult((maybeMinDate), "@foldkit/ui/calendar/index.js#maybeMinDate") })), "@foldkit/ui/calendar/index.js#anonymous~2"));
|
|
121
121
|
/** Reflects the maximum selectable date onto the model. Pass `Option.none()`
|
|
122
122
|
* to remove the maximum. Does NOT reconcile the current selection. */
|
|
123
|
-
export const reflectMaxDate = Function.dual(2, (model, maybeMaxDate) => __foldkitBrandViewResult((
|
|
123
|
+
export const reflectMaxDate = Function.dual(2, (model, maybeMaxDate) => __foldkitBrandViewResult((modifyFields(model, { maybeMaxDate: () => __foldkitBrandViewResult((maybeMaxDate), "@foldkit/ui/calendar/index.js#maybeMaxDate") })), "@foldkit/ui/calendar/index.js#anonymous~3"));
|
|
124
124
|
/** Reflects the list of individually-disabled dates onto the model. Pass an
|
|
125
125
|
* empty array to clear. Does NOT reconcile the current selection. */
|
|
126
|
-
export const reflectDisabledDates = Function.dual(2, (model, disabledDates) => __foldkitBrandViewResult((
|
|
126
|
+
export const reflectDisabledDates = Function.dual(2, (model, disabledDates) => __foldkitBrandViewResult((modifyFields(model, { disabledDates: () => __foldkitBrandViewResult((disabledDates), "@foldkit/ui/calendar/index.js#disabledDates") })), "@foldkit/ui/calendar/index.js#anonymous~4"));
|
|
127
127
|
/** Reflects the days of the week that are disabled (e.g. weekends) onto the
|
|
128
128
|
* model. Pass an empty array to clear. Does NOT reconcile the current
|
|
129
129
|
* selection. */
|
|
130
|
-
export const reflectDisabledDaysOfWeek = Function.dual(2, (model, disabledDaysOfWeek) => __foldkitBrandViewResult((
|
|
130
|
+
export const reflectDisabledDaysOfWeek = Function.dual(2, (model, disabledDaysOfWeek) => __foldkitBrandViewResult((modifyFields(model, { disabledDaysOfWeek: () => __foldkitBrandViewResult((disabledDaysOfWeek), "@foldkit/ui/calendar/index.js#disabledDaysOfWeek") })), "@foldkit/ui/calendar/index.js#anonymous~5"));
|
|
131
131
|
/** Returns the calendar to Days mode regardless of current depth. Useful for
|
|
132
132
|
* standalone (non-popovered) consumers that want to wire their own back-out
|
|
133
133
|
* gesture. Popovered consumers like `DatePicker` don't need this. Escape
|
|
@@ -143,7 +143,7 @@ export const dropToDays = (model) => {
|
|
|
143
143
|
onNone: () => __foldkitBrandViewResult((1), "@foldkit/ui/calendar/index.js#onNone"),
|
|
144
144
|
onSome: date => __foldkitBrandViewResult((Math.min(date.day, Calendar.daysInMonth(model.viewYear, model.viewMonth))), "@foldkit/ui/calendar/index.js#onSome"),
|
|
145
145
|
});
|
|
146
|
-
return __foldkitBrandViewResult((
|
|
146
|
+
return __foldkitBrandViewResult((modifyFields(model, {
|
|
147
147
|
viewMode: () => __foldkitBrandViewResult(('Days'), "@foldkit/ui/calendar/index.js#viewMode"),
|
|
148
148
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(Calendar.make(model.viewYear, model.viewMonth, focusedDay))), "@foldkit/ui/calendar/index.js#maybeFocusedDate~2"),
|
|
149
149
|
})), "@foldkit/ui/calendar/index.js#dropToDays");
|
|
@@ -214,7 +214,7 @@ const currentOrFallbackFocus = (model) => __foldkitBrandViewResult((Option.getOr
|
|
|
214
214
|
* the parent infers month transitions from the date itself rather than from
|
|
215
215
|
* a separate `ChangedViewMonth` signal that would race with the selection. */
|
|
216
216
|
const commitSelection = (model, date) => (__foldkitBrandViewResult(({
|
|
217
|
-
model:
|
|
217
|
+
model: modifyFields(model, {
|
|
218
218
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(date)), "@foldkit/ui/calendar/index.js#maybeFocusedDate~3"),
|
|
219
219
|
viewYear: () => __foldkitBrandViewResult((date.year), "@foldkit/ui/calendar/index.js#viewYear~2"),
|
|
220
220
|
viewMonth: () => __foldkitBrandViewResult((date.month), "@foldkit/ui/calendar/index.js#viewMonth~2"),
|
|
@@ -228,7 +228,7 @@ const applyFocusMove = (model, candidate, direction, cap) => {
|
|
|
228
228
|
const clamped = clampToRange(model, candidate);
|
|
229
229
|
const nextFocus = skipDisabled(model, clamped, direction, cap);
|
|
230
230
|
const crossedMonth = nextFocus.year !== model.viewYear || nextFocus.month !== model.viewMonth;
|
|
231
|
-
const nextModel =
|
|
231
|
+
const nextModel = modifyFields(model, {
|
|
232
232
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(nextFocus)), "@foldkit/ui/calendar/index.js#maybeFocusedDate~4"),
|
|
233
233
|
viewYear: () => __foldkitBrandViewResult((nextFocus.year), "@foldkit/ui/calendar/index.js#viewYear~3"),
|
|
234
234
|
viewMonth: () => __foldkitBrandViewResult((nextFocus.month), "@foldkit/ui/calendar/index.js#viewMonth~3"),
|
|
@@ -265,7 +265,7 @@ const applyViewMonthChange = (model, year, month, direction) => {
|
|
|
265
265
|
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#applyViewMonthChange");
|
|
266
266
|
}
|
|
267
267
|
const nextFocus = moveFocusForViewChange(model, year, month, direction);
|
|
268
|
-
const nextModel =
|
|
268
|
+
const nextModel = modifyFields(model, {
|
|
269
269
|
viewYear: () => __foldkitBrandViewResult((year), "@foldkit/ui/calendar/index.js#viewYear~4"),
|
|
270
270
|
viewMonth: () => __foldkitBrandViewResult((month), "@foldkit/ui/calendar/index.js#viewMonth~4"),
|
|
271
271
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(nextFocus)), "@foldkit/ui/calendar/index.js#maybeFocusedDate~5"),
|
|
@@ -298,7 +298,7 @@ const applyMonthsFocusShift = (model, monthShift) => {
|
|
|
298
298
|
const focused = currentOrFallbackFocus(model);
|
|
299
299
|
const nextFocus = Calendar.addMonths(focused, monthShift);
|
|
300
300
|
return __foldkitBrandViewResult(({
|
|
301
|
-
model:
|
|
301
|
+
model: modifyFields(model, {
|
|
302
302
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(nextFocus)), "@foldkit/ui/calendar/index.js#maybeFocusedDate~6"),
|
|
303
303
|
viewYear: () => __foldkitBrandViewResult((nextFocus.year), "@foldkit/ui/calendar/index.js#viewYear~5"),
|
|
304
304
|
}),
|
|
@@ -312,7 +312,7 @@ const applyYearsFocusShift = (model, yearShift) => {
|
|
|
312
312
|
const focused = currentOrFallbackFocus(model);
|
|
313
313
|
const nextFocus = Calendar.addYears(focused, yearShift);
|
|
314
314
|
return __foldkitBrandViewResult(({
|
|
315
|
-
model:
|
|
315
|
+
model: modifyFields(model, {
|
|
316
316
|
maybeFocusedDate: () => __foldkitBrandViewResult((Option.some(nextFocus)), "@foldkit/ui/calendar/index.js#maybeFocusedDate~7"),
|
|
317
317
|
}),
|
|
318
318
|
}), "@foldkit/ui/calendar/index.js#applyYearsFocusShift");
|
|
@@ -360,10 +360,10 @@ export const update = (model, message) => __foldkitBrandViewResult((Message.matc
|
|
|
360
360
|
return __foldkitBrandViewResult((applyViewMonthChange(model, next.year, next.month, 1)), "@foldkit/ui/calendar/index.js#ClickedNextMonthButton");
|
|
361
361
|
},
|
|
362
362
|
ClickedHeading: () => __foldkitBrandViewResult((Match.value(model.viewMode).pipe(withUpdateReturn, Match.when('Days', () => (__foldkitBrandViewResult(({
|
|
363
|
-
model:
|
|
363
|
+
model: modifyFields(model, { viewMode: () => __foldkitBrandViewResult(('Months'), "@foldkit/ui/calendar/index.js#viewMode~2") }),
|
|
364
364
|
commands: [FocusGrid({ id: model.id })],
|
|
365
365
|
}), "@foldkit/ui/calendar/index.js#anonymous~35"))), Match.when('Months', () => (__foldkitBrandViewResult(({
|
|
366
|
-
model:
|
|
366
|
+
model: modifyFields(model, { viewMode: () => __foldkitBrandViewResult(('Years'), "@foldkit/ui/calendar/index.js#viewMode~3") }),
|
|
367
367
|
commands: [FocusGrid({ id: model.id })],
|
|
368
368
|
}), "@foldkit/ui/calendar/index.js#anonymous~36"))), Match.when('Years', () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#anonymous~37"))), Match.exhaustive)), "@foldkit/ui/calendar/index.js#ClickedHeading"),
|
|
369
369
|
SelectedMonth: ({ month }) => {
|
|
@@ -373,7 +373,9 @@ export const update = (model, message) => __foldkitBrandViewResult((Message.matc
|
|
|
373
373
|
else {
|
|
374
374
|
const viewMonthChange = applyViewMonthChange(model, model.viewYear, month, jumpDirection(model, model.viewYear, month));
|
|
375
375
|
const monthSelection = {
|
|
376
|
-
model:
|
|
376
|
+
model: modifyFields(viewMonthChange.model, {
|
|
377
|
+
viewMode: () => __foldkitBrandViewResult(('Days'), "@foldkit/ui/calendar/index.js#viewMode~4"),
|
|
378
|
+
}),
|
|
377
379
|
commands: [FocusGrid({ id: model.id })],
|
|
378
380
|
};
|
|
379
381
|
return __foldkitBrandViewResult((pipe(monthSelection, Update.withOutMessage(viewMonthChange.outMessage))), "@foldkit/ui/calendar/index.js#SelectedMonth");
|
|
@@ -386,17 +388,23 @@ export const update = (model, message) => __foldkitBrandViewResult((Message.matc
|
|
|
386
388
|
else {
|
|
387
389
|
const yearViewMonthChange = applyViewMonthChange(model, year, model.viewMonth, jumpDirection(model, year, model.viewMonth));
|
|
388
390
|
const yearSelection = {
|
|
389
|
-
model:
|
|
391
|
+
model: modifyFields(yearViewMonthChange.model, {
|
|
392
|
+
viewMode: () => __foldkitBrandViewResult(('Months'), "@foldkit/ui/calendar/index.js#viewMode~5"),
|
|
393
|
+
}),
|
|
390
394
|
commands: [FocusGrid({ id: model.id })],
|
|
391
395
|
};
|
|
392
396
|
return __foldkitBrandViewResult((pipe(yearSelection, Update.withOutMessage(yearViewMonthChange.outMessage))), "@foldkit/ui/calendar/index.js#SelectedYear");
|
|
393
397
|
}
|
|
394
398
|
},
|
|
395
399
|
PagedYears: ({ direction }) => __foldkitBrandViewResult((applyYearsFocusShift(model, direction * YEARS_PAGE_SIZE)), "@foldkit/ui/calendar/index.js#PagedYears"),
|
|
396
|
-
FocusedGrid: () => (__foldkitBrandViewResult(({
|
|
397
|
-
|
|
400
|
+
FocusedGrid: () => (__foldkitBrandViewResult(({
|
|
401
|
+
model: modifyFields(model, { isGridFocused: () => __foldkitBrandViewResult((true), "@foldkit/ui/calendar/index.js#isGridFocused") }),
|
|
402
|
+
}), "@foldkit/ui/calendar/index.js#FocusedGrid")),
|
|
403
|
+
BlurredGrid: () => (__foldkitBrandViewResult(({
|
|
404
|
+
model: modifyFields(model, { isGridFocused: () => __foldkitBrandViewResult((false), "@foldkit/ui/calendar/index.js#isGridFocused~2") }),
|
|
405
|
+
}), "@foldkit/ui/calendar/index.js#BlurredGrid")),
|
|
398
406
|
RefreshedToday: ({ today }) => (__foldkitBrandViewResult(({
|
|
399
|
-
model:
|
|
407
|
+
model: modifyFields(model, { today: () => __foldkitBrandViewResult((today), "@foldkit/ui/calendar/index.js#today") }),
|
|
400
408
|
}), "@foldkit/ui/calendar/index.js#RefreshedToday")),
|
|
401
409
|
CompletedFocusGrid: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/calendar/index.js#CompletedFocusGrid")),
|
|
402
410
|
})), "@foldkit/ui/calendar/index.js#update");
|
package/dist/checkbox/index.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ export declare const descriptionId: (id: string) => string;
|
|
|
77
77
|
*
|
|
78
78
|
* // In update:
|
|
79
79
|
* ToggledTerms: ({ isChecked }) => ({
|
|
80
|
-
* model:
|
|
80
|
+
* model: modifyFields(model, { acceptedTerms: () => isChecked }),
|
|
81
81
|
* }),
|
|
82
82
|
* ``` */
|
|
83
83
|
export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
|
package/dist/checkbox/index.js
CHANGED
|
@@ -22,7 +22,7 @@ export const descriptionId = (id) => __foldkitBrandViewResult((`${id}-descriptio
|
|
|
22
22
|
*
|
|
23
23
|
* // In update:
|
|
24
24
|
* ToggledTerms: ({ isChecked }) => ({
|
|
25
|
-
* model:
|
|
25
|
+
* model: modifyFields(model, { acceptedTerms: () => isChecked }),
|
|
26
26
|
* }),
|
|
27
27
|
* ``` */
|
|
28
28
|
export const view = (config, h) => {
|
package/dist/combobox/multi.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const Model: Schema.Struct<{
|
|
|
15
15
|
readonly id: Schema.String;
|
|
16
16
|
readonly isShowing: Schema.Boolean;
|
|
17
17
|
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
18
|
+
readonly transitionGeneration: Schema.Number;
|
|
18
19
|
}>;
|
|
19
20
|
readonly maybeActiveItemIndex: Schema.Option<Schema.Number>;
|
|
20
21
|
readonly activationTrigger: Schema.Literals<readonly ["Pointer", "Keyboard"]>;
|
|
@@ -47,6 +48,7 @@ export declare const update: (model: {
|
|
|
47
48
|
readonly id: string;
|
|
48
49
|
readonly isShowing: boolean;
|
|
49
50
|
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
|
|
51
|
+
readonly transitionGeneration: number;
|
|
50
52
|
};
|
|
51
53
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
52
54
|
readonly activationTrigger: "Keyboard" | "Pointer";
|
|
@@ -68,6 +70,7 @@ export declare const update: (model: {
|
|
|
68
70
|
readonly id: string;
|
|
69
71
|
readonly isShowing: boolean;
|
|
70
72
|
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
|
|
73
|
+
readonly transitionGeneration: number;
|
|
71
74
|
};
|
|
72
75
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
73
76
|
readonly activationTrigger: "Keyboard" | "Pointer";
|
|
@@ -120,8 +123,10 @@ export declare const update: (model: {
|
|
|
120
123
|
readonly _tag: "GotAnimationMessage";
|
|
121
124
|
readonly message: {
|
|
122
125
|
readonly _tag: "CompletedWaitForPaint";
|
|
126
|
+
readonly generation: number;
|
|
123
127
|
} | {
|
|
124
128
|
readonly _tag: "EndedAnimation";
|
|
129
|
+
readonly generation: number;
|
|
125
130
|
} | {
|
|
126
131
|
readonly _tag: "Hid";
|
|
127
132
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi.d.ts","sourceRoot":"","sources":["../../src/combobox/multi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,KAAK,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE5D,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,OAAO,EACP,UAAU,EAKX,MAAM,aAAa,CAAA;AAIpB,qOAAqO;AACrO,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"multi.d.ts","sourceRoot":"","sources":["../../src/combobox/multi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,KAAK,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE5D,OAAO,EACL,KAAK,cAAc,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,CAAC,CAAA;IACpD,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;IACpE,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAClE,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAChD,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;CAClD,CAAC,CAAA;AAEF;;wEAEwE;AACxE,eAAO,MAAM,MAAM,GAAI,IAAI,SAAS,MAAM,GAAG,MAAM,OAAK,MAAM,CAAC,IAAI,CA2BlE,CAAA"}
|
package/dist/combobox/multi.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
2
|
import { Option, Schema } from 'effect';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from 'foldkit/struct';
|
|
4
4
|
import { BaseModel, Message, OutMessage, baseInit, closedBaseModel, makeUpdate, makeView, } from './shared.js';
|
|
5
5
|
// MODEL
|
|
6
6
|
/** Schema for the multi-select combobox's private interaction state (open/closed status, active item, activation trigger, typed input value). The selection is owned by the parent and passed in via `ViewInputs.selectedValues`. */
|
|
@@ -18,7 +18,7 @@ export const init = (config) => __foldkitBrandViewResult((baseInit(config)), "@f
|
|
|
18
18
|
* design. Clear the selection by toggling each value off. */
|
|
19
19
|
export const update = makeUpdate({
|
|
20
20
|
handleClose: model => (__foldkitBrandViewResult(({
|
|
21
|
-
model:
|
|
21
|
+
model: modifyFields(closedBaseModel(model), { inputValue: () => __foldkitBrandViewResult((''), "@foldkit/ui/combobox/multi.js#inputValue") }),
|
|
22
22
|
}), "@foldkit/ui/combobox/multi.js#handleClose")),
|
|
23
23
|
handleSelectedItem: (model, item) => (__foldkitBrandViewResult(({
|
|
24
24
|
model,
|
|
@@ -23,6 +23,7 @@ export declare const BaseModel: Schema.Struct<{
|
|
|
23
23
|
readonly id: Schema.String;
|
|
24
24
|
readonly isShowing: Schema.Boolean;
|
|
25
25
|
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
26
|
+
readonly transitionGeneration: Schema.Number;
|
|
26
27
|
}>;
|
|
27
28
|
readonly maybeActiveItemIndex: Schema.Option<Schema.Number>;
|
|
28
29
|
readonly activationTrigger: Schema.Literals<readonly ["Pointer", "Keyboard"]>;
|
|
@@ -100,8 +101,12 @@ export declare const Message: import("foldkit/message").MessageUnion<{
|
|
|
100
101
|
message: import("foldkit/message").MessageUnion<{
|
|
101
102
|
readonly Showed: {};
|
|
102
103
|
readonly Hid: {};
|
|
103
|
-
readonly CompletedWaitForPaint: {
|
|
104
|
-
|
|
104
|
+
readonly CompletedWaitForPaint: {
|
|
105
|
+
generation: Schema.Number;
|
|
106
|
+
};
|
|
107
|
+
readonly EndedAnimation: {
|
|
108
|
+
generation: Schema.Number;
|
|
109
|
+
};
|
|
105
110
|
}>;
|
|
106
111
|
};
|
|
107
112
|
readonly UpdatedInputValue: {
|
|
@@ -212,12 +217,15 @@ export declare const ClickItem: Command.CommandDefinitionWithArgs<"ClickItem", {
|
|
|
212
217
|
/** Detects whether the combobox input wrapper moved or the leave animation ended. Whichever comes first; both outcomes signal the Animation submodel that leave is complete. */
|
|
213
218
|
export declare const DetectMovementOrAnimationEnd: Command.CommandDefinitionWithArgs<"DetectMovementOrAnimationEnd", {
|
|
214
219
|
id: Schema.String;
|
|
220
|
+
generation: Schema.Number;
|
|
215
221
|
}, Effect.Effect<{
|
|
216
222
|
readonly _tag: "GotAnimationMessage";
|
|
217
223
|
readonly message: {
|
|
218
224
|
readonly _tag: "CompletedWaitForPaint";
|
|
225
|
+
readonly generation: number;
|
|
219
226
|
} | {
|
|
220
227
|
readonly _tag: "EndedAnimation";
|
|
228
|
+
readonly generation: number;
|
|
221
229
|
} | {
|
|
222
230
|
readonly _tag: "Hid";
|
|
223
231
|
} | {
|
|
@@ -301,8 +309,10 @@ export declare const makeUpdate: <Model extends BaseModel>(handlers: Readonly<{
|
|
|
301
309
|
readonly _tag: "GotAnimationMessage";
|
|
302
310
|
readonly message: {
|
|
303
311
|
readonly _tag: "CompletedWaitForPaint";
|
|
312
|
+
readonly generation: number;
|
|
304
313
|
} | {
|
|
305
314
|
readonly _tag: "EndedAnimation";
|
|
315
|
+
readonly generation: number;
|
|
306
316
|
} | {
|
|
307
317
|
readonly _tag: "Hid";
|
|
308
318
|
} | {
|
|
@@ -313,11 +323,11 @@ export declare const makeUpdate: <Model extends BaseModel>(handlers: Readonly<{
|
|
|
313
323
|
}>;
|
|
314
324
|
/** The anchor-positioning Mount this Combobox renders on its items panel.
|
|
315
325
|
* The panel is always anchored to the input wrapper via Floating UI and
|
|
316
|
-
* portaled to the document body
|
|
317
|
-
* `anchor.portal: false`), so it
|
|
318
|
-
* overflow clipping. The Mount also
|
|
319
|
-
* capture listener that prevents
|
|
320
|
-
* Scene tests can call
|
|
326
|
+
* portaled to the document body, or into the enclosing `<dialog>` when
|
|
327
|
+
* there is one (opt out of portaling with `anchor.portal: false`), so it
|
|
328
|
+
* escapes ancestor stacking contexts and overflow clipping. The Mount also
|
|
329
|
+
* installs the `pointerdown`-cancelling capture listener that prevents
|
|
330
|
+
* input blur on item presses. Exposed so Scene tests can call
|
|
321
331
|
* `Scene.Mount.resolve(AnchorCombobox, CompletedAnchorCombobox())`. */
|
|
322
332
|
export declare const AnchorCombobox: Mount.MountDefinitionWithArgs<"AnchorCombobox", {
|
|
323
333
|
buttonId: Schema.String;
|
|
@@ -400,6 +410,8 @@ export type BaseViewInputsCommon<Item extends string> = Readonly<{
|
|
|
400
410
|
itemsScrollAttributes?: ReadonlyArray<ChildAttribute>;
|
|
401
411
|
backdropClassName?: string;
|
|
402
412
|
backdropAttributes?: ReadonlyArray<ChildAttribute>;
|
|
413
|
+
/** CSS class for the outer wrapper. Keep the wrapper positioned when the
|
|
414
|
+
* Combobox renders a backdrop, so the input paints above it. */
|
|
403
415
|
className?: string;
|
|
404
416
|
attributes?: ReadonlyArray<ChildAttribute>;
|
|
405
417
|
buttonContent?: Html;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/combobox/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAS,MAAM,EAAa,MAAM,EAAQ,MAAM,QAAQ,CAAA;AAC9E,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAExD,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,CAAA;AACxE,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/combobox/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAS,MAAM,EAAa,MAAM,EAAQ,MAAM,QAAQ,CAAA;AAC9E,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAExD,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,CAAA;AACxE,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,YAAY,EAA+B,MAAM,oBAAoB,CAAA;AAU9E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAK7C,OAAO,EAAE,eAAe,EAAE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CAAA;IAC/C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACnD,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF;;;gDAGgD;AAChD,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,MAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAC1E,QAAQ,CAAC;IACP;;sCAEkC;IAClC,cAAc,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;CACpC,CAAC,CAAA;AAIJ,qFAAqF;AACrF,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAC,CAAA;AAEF,2NAA2N;AAC3N,eAAO,MAAM,QAAQ,GAAI,KAAK,SAAS,SAAS,YAAY,YAAY,MA+jB9D,IAAI,SAAS,MAAM,OAEN,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,CACvE,CAAA"}
|
package/dist/combobox/shared.js
CHANGED
|
@@ -4,10 +4,10 @@ import * as Command from 'foldkit/command';
|
|
|
4
4
|
import * as Dom from 'foldkit/dom';
|
|
5
5
|
import { defineMessageUnion } from 'foldkit/message';
|
|
6
6
|
import * as Mount from 'foldkit/mount';
|
|
7
|
-
import {
|
|
7
|
+
import { makeModifyFieldsFor } from 'foldkit/struct';
|
|
8
8
|
import { defineView } from 'foldkit/submodel';
|
|
9
9
|
import * as Update from 'foldkit/update';
|
|
10
|
-
import { AnchorConfig, anchorSetup,
|
|
10
|
+
import { AnchorConfig, anchorSetup, portalBackdrop } from '../anchor/index.js';
|
|
11
11
|
// NOTE: Animation imports are split across schema + update to avoid a circular
|
|
12
12
|
// dependency: animation → html → runtime → devtools → combobox → animation.
|
|
13
13
|
// The barrel (../animation) imports from html, which starts the cycle.
|
|
@@ -119,9 +119,9 @@ const backdropSelector = (id) => __foldkitBrandViewResult((idSelector(`${id}-bac
|
|
|
119
119
|
export const itemSelector = (id, index) => __foldkitBrandViewResult((idSelector(`${id}-item-${index}`)), "@foldkit/ui/combobox/shared.js#itemSelector");
|
|
120
120
|
export const itemId = (id, index) => __foldkitBrandViewResult((`${id}-item-${index}`), "@foldkit/ui/combobox/shared.js#itemId");
|
|
121
121
|
// HELPERS
|
|
122
|
-
const
|
|
122
|
+
const modifyBaseFields = makeModifyFieldsFor();
|
|
123
123
|
/** Resets only shared base fields to their closed state. Does not touch inputValue. That is variant-specific. */
|
|
124
|
-
export const closedBaseModel = (model) => __foldkitBrandViewResult((
|
|
124
|
+
export const closedBaseModel = (model) => __foldkitBrandViewResult((modifyBaseFields(model, {
|
|
125
125
|
isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/combobox/shared.js#isOpen"),
|
|
126
126
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#maybeActiveItemIndex"),
|
|
127
127
|
activationTrigger: () => __foldkitBrandViewResult(('Keyboard'), "@foldkit/ui/combobox/shared.js#activationTrigger"),
|
|
@@ -173,40 +173,40 @@ export const ClickItem = Command.define('ClickItem', {
|
|
|
173
173
|
});
|
|
174
174
|
/** Detects whether the combobox input wrapper moved or the leave animation ended. Whichever comes first; both outcomes signal the Animation submodel that leave is complete. */
|
|
175
175
|
export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnimationEnd', {
|
|
176
|
-
args: { id: Schema.String },
|
|
176
|
+
args: { id: Schema.String, generation: Schema.Number },
|
|
177
177
|
messages: [Message.GotAnimationMessage],
|
|
178
|
-
execute: ({ id }) => __foldkitBrandViewResult((Effect.raceFirst(Dom.detectElementMovement(inputWrapperSelector(id)).pipe(Effect.as(Message.GotAnimationMessage({
|
|
179
|
-
message: Animation.Message.EndedAnimation(),
|
|
178
|
+
execute: ({ id, generation }) => __foldkitBrandViewResult((Effect.raceFirst(Dom.detectElementMovement(inputWrapperSelector(id)).pipe(Effect.as(Message.GotAnimationMessage({
|
|
179
|
+
message: Animation.Message.EndedAnimation({ generation }),
|
|
180
180
|
}))), Dom.waitForAnimationSettled(itemsSelector(id)).pipe(Effect.as(Message.GotAnimationMessage({
|
|
181
|
-
message: Animation.Message.EndedAnimation(),
|
|
181
|
+
message: Animation.Message.EndedAnimation({ generation }),
|
|
182
182
|
}))))), "@foldkit/ui/combobox/shared.js#execute~6"),
|
|
183
183
|
});
|
|
184
184
|
/** Creates a combobox update function from variant-specific handlers. Shared logic (open, close, activate, transition) is handled internally; only close, selection, and immediate-activation behavior varies by variant. */
|
|
185
185
|
export const makeUpdate = (handlers) => {
|
|
186
186
|
const foldAnimationOutMessage = Animation.OutMessage.match({
|
|
187
|
-
StartedLeaveAnimating: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({
|
|
187
|
+
StartedLeaveAnimating: ({ generation }) => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({
|
|
188
188
|
model,
|
|
189
|
-
commands: [DetectMovementOrAnimationEnd({ id: model.id })],
|
|
189
|
+
commands: [DetectMovementOrAnimationEnd({ id: model.id, generation })],
|
|
190
190
|
}), "@foldkit/ui/combobox/shared.js#anonymous"))), "@foldkit/ui/combobox/shared.js#StartedLeaveAnimating"),
|
|
191
191
|
TransitionedOut: () => __foldkitBrandViewResult((model => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/combobox/shared.js#anonymous~2"))), "@foldkit/ui/combobox/shared.js#TransitionedOut"),
|
|
192
192
|
});
|
|
193
193
|
const foldAnimation = Update.foldChild({
|
|
194
194
|
update: animationUpdate,
|
|
195
195
|
read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/combobox/shared.js#read"),
|
|
196
|
-
write: (model, nextAnimation) => __foldkitBrandViewResult((
|
|
196
|
+
write: (model, nextAnimation) => __foldkitBrandViewResult((modifyBaseFields(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/combobox/shared.js#animation") })), "@foldkit/ui/combobox/shared.js#write"),
|
|
197
197
|
toParentMessage: message => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/combobox/shared.js#toParentMessage"),
|
|
198
198
|
foldOutMessage: foldAnimationOutMessage,
|
|
199
199
|
});
|
|
200
200
|
const foldAnimationShow = Update.foldChildStep({
|
|
201
201
|
update: animationShow,
|
|
202
202
|
read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/combobox/shared.js#read~2"),
|
|
203
|
-
write: (model, nextAnimation) => __foldkitBrandViewResult((
|
|
203
|
+
write: (model, nextAnimation) => __foldkitBrandViewResult((modifyBaseFields(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/combobox/shared.js#animation~2") })), "@foldkit/ui/combobox/shared.js#write~2"),
|
|
204
204
|
toParentMessage: message => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/combobox/shared.js#toParentMessage~2"),
|
|
205
205
|
});
|
|
206
206
|
const foldAnimationHide = Update.foldChildStep({
|
|
207
207
|
update: animationHide,
|
|
208
208
|
read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/combobox/shared.js#read~3"),
|
|
209
|
-
write: (model, nextAnimation) => __foldkitBrandViewResult((
|
|
209
|
+
write: (model, nextAnimation) => __foldkitBrandViewResult((modifyBaseFields(model, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/combobox/shared.js#animation~3") })), "@foldkit/ui/combobox/shared.js#write~3"),
|
|
210
210
|
toParentMessage: message => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/combobox/shared.js#toParentMessage~3"),
|
|
211
211
|
});
|
|
212
212
|
const internalUpdate = (model, message) => {
|
|
@@ -242,12 +242,12 @@ export const makeUpdate = (handlers) => {
|
|
|
242
242
|
}), "@foldkit/ui/combobox/shared.js#anonymous~4")),
|
|
243
243
|
foldAnimationShow,
|
|
244
244
|
stepModel => (__foldkitBrandViewResult(({
|
|
245
|
-
model:
|
|
245
|
+
model: modifyBaseFields(stepModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/combobox/shared.js#isOpen~2") }),
|
|
246
246
|
}), "@foldkit/ui/combobox/shared.js#anonymous~5")),
|
|
247
247
|
])), "@foldkit/ui/combobox/shared.js#openCombobox");
|
|
248
248
|
}
|
|
249
249
|
return __foldkitBrandViewResult(({
|
|
250
|
-
model:
|
|
250
|
+
model: modifyBaseFields(baseModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/combobox/shared.js#isOpen~3") }),
|
|
251
251
|
commands: Array.getSomes([maybeLockScroll, maybeInertOthers]),
|
|
252
252
|
}), "@foldkit/ui/combobox/shared.js#openCombobox");
|
|
253
253
|
};
|
|
@@ -275,7 +275,7 @@ export const makeUpdate = (handlers) => {
|
|
|
275
275
|
CompletedAttachComboboxPreventBlur: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/combobox/shared.js#CompletedAttachComboboxPreventBlur")),
|
|
276
276
|
CompletedAttachComboboxSelectOnFocus: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/combobox/shared.js#CompletedAttachComboboxSelectOnFocus")),
|
|
277
277
|
CompletedPortalComboboxBackdrop: () => (__foldkitBrandViewResult(({ model }), "@foldkit/ui/combobox/shared.js#CompletedPortalComboboxBackdrop")),
|
|
278
|
-
Opened: ({ maybeActiveItemIndex }) => __foldkitBrandViewResult((openCombobox(
|
|
278
|
+
Opened: ({ maybeActiveItemIndex }) => __foldkitBrandViewResult((openCombobox(modifyBaseFields(model, {
|
|
279
279
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((maybeActiveItemIndex), "@foldkit/ui/combobox/shared.js#maybeActiveItemIndex~2"),
|
|
280
280
|
activationTrigger: () => __foldkitBrandViewResult((Option.match(maybeActiveItemIndex, {
|
|
281
281
|
onNone: () => __foldkitBrandViewResult(('Pointer'), "@foldkit/ui/combobox/shared.js#onNone"),
|
|
@@ -293,7 +293,7 @@ export const makeUpdate = (handlers) => {
|
|
|
293
293
|
? closeCombobox(model, closeWithoutFocusCommands, restingInputValue, isClearable)
|
|
294
294
|
: { model }), "@foldkit/ui/combobox/shared.js#BlurredInput"),
|
|
295
295
|
ActivatedItem: ({ index, activationTrigger, maybeImmediateSelection, }) => {
|
|
296
|
-
const highlightedModel =
|
|
296
|
+
const highlightedModel = modifyBaseFields(model, {
|
|
297
297
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/combobox/shared.js#maybeActiveItemIndex~3"),
|
|
298
298
|
activationTrigger: () => __foldkitBrandViewResult((activationTrigger), "@foldkit/ui/combobox/shared.js#activationTrigger~3"),
|
|
299
299
|
});
|
|
@@ -320,7 +320,7 @@ export const makeUpdate = (handlers) => {
|
|
|
320
320
|
return __foldkitBrandViewResult(({ model }), "@foldkit/ui/combobox/shared.js#MovedPointerOverItem");
|
|
321
321
|
}
|
|
322
322
|
return __foldkitBrandViewResult(({
|
|
323
|
-
model:
|
|
323
|
+
model: modifyBaseFields(model, {
|
|
324
324
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/combobox/shared.js#maybeActiveItemIndex~4"),
|
|
325
325
|
activationTrigger: () => __foldkitBrandViewResult(('Pointer'), "@foldkit/ui/combobox/shared.js#activationTrigger~4"),
|
|
326
326
|
maybeLastPointerPosition: () => __foldkitBrandViewResult((Option.some({ screenX, screenY })), "@foldkit/ui/combobox/shared.js#maybeLastPointerPosition~3"),
|
|
@@ -329,7 +329,7 @@ export const makeUpdate = (handlers) => {
|
|
|
329
329
|
},
|
|
330
330
|
DeactivatedItem: () => __foldkitBrandViewResult((model.activationTrigger === 'Pointer'
|
|
331
331
|
? {
|
|
332
|
-
model:
|
|
332
|
+
model: modifyBaseFields(model, {
|
|
333
333
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#maybeActiveItemIndex~5"),
|
|
334
334
|
}),
|
|
335
335
|
}
|
|
@@ -344,14 +344,14 @@ export const makeUpdate = (handlers) => {
|
|
|
344
344
|
UpdatedInputValue: ({ value }) => {
|
|
345
345
|
if (model.isOpen) {
|
|
346
346
|
return __foldkitBrandViewResult(({
|
|
347
|
-
model:
|
|
347
|
+
model: modifyBaseFields(model, {
|
|
348
348
|
inputValue: () => __foldkitBrandViewResult((value), "@foldkit/ui/combobox/shared.js#inputValue"),
|
|
349
349
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.some(0)), "@foldkit/ui/combobox/shared.js#maybeActiveItemIndex~6"),
|
|
350
350
|
activationTrigger: () => __foldkitBrandViewResult(('Keyboard'), "@foldkit/ui/combobox/shared.js#activationTrigger~5"),
|
|
351
351
|
}),
|
|
352
352
|
}), "@foldkit/ui/combobox/shared.js#UpdatedInputValue");
|
|
353
353
|
}
|
|
354
|
-
return __foldkitBrandViewResult((openCombobox(
|
|
354
|
+
return __foldkitBrandViewResult((openCombobox(modifyBaseFields(model, {
|
|
355
355
|
inputValue: () => __foldkitBrandViewResult((value), "@foldkit/ui/combobox/shared.js#inputValue~2"),
|
|
356
356
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.some(0)), "@foldkit/ui/combobox/shared.js#maybeActiveItemIndex~7"),
|
|
357
357
|
activationTrigger: () => __foldkitBrandViewResult(('Keyboard'), "@foldkit/ui/combobox/shared.js#activationTrigger~6"),
|
|
@@ -362,7 +362,7 @@ export const makeUpdate = (handlers) => {
|
|
|
362
362
|
if (model.isOpen) {
|
|
363
363
|
return __foldkitBrandViewResult((closeCombobox(model, closeWithFocusCommands, restingInputValue, isClearable)), "@foldkit/ui/combobox/shared.js#PressedToggleButton");
|
|
364
364
|
}
|
|
365
|
-
return __foldkitBrandViewResult((Update.combine(
|
|
365
|
+
return __foldkitBrandViewResult((Update.combine(modifyBaseFields(model, {
|
|
366
366
|
maybeActiveItemIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#maybeActiveItemIndex~8"),
|
|
367
367
|
activationTrigger: () => __foldkitBrandViewResult(('Pointer'), "@foldkit/ui/combobox/shared.js#activationTrigger~7"),
|
|
368
368
|
maybeLastPointerPosition: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/combobox/shared.js#maybeLastPointerPosition~5"),
|
|
@@ -381,11 +381,11 @@ export const makeUpdate = (handlers) => {
|
|
|
381
381
|
};
|
|
382
382
|
/** The anchor-positioning Mount this Combobox renders on its items panel.
|
|
383
383
|
* The panel is always anchored to the input wrapper via Floating UI and
|
|
384
|
-
* portaled to the document body
|
|
385
|
-
* `anchor.portal: false`), so it
|
|
386
|
-
* overflow clipping. The Mount also
|
|
387
|
-
* capture listener that prevents
|
|
388
|
-
* Scene tests can call
|
|
384
|
+
* portaled to the document body, or into the enclosing `<dialog>` when
|
|
385
|
+
* there is one (opt out of portaling with `anchor.portal: false`), so it
|
|
386
|
+
* escapes ancestor stacking contexts and overflow clipping. The Mount also
|
|
387
|
+
* installs the `pointerdown`-cancelling capture listener that prevents
|
|
388
|
+
* input blur on item presses. Exposed so Scene tests can call
|
|
389
389
|
* `Scene.Mount.resolve(AnchorCombobox, CompletedAnchorCombobox())`. */
|
|
390
390
|
export const AnchorCombobox = Mount.define('AnchorCombobox', {
|
|
391
391
|
args: { buttonId: Schema.String, anchor: AnchorConfig },
|
|
@@ -456,7 +456,7 @@ export const AttachComboboxSelectOnFocus = Mount.define('AttachComboboxSelectOnF
|
|
|
456
456
|
export const PortalComboboxBackdrop = Mount.define('PortalComboboxBackdrop', {
|
|
457
457
|
messages: [Message.CompletedPortalComboboxBackdrop],
|
|
458
458
|
execute: ({ element }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
459
|
-
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((
|
|
459
|
+
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((portalBackdrop(element)), "@foldkit/ui/combobox/shared.js#anonymous~22")), cleanup => __foldkitBrandViewResult((Effect.sync(cleanup)), "@foldkit/ui/combobox/shared.js#anonymous~23"));
|
|
460
460
|
return __foldkitBrandViewResult((Message.CompletedPortalComboboxBackdrop()), "@foldkit/ui/combobox/shared.js#anonymous~21");
|
|
461
461
|
})), "@foldkit/ui/combobox/shared.js#execute~10"),
|
|
462
462
|
});
|
|
@@ -15,6 +15,7 @@ export declare const Model: Schema.Struct<{
|
|
|
15
15
|
readonly id: Schema.String;
|
|
16
16
|
readonly isShowing: Schema.Boolean;
|
|
17
17
|
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
18
|
+
readonly transitionGeneration: Schema.Number;
|
|
18
19
|
}>;
|
|
19
20
|
readonly maybeActiveItemIndex: Schema.Option<Schema.Number>;
|
|
20
21
|
readonly activationTrigger: Schema.Literals<readonly ["Pointer", "Keyboard"]>;
|
|
@@ -45,6 +46,7 @@ export declare const update: (model: {
|
|
|
45
46
|
readonly id: string;
|
|
46
47
|
readonly isShowing: boolean;
|
|
47
48
|
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
|
|
49
|
+
readonly transitionGeneration: number;
|
|
48
50
|
};
|
|
49
51
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
50
52
|
readonly activationTrigger: "Keyboard" | "Pointer";
|
|
@@ -66,6 +68,7 @@ export declare const update: (model: {
|
|
|
66
68
|
readonly id: string;
|
|
67
69
|
readonly isShowing: boolean;
|
|
68
70
|
readonly transitionState: "EnterAnimating" | "EnterStart" | "Idle" | "LeaveAnimating" | "LeaveStart";
|
|
71
|
+
readonly transitionGeneration: number;
|
|
69
72
|
};
|
|
70
73
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
71
74
|
readonly activationTrigger: "Keyboard" | "Pointer";
|
|
@@ -118,8 +121,10 @@ export declare const update: (model: {
|
|
|
118
121
|
readonly _tag: "GotAnimationMessage";
|
|
119
122
|
readonly message: {
|
|
120
123
|
readonly _tag: "CompletedWaitForPaint";
|
|
124
|
+
readonly generation: number;
|
|
121
125
|
} | {
|
|
122
126
|
readonly _tag: "EndedAnimation";
|
|
127
|
+
readonly generation: number;
|
|
123
128
|
} | {
|
|
124
129
|
readonly _tag: "Hid";
|
|
125
130
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../src/combobox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,CAAA;AAExE,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EACzB,OAAO,EACP,UAAU,EAKX,MAAM,aAAa,CAAA;AAIpB,0OAA0O;AAC1O,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../src/combobox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,CAAA;AAExE,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EACzB,OAAO,EACP,UAAU,EAKX,MAAM,aAAa,CAAA;AAIpB,0OAA0O;AAC1O,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;EAEhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,oOAAoO;AACpO,MAAM,MAAM,UAAU,GAAG,cAAc,CAAA;AAEvC,gIAA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V,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,KAChB,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAC7B,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAChD,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAA;CAC7E,CAAC,CAAA;AAEF;;;;;wDAKwD;AACxD,eAAO,MAAM,MAAM,GAAI,IAAI,SAAS,MAAM,GAAG,MAAM,OAAK,MAAM,CAAC,IAAI,CAuClE,CAAA"}
|
package/dist/combobox/single.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
2
|
import { Option, Schema } from 'effect';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from 'foldkit/struct';
|
|
4
4
|
import { defineView } from 'foldkit/submodel';
|
|
5
5
|
import { BaseModel, Message, OutMessage, baseInit, closedBaseModel, makeUpdate, makeView, } from './shared.js';
|
|
6
6
|
// MODEL
|
|
@@ -19,19 +19,19 @@ export const update = makeUpdate({
|
|
|
19
19
|
handleClose: (model, restingInputValue, isClearable) => {
|
|
20
20
|
if (isClearable && model.nullable && model.inputValue === '') {
|
|
21
21
|
return __foldkitBrandViewResult(({
|
|
22
|
-
model:
|
|
22
|
+
model: modifyFields(closedBaseModel(model), { inputValue: () => __foldkitBrandViewResult((''), "@foldkit/ui/combobox/single.js#inputValue") }),
|
|
23
23
|
outMessage: OutMessage.ClearedSelection(),
|
|
24
24
|
}), "@foldkit/ui/combobox/single.js#handleClose");
|
|
25
25
|
}
|
|
26
26
|
return __foldkitBrandViewResult(({
|
|
27
|
-
model:
|
|
27
|
+
model: modifyFields(closedBaseModel(model), {
|
|
28
28
|
inputValue: () => __foldkitBrandViewResult((restingInputValue), "@foldkit/ui/combobox/single.js#inputValue~2"),
|
|
29
29
|
}),
|
|
30
30
|
}), "@foldkit/ui/combobox/single.js#handleClose");
|
|
31
31
|
},
|
|
32
32
|
handleSelectedItem: (model, item, displayText, wasSelected, context) => {
|
|
33
33
|
const nullableDeselect = model.nullable && wasSelected;
|
|
34
|
-
return __foldkitBrandViewResult((context.closeWithFocus(
|
|
34
|
+
return __foldkitBrandViewResult((context.closeWithFocus(modifyFields(closedBaseModel(model), {
|
|
35
35
|
inputValue: () => (__foldkitBrandViewResult((nullableDeselect ? '' : displayText), "@foldkit/ui/combobox/single.js#inputValue~3")),
|
|
36
36
|
}), OutMessage.Selected({ value: item }))), "@foldkit/ui/combobox/single.js#handleSelectedItem");
|
|
37
37
|
},
|