@foldkit/ui 0.148.2 → 0.149.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/index.d.ts +3 -3
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/animation/index.js +2 -2
- 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 +12 -21
- package/dist/animation/schema.d.ts.map +1 -1
- package/dist/animation/schema.js +11 -15
- package/dist/animation/update.d.ts +1 -1
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +9 -9
- package/dist/calendar/index.d.ts +50 -105
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +61 -98
- package/dist/calendar/public.d.ts +1 -1
- package/dist/calendar/public.d.ts.map +1 -1
- package/dist/calendar/public.js +1 -1
- package/dist/combobox/multi.d.ts +9 -9
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +9 -9
- package/dist/combobox/public.d.ts +1 -1
- package/dist/combobox/public.d.ts.map +1 -1
- package/dist/combobox/public.js +1 -1
- package/dist/combobox/shared.d.ts +93 -137
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +108 -153
- package/dist/combobox/single.d.ts +9 -9
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +10 -10
- package/dist/datePicker/index.d.ts +88 -84
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +33 -63
- package/dist/datePicker/public.d.ts +1 -1
- package/dist/datePicker/public.d.ts.map +1 -1
- package/dist/datePicker/public.js +1 -1
- package/dist/dialog/index.d.ts +28 -49
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +39 -67
- package/dist/dialog/public.d.ts +1 -1
- package/dist/dialog/public.d.ts.map +1 -1
- package/dist/dialog/public.js +1 -1
- package/dist/dragAndDrop/index.d.ts +45 -72
- package/dist/dragAndDrop/index.d.ts.map +1 -1
- package/dist/dragAndDrop/index.js +72 -93
- package/dist/dragAndDrop/public.d.ts +1 -1
- package/dist/dragAndDrop/public.d.ts.map +1 -1
- package/dist/dragAndDrop/public.js +1 -1
- package/dist/fileDrop/index.d.ts +14 -35
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +20 -46
- package/dist/fileDrop/public.d.ts +1 -1
- package/dist/fileDrop/public.d.ts.map +1 -1
- package/dist/fileDrop/public.js +1 -1
- package/dist/listbox/multi.d.ts +7 -7
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/multi.js +8 -8
- package/dist/listbox/public.d.ts +1 -1
- package/dist/listbox/public.d.ts.map +1 -1
- package/dist/listbox/public.js +1 -1
- package/dist/listbox/shared.d.ts +80 -127
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +92 -149
- package/dist/listbox/single.d.ts +7 -7
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/listbox/single.js +8 -8
- package/dist/menu/index.d.ts +86 -134
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +141 -189
- package/dist/menu/public.d.ts +1 -1
- package/dist/menu/public.d.ts.map +1 -1
- package/dist/menu/public.js +1 -1
- package/dist/popover/index.d.ts +39 -65
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +68 -98
- package/dist/popover/public.d.ts +1 -1
- package/dist/popover/public.d.ts.map +1 -1
- package/dist/popover/public.js +1 -1
- package/dist/radioGroup/index.d.ts +18 -29
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +22 -27
- package/dist/radioGroup/public.d.ts +1 -1
- package/dist/radioGroup/public.d.ts.map +1 -1
- package/dist/radioGroup/public.js +1 -1
- package/dist/slider/index.d.ts +29 -51
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +36 -56
- package/dist/slider/public.d.ts +1 -1
- package/dist/slider/public.d.ts.map +1 -1
- package/dist/slider/public.js +1 -1
- package/dist/tabs/index.d.ts +18 -28
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +22 -26
- package/dist/tabs/public.d.ts +1 -1
- package/dist/tabs/public.d.ts.map +1 -1
- package/dist/tabs/public.js +1 -1
- package/dist/test/apps/disabledButton.d.ts +71 -14
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +14 -13
- package/dist/toast/index.d.ts +124 -109
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +5 -5
- package/dist/toast/public.d.ts +1 -1
- package/dist/toast/public.d.ts.map +1 -1
- package/dist/toast/public.js +1 -1
- package/dist/toast/schema.d.ts +72 -84
- package/dist/toast/schema.d.ts.map +1 -1
- package/dist/toast/schema.js +31 -41
- package/dist/toast/test.d.ts.map +1 -1
- package/dist/toast/test.js +6 -3
- package/dist/toast/update.d.ts +104 -89
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +19 -20
- package/dist/tooltip/message.d.ts +26 -47
- package/dist/tooltip/message.d.ts.map +1 -1
- package/dist/tooltip/message.js +15 -40
- package/dist/tooltip/public.d.ts +1 -1
- package/dist/tooltip/public.d.ts.map +1 -1
- package/dist/tooltip/public.js +1 -1
- package/dist/tooltip/tooltip.d.ts +1 -1
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +15 -16
- package/dist/virtualList/index.d.ts +46 -23
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +12 -23
- package/dist/virtualList/public.d.ts +1 -1
- package/dist/virtualList/public.d.ts.map +1 -1
- package/dist/virtualList/public.js +1 -1
- package/package.json +3 -3
package/dist/dialog/index.js
CHANGED
|
@@ -3,14 +3,14 @@ import { Effect, Match as M, Option, Schema as S } from 'effect';
|
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import * as Dom from 'foldkit/dom';
|
|
5
5
|
import { childAttributes } from 'foldkit/html';
|
|
6
|
-
import {
|
|
6
|
+
import { defineMessageUnion } from 'foldkit/message';
|
|
7
7
|
import { evo } from 'foldkit/struct';
|
|
8
8
|
import { defineView } from 'foldkit/submodel';
|
|
9
9
|
import * as Update from 'foldkit/update';
|
|
10
10
|
// NOTE: Animation imports are split across schema + update to avoid a circular
|
|
11
11
|
// dependency: animation → html → runtime → devtools → dialog → animation.
|
|
12
12
|
// The barrel (../animation) imports from html, which starts the cycle.
|
|
13
|
-
import {
|
|
13
|
+
import { Message as AnimationMessage, Model as AnimationModel, OutMessage as AnimationOutMessage, init as animationInit, } from '../animation/schema.js';
|
|
14
14
|
import { defaultLeaveCommand as animationDefaultLeaveCommand, update as animationUpdate, } from '../animation/update.js';
|
|
15
15
|
import { idSelector } from '../internal/selectors.js';
|
|
16
16
|
// MODEL
|
|
@@ -23,50 +23,22 @@ export const Model = S.Struct({
|
|
|
23
23
|
maybeFocusSelector: S.Option(S.String),
|
|
24
24
|
});
|
|
25
25
|
// MESSAGE
|
|
26
|
-
/** Sent when the dialog should open. Triggers the ShowDialog command. */
|
|
27
|
-
export const RequestedOpen = m('RequestedOpen');
|
|
28
|
-
/** Sent when the dialog should close (Escape key, backdrop click, or programmatic). */
|
|
29
|
-
export const RequestedClose = m('RequestedClose');
|
|
30
|
-
/** Sent when the show-dialog command completes. */
|
|
31
|
-
export const CompletedShowDialog = m('CompletedShowDialog');
|
|
32
|
-
/** Sent when the close-dialog command completes. */
|
|
33
|
-
export const CompletedCloseDialog = m('CompletedCloseDialog');
|
|
34
|
-
/** Sent when the native `<dialog>` element is removed from the DOM, the classic
|
|
35
|
-
* case being navigation away from a route-keyed subtree that contains the
|
|
36
|
-
* dialog. When the dialog still holds framework resources, `update` triggers
|
|
37
|
-
* the hygiene-only `ReleaseDialogResources` command and resets the model to a
|
|
38
|
-
* clean closed state. Does not emit `Closed` or run any consumer close
|
|
39
|
-
* Commands: it is a backstop, not the purposeful close. */
|
|
40
|
-
export const Unmounted = m('Unmounted');
|
|
41
|
-
/** Sent when the release-dialog-resources command completes. */
|
|
42
|
-
export const CompletedReleaseDialogResources = m('CompletedReleaseDialogResources');
|
|
43
|
-
/** Wraps an Animation submodel message for delegation. */
|
|
44
|
-
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
45
|
-
message: AnimationMessage,
|
|
46
|
-
});
|
|
47
26
|
/** Union of all messages the dialog component can produce. */
|
|
48
|
-
export const Message =
|
|
49
|
-
RequestedOpen,
|
|
50
|
-
RequestedClose,
|
|
51
|
-
CompletedShowDialog,
|
|
52
|
-
CompletedCloseDialog,
|
|
53
|
-
Unmounted,
|
|
54
|
-
CompletedReleaseDialogResources,
|
|
55
|
-
GotAnimationMessage,
|
|
56
|
-
|
|
27
|
+
export const Message = defineMessageUnion({
|
|
28
|
+
RequestedOpen: {},
|
|
29
|
+
RequestedClose: {},
|
|
30
|
+
CompletedShowDialog: {},
|
|
31
|
+
CompletedCloseDialog: {},
|
|
32
|
+
Unmounted: {},
|
|
33
|
+
CompletedReleaseDialogResources: {},
|
|
34
|
+
GotAnimationMessage: { message: AnimationMessage },
|
|
35
|
+
});
|
|
57
36
|
// OUT MESSAGE
|
|
58
|
-
/** Sent once the dialog has transitioned to open. Fires after `update`
|
|
59
|
-
* has processed `RequestedOpen` and `isOpen` reflects the new state.
|
|
60
|
-
* Programmatic `Dialog.open` on an already-open model is a no-op that
|
|
61
|
-
* does not re-emit. */
|
|
62
|
-
export const Opened = m('Opened');
|
|
63
|
-
/** Sent once the dialog has transitioned to closed. Programmatic
|
|
64
|
-
* `Dialog.close` on an already-closed model is a no-op that does not
|
|
65
|
-
* re-emit; calling close while a leave animation is in progress is
|
|
66
|
-
* also a no-op. */
|
|
67
|
-
export const Closed = m('Closed');
|
|
68
37
|
/** Union of out-messages the dialog component can produce. */
|
|
69
|
-
export const OutMessage =
|
|
38
|
+
export const OutMessage = defineMessageUnion({
|
|
39
|
+
Opened: {},
|
|
40
|
+
Closed: {},
|
|
41
|
+
});
|
|
70
42
|
/** Creates an initial dialog model from a config. Defaults to closed and non-animated. */
|
|
71
43
|
export const init = (config) => (__foldkitBrandViewResult(({
|
|
72
44
|
id: config.id,
|
|
@@ -86,7 +58,6 @@ export const initialFocusMarkerAttribute = 'foldkit-dialog-initial-focus';
|
|
|
86
58
|
/** Selector for {@link initialFocusMarkerAttribute}, focused against the open
|
|
87
59
|
* dialog when no `focusSelector` is configured. */
|
|
88
60
|
export const initialFocusMarkerSelector = `[data-${initialFocusMarkerAttribute}]`;
|
|
89
|
-
const withUpdateReturn = M.withReturnType();
|
|
90
61
|
/** Locks page scroll and opens the native dialog element through
|
|
91
62
|
* `Dom.showDialog`, which calls `show()` (not native `showModal()`) so other
|
|
92
63
|
* high-z-index overlays stay interactive. It layers the dialog with a high
|
|
@@ -94,14 +65,14 @@ const withUpdateReturn = M.withReturnType();
|
|
|
94
65
|
* component supplies its own backdrop. */
|
|
95
66
|
export const ShowDialog = Command.define('ShowDialog', {
|
|
96
67
|
args: { id: S.String, focusSelector: S.String },
|
|
97
|
-
messages: [CompletedShowDialog],
|
|
98
|
-
execute: ({ id, focusSelector }) => __foldkitBrandViewResult((Dom.lockScroll.pipe(Effect.andThen(() => __foldkitBrandViewResult((Dom.showDialog(dialogSelector(id), { focusSelector })), "@foldkit/ui/dialog/index.js#anonymous")), Effect.ignore, Effect.as(CompletedShowDialog()))), "@foldkit/ui/dialog/index.js#execute"),
|
|
68
|
+
messages: [Message.CompletedShowDialog],
|
|
69
|
+
execute: ({ id, focusSelector }) => __foldkitBrandViewResult((Dom.lockScroll.pipe(Effect.andThen(() => __foldkitBrandViewResult((Dom.showDialog(dialogSelector(id), { focusSelector })), "@foldkit/ui/dialog/index.js#anonymous")), Effect.ignore, Effect.as(Message.CompletedShowDialog()))), "@foldkit/ui/dialog/index.js#execute"),
|
|
99
70
|
});
|
|
100
71
|
/** Calls `close()` on the native dialog element and unlocks page scroll. */
|
|
101
72
|
export const CloseDialog = Command.define('CloseDialog', {
|
|
102
73
|
args: { id: S.String },
|
|
103
|
-
messages: [CompletedCloseDialog],
|
|
104
|
-
execute: ({ id }) => __foldkitBrandViewResult((Dom.closeDialog(dialogSelector(id)).pipe(Effect.andThen(() => __foldkitBrandViewResult((Dom.unlockScroll), "@foldkit/ui/dialog/index.js#anonymous~2")), Effect.ignore, Effect.as(CompletedCloseDialog()))), "@foldkit/ui/dialog/index.js#execute~2"),
|
|
74
|
+
messages: [Message.CompletedCloseDialog],
|
|
75
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.closeDialog(dialogSelector(id)).pipe(Effect.andThen(() => __foldkitBrandViewResult((Dom.unlockScroll), "@foldkit/ui/dialog/index.js#anonymous~2")), Effect.ignore, Effect.as(Message.CompletedCloseDialog()))), "@foldkit/ui/dialog/index.js#execute~2"),
|
|
105
76
|
});
|
|
106
77
|
/** Releases the framework hygiene the dialog holds while open (scroll lock,
|
|
107
78
|
* focus trap, return focus, stack entry) when the element unmounts without a
|
|
@@ -109,17 +80,17 @@ export const CloseDialog = Command.define('CloseDialog', {
|
|
|
109
80
|
* resources through `CloseDialog`. */
|
|
110
81
|
export const ReleaseDialogResources = Command.define('ReleaseDialogResources', {
|
|
111
82
|
args: { id: S.String },
|
|
112
|
-
messages: [CompletedReleaseDialogResources],
|
|
113
|
-
execute: ({ id }) => __foldkitBrandViewResult((Dom.releaseDialogResources(id).pipe(Effect.ignore, Effect.as(CompletedReleaseDialogResources()))), "@foldkit/ui/dialog/index.js#execute~3"),
|
|
83
|
+
messages: [Message.CompletedReleaseDialogResources],
|
|
84
|
+
execute: ({ id }) => __foldkitBrandViewResult((Dom.releaseDialogResources(id).pipe(Effect.ignore, Effect.as(Message.CompletedReleaseDialogResources()))), "@foldkit/ui/dialog/index.js#execute~3"),
|
|
114
85
|
});
|
|
115
|
-
const wrapAnimationMessage = (message) => __foldkitBrandViewResult((GotAnimationMessage({ message })), "@foldkit/ui/dialog/index.js#wrapAnimationMessage");
|
|
116
|
-
const foldAnimationOutMessage = (outMessage, { liftCommand }) => __foldkitBrandViewResult((
|
|
86
|
+
const wrapAnimationMessage = (message) => __foldkitBrandViewResult((Message.GotAnimationMessage({ message })), "@foldkit/ui/dialog/index.js#wrapAnimationMessage");
|
|
87
|
+
const foldAnimationOutMessage = (outMessage, { liftCommand }) => __foldkitBrandViewResult((AnimationOutMessage.match(outMessage, {
|
|
117
88
|
StartedLeaveAnimating: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([
|
|
118
89
|
model,
|
|
119
90
|
[liftCommand(animationDefaultLeaveCommand(model.animation))],
|
|
120
91
|
]), "@foldkit/ui/dialog/index.js#anonymous~3")), "@foldkit/ui/dialog/index.js#StartedLeaveAnimating"),
|
|
121
92
|
TransitionedOut: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([model, [CloseDialog({ id: model.id })]]), "@foldkit/ui/dialog/index.js#anonymous~4")), "@foldkit/ui/dialog/index.js#TransitionedOut"),
|
|
122
|
-
}))
|
|
93
|
+
})), "@foldkit/ui/dialog/index.js#foldAnimationOutMessage");
|
|
123
94
|
const foldAnimation = Update.foldChild({
|
|
124
95
|
update: animationUpdate,
|
|
125
96
|
read: (model) => __foldkitBrandViewResult((Option.some(model.animation)), "@foldkit/ui/dialog/index.js#read"),
|
|
@@ -129,7 +100,7 @@ const foldAnimation = Update.foldChild({
|
|
|
129
100
|
foldOutMessage: foldAnimationOutMessage,
|
|
130
101
|
});
|
|
131
102
|
/** Processes a dialog message and returns the next model and commands. */
|
|
132
|
-
export const update = (model, message) => __foldkitBrandViewResult((
|
|
103
|
+
export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
133
104
|
RequestedOpen: () => {
|
|
134
105
|
const wasClosed = !model.isOpen;
|
|
135
106
|
const maybeShow = Option.liftPredicate(ShowDialog({
|
|
@@ -137,10 +108,10 @@ export const update = (model, message) => __foldkitBrandViewResult((M.value(mess
|
|
|
137
108
|
focusSelector: Option.getOrElse(model.maybeFocusSelector, () => __foldkitBrandViewResult((initialFocusMarkerSelector), "@foldkit/ui/dialog/index.js#anonymous~5")),
|
|
138
109
|
}), () => __foldkitBrandViewResult((wasClosed), "@foldkit/ui/dialog/index.js#anonymous~6"));
|
|
139
110
|
const maybeOutMessage = wasClosed
|
|
140
|
-
? Option.some(Opened())
|
|
111
|
+
? Option.some(OutMessage.Opened())
|
|
141
112
|
: Option.none();
|
|
142
113
|
if (model.isAnimated) {
|
|
143
|
-
const [nextModel, animationCommands] = foldAnimation(model,
|
|
114
|
+
const [nextModel, animationCommands] = foldAnimation(model, AnimationMessage.Showed());
|
|
144
115
|
return __foldkitBrandViewResult(([
|
|
145
116
|
evo(nextModel, { isOpen: () => __foldkitBrandViewResult((true), "@foldkit/ui/dialog/index.js#isOpen") }),
|
|
146
117
|
[...Option.toArray(maybeShow), ...animationCommands],
|
|
@@ -155,15 +126,16 @@ export const update = (model, message) => __foldkitBrandViewResult((M.value(mess
|
|
|
155
126
|
},
|
|
156
127
|
RequestedClose: () => {
|
|
157
128
|
const { transitionState } = model.animation;
|
|
158
|
-
const isLeaving = transitionState === 'LeaveStart' ||
|
|
159
|
-
transitionState === 'LeaveAnimating';
|
|
129
|
+
const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
|
|
160
130
|
if (isLeaving) {
|
|
161
131
|
return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/dialog/index.js#RequestedClose");
|
|
162
132
|
}
|
|
163
133
|
const wasOpen = model.isOpen;
|
|
164
|
-
const maybeOutMessage = wasOpen
|
|
134
|
+
const maybeOutMessage = wasOpen
|
|
135
|
+
? Option.some(OutMessage.Closed())
|
|
136
|
+
: Option.none();
|
|
165
137
|
if (model.isAnimated) {
|
|
166
|
-
const [nextModel, animationCommands] = foldAnimation(evo(model, { isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/dialog/index.js#isOpen~3") }),
|
|
138
|
+
const [nextModel, animationCommands] = foldAnimation(evo(model, { isOpen: () => __foldkitBrandViewResult((false), "@foldkit/ui/dialog/index.js#isOpen~3") }), AnimationMessage.Hid());
|
|
167
139
|
return __foldkitBrandViewResult(([nextModel, animationCommands, maybeOutMessage]), "@foldkit/ui/dialog/index.js#RequestedClose");
|
|
168
140
|
}
|
|
169
141
|
const maybeClose = Option.liftPredicate(CloseDialog({ id: model.id }), () => __foldkitBrandViewResult((wasOpen), "@foldkit/ui/dialog/index.js#anonymous~7"));
|
|
@@ -194,11 +166,11 @@ export const update = (model, message) => __foldkitBrandViewResult((M.value(mess
|
|
|
194
166
|
CompletedShowDialog: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/dialog/index.js#CompletedShowDialog"),
|
|
195
167
|
CompletedCloseDialog: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/dialog/index.js#CompletedCloseDialog"),
|
|
196
168
|
CompletedReleaseDialogResources: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/dialog/index.js#CompletedReleaseDialogResources"),
|
|
197
|
-
}))
|
|
169
|
+
})), "@foldkit/ui/dialog/index.js#update");
|
|
198
170
|
/** Programmatically opens the dialog. */
|
|
199
|
-
export const open = (model) => __foldkitBrandViewResult((update(model, RequestedOpen())), "@foldkit/ui/dialog/index.js#open");
|
|
171
|
+
export const open = (model) => __foldkitBrandViewResult((update(model, Message.RequestedOpen())), "@foldkit/ui/dialog/index.js#open");
|
|
200
172
|
/** Programmatically closes the dialog. */
|
|
201
|
-
export const close = (model) => __foldkitBrandViewResult((update(model, RequestedClose())), "@foldkit/ui/dialog/index.js#close");
|
|
173
|
+
export const close = (model) => __foldkitBrandViewResult((update(model, Message.RequestedClose())), "@foldkit/ui/dialog/index.js#close");
|
|
202
174
|
// VIEW
|
|
203
175
|
/** Returns the framework-managed id the dialog's `aria-labelledby` points at,
|
|
204
176
|
* the `-dialog-title` suffix on `model.id`.
|
|
@@ -246,7 +218,7 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
246
218
|
h.Id(id),
|
|
247
219
|
h.AriaLabelledBy(titleId(model)),
|
|
248
220
|
h.AriaDescribedBy(descriptionId(model)),
|
|
249
|
-
h.OnCancel(RequestedClose()),
|
|
221
|
+
h.OnCancel(Message.RequestedClose()),
|
|
250
222
|
h.Open(isVisible),
|
|
251
223
|
h.Style({
|
|
252
224
|
width: '100%',
|
|
@@ -261,13 +233,13 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
261
233
|
: {}),
|
|
262
234
|
}),
|
|
263
235
|
...(isVisible
|
|
264
|
-
? [h.DataAttribute('open', ''), h.OnUnmount(Unmounted())]
|
|
236
|
+
? [h.DataAttribute('open', ''), h.OnUnmount(Message.Unmounted())]
|
|
265
237
|
: []),
|
|
266
238
|
];
|
|
267
239
|
const backdropAttributes = [
|
|
268
240
|
h.Style({ minHeight: '100vh' }),
|
|
269
241
|
...animationAttributes,
|
|
270
|
-
...(isLeaving ? [] : [h.OnClick(RequestedClose())]),
|
|
242
|
+
...(isLeaving ? [] : [h.OnClick(Message.RequestedClose())]),
|
|
271
243
|
];
|
|
272
244
|
const panelAttributes = [h.Id(`${id}-panel`), ...animationAttributes];
|
|
273
245
|
const titleAttributes = [h.Id(titleId(model))];
|
|
@@ -277,7 +249,7 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
277
249
|
];
|
|
278
250
|
const closeButtonAttributes = [
|
|
279
251
|
h.Type('button'),
|
|
280
|
-
...(isLeaving ? [] : [h.OnClick(RequestedClose())]),
|
|
252
|
+
...(isLeaving ? [] : [h.OnClick(Message.RequestedClose())]),
|
|
281
253
|
];
|
|
282
254
|
return __foldkitBrandViewResult((toView({
|
|
283
255
|
dialog: childAttributes(dialogAttributes),
|
package/dist/dialog/public.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { init, update, open, close, view, titleId, descriptionId, Model, Message, OutMessage, Opened, Closed, RequestedOpen, RequestedClose, CompletedShowDialog, CompletedCloseDialog, Unmounted, CompletedReleaseDialogResources,
|
|
1
|
+
export { init, update, open, close, view, titleId, descriptionId, Model, Message, OutMessage, type Opened, type Closed, type RequestedOpen, type RequestedClose, type CompletedShowDialog, type CompletedCloseDialog, type Unmounted, type CompletedReleaseDialogResources, ShowDialog, CloseDialog, ReleaseDialogResources, } from './index.js';
|
|
2
2
|
export type { InitConfig, ViewInputs, RenderInfo } from './index.js';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/dialog/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,OAAO,EACP,aAAa,EACb,KAAK,EACL,OAAO,EACP,UAAU,EACV,MAAM,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/dialog/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,OAAO,EACP,aAAa,EACb,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,+BAA+B,EACpC,UAAU,EACV,WAAW,EACX,sBAAsB,GACvB,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/dialog/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, open, close, view, titleId, descriptionId, Model, Message, OutMessage,
|
|
1
|
+
export { init, update, open, close, view, titleId, descriptionId, Model, Message, OutMessage, ShowDialog, CloseDialog, ReleaseDialogResources, } from './index.js';
|
|
@@ -44,82 +44,55 @@ export declare const Model: S.Struct<{
|
|
|
44
44
|
}>]>;
|
|
45
45
|
}>;
|
|
46
46
|
export type Model = typeof Model.Type;
|
|
47
|
-
/**
|
|
48
|
-
export declare const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
index: S.Number;
|
|
52
|
-
screenX: S.Number;
|
|
53
|
-
screenY: S.Number;
|
|
54
|
-
}>;
|
|
55
|
-
/** The pointer moved during a drag, with collision detection results. */
|
|
56
|
-
export declare const MovedPointer: import("foldkit/schema").CallableTaggedStruct<"MovedPointer", {
|
|
57
|
-
screenX: S.Number;
|
|
58
|
-
screenY: S.Number;
|
|
59
|
-
clientX: S.Number;
|
|
60
|
-
clientY: S.Number;
|
|
61
|
-
maybeDropTarget: S.Option<S.Struct<{
|
|
47
|
+
/** Union of all messages the drag-and-drop component can produce. */
|
|
48
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
49
|
+
readonly PressedDraggable: {
|
|
50
|
+
readonly itemId: S.String;
|
|
62
51
|
readonly containerId: S.String;
|
|
63
52
|
readonly index: S.Number;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
53
|
+
readonly screenX: S.Number;
|
|
54
|
+
readonly screenY: S.Number;
|
|
55
|
+
};
|
|
56
|
+
readonly MovedPointer: {
|
|
57
|
+
readonly screenX: S.Number;
|
|
58
|
+
readonly screenY: S.Number;
|
|
59
|
+
readonly clientX: S.Number;
|
|
60
|
+
readonly clientY: S.Number;
|
|
61
|
+
readonly maybeDropTarget: S.Option<S.Struct<{
|
|
62
|
+
readonly containerId: S.String;
|
|
63
|
+
readonly index: S.Number;
|
|
64
|
+
}>>;
|
|
65
|
+
};
|
|
66
|
+
readonly ReleasedPointer: {};
|
|
67
|
+
readonly CancelledDrag: {};
|
|
68
|
+
readonly ActivatedKeyboardDrag: {
|
|
69
|
+
readonly itemId: S.String;
|
|
70
|
+
readonly containerId: S.String;
|
|
71
|
+
readonly index: S.Number;
|
|
72
|
+
};
|
|
73
|
+
readonly CompletedResolveKeyboardMove: {
|
|
74
|
+
readonly targetContainerId: S.String;
|
|
75
|
+
readonly targetIndex: S.Number;
|
|
76
|
+
};
|
|
77
|
+
readonly ConfirmedKeyboardDrop: {};
|
|
78
|
+
readonly PressedArrowKey: {
|
|
79
|
+
readonly direction: S.Literals<readonly ["Up", "Down", "Left", "Right", "NextContainer", "PreviousContainer"]>;
|
|
80
|
+
};
|
|
81
|
+
readonly AdvancedAutoScrollFrame: {};
|
|
82
|
+
readonly CompletedFocusItem: {};
|
|
86
83
|
}>;
|
|
87
|
-
/** An animation frame fired during auto-scroll. */
|
|
88
|
-
export declare const AdvancedAutoScrollFrame: import("foldkit/schema").CallableTaggedStruct<"AdvancedAutoScrollFrame", {}>;
|
|
89
|
-
/** The FocusItem Command completed. */
|
|
90
|
-
export declare const CompletedFocusItem: import("foldkit/schema").CallableTaggedStruct<"CompletedFocusItem", {}>;
|
|
91
|
-
/** Union of all messages the drag-and-drop component can produce. */
|
|
92
|
-
export declare const Message: S.Union<[
|
|
93
|
-
typeof PressedDraggable,
|
|
94
|
-
typeof MovedPointer,
|
|
95
|
-
typeof ReleasedPointer,
|
|
96
|
-
typeof CancelledDrag,
|
|
97
|
-
typeof ActivatedKeyboardDrag,
|
|
98
|
-
typeof CompletedResolveKeyboardMove,
|
|
99
|
-
typeof ConfirmedKeyboardDrop,
|
|
100
|
-
typeof PressedArrowKey,
|
|
101
|
-
typeof AdvancedAutoScrollFrame,
|
|
102
|
-
typeof CompletedFocusItem
|
|
103
|
-
]>;
|
|
104
84
|
export type Message = typeof Message.Type;
|
|
105
|
-
/** Emitted when a drag completes with a valid drop target. The parent uses this to commit the reorder. */
|
|
106
|
-
export declare const Reordered: import("foldkit/schema").CallableTaggedStruct<"Reordered", {
|
|
107
|
-
itemId: S.String;
|
|
108
|
-
fromContainerId: S.String;
|
|
109
|
-
fromIndex: S.Number;
|
|
110
|
-
toContainerId: S.String;
|
|
111
|
-
toIndex: S.Number;
|
|
112
|
-
}>;
|
|
113
|
-
/** Emitted when a drag is cancelled via Escape or pointer release without a drop target. */
|
|
114
|
-
export declare const Cancelled: import("foldkit/schema").CallableTaggedStruct<"Cancelled", {}>;
|
|
115
85
|
/** Union of all out-messages the drag-and-drop component can emit to its parent. */
|
|
116
|
-
export declare const OutMessage:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
86
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
87
|
+
readonly Reordered: {
|
|
88
|
+
readonly itemId: S.String;
|
|
89
|
+
readonly fromContainerId: S.String;
|
|
90
|
+
readonly fromIndex: S.Number;
|
|
91
|
+
readonly toContainerId: S.String;
|
|
92
|
+
readonly toIndex: S.Number;
|
|
93
|
+
};
|
|
94
|
+
readonly Cancelled: {};
|
|
95
|
+
}>;
|
|
123
96
|
export type OutMessage = typeof OutMessage.Type;
|
|
124
97
|
export type InitConfig = Readonly<{
|
|
125
98
|
id: string;
|
|
@@ -513,7 +486,7 @@ export declare const subscriptions: {
|
|
|
513
486
|
};
|
|
514
487
|
};
|
|
515
488
|
/** Messages the draggable view helper can dispatch. */
|
|
516
|
-
export type DraggableMessage = typeof PressedDraggable.Type | typeof ActivatedKeyboardDrag.Type;
|
|
489
|
+
export type DraggableMessage = typeof Message.PressedDraggable.Type | typeof Message.ActivatedKeyboardDrag.Type;
|
|
517
490
|
/** Configuration for creating draggable attributes with `draggable`. */
|
|
518
491
|
export type DraggableConfig<ParentMessage> = Readonly<{
|
|
519
492
|
model: Model;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dragAndDrop/index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