@gjermundgaraba-designs/pixel-paper 0.22.2 → 0.24.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/DESIGN.md +18 -17
- package/dist/src/adapters/mermaid.d.ts.map +1 -1
- package/dist/src/adapters/mermaid.js +0 -24
- package/dist/src/announcer/announcer.d.ts.map +1 -1
- package/dist/src/announcer/announcer.js +12 -12
- package/dist/src/board/board.d.ts +0 -10
- package/dist/src/board/board.d.ts.map +1 -1
- package/dist/src/board/board.js +36 -64
- package/dist/src/board/index.d.ts +2 -1
- package/dist/src/board/index.d.ts.map +1 -1
- package/dist/src/board/index.js +2 -1
- package/dist/src/button/button.d.ts +1 -1
- package/dist/src/button/button.d.ts.map +1 -1
- package/dist/src/commandPalette/commandPalette.d.ts.map +1 -1
- package/dist/src/commandPalette/commandPalette.js +78 -83
- package/dist/src/commandPalette/keys.d.ts +2 -2
- package/dist/src/commandPalette/keys.d.ts.map +1 -1
- package/dist/src/commandPalette/keys.js +2 -4
- package/dist/src/commandPalette/match.d.ts.map +1 -1
- package/dist/src/commandPalette/match.js +2 -2
- package/dist/src/confirmDialog/confirmDialog.d.ts.map +1 -1
- package/dist/src/confirmDialog/confirmDialog.js +1 -2
- package/dist/src/copyButton/copyButton.d.ts +0 -5
- package/dist/src/copyButton/copyButton.d.ts.map +1 -1
- package/dist/src/copyButton/copyButton.js +2 -2
- package/dist/src/crumbs/crumbs.d.ts +0 -2
- package/dist/src/crumbs/crumbs.d.ts.map +1 -1
- package/dist/src/crumbs/crumbs.js +2 -2
- package/dist/src/dialog/dialog.d.ts +2 -0
- package/dist/src/dialog/dialog.d.ts.map +1 -1
- package/dist/src/dialog/dialog.js +3 -2
- package/dist/src/drag/drag.d.ts +28 -0
- package/dist/src/drag/drag.d.ts.map +1 -1
- package/dist/src/drag/drag.js +39 -17
- package/dist/src/editableTitle/editableTitle.d.ts +4 -4
- package/dist/src/field/field.d.ts +7 -1
- package/dist/src/field/field.d.ts.map +1 -1
- package/dist/src/field/field.js +14 -6
- package/dist/src/fieldset/fieldset.d.ts.map +1 -1
- package/dist/src/fieldset/fieldset.js +2 -4
- package/dist/src/fileTree/fileTree.d.ts.map +1 -1
- package/dist/src/fileTree/fileTree.js +16 -16
- package/dist/src/iconButton/iconButton.d.ts +6 -1
- package/dist/src/iconButton/iconButton.d.ts.map +1 -1
- package/dist/src/iconButton/iconButton.js +7 -2
- package/dist/src/inlineInput/inlineInput.d.ts +4 -0
- package/dist/src/inlineInput/inlineInput.d.ts.map +1 -1
- package/dist/src/inlineInput/inlineInput.js +9 -6
- package/dist/src/keyHelp/index.d.ts +1 -1
- package/dist/src/keyHelp/index.d.ts.map +1 -1
- package/dist/src/keyHelp/index.js +1 -1
- package/dist/src/keyHelp/keyHelp.d.ts +1 -3
- package/dist/src/keyHelp/keyHelp.d.ts.map +1 -1
- package/dist/src/keyHelp/keyHelp.js +3 -6
- package/dist/src/keyHint/keyLabel.d.ts +2 -0
- package/dist/src/keyHint/keyLabel.d.ts.map +1 -1
- package/dist/src/keyHint/keyLabel.js +3 -2
- package/dist/src/lineDiff/diff.d.ts +6 -3
- package/dist/src/lineDiff/diff.d.ts.map +1 -1
- package/dist/src/lineDiff/diff.js +40 -28
- package/dist/src/lineDiff/patch.d.ts.map +1 -1
- package/dist/src/lineDiff/patch.js +18 -13
- package/dist/src/linkState/linkState.d.ts.map +1 -1
- package/dist/src/linkState/linkState.js +1 -7
- package/dist/src/menu/slip.js +2 -2
- package/dist/src/meter/meter.d.ts.map +1 -1
- package/dist/src/meter/meter.js +22 -17
- package/dist/src/notice/notice.d.ts +2 -0
- package/dist/src/notice/notice.d.ts.map +1 -1
- package/dist/src/notice/notice.js +2 -1
- package/dist/src/panel/panel.d.ts +3 -0
- package/dist/src/panel/panel.d.ts.map +1 -1
- package/dist/src/panel/panel.js +2 -1
- package/dist/src/passwordField/passwordField.d.ts.map +1 -1
- package/dist/src/passwordField/passwordField.js +3 -7
- package/dist/src/rail/index.d.ts +1 -1
- package/dist/src/rail/index.d.ts.map +1 -1
- package/dist/src/rail/index.js +1 -1
- package/dist/src/rail/rail.d.ts +95 -20
- package/dist/src/rail/rail.d.ts.map +1 -1
- package/dist/src/rail/rail.js +103 -46
- package/dist/src/reel/layout.d.ts +9 -5
- package/dist/src/reel/layout.d.ts.map +1 -1
- package/dist/src/reel/layout.js +11 -5
- package/dist/src/reel/reel.d.ts.map +1 -1
- package/dist/src/reel/reel.js +122 -68
- package/dist/src/scheme/scheme.d.ts +1 -1
- package/dist/src/scheme/scheme.d.ts.map +1 -1
- package/dist/src/segmented/segmented.d.ts +0 -3
- package/dist/src/segmented/segmented.d.ts.map +1 -1
- package/dist/src/segmented/segmented.js +1 -6
- package/dist/src/selectField/selectField.d.ts.map +1 -1
- package/dist/src/selectField/selectField.js +3 -10
- package/dist/src/sortable/index.d.ts +1 -1
- package/dist/src/sortable/index.d.ts.map +1 -1
- package/dist/src/sortable/index.js +1 -1
- package/dist/src/sortable/sortable.d.ts +39 -40
- package/dist/src/sortable/sortable.d.ts.map +1 -1
- package/dist/src/sortable/sortable.js +14 -31
- package/dist/src/stack/stack.d.ts +1 -1
- package/dist/src/stack/stack.d.ts.map +1 -1
- package/dist/src/stack/stack.js +1 -1
- package/dist/src/tabs/tabs.d.ts +1 -1
- package/dist/src/tabs/tabs.d.ts.map +1 -1
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/textareaField/textareaField.d.ts.map +1 -1
- package/dist/src/textareaField/textareaField.js +3 -7
- package/dist/src/time/time.d.ts.map +1 -1
- package/dist/src/time/time.js +4 -2
- package/dist/src/tips/index.d.ts +1 -1
- package/dist/src/tips/index.d.ts.map +1 -1
- package/dist/src/tips/tips.d.ts +30 -1
- package/dist/src/tips/tips.d.ts.map +1 -1
- package/dist/src/tips/tips.js +53 -31
- package/dist/src/toast/index.d.ts +1 -1
- package/dist/src/toast/index.d.ts.map +1 -1
- package/dist/src/toast/toast.d.ts +5 -5
- package/dist/src/toast/toast.d.ts.map +1 -1
- package/dist/src/toast/toast.js +1 -6
- package/dist/src/toolbar/toolbar.d.ts +0 -3
- package/dist/src/toolbar/toolbar.d.ts.map +1 -1
- package/dist/src/toolbar/toolbar.js +1 -2
- package/package.json +1 -1
- package/src/adapters/mermaid.ts +0 -24
- package/src/announcer/announcer.ts +13 -17
- package/src/board/board.ts +32 -80
- package/src/board/index.ts +1 -1
- package/src/button/button.ts +1 -1
- package/src/commandPalette/commandPalette.ts +21 -38
- package/src/commandPalette/keys.ts +2 -4
- package/src/commandPalette/match.ts +3 -3
- package/src/confirmDialog/confirmDialog.ts +5 -3
- package/src/copyButton/copyButton.ts +2 -5
- package/src/crumbs/crumbs.ts +2 -4
- package/src/dialog/dialog.ts +3 -2
- package/src/drag/drag.ts +54 -5
- package/src/field/field.ts +29 -7
- package/src/fieldset/fieldset.ts +2 -4
- package/src/fileTree/fileTree.ts +10 -12
- package/src/iconButton/iconButton.ts +19 -2
- package/src/inlineInput/inlineInput.ts +11 -2
- package/src/keyHelp/index.ts +0 -1
- package/src/keyHelp/keyHelp.ts +3 -9
- package/src/keyHint/keyLabel.ts +5 -2
- package/src/lineDiff/diff.ts +70 -54
- package/src/lineDiff/patch.ts +27 -14
- package/src/linkState/linkState.ts +1 -8
- package/src/menu/slip.ts +2 -2
- package/src/meter/meter.ts +25 -15
- package/src/notice/notice.ts +2 -1
- package/src/panel/panel.ts +5 -0
- package/src/passwordField/passwordField.ts +3 -7
- package/src/pixel-paper.css +200 -134
- package/src/rail/index.ts +2 -0
- package/src/rail/rail.ts +124 -44
- package/src/reel/layout.ts +14 -7
- package/src/reel/reel.ts +132 -63
- package/src/scheme/scheme.ts +1 -1
- package/src/segmented/segmented.ts +1 -9
- package/src/selectField/selectField.ts +3 -10
- package/src/sortable/index.ts +0 -1
- package/src/sortable/sortable.ts +35 -54
- package/src/stack/stack.ts +1 -1
- package/src/tabs/tabs.ts +1 -1
- package/src/textareaField/textareaField.ts +3 -7
- package/src/time/time.ts +6 -7
- package/src/tips/index.ts +1 -1
- package/src/tips/tips.ts +71 -35
- package/src/toast/index.ts +1 -1
- package/src/toast/toast.ts +2 -8
- package/src/tokens.css +7 -0
- package/src/toolbar/toolbar.ts +0 -5
- package/dist/src/inlineInput/inline.d.ts +0 -6
- package/dist/src/inlineInput/inline.d.ts.map +0 -1
- package/dist/src/inlineInput/inline.js +0 -7
- package/src/inlineInput/inline.ts +0 -13
package/dist/src/rail/rail.js
CHANGED
|
@@ -22,8 +22,8 @@ const Resizing = Schema.Struct({
|
|
|
22
22
|
width: Schema.Number,
|
|
23
23
|
});
|
|
24
24
|
/** Schema for a rail: whether it is open as a drawer (at 900px and under; wider, it is always
|
|
25
|
-
* in the page and this stays false), and its splitter while a pointer drags it. Its width
|
|
26
|
-
* the parent's. */
|
|
25
|
+
* in the page and this stays false), and its splitter while a pointer drags it. Its width,
|
|
26
|
+
* and whether the reader hid it, are the parent's. */
|
|
27
27
|
export const Model = Schema.Struct({
|
|
28
28
|
id: Schema.String,
|
|
29
29
|
isOpen: Schema.Boolean,
|
|
@@ -35,6 +35,7 @@ export const Model = Schema.Struct({
|
|
|
35
35
|
* the window growing past 900px while it is open, where the rail is back in the page. */
|
|
36
36
|
export const Message = defineMessageUnion({
|
|
37
37
|
ClickedOpen: {},
|
|
38
|
+
ClickedToggle: {},
|
|
38
39
|
PressedSplitter: { pointerId: Schema.Number, clientX: Schema.Number, width: Schema.Number },
|
|
39
40
|
MovedSplitter: { clientX: Schema.Number },
|
|
40
41
|
ReleasedSplitter: { clientX: Schema.Number },
|
|
@@ -47,12 +48,16 @@ export const Message = defineMessageUnion({
|
|
|
47
48
|
WidenedPastDrawer: {},
|
|
48
49
|
CompletedShowRailDrawer: {},
|
|
49
50
|
CompletedHideRailDrawer: {},
|
|
51
|
+
CompletedFocusRailToggle: {},
|
|
50
52
|
});
|
|
51
53
|
/** What a rail asks of its parent. `ResizedRail`: its splitter was let go, or stepped by a
|
|
52
54
|
* key, at `width` pixels, within the rail's bounds; the parent keeps it (per client) and
|
|
53
|
-
* passes it back as the view's `maybeWidth`.
|
|
55
|
+
* passes it back as the view's `maybeWidth`. `ToggledRail`: its toggle was pressed; the
|
|
56
|
+
* parent flips whether it keeps the rail hidden (per client) and passes it back as the view's
|
|
57
|
+
* `isHidden`. */
|
|
54
58
|
export const OutMessage = defineMessageUnion({
|
|
55
59
|
ResizedRail: { width: Schema.Number },
|
|
60
|
+
ToggledRail: {},
|
|
56
61
|
});
|
|
57
62
|
/** Creates a rail, closed, its splitter at rest. */
|
|
58
63
|
export const init = (config) => (__foldkitBrandViewResult(({
|
|
@@ -67,7 +72,7 @@ export const init = (config) => (__foldkitBrandViewResult(({
|
|
|
67
72
|
* (which leaves the deck at least 421px of a 901px window, the narrowest one the rail stands
|
|
68
73
|
* in, more than a phone has), and what an arrow on its splitter moves it. The bounds and the
|
|
69
74
|
* step are the component's, not tokens: the splitter says them as its values. */
|
|
70
|
-
const WIDTH = { start: 272, least: 220, most: 480, step: 16 };
|
|
75
|
+
export const WIDTH = { start: 272, least: 220, most: 480, step: 16 };
|
|
71
76
|
const bounded = (width) => __foldkitBrandViewResult((Math.round(Number.clamp(width, { minimum: WIDTH.least, maximum: WIDTH.most }))), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#bounded");
|
|
72
77
|
// ACCESSORS
|
|
73
78
|
/** The rail's id, unique in the document. */
|
|
@@ -75,12 +80,14 @@ export const id = (model) => __foldkitBrandViewResult((model.id), "@gjermundgara
|
|
|
75
80
|
/** Whether the rail is open as a drawer: a parent pauses its own page keys while it is. */
|
|
76
81
|
export const isOpen = (model) => __foldkitBrandViewResult((model.isOpen), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#isOpen");
|
|
77
82
|
const openButtonId = (model) => __foldkitBrandViewResult((`${model.id}-open`), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#openButtonId");
|
|
83
|
+
const toggleId = (model) => __foldkitBrandViewResult((`${model.id}-toggle`), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#toggleId");
|
|
78
84
|
// COMMAND
|
|
79
85
|
const FOCUSABLE = "a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]";
|
|
80
86
|
const findRail = (railId) => __foldkitBrandViewResult((Effect.suspend(() => __foldkitBrandViewResult((Effect.fromNullishOr(document.querySelector(`#${CSS.escape(railId)}`))), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous"))), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#findRail");
|
|
81
87
|
/** The drawer's first Tab stop past its head: a control the keyboard reaches, so a tree's
|
|
82
|
-
* items other than its one stop (`tabindex="-1"`) are passed over
|
|
83
|
-
|
|
88
|
+
* items other than its one stop (`tabindex="-1"`) are passed over, and so is the toggle,
|
|
89
|
+
* which the drawer does not print. */
|
|
90
|
+
export const firstTabStop = (rail) => __foldkitBrandViewResult((Array.findFirst(Array.fromIterable(rail.querySelectorAll(`.rail-head ~ * :is(${FOCUSABLE})`)), (control) => __foldkitBrandViewResult((control.tabIndex >= 0 && control.closest("[inert], [hidden], .rail-toggle") === null), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~2"))), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#firstTabStop");
|
|
84
91
|
/** Opens the rail as a drawer over the page and puts focus on its first control past its
|
|
85
92
|
* head. */
|
|
86
93
|
export const ShowRailDrawer = Command.define("ShowRailDrawer", {
|
|
@@ -108,6 +115,22 @@ export const HideRailDrawer = Command.define("HideRailDrawer", {
|
|
|
108
115
|
}
|
|
109
116
|
}).pipe(Effect.ignore, Effect.andThen(isReturningFocus ? Dom.focus(`#${CSS.escape(buttonId)}`).pipe(Effect.ignore) : Effect.void), Effect.as(Message.CompletedHideRailDrawer()))), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#execute~2"),
|
|
110
117
|
});
|
|
118
|
+
/** Puts focus on the rail's toggle once the rail has folded or unfolded, if focus was in the
|
|
119
|
+
* rail or on its splitter: folding takes away every control in it but the toggle, which
|
|
120
|
+
* brings it back, and the splitter with them. Focus anywhere else stays where it is. */
|
|
121
|
+
export const FocusRailToggle = Command.define("FocusRailToggle", {
|
|
122
|
+
args: { railId: Schema.String, toggleId: Schema.String },
|
|
123
|
+
messages: [Message.CompletedFocusRailToggle],
|
|
124
|
+
execute: ({ railId, toggleId: buttonId }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
125
|
+
// NOTE: read before the fold renders, which takes away the control focus is on
|
|
126
|
+
const rail = yield* findRail(railId);
|
|
127
|
+
const active = document.activeElement;
|
|
128
|
+
const isOnSplitter = active?.matches(`.rail-resize[aria-controls="${CSS.escape(railId)}"]`) ?? false;
|
|
129
|
+
if (rail.contains(active) || isOnSplitter) {
|
|
130
|
+
yield* Dom.focus(`#${CSS.escape(buttonId)}`);
|
|
131
|
+
}
|
|
132
|
+
}).pipe(Effect.ignore, Effect.as(Message.CompletedFocusRailToggle()))), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#execute~3"),
|
|
133
|
+
});
|
|
111
134
|
const closeDrawer = (model, isReturningFocus) => __foldkitBrandViewResult((model.isOpen
|
|
112
135
|
? {
|
|
113
136
|
model: modifyFields(model, { isOpen: () => __foldkitBrandViewResult((false), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#isOpen~2") }),
|
|
@@ -123,16 +146,25 @@ const open = (model) => (__foldkitBrandViewResult(({
|
|
|
123
146
|
}), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#open"));
|
|
124
147
|
/** Closes the rail's drawer, focus back on its button. */
|
|
125
148
|
export const close = (model) => __foldkitBrandViewResult((closeDrawer(model, true)), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#close");
|
|
149
|
+
/** Folds or unfolds the rail from a key of the parent's: the parent flips whether it keeps the
|
|
150
|
+
* rail hidden, as it does for `ToggledRail`, and folds this in, which moves focus in the rail
|
|
151
|
+
* onto the toggle. */
|
|
152
|
+
export const toggle = (model) => (__foldkitBrandViewResult(({
|
|
153
|
+
model,
|
|
154
|
+
commands: [FocusRailToggle({ railId: model.id, toggleId: toggleId(model) })],
|
|
155
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#toggle"));
|
|
126
156
|
const withResizing = (model, maybeResizing) => __foldkitBrandViewResult((modifyFields(model, { maybeResizing: () => __foldkitBrandViewResult((maybeResizing), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#maybeResizing") })), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#withResizing");
|
|
127
157
|
/** The width a dragged splitter previews with the pointer at `clientX`. */
|
|
128
158
|
const dragTo = (model, clientX) => __foldkitBrandViewResult((withResizing(model, Option.map(model.maybeResizing, (resizing) => (__foldkitBrandViewResult(({
|
|
129
159
|
...resizing,
|
|
130
160
|
width: bounded(resizing.fromWidth + clientX - resizing.pressX),
|
|
131
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~
|
|
161
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~8"))))), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#dragTo");
|
|
132
162
|
/** Processes a rail Message and returns the next Model, Commands and OutMessage: a splitter let
|
|
133
|
-
* go where it changes the width, or stepped by a key, asks for the width
|
|
163
|
+
* go where it changes the width, or stepped by a key, asks for the width, and the toggle asks
|
|
164
|
+
* to fold or unfold the rail. */
|
|
134
165
|
export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
135
166
|
ClickedOpen: () => __foldkitBrandViewResult((open(model)), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#ClickedOpen"),
|
|
167
|
+
ClickedToggle: () => (__foldkitBrandViewResult(({ ...toggle(model), outMessage: OutMessage.ToggledRail() }), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#ClickedToggle")),
|
|
136
168
|
PressedSplitter: ({ pointerId, clientX, width }) => __foldkitBrandViewResult((Option.isSome(model.maybeResizing)
|
|
137
169
|
? { model }
|
|
138
170
|
: {
|
|
@@ -158,18 +190,19 @@ export const update = (model, message) => __foldkitBrandViewResult((Message.matc
|
|
|
158
190
|
WidenedPastDrawer: () => __foldkitBrandViewResult((closeDrawer(model, false)), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#WidenedPastDrawer"),
|
|
159
191
|
CompletedShowRailDrawer: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#CompletedShowRailDrawer")),
|
|
160
192
|
CompletedHideRailDrawer: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#CompletedHideRailDrawer")),
|
|
193
|
+
CompletedFocusRailToggle: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#CompletedFocusRailToggle")),
|
|
161
194
|
})), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#update");
|
|
162
195
|
/** The width at and under which the rail is a drawer, as the stylesheet has it. */
|
|
163
|
-
const DRAWER_QUERY = "(max-width: 900px)";
|
|
196
|
+
export const DRAWER_QUERY = "(max-width: 900px)";
|
|
164
197
|
/** The window crossing the drawer's width: growing past it while the drawer is open closes
|
|
165
198
|
* the drawer, since the rail is back in the page there. */
|
|
166
199
|
export const widthChangeMessage = (isDrawerWidth, isDrawerOpen) => __foldkitBrandViewResult((!isDrawerWidth && isDrawerOpen ? Option.some(Message.WidenedPastDrawer()) : Option.none()), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#widthChangeMessage");
|
|
167
200
|
/** The browser closing the drawer (Escape, a press on the veil); a toggle that opened it says
|
|
168
201
|
* nothing. */
|
|
169
|
-
export const drawerToggleMessage = (event) => __foldkitBrandViewResult((Option.liftPredicate(Message.ClosedDrawer(), () => __foldkitBrandViewResult((event.newState === "closed"), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~
|
|
202
|
+
export const drawerToggleMessage = (event) => __foldkitBrandViewResult((Option.liftPredicate(Message.ClosedDrawer(), () => __foldkitBrandViewResult((event.newState === "closed"), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~9"))), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#drawerToggleMessage");
|
|
170
203
|
/** Focus leaving the drawer while it is open (`isDrawerOpen`, the rail matching
|
|
171
204
|
* `:popover-open`); focus moving inside it says nothing. */
|
|
172
|
-
export const drawerFocusOutMessage = (rail, event, isDrawerOpen) => __foldkitBrandViewResult((Option.liftPredicate(Message.BlurredDrawer(), () => __foldkitBrandViewResult((isDrawerOpen && event.relatedTarget instanceof Node && !rail.contains(event.relatedTarget)), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~
|
|
205
|
+
export const drawerFocusOutMessage = (rail, event, isDrawerOpen) => __foldkitBrandViewResult((Option.liftPredicate(Message.BlurredDrawer(), () => __foldkitBrandViewResult((isDrawerOpen && event.relatedTarget instanceof Node && !rail.contains(event.relatedTarget)), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~10"))), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#drawerFocusOutMessage");
|
|
173
206
|
/** Follows the drawer the browser shows: the browser closing it (Escape, a press on the
|
|
174
207
|
* veil), focus leaving it while it is open, and the window growing past its width while it
|
|
175
208
|
* is open, each of which closes the rail. */
|
|
@@ -190,17 +223,17 @@ export const FollowRailDrawer = Mount.defineStream("FollowRailDrawer", {
|
|
|
190
223
|
const fromWidth = Dom.streamFromMediaQuery({
|
|
191
224
|
query: DRAWER_QUERY,
|
|
192
225
|
mapMatches: (isDrawerWidth) => __foldkitBrandViewResult((widthChangeMessage(isDrawerWidth, isDrawerOpen())), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#mapMatches"),
|
|
193
|
-
}).pipe(Stream.filter(Option.isSome), Stream.map(({ value }) => __foldkitBrandViewResult((value), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~
|
|
226
|
+
}).pipe(Stream.filter(Option.isSome), Stream.map(({ value }) => __foldkitBrandViewResult((value), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~11")));
|
|
194
227
|
return __foldkitBrandViewResult((Stream.mergeAll([fromToggle, fromFocusOut, fromWidth], {
|
|
195
228
|
concurrency: "unbounded",
|
|
196
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#execute~
|
|
229
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#execute~4");
|
|
197
230
|
},
|
|
198
231
|
});
|
|
199
232
|
// SUBSCRIPTION
|
|
200
233
|
const railSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResult(({
|
|
201
234
|
resize: entry({ maybePointerId: Schema.Option(Schema.Number) }, {
|
|
202
235
|
modelToDependencies: (model) => (__foldkitBrandViewResult(({
|
|
203
|
-
maybePointerId: Option.map(model.maybeResizing, ({ pointerId }) => __foldkitBrandViewResult((pointerId), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~
|
|
236
|
+
maybePointerId: Option.map(model.maybeResizing, ({ pointerId }) => __foldkitBrandViewResult((pointerId), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~13")),
|
|
204
237
|
}), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#modelToDependencies")),
|
|
205
238
|
dependenciesToStream: ({ maybePointerId }) => __foldkitBrandViewResult((Option.match(maybePointerId, {
|
|
206
239
|
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#onNone~2"),
|
|
@@ -215,17 +248,18 @@ const railSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResu
|
|
|
215
248
|
modelToDependencies: (model) => (__foldkitBrandViewResult(({ isResizing: Option.isSome(model.maybeResizing) }), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#modelToDependencies~2")),
|
|
216
249
|
dependenciesToStream: ({ isResizing }) => __foldkitBrandViewResult((isResizing ? escapeKeys(Message.PressedEscape()) : Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#dependenciesToStream~2"),
|
|
217
250
|
}),
|
|
218
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~
|
|
251
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~12")));
|
|
219
252
|
/** A dragged splitter follows the pointer, and Escape puts it back before a dialog or the
|
|
220
253
|
* page sees it, from listeners that run only while it is dragged. Lift them into the
|
|
221
254
|
* application's Subscriptions behind a key prefix of the parent's: `subscriptions("rail")` is
|
|
222
255
|
* keyed `railResize` and `railEscape`. */
|
|
223
256
|
export const subscriptions = (keyPrefix) => __foldkitBrandViewResult((prefixKeys(keyPrefix, railSubscriptions)), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#subscriptions");
|
|
224
257
|
/**
|
|
225
|
-
* A column of panels beside the deck, fixed under the top bar
|
|
226
|
-
* `
|
|
227
|
-
*
|
|
228
|
-
*
|
|
258
|
+
* A column of panels beside the deck, fixed under the top bar: `div.railed >` the deck, then
|
|
259
|
+
* `aside.rail[popover="auto"][aria-label]`, then its splitter, `div.rail-resize[role="separator"]`,
|
|
260
|
+
* on its right edge. What comes before its last panel keeps its height, and the last panel
|
|
261
|
+
* shrinks to the room left, its bar and foot staying while its body scrolls. One element
|
|
262
|
+
* serves both layouts, so nothing in it renders twice or loses its state. At 900px and under it leaves the page, and
|
|
229
263
|
* `span.rail-open > button.btn.small` at the top of the deck opens the same element as a drawer
|
|
230
264
|
* over a veil, its head (the name and a close glyph) showing. Opening focuses its first
|
|
231
265
|
* control; Escape, a press on the veil, the close glyph, focus leaving or the window growing
|
|
@@ -233,18 +267,25 @@ export const subscriptions = (keyPrefix) => __foldkitBrandViewResult((prefixKeys
|
|
|
233
267
|
*
|
|
234
268
|
* Its splitter sizes it, by a pointer (previewed as it moves) or the side arrows, within its
|
|
235
269
|
* bounds, and reports the width as `ResizedRail` for the parent to keep and pass back as
|
|
236
|
-
* `maybeWidth`, which the view sets as `--
|
|
237
|
-
* rail's width follow it. The drawer keeps its own width. Lift
|
|
238
|
-
* the application's, or a dragged splitter follows nothing.
|
|
270
|
+
* `maybeWidth`, which the view sets as `--railed-width` on `div.railed`, so the page's padding
|
|
271
|
+
* and the rail's width follow it (without one, `--rail`). The drawer keeps its own width. Lift
|
|
272
|
+
* `subscriptions(keyPrefix)` into the application's, or a dragged splitter follows nothing.
|
|
273
|
+
*
|
|
274
|
+
* Its toggle, `span.rail-toggle > button.iconbtn.quiet[aria-expanded]` ("Hide <label>"), comes
|
|
275
|
+
* to `toAsideView` to print as the first panel's `lead`. Pressed, it reports `ToggledRail` for
|
|
276
|
+
* the parent to keep and pass back as `isHidden`: `div.railed.folded` then stands the first
|
|
277
|
+
* panel's title bar on end on the ground (the toggle at its top, "Show <label>"), the rest of
|
|
278
|
+
* the rail and its splitter gone, and the deck takes the width. Focus in the rail lands on the
|
|
279
|
+
* toggle. The drawer, at 900px and under, prints neither the toggle nor the fold.
|
|
239
280
|
*
|
|
240
281
|
* Its state is its own, not `@foldkit/ui`'s Popover: that panel is placed by Floating UI and
|
|
241
282
|
* rendered only while open, and this one is always in the page, placed by the stylesheet, and
|
|
242
283
|
* opened as a native popover so the browser keeps it in the top layer.
|
|
243
284
|
*/
|
|
244
285
|
export const view = defineView((model, viewInputs, h) => {
|
|
245
|
-
const { label, toAsideView, toDeckView } = viewInputs;
|
|
246
|
-
const maybeWidth = Option.orElse(Option.map(model.maybeResizing, ({ width }) => __foldkitBrandViewResult((width), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~
|
|
247
|
-
const width = Option.getOrElse(maybeWidth, () => __foldkitBrandViewResult((WIDTH.start), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~
|
|
286
|
+
const { label, isHidden, maybeToggleKeyHint, toAsideView, toDeckView } = viewInputs;
|
|
287
|
+
const maybeWidth = Option.orElse(Option.map(model.maybeResizing, ({ width }) => __foldkitBrandViewResult((width), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~15")), () => __foldkitBrandViewResult((Option.map(viewInputs.maybeWidth, bounded)), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~16"));
|
|
288
|
+
const width = Option.getOrElse(maybeWidth, () => __foldkitBrandViewResult((WIDTH.start), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~17"));
|
|
248
289
|
const openButton = h.span([h.Class("rail-open")], [
|
|
249
290
|
Button.view({
|
|
250
291
|
label,
|
|
@@ -258,11 +299,43 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
258
299
|
],
|
|
259
300
|
}, h),
|
|
260
301
|
]);
|
|
302
|
+
const toggleButton = h.span([h.Class("rail-toggle")], [
|
|
303
|
+
IconButton.view({
|
|
304
|
+
glyph: "sidebar",
|
|
305
|
+
label: `${isHidden ? "Show" : "Hide"} ${label}`,
|
|
306
|
+
isQuiet: true,
|
|
307
|
+
onClick: Message.ClickedToggle(),
|
|
308
|
+
...Option.match(maybeToggleKeyHint, {
|
|
309
|
+
onNone: () => (__foldkitBrandViewResult(({}), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#onNone~3")),
|
|
310
|
+
onSome: (keyHint) => (__foldkitBrandViewResult(({ keyHint }), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#onSome~3")),
|
|
311
|
+
}),
|
|
312
|
+
attributes: [h.Id(toggleId(model)), h.AriaExpanded(!isHidden), h.AriaControls(model.id)],
|
|
313
|
+
}, h),
|
|
314
|
+
]);
|
|
315
|
+
const splitter = h.div([
|
|
316
|
+
h.Class("rail-resize"),
|
|
317
|
+
h.Role("separator"),
|
|
318
|
+
h.AriaLabel(`Width of ${label}`),
|
|
319
|
+
h.AriaControls(model.id),
|
|
320
|
+
h.AriaValuemin(WIDTH.least),
|
|
321
|
+
h.AriaValuemax(WIDTH.most),
|
|
322
|
+
h.AriaValuenow(width),
|
|
323
|
+
h.AriaValuetext(`${width} pixels`),
|
|
324
|
+
h.Tabindex(0),
|
|
325
|
+
...splitterAttributes({
|
|
326
|
+
orientation: "vertical",
|
|
327
|
+
isIdle: Option.isNone(model.maybeResizing),
|
|
328
|
+
onPress: (pointerId, clientX) => __foldkitBrandViewResult((Message.PressedSplitter({ pointerId, clientX, width })), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#onPress"),
|
|
329
|
+
onStep: (direction) => __foldkitBrandViewResult((Message.PressedSplitterKey({ width: width + direction * WIDTH.step })), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#onStep"),
|
|
330
|
+
}, h),
|
|
331
|
+
]);
|
|
261
332
|
// NOTE: the deck comes first so the page's main content, and its h1, precede the rail's
|
|
262
333
|
// panels in reading order; the stylesheet places the rail, fixed, at the left.
|
|
263
334
|
return __foldkitBrandViewResult((h.div([
|
|
264
|
-
h.Class("railed"),
|
|
265
|
-
...
|
|
335
|
+
h.Class(isHidden ? "railed folded" : "railed"),
|
|
336
|
+
...(isHidden
|
|
337
|
+
? []
|
|
338
|
+
: Array.fromOption(Option.map(maybeWidth, (shown) => __foldkitBrandViewResult((h.Style({ "--railed-width": `${shown}px` })), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~18")))),
|
|
266
339
|
], [
|
|
267
340
|
toDeckView(openButton),
|
|
268
341
|
h.aside([
|
|
@@ -276,24 +349,8 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
276
349
|
h.span([h.Class("label")], [label]),
|
|
277
350
|
IconButton.view({ glyph: "cross", label: "Close", onClick: Message.ClickedClose() }, h),
|
|
278
351
|
]),
|
|
279
|
-
...toAsideView(),
|
|
280
|
-
]),
|
|
281
|
-
h.div([
|
|
282
|
-
h.Class("rail-resize"),
|
|
283
|
-
h.Role("separator"),
|
|
284
|
-
h.AriaLabel(`Width of ${label}`),
|
|
285
|
-
h.AriaControls(model.id),
|
|
286
|
-
h.AriaValuemin(WIDTH.least),
|
|
287
|
-
h.AriaValuemax(WIDTH.most),
|
|
288
|
-
h.AriaValuenow(width),
|
|
289
|
-
h.AriaValuetext(`${width} pixels`),
|
|
290
|
-
h.Tabindex(0),
|
|
291
|
-
...splitterAttributes({
|
|
292
|
-
orientation: "vertical",
|
|
293
|
-
isIdle: Option.isNone(model.maybeResizing),
|
|
294
|
-
onPress: (pointerId, clientX) => __foldkitBrandViewResult((Message.PressedSplitter({ pointerId, clientX, width })), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#onPress"),
|
|
295
|
-
onStep: (direction) => __foldkitBrandViewResult((Message.PressedSplitterKey({ width: width + direction * WIDTH.step })), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#onStep"),
|
|
296
|
-
}, h),
|
|
352
|
+
...toAsideView(toggleButton),
|
|
297
353
|
]),
|
|
298
|
-
|
|
354
|
+
...(isHidden ? [] : [splitter]),
|
|
355
|
+
])), "@gjermundgaraba-designs/pixel-paper/src/rail/rail.js#anonymous~14");
|
|
299
356
|
});
|
|
@@ -122,6 +122,9 @@ export declare const firstPlace: (layout: Layout) => Option.Option<Place>;
|
|
|
122
122
|
* for it. A request naming a pane or column the layout no longer has changes nothing.
|
|
123
123
|
*/
|
|
124
124
|
export declare const apply: (layout: Layout, request: OutMessage) => Layout;
|
|
125
|
+
/** Whether `request` changes `layout`: a move, a drop or a stop that would leave it as it is
|
|
126
|
+
* is passed over. */
|
|
127
|
+
export declare const isChange: (layout: Layout, request: OutMessage) => boolean;
|
|
125
128
|
export declare const widthWords: (width: number) => string;
|
|
126
129
|
/** The next preset wider than `width`, or the narrowest past the widest. */
|
|
127
130
|
export declare const nextPreset: (width: number) => number;
|
|
@@ -152,19 +155,20 @@ export declare const isTargetPresent: (layout: Layout, target: Target) => boolea
|
|
|
152
155
|
* with nothing further that way, it stays (where the pane started, if the target's column has
|
|
153
156
|
* gone). */
|
|
154
157
|
export declare const steppedTarget: (layout: Layout, paneId: string, target: Target, step: Step) => Target;
|
|
155
|
-
/** A column as a pointer reads it: its id
|
|
156
|
-
* of its slots, the held pane's left out. */
|
|
158
|
+
/** A column as a pointer reads it: its id and its left and right edges. */
|
|
157
159
|
export type ColumnBox = Readonly<{
|
|
158
160
|
id: string;
|
|
159
161
|
left: number;
|
|
160
162
|
right: number;
|
|
161
|
-
slotMiddles: ReadonlyArray<number>;
|
|
162
163
|
}>;
|
|
163
164
|
/** Where a pointer at (`clientX`, `clientY`) over a reel whose columns sit at `columns`, left
|
|
164
165
|
* to right, would drop a pane. Over a column's edge band (or over a gap, or past the last
|
|
165
166
|
* column) it lands in that gap, as a column of its own; over the rest of a column it lands
|
|
166
|
-
* among that column's other panes, after each whose middle is above the pointer.
|
|
167
|
-
|
|
167
|
+
* among that column's other panes, after each whose middle is above the pointer.
|
|
168
|
+
* `slotMiddlesOf` gives the vertical middles of a column's slots, by its index, the held
|
|
169
|
+
* pane's left out: it is asked for the column the pointer is over alone, and only when the
|
|
170
|
+
* pointer is among its panes. */
|
|
171
|
+
export declare const targetAtPoint: (columns: ReadonlyArray<ColumnBox>, clientX: number, clientY: number, slotMiddlesOf: (index: number) => ReadonlyArray<number>) => Target;
|
|
168
172
|
/** What moving `splitter` by `share` asks of the layout, from the sizes the layout holds (not
|
|
169
173
|
* the sizes printed, which the stylesheet may hold at a minimum): a width splitter adds
|
|
170
174
|
* `share` to its column's width; a pane splitter moves `share` of its column's height from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/reel/layout.ts"],"names":[],"mappings":"AAGA,OAAO,EAA+B,MAAM,EAAqB,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAQ9F;;sEAEsE;AACtE,eAAO,MAAM,IAAI;;;;EAIf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC;AAEpC;;;oFAGoF;AACpF,eAAO,MAAM,MAAM;;;;;;;;EAIjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAA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AAC;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAKH;;;;;;kCAMkC;AAClC,eAAO,MAAM,aAAa,YACf,aAAa,CAAC,SAAS,CAAC,WACxB,MAAM,WACN,MAAM,iBACA,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,CAAC,MAAM,CAAC,KACtD,MAoBA,CAAC;AAuBJ;;;;+CAI+C;AAC/C,eAAO,MAAM,QAAQ,WACX,MAAM,YACJ,QAAQ,SACX,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,MAAM,CAmCnB,CAAC;AAEL,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,WAAY,MAAM,YAAY,QAAQ,KAAG,OACzB,CAAC"}
|
package/dist/src/reel/layout.js
CHANGED
|
@@ -158,6 +158,9 @@ export const apply = (layout, request) => __foldkitBrandViewResult((OutMessage.m
|
|
|
158
158
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~18"))),
|
|
159
159
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~17")))), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#ResizedPanes"),
|
|
160
160
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#apply");
|
|
161
|
+
/** Whether `request` changes `layout`: a move, a drop or a stop that would leave it as it is
|
|
162
|
+
* is passed over. */
|
|
163
|
+
export const isChange = (layout, request) => __foldkitBrandViewResult((!Equal.equals(apply(layout, request), layout)), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#isChange");
|
|
161
164
|
// WIDTHS
|
|
162
165
|
/** How close a width is to a preset to count as it. */
|
|
163
166
|
const PRESET_TOLERANCE = 0.01;
|
|
@@ -216,7 +219,7 @@ export const originOf = (layout, paneId) => __foldkitBrandViewResult((Option.map
|
|
|
216
219
|
export const requestOf = (layout, paneId, target) => __foldkitBrandViewResult((Option.liftPredicate(Target.match(target, {
|
|
217
220
|
Into: ({ columnId, index }) => __foldkitBrandViewResult((OutMessage.MovedPane({ paneId, toColumnId: columnId, toIndex: index })), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#Into"),
|
|
218
221
|
Gap: ({ maybeBeforeColumnId }) => __foldkitBrandViewResult((OutMessage.PulledOutPane({ paneId, maybeBeforeColumnId })), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#Gap"),
|
|
219
|
-
}), (request) => __foldkitBrandViewResult((
|
|
222
|
+
}), (request) => __foldkitBrandViewResult((isChange(layout, request)), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~29"))), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#requestOf");
|
|
220
223
|
/** Where the pane `paneId` would be once dropped at `target`, in words. */
|
|
221
224
|
export const landingWords = (layout, paneId, target) => __foldkitBrandViewResult((Option.match(requestOf(layout, paneId, target), {
|
|
222
225
|
onNone: () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#onNone~7"),
|
|
@@ -295,10 +298,13 @@ const gapBefore = (columns, gap) => __foldkitBrandViewResult((Target.Gap({ maybe
|
|
|
295
298
|
/** Where a pointer at (`clientX`, `clientY`) over a reel whose columns sit at `columns`, left
|
|
296
299
|
* to right, would drop a pane. Over a column's edge band (or over a gap, or past the last
|
|
297
300
|
* column) it lands in that gap, as a column of its own; over the rest of a column it lands
|
|
298
|
-
* among that column's other panes, after each whose middle is above the pointer.
|
|
299
|
-
|
|
301
|
+
* among that column's other panes, after each whose middle is above the pointer.
|
|
302
|
+
* `slotMiddlesOf` gives the vertical middles of a column's slots, by its index, the held
|
|
303
|
+
* pane's left out: it is asked for the column the pointer is over alone, and only when the
|
|
304
|
+
* pointer is among its panes. */
|
|
305
|
+
export const targetAtPoint = (columns, clientX, clientY, slotMiddlesOf) => __foldkitBrandViewResult((pipe(Array.findFirstIndex(columns, ({ right }) => __foldkitBrandViewResult((clientX <= right), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~42")), Option.flatMap((index) => __foldkitBrandViewResult((Option.map(Array.get(columns, index), (box) => (__foldkitBrandViewResult(({ index, box }), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~44")))), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~43")), Option.match({
|
|
300
306
|
onNone: () => __foldkitBrandViewResult((gapBefore(columns, columns.length)), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#onNone~11"),
|
|
301
|
-
onSome: ({ index, box: { id, left, right
|
|
307
|
+
onSome: ({ index, box: { id, left, right } }) => {
|
|
302
308
|
const band = Math.min((right - left) * EDGE_SHARE, EDGE_MAX);
|
|
303
309
|
if (clientX < left + band) {
|
|
304
310
|
return __foldkitBrandViewResult((gapBefore(columns, index)), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#onSome~11");
|
|
@@ -309,7 +315,7 @@ export const targetAtPoint = (columns, clientX, clientY) => __foldkitBrandViewRe
|
|
|
309
315
|
else {
|
|
310
316
|
return __foldkitBrandViewResult((Target.Into({
|
|
311
317
|
columnId: id,
|
|
312
|
-
index: Array.filter(
|
|
318
|
+
index: Array.filter(slotMiddlesOf(index), (middle) => __foldkitBrandViewResult((middle < clientY), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#anonymous~45")).length,
|
|
313
319
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/layout.js#onSome~11");
|
|
314
320
|
}
|
|
315
321
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reel.d.ts","sourceRoot":"","sources":["../../../src/reel/reel.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"reel.d.ts","sourceRoot":"","sources":["../../../src/reel/reel.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAIN,MAAM,EAGN,MAAM,EAGP,MAAM,QAAQ,CAAC;AAChB,OAAO,KAA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