@foldkit/ui 0.155.0 → 0.156.0-canary.0053b7691fcd
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.js +6 -6
- 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 +2 -2
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +9 -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 +51 -51
- 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 +9 -9
- package/dist/dialog/index.d.ts +14 -14
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +14 -14
- 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 +52 -52
- 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 +60 -57
- package/dist/popover/index.d.ts +34 -34
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +27 -27
- 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 +4 -4
- 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 +25 -25
- package/dist/toast/update.d.ts +61 -61
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +5 -5
- 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 +15 -15
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +13 -13
- package/package.json +4 -4
package/dist/toast/update.d.ts
CHANGED
|
@@ -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 * as Update from 'foldkit/update';
|
|
4
4
|
import { type InitConfig, type Variant } from './schema.js';
|
|
@@ -16,9 +16,9 @@ export type ShowInput<A> = Readonly<{
|
|
|
16
16
|
* the update function. Static. The Command definition doesn't depend on
|
|
17
17
|
* payload. */
|
|
18
18
|
export declare const WaitBeforeDismissal: Command.CommandDefinitionWithArgs<"WaitBeforeDismissal", {
|
|
19
|
-
entryId:
|
|
20
|
-
version:
|
|
21
|
-
duration:
|
|
19
|
+
entryId: Schema.String;
|
|
20
|
+
version: Schema.Number;
|
|
21
|
+
duration: Schema.DurationFromMillis;
|
|
22
22
|
}, Effect.Effect<{
|
|
23
23
|
readonly _tag: "CompletedWaitBeforeDismissal";
|
|
24
24
|
readonly entryId: string;
|
|
@@ -31,70 +31,70 @@ export declare const WaitBeforeDismissal: Command.CommandDefinitionWithArgs<"Wai
|
|
|
31
31
|
*
|
|
32
32
|
* @internal Consumers should use `Toast.make(PayloadSchema)`. This is
|
|
33
33
|
* only exported so `index.ts` can wire the view into the bound runtime. */
|
|
34
|
-
export declare const makeRuntime: <A, I>(payloadSchema:
|
|
35
|
-
readonly Entry:
|
|
36
|
-
readonly id:
|
|
37
|
-
readonly variant:
|
|
38
|
-
readonly animation:
|
|
39
|
-
readonly id:
|
|
40
|
-
readonly isShowing:
|
|
41
|
-
readonly transitionState:
|
|
34
|
+
export declare const makeRuntime: <A, I>(payloadSchema: Schema.Codec<A, I>) => {
|
|
35
|
+
readonly Entry: Schema.Struct<{
|
|
36
|
+
readonly id: Schema.String;
|
|
37
|
+
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
|
|
38
|
+
readonly animation: Schema.Struct<{
|
|
39
|
+
readonly id: Schema.String;
|
|
40
|
+
readonly isShowing: Schema.Boolean;
|
|
41
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
42
42
|
}>;
|
|
43
|
-
readonly maybeDuration:
|
|
44
|
-
readonly pendingDismissVersion:
|
|
45
|
-
readonly isHovered:
|
|
46
|
-
readonly payload:
|
|
43
|
+
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
|
|
44
|
+
readonly pendingDismissVersion: Schema.Number;
|
|
45
|
+
readonly isHovered: Schema.Boolean;
|
|
46
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
47
47
|
}>;
|
|
48
|
-
readonly Model:
|
|
49
|
-
readonly id:
|
|
50
|
-
readonly defaultDuration:
|
|
51
|
-
readonly entries:
|
|
52
|
-
readonly id:
|
|
53
|
-
readonly variant:
|
|
54
|
-
readonly animation:
|
|
55
|
-
readonly id:
|
|
56
|
-
readonly isShowing:
|
|
57
|
-
readonly transitionState:
|
|
48
|
+
readonly Model: Schema.Struct<{
|
|
49
|
+
readonly id: Schema.String;
|
|
50
|
+
readonly defaultDuration: Schema.DurationFromMillis;
|
|
51
|
+
readonly entries: Schema.$Array<Schema.Struct<{
|
|
52
|
+
readonly id: Schema.String;
|
|
53
|
+
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
|
|
54
|
+
readonly animation: Schema.Struct<{
|
|
55
|
+
readonly id: Schema.String;
|
|
56
|
+
readonly isShowing: Schema.Boolean;
|
|
57
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
58
58
|
}>;
|
|
59
|
-
readonly maybeDuration:
|
|
60
|
-
readonly pendingDismissVersion:
|
|
61
|
-
readonly isHovered:
|
|
62
|
-
readonly payload:
|
|
59
|
+
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
|
|
60
|
+
readonly pendingDismissVersion: Schema.Number;
|
|
61
|
+
readonly isHovered: Schema.Boolean;
|
|
62
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
63
63
|
}>>;
|
|
64
|
-
readonly nextEntryKey:
|
|
64
|
+
readonly nextEntryKey: Schema.Number;
|
|
65
65
|
}>;
|
|
66
66
|
readonly Message: import("foldkit/message").MessageUnion<{
|
|
67
67
|
readonly Added: {
|
|
68
|
-
readonly entry:
|
|
69
|
-
readonly id:
|
|
70
|
-
readonly variant:
|
|
71
|
-
readonly animation:
|
|
72
|
-
readonly id:
|
|
73
|
-
readonly isShowing:
|
|
74
|
-
readonly transitionState:
|
|
68
|
+
readonly entry: Schema.Struct<{
|
|
69
|
+
readonly id: Schema.String;
|
|
70
|
+
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
|
|
71
|
+
readonly animation: Schema.Struct<{
|
|
72
|
+
readonly id: Schema.String;
|
|
73
|
+
readonly isShowing: Schema.Boolean;
|
|
74
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
75
75
|
}>;
|
|
76
|
-
readonly maybeDuration:
|
|
77
|
-
readonly pendingDismissVersion:
|
|
78
|
-
readonly isHovered:
|
|
79
|
-
readonly payload:
|
|
76
|
+
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
|
|
77
|
+
readonly pendingDismissVersion: Schema.Number;
|
|
78
|
+
readonly isHovered: Schema.Boolean;
|
|
79
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
80
80
|
}>;
|
|
81
81
|
};
|
|
82
82
|
readonly Dismissed: {
|
|
83
|
-
entryId:
|
|
83
|
+
entryId: Schema.String;
|
|
84
84
|
};
|
|
85
85
|
readonly DismissedAll: {};
|
|
86
86
|
readonly CompletedWaitBeforeDismissal: {
|
|
87
|
-
entryId:
|
|
88
|
-
version:
|
|
87
|
+
entryId: Schema.String;
|
|
88
|
+
version: Schema.Number;
|
|
89
89
|
};
|
|
90
90
|
readonly HoveredEntry: {
|
|
91
|
-
entryId:
|
|
91
|
+
entryId: Schema.String;
|
|
92
92
|
};
|
|
93
93
|
readonly LeftEntry: {
|
|
94
|
-
entryId:
|
|
94
|
+
entryId: Schema.String;
|
|
95
95
|
};
|
|
96
96
|
readonly GotAnimationMessage: {
|
|
97
|
-
entryId:
|
|
97
|
+
entryId: Schema.String;
|
|
98
98
|
message: import("foldkit/message").MessageUnion<{
|
|
99
99
|
readonly Showed: {};
|
|
100
100
|
readonly Hid: {};
|
|
@@ -105,26 +105,26 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Codec<A, I>) => {
|
|
|
105
105
|
}>;
|
|
106
106
|
readonly OutMessage: import("foldkit/message").MessageUnion<{
|
|
107
107
|
readonly DismissedToast: {
|
|
108
|
-
readonly payload:
|
|
108
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
109
109
|
};
|
|
110
110
|
}>;
|
|
111
111
|
readonly Added: import("foldkit/schema").CallableTaggedStruct<"Added", {
|
|
112
|
-
readonly entry:
|
|
113
|
-
readonly id:
|
|
114
|
-
readonly variant:
|
|
115
|
-
readonly animation:
|
|
116
|
-
readonly id:
|
|
117
|
-
readonly isShowing:
|
|
118
|
-
readonly transitionState:
|
|
112
|
+
readonly entry: Schema.Struct<{
|
|
113
|
+
readonly id: Schema.String;
|
|
114
|
+
readonly variant: Schema.Literals<readonly ["Info", "Success", "Warning", "Error"]>;
|
|
115
|
+
readonly animation: Schema.Struct<{
|
|
116
|
+
readonly id: Schema.String;
|
|
117
|
+
readonly isShowing: Schema.Boolean;
|
|
118
|
+
readonly transitionState: Schema.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
119
119
|
}>;
|
|
120
|
-
readonly maybeDuration:
|
|
121
|
-
readonly pendingDismissVersion:
|
|
122
|
-
readonly isHovered:
|
|
123
|
-
readonly payload:
|
|
120
|
+
readonly maybeDuration: Schema.Option<Schema.DurationFromMillis>;
|
|
121
|
+
readonly pendingDismissVersion: Schema.Number;
|
|
122
|
+
readonly isHovered: Schema.Boolean;
|
|
123
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
124
124
|
}>;
|
|
125
125
|
}>;
|
|
126
126
|
readonly DismissedToast: import("foldkit/schema").CallableTaggedStruct<"DismissedToast", {
|
|
127
|
-
readonly payload:
|
|
127
|
+
readonly payload: Schema.Codec<A, I, never, never>;
|
|
128
128
|
}>;
|
|
129
129
|
readonly init: (config: InitConfig) => {
|
|
130
130
|
readonly id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/toast/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,MAAM,EAGN,MAAM,EACN,MAAM,
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/toast/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,MAAM,EAGN,MAAM,EACN,MAAM,EAEP,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAaxC,OAAO,EAEL,KAAK,UAAU,EAEf,KAAK,OAAO,EAKb,MAAM,aAAa,CAAA;AAIpB;;oDAEoD;AACpD,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,QAAQ,CAAC;IAClC,OAAO,EAAE,CAAC,CAAA;IACV,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAA;IACzB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAEF;;;eAGe;AACf,eAAO,MAAM,mBAAmB;;;;;;;;iBAa9B,CAAA;AAIF;;;;;;4EAM4E;AAC5E,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,iBAAiB,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA8K3C,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuHG,SAAS,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAIP,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoB/C,CAAA"}
|
package/dist/toast/update.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Array, Duration, Effect, Match
|
|
2
|
+
import { Array, Duration, Effect, Match, Number, Option, Schema, pipe, } from 'effect';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import { evo } from 'foldkit/struct';
|
|
5
5
|
import * as Update from 'foldkit/update';
|
|
@@ -13,9 +13,9 @@ import { DEFAULT_DURATION, Message as StaticMessage, makeEntry, makeMessage, mak
|
|
|
13
13
|
* payload. */
|
|
14
14
|
export const WaitBeforeDismissal = Command.define('WaitBeforeDismissal', {
|
|
15
15
|
args: {
|
|
16
|
-
entryId:
|
|
17
|
-
version:
|
|
18
|
-
duration:
|
|
16
|
+
entryId: Schema.String,
|
|
17
|
+
version: Schema.Number,
|
|
18
|
+
duration: Schema.DurationFromMillis,
|
|
19
19
|
},
|
|
20
20
|
messages: [StaticMessage.CompletedWaitBeforeDismissal],
|
|
21
21
|
execute: ({ entryId, version, duration }) => __foldkitBrandViewResult((Effect.sleep(duration).pipe(Effect.as(StaticMessage.CompletedWaitBeforeDismissal({ entryId, version })))), "@foldkit/ui/toast/update.js#execute"),
|
|
@@ -62,7 +62,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
62
62
|
const readEntryAnimation = (entryId) => __foldkitBrandViewResult(((model) => __foldkitBrandViewResult((pipe(Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~4")), Option.map(({ animation }) => __foldkitBrandViewResult((animation), "@foldkit/ui/toast/update.js#anonymous~5")))), "@foldkit/ui/toast/update.js#anonymous~3")), "@foldkit/ui/toast/update.js#readEntryAnimation");
|
|
63
63
|
const writeEntryAnimation = (entryId) => __foldkitBrandViewResult(((model, nextAnimation) => __foldkitBrandViewResult((updateEntry(model, entryId, entry => __foldkitBrandViewResult((evo(entry, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/toast/update.js#animation") })), "@foldkit/ui/toast/update.js#anonymous~7"))), "@foldkit/ui/toast/update.js#anonymous~6")), "@foldkit/ui/toast/update.js#writeEntryAnimation");
|
|
64
64
|
const toGotAnimationMessage = (entryId) => __foldkitBrandViewResult(((message) => __foldkitBrandViewResult((MessageSchema.GotAnimationMessage({ entryId, message })), "@foldkit/ui/toast/update.js#anonymous~8")), "@foldkit/ui/toast/update.js#toGotAnimationMessage");
|
|
65
|
-
const toDismissedToastOutMessage = payload => __foldkitBrandViewResult((
|
|
65
|
+
const toDismissedToastOutMessage = payload => __foldkitBrandViewResult((Match.type().pipe(Match.withReturnType(), Match.tagsExhaustive({
|
|
66
66
|
StartedLeaveAnimating: () => __foldkitBrandViewResult((undefined), "@foldkit/ui/toast/update.js#StartedLeaveAnimating"),
|
|
67
67
|
TransitionedOut: () => __foldkitBrandViewResult((OutMessageSchema.DismissedToast({ payload })), "@foldkit/ui/toast/update.js#TransitionedOut"),
|
|
68
68
|
}))), "@foldkit/ui/toast/update.js#toDismissedToastOutMessage");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
/** Union of all messages the tooltip component can produce. */
|
|
3
3
|
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
4
4
|
readonly EnteredTrigger: {};
|
|
@@ -7,10 +7,10 @@ export declare const Message: import("foldkit/message").MessageUnion<{
|
|
|
7
7
|
readonly BlurredTrigger: {};
|
|
8
8
|
readonly PressedEscape: {};
|
|
9
9
|
readonly PressedPointerOnTrigger: {
|
|
10
|
-
pointerType:
|
|
10
|
+
pointerType: Schema.String;
|
|
11
11
|
};
|
|
12
12
|
readonly CompletedWaitBeforeShowing: {
|
|
13
|
-
version:
|
|
13
|
+
version: Schema.Number;
|
|
14
14
|
};
|
|
15
15
|
readonly CompletedAnchorTooltip: {};
|
|
16
16
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/tooltip/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/tooltip/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAK/B,+DAA+D;AAC/D,eAAO,MAAM,OAAO;;;;;;;QAMS,WAAW;;;QACR,OAAO;;;EAErC,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,CAAA;AAC/D,MAAM,MAAM,WAAW,GAAG,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAA;AACzD,MAAM,MAAM,cAAc,GAAG,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,CAAA;AAC/D,MAAM,MAAM,cAAc,GAAG,OAAO,OAAO,CAAC,cAAc,CAAC,IAAI,CAAA;AAC/D,MAAM,MAAM,aAAa,GAAG,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAA;AAC7D,MAAM,MAAM,uBAAuB,GACjC,OAAO,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAA;AAE7C,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,+DAA+D;AAC/D,eAAO,MAAM,UAAU;;;EAGrB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAA;AAChD,MAAM,MAAM,MAAM,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA;AAClD,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA"}
|
package/dist/tooltip/message.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from 'foldkit/message';
|
|
3
3
|
// MESSAGE
|
|
4
4
|
/** Union of all messages the tooltip component can produce. */
|
|
@@ -8,8 +8,8 @@ export const Message = defineMessageUnion({
|
|
|
8
8
|
FocusedTrigger: {},
|
|
9
9
|
BlurredTrigger: {},
|
|
10
10
|
PressedEscape: {},
|
|
11
|
-
PressedPointerOnTrigger: { pointerType:
|
|
12
|
-
CompletedWaitBeforeShowing: { version:
|
|
11
|
+
PressedPointerOnTrigger: { pointerType: Schema.String },
|
|
12
|
+
CompletedWaitBeforeShowing: { version: Schema.Number },
|
|
13
13
|
CompletedAnchorTooltip: {},
|
|
14
14
|
});
|
|
15
15
|
// OUT MESSAGE
|
|
@@ -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,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,YAAY,EAAe,MAAM,oBAAoB,CAAA;AAE9D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIlD,8pBAA8pB;AAC9pB,eAAO,MAAM,KAAK;;;;;;;;;EAShB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC;;;mCAGmC;AACnC,eAAO,MAAM,SAAS,OAAQ,MAAM,KAAG,MAAyB,CAAA;AAQhE,8DAA8D;AAC9D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAA;CAC3B,CAAC,CAAA;AAEF,0EAA0E;AAC1E,eAAO,MAAM,IAAI,WAAY,UAAU,KAAG,KAYxC,CAAA;AAIF;oCACoC;AACpC,eAAO,MAAM,iBAAiB;;;;;;iBAO5B,CAAA;AAEF,sEAAsE;AACtE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;EAiBxB,CAAA;AAkHF;;;uEAGuE;AACvE,eAAO,MAAM,MAAM,UACV,KAAK,WACH,OAAO,KACf,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAQxD,CAAA;AAED;;wDAEwD;AACxD,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAI3D,CAAA;AAID;;;;;;;;;yCASyC;AACzC,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACtC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF;;uEAEuE;AACvE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAVP,YAAY;YACZ,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;iBACvB,OAAO;gBACR,MAAM;qBACD,MAAM;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;
|
|
@@ -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":"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"}
|
|
@@ -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.0053b7691fcd",
|
|
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.0053b7691fcd"
|
|
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.0053b7691fcd",
|
|
138
|
+
"foldkit": "0.156.0-canary.0053b7691fcd"
|
|
139
139
|
},
|
|
140
140
|
"keywords": [
|
|
141
141
|
"foldkit",
|