foldkit 0.111.0 → 0.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/devTools/host.d.ts +6 -0
- package/dist/devTools/host.d.ts.map +1 -0
- package/dist/devTools/host.js +4 -0
- package/dist/dom/dom.d.ts +6 -1
- package/dist/dom/dom.d.ts.map +1 -1
- package/dist/dom/dom.js +24 -1
- package/dist/html/index.d.ts +4 -3
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +4 -3
- package/dist/html/submodel.d.ts +2 -2
- package/dist/html/submodel.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/runtime/public.d.ts +1 -1
- package/dist/runtime/public.d.ts.map +1 -1
- package/dist/runtime/runtime.d.ts +14 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +7 -4
- package/dist/runtime/subscription.d.ts +1 -1
- package/dist/subscription/public.d.ts +1 -1
- package/dist/subscription/public.d.ts.map +1 -1
- package/package.json +12 -93
- package/dist/devTools/overlay-styles.d.ts +0 -3
- package/dist/devTools/overlay-styles.d.ts.map +0 -1
- package/dist/devTools/overlay-styles.js +0 -706
- package/dist/devTools/overlay.d.ts +0 -63
- package/dist/devTools/overlay.d.ts.map +0 -1
- package/dist/devTools/overlay.js +0 -1244
- package/dist/test/apps/disabledButton.d.ts +0 -38
- package/dist/test/apps/disabledButton.d.ts.map +0 -1
- package/dist/test/apps/disabledButton.js +0 -71
- package/dist/ui/anchor.d.ts +0 -38
- package/dist/ui/anchor.d.ts.map +0 -1
- package/dist/ui/anchor.js +0 -142
- package/dist/ui/animation/index.d.ts +0 -49
- package/dist/ui/animation/index.d.ts.map +0 -1
- package/dist/ui/animation/index.js +0 -74
- package/dist/ui/animation/public.d.ts +0 -3
- package/dist/ui/animation/public.d.ts.map +0 -1
- package/dist/ui/animation/public.js +0 -1
- package/dist/ui/animation/schema.d.ts +0 -43
- package/dist/ui/animation/schema.d.ts.map +0 -1
- package/dist/ui/animation/schema.js +0 -41
- package/dist/ui/animation/update.d.ts +0 -24
- package/dist/ui/animation/update.d.ts.map +0 -1
- package/dist/ui/animation/update.js +0 -67
- package/dist/ui/button/index.d.ts +0 -17
- package/dist/ui/button/index.d.ts.map +0 -1
- package/dist/ui/button/index.js +0 -22
- package/dist/ui/button/public.d.ts +0 -3
- package/dist/ui/button/public.d.ts.map +0 -1
- package/dist/ui/button/public.js +0 -1
- package/dist/ui/calendar/index.d.ts +0 -462
- package/dist/ui/calendar/index.d.ts.map +0 -1
- package/dist/ui/calendar/index.js +0 -824
- package/dist/ui/calendar/public.d.ts +0 -3
- package/dist/ui/calendar/public.d.ts.map +0 -1
- package/dist/ui/calendar/public.js +0 -1
- package/dist/ui/checkbox/index.d.ts +0 -119
- package/dist/ui/checkbox/index.d.ts.map +0 -1
- package/dist/ui/checkbox/index.js +0 -110
- package/dist/ui/checkbox/public.d.ts +0 -3
- package/dist/ui/checkbox/public.d.ts.map +0 -1
- package/dist/ui/checkbox/public.js +0 -1
- package/dist/ui/combobox/multi.d.ts +0 -184
- package/dist/ui/combobox/multi.d.ts.map +0 -1
- package/dist/ui/combobox/multi.js +0 -81
- package/dist/ui/combobox/multiPublic.d.ts +0 -3
- package/dist/ui/combobox/multiPublic.d.ts.map +0 -1
- package/dist/ui/combobox/multiPublic.js +0 -1
- package/dist/ui/combobox/public.d.ts +0 -7
- package/dist/ui/combobox/public.d.ts.map +0 -1
- package/dist/ui/combobox/public.js +0 -3
- package/dist/ui/combobox/shared.d.ts +0 -422
- package/dist/ui/combobox/shared.d.ts.map +0 -1
- package/dist/ui/combobox/shared.js +0 -707
- package/dist/ui/combobox/single.d.ts +0 -199
- package/dist/ui/combobox/single.d.ts.map +0 -1
- package/dist/ui/combobox/single.js +0 -106
- package/dist/ui/datePicker/index.d.ts +0 -457
- package/dist/ui/datePicker/index.d.ts.map +0 -1
- package/dist/ui/datePicker/index.js +0 -317
- package/dist/ui/datePicker/public.d.ts +0 -3
- package/dist/ui/datePicker/public.d.ts.map +0 -1
- package/dist/ui/datePicker/public.js +0 -1
- package/dist/ui/dialog/index.d.ts +0 -155
- package/dist/ui/dialog/index.d.ts.map +0 -1
- package/dist/ui/dialog/index.js +0 -208
- package/dist/ui/dialog/public.d.ts +0 -3
- package/dist/ui/dialog/public.d.ts.map +0 -1
- package/dist/ui/dialog/public.js +0 -1
- package/dist/ui/disclosure/index.d.ts +0 -110
- package/dist/ui/disclosure/index.d.ts.map +0 -1
- package/dist/ui/disclosure/index.js +0 -110
- package/dist/ui/disclosure/public.d.ts +0 -3
- package/dist/ui/disclosure/public.d.ts.map +0 -1
- package/dist/ui/disclosure/public.js +0 -1
- package/dist/ui/dragAndDrop/index.d.ts +0 -540
- package/dist/ui/dragAndDrop/index.d.ts.map +0 -1
- package/dist/ui/dragAndDrop/index.js +0 -535
- package/dist/ui/dragAndDrop/public.d.ts +0 -3
- package/dist/ui/dragAndDrop/public.d.ts.map +0 -1
- package/dist/ui/dragAndDrop/public.js +0 -1
- package/dist/ui/fieldset/index.d.ts +0 -21
- package/dist/ui/fieldset/index.d.ts.map +0 -1
- package/dist/ui/fieldset/index.js +0 -25
- package/dist/ui/fieldset/public.d.ts +0 -3
- package/dist/ui/fieldset/public.d.ts.map +0 -1
- package/dist/ui/fieldset/public.js +0 -1
- package/dist/ui/fileDrop/index.d.ts +0 -109
- package/dist/ui/fileDrop/index.d.ts.map +0 -1
- package/dist/ui/fileDrop/index.js +0 -126
- package/dist/ui/fileDrop/public.d.ts +0 -3
- package/dist/ui/fileDrop/public.d.ts.map +0 -1
- package/dist/ui/fileDrop/public.js +0 -1
- package/dist/ui/group.d.ts +0 -8
- package/dist/ui/group.d.ts.map +0 -1
- package/dist/ui/group.js +0 -13
- package/dist/ui/index.d.ts +0 -25
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -24
- package/dist/ui/input/index.d.ts +0 -26
- package/dist/ui/input/index.d.ts.map +0 -1
- package/dist/ui/input/index.js +0 -43
- package/dist/ui/input/public.d.ts +0 -3
- package/dist/ui/input/public.d.ts.map +0 -1
- package/dist/ui/input/public.js +0 -1
- package/dist/ui/keyboard.d.ts +0 -6
- package/dist/ui/keyboard.d.ts.map +0 -1
- package/dist/ui/keyboard.js +0 -9
- package/dist/ui/listbox/multi.d.ts +0 -190
- package/dist/ui/listbox/multi.d.ts.map +0 -1
- package/dist/ui/listbox/multi.js +0 -65
- package/dist/ui/listbox/multiPublic.d.ts +0 -3
- package/dist/ui/listbox/multiPublic.d.ts.map +0 -1
- package/dist/ui/listbox/multiPublic.js +0 -1
- package/dist/ui/listbox/public.d.ts +0 -7
- package/dist/ui/listbox/public.d.ts.map +0 -1
- package/dist/ui/listbox/public.js +0 -3
- package/dist/ui/listbox/shared.d.ts +0 -431
- package/dist/ui/listbox/shared.d.ts.map +0 -1
- package/dist/ui/listbox/shared.js +0 -669
- package/dist/ui/listbox/single.d.ts +0 -208
- package/dist/ui/listbox/single.d.ts.map +0 -1
- package/dist/ui/listbox/single.js +0 -73
- package/dist/ui/menu/index.d.ts +0 -367
- package/dist/ui/menu/index.d.ts.map +0 -1
- package/dist/ui/menu/index.js +0 -681
- package/dist/ui/menu/public.d.ts +0 -4
- package/dist/ui/menu/public.d.ts.map +0 -1
- package/dist/ui/menu/public.js +0 -1
- package/dist/ui/popover/index.d.ts +0 -267
- package/dist/ui/popover/index.d.ts.map +0 -1
- package/dist/ui/popover/index.js +0 -345
- package/dist/ui/popover/public.d.ts +0 -4
- package/dist/ui/popover/public.d.ts.map +0 -1
- package/dist/ui/popover/public.js +0 -1
- package/dist/ui/radioGroup/index.d.ts +0 -169
- package/dist/ui/radioGroup/index.d.ts.map +0 -1
- package/dist/ui/radioGroup/index.js +0 -196
- package/dist/ui/radioGroup/public.d.ts +0 -3
- package/dist/ui/radioGroup/public.d.ts.map +0 -1
- package/dist/ui/radioGroup/public.js +0 -1
- package/dist/ui/select/index.d.ts +0 -24
- package/dist/ui/select/index.d.ts.map +0 -1
- package/dist/ui/select/index.js +0 -40
- package/dist/ui/select/public.d.ts +0 -3
- package/dist/ui/select/public.d.ts.map +0 -1
- package/dist/ui/select/public.js +0 -1
- package/dist/ui/slider/index.d.ts +0 -318
- package/dist/ui/slider/index.d.ts.map +0 -1
- package/dist/ui/slider/index.js +0 -336
- package/dist/ui/slider/public.d.ts +0 -3
- package/dist/ui/slider/public.d.ts.map +0 -1
- package/dist/ui/slider/public.js +0 -1
- package/dist/ui/switch/index.d.ts +0 -99
- package/dist/ui/switch/index.d.ts.map +0 -1
- package/dist/ui/switch/index.js +0 -106
- package/dist/ui/switch/public.d.ts +0 -3
- package/dist/ui/switch/public.d.ts.map +0 -1
- package/dist/ui/switch/public.js +0 -1
- package/dist/ui/tabs/index.d.ts +0 -155
- package/dist/ui/tabs/index.d.ts.map +0 -1
- package/dist/ui/tabs/index.js +0 -184
- package/dist/ui/tabs/public.d.ts +0 -3
- package/dist/ui/tabs/public.d.ts.map +0 -1
- package/dist/ui/tabs/public.js +0 -1
- package/dist/ui/textarea/index.d.ts +0 -26
- package/dist/ui/textarea/index.d.ts.map +0 -1
- package/dist/ui/textarea/index.js +0 -44
- package/dist/ui/textarea/public.d.ts +0 -3
- package/dist/ui/textarea/public.d.ts.map +0 -1
- package/dist/ui/textarea/public.js +0 -1
- package/dist/ui/toast/index.d.ts +0 -608
- package/dist/ui/toast/index.d.ts.map +0 -1
- package/dist/ui/toast/index.js +0 -145
- package/dist/ui/toast/public.d.ts +0 -4
- package/dist/ui/toast/public.d.ts.map +0 -1
- package/dist/ui/toast/public.js +0 -1
- package/dist/ui/toast/schema.d.ts +0 -154
- package/dist/ui/toast/schema.d.ts.map +0 -1
- package/dist/ui/toast/schema.js +0 -93
- package/dist/ui/toast/update.d.ts +0 -510
- package/dist/ui/toast/update.d.ts.map +0 -1
- package/dist/ui/toast/update.js +0 -225
- package/dist/ui/tooltip/index.d.ts +0 -170
- package/dist/ui/tooltip/index.d.ts.map +0 -1
- package/dist/ui/tooltip/index.js +0 -252
- package/dist/ui/tooltip/public.d.ts +0 -4
- package/dist/ui/tooltip/public.d.ts.map +0 -1
- package/dist/ui/tooltip/public.js +0 -1
- package/dist/ui/typeahead.d.ts +0 -4
- package/dist/ui/typeahead.d.ts.map +0 -1
- package/dist/ui/typeahead.js +0 -14
- package/dist/ui/virtualList/index.d.ts +0 -202
- package/dist/ui/virtualList/index.d.ts.map +0 -1
- package/dist/ui/virtualList/index.js +0 -391
- package/dist/ui/virtualList/public.d.ts +0 -3
- package/dist/ui/virtualList/public.d.ts.map +0 -1
- package/dist/ui/virtualList/public.js +0 -1
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { Option, Schema as S } from 'effect';
|
|
2
|
-
import * as Command from '../../command/index.js';
|
|
3
|
-
import { type ChildAttribute, type Html } from '../../html/index.js';
|
|
4
|
-
/** Schema for the file-drop component's state.
|
|
5
|
-
*
|
|
6
|
-
* `isDragOver` controls the `data-drag-over` attribute on the root while a
|
|
7
|
-
* drag is hovering. The html layer's `OnDragEnter`/`OnDragLeave` handlers
|
|
8
|
-
* track the per-element active state internally so transitions between
|
|
9
|
-
* children of the zone do not flicker the boolean off-and-on. */
|
|
10
|
-
export declare const Model: S.Struct<{
|
|
11
|
-
readonly id: S.String;
|
|
12
|
-
readonly isDragOver: S.Boolean;
|
|
13
|
-
}>;
|
|
14
|
-
export type Model = typeof Model.Type;
|
|
15
|
-
/** Sent when a drag enters the drop zone. Flips `isDragOver` to true so
|
|
16
|
-
* the consumer's styling can highlight the zone. */
|
|
17
|
-
export declare const EnteredDragZone: import("../../schema/index.js").CallableTaggedStruct<"EnteredDragZone", {}>;
|
|
18
|
-
/** Sent when a drag leaves the drop zone without dropping. Flips
|
|
19
|
-
* `isDragOver` back to false. */
|
|
20
|
-
export declare const LeftDragZone: import("../../schema/index.js").CallableTaggedStruct<"LeftDragZone", {}>;
|
|
21
|
-
/** Sent when the user drops files on the zone or selects them via the
|
|
22
|
-
* hidden `<input type="file">`. Carries a non-empty list of `File`
|
|
23
|
-
* objects, resets `isDragOver`, and emits `ReceivedFiles` as an
|
|
24
|
-
* OutMessage. */
|
|
25
|
-
export declare const DroppedFiles: import("../../schema/index.js").CallableTaggedStruct<"DroppedFiles", {
|
|
26
|
-
files: S.NonEmptyArray<S.Schema<File>>;
|
|
27
|
-
}>;
|
|
28
|
-
/** Sent when a drop or input-change event fires without any files,
|
|
29
|
-
* typically a drag of non-file data (text, URLs, images from another
|
|
30
|
-
* page). Resets `isDragOver` and emits `RejectedNonFiles` as an
|
|
31
|
-
* OutMessage so the consumer can surface a message (e.g. "Only files are
|
|
32
|
-
* accepted"). */
|
|
33
|
-
export declare const DroppedNonFiles: import("../../schema/index.js").CallableTaggedStruct<"DroppedNonFiles", {}>;
|
|
34
|
-
/** Union of all messages the file-drop component can produce. */
|
|
35
|
-
export declare const Message: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"EnteredDragZone", {}>, import("../../schema/index.js").CallableTaggedStruct<"LeftDragZone", {}>, import("../../schema/index.js").CallableTaggedStruct<"DroppedFiles", {
|
|
36
|
-
files: S.NonEmptyArray<S.Schema<File>>;
|
|
37
|
-
}>, import("../../schema/index.js").CallableTaggedStruct<"DroppedNonFiles", {}>]>;
|
|
38
|
-
export type Message = typeof Message.Type;
|
|
39
|
-
/** Emitted when files arrive via drop or input-change. The consumer's
|
|
40
|
-
* parent update handles this to process the files (validate, upload,
|
|
41
|
-
* store in Model, etc.). The files list is non-empty. */
|
|
42
|
-
export declare const ReceivedFiles: import("../../schema/index.js").CallableTaggedStruct<"ReceivedFiles", {
|
|
43
|
-
files: S.NonEmptyArray<S.Schema<File>>;
|
|
44
|
-
}>;
|
|
45
|
-
/** Emitted when a drop or input-change event produces no files. The
|
|
46
|
-
* consumer's parent update handles this to surface a message (e.g. "Only
|
|
47
|
-
* files are accepted"). */
|
|
48
|
-
export declare const RejectedNonFiles: import("../../schema/index.js").CallableTaggedStruct<"RejectedNonFiles", {}>;
|
|
49
|
-
/** The file-drop component's OutMessages: `ReceivedFiles` on the happy
|
|
50
|
-
* path and `RejectedNonFiles` when a drop event fires without files. */
|
|
51
|
-
export declare const OutMessage: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"ReceivedFiles", {
|
|
52
|
-
files: S.NonEmptyArray<S.Schema<File>>;
|
|
53
|
-
}>, import("../../schema/index.js").CallableTaggedStruct<"RejectedNonFiles", {}>]>;
|
|
54
|
-
export type OutMessage = typeof OutMessage.Type;
|
|
55
|
-
/** Configuration for creating a file-drop model with `init`. */
|
|
56
|
-
export type InitConfig = Readonly<{
|
|
57
|
-
id: string;
|
|
58
|
-
}>;
|
|
59
|
-
/** Creates an initial file-drop model. Drag state starts cleared. */
|
|
60
|
-
export declare const init: (config: InitConfig) => Model;
|
|
61
|
-
type UpdateReturn = readonly [
|
|
62
|
-
Model,
|
|
63
|
-
ReadonlyArray<Command.Command<Message>>,
|
|
64
|
-
Option.Option<OutMessage>
|
|
65
|
-
];
|
|
66
|
-
/** Processes a file-drop message and returns the next model, commands,
|
|
67
|
-
* and optional OutMessage. */
|
|
68
|
-
export declare const update: (model: Model, message: Message) => UpdateReturn;
|
|
69
|
-
/** Attribute groups the file-drop component provides to the consumer's
|
|
70
|
-
* `toView` callback. */
|
|
71
|
-
export type FileDropAttributes = Readonly<{
|
|
72
|
-
/** Attributes for the outer drop zone element (typically a `<label>`):
|
|
73
|
-
* drag-and-drop handlers, `data-drag-over` while a drag hovers, and
|
|
74
|
-
* `data-disabled` when disabled. */
|
|
75
|
-
root: ReadonlyArray<ChildAttribute>;
|
|
76
|
-
/** Attributes for a hidden `<input type="file">` nested inside the
|
|
77
|
-
* root: file-change handler, `type`, `id`, `multiple`, `accept`, and
|
|
78
|
-
* `sr-only` class. */
|
|
79
|
-
input: ReadonlyArray<ChildAttribute>;
|
|
80
|
-
}>;
|
|
81
|
-
/** Per-render view inputs passed to `view` via `h.submodel`'s `viewInputs` field. */
|
|
82
|
-
export type ViewInputs = Readonly<{
|
|
83
|
-
toView: (attributes: FileDropAttributes) => Html;
|
|
84
|
-
accept?: ReadonlyArray<string>;
|
|
85
|
-
multiple?: boolean;
|
|
86
|
-
isDisabled?: boolean;
|
|
87
|
-
}>;
|
|
88
|
-
/** Renders an accessible file-drop zone by publishing attribute groups
|
|
89
|
-
* for a `<label>`-wrapped hidden file input. */
|
|
90
|
-
export declare const view: import("../../html/submodel.js").SubmodelView<{
|
|
91
|
-
readonly id: string;
|
|
92
|
-
readonly isDragOver: boolean;
|
|
93
|
-
}, {
|
|
94
|
-
readonly _tag: "EnteredDragZone";
|
|
95
|
-
} | {
|
|
96
|
-
readonly _tag: "LeftDragZone";
|
|
97
|
-
} | {
|
|
98
|
-
readonly _tag: "DroppedFiles";
|
|
99
|
-
readonly files: readonly [File, ...File[]];
|
|
100
|
-
} | {
|
|
101
|
-
readonly _tag: "DroppedNonFiles";
|
|
102
|
-
}, Readonly<{
|
|
103
|
-
toView: (attributes: FileDropAttributes) => Html;
|
|
104
|
-
accept?: ReadonlyArray<string>;
|
|
105
|
-
multiple?: boolean;
|
|
106
|
-
isDisabled?: boolean;
|
|
107
|
-
}>>;
|
|
108
|
-
export {};
|
|
109
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/fileDrop/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE/D,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,IAAI,EAIV,MAAM,qBAAqB,CAAA;AAM5B;;;;;iEAKiE;AACjE,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC;oDACoD;AACpD,eAAO,MAAM,eAAe,6EAAuB,CAAA;AACnD;iCACiC;AACjC,eAAO,MAAM,YAAY,0EAAoB,CAAA;AAC7C;;;iBAGiB;AACjB,eAAO,MAAM,YAAY;;EAEvB,CAAA;AACF;;;;iBAIiB;AACjB,eAAO,MAAM,eAAe,6EAAuB,CAAA;AAEnD,iEAAiE;AACjE,eAAO,MAAM,OAAO;;iFAKlB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC;;yDAEyD;AACzD,eAAO,MAAM,aAAa;;EAExB,CAAA;AAEF;;2BAE2B;AAC3B,eAAO,MAAM,gBAAgB,8EAAwB,CAAA;AAErD;wEACwE;AACxE,eAAO,MAAM,UAAU;;kFAA6C,CAAA;AACpE,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA;AAI/C,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,EAAE,EAAE,MAAM,CAAA;CACX,CAAC,CAAA;AAEF,qEAAqE;AACrE,eAAO,MAAM,IAAI,GAAI,QAAQ,UAAU,KAAG,KAGxC,CAAA;AAIF,KAAK,YAAY,GAAG,SAAS;IAC3B,KAAK;IACL,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;CAC1B,CAAA;AAED;8BAC8B;AAC9B,eAAO,MAAM,MAAM,GAAI,OAAO,KAAK,EAAE,SAAS,OAAO,KAAG,YAyBrD,CAAA;AAIH;yBACyB;AACzB,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC;;yCAEqC;IACrC,IAAI,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACnC;;2BAEuB;IACvB,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;CACrC,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,CAAC,UAAU,EAAE,kBAAkB,KAAK,IAAI,CAAA;IAChD,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAC,CAAA;AAQF;iDACiD;AACjD,eAAO,MAAM,IAAI;;;;;;;;;;;;;YAdP,CAAC,UAAU,EAAE,kBAAkB,KAAK,IAAI;aACvC,aAAa,CAAC,MAAM,CAAC;eACnB,OAAO;iBACL,OAAO;GAmDrB,CAAA"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { Array, Match as M, Option, Schema as S } from 'effect';
|
|
2
|
-
import * as File from '../../file/index.js';
|
|
3
|
-
import { childAttributes, defineView, html, } from '../../html/index.js';
|
|
4
|
-
import { m } from '../../message/index.js';
|
|
5
|
-
import { evo } from '../../struct/index.js';
|
|
6
|
-
// MODEL
|
|
7
|
-
/** Schema for the file-drop component's state.
|
|
8
|
-
*
|
|
9
|
-
* `isDragOver` controls the `data-drag-over` attribute on the root while a
|
|
10
|
-
* drag is hovering. The html layer's `OnDragEnter`/`OnDragLeave` handlers
|
|
11
|
-
* track the per-element active state internally so transitions between
|
|
12
|
-
* children of the zone do not flicker the boolean off-and-on. */
|
|
13
|
-
export const Model = S.Struct({
|
|
14
|
-
id: S.String,
|
|
15
|
-
isDragOver: S.Boolean,
|
|
16
|
-
});
|
|
17
|
-
// MESSAGE
|
|
18
|
-
/** Sent when a drag enters the drop zone. Flips `isDragOver` to true so
|
|
19
|
-
* the consumer's styling can highlight the zone. */
|
|
20
|
-
export const EnteredDragZone = m('EnteredDragZone');
|
|
21
|
-
/** Sent when a drag leaves the drop zone without dropping. Flips
|
|
22
|
-
* `isDragOver` back to false. */
|
|
23
|
-
export const LeftDragZone = m('LeftDragZone');
|
|
24
|
-
/** Sent when the user drops files on the zone or selects them via the
|
|
25
|
-
* hidden `<input type="file">`. Carries a non-empty list of `File`
|
|
26
|
-
* objects, resets `isDragOver`, and emits `ReceivedFiles` as an
|
|
27
|
-
* OutMessage. */
|
|
28
|
-
export const DroppedFiles = m('DroppedFiles', {
|
|
29
|
-
files: S.NonEmptyArray(File.File),
|
|
30
|
-
});
|
|
31
|
-
/** Sent when a drop or input-change event fires without any files,
|
|
32
|
-
* typically a drag of non-file data (text, URLs, images from another
|
|
33
|
-
* page). Resets `isDragOver` and emits `RejectedNonFiles` as an
|
|
34
|
-
* OutMessage so the consumer can surface a message (e.g. "Only files are
|
|
35
|
-
* accepted"). */
|
|
36
|
-
export const DroppedNonFiles = m('DroppedNonFiles');
|
|
37
|
-
/** Union of all messages the file-drop component can produce. */
|
|
38
|
-
export const Message = S.Union([
|
|
39
|
-
EnteredDragZone,
|
|
40
|
-
LeftDragZone,
|
|
41
|
-
DroppedFiles,
|
|
42
|
-
DroppedNonFiles,
|
|
43
|
-
]);
|
|
44
|
-
// OUT MESSAGE
|
|
45
|
-
/** Emitted when files arrive via drop or input-change. The consumer's
|
|
46
|
-
* parent update handles this to process the files (validate, upload,
|
|
47
|
-
* store in Model, etc.). The files list is non-empty. */
|
|
48
|
-
export const ReceivedFiles = m('ReceivedFiles', {
|
|
49
|
-
files: S.NonEmptyArray(File.File),
|
|
50
|
-
});
|
|
51
|
-
/** Emitted when a drop or input-change event produces no files. The
|
|
52
|
-
* consumer's parent update handles this to surface a message (e.g. "Only
|
|
53
|
-
* files are accepted"). */
|
|
54
|
-
export const RejectedNonFiles = m('RejectedNonFiles');
|
|
55
|
-
/** The file-drop component's OutMessages: `ReceivedFiles` on the happy
|
|
56
|
-
* path and `RejectedNonFiles` when a drop event fires without files. */
|
|
57
|
-
export const OutMessage = S.Union([ReceivedFiles, RejectedNonFiles]);
|
|
58
|
-
/** Creates an initial file-drop model. Drag state starts cleared. */
|
|
59
|
-
export const init = (config) => ({
|
|
60
|
-
id: config.id,
|
|
61
|
-
isDragOver: false,
|
|
62
|
-
});
|
|
63
|
-
/** Processes a file-drop message and returns the next model, commands,
|
|
64
|
-
* and optional OutMessage. */
|
|
65
|
-
export const update = (model, message) => M.value(message).pipe(M.withReturnType(), M.tagsExhaustive({
|
|
66
|
-
EnteredDragZone: () => [
|
|
67
|
-
evo(model, { isDragOver: () => true }),
|
|
68
|
-
[],
|
|
69
|
-
Option.none(),
|
|
70
|
-
],
|
|
71
|
-
LeftDragZone: () => [
|
|
72
|
-
evo(model, { isDragOver: () => false }),
|
|
73
|
-
[],
|
|
74
|
-
Option.none(),
|
|
75
|
-
],
|
|
76
|
-
DroppedFiles: ({ files }) => [
|
|
77
|
-
evo(model, { isDragOver: () => false }),
|
|
78
|
-
[],
|
|
79
|
-
Option.some(ReceivedFiles({ files })),
|
|
80
|
-
],
|
|
81
|
-
DroppedNonFiles: () => [
|
|
82
|
-
evo(model, { isDragOver: () => false }),
|
|
83
|
-
[],
|
|
84
|
-
Option.some(RejectedNonFiles()),
|
|
85
|
-
],
|
|
86
|
-
}));
|
|
87
|
-
const dispatchDroppedFiles = (files) => Array.match(files, {
|
|
88
|
-
onEmpty: () => DroppedNonFiles(),
|
|
89
|
-
onNonEmpty: nonEmptyFiles => DroppedFiles({ files: [...nonEmptyFiles] }),
|
|
90
|
-
});
|
|
91
|
-
/** Renders an accessible file-drop zone by publishing attribute groups
|
|
92
|
-
* for a `<label>`-wrapped hidden file input. */
|
|
93
|
-
export const view = defineView((model, viewInputs) => {
|
|
94
|
-
const h = html();
|
|
95
|
-
const { id, isDragOver } = model;
|
|
96
|
-
const { toView, accept, multiple = false, isDisabled = false } = viewInputs;
|
|
97
|
-
const stateAttributes = [
|
|
98
|
-
...(isDragOver ? [h.DataAttribute('drag-over', '')] : []),
|
|
99
|
-
...(isDisabled ? [h.DataAttribute('disabled', '')] : []),
|
|
100
|
-
];
|
|
101
|
-
const rootAttributes = isDisabled
|
|
102
|
-
? stateAttributes
|
|
103
|
-
: [
|
|
104
|
-
...stateAttributes,
|
|
105
|
-
h.OnDragEnter(EnteredDragZone()),
|
|
106
|
-
h.OnDragLeave(LeftDragZone()),
|
|
107
|
-
h.AllowDrop(),
|
|
108
|
-
h.OnDropFiles(dispatchDroppedFiles),
|
|
109
|
-
];
|
|
110
|
-
const inputAttributes = [
|
|
111
|
-
h.Id(id),
|
|
112
|
-
h.Type('file'),
|
|
113
|
-
h.Class('sr-only'),
|
|
114
|
-
...(multiple ? [h.Multiple(true)] : []),
|
|
115
|
-
...(accept !== undefined && accept.length > 0
|
|
116
|
-
? [h.Accept(accept.join(','))]
|
|
117
|
-
: []),
|
|
118
|
-
...(isDisabled
|
|
119
|
-
? [h.Disabled(true)]
|
|
120
|
-
: [h.OnFileChange(dispatchDroppedFiles)]),
|
|
121
|
-
];
|
|
122
|
-
return toView({
|
|
123
|
-
root: childAttributes(rootAttributes),
|
|
124
|
-
input: childAttributes(inputAttributes),
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { init, update, view, Model, Message, OutMessage, ReceivedFiles, EnteredDragZone, LeftDragZone, DroppedFiles, DroppedNonFiles, RejectedNonFiles, } from './index.js';
|
|
2
|
-
export type { InitConfig, ViewInputs, FileDropAttributes } from './index.js';
|
|
3
|
-
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/fileDrop/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,OAAO,EACP,UAAU,EACV,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,GACjB,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { init, update, view, Model, Message, OutMessage, ReceivedFiles, EnteredDragZone, LeftDragZone, DroppedFiles, DroppedNonFiles, RejectedNonFiles, } from './index.js';
|
package/dist/ui/group.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** A contiguous segment of items sharing the same group key. */
|
|
2
|
-
export type Segment<A> = Readonly<{
|
|
3
|
-
key: string;
|
|
4
|
-
items: ReadonlyArray<A>;
|
|
5
|
-
}>;
|
|
6
|
-
/** Groups items into contiguous segments by a key function. Adjacent items with the same key are collected into a single segment. */
|
|
7
|
-
export declare const groupContiguous: <A>(items: ReadonlyArray<A>, toKey: (item: A, index: number) => string) => ReadonlyArray<Segment<A>>;
|
|
8
|
-
//# sourceMappingURL=group.d.ts.map
|
package/dist/ui/group.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/ui/group.ts"],"names":[],"mappings":"AAEA,gEAAgE;AAChE,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,QAAQ,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAAA;AAE3E,qIAAqI;AACrI,eAAO,MAAM,eAAe,GAAI,CAAC,EAC/B,OAAO,aAAa,CAAC,CAAC,CAAC,EACvB,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,KACxC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAW1B,CAAA"}
|
package/dist/ui/group.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Array } from 'effect';
|
|
2
|
-
/** Groups items into contiguous segments by a key function. Adjacent items with the same key are collected into a single segment. */
|
|
3
|
-
export const groupContiguous = (items, toKey) => {
|
|
4
|
-
const tagged = Array.map(items, (item, index) => ({
|
|
5
|
-
key: toKey(item, index),
|
|
6
|
-
item,
|
|
7
|
-
}));
|
|
8
|
-
return Array.chop(tagged, nonEmpty => {
|
|
9
|
-
const key = Array.headNonEmpty(nonEmpty).key;
|
|
10
|
-
const [matching, rest] = Array.span(nonEmpty, tagged => tagged.key === key);
|
|
11
|
-
return [{ key, items: Array.map(matching, ({ item }) => item) }, rest];
|
|
12
|
-
});
|
|
13
|
-
};
|
package/dist/ui/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export * as Animation from './animation/public.js';
|
|
2
|
-
export * as Button from './button/public.js';
|
|
3
|
-
export * as Calendar from './calendar/public.js';
|
|
4
|
-
export * as DatePicker from './datePicker/public.js';
|
|
5
|
-
export * as Checkbox from './checkbox/public.js';
|
|
6
|
-
export * as Combobox from './combobox/public.js';
|
|
7
|
-
export * as Dialog from './dialog/public.js';
|
|
8
|
-
export * as DragAndDrop from './dragAndDrop/public.js';
|
|
9
|
-
export * as Disclosure from './disclosure/public.js';
|
|
10
|
-
export * as Fieldset from './fieldset/public.js';
|
|
11
|
-
export * as FileDrop from './fileDrop/public.js';
|
|
12
|
-
export * as Input from './input/public.js';
|
|
13
|
-
export * as Listbox from './listbox/public.js';
|
|
14
|
-
export * as Menu from './menu/public.js';
|
|
15
|
-
export * as Popover from './popover/public.js';
|
|
16
|
-
export * as RadioGroup from './radioGroup/public.js';
|
|
17
|
-
export * as Select from './select/public.js';
|
|
18
|
-
export * as Slider from './slider/public.js';
|
|
19
|
-
export * as Switch from './switch/public.js';
|
|
20
|
-
export * as Textarea from './textarea/public.js';
|
|
21
|
-
export * as Tabs from './tabs/public.js';
|
|
22
|
-
export * as Toast from './toast/public.js';
|
|
23
|
-
export * as Tooltip from './tooltip/public.js';
|
|
24
|
-
export * as VirtualList from './virtualList/public.js';
|
|
25
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/ui/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAA;AACtD,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAC1C,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAA;AAC1C,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAA"}
|
package/dist/ui/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export * as Animation from './animation/public.js';
|
|
2
|
-
export * as Button from './button/public.js';
|
|
3
|
-
export * as Calendar from './calendar/public.js';
|
|
4
|
-
export * as DatePicker from './datePicker/public.js';
|
|
5
|
-
export * as Checkbox from './checkbox/public.js';
|
|
6
|
-
export * as Combobox from './combobox/public.js';
|
|
7
|
-
export * as Dialog from './dialog/public.js';
|
|
8
|
-
export * as DragAndDrop from './dragAndDrop/public.js';
|
|
9
|
-
export * as Disclosure from './disclosure/public.js';
|
|
10
|
-
export * as Fieldset from './fieldset/public.js';
|
|
11
|
-
export * as FileDrop from './fileDrop/public.js';
|
|
12
|
-
export * as Input from './input/public.js';
|
|
13
|
-
export * as Listbox from './listbox/public.js';
|
|
14
|
-
export * as Menu from './menu/public.js';
|
|
15
|
-
export * as Popover from './popover/public.js';
|
|
16
|
-
export * as RadioGroup from './radioGroup/public.js';
|
|
17
|
-
export * as Select from './select/public.js';
|
|
18
|
-
export * as Slider from './slider/public.js';
|
|
19
|
-
export * as Switch from './switch/public.js';
|
|
20
|
-
export * as Textarea from './textarea/public.js';
|
|
21
|
-
export * as Tabs from './tabs/public.js';
|
|
22
|
-
export * as Toast from './toast/public.js';
|
|
23
|
-
export * as Tooltip from './tooltip/public.js';
|
|
24
|
-
export * as VirtualList from './virtualList/public.js';
|
package/dist/ui/input/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Attribute } from '../../html/index.js';
|
|
2
|
-
import type { Html } from '../../html/index.js';
|
|
3
|
-
/** Attribute groups the input component provides to the consumer's `toView` callback. */
|
|
4
|
-
export type InputAttributes<ParentMessage> = Readonly<{
|
|
5
|
-
input: ReadonlyArray<Attribute<ParentMessage>>;
|
|
6
|
-
label: ReadonlyArray<Attribute<ParentMessage>>;
|
|
7
|
-
description: ReadonlyArray<Attribute<ParentMessage>>;
|
|
8
|
-
}>;
|
|
9
|
-
/** Configuration for rendering an input with `view`. */
|
|
10
|
-
export type ViewConfig<ParentMessage> = Readonly<{
|
|
11
|
-
id: string;
|
|
12
|
-
toView: (attributes: InputAttributes<ParentMessage>) => Html;
|
|
13
|
-
onInput?: (value: string) => ParentMessage;
|
|
14
|
-
value?: string;
|
|
15
|
-
isDisabled?: boolean;
|
|
16
|
-
isInvalid?: boolean;
|
|
17
|
-
isAutofocus?: boolean;
|
|
18
|
-
name?: string;
|
|
19
|
-
type?: string;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
}>;
|
|
22
|
-
/** Generates the description element ID from the input's base ID. */
|
|
23
|
-
export declare const descriptionId: (id: string) => string;
|
|
24
|
-
/** Renders an accessible input by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
25
|
-
export declare const view: <ParentMessage>(config: ViewConfig<ParentMessage>) => Html;
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/input/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAI/C,yFAAyF;AACzF,MAAM,MAAM,eAAe,CAAC,aAAa,IAAI,QAAQ,CAAC;IACpD,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IAC9C,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IAC9C,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;CACrD,CAAC,CAAA;AAEF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,aAAa,IAAI,QAAQ,CAAC;IAC/C,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;IAC5D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,CAAA;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC,CAAA;AAEF,qEAAqE;AACrE,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE,+HAA+H;AAC/H,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,QAAQ,UAAU,CAAC,aAAa,CAAC,KAChC,IA6DF,CAAA"}
|
package/dist/ui/input/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Predicate } from 'effect';
|
|
2
|
-
import { html } from '../../html/index.js';
|
|
3
|
-
/** Generates the description element ID from the input's base ID. */
|
|
4
|
-
export const descriptionId = (id) => `${id}-description`;
|
|
5
|
-
/** Renders an accessible input by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
6
|
-
export const view = (config) => {
|
|
7
|
-
const h = html();
|
|
8
|
-
const { toView, id, onInput, value, isDisabled = false, isInvalid = false, isAutofocus = false, name, type = 'text', placeholder, } = config;
|
|
9
|
-
const disabledAttributes = isDisabled
|
|
10
|
-
? [h.AriaDisabled(true), h.Disabled(true), h.DataAttribute('disabled', '')]
|
|
11
|
-
: [];
|
|
12
|
-
const invalidAttributes = isInvalid
|
|
13
|
-
? [h.AriaInvalid(true), h.DataAttribute('invalid', '')]
|
|
14
|
-
: [];
|
|
15
|
-
const inputAttributes = Predicate.isNotUndefined(onInput) && !isDisabled ? [h.OnInput(onInput)] : [];
|
|
16
|
-
const valueAttributes = Predicate.isNotUndefined(value)
|
|
17
|
-
? [h.Value(value)]
|
|
18
|
-
: [];
|
|
19
|
-
const autofocusAttributes = isAutofocus ? [h.Autofocus(true)] : [];
|
|
20
|
-
const nameAttributes = Predicate.isNotUndefined(name) ? [h.Name(name)] : [];
|
|
21
|
-
const placeholderAttributes = Predicate.isNotUndefined(placeholder)
|
|
22
|
-
? [h.Placeholder(placeholder)]
|
|
23
|
-
: [];
|
|
24
|
-
const allInputAttributes = [
|
|
25
|
-
h.Id(id),
|
|
26
|
-
h.Type(type),
|
|
27
|
-
h.AriaDescribedBy(descriptionId(id)),
|
|
28
|
-
...disabledAttributes,
|
|
29
|
-
...invalidAttributes,
|
|
30
|
-
...inputAttributes,
|
|
31
|
-
...valueAttributes,
|
|
32
|
-
...autofocusAttributes,
|
|
33
|
-
...nameAttributes,
|
|
34
|
-
...placeholderAttributes,
|
|
35
|
-
];
|
|
36
|
-
const labelAttributes = [h.For(id)];
|
|
37
|
-
const descriptionAttributes = [h.Id(descriptionId(id))];
|
|
38
|
-
return toView({
|
|
39
|
-
input: allInputAttributes,
|
|
40
|
-
label: labelAttributes,
|
|
41
|
-
description: descriptionAttributes,
|
|
42
|
-
});
|
|
43
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/input/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhD,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/ui/input/public.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { view, descriptionId } from './index.js';
|
package/dist/ui/keyboard.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** Whether a keyboard event key is a single printable character (not a named key like "Enter" or "ArrowDown"). */
|
|
2
|
-
export declare const isPrintableKey: (key: string) => boolean;
|
|
3
|
-
export declare const wrapIndex: (index: number, length: number) => number;
|
|
4
|
-
export declare const findFirstEnabledIndex: (itemCount: number, focusedIndex: number, isDisabled: (index: number) => boolean) => (startIndex: number, direction: 1 | -1) => number;
|
|
5
|
-
export declare const keyToIndex: (nextKey: string, previousKey: string, itemCount: number, focusedIndex: number, isDisabled: (index: number) => boolean) => ((key: string) => number);
|
|
6
|
-
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/ui/keyboard.ts"],"names":[],"mappings":"AAEA,kHAAkH;AAClH,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,OAA2B,CAAA;AAExE,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,MACpB,CAAA;AAEtC,eAAO,MAAM,qBAAqB,GAE9B,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,YAAY,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,MAEvC,YAAY,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,KAAG,MAMtC,CAAA;AAEL,eAAO,MAAM,UAAU,GACrB,SAAS,MAAM,EACf,aAAa,MAAM,EACnB,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,YAAY,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,KACrC,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAW1B,CAAA"}
|
package/dist/ui/keyboard.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Array, Match as M, Option, Predicate, pipe } from 'effect';
|
|
2
|
-
/** Whether a keyboard event key is a single printable character (not a named key like "Enter" or "ArrowDown"). */
|
|
3
|
-
export const isPrintableKey = (key) => key.length === 1;
|
|
4
|
-
export const wrapIndex = (index, length) => ((index % length) + length) % length;
|
|
5
|
-
export const findFirstEnabledIndex = (itemCount, focusedIndex, isDisabled) => (startIndex, direction) => pipe(itemCount, Array.makeBy(step => wrapIndex(startIndex + step * direction, itemCount)), Array.findFirst(Predicate.not(isDisabled)), Option.getOrElse(() => focusedIndex));
|
|
6
|
-
export const keyToIndex = (nextKey, previousKey, itemCount, focusedIndex, isDisabled) => {
|
|
7
|
-
const find = findFirstEnabledIndex(itemCount, focusedIndex, isDisabled);
|
|
8
|
-
return (key) => M.value(key).pipe(M.when(nextKey, () => find(focusedIndex + 1, 1)), M.when(previousKey, () => find(focusedIndex - 1, -1)), M.whenOr('Home', 'PageUp', () => find(0, 1)), M.whenOr('End', 'PageDown', () => find(itemCount - 1, -1)), M.orElse(() => focusedIndex));
|
|
9
|
-
};
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { Option, Schema as S } from 'effect';
|
|
2
|
-
import type * as Command from '../../command/index.js';
|
|
3
|
-
import type { SubmodelView } from '../../html/index.js';
|
|
4
|
-
import type { Reflect } from '../../submodel/submodel.js';
|
|
5
|
-
import { type BaseInitConfig, type BaseViewInputs, type Message, type OutMessage } from './shared.js';
|
|
6
|
-
/** Schema for the multi-select listbox component's state, tracking open/closed status, active item, selected items, activation trigger, and typeahead search. */
|
|
7
|
-
export declare const Model: S.Struct<{
|
|
8
|
-
readonly selectedItems: S.$Array<S.String>;
|
|
9
|
-
readonly id: S.String;
|
|
10
|
-
readonly isOpen: S.Boolean;
|
|
11
|
-
readonly isAnimated: S.Boolean;
|
|
12
|
-
readonly isModal: S.Boolean;
|
|
13
|
-
readonly orientation: S.Literals<readonly ["Vertical", "Horizontal"]>;
|
|
14
|
-
readonly animation: S.Struct<{
|
|
15
|
-
readonly id: S.String;
|
|
16
|
-
readonly isShowing: S.Boolean;
|
|
17
|
-
readonly transitionState: S.Literals<readonly ["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
18
|
-
}>;
|
|
19
|
-
readonly maybeActiveItemIndex: S.Option<S.Number>;
|
|
20
|
-
readonly activationTrigger: S.Literals<readonly ["Pointer", "Keyboard"]>;
|
|
21
|
-
readonly searchQuery: S.String;
|
|
22
|
-
readonly searchVersion: S.Number;
|
|
23
|
-
readonly maybeLastPointerPosition: S.Option<S.Struct<{
|
|
24
|
-
readonly screenX: S.Number;
|
|
25
|
-
readonly screenY: S.Number;
|
|
26
|
-
}>>;
|
|
27
|
-
readonly maybeLastButtonPointerType: S.Option<S.String>;
|
|
28
|
-
}>;
|
|
29
|
-
export type Model = typeof Model.Type;
|
|
30
|
-
/** Configuration for creating a multi-select listbox model with `init`. `isAnimated` enables CSS transition coordination (default `false`). `isModal` locks page scroll and inerts other elements when open (default `false`). `selectedItems` sets the initial selection (default `[]`). */
|
|
31
|
-
export type InitConfig = BaseInitConfig & Readonly<{
|
|
32
|
-
selectedItems?: ReadonlyArray<string>;
|
|
33
|
-
}>;
|
|
34
|
-
/** Creates an initial multi-select listbox model from a config. Defaults to closed with no active item and no selection. */
|
|
35
|
-
export declare const init: (config: InitConfig) => Model;
|
|
36
|
-
/** Processes a listbox message and returns the next model, commands, and optional OutMessage. Stays open on selection and toggles item membership (multi-select behavior); emits a `Selected({ value, wasAdded })` OutMessage indicating whether the value was added or removed. */
|
|
37
|
-
export declare const update: (model: {
|
|
38
|
-
readonly selectedItems: readonly string[];
|
|
39
|
-
readonly id: string;
|
|
40
|
-
readonly isOpen: boolean;
|
|
41
|
-
readonly isAnimated: boolean;
|
|
42
|
-
readonly isModal: boolean;
|
|
43
|
-
readonly orientation: "Vertical" | "Horizontal";
|
|
44
|
-
readonly animation: {
|
|
45
|
-
readonly id: string;
|
|
46
|
-
readonly isShowing: boolean;
|
|
47
|
-
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
48
|
-
};
|
|
49
|
-
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
50
|
-
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
51
|
-
readonly searchQuery: string;
|
|
52
|
-
readonly searchVersion: number;
|
|
53
|
-
readonly maybeLastPointerPosition: Option.Option<{
|
|
54
|
-
readonly screenX: number;
|
|
55
|
-
readonly screenY: number;
|
|
56
|
-
}>;
|
|
57
|
-
readonly maybeLastButtonPointerType: Option.Option<string>;
|
|
58
|
-
}, message: Message) => readonly [{
|
|
59
|
-
readonly selectedItems: readonly string[];
|
|
60
|
-
readonly id: string;
|
|
61
|
-
readonly isOpen: boolean;
|
|
62
|
-
readonly isAnimated: boolean;
|
|
63
|
-
readonly isModal: boolean;
|
|
64
|
-
readonly orientation: "Vertical" | "Horizontal";
|
|
65
|
-
readonly animation: {
|
|
66
|
-
readonly id: string;
|
|
67
|
-
readonly isShowing: boolean;
|
|
68
|
-
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
69
|
-
};
|
|
70
|
-
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
71
|
-
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
72
|
-
readonly searchQuery: string;
|
|
73
|
-
readonly searchVersion: number;
|
|
74
|
-
readonly maybeLastPointerPosition: Option.Option<{
|
|
75
|
-
readonly screenX: number;
|
|
76
|
-
readonly screenY: number;
|
|
77
|
-
}>;
|
|
78
|
-
readonly maybeLastButtonPointerType: Option.Option<string>;
|
|
79
|
-
}, readonly Readonly<{
|
|
80
|
-
name: string;
|
|
81
|
-
args?: Record<string, unknown>;
|
|
82
|
-
effect: import("effect/Effect").Effect<{
|
|
83
|
-
readonly _tag: "Opened";
|
|
84
|
-
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
85
|
-
} | {
|
|
86
|
-
readonly _tag: "Closed";
|
|
87
|
-
} | {
|
|
88
|
-
readonly _tag: "BlurredItems";
|
|
89
|
-
} | {
|
|
90
|
-
readonly _tag: "ActivatedItem";
|
|
91
|
-
readonly index: number;
|
|
92
|
-
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
93
|
-
} | {
|
|
94
|
-
readonly _tag: "DeactivatedItem";
|
|
95
|
-
} | {
|
|
96
|
-
readonly _tag: "SelectedItem";
|
|
97
|
-
readonly item: string;
|
|
98
|
-
} | {
|
|
99
|
-
readonly _tag: "RequestedItemClick";
|
|
100
|
-
readonly index: number;
|
|
101
|
-
} | {
|
|
102
|
-
readonly _tag: "Searched";
|
|
103
|
-
readonly key: string;
|
|
104
|
-
readonly maybeTargetIndex: Option.Option<number>;
|
|
105
|
-
} | {
|
|
106
|
-
readonly _tag: "ClearedSearch";
|
|
107
|
-
readonly version: number;
|
|
108
|
-
} | {
|
|
109
|
-
readonly _tag: "MovedPointerOverItem";
|
|
110
|
-
readonly index: number;
|
|
111
|
-
readonly screenX: number;
|
|
112
|
-
readonly screenY: number;
|
|
113
|
-
} | {
|
|
114
|
-
readonly _tag: "CompletedLockScroll";
|
|
115
|
-
} | {
|
|
116
|
-
readonly _tag: "CompletedUnlockScroll";
|
|
117
|
-
} | {
|
|
118
|
-
readonly _tag: "CompletedInertOthers";
|
|
119
|
-
} | {
|
|
120
|
-
readonly _tag: "CompletedRestoreInert";
|
|
121
|
-
} | {
|
|
122
|
-
readonly _tag: "CompletedFocusButton";
|
|
123
|
-
} | {
|
|
124
|
-
readonly _tag: "CompletedFocusItems";
|
|
125
|
-
} | {
|
|
126
|
-
readonly _tag: "CompletedScrollIntoView";
|
|
127
|
-
} | {
|
|
128
|
-
readonly _tag: "CompletedClickItem";
|
|
129
|
-
} | {
|
|
130
|
-
readonly _tag: "IgnoredMouseClick";
|
|
131
|
-
} | {
|
|
132
|
-
readonly _tag: "SuppressedSpaceScroll";
|
|
133
|
-
} | {
|
|
134
|
-
readonly _tag: "CompletedAnchorListbox";
|
|
135
|
-
} | {
|
|
136
|
-
readonly _tag: "CompletedPortalListboxBackdrop";
|
|
137
|
-
} | {
|
|
138
|
-
readonly _tag: "GotAnimationMessage";
|
|
139
|
-
readonly message: {
|
|
140
|
-
readonly _tag: "Showed";
|
|
141
|
-
} | {
|
|
142
|
-
readonly _tag: "Hid";
|
|
143
|
-
} | {
|
|
144
|
-
readonly _tag: "AdvancedAnimationFrame";
|
|
145
|
-
} | {
|
|
146
|
-
readonly _tag: "EndedAnimation";
|
|
147
|
-
};
|
|
148
|
-
} | {
|
|
149
|
-
readonly _tag: "PressedPointerOnButton";
|
|
150
|
-
readonly pointerType: string;
|
|
151
|
-
readonly button: number;
|
|
152
|
-
}, never, never>;
|
|
153
|
-
}>[], Option.Option<Readonly<{
|
|
154
|
-
readonly _tag: "Selected";
|
|
155
|
-
readonly value: string;
|
|
156
|
-
readonly wasAdded: boolean;
|
|
157
|
-
}>>];
|
|
158
|
-
type UpdateReturn = ReturnType<typeof update>;
|
|
159
|
-
/** Programmatically opens the listbox, updating the model and returning
|
|
160
|
-
* focus and modal commands. Use this in domain-event handlers to open the listbox. */
|
|
161
|
-
export declare const open: (model: Model) => UpdateReturn;
|
|
162
|
-
/** Programmatically closes the listbox, updating the model and returning
|
|
163
|
-
* focus and modal commands. Use this in domain-event handlers to close the listbox. */
|
|
164
|
-
export declare const close: (model: Model) => UpdateReturn;
|
|
165
|
-
/** Programmatically toggles an item in the multi-select listbox. Emits `Selected({ value, wasAdded })`. */
|
|
166
|
-
export declare const selectItem: (model: Model, item: string) => UpdateReturn;
|
|
167
|
-
/** Reflects an externally-sourced selection set onto the model without
|
|
168
|
-
* emitting an OutMessage or running selection side effects. Use this to
|
|
169
|
-
* mirror external truth (URL parameters, restored storage, a server push)
|
|
170
|
-
* onto the listbox's selected items. Contrast with `selectItem`, which
|
|
171
|
-
* toggles a single item as a user *choice* and emits `Selected`. Returns
|
|
172
|
-
* the model directly because it produces no commands and no OutMessage. */
|
|
173
|
-
export declare const reflectSelectedItems: Reflect<Model, ReadonlyArray<string>>;
|
|
174
|
-
/** Per-render view inputs passed to the view via `h.submodel`'s `viewInputs` field. */
|
|
175
|
-
export type ViewInputs<Item, Value extends string = string> = BaseViewInputs<Item, Value>;
|
|
176
|
-
/** Pairs the multi-select listbox's `view` and `update` (and programmatic
|
|
177
|
-
* helpers) behind a single Item-typed entry point. Same shape as
|
|
178
|
-
* `Ui.Listbox.create`. Two type params support object-typed items via
|
|
179
|
-
* `itemToValue`: `Value` defaults to `Item` when `Item extends string`,
|
|
180
|
-
* else `string`. */
|
|
181
|
-
export declare const create: <Item = string, Value extends string = Item extends string ? Item : string>() => Readonly<{
|
|
182
|
-
view: SubmodelView<Model, Message, BaseViewInputs<Item, Value>>;
|
|
183
|
-
update: (model: Model, message: Message) => readonly [Model, ReadonlyArray<Command.Command<Message>>, Option.Option<OutMessage<Value>>];
|
|
184
|
-
selectItem: (model: Model, item: Value) => readonly [Model, ReadonlyArray<Command.Command<Message>>, Option.Option<OutMessage<Value>>];
|
|
185
|
-
open: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>, Option.Option<OutMessage<Value>>];
|
|
186
|
-
close: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>, Option.Option<OutMessage<Value>>];
|
|
187
|
-
reflectSelectedItems: Reflect<Model, ReadonlyArray<Value>>;
|
|
188
|
-
}>;
|
|
189
|
-
export {};
|
|
190
|
-
//# sourceMappingURL=multi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multi.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/multi.ts"],"names":[],"mappings":"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"}
|