@foldkit/ui 0.155.0 → 0.156.0-canary.13f4f703eb6a
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 +18 -18
- package/dist/anchor/anchor.d.ts.map +1 -1
- package/dist/anchor/anchor.js +16 -16
- package/dist/animation/index.d.ts +4 -4
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/animation/index.js +8 -8
- package/dist/animation/public.d.ts +1 -1
- package/dist/animation/public.d.ts.map +1 -1
- package/dist/animation/public.js +1 -1
- package/dist/animation/schema.d.ts +6 -6
- package/dist/animation/schema.d.ts.map +1 -1
- package/dist/animation/schema.js +5 -5
- package/dist/animation/update.d.ts +4 -2
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +18 -9
- package/dist/calendar/index.d.ts +56 -56
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +49 -37
- package/dist/checkbox/index.js +2 -2
- package/dist/combobox/multi.d.ts +19 -19
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +2 -2
- package/dist/combobox/shared.d.ts +61 -61
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +61 -61
- package/dist/combobox/single.d.ts +19 -19
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +2 -2
- package/dist/datePicker/index.d.ts +72 -72
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +12 -12
- package/dist/dialog/index.d.ts +14 -14
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +22 -22
- package/dist/disclosure/index.js +2 -2
- package/dist/dragAndDrop/index.d.ts +61 -61
- package/dist/dragAndDrop/index.d.ts.map +1 -1
- package/dist/dragAndDrop/index.js +85 -85
- package/dist/fileDrop/index.d.ts +6 -6
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +6 -6
- package/dist/hoverIntent/hoverIntent.d.ts +19 -16
- package/dist/hoverIntent/hoverIntent.d.ts.map +1 -1
- package/dist/hoverIntent/hoverIntent.js +49 -46
- package/dist/hoverIntent/message.d.ts +4 -4
- package/dist/hoverIntent/message.d.ts.map +1 -1
- package/dist/hoverIntent/message.js +4 -4
- package/dist/hoverIntent/public.d.ts +1 -1
- package/dist/hoverIntent/public.d.ts.map +1 -1
- package/dist/hoverIntent/public.js +1 -1
- package/dist/keyboard.js +2 -2
- package/dist/listbox/multi.d.ts +19 -19
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/multi.js +2 -2
- package/dist/listbox/shared.d.ts +58 -58
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +61 -61
- package/dist/listbox/single.d.ts +19 -19
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/listbox/single.js +2 -2
- package/dist/menu/index.d.ts +67 -67
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +69 -66
- package/dist/popover/index.d.ts +34 -34
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +36 -36
- package/dist/radioGroup/index.d.ts +12 -12
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +16 -16
- package/dist/slider/index.d.ts +14 -14
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +31 -31
- package/dist/switch/index.js +2 -2
- package/dist/tabs/index.d.ts +14 -14
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +18 -18
- package/dist/test/apps/disabledButton.d.ts +12 -12
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +5 -5
- package/dist/textarea/index.d.ts +2 -2
- package/dist/textarea/index.d.ts.map +1 -1
- package/dist/toast/index.d.ts +63 -63
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +19 -19
- package/dist/toast/schema.d.ts +55 -55
- package/dist/toast/schema.d.ts.map +1 -1
- package/dist/toast/schema.js +29 -29
- package/dist/toast/test.d.ts.map +1 -1
- package/dist/toast/test.js +3 -3
- package/dist/toast/update.d.ts +61 -61
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +11 -11
- package/dist/tooltip/message.d.ts +3 -3
- package/dist/tooltip/message.d.ts.map +1 -1
- package/dist/tooltip/message.js +3 -3
- package/dist/tooltip/tooltip.d.ts +24 -24
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +13 -13
- package/dist/typeahead.d.ts.map +1 -1
- package/dist/typeahead.js +3 -3
- package/dist/virtualList/index.d.ts +16 -16
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +13 -13
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Duration, Effect, Option, Schema
|
|
1
|
+
import { Duration, Effect, Option, Schema } 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';
|
|
@@ -7,15 +7,15 @@ import * as Update from 'foldkit/update';
|
|
|
7
7
|
import { AnchorConfig } from '../anchor/index.js';
|
|
8
8
|
import { Message, OutMessage } from './message.js';
|
|
9
9
|
/** Schema for the tooltip component's state. `isOpen` is visibility; `isHovered` tracks pointer on trigger; `isFocused` tracks tooltip-affirming focus on the trigger (focus arriving without a preceding mouse press, like keyboard, touch, or pen; mouse-click-induced focus is excluded since it doesn't affirm the user wants the tooltip visible); `isDismissed` suppresses re-opening after the user dismissed the tooltip (via Escape) until they disengage (leave or blur). `showDelay` is the hover-to-show duration. `maybeLastPointerType` records the most recent pointer type that pressed the trigger, so a mouse-click-induced focus can be distinguished from other focus. */
|
|
10
|
-
export declare const Model:
|
|
11
|
-
readonly id:
|
|
12
|
-
readonly isOpen:
|
|
13
|
-
readonly isHovered:
|
|
14
|
-
readonly isFocused:
|
|
15
|
-
readonly isDismissed:
|
|
16
|
-
readonly showDelay:
|
|
17
|
-
readonly pendingShowVersion:
|
|
18
|
-
readonly maybeLastPointerType:
|
|
10
|
+
export declare const Model: Schema.Struct<{
|
|
11
|
+
readonly id: Schema.String;
|
|
12
|
+
readonly isOpen: Schema.Boolean;
|
|
13
|
+
readonly isHovered: Schema.Boolean;
|
|
14
|
+
readonly isFocused: Schema.Boolean;
|
|
15
|
+
readonly isDismissed: Schema.Boolean;
|
|
16
|
+
readonly showDelay: Schema.DurationFromMillis;
|
|
17
|
+
readonly pendingShowVersion: Schema.Number;
|
|
18
|
+
readonly maybeLastPointerType: Schema.Option<Schema.String>;
|
|
19
19
|
}>;
|
|
20
20
|
export type Model = typeof Model.Type;
|
|
21
21
|
/** Returns the bare DOM id of the tooltip trigger button, derived from the
|
|
@@ -33,27 +33,27 @@ export declare const init: (config: InitConfig) => Model;
|
|
|
33
33
|
/** Waits for the tooltip's show delay before emitting
|
|
34
34
|
* `CompletedWaitBeforeShowing`. */
|
|
35
35
|
export declare const WaitBeforeShowing: Command.CommandDefinitionWithArgs<"WaitBeforeShowing", {
|
|
36
|
-
delay:
|
|
37
|
-
version:
|
|
36
|
+
delay: Schema.DurationFromMillis;
|
|
37
|
+
version: Schema.Number;
|
|
38
38
|
}, Effect.Effect<{
|
|
39
39
|
readonly _tag: "CompletedWaitBeforeShowing";
|
|
40
40
|
readonly version: number;
|
|
41
41
|
}, never, never>>;
|
|
42
42
|
/** The anchor-positioning Mount this Tooltip renders on its panel. */
|
|
43
43
|
export declare const AnchorTooltip: Mount.MountDefinitionWithArgs<"AnchorTooltip", {
|
|
44
|
-
buttonId:
|
|
45
|
-
anchor:
|
|
46
|
-
readonly placement:
|
|
47
|
-
readonly gap:
|
|
48
|
-
readonly offset:
|
|
49
|
-
readonly padding:
|
|
50
|
-
readonly top:
|
|
51
|
-
readonly right:
|
|
52
|
-
readonly bottom:
|
|
53
|
-
readonly left:
|
|
44
|
+
buttonId: Schema.String;
|
|
45
|
+
anchor: Schema.Struct<{
|
|
46
|
+
readonly placement: Schema.optional<Schema.Literals<readonly ["top", "right", "bottom", "left", "top-start", "top-end", "right-start", "right-end", "bottom-start", "bottom-end", "left-start", "left-end"]>>;
|
|
47
|
+
readonly gap: Schema.optional<Schema.Number>;
|
|
48
|
+
readonly offset: Schema.optional<Schema.Number>;
|
|
49
|
+
readonly padding: Schema.optional<Schema.Union<readonly [Schema.Number, Schema.Struct<{
|
|
50
|
+
readonly top: Schema.optionalKey<Schema.Number>;
|
|
51
|
+
readonly right: Schema.optionalKey<Schema.Number>;
|
|
52
|
+
readonly bottom: Schema.optionalKey<Schema.Number>;
|
|
53
|
+
readonly left: Schema.optionalKey<Schema.Number>;
|
|
54
54
|
}>]>>;
|
|
55
|
-
readonly portal:
|
|
56
|
-
readonly isPlacementLocked:
|
|
55
|
+
readonly portal: Schema.optional<Schema.Boolean>;
|
|
56
|
+
readonly isPlacementLocked: Schema.optional<Schema.Boolean>;
|
|
57
57
|
}>;
|
|
58
58
|
}, {
|
|
59
59
|
readonly _tag: "CompletedAnchorTooltip";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/tooltip/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,MAAM,EAKN,MAAM,EAEN,MAAM,
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/tooltip/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,MAAM,EAKN,MAAM,EAEN,MAAM,EAEP,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAC9E,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAA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AY,CAAA;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF;;uEAEuE;AACvE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAVP,YAAY;YACZ,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;iBACvB,OAAO;gBACR,MAAM;qBACD,MAAM;GA2ExB,CAAA"}
|
package/dist/tooltip/tooltip.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Duration, Effect, Equal, Function, Match
|
|
2
|
+
import { Duration, Effect, Equal, Function, Match, Number, Option, Predicate, Schema, pipe, } from 'effect';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import { childAttributes } from 'foldkit/html';
|
|
5
5
|
import * as Mount from 'foldkit/mount';
|
|
@@ -11,15 +11,15 @@ import * as OptionExt from '../internal/optionExtensions.js';
|
|
|
11
11
|
import { Message, OutMessage } from './message.js';
|
|
12
12
|
// MODEL
|
|
13
13
|
/** Schema for the tooltip component's state. `isOpen` is visibility; `isHovered` tracks pointer on trigger; `isFocused` tracks tooltip-affirming focus on the trigger (focus arriving without a preceding mouse press, like keyboard, touch, or pen; mouse-click-induced focus is excluded since it doesn't affirm the user wants the tooltip visible); `isDismissed` suppresses re-opening after the user dismissed the tooltip (via Escape) until they disengage (leave or blur). `showDelay` is the hover-to-show duration. `maybeLastPointerType` records the most recent pointer type that pressed the trigger, so a mouse-click-induced focus can be distinguished from other focus. */
|
|
14
|
-
export const Model =
|
|
15
|
-
id:
|
|
16
|
-
isOpen:
|
|
17
|
-
isHovered:
|
|
18
|
-
isFocused:
|
|
19
|
-
isDismissed:
|
|
20
|
-
showDelay:
|
|
21
|
-
pendingShowVersion:
|
|
22
|
-
maybeLastPointerType:
|
|
14
|
+
export const Model = Schema.Struct({
|
|
15
|
+
id: Schema.String,
|
|
16
|
+
isOpen: Schema.Boolean,
|
|
17
|
+
isHovered: Schema.Boolean,
|
|
18
|
+
isFocused: Schema.Boolean,
|
|
19
|
+
isDismissed: Schema.Boolean,
|
|
20
|
+
showDelay: Schema.DurationFromMillis,
|
|
21
|
+
pendingShowVersion: Schema.Number,
|
|
22
|
+
maybeLastPointerType: Schema.Option(Schema.String),
|
|
23
23
|
});
|
|
24
24
|
// SELECTORS
|
|
25
25
|
/** Returns the bare DOM id of the tooltip trigger button, derived from the
|
|
@@ -47,13 +47,13 @@ export const init = (config) => (__foldkitBrandViewResult(({
|
|
|
47
47
|
/** Waits for the tooltip's show delay before emitting
|
|
48
48
|
* `CompletedWaitBeforeShowing`. */
|
|
49
49
|
export const WaitBeforeShowing = Command.define('WaitBeforeShowing', {
|
|
50
|
-
args: { delay:
|
|
50
|
+
args: { delay: Schema.DurationFromMillis, version: Schema.Number },
|
|
51
51
|
messages: [Message.CompletedWaitBeforeShowing],
|
|
52
52
|
execute: ({ delay, version }) => __foldkitBrandViewResult((Effect.sleep(delay).pipe(Effect.as(Message.CompletedWaitBeforeShowing({ version })))), "@foldkit/ui/tooltip/tooltip.js#execute"),
|
|
53
53
|
});
|
|
54
54
|
/** The anchor-positioning Mount this Tooltip renders on its panel. */
|
|
55
55
|
export const AnchorTooltip = Mount.define('AnchorTooltip', {
|
|
56
|
-
args: { buttonId:
|
|
56
|
+
args: { buttonId: Schema.String, anchor: AnchorConfig },
|
|
57
57
|
messages: [Message.CompletedAnchorTooltip],
|
|
58
58
|
execute: ({ element, buttonId, anchor }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
59
59
|
yield* Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((anchorSetup(element, {
|
|
@@ -187,7 +187,7 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
const triggerLabelAttributes = resolveTriggerLabel();
|
|
190
|
-
const handleTriggerKeyDown = (key) => __foldkitBrandViewResult((
|
|
190
|
+
const handleTriggerKeyDown = (key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when('Escape', () => __foldkitBrandViewResult((OptionExt.when(isOpen, Message.PressedEscape())), "@foldkit/ui/tooltip/tooltip.js#anonymous~6")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tooltip/tooltip.js#anonymous~7")))), "@foldkit/ui/tooltip/tooltip.js#handleTriggerKeyDown");
|
|
191
191
|
const handleTriggerPointerDown = (pointerType) => __foldkitBrandViewResult((Option.some(Message.PressedPointerOnTrigger({ pointerType }))), "@foldkit/ui/tooltip/tooltip.js#handleTriggerPointerDown");
|
|
192
192
|
const triggerAttributes = [
|
|
193
193
|
h.Id(triggerId(id)),
|
package/dist/typeahead.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeahead.d.ts","sourceRoot":"","sources":["../src/typeahead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"typeahead.d.ts","sourceRoot":"","sources":["../src/typeahead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAgB,MAAM,QAAQ,CAAA;AAIpD,oOAAoO;AACpO,eAAO,MAAM,qBAAqB,GAAI,IAAI,SACjC,aAAa,CAAC,IAAI,CAAC,SACnB,MAAM,wBACS,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAC/B,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,oBACpB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,gBACzC,OAAO,KACpB,MAAM,CAAC,MAAM,CAAC,MAAM,CA4BtB,CAAA"}
|
package/dist/typeahead.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Array, Option, String
|
|
2
|
+
import { Array, Option, String, pipe } from 'effect';
|
|
3
3
|
import { wrapIndex } from './keyboard.js';
|
|
4
4
|
/** Finds the first enabled item whose search text starts with the query, searching forward from the active item and wrapping around. On a fresh search, starts after the active item; on a refinement, includes the active item. */
|
|
5
5
|
export const resolveTypeaheadMatch = (items, query, maybeActiveItemIndex, isDisabled, itemToSearchText, isRefinement) => {
|
|
6
|
-
const lowerQuery =
|
|
6
|
+
const lowerQuery = String.toLowerCase(query);
|
|
7
7
|
const offset = isRefinement ? 0 : 1;
|
|
8
8
|
const startIndex = Option.match(maybeActiveItemIndex, {
|
|
9
9
|
onNone: () => __foldkitBrandViewResult((0), "@foldkit/ui/typeahead.js#onNone"),
|
|
10
10
|
onSome: index => __foldkitBrandViewResult((index + offset), "@foldkit/ui/typeahead.js#onSome"),
|
|
11
11
|
});
|
|
12
12
|
const isEnabledMatch = (index) => __foldkitBrandViewResult((!isDisabled(index) &&
|
|
13
|
-
pipe(items, Array.get(index), Option.exists(item => __foldkitBrandViewResult((pipe(itemToSearchText(item, index),
|
|
13
|
+
pipe(items, Array.get(index), Option.exists(item => __foldkitBrandViewResult((pipe(itemToSearchText(item, index), String.toLowerCase, String.startsWith(lowerQuery))), "@foldkit/ui/typeahead.js#anonymous")))), "@foldkit/ui/typeahead.js#isEnabledMatch");
|
|
14
14
|
return __foldkitBrandViewResult((pipe(items, Array.length, Array.makeBy(step => __foldkitBrandViewResult((wrapIndex(startIndex + step, items.length)), "@foldkit/ui/typeahead.js#anonymous~2")), Array.findFirst(isEnabledMatch))), "@foldkit/ui/typeahead.js#resolveTypeaheadMatch");
|
|
15
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Effect, Option, Schema
|
|
1
|
+
import { Effect, Option, Schema } from 'effect';
|
|
2
2
|
import { type Update } from 'foldkit';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import { type ChildAttribute, type Html, type TagName } from 'foldkit/html';
|
|
@@ -6,36 +6,36 @@ import { type View as SubmodelView } from 'foldkit/submodel';
|
|
|
6
6
|
import * as Subscription from 'foldkit/subscription';
|
|
7
7
|
/** Schema for the virtual list's state. Tracks scroll position, container
|
|
8
8
|
* measurement, and any in-flight programmatic scroll. */
|
|
9
|
-
export declare const Model:
|
|
10
|
-
readonly id:
|
|
11
|
-
readonly rowHeightPx:
|
|
12
|
-
readonly scrollTop:
|
|
9
|
+
export declare const Model: Schema.Struct<{
|
|
10
|
+
readonly id: Schema.String;
|
|
11
|
+
readonly rowHeightPx: Schema.Number;
|
|
12
|
+
readonly scrollTop: Schema.Number;
|
|
13
13
|
readonly measurement: import("foldkit/schema").TaggedUnion<{
|
|
14
14
|
readonly Unmeasured: {};
|
|
15
15
|
readonly Measured: {
|
|
16
|
-
containerHeight:
|
|
16
|
+
containerHeight: Schema.Number;
|
|
17
17
|
};
|
|
18
18
|
}>;
|
|
19
19
|
readonly pendingScroll: import("foldkit/schema").TaggedUnion<{
|
|
20
20
|
readonly Idle: {};
|
|
21
21
|
readonly ScrollingToIndex: {
|
|
22
|
-
index:
|
|
23
|
-
version:
|
|
22
|
+
index: Schema.Number;
|
|
23
|
+
version: Schema.Number;
|
|
24
24
|
};
|
|
25
25
|
}>;
|
|
26
|
-
readonly pendingScrollVersion:
|
|
26
|
+
readonly pendingScrollVersion: Schema.Number;
|
|
27
27
|
}>;
|
|
28
28
|
export type Model = typeof Model.Type;
|
|
29
29
|
/** Union of all messages the virtual list component can produce. */
|
|
30
30
|
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
31
31
|
readonly ScrolledContainer: {
|
|
32
|
-
scrollTop:
|
|
32
|
+
scrollTop: Schema.Number;
|
|
33
33
|
};
|
|
34
34
|
readonly MeasuredContainer: {
|
|
35
|
-
containerHeight:
|
|
35
|
+
containerHeight: Schema.Number;
|
|
36
36
|
};
|
|
37
37
|
readonly CompletedApplyScroll: {
|
|
38
|
-
version:
|
|
38
|
+
version: Schema.Number;
|
|
39
39
|
};
|
|
40
40
|
}>;
|
|
41
41
|
export type ScrolledContainer = typeof Message.ScrolledContainer.Type;
|
|
@@ -52,9 +52,9 @@ export type InitConfig = Readonly<{
|
|
|
52
52
|
* `Measured`. */
|
|
53
53
|
export declare const init: (config: InitConfig) => Model;
|
|
54
54
|
export declare const ApplyScroll: Command.CommandDefinitionWithArgs<"ApplyScroll", {
|
|
55
|
-
id:
|
|
56
|
-
scrollTop:
|
|
57
|
-
version:
|
|
55
|
+
id: Schema.String;
|
|
56
|
+
scrollTop: Schema.Number;
|
|
57
|
+
version: Schema.Number;
|
|
58
58
|
}, Effect.Effect<{
|
|
59
59
|
readonly _tag: "CompletedApplyScroll";
|
|
60
60
|
readonly version: number;
|
|
@@ -215,7 +215,7 @@ export type ViewInputs<Item> = Readonly<{
|
|
|
215
215
|
itemToView: (item: Item, index: number) => Html;
|
|
216
216
|
itemToRowHeightPx?: (item: Item, index: number) => number;
|
|
217
217
|
overscan?: number;
|
|
218
|
-
rowElement?: TagName
|
|
218
|
+
rowElement?: Exclude<TagName, 'textarea'>;
|
|
219
219
|
containerClassName?: string;
|
|
220
220
|
containerAttributes?: ReadonlyArray<ChildAttribute>;
|
|
221
221
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/virtualList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,MAAM,EAEN,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/virtualList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,MAAM,EAEN,MAAM,EAGP,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EACL,KAAK,cAAc,EACnB,KAA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AAE,MAAM,KAAK,MAAM,CAAA;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;IACzC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;CACpD,CAAC,CAAA;AAEF;;;;;;;YAOY;AACZ,KAAK,WAAW,CAAC,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;AAEvE,eAAO,MAAM,IAAI,GAAI,IAAI,OAEA,WAAW,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Array, Effect, Number, Option, Queue, Schema
|
|
2
|
+
import { Array, Effect, Number, Option, Queue, Schema, Stream, pipe, } from 'effect';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import { childAttributes, } from 'foldkit/html';
|
|
5
5
|
import { defineMessageUnion } from 'foldkit/message';
|
|
@@ -17,29 +17,29 @@ import * as Subscription from 'foldkit/subscription';
|
|
|
17
17
|
*/
|
|
18
18
|
const Measurement = defineTaggedUnion({
|
|
19
19
|
Unmeasured: {},
|
|
20
|
-
Measured: { containerHeight:
|
|
20
|
+
Measured: { containerHeight: Schema.Number },
|
|
21
21
|
});
|
|
22
22
|
/** State of a programmatic scroll initiated by `scrollToIndex`. */
|
|
23
23
|
const PendingScroll = defineTaggedUnion({
|
|
24
24
|
Idle: {},
|
|
25
|
-
ScrollingToIndex: { index:
|
|
25
|
+
ScrollingToIndex: { index: Schema.Number, version: Schema.Number },
|
|
26
26
|
});
|
|
27
27
|
/** Schema for the virtual list's state. Tracks scroll position, container
|
|
28
28
|
* measurement, and any in-flight programmatic scroll. */
|
|
29
|
-
export const Model =
|
|
30
|
-
id:
|
|
31
|
-
rowHeightPx:
|
|
32
|
-
scrollTop:
|
|
29
|
+
export const Model = Schema.Struct({
|
|
30
|
+
id: Schema.String,
|
|
31
|
+
rowHeightPx: Schema.Number,
|
|
32
|
+
scrollTop: Schema.Number,
|
|
33
33
|
measurement: Measurement,
|
|
34
34
|
pendingScroll: PendingScroll,
|
|
35
|
-
pendingScrollVersion:
|
|
35
|
+
pendingScrollVersion: Schema.Number,
|
|
36
36
|
});
|
|
37
37
|
// MESSAGE
|
|
38
38
|
/** Union of all messages the virtual list component can produce. */
|
|
39
39
|
export const Message = defineMessageUnion({
|
|
40
|
-
ScrolledContainer: { scrollTop:
|
|
41
|
-
MeasuredContainer: { containerHeight:
|
|
42
|
-
CompletedApplyScroll: { version:
|
|
40
|
+
ScrolledContainer: { scrollTop: Schema.Number },
|
|
41
|
+
MeasuredContainer: { containerHeight: Schema.Number },
|
|
42
|
+
CompletedApplyScroll: { version: Schema.Number },
|
|
43
43
|
});
|
|
44
44
|
/** Creates an initial virtual list model from a config. The container starts
|
|
45
45
|
* in `Unmeasured` state. The first `ResizeObserver` entry transitions it to
|
|
@@ -54,7 +54,7 @@ export const init = (config) => (__foldkitBrandViewResult(({
|
|
|
54
54
|
}), "@foldkit/ui/virtualList/index.js#init"));
|
|
55
55
|
// UPDATE
|
|
56
56
|
export const ApplyScroll = Command.define('ApplyScroll', {
|
|
57
|
-
args: { id:
|
|
57
|
+
args: { id: Schema.String, scrollTop: Schema.Number, version: Schema.Number },
|
|
58
58
|
messages: [Message.CompletedApplyScroll],
|
|
59
59
|
execute: ({ id, scrollTop, version }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
60
60
|
const element = document.getElementById(id);
|
|
@@ -245,7 +245,7 @@ const containerElement = (id) => __foldkitBrandViewResult((Option.fromNullishOr(
|
|
|
245
245
|
* page that mounts the list, away, and back all reattach correctly without
|
|
246
246
|
* the consumer having to teach the framework about navigation. */
|
|
247
247
|
export const subscriptions = Subscription.make()(entry => (__foldkitBrandViewResult(({
|
|
248
|
-
containerEvents: entry({ id:
|
|
248
|
+
containerEvents: entry({ id: Schema.String }, {
|
|
249
249
|
modelToDependencies: model => (__foldkitBrandViewResult(({ id: model.id }), "@foldkit/ui/virtualList/index.js#modelToDependencies")),
|
|
250
250
|
dependenciesToStream: ({ id }) => __foldkitBrandViewResult((Stream.callback(queue => __foldkitBrandViewResult((Effect.acquireRelease(Effect.sync(() => {
|
|
251
251
|
const state = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldkit/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.156.0-canary.13f4f703eb6a",
|
|
4
4
|
"description": "Headless, accessible UI components for Foldkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
],
|
|
123
123
|
"peerDependencies": {
|
|
124
124
|
"effect": "4.0.0-rc.112",
|
|
125
|
-
"foldkit": "
|
|
125
|
+
"foldkit": "0.156.0-canary.13f4f703eb6a"
|
|
126
126
|
},
|
|
127
127
|
"dependencies": {
|
|
128
128
|
"@floating-ui/dom": "^1.8.0"
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"rimraf": "^6.1.3",
|
|
135
135
|
"typescript": "^7.0.2",
|
|
136
136
|
"vitest": "^4.1.11",
|
|
137
|
-
"@foldkit/vite-plugin": "0.20.0",
|
|
138
|
-
"foldkit": "0.
|
|
137
|
+
"@foldkit/vite-plugin": "0.20.0-canary.13f4f703eb6a",
|
|
138
|
+
"foldkit": "0.156.0-canary.13f4f703eb6a"
|
|
139
139
|
},
|
|
140
140
|
"keywords": [
|
|
141
141
|
"foldkit",
|