@gjermundgaraba-designs/pixel-paper 0.24.0 → 0.26.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 +3 -1
- package/dist/src/reel/index.d.ts +1 -1
- package/dist/src/reel/index.d.ts.map +1 -1
- package/dist/src/reel/index.js +1 -1
- package/dist/src/reel/reel.d.ts +85 -7
- package/dist/src/reel/reel.d.ts.map +1 -1
- package/dist/src/reel/reel.js +232 -115
- package/dist/src/toast/stack.d.ts +52 -52
- package/package.json +10 -10
- package/src/pixel-paper.css +48 -0
- package/src/reel/index.ts +2 -0
- package/src/reel/reel.ts +221 -31
package/dist/src/reel/reel.js
CHANGED
|
@@ -28,6 +28,7 @@ const COPY = {
|
|
|
28
28
|
widthLabel: "Width of column {column}",
|
|
29
29
|
heightLabel: "Height of {pane}",
|
|
30
30
|
focused: "{pane}, {where}.",
|
|
31
|
+
focusedTab: "{pane}, tab {tab} of {tabs}.",
|
|
31
32
|
moved: "{subject} moved to {where}.",
|
|
32
33
|
widened: "Column {column} takes {width}.",
|
|
33
34
|
pickedUp: "Picked up {subject}.",
|
|
@@ -75,6 +76,10 @@ export const Model = Schema.Struct({
|
|
|
75
76
|
maybeHeld: Schema.Option(Held),
|
|
76
77
|
maybeResizing: Schema.Option(Resizing),
|
|
77
78
|
});
|
|
79
|
+
/** How a reel shows its panes: side by side in their columns (`Strip`), or one at a time at
|
|
80
|
+
* the reel's full size under a tab per pane (`Tabs`). The application holds it and passes it
|
|
81
|
+
* in; the layout is the same in both. */
|
|
82
|
+
export const Arrangement = Schema.Literals(["Strip", "Tabs"]);
|
|
78
83
|
// MESSAGE
|
|
79
84
|
const PointerAt = Schema.Struct({
|
|
80
85
|
clientX: Schema.Number,
|
|
@@ -98,6 +103,8 @@ export const Message = defineMessageUnion({
|
|
|
98
103
|
LeftGrip: {},
|
|
99
104
|
PressedEscape: {},
|
|
100
105
|
FocusedPane: { paneId: Schema.String },
|
|
106
|
+
PressedTab: { paneId: Schema.String },
|
|
107
|
+
SteppedTab: { paneId: Schema.String },
|
|
101
108
|
PressedSplitter: {
|
|
102
109
|
splitter: Splitter,
|
|
103
110
|
pointerId: Schema.Number,
|
|
@@ -110,6 +117,7 @@ export const Message = defineMessageUnion({
|
|
|
110
117
|
PressedSplitterKey: { splitter: Splitter, share: Schema.Number },
|
|
111
118
|
CompletedAnnounceReel: {},
|
|
112
119
|
CompletedFocusPane: {},
|
|
120
|
+
CompletedFocusTab: {},
|
|
113
121
|
CompletedRestoreFocus: {},
|
|
114
122
|
CompletedScrollIntoView: {},
|
|
115
123
|
CompletedSizeLiftedPane: {},
|
|
@@ -141,6 +149,7 @@ const isCarried = (held) => __foldkitBrandViewResult((By.match(held.by, { Pointe
|
|
|
141
149
|
// DOM HOOKS
|
|
142
150
|
const paneHook = (model, paneId) => __foldkitBrandViewResult((`${model.id}/pane/${paneId}`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#paneHook");
|
|
143
151
|
const columnHook = (model, columnId) => __foldkitBrandViewResult((`${model.id}/column/${columnId}`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#columnHook");
|
|
152
|
+
const tabHook = (model, paneId) => __foldkitBrandViewResult((`${model.id}/tab/${paneId}`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#tabHook");
|
|
144
153
|
const scrollerOf = (reelHook) => __foldkitBrandViewResult((Option.fromNullishOr(document.querySelector(`[data-reel="${CSS.escape(reelHook)}"] > .reel-view`))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#scrollerOf");
|
|
145
154
|
const paneElement = (hook) => __foldkitBrandViewResult((Option.fromNullishOr(document.querySelector(`[data-reel-pane="${CSS.escape(hook)}"]`))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#paneElement");
|
|
146
155
|
/** Puts the keyboard in `pane`: on its control marked `data-reel-focus` (a terminal's input),
|
|
@@ -170,6 +179,19 @@ export const FocusPane = Command.define("FocusPane", {
|
|
|
170
179
|
return __foldkitBrandViewResult((Message.CompletedFocusPane()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~6");
|
|
171
180
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~2"),
|
|
172
181
|
});
|
|
182
|
+
/** Focuses the tab `tabHook` names, for a tab the arrows step to: the keyboard stays in the
|
|
183
|
+
* tab list until the reader goes into the pane. */
|
|
184
|
+
export const FocusTab = Command.define("FocusTab", {
|
|
185
|
+
args: { tabHook: Schema.String },
|
|
186
|
+
messages: [Message.CompletedFocusTab],
|
|
187
|
+
execute: ({ tabHook: hook }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
188
|
+
yield* Render.afterCommit;
|
|
189
|
+
yield* Effect.sync(() => {
|
|
190
|
+
document.querySelector(`[data-reel-tab="${CSS.escape(hook)}"]`)?.focus();
|
|
191
|
+
});
|
|
192
|
+
return __foldkitBrandViewResult((Message.CompletedFocusTab()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~9");
|
|
193
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~3"),
|
|
194
|
+
});
|
|
173
195
|
/** Focuses the pane `paneHook` names only where focus was lost (it left with the pane that
|
|
174
196
|
* held it), so focus the reader put somewhere else stays there. */
|
|
175
197
|
export const RestoreFocus = Command.define("RestoreFocus", {
|
|
@@ -183,8 +205,8 @@ export const RestoreFocus = Command.define("RestoreFocus", {
|
|
|
183
205
|
Option.map(paneElement(hook), focusInto);
|
|
184
206
|
}
|
|
185
207
|
});
|
|
186
|
-
return __foldkitBrandViewResult((Message.CompletedRestoreFocus()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
187
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~
|
|
208
|
+
return __foldkitBrandViewResult((Message.CompletedRestoreFocus()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~11");
|
|
209
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~4"),
|
|
188
210
|
});
|
|
189
211
|
/** Scrolls the pane or column `hook` names into view, by the least distance either way, its
|
|
190
212
|
* gutter kept by the stylesheet's `scroll-margin`, once the render that placed it is in the
|
|
@@ -199,8 +221,8 @@ export const ScrollIntoView = Command.define("ScrollIntoView", {
|
|
|
199
221
|
.querySelector(`[data-reel-pane="${CSS.escape(hook)}"], [data-reel-hook="${CSS.escape(hook)}"]`)
|
|
200
222
|
?.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
201
223
|
});
|
|
202
|
-
return __foldkitBrandViewResult((Message.CompletedScrollIntoView()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
203
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~
|
|
224
|
+
return __foldkitBrandViewResult((Message.CompletedScrollIntoView()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~13");
|
|
225
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~5"),
|
|
204
226
|
});
|
|
205
227
|
/** How far a pointer moves from its press before it carries what it pressed. */
|
|
206
228
|
const CARRY_THRESHOLD = 5;
|
|
@@ -210,9 +232,9 @@ const focusOn = (model, place) => __foldkitBrandViewResult((modifyFields(model,
|
|
|
210
232
|
maybeFocus: () => __foldkitBrandViewResult((Option.some({ paneId: place.pane.id, column: place.columnIndex, row: place.row })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#maybeFocus"),
|
|
211
233
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#focusOn");
|
|
212
234
|
const announce = (text) => __foldkitBrandViewResult((AnnounceReel({ text })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#announce");
|
|
213
|
-
const heldLabel = (layout, held) => __foldkitBrandViewResult((Option.getOrElse(subjectWords(layout, Subject.Pane({ paneId: held.paneId })), () => __foldkitBrandViewResult((""), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
235
|
+
const heldLabel = (layout, held) => __foldkitBrandViewResult((Option.getOrElse(subjectWords(layout, Subject.Pane({ paneId: held.paneId })), () => __foldkitBrandViewResult((""), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~15"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#heldLabel");
|
|
214
236
|
const heldWords = (layout, held) => __foldkitBrandViewResult((String.capitalize(heldLabel(layout, held))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#heldWords");
|
|
215
|
-
const scrollToTarget = (model, layout, target) => __foldkitBrandViewResult((Array.fromOption(Option.map(columnOfTarget(layout, target), (columnId) => __foldkitBrandViewResult((ScrollIntoView({ hook: columnHook(model, columnId) })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
237
|
+
const scrollToTarget = (model, layout, target) => __foldkitBrandViewResult((Array.fromOption(Option.map(columnOfTarget(layout, target), (columnId) => __foldkitBrandViewResult((ScrollIntoView({ hook: columnHook(model, columnId) })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~16")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#scrollToTarget");
|
|
216
238
|
/** Lets go of the held pane: dropped at its target when it is carried and the drop changes
|
|
217
239
|
* something (reported as the request), put back otherwise, said in `putBack`'s words. */
|
|
218
240
|
const letGo = (model, layout, held, putBack) => {
|
|
@@ -221,7 +243,7 @@ const letGo = (model, layout, held, putBack) => {
|
|
|
221
243
|
return __foldkitBrandViewResult(({ model: released }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#letGo");
|
|
222
244
|
}
|
|
223
245
|
const subject = heldWords(layout, held);
|
|
224
|
-
const maybeRequest = Option.flatMap(held.maybeTarget, (target) => __foldkitBrandViewResult((requestOf(layout, held.paneId, target)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
246
|
+
const maybeRequest = Option.flatMap(held.maybeTarget, (target) => __foldkitBrandViewResult((requestOf(layout, held.paneId, target)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~17"));
|
|
225
247
|
return __foldkitBrandViewResult((Option.match(maybeRequest, {
|
|
226
248
|
onNone: () => (__foldkitBrandViewResult(({
|
|
227
249
|
model: released,
|
|
@@ -232,7 +254,7 @@ const letGo = (model, layout, held, putBack) => {
|
|
|
232
254
|
commands: [
|
|
233
255
|
announce(fill(COPY.dropped, {
|
|
234
256
|
subject,
|
|
235
|
-
where: Option.getOrElse(whereWords(apply(layout, request), Subject.Pane({ paneId: held.paneId })), () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
257
|
+
where: Option.getOrElse(whereWords(apply(layout, request), Subject.Pane({ paneId: held.paneId })), () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~18")),
|
|
236
258
|
})),
|
|
237
259
|
],
|
|
238
260
|
outMessage: request,
|
|
@@ -240,7 +262,7 @@ const letGo = (model, layout, held, putBack) => {
|
|
|
240
262
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#letGo");
|
|
241
263
|
};
|
|
242
264
|
const cancel = (model, layout, held) => __foldkitBrandViewResult((letGo(model, layout, { ...held, maybeTarget: Option.none() }, COPY.cancelled)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#cancel");
|
|
243
|
-
const lift = (model, layout, paneId, by) => __foldkitBrandViewResult((Option.match(Option.filter(originOf(layout, paneId), () => __foldkitBrandViewResult((isIdle(model)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
265
|
+
const lift = (model, layout, paneId, by) => __foldkitBrandViewResult((Option.match(Option.filter(originOf(layout, paneId), () => __foldkitBrandViewResult((isIdle(model)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~19")), {
|
|
244
266
|
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~3")),
|
|
245
267
|
onSome: (origin) => {
|
|
246
268
|
const held = { paneId, by, maybeTarget: Option.some(origin) };
|
|
@@ -272,7 +294,7 @@ const movePointer = (model, layout, held, pointer) => __foldkitBrandViewResult((
|
|
|
272
294
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#movePointer");
|
|
273
295
|
/** A keyboard step of what is held, resolved from the layout, with the reel scrolled to the
|
|
274
296
|
* column it lands by. */
|
|
275
|
-
const stepHeld = (model, layout, held, step) => __foldkitBrandViewResult((Option.match(Option.filter(held.maybeTarget, () => __foldkitBrandViewResult((held.by._tag === "Keyboard"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
297
|
+
const stepHeld = (model, layout, held, step) => __foldkitBrandViewResult((Option.match(Option.filter(held.maybeTarget, () => __foldkitBrandViewResult((held.by._tag === "Keyboard"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~20")), {
|
|
276
298
|
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~4")),
|
|
277
299
|
onSome: (target) => {
|
|
278
300
|
const next = steppedTarget(layout, held.paneId, target, step);
|
|
@@ -292,7 +314,7 @@ const stepHeld = (model, layout, held, step) => __foldkitBrandViewResult((Option
|
|
|
292
314
|
},
|
|
293
315
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#stepHeld");
|
|
294
316
|
const whileHeld = (model, f) => __foldkitBrandViewResult((Option.match(model.maybeHeld, { onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~5")), onSome: f })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#whileHeld");
|
|
295
|
-
const whileHeldBy = (model, by, f) => __foldkitBrandViewResult((whileHeld(model, (held) => (__foldkitBrandViewResult((held.by._tag === by ? f(held) : { model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
317
|
+
const whileHeldBy = (model, by, f) => __foldkitBrandViewResult((whileHeld(model, (held) => (__foldkitBrandViewResult((held.by._tag === by ? f(held) : { model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~21")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#whileHeldBy");
|
|
296
318
|
/** The resize a splitter dragged `share` of its scale asks for: previewed while it moves, and
|
|
297
319
|
* asked for when it is let go. */
|
|
298
320
|
const resizeSplitter = (model, layout, share, isLetGo) => __foldkitBrandViewResult((Option.match(model.maybeResizing, {
|
|
@@ -308,6 +330,12 @@ const resizeSplitter = (model, layout, share, isLetGo) => __foldkitBrandViewResu
|
|
|
308
330
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~5");
|
|
309
331
|
},
|
|
310
332
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#resizeSplitter");
|
|
333
|
+
/** Shows the pane `paneId` under its tab and moves the keyboard as `focus` says: into the
|
|
334
|
+
* pane for a press, onto the tab for an arrow. */
|
|
335
|
+
const selectTab = (model, layout, paneId, focus) => __foldkitBrandViewResult((Option.match(placeOf(layout, paneId), {
|
|
336
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~8")),
|
|
337
|
+
onSome: (place) => (__foldkitBrandViewResult(({ model: focusOn(model, place), commands: [focus] }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~7")),
|
|
338
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#selectTab");
|
|
311
339
|
/** Processes a reel Message against the layout as the application holds it now, and returns
|
|
312
340
|
* the next Model, Commands and OutMessage. */
|
|
313
341
|
export const update = (model, message, context) => {
|
|
@@ -322,18 +350,20 @@ export const update = (model, message, context) => {
|
|
|
322
350
|
isCarrying: false,
|
|
323
351
|
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#PressedGrip"),
|
|
324
352
|
PressedGripKey: ({ paneId }) => __foldkitBrandViewResult((lift(model, layout, paneId, By.Keyboard())), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#PressedGripKey"),
|
|
325
|
-
MovedPointer: (pointer) => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((movePointer(model, layout, held, pointer)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
326
|
-
ReleasedPointer: (pointer) => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((letGo(model, layout, isCarried(held) ? { ...held, maybeTarget: pointer.maybeTarget } : held, COPY.putBack)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
327
|
-
CancelledPointer: () => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((letGo(model, layout, { ...held, maybeTarget: Option.none() }, COPY.putBack)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
328
|
-
SteppedHeld: ({ step }) => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((stepHeld(model, layout, held, step)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
329
|
-
DroppedHeld: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((letGo(model, layout, held, COPY.putBack)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
330
|
-
LeftGrip: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
353
|
+
MovedPointer: (pointer) => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((movePointer(model, layout, held, pointer)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~22"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#MovedPointer"),
|
|
354
|
+
ReleasedPointer: (pointer) => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((letGo(model, layout, isCarried(held) ? { ...held, maybeTarget: pointer.maybeTarget } : held, COPY.putBack)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~23"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#ReleasedPointer"),
|
|
355
|
+
CancelledPointer: () => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((letGo(model, layout, { ...held, maybeTarget: Option.none() }, COPY.putBack)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~24"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CancelledPointer"),
|
|
356
|
+
SteppedHeld: ({ step }) => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((stepHeld(model, layout, held, step)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~25"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#SteppedHeld"),
|
|
357
|
+
DroppedHeld: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((letGo(model, layout, held, COPY.putBack)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~26"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#DroppedHeld"),
|
|
358
|
+
LeftGrip: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~27"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#LeftGrip"),
|
|
331
359
|
PressedEscape: () => __foldkitBrandViewResult((Option.isSome(model.maybeResizing)
|
|
332
360
|
? { model: withResizing(model, Option.none()) }
|
|
333
|
-
: whileHeld(model, (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
361
|
+
: whileHeld(model, (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~28"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#PressedEscape"),
|
|
362
|
+
PressedTab: ({ paneId }) => __foldkitBrandViewResult((selectTab(model, layout, paneId, FocusPane({ paneHook: paneHook(model, paneId) }))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#PressedTab"),
|
|
363
|
+
SteppedTab: ({ paneId }) => __foldkitBrandViewResult((selectTab(model, layout, paneId, FocusTab({ tabHook: tabHook(model, paneId) }))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#SteppedTab"),
|
|
364
|
+
FocusedPane: ({ paneId }) => __foldkitBrandViewResult((Option.match(Option.filter(placeOf(layout, paneId), () => __foldkitBrandViewResult((!Option.exists(model.maybeFocus, (focus) => __foldkitBrandViewResult((focus.paneId === paneId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~30"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~29")), {
|
|
365
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~9")),
|
|
366
|
+
onSome: (place) => (__foldkitBrandViewResult(({ model: focusOn(model, place) }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~8")),
|
|
337
367
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#FocusedPane"),
|
|
338
368
|
PressedSplitter: ({ splitter, pointerId, clientX, clientY }) => __foldkitBrandViewResult((!isIdle(model) || !isSplitterPresent(layout, splitter)
|
|
339
369
|
? { model }
|
|
@@ -350,11 +380,12 @@ export const update = (model, message, context) => {
|
|
|
350
380
|
ReleasedSplitter: ({ share }) => __foldkitBrandViewResult((resizeSplitter(model, layout, share, true)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#ReleasedSplitter"),
|
|
351
381
|
CancelledSplitter: () => (__foldkitBrandViewResult(({ model: withResizing(model, Option.none()) }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CancelledSplitter")),
|
|
352
382
|
PressedSplitterKey: ({ splitter, share }) => __foldkitBrandViewResult((Option.match(resizeOf(layout, splitter, share), {
|
|
353
|
-
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
354
|
-
onSome: (resize) => (__foldkitBrandViewResult(({ model, outMessage: resize }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
383
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~10")),
|
|
384
|
+
onSome: (resize) => (__foldkitBrandViewResult(({ model, outMessage: resize }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~9")),
|
|
355
385
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#PressedSplitterKey"),
|
|
356
386
|
CompletedAnnounceReel: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedAnnounceReel")),
|
|
357
387
|
CompletedFocusPane: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedFocusPane")),
|
|
388
|
+
CompletedFocusTab: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedFocusTab")),
|
|
358
389
|
CompletedRestoreFocus: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedRestoreFocus")),
|
|
359
390
|
CompletedScrollIntoView: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedScrollIntoView")),
|
|
360
391
|
CompletedSizeLiftedPane: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedSizeLiftedPane")),
|
|
@@ -371,30 +402,30 @@ export const update = (model, message, context) => {
|
|
|
371
402
|
*/
|
|
372
403
|
export const reconcile = (model, context) => {
|
|
373
404
|
const { layout } = context;
|
|
374
|
-
const isFocusGone = Option.exists(model.maybeFocus, (focus) => __foldkitBrandViewResult((Option.isNone(placeOf(layout, focus.paneId))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
375
|
-
const maybePlace = Option.filter(focusedPlace(model, layout), () => __foldkitBrandViewResult((Option.isSome(model.maybeFocus)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
405
|
+
const isFocusGone = Option.exists(model.maybeFocus, (focus) => __foldkitBrandViewResult((Option.isNone(placeOf(layout, focus.paneId))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~31"));
|
|
406
|
+
const maybePlace = Option.filter(focusedPlace(model, layout), () => __foldkitBrandViewResult((Option.isSome(model.maybeFocus)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~32"));
|
|
376
407
|
const focused = Option.match(maybePlace, {
|
|
377
|
-
onNone: () => __foldkitBrandViewResult((model), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
378
|
-
onSome: (place) => __foldkitBrandViewResult((focusOn(model, place)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
408
|
+
onNone: () => __foldkitBrandViewResult((model), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~11"),
|
|
409
|
+
onSome: (place) => __foldkitBrandViewResult((focusOn(model, place)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~10"),
|
|
379
410
|
});
|
|
380
|
-
const restore = Array.fromOption(Option.map(Option.filter(maybePlace, () => __foldkitBrandViewResult((isFocusGone), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
381
|
-
const settled = Option.exists(model.maybeResizing, ({ splitter }) => __foldkitBrandViewResult((isSplitterPresent(layout, splitter)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
411
|
+
const restore = Array.fromOption(Option.map(Option.filter(maybePlace, () => __foldkitBrandViewResult((isFocusGone), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~33")), (place) => __foldkitBrandViewResult((RestoreFocus({ paneHook: paneHook(model, place.pane.id) })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~34")));
|
|
412
|
+
const settled = Option.exists(model.maybeResizing, ({ splitter }) => __foldkitBrandViewResult((isSplitterPresent(layout, splitter)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~35"))
|
|
382
413
|
? focused
|
|
383
414
|
: withResizing(focused, Option.none());
|
|
384
415
|
return __foldkitBrandViewResult((Option.match(settled.maybeHeld, {
|
|
385
|
-
onNone: () => (__foldkitBrandViewResult(({ model: settled, commands: restore }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
416
|
+
onNone: () => (__foldkitBrandViewResult(({ model: settled, commands: restore }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~12")),
|
|
386
417
|
onSome: (held) => {
|
|
387
418
|
if (Option.isNone(placeOf(layout, held.paneId))) {
|
|
388
419
|
return __foldkitBrandViewResult(({
|
|
389
420
|
model: withHeld(settled, Option.none()),
|
|
390
421
|
commands: [...restore, announce(COPY.gone)],
|
|
391
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
422
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~11");
|
|
392
423
|
}
|
|
393
|
-
const maybeTarget = Option.orElse(Option.filter(held.maybeTarget, (target) => __foldkitBrandViewResult((isTargetPresent(layout, target)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
424
|
+
const maybeTarget = Option.orElse(Option.filter(held.maybeTarget, (target) => __foldkitBrandViewResult((isTargetPresent(layout, target)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~36")), () => (__foldkitBrandViewResult((held.by._tag === "Keyboard" ? originOf(layout, held.paneId) : Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~37")));
|
|
394
425
|
return __foldkitBrandViewResult(({
|
|
395
426
|
model: withHeld(settled, Option.some({ ...held, maybeTarget })),
|
|
396
427
|
commands: restore,
|
|
397
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
428
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~11");
|
|
398
429
|
},
|
|
399
430
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#reconcile");
|
|
400
431
|
};
|
|
@@ -427,13 +458,13 @@ const focusStep = (model, layout, place) => (__foldkitBrandViewResult(({
|
|
|
427
458
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#focusStep"));
|
|
428
459
|
/** Asks for `request` with focus kept on the pane it moves, at its new place, the reel
|
|
429
460
|
* scrolled to it and the move said; nothing where it would change nothing. */
|
|
430
|
-
const requestStep = (model, layout, place, subject, maybeRequest) => __foldkitBrandViewResult((Option.match(Option.filter(maybeRequest, (request) => __foldkitBrandViewResult((isChange(layout, request)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
431
|
-
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
461
|
+
const requestStep = (model, layout, place, subject, maybeRequest) => __foldkitBrandViewResult((Option.match(Option.filter(maybeRequest, (request) => __foldkitBrandViewResult((isChange(layout, request)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~38")), {
|
|
462
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~13")),
|
|
432
463
|
onSome: (request) => {
|
|
433
464
|
const next = apply(layout, request);
|
|
434
|
-
const landing = Option.getOrElse(placeOf(next, place.pane.id), () => __foldkitBrandViewResult((place), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
435
|
-
const words = Option.getOrElse(subjectWords(layout, subject), () => __foldkitBrandViewResult((place.pane.label), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
436
|
-
const where = Option.getOrElse(whereWords(next, subject), () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
465
|
+
const landing = Option.getOrElse(placeOf(next, place.pane.id), () => __foldkitBrandViewResult((place), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~39"));
|
|
466
|
+
const words = Option.getOrElse(subjectWords(layout, subject), () => __foldkitBrandViewResult((place.pane.label), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~40"));
|
|
467
|
+
const where = Option.getOrElse(whereWords(next, subject), () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~41"));
|
|
437
468
|
return __foldkitBrandViewResult(({
|
|
438
469
|
model: focusOn(model, landing),
|
|
439
470
|
commands: [
|
|
@@ -441,40 +472,73 @@ const requestStep = (model, layout, place, subject, maybeRequest) => __foldkitBr
|
|
|
441
472
|
announce(fill(COPY.moved, { subject: String.capitalize(words), where })),
|
|
442
473
|
],
|
|
443
474
|
outMessage: request,
|
|
444
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
475
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~12");
|
|
445
476
|
},
|
|
446
477
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#requestStep");
|
|
447
|
-
|
|
478
|
+
/** The panes in the order their tabs print: column by column, and down each column. */
|
|
479
|
+
const readingOrder = (layout) => __foldkitBrandViewResult((Array.flatMap(layout, (column) => __foldkitBrandViewResult((column.panes), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~42"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#readingOrder");
|
|
480
|
+
/** How far each focus key steps through the tabs: left and up to the one before, right and
|
|
481
|
+
* down to the one after. */
|
|
482
|
+
const TAB_STEPS = {
|
|
483
|
+
FocusLeft: -1,
|
|
484
|
+
FocusUp: -1,
|
|
485
|
+
FocusRight: 1,
|
|
486
|
+
FocusDown: 1,
|
|
487
|
+
};
|
|
488
|
+
/** `perform` while the panes print as tabs: a focus key moves to the tab beside the focused
|
|
489
|
+
* pane's, past neither end; there is no column to move or size. */
|
|
490
|
+
const performTabbed = (model, action, layout) => {
|
|
491
|
+
const panes = readingOrder(layout);
|
|
492
|
+
const maybeNext = Option.flatMap(Option.all({
|
|
493
|
+
step: Option.fromUndefinedOr(TAB_STEPS[action]),
|
|
494
|
+
index: Option.flatMap(focusedPaneId(model, layout), (paneId) => __foldkitBrandViewResult((Array.findFirstIndex(panes, (pane) => __foldkitBrandViewResult((pane.id === paneId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~44"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~43")),
|
|
495
|
+
}), ({ step, index }) => __foldkitBrandViewResult((Option.flatMap(Array.get(panes, index + step), (pane) => __foldkitBrandViewResult((Option.map(placeOf(layout, pane.id), (place) => (__foldkitBrandViewResult(({ place, tab: index + step + 1 }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~47")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~46"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~45"));
|
|
496
|
+
return __foldkitBrandViewResult((Option.match(Option.filter(maybeNext, () => __foldkitBrandViewResult((!isHolding(model)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~48")), {
|
|
497
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~14")),
|
|
498
|
+
onSome: ({ place, tab }) => (__foldkitBrandViewResult(({
|
|
499
|
+
model: focusOn(model, place),
|
|
500
|
+
commands: [
|
|
501
|
+
FocusPane({ paneHook: paneHook(model, place.pane.id) }),
|
|
502
|
+
announce(fill(COPY.focusedTab, { pane: place.pane.label, tab, tabs: panes.length })),
|
|
503
|
+
],
|
|
504
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~13")),
|
|
505
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#performTabbed");
|
|
506
|
+
};
|
|
507
|
+
const columnIdAt = (layout, index) => __foldkitBrandViewResult((Option.map(Array.get(layout, index), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~49"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#columnIdAt");
|
|
448
508
|
/**
|
|
449
509
|
* Does what the application's key for `action` asks, from the focused pane, against the
|
|
450
510
|
* layout as the application holds it: focus moves focus the pane and scroll the reel to it;
|
|
451
511
|
* moves report their request as the OutMessage, which the application applies, with focus
|
|
452
512
|
* kept on the pane. Each is said through the live region. Nothing happens while something is
|
|
453
|
-
* held, or where there is nowhere to go.
|
|
513
|
+
* held, or where there is nowhere to go. Under tabs, only the focus keys act, stepping from tab
|
|
514
|
+
* to tab.
|
|
454
515
|
*/
|
|
455
516
|
export const perform = (model, action, context) => {
|
|
456
|
-
const { layout } = context;
|
|
457
|
-
|
|
458
|
-
|
|
517
|
+
const { layout, arrangement = "Strip" } = context;
|
|
518
|
+
if (arrangement === "Tabs") {
|
|
519
|
+
return __foldkitBrandViewResult((performTabbed(model, action, layout)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#perform");
|
|
520
|
+
}
|
|
521
|
+
return __foldkitBrandViewResult((Option.match(Option.filter(focusedPlace(model, layout), () => __foldkitBrandViewResult((!isHolding(model)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~50")), {
|
|
522
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~15")),
|
|
459
523
|
onSome: (place) => {
|
|
460
524
|
const { column, columnIndex, row, pane } = place;
|
|
461
525
|
const rows = column.panes.length;
|
|
462
526
|
const paneId = pane.id;
|
|
463
527
|
const ask = (maybeRequest, subject = Subject.Pane({ paneId })) => __foldkitBrandViewResult((requestStep(model, layout, place, subject, maybeRequest)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#ask");
|
|
464
|
-
const focusAt = (toColumn, toRow) => __foldkitBrandViewResult((Option.match(Option.flatMap(Array.get(layout, toColumn), (found) => __foldkitBrandViewResult((placeAt(layout, toColumn, Number.clamp(toRow, { minimum: 0, maximum: found.panes.length - 1 }))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
465
|
-
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
466
|
-
onSome: (next) => __foldkitBrandViewResult((next.pane.id === paneId ? { model } : focusStep(model, layout, next)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
528
|
+
const focusAt = (toColumn, toRow) => __foldkitBrandViewResult((Option.match(Option.flatMap(Array.get(layout, toColumn), (found) => __foldkitBrandViewResult((placeAt(layout, toColumn, Number.clamp(toRow, { minimum: 0, maximum: found.panes.length - 1 }))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~51")), {
|
|
529
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~16")),
|
|
530
|
+
onSome: (next) => __foldkitBrandViewResult((next.pane.id === paneId ? { model } : focusStep(model, layout, next)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~15"),
|
|
467
531
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#focusAt");
|
|
468
532
|
const sideways = (toColumn, edge) => __foldkitBrandViewResult((ask(Option.match(Array.get(layout, toColumn), {
|
|
469
533
|
onSome: (found) => __foldkitBrandViewResult((Option.some(OutMessage.MovedPane({
|
|
470
534
|
paneId,
|
|
471
535
|
toColumnId: found.id,
|
|
472
536
|
toIndex: Math.min(row, found.panes.length),
|
|
473
|
-
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
474
|
-
onNone: () => __foldkitBrandViewResult((Option.liftPredicate(OutMessage.PulledOutPane({ paneId, maybeBeforeColumnId: edge }), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
537
|
+
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~16"),
|
|
538
|
+
onNone: () => __foldkitBrandViewResult((Option.liftPredicate(OutMessage.PulledOutPane({ paneId, maybeBeforeColumnId: edge }), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~52"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~17"),
|
|
475
539
|
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#sideways");
|
|
476
|
-
const moveColumn = (maybeBefore) => __foldkitBrandViewResult((ask(Option.map(maybeBefore, (maybeBeforeColumnId) => __foldkitBrandViewResult((OutMessage.MovedColumn({ columnId: column.id, maybeBeforeColumnId })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
477
|
-
return __foldkitBrandViewResult((Match.value(action).pipe(Match.withReturnType(), Match.when("FocusLeft", () => __foldkitBrandViewResult((focusAt(columnIndex - 1, row)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
540
|
+
const moveColumn = (maybeBefore) => __foldkitBrandViewResult((ask(Option.map(maybeBefore, (maybeBeforeColumnId) => __foldkitBrandViewResult((OutMessage.MovedColumn({ columnId: column.id, maybeBeforeColumnId })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~53")), Subject.Column({ columnId: column.id }))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#moveColumn");
|
|
541
|
+
return __foldkitBrandViewResult((Match.value(action).pipe(Match.withReturnType(), Match.when("FocusLeft", () => __foldkitBrandViewResult((focusAt(columnIndex - 1, row)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~54")), Match.when("FocusRight", () => __foldkitBrandViewResult((focusAt(columnIndex + 1, row)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~55")), Match.when("FocusUp", () => (__foldkitBrandViewResult((row > 0 ? focusAt(columnIndex, row - 1) : { model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~56"))), Match.when("FocusDown", () => __foldkitBrandViewResult((focusAt(columnIndex, row + 1)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~57")), Match.when("MovePaneUp", () => __foldkitBrandViewResult((ask(Option.some(OutMessage.MovedPane({ paneId, toColumnId: column.id, toIndex: row - 1 })))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~58")), Match.when("MovePaneDown", () => __foldkitBrandViewResult((ask(Option.some(OutMessage.MovedPane({ paneId, toColumnId: column.id, toIndex: row + 1 })))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~59")), Match.when("MovePaneLeft", () => __foldkitBrandViewResult((sideways(columnIndex - 1, columnIdAt(layout, 0))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~60")), Match.when("MovePaneRight", () => __foldkitBrandViewResult((sideways(columnIndex + 1, Option.none())), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~61")), Match.when("MoveColumnLeft", () => __foldkitBrandViewResult((moveColumn(Option.map(columnIdAt(layout, columnIndex - 1), (before) => __foldkitBrandViewResult((Option.some(before)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~63")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~62")), Match.when("MoveColumnRight", () => __foldkitBrandViewResult((moveColumn(Option.map(columnIdAt(layout, columnIndex + 1), () => __foldkitBrandViewResult((columnIdAt(layout, columnIndex + 2)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~65")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~64")), Match.when("CycleWidth", () => {
|
|
478
542
|
const width = nextPreset(column.width);
|
|
479
543
|
return __foldkitBrandViewResult(({
|
|
480
544
|
model,
|
|
@@ -483,11 +547,11 @@ export const perform = (model, action, context) => {
|
|
|
483
547
|
announce(fill(COPY.widened, { column: columnIndex + 1, width: widthWords(width) })),
|
|
484
548
|
],
|
|
485
549
|
outMessage: OutMessage.ResizedColumn({ columnId: column.id, width }),
|
|
486
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
550
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~66");
|
|
487
551
|
}), Match.when("PullOut", () => __foldkitBrandViewResult((ask(Option.liftPredicate(OutMessage.PulledOutPane({
|
|
488
552
|
paneId,
|
|
489
553
|
maybeBeforeColumnId: columnIdAt(layout, columnIndex + 1),
|
|
490
|
-
}), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
554
|
+
}), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~68")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~67")), Match.exhaustive)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~14");
|
|
491
555
|
},
|
|
492
556
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#perform");
|
|
493
557
|
};
|
|
@@ -507,9 +571,9 @@ const columnBoxOf = (element) => {
|
|
|
507
571
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#columnBoxOf");
|
|
508
572
|
};
|
|
509
573
|
/** The middles of a column's slots but the held pane's. */
|
|
510
|
-
const slotMiddlesOf = (element, heldId) => __foldkitBrandViewResult((Array.map(Array.filter(Array.fromIterable(element.querySelectorAll("[data-reel-slot]")), (slot) => __foldkitBrandViewResult((slot.getAttribute("data-reel-slot") !== heldId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
574
|
+
const slotMiddlesOf = (element, heldId) => __foldkitBrandViewResult((Array.map(Array.filter(Array.fromIterable(element.querySelectorAll("[data-reel-slot]")), (slot) => __foldkitBrandViewResult((slot.getAttribute("data-reel-slot") !== heldId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~69")), (slot) => {
|
|
511
575
|
const slotRect = slot.getBoundingClientRect();
|
|
512
|
-
return __foldkitBrandViewResult((slotRect.top + slotRect.height / 2), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
576
|
+
return __foldkitBrandViewResult((slotRect.top + slotRect.height / 2), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~70");
|
|
513
577
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#slotMiddlesOf");
|
|
514
578
|
/** Where a pointer at (`clientX`, `clientY`) would drop the pane `paneId` in the reel
|
|
515
579
|
* `reelHook` names, read from where its columns sit and the slots of the one it is over: none
|
|
@@ -519,13 +583,13 @@ const pointerTarget = (reelHook, paneId, clientX, clientY) => __foldkitBrandView
|
|
|
519
583
|
return (__foldkitBrandViewResult((clientX >= rect.left &&
|
|
520
584
|
clientX <= rect.right &&
|
|
521
585
|
clientY >= rect.top &&
|
|
522
|
-
clientY <= rect.bottom), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
586
|
+
clientY <= rect.bottom), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~71"));
|
|
523
587
|
}), (view) => {
|
|
524
588
|
const columns = Array.fromIterable(view.querySelectorAll("[data-reel-column]"));
|
|
525
589
|
return __foldkitBrandViewResult((targetAtPoint(Array.map(columns, columnBoxOf), clientX, clientY, (index) => __foldkitBrandViewResult((Option.match(Array.get(columns, index), {
|
|
526
|
-
onNone: () => __foldkitBrandViewResult(([]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
527
|
-
onSome: (column) => __foldkitBrandViewResult((slotMiddlesOf(column, paneId)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
528
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
590
|
+
onNone: () => __foldkitBrandViewResult(([]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~18"),
|
|
591
|
+
onSome: (column) => __foldkitBrandViewResult((slotMiddlesOf(column, paneId)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~17"),
|
|
592
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~73"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~72");
|
|
529
593
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#pointerTarget");
|
|
530
594
|
const PointerHold = Schema.Struct({
|
|
531
595
|
reelHook: Schema.String,
|
|
@@ -548,7 +612,7 @@ const pointerMessages = (hold) => __foldkitBrandViewResult((Stream.callback((que
|
|
|
548
612
|
};
|
|
549
613
|
const readMove = () => {
|
|
550
614
|
cancelAnimationFrame(state.frame);
|
|
551
|
-
Option.map(state.maybeMove, (event) => __foldkitBrandViewResult((offer(Message.MovedPointer(pointerAt(hold, event)))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
615
|
+
Option.map(state.maybeMove, (event) => __foldkitBrandViewResult((offer(Message.MovedPointer(pointerAt(hold, event)))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~76"));
|
|
552
616
|
state.maybeMove = Option.none();
|
|
553
617
|
};
|
|
554
618
|
const onMove = (event) => {
|
|
@@ -575,13 +639,13 @@ const pointerMessages = (hold) => __foldkitBrandViewResult((Stream.callback((que
|
|
|
575
639
|
document.addEventListener("pointermove", onMove);
|
|
576
640
|
document.addEventListener("pointerup", onUp);
|
|
577
641
|
document.addEventListener("pointercancel", onCancel);
|
|
578
|
-
return __foldkitBrandViewResult(({ state, onMove, onUp, onCancel }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
642
|
+
return __foldkitBrandViewResult(({ state, onMove, onUp, onCancel }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~75");
|
|
579
643
|
}), ({ state, onMove, onUp, onCancel }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
580
644
|
cancelAnimationFrame(state.frame);
|
|
581
645
|
document.removeEventListener("pointermove", onMove);
|
|
582
646
|
document.removeEventListener("pointerup", onUp);
|
|
583
647
|
document.removeEventListener("pointercancel", onCancel);
|
|
584
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
648
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~77"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~74"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#pointerMessages");
|
|
585
649
|
/** Which way a pointer at `at` scrolls a box from `low` to `high`: towards the edge it is near. */
|
|
586
650
|
const towards = (at, low, high) => {
|
|
587
651
|
if (at < low + EDGE_SCROLL) {
|
|
@@ -619,11 +683,11 @@ const edgeScroll = (hold) => __foldkitBrandViewResult((Stream.callback(() => __f
|
|
|
619
683
|
};
|
|
620
684
|
document.addEventListener("pointermove", onMove);
|
|
621
685
|
state.frame = requestAnimationFrame(step);
|
|
622
|
-
return __foldkitBrandViewResult(({ state, onMove }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
686
|
+
return __foldkitBrandViewResult(({ state, onMove }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~80");
|
|
623
687
|
}), ({ state, onMove }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
624
688
|
cancelAnimationFrame(state.frame);
|
|
625
689
|
document.removeEventListener("pointermove", onMove);
|
|
626
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
690
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~82")).pipe(Effect.flatMap(() => __foldkitBrandViewResult((Effect.never), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~84")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~79"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#edgeScroll");
|
|
627
691
|
const SplitterHold = Schema.Struct({
|
|
628
692
|
reelHook: Schema.String,
|
|
629
693
|
splitter: Splitter,
|
|
@@ -637,12 +701,12 @@ const heightOf = (element) => __foldkitBrandViewResult((element.getBoundingClien
|
|
|
637
701
|
* column's panes' height for a pane splitter. */
|
|
638
702
|
const scaleOf = (hold) => __foldkitBrandViewResult((Option.getOrElse(Option.map(scrollerOf(hold.reelHook), (view) => __foldkitBrandViewResult((Splitter.match(hold.splitter, {
|
|
639
703
|
Width: () => __foldkitBrandViewResult((view.clientWidth -
|
|
640
|
-
Option.getOrElse(Option.map(Option.fromNullishOr(view.querySelector(".reel-gap")), (gap) => __foldkitBrandViewResult((gap.getBoundingClientRect().width), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
704
|
+
Option.getOrElse(Option.map(Option.fromNullishOr(view.querySelector(".reel-gap")), (gap) => __foldkitBrandViewResult((gap.getBoundingClientRect().width), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~86")), () => __foldkitBrandViewResult((0), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~87"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Width"),
|
|
641
705
|
Split: ({ abovePaneId }) => __foldkitBrandViewResult((Number.sumAll(Array.map(Array.fromIterable(view
|
|
642
706
|
.querySelector(`[data-reel-slot="${CSS.escape(abovePaneId)}"]`)
|
|
643
707
|
?.closest(".reel-column")
|
|
644
708
|
?.querySelectorAll("[data-reel-slot]") ?? []), heightOf))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Split"),
|
|
645
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
709
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~85")), () => __foldkitBrandViewResult((0), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~88"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#scaleOf");
|
|
646
710
|
/** The dragging pointer's moves, release and cancel, as shares of the splitter's scale. */
|
|
647
711
|
const splitterMessages = (hold) => __foldkitBrandViewResult((Stream.suspend(() => {
|
|
648
712
|
const scale = scaleOf(hold);
|
|
@@ -654,25 +718,25 @@ const splitterMessages = (hold) => __foldkitBrandViewResult((Stream.suspend(() =
|
|
|
654
718
|
moved: (event) => __foldkitBrandViewResult((Message.MovedSplitter({ share: shareOf(event) })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#moved"),
|
|
655
719
|
released: (event) => __foldkitBrandViewResult((Message.ReleasedSplitter({ share: shareOf(event) })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#released"),
|
|
656
720
|
cancelled: () => __foldkitBrandViewResult((Message.CancelledSplitter()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#cancelled"),
|
|
657
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
721
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~89");
|
|
658
722
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#splitterMessages");
|
|
659
723
|
const pointerHoldOf = (model, isCarryingOnly) => __foldkitBrandViewResult((Option.flatMap(model.maybeHeld, ({ paneId, by }) => __foldkitBrandViewResult((By.match(by, {
|
|
660
724
|
Keyboard: () => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Keyboard~3"),
|
|
661
725
|
Pointer: ({ pointerId, isCarrying }) => __foldkitBrandViewResult((isCarryingOnly && !isCarrying
|
|
662
726
|
? Option.none()
|
|
663
727
|
: Option.some({ reelHook: model.id, paneId, pointerId })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Pointer~3"),
|
|
664
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
728
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~90"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#pointerHoldOf");
|
|
665
729
|
const reelSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResult(({
|
|
666
730
|
pointer: entry({ maybeHold: Schema.Option(PointerHold) }, {
|
|
667
731
|
modelToDependencies: (model) => (__foldkitBrandViewResult(({ maybeHold: pointerHoldOf(model, false) }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#modelToDependencies")),
|
|
668
732
|
dependenciesToStream: ({ maybeHold }) => __foldkitBrandViewResult((Option.match(maybeHold, {
|
|
669
|
-
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
670
|
-
onSome: (hold) => __foldkitBrandViewResult((Stream.merge(pointerMessages(hold), markDragging)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
733
|
+
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~19"),
|
|
734
|
+
onSome: (hold) => __foldkitBrandViewResult((Stream.merge(pointerMessages(hold), markDragging)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~18"),
|
|
671
735
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#dependenciesToStream"),
|
|
672
736
|
}),
|
|
673
737
|
edge: entry({ maybeHold: Schema.Option(PointerHold) }, {
|
|
674
738
|
modelToDependencies: (model) => (__foldkitBrandViewResult(({ maybeHold: pointerHoldOf(model, true) }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#modelToDependencies~2")),
|
|
675
|
-
dependenciesToStream: ({ maybeHold }) => __foldkitBrandViewResult((Option.match(maybeHold, { onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
739
|
+
dependenciesToStream: ({ maybeHold }) => __foldkitBrandViewResult((Option.match(maybeHold, { onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~20"), onSome: edgeScroll })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#dependenciesToStream~2"),
|
|
676
740
|
}),
|
|
677
741
|
resize: entry({ maybeHold: Schema.Option(SplitterHold) }, {
|
|
678
742
|
modelToDependencies: (model) => (__foldkitBrandViewResult(({
|
|
@@ -682,11 +746,11 @@ const reelSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResu
|
|
|
682
746
|
pointerId,
|
|
683
747
|
pressX,
|
|
684
748
|
pressY,
|
|
685
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
749
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~92"))),
|
|
686
750
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#modelToDependencies~3")),
|
|
687
751
|
dependenciesToStream: ({ maybeHold }) => __foldkitBrandViewResult((Option.match(maybeHold, {
|
|
688
|
-
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
689
|
-
onSome: (hold) => __foldkitBrandViewResult((Stream.merge(splitterMessages(hold), markDragging)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~
|
|
752
|
+
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~21"),
|
|
753
|
+
onSome: (hold) => __foldkitBrandViewResult((Stream.merge(splitterMessages(hold), markDragging)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~19"),
|
|
690
754
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#dependenciesToStream~3"),
|
|
691
755
|
}),
|
|
692
756
|
escape: entry({ isHolding: Schema.Boolean }, {
|
|
@@ -695,7 +759,7 @@ const reelSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResu
|
|
|
695
759
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#modelToDependencies~4")),
|
|
696
760
|
dependenciesToStream: ({ isHolding: isHoldingNow }) => __foldkitBrandViewResult((isHoldingNow ? escapeKeys(Message.PressedEscape()) : Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#dependenciesToStream~4"),
|
|
697
761
|
}),
|
|
698
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
762
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~91")));
|
|
699
763
|
/** A held pane follows the pointer (the reel scrolling near its edges), a dragged
|
|
700
764
|
* splitter resizes, and Escape puts either back, before a dialog or the page sees it, from
|
|
701
765
|
* listeners that run only while something is held. Lift them into the application's
|
|
@@ -710,8 +774,8 @@ export const SizeLiftedPane = Mount.define("SizeLiftedPane", {
|
|
|
710
774
|
messages: [Message.CompletedSizeLiftedPane],
|
|
711
775
|
execute: ({ element, sourceSelector, pressX, pressY }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
712
776
|
measureLift(element, sourceSelector, pressX, pressY);
|
|
713
|
-
return __foldkitBrandViewResult((Message.CompletedSizeLiftedPane()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
714
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~
|
|
777
|
+
return __foldkitBrandViewResult((Message.CompletedSizeLiftedPane()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~93");
|
|
778
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~6"),
|
|
715
779
|
});
|
|
716
780
|
const helpId = (model) => __foldkitBrandViewResult((`${model.id}-grip-help`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#helpId");
|
|
717
781
|
/** The share of the reel or the column a splitter's arrow key moves. */
|
|
@@ -723,34 +787,36 @@ const HELD_STEPS = {
|
|
|
723
787
|
ArrowRight: "Right",
|
|
724
788
|
};
|
|
725
789
|
const isDropKey = (key) => __foldkitBrandViewResult((key === " " || key === "Enter"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#isDropKey");
|
|
790
|
+
/** The anchor every pane is pinned to under tabs: the one slot, the reel's full size. */
|
|
791
|
+
const STAGE_ANCHOR = "--reel-stage";
|
|
726
792
|
/** The anchor that pins a pane to its slot. Pane ids are the application's, so the name is
|
|
727
793
|
* the pane's place in the id order, which the slot and the pane read from one list. */
|
|
728
794
|
const anchorName = (index) => __foldkitBrandViewResult((`--reel-${index}`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anchorName");
|
|
729
795
|
/** The panes in their layer's order: by id, which no move changes. */
|
|
730
|
-
const byId = Order.mapInput(Order.String, (pane) => __foldkitBrandViewResult((pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
796
|
+
const byId = Order.mapInput(Order.String, (pane) => __foldkitBrandViewResult((pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~94"));
|
|
731
797
|
/** Where a carried drop would land, marked: none where it would change nothing. */
|
|
732
|
-
const markOf = (model, layout) => __foldkitBrandViewResult((Option.flatMap(Option.filter(model.maybeHeld, isCarried), (held) => __foldkitBrandViewResult((Option.filter(held.maybeTarget, (target) => __foldkitBrandViewResult((Option.isSome(requestOf(layout, held.paneId, target))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
733
|
-
const carriedIdOf = (model) => __foldkitBrandViewResult((Option.map(Option.filter(model.maybeHeld, isCarried), ({ paneId }) => __foldkitBrandViewResult((paneId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
798
|
+
const markOf = (model, layout) => __foldkitBrandViewResult((Option.flatMap(Option.filter(model.maybeHeld, isCarried), (held) => __foldkitBrandViewResult((Option.filter(held.maybeTarget, (target) => __foldkitBrandViewResult((Option.isSome(requestOf(layout, held.paneId, target))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~96"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~95"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#markOf");
|
|
799
|
+
const carriedIdOf = (model) => __foldkitBrandViewResult((Option.map(Option.filter(model.maybeHeld, isCarried), ({ paneId }) => __foldkitBrandViewResult((paneId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~97"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#carriedIdOf");
|
|
734
800
|
const gripView = (model, pane, h) => {
|
|
735
|
-
const maybeHeldHere = Option.filter(model.maybeHeld, (held) => __foldkitBrandViewResult((held.paneId === pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
801
|
+
const maybeHeldHere = Option.filter(model.maybeHeld, (held) => __foldkitBrandViewResult((held.paneId === pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~98"));
|
|
736
802
|
const isHeld = Option.exists(maybeHeldHere, isCarried);
|
|
737
|
-
const isKeyboardHeld = Option.exists(maybeHeldHere, (held) => __foldkitBrandViewResult((held.by._tag === "Keyboard"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
803
|
+
const isKeyboardHeld = Option.exists(maybeHeldHere, (held) => __foldkitBrandViewResult((held.by._tag === "Keyboard"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~99"));
|
|
738
804
|
// the keyboard holds an item on its grip: the keys are the grip's own, and focus leaving the
|
|
739
805
|
// grip puts the item back, so a field reached by Tab types as it should
|
|
740
806
|
const onGripKey = h.OnKeyDownPreventDefault((key, modifiers) => {
|
|
741
807
|
if (!isPlain(modifiers)) {
|
|
742
|
-
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
808
|
+
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~100");
|
|
743
809
|
}
|
|
744
810
|
else if (isKeyboardHeld) {
|
|
745
811
|
return __foldkitBrandViewResult((isDropKey(key)
|
|
746
812
|
? Option.some(Message.DroppedHeld())
|
|
747
|
-
: Option.map(Option.fromNullishOr(HELD_STEPS[key]), (step) => __foldkitBrandViewResult((Message.SteppedHeld({ step })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
813
|
+
: Option.map(Option.fromNullishOr(HELD_STEPS[key]), (step) => __foldkitBrandViewResult((Message.SteppedHeld({ step })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~101"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~100");
|
|
748
814
|
}
|
|
749
815
|
else {
|
|
750
|
-
return __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGripKey({ paneId: pane.id }), () => __foldkitBrandViewResult((isIdle(model) && isDropKey(key)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
816
|
+
return __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGripKey({ paneId: pane.id }), () => __foldkitBrandViewResult((isIdle(model) && isDropKey(key)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~102"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~100");
|
|
751
817
|
}
|
|
752
818
|
});
|
|
753
|
-
const onGripPress = h.OnPointerDown((_pointerType, button, _screenX, _screenY, _time, clientX, clientY, pointerId) => __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGrip({ paneId: pane.id, pointerId, clientX, clientY }), () => __foldkitBrandViewResult((isIdle(model) && button === LEFT_BUTTON), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
819
|
+
const onGripPress = h.OnPointerDown((_pointerType, button, _screenX, _screenY, _time, clientX, clientY, pointerId) => __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGrip({ paneId: pane.id, pointerId, clientX, clientY }), () => __foldkitBrandViewResult((isIdle(model) && button === LEFT_BUTTON), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~104"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~103"));
|
|
754
820
|
return __foldkitBrandViewResult((IconButton.view({
|
|
755
821
|
glyph: "grip",
|
|
756
822
|
label: fill(COPY.paneGrip, { pane: pane.label }),
|
|
@@ -777,17 +843,17 @@ const reelSplitterAttributes = (model, splitter, h) => __foldkitBrandViewResult(
|
|
|
777
843
|
* land before, or the last one when it would land at the end, the carried pane left out. */
|
|
778
844
|
const dropMarkOf = (info, column) => __foldkitBrandViewResult((Option.flatMap(info.maybeMark, (mark) => {
|
|
779
845
|
if (mark._tag !== "Into" || mark.columnId !== column.id) {
|
|
780
|
-
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
846
|
+
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~105");
|
|
781
847
|
}
|
|
782
|
-
const others = Array.filter(column.panes, (pane) => __foldkitBrandViewResult((!Option.contains(info.maybeCarriedId, pane.id)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
848
|
+
const others = Array.filter(column.panes, (pane) => __foldkitBrandViewResult((!Option.contains(info.maybeCarriedId, pane.id)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~106"));
|
|
783
849
|
return __foldkitBrandViewResult((Option.orElse(Option.map(Array.get(others, mark.index), ({ id }) => (__foldkitBrandViewResult(({
|
|
784
850
|
paneId: id,
|
|
785
851
|
markClass: " drop-before",
|
|
786
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
852
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~107"))), () => __foldkitBrandViewResult((Option.map(Option.filter(Array.last(others), () => __foldkitBrandViewResult((mark.index >= others.length), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~109")), ({ id }) => (__foldkitBrandViewResult(({ paneId: id, markClass: " drop-after" }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~110")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~108"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~105");
|
|
787
853
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#dropMarkOf");
|
|
788
|
-
const isGapMarked = (info, maybeBeforeColumnId) => __foldkitBrandViewResult((Option.exists(info.maybeMark, (mark) => __foldkitBrandViewResult((mark._tag === "Gap" && Equal.equals(mark.maybeBeforeColumnId, maybeBeforeColumnId)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
854
|
+
const isGapMarked = (info, maybeBeforeColumnId) => __foldkitBrandViewResult((Option.exists(info.maybeMark, (mark) => __foldkitBrandViewResult((mark._tag === "Gap" && Equal.equals(mark.maybeBeforeColumnId, maybeBeforeColumnId)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~111"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#isGapMarked");
|
|
789
855
|
const slotView = (anchors, maybeDropMark, pane, h) => __foldkitBrandViewResult((h.keyed("div")(pane.id, [
|
|
790
|
-
h.Class(`reel-slot${Option.match(Option.filter(maybeDropMark, ({ paneId }) => __foldkitBrandViewResult((paneId === pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
856
|
+
h.Class(`reel-slot${Option.match(Option.filter(maybeDropMark, ({ paneId }) => __foldkitBrandViewResult((paneId === pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~112")), { onNone: () => __foldkitBrandViewResult((""), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~22"), onSome: ({ markClass }) => __foldkitBrandViewResult((markClass), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~20") })}`),
|
|
791
857
|
h.DataAttribute("reel-slot", pane.id),
|
|
792
858
|
h.Style({ "--reel-weight": `${pane.weight}`, "--reel-anchor": anchors.get(pane.id) ?? "none" }),
|
|
793
859
|
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#slotView");
|
|
@@ -804,13 +870,13 @@ const splitView = (model, above, share, h) => __foldkitBrandViewResult((h.keyed(
|
|
|
804
870
|
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#splitView");
|
|
805
871
|
const columnView = (info, anchors, column, index, h) => {
|
|
806
872
|
const { model, layout } = info;
|
|
807
|
-
const total = Number.sumAll(Array.map(column.panes, (pane) => __foldkitBrandViewResult((pane.weight), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
873
|
+
const total = Number.sumAll(Array.map(column.panes, (pane) => __foldkitBrandViewResult((pane.weight), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~113")));
|
|
808
874
|
const maybeDropMark = dropMarkOf(info, column);
|
|
809
875
|
const stack = Array.flatMap(column.panes, (pane, row) => __foldkitBrandViewResult(([
|
|
810
|
-
...Array.fromOption(Option.map(Array.get(column.panes, row - 1), (above) => __foldkitBrandViewResult((splitView(model, above, total > 0 ? above.weight / total : 0, h)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
876
|
+
...Array.fromOption(Option.map(Array.get(column.panes, row - 1), (above) => __foldkitBrandViewResult((splitView(model, above, total > 0 ? above.weight / total : 0, h)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~115"))),
|
|
811
877
|
slotView(anchors, maybeDropMark, pane, h),
|
|
812
|
-
]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
813
|
-
const maybeNextId = Option.map(Array.get(layout, index + 1), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
878
|
+
]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~114"));
|
|
879
|
+
const maybeNextId = Option.map(Array.get(layout, index + 1), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~116"));
|
|
814
880
|
return __foldkitBrandViewResult(([
|
|
815
881
|
h.keyed("div")(`column:${column.id}`, [
|
|
816
882
|
h.Class("reel-column"),
|
|
@@ -834,24 +900,28 @@ const columnView = (info, anchors, column, index, h) => {
|
|
|
834
900
|
};
|
|
835
901
|
const paneLayerView = (info, panes, anchors, h) => {
|
|
836
902
|
const { model } = info;
|
|
837
|
-
// NOTE: the panes keep one order in the page, by id, whatever the layout
|
|
838
|
-
// only where each is anchored, so no pane's element is
|
|
839
|
-
// drop focus, a terminal's scroll and whatever a Mount
|
|
903
|
+
// NOTE: the panes keep one order in the page, by id, whatever the layout or the arrangement:
|
|
904
|
+
// a move or a change to tabs changes only where each is anchored, so no pane's element is
|
|
905
|
+
// taken out and put back, which would drop focus, a terminal's scroll and whatever a Mount
|
|
906
|
+
// holds inside it. Under tabs the panes behind the focused one are hidden, not removed, and
|
|
907
|
+
// keep their size, so a terminal sized by its box is not resized as the tabs change.
|
|
840
908
|
return __foldkitBrandViewResult((h.div([h.Class("reel-panes")], Array.map(panes, (pane) => {
|
|
841
909
|
const isFocused = Option.contains(info.maybeFocusedId, pane.id);
|
|
842
910
|
const isHeld = Option.contains(info.maybeCarriedId, pane.id);
|
|
911
|
+
const isBehind = info.isTabbed && !isFocused;
|
|
843
912
|
return __foldkitBrandViewResult((h.keyed("div")(pane.id, [
|
|
844
|
-
h.Class(`reel-pane${isFocused ? " focused" : ""}${isHeld ? " drag-dim" : ""}`),
|
|
913
|
+
h.Class(`reel-pane${isFocused ? " focused" : ""}${isHeld ? " drag-dim" : ""}${isBehind ? " behind" : ""}`),
|
|
845
914
|
h.DataAttribute("reel-pane", paneHook(model, pane.id)),
|
|
846
915
|
h.Style({ "--reel-anchor": anchors.get(pane.id) ?? "none" }),
|
|
847
916
|
h.Tabindex(-1),
|
|
917
|
+
...(isBehind ? [h.Inert(true)] : []),
|
|
848
918
|
h.OnFocusEnter(Message.FocusedPane({ paneId: pane.id })),
|
|
849
919
|
], [
|
|
850
920
|
info.toPaneView(pane, {
|
|
851
|
-
|
|
921
|
+
lead: info.isTabbed ? [] : [gripView(model, pane, h)],
|
|
852
922
|
id: `${model.id}-${pane.id}`,
|
|
853
923
|
}),
|
|
854
|
-
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
924
|
+
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~117");
|
|
855
925
|
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#paneLayerView");
|
|
856
926
|
};
|
|
857
927
|
/** The copy a pointer carries: the held pane's title bar, drawn by the reel from its label,
|
|
@@ -877,11 +947,35 @@ const liftedCopyView = (info, h) => {
|
|
|
877
947
|
h.h2([], [heldLabel(layout, held)]),
|
|
878
948
|
]),
|
|
879
949
|
]),
|
|
880
|
-
]), () => __foldkitBrandViewResult((isCarrying), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
881
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
950
|
+
]), () => __foldkitBrandViewResult((isCarrying), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~119"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Pointer~4"),
|
|
951
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~118")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#liftedCopyView");
|
|
952
|
+
};
|
|
953
|
+
/** The tab list under tabs: a tab per pane in reading order, the focused pane's selected. A
|
|
954
|
+
* press shows its pane and puts the keyboard in it; the side arrows (wrapping), Home and End
|
|
955
|
+
* select as they move and keep the keyboard on the tabs, only the selected tab being in the
|
|
956
|
+
* Tab order. A modified arrow is the application's. */
|
|
957
|
+
const tabListView = (info, label, toTabLeadView, h) => {
|
|
958
|
+
const { model, layout } = info;
|
|
959
|
+
const panes = readingOrder(layout);
|
|
960
|
+
const stepTo = (index) => __foldkitBrandViewResult((Option.map(Array.get(panes, (index + panes.length) % panes.length), ({ id }) => __foldkitBrandViewResult((Message.SteppedTab({ paneId: id })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~120"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#stepTo");
|
|
961
|
+
const keyOf = (index, key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when("ArrowLeft", () => __foldkitBrandViewResult((stepTo(index - 1)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~121")), Match.when("ArrowRight", () => __foldkitBrandViewResult((stepTo(index + 1)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~122")), Match.when("Home", () => __foldkitBrandViewResult((stepTo(0)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~123")), Match.when("End", () => __foldkitBrandViewResult((stepTo(panes.length - 1)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~124")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~125")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#keyOf");
|
|
962
|
+
return __foldkitBrandViewResult((h.div([h.Class("nav tabs reel-tabs"), h.Role("tablist"), h.AriaLabel(label)], Array.map(panes, (pane, index) => {
|
|
963
|
+
const isSelected = Option.contains(info.maybeFocusedId, pane.id);
|
|
964
|
+
return __foldkitBrandViewResult((h.keyed("button")(pane.id, [
|
|
965
|
+
h.Type("button"),
|
|
966
|
+
h.Role("tab"),
|
|
967
|
+
h.AriaSelected(isSelected),
|
|
968
|
+
h.AriaControls(`${model.id}-${pane.id}`),
|
|
969
|
+
h.Tabindex(isSelected ? 0 : -1),
|
|
970
|
+
h.DataAttribute("reel-tab", tabHook(model, pane.id)),
|
|
971
|
+
h.OnClick(Message.PressedTab({ paneId: pane.id })),
|
|
972
|
+
h.OnKeyDownPreventDefault((key, modifiers) => __foldkitBrandViewResult((isPlain(modifiers) ? keyOf(index, key) : Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~127")),
|
|
973
|
+
], [...toTabLeadView(pane), h.span([h.Class("reel-tab-words")], [pane.label])])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~126");
|
|
974
|
+
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#tabListView");
|
|
882
975
|
};
|
|
976
|
+
const NO_TAB_LEAD = () => __foldkitBrandViewResult(([]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#NO_TAB_LEAD");
|
|
883
977
|
/** The layout as it prints, with a dragged splitter's resize shown before it is asked for. */
|
|
884
|
-
const previewed = (model, layout) => __foldkitBrandViewResult((Option.match(Option.flatMap(model.maybeResizing, ({ maybeResize }) => __foldkitBrandViewResult((maybeResize), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
978
|
+
const previewed = (model, layout) => __foldkitBrandViewResult((Option.match(Option.flatMap(model.maybeResizing, ({ maybeResize }) => __foldkitBrandViewResult((maybeResize), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~128")), { onNone: () => __foldkitBrandViewResult((layout), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~23"), onSome: (resize) => __foldkitBrandViewResult((apply(layout, resize)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~21") })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#previewed");
|
|
885
979
|
/**
|
|
886
980
|
* A row of columns wider than the view when it must be, each a stack of panes, scrolled
|
|
887
981
|
* sideways, and down where a column is taller than the view: `div.reel` holding the scroller
|
|
@@ -895,33 +989,56 @@ const previewed = (model, layout) => __foldkitBrandViewResult((Option.match(Opti
|
|
|
895
989
|
* panes), Space drops it, and Escape or Tab puts it back. A drop reports what it asks
|
|
896
990
|
* of the layout as the OutMessage. Lift `subscriptions(keyPrefix)` into the application's, or
|
|
897
991
|
* nothing follows the pointer, and call `reconcile` whenever the layout changes.
|
|
992
|
+
*
|
|
993
|
+
* Under tabs (`arrangement: "Tabs"`) the reel is `div.reel.tabbed`: a `div.nav.tabs.reel-tabs`
|
|
994
|
+
* tab list over the scroller, whose track holds one `div.reel-slot.reel-stage` at the reel's
|
|
995
|
+
* full size where the columns were. Every pane is pinned to it, the focused one shown and the
|
|
996
|
+
* others `.behind`, hidden and inert; there are no grips and no splitters.
|
|
898
997
|
*/
|
|
899
998
|
export const view = defineView((model, viewInputs, h) => {
|
|
900
|
-
const { label, toPaneView } = viewInputs;
|
|
999
|
+
const { label, toPaneView, arrangement = "Strip", toTabLeadView = NO_TAB_LEAD } = viewInputs;
|
|
1000
|
+
const isTabbed = arrangement === "Tabs";
|
|
901
1001
|
const layout = previewed(model, viewInputs.layout);
|
|
902
|
-
const panes = Array.sort(Array.flatMap(layout, (column) => __foldkitBrandViewResult((column.panes), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
903
|
-
const anchors = new Map(Array.map(panes, (pane, index) => __foldkitBrandViewResult(([pane.id, anchorName(index)]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
1002
|
+
const panes = Array.sort(Array.flatMap(layout, (column) => __foldkitBrandViewResult((column.panes), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~130")), byId);
|
|
1003
|
+
const anchors = new Map(Array.map(panes, (pane, index) => __foldkitBrandViewResult(([pane.id, isTabbed ? STAGE_ANCHOR : anchorName(index)]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~131")));
|
|
904
1004
|
const info = {
|
|
905
1005
|
model,
|
|
906
1006
|
layout,
|
|
1007
|
+
isTabbed,
|
|
907
1008
|
toPaneView,
|
|
908
1009
|
maybeFocusedId: focusedPaneId(model, layout),
|
|
909
1010
|
maybeMark: markOf(model, layout),
|
|
910
1011
|
maybeCarriedId: carriedIdOf(model),
|
|
911
1012
|
};
|
|
912
|
-
|
|
1013
|
+
const strip = () => __foldkitBrandViewResult(([
|
|
1014
|
+
h.keyed("div")("gap:start", [
|
|
1015
|
+
h.Class(`reel-gap${isGapMarked(info, Option.map(Array.head(layout), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~132")))
|
|
1016
|
+
? " drop-here"
|
|
1017
|
+
: ""}`),
|
|
1018
|
+
]),
|
|
1019
|
+
...Array.flatMap(layout, (column, index) => __foldkitBrandViewResult((columnView(info, anchors, column, index, h)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~133")),
|
|
1020
|
+
]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#strip");
|
|
1021
|
+
return __foldkitBrandViewResult((h.div([
|
|
1022
|
+
h.Class(isTabbed ? "reel tabbed" : "reel"),
|
|
1023
|
+
h.Role("group"),
|
|
1024
|
+
h.AriaLabel(label),
|
|
1025
|
+
h.DataAttribute("reel", model.id),
|
|
1026
|
+
], [
|
|
1027
|
+
...(isTabbed ? [tabListView(info, label, toTabLeadView, h)] : []),
|
|
913
1028
|
h.div([h.Class("reel-view")], [
|
|
914
1029
|
h.div([h.Class("reel-track")], [
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1030
|
+
...(isTabbed
|
|
1031
|
+
? [
|
|
1032
|
+
h.div([
|
|
1033
|
+
h.Class("reel-slot reel-stage"),
|
|
1034
|
+
h.Style({ "--reel-anchor": STAGE_ANCHOR }),
|
|
1035
|
+
]),
|
|
1036
|
+
]
|
|
1037
|
+
: strip()),
|
|
921
1038
|
paneLayerView(info, panes, anchors, h),
|
|
922
1039
|
]),
|
|
923
1040
|
]),
|
|
924
1041
|
h.p([h.Id(helpId(model)), h.Class("sr-only")], [COPY.gripHelp]),
|
|
925
1042
|
...liftedCopyView(info, h),
|
|
926
|
-
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
1043
|
+
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~129");
|
|
927
1044
|
});
|