@gjermundgaraba-designs/pixel-paper 0.20.1 → 0.22.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 +21 -15
- package/dist/src/bench/bench.d.ts +14 -0
- package/dist/src/bench/bench.d.ts.map +1 -0
- package/dist/src/bench/bench.js +9 -0
- package/dist/src/bench/index.d.ts +3 -0
- package/dist/src/bench/index.d.ts.map +1 -0
- package/dist/src/bench/index.js +1 -0
- package/dist/src/chip/chip.d.ts +10 -0
- package/dist/src/chip/chip.d.ts.map +1 -1
- package/dist/src/chip/chip.js +19 -0
- package/dist/src/chip/index.d.ts +2 -2
- package/dist/src/chip/index.d.ts.map +1 -1
- package/dist/src/chip/index.js +1 -1
- package/dist/src/drag/drag.d.ts +18 -0
- package/dist/src/drag/drag.d.ts.map +1 -1
- package/dist/src/drag/drag.js +35 -7
- package/dist/src/field/field.d.ts +3 -0
- package/dist/src/field/field.d.ts.map +1 -1
- package/dist/src/field/field.js +2 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/lineDiff/index.d.ts +2 -0
- package/dist/src/lineDiff/index.d.ts.map +1 -1
- package/dist/src/lineDiff/index.js +1 -0
- package/dist/src/lineDiff/lineDiff.d.ts +8 -4
- package/dist/src/lineDiff/lineDiff.d.ts.map +1 -1
- package/dist/src/lineDiff/lineDiff.js +19 -15
- package/dist/src/lineDiff/patch.d.ts +35 -0
- package/dist/src/lineDiff/patch.d.ts.map +1 -0
- package/dist/src/lineDiff/patch.js +146 -0
- package/dist/src/menu/menu.d.ts +6 -6
- 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 +217 -17
- package/dist/src/rail/rail.d.ts.map +1 -1
- package/dist/src/rail/rail.js +133 -15
- 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/layout.d.ts +21 -26
- package/dist/src/reel/layout.d.ts.map +1 -1
- package/dist/src/reel/layout.js +84 -106
- package/dist/src/reel/reel.d.ts +30 -172
- package/dist/src/reel/reel.d.ts.map +1 -1
- package/dist/src/reel/reel.js +144 -195
- package/dist/src/rows/rows.d.ts +9 -1
- package/dist/src/rows/rows.d.ts.map +1 -1
- package/dist/src/rows/rows.js +1 -1
- package/dist/src/sortable/sortable.d.ts +30 -30
- package/dist/src/toast/toast.d.ts +12 -12
- package/dist/src/window/window.d.ts +3 -1
- package/dist/src/window/window.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bench/bench.ts +24 -0
- package/src/bench/index.ts +2 -0
- package/src/chip/chip.ts +31 -0
- package/src/chip/index.ts +2 -2
- package/src/drag/drag.ts +60 -1
- package/src/field/field.ts +5 -1
- package/src/index.ts +1 -0
- package/src/lineDiff/index.ts +2 -0
- package/src/lineDiff/lineDiff.ts +29 -24
- package/src/lineDiff/patch.ts +218 -0
- package/src/pixel-paper.css +202 -32
- package/src/rail/index.ts +2 -0
- package/src/rail/rail.ts +181 -16
- package/src/reel/index.ts +0 -1
- package/src/reel/layout.ts +78 -118
- package/src/reel/reel.ts +108 -216
- package/src/rows/rows.ts +14 -2
- package/src/tokens.css +2 -1
- package/src/window/window.ts +3 -1
package/dist/src/reel/reel.js
CHANGED
|
@@ -10,17 +10,18 @@ import { defineView } from "foldkit/submodel";
|
|
|
10
10
|
import * as Subscription from "foldkit/subscription";
|
|
11
11
|
import * as Announcer from "../announcer/announcer.js";
|
|
12
12
|
import * as Button from "../button/button.js";
|
|
13
|
-
import { LEFT_BUTTON, escapeKeys, markDragging, measureLift,
|
|
13
|
+
import { LEFT_BUTTON, escapeKeys, markDragging, measureLift, pointerMessages as dragMessages, splitterAttributes, } from "../drag/drag.js";
|
|
14
14
|
import * as Glyph from "../glyph/glyph.js";
|
|
15
15
|
import * as IconButton from "../iconButton/iconButton.js";
|
|
16
|
+
import { isPlain } from "../keys/keys.js";
|
|
16
17
|
import { prefixKeys } from "../subscription/prefixKeys.js";
|
|
17
|
-
import { OutMessage, Resize, Splitter, Step, Subject, Target, WHERE_IT_WAS, apply,
|
|
18
|
+
import { OutMessage, Resize, Splitter, Step, Subject, Target, WHERE_IT_WAS, apply, columnOfTarget, fill, firstPlace, isSplitterPresent, isTargetPresent, landingWords, nextPreset, originOf, placeAt, placeOf, placeWords, requestOf, resizeOf, steppedTarget, subjectWords, targetAtPoint, whereWords, widthWords, } from "./layout.js";
|
|
18
19
|
// MODEL
|
|
19
|
-
/** The words a reel says. `{pane}` is a pane's label, `{subject}` what
|
|
20
|
-
* column by its first pane), `{where}` a place and `{column}` a column's
|
|
20
|
+
/** The words a reel says. `{pane}` is a pane's label, `{subject}` what moves (the held pane,
|
|
21
|
+
* or a column a key moves, by its first pane), `{where}` a place and `{column}` a column's
|
|
22
|
+
* number. */
|
|
21
23
|
const COPY = {
|
|
22
24
|
paneGrip: "Move {pane}",
|
|
23
|
-
columnGrip: "Move column {column}",
|
|
24
25
|
gripHelp: "Press space to pick it up. Arrow keys move it, space drops it, escape or tab puts it back.",
|
|
25
26
|
widthLabel: "Width of column {column}",
|
|
26
27
|
heightLabel: "Height of {pane}",
|
|
@@ -50,9 +51,9 @@ const By = defineTaggedUnion({
|
|
|
50
51
|
},
|
|
51
52
|
Keyboard: {},
|
|
52
53
|
});
|
|
53
|
-
/**
|
|
54
|
+
/** The pane held, how, and where it would land: none while a pointer is outside the reel. */
|
|
54
55
|
const Held = Schema.Struct({
|
|
55
|
-
|
|
56
|
+
paneId: Schema.String,
|
|
56
57
|
by: By,
|
|
57
58
|
maybeTarget: Schema.Option(Target),
|
|
58
59
|
});
|
|
@@ -81,12 +82,12 @@ const PointerAt = Schema.Struct({
|
|
|
81
82
|
/** Union of all Messages a reel can produce. */
|
|
82
83
|
export const Message = defineMessageUnion({
|
|
83
84
|
PressedGrip: {
|
|
84
|
-
|
|
85
|
+
paneId: Schema.String,
|
|
85
86
|
pointerId: Schema.Number,
|
|
86
87
|
clientX: Schema.Number,
|
|
87
88
|
clientY: Schema.Number,
|
|
88
89
|
},
|
|
89
|
-
PressedGripKey: {
|
|
90
|
+
PressedGripKey: { paneId: Schema.String },
|
|
90
91
|
MovedPointer: PointerAt.fields,
|
|
91
92
|
ReleasedPointer: PointerAt.fields,
|
|
92
93
|
CancelledPointer: {},
|
|
@@ -108,7 +109,6 @@ export const Message = defineMessageUnion({
|
|
|
108
109
|
CompletedAnnounceReel: {},
|
|
109
110
|
CompletedFocusPane: {},
|
|
110
111
|
CompletedRestoreFocus: {},
|
|
111
|
-
CompletedFocusGrip: {},
|
|
112
112
|
CompletedScrollIntoView: {},
|
|
113
113
|
CompletedSizeLiftedPane: {},
|
|
114
114
|
});
|
|
@@ -137,10 +137,6 @@ const isCarried = (held) => __foldkitBrandViewResult((By.match(held.by, { Pointe
|
|
|
137
137
|
// DOM HOOKS
|
|
138
138
|
const paneHook = (model, paneId) => __foldkitBrandViewResult((`${model.id}/pane/${paneId}`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#paneHook");
|
|
139
139
|
const columnHook = (model, columnId) => __foldkitBrandViewResult((`${model.id}/column/${columnId}`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#columnHook");
|
|
140
|
-
const subjectHook = (model, subject) => __foldkitBrandViewResult((Subject.match(subject, {
|
|
141
|
-
Pane: ({ paneId }) => __foldkitBrandViewResult((paneHook(model, paneId)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Pane"),
|
|
142
|
-
Column: ({ columnId }) => __foldkitBrandViewResult((columnHook(model, columnId)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Column"),
|
|
143
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#subjectHook");
|
|
144
140
|
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
141
|
const paneElement = (hook) => __foldkitBrandViewResult((Option.fromNullishOr(document.querySelector(`[data-reel-pane="${CSS.escape(hook)}"]`))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#paneElement");
|
|
146
142
|
/** Puts the keyboard in `pane`: on its control marked `data-reel-focus` (a terminal's input),
|
|
@@ -186,21 +182,6 @@ export const RestoreFocus = Command.define("RestoreFocus", {
|
|
|
186
182
|
return __foldkitBrandViewResult((Message.CompletedRestoreFocus()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~9");
|
|
187
183
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~3"),
|
|
188
184
|
});
|
|
189
|
-
/** Puts focus back on a column's grip once the render that moved its column is in the page:
|
|
190
|
-
* a column's element moves with it, which takes focus off its grip. */
|
|
191
|
-
export const FocusGrip = Command.define("FocusGrip", {
|
|
192
|
-
args: { gripHook: Schema.String },
|
|
193
|
-
messages: [Message.CompletedFocusGrip],
|
|
194
|
-
execute: ({ gripHook }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
195
|
-
yield* Render.afterCommit;
|
|
196
|
-
yield* Effect.sync(() => {
|
|
197
|
-
document
|
|
198
|
-
.querySelector(`[data-reel-grip="${CSS.escape(gripHook)}"]`)
|
|
199
|
-
?.focus({ preventScroll: true });
|
|
200
|
-
});
|
|
201
|
-
return __foldkitBrandViewResult((Message.CompletedFocusGrip()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~11");
|
|
202
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~4"),
|
|
203
|
-
});
|
|
204
185
|
/** Scrolls the pane or column `hook` names into view, by the least distance either way, its
|
|
205
186
|
* gutter kept by the stylesheet's `scroll-margin`, once the render that placed it is in the
|
|
206
187
|
* page. It jumps: motion is stepped or instant, and a follow is instant. */
|
|
@@ -214,8 +195,8 @@ export const ScrollIntoView = Command.define("ScrollIntoView", {
|
|
|
214
195
|
.querySelector(`[data-reel-pane="${CSS.escape(hook)}"], [data-reel-hook="${CSS.escape(hook)}"]`)
|
|
215
196
|
?.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
216
197
|
});
|
|
217
|
-
return __foldkitBrandViewResult((Message.CompletedScrollIntoView()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
218
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~
|
|
198
|
+
return __foldkitBrandViewResult((Message.CompletedScrollIntoView()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~11");
|
|
199
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~4"),
|
|
219
200
|
});
|
|
220
201
|
/** How far a pointer moves from its press before it carries what it pressed. */
|
|
221
202
|
const CARRY_THRESHOLD = 5;
|
|
@@ -225,22 +206,17 @@ const focusOn = (model, place) => __foldkitBrandViewResult((modifyFields(model,
|
|
|
225
206
|
maybeFocus: () => __foldkitBrandViewResult((Option.some({ paneId: place.pane.id, column: place.columnIndex, row: place.row })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#maybeFocus"),
|
|
226
207
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#focusOn");
|
|
227
208
|
const announce = (text) => __foldkitBrandViewResult((AnnounceReel({ text })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#announce");
|
|
228
|
-
const heldWords = (layout, held) => __foldkitBrandViewResult((String.capitalize(Option.getOrElse(subjectWords(layout, held.
|
|
229
|
-
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~
|
|
230
|
-
/** Lets go of
|
|
231
|
-
* something (reported as the request), put back otherwise, said in `putBack`'s words.
|
|
232
|
-
* column dropped by the keyboard gets its grip's focus back. */
|
|
209
|
+
const heldWords = (layout, held) => __foldkitBrandViewResult((String.capitalize(Option.getOrElse(subjectWords(layout, Subject.Pane({ paneId: held.paneId })), () => __foldkitBrandViewResult((""), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~13")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#heldWords");
|
|
210
|
+
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~14")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#scrollToTarget");
|
|
211
|
+
/** Lets go of the held pane: dropped at its target when it is carried and the drop changes
|
|
212
|
+
* something (reported as the request), put back otherwise, said in `putBack`'s words. */
|
|
233
213
|
const letGo = (model, layout, held, putBack) => {
|
|
234
214
|
const released = withHeld(model, Option.none());
|
|
235
215
|
if (!isCarried(held)) {
|
|
236
216
|
return __foldkitBrandViewResult(({ model: released }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#letGo");
|
|
237
217
|
}
|
|
238
218
|
const subject = heldWords(layout, held);
|
|
239
|
-
const maybeRequest = Option.flatMap(held.maybeTarget, (target) => __foldkitBrandViewResult((requestOf(layout, held.
|
|
240
|
-
// a column that moves takes focus off its grip; one put back never left its place
|
|
241
|
-
const refocus = held.subject._tag === "Column" && held.by._tag === "Keyboard"
|
|
242
|
-
? [FocusGrip({ gripHook: subjectHook(model, held.subject) })]
|
|
243
|
-
: [];
|
|
219
|
+
const maybeRequest = Option.flatMap(held.maybeTarget, (target) => __foldkitBrandViewResult((requestOf(layout, held.paneId, target)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~15"));
|
|
244
220
|
return __foldkitBrandViewResult((Option.match(maybeRequest, {
|
|
245
221
|
onNone: () => (__foldkitBrandViewResult(({
|
|
246
222
|
model: released,
|
|
@@ -249,10 +225,9 @@ const letGo = (model, layout, held, putBack) => {
|
|
|
249
225
|
onSome: (request) => (__foldkitBrandViewResult(({
|
|
250
226
|
model: released,
|
|
251
227
|
commands: [
|
|
252
|
-
...refocus,
|
|
253
228
|
announce(fill(COPY.dropped, {
|
|
254
229
|
subject,
|
|
255
|
-
where: Option.getOrElse(whereWords(apply(layout, request), held.
|
|
230
|
+
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~16")),
|
|
256
231
|
})),
|
|
257
232
|
],
|
|
258
233
|
outMessage: request,
|
|
@@ -260,10 +235,10 @@ const letGo = (model, layout, held, putBack) => {
|
|
|
260
235
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#letGo");
|
|
261
236
|
};
|
|
262
237
|
const cancel = (model, layout, held) => __foldkitBrandViewResult((letGo(model, layout, { ...held, maybeTarget: Option.none() }, COPY.cancelled)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#cancel");
|
|
263
|
-
const lift = (model, layout,
|
|
238
|
+
const lift = (model, layout, paneId, by) => __foldkitBrandViewResult((Option.match(Option.filter(originOf(layout, paneId), () => __foldkitBrandViewResult((!isHolding(model) && Option.isNone(model.maybeResizing)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~17")), {
|
|
264
239
|
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~3")),
|
|
265
240
|
onSome: (origin) => {
|
|
266
|
-
const held = {
|
|
241
|
+
const held = { paneId, by, maybeTarget: Option.some(origin) };
|
|
267
242
|
return __foldkitBrandViewResult(({
|
|
268
243
|
model: withHeld(model, Option.some(held)),
|
|
269
244
|
commands: by._tag === "Keyboard"
|
|
@@ -292,10 +267,10 @@ const movePointer = (model, layout, held, pointer) => __foldkitBrandViewResult((
|
|
|
292
267
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#movePointer");
|
|
293
268
|
/** A keyboard step of what is held, resolved from the layout, with the reel scrolled to the
|
|
294
269
|
* column it lands by. */
|
|
295
|
-
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~
|
|
270
|
+
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~18")), {
|
|
296
271
|
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~4")),
|
|
297
272
|
onSome: (target) => {
|
|
298
|
-
const next = steppedTarget(layout, held.
|
|
273
|
+
const next = steppedTarget(layout, held.paneId, target, step);
|
|
299
274
|
if (Equal.equals(next, target)) {
|
|
300
275
|
return __foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~4");
|
|
301
276
|
}
|
|
@@ -304,7 +279,7 @@ const stepHeld = (model, layout, held, step) => __foldkitBrandViewResult((Option
|
|
|
304
279
|
commands: [
|
|
305
280
|
announce(fill(COPY.over, {
|
|
306
281
|
subject: heldWords(layout, held),
|
|
307
|
-
where: landingWords(layout, held.
|
|
282
|
+
where: landingWords(layout, held.paneId, next),
|
|
308
283
|
})),
|
|
309
284
|
...scrollToTarget(model, layout, next),
|
|
310
285
|
],
|
|
@@ -312,7 +287,7 @@ const stepHeld = (model, layout, held, step) => __foldkitBrandViewResult((Option
|
|
|
312
287
|
},
|
|
313
288
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#stepHeld");
|
|
314
289
|
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");
|
|
315
|
-
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~
|
|
290
|
+
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~19")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#whileHeldBy");
|
|
316
291
|
/** The resize a splitter dragged `share` of its scale asks for: previewed while it moves, and
|
|
317
292
|
* asked for when it is let go. */
|
|
318
293
|
const resizeSplitter = (model, layout, share, isLetGo) => __foldkitBrandViewResult((Option.match(model.maybeResizing, {
|
|
@@ -333,7 +308,7 @@ const resizeSplitter = (model, layout, share, isLetGo) => __foldkitBrandViewResu
|
|
|
333
308
|
export const update = (model, message, context) => {
|
|
334
309
|
const { layout } = context;
|
|
335
310
|
return __foldkitBrandViewResult((Message.match(message, {
|
|
336
|
-
PressedGrip: ({
|
|
311
|
+
PressedGrip: ({ paneId, pointerId, clientX, clientY }) => __foldkitBrandViewResult((lift(model, layout, paneId, By.Pointer({
|
|
337
312
|
pointerId,
|
|
338
313
|
pressX: clientX,
|
|
339
314
|
pressY: clientY,
|
|
@@ -341,17 +316,17 @@ export const update = (model, message, context) => {
|
|
|
341
316
|
y: clientY,
|
|
342
317
|
isCarrying: false,
|
|
343
318
|
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#PressedGrip"),
|
|
344
|
-
PressedGripKey: ({
|
|
345
|
-
MovedPointer: (pointer) => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((movePointer(model, layout, held, pointer)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
346
|
-
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~
|
|
347
|
-
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~
|
|
348
|
-
SteppedHeld: ({ step }) => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((stepHeld(model, layout, held, step)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
349
|
-
DroppedHeld: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((letGo(model, layout, held, COPY.putBack)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
350
|
-
LeftGrip: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
319
|
+
PressedGripKey: ({ paneId }) => __foldkitBrandViewResult((lift(model, layout, paneId, By.Keyboard())), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#PressedGripKey"),
|
|
320
|
+
MovedPointer: (pointer) => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((movePointer(model, layout, held, pointer)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~20"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#MovedPointer"),
|
|
321
|
+
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~21"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#ReleasedPointer"),
|
|
322
|
+
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~22"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CancelledPointer"),
|
|
323
|
+
SteppedHeld: ({ step }) => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((stepHeld(model, layout, held, step)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~23"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#SteppedHeld"),
|
|
324
|
+
DroppedHeld: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((letGo(model, layout, held, COPY.putBack)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~24"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#DroppedHeld"),
|
|
325
|
+
LeftGrip: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~25"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#LeftGrip"),
|
|
351
326
|
PressedEscape: () => __foldkitBrandViewResult((Option.isSome(model.maybeResizing)
|
|
352
327
|
? { model: withResizing(model, Option.none()) }
|
|
353
|
-
: whileHeld(model, (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
354
|
-
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~
|
|
328
|
+
: whileHeld(model, (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~26"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#PressedEscape"),
|
|
329
|
+
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~28"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~27")), {
|
|
355
330
|
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~8")),
|
|
356
331
|
onSome: (place) => (__foldkitBrandViewResult(({ model: focusOn(model, place) }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~7")),
|
|
357
332
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#FocusedPane"),
|
|
@@ -376,7 +351,6 @@ export const update = (model, message, context) => {
|
|
|
376
351
|
CompletedAnnounceReel: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedAnnounceReel")),
|
|
377
352
|
CompletedFocusPane: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedFocusPane")),
|
|
378
353
|
CompletedRestoreFocus: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedRestoreFocus")),
|
|
379
|
-
CompletedFocusGrip: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedFocusGrip")),
|
|
380
354
|
CompletedScrollIntoView: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedScrollIntoView")),
|
|
381
355
|
CompletedSizeLiftedPane: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#CompletedSizeLiftedPane")),
|
|
382
356
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#update");
|
|
@@ -386,32 +360,32 @@ export const update = (model, message, context) => {
|
|
|
386
360
|
* Brings the reel in line with a layout that changed: call it whenever the application changes
|
|
387
361
|
* the layout, by a request it applied, another client's or one of its own (a pane closed). The
|
|
388
362
|
* focused pane's place is read again; when it has gone, focus moves to the pane now nearest
|
|
389
|
-
* where it was, and the keyboard follows where it went with the pane. A drag whose pane
|
|
390
|
-
*
|
|
363
|
+
* where it was, and the keyboard follows where it went with the pane. A drag whose pane has
|
|
364
|
+
* gone is cancelled, and one whose target's column has gone aims where it started;
|
|
391
365
|
* a splitter whose column or pane has gone lets go.
|
|
392
366
|
*/
|
|
393
367
|
export const reconcile = (model, context) => {
|
|
394
368
|
const { layout } = context;
|
|
395
|
-
const isFocusGone = Option.exists(model.maybeFocus, (focus) => __foldkitBrandViewResult((Option.isNone(placeOf(layout, focus.paneId))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
396
|
-
const maybePlace = Option.filter(focusedPlace(model, layout), () => __foldkitBrandViewResult((Option.isSome(model.maybeFocus)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
369
|
+
const isFocusGone = Option.exists(model.maybeFocus, (focus) => __foldkitBrandViewResult((Option.isNone(placeOf(layout, focus.paneId))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~29"));
|
|
370
|
+
const maybePlace = Option.filter(focusedPlace(model, layout), () => __foldkitBrandViewResult((Option.isSome(model.maybeFocus)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~30"));
|
|
397
371
|
const focused = Option.match(maybePlace, {
|
|
398
372
|
onNone: () => __foldkitBrandViewResult((model), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~10"),
|
|
399
373
|
onSome: (place) => __foldkitBrandViewResult((focusOn(model, place)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~9"),
|
|
400
374
|
});
|
|
401
|
-
const restore = Array.fromOption(Option.map(Option.filter(maybePlace, () => __foldkitBrandViewResult((isFocusGone), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
402
|
-
const settled = Option.exists(model.maybeResizing, ({ splitter }) => __foldkitBrandViewResult((isSplitterPresent(layout, splitter)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
375
|
+
const restore = Array.fromOption(Option.map(Option.filter(maybePlace, () => __foldkitBrandViewResult((isFocusGone), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~31")), (place) => __foldkitBrandViewResult((RestoreFocus({ paneHook: paneHook(model, place.pane.id) })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~32")));
|
|
376
|
+
const settled = Option.exists(model.maybeResizing, ({ splitter }) => __foldkitBrandViewResult((isSplitterPresent(layout, splitter)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~33"))
|
|
403
377
|
? focused
|
|
404
378
|
: withResizing(focused, Option.none());
|
|
405
379
|
return __foldkitBrandViewResult((Option.match(settled.maybeHeld, {
|
|
406
380
|
onNone: () => (__foldkitBrandViewResult(({ model: settled, commands: restore }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~11")),
|
|
407
381
|
onSome: (held) => {
|
|
408
|
-
if (
|
|
382
|
+
if (Option.isNone(placeOf(layout, held.paneId))) {
|
|
409
383
|
return __foldkitBrandViewResult(({
|
|
410
384
|
model: withHeld(settled, Option.none()),
|
|
411
385
|
commands: [...restore, announce(COPY.gone)],
|
|
412
386
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~10");
|
|
413
387
|
}
|
|
414
|
-
const maybeTarget = Option.orElse(Option.filter(held.maybeTarget, (target) => __foldkitBrandViewResult((isTargetPresent(layout, target)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
388
|
+
const maybeTarget = Option.orElse(Option.filter(held.maybeTarget, (target) => __foldkitBrandViewResult((isTargetPresent(layout, target)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~34")), () => (__foldkitBrandViewResult((held.by._tag === "Keyboard" ? originOf(layout, held.paneId) : Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~35")));
|
|
415
389
|
return __foldkitBrandViewResult(({
|
|
416
390
|
model: withHeld(settled, Option.some({ ...held, maybeTarget })),
|
|
417
391
|
commands: restore,
|
|
@@ -448,13 +422,13 @@ const focusStep = (model, layout, place) => (__foldkitBrandViewResult(({
|
|
|
448
422
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#focusStep"));
|
|
449
423
|
/** Asks for `request` with focus kept on the pane it moves, at its new place, the reel
|
|
450
424
|
* scrolled to it and the move said; nothing where it would change nothing. */
|
|
451
|
-
const requestStep = (model, layout, place, subject, maybeRequest) => __foldkitBrandViewResult((Option.match(Option.filter(maybeRequest, (request) => __foldkitBrandViewResult((!Equal.equals(apply(layout, request), layout)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
425
|
+
const requestStep = (model, layout, place, subject, maybeRequest) => __foldkitBrandViewResult((Option.match(Option.filter(maybeRequest, (request) => __foldkitBrandViewResult((!Equal.equals(apply(layout, request), layout)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~36")), {
|
|
452
426
|
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~12")),
|
|
453
427
|
onSome: (request) => {
|
|
454
428
|
const next = apply(layout, request);
|
|
455
|
-
const landing = Option.getOrElse(placeOf(next, place.pane.id), () => __foldkitBrandViewResult((place), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
456
|
-
const words = Option.getOrElse(subjectWords(layout, subject), () => __foldkitBrandViewResult((place.pane.label), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
457
|
-
const where = Option.getOrElse(whereWords(next, subject), () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
429
|
+
const landing = Option.getOrElse(placeOf(next, place.pane.id), () => __foldkitBrandViewResult((place), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~37"));
|
|
430
|
+
const words = Option.getOrElse(subjectWords(layout, subject), () => __foldkitBrandViewResult((place.pane.label), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~38"));
|
|
431
|
+
const where = Option.getOrElse(whereWords(next, subject), () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~39"));
|
|
458
432
|
return __foldkitBrandViewResult(({
|
|
459
433
|
model: focusOn(model, landing),
|
|
460
434
|
commands: [
|
|
@@ -465,7 +439,7 @@ const requestStep = (model, layout, place, subject, maybeRequest) => __foldkitBr
|
|
|
465
439
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~11");
|
|
466
440
|
},
|
|
467
441
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#requestStep");
|
|
468
|
-
const columnIdAt = (layout, index) => __foldkitBrandViewResult((Option.map(Array.get(layout, index), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
442
|
+
const columnIdAt = (layout, index) => __foldkitBrandViewResult((Option.map(Array.get(layout, index), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~40"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#columnIdAt");
|
|
469
443
|
/**
|
|
470
444
|
* Does what the application's key for `action` asks, from the focused pane, against the
|
|
471
445
|
* layout as the application holds it: focus moves focus the pane and scroll the reel to it;
|
|
@@ -475,14 +449,14 @@ const columnIdAt = (layout, index) => __foldkitBrandViewResult((Option.map(Array
|
|
|
475
449
|
*/
|
|
476
450
|
export const perform = (model, action, context) => {
|
|
477
451
|
const { layout } = context;
|
|
478
|
-
return __foldkitBrandViewResult((Option.match(Option.filter(focusedPlace(model, layout), () => __foldkitBrandViewResult((!isHolding(model)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
452
|
+
return __foldkitBrandViewResult((Option.match(Option.filter(focusedPlace(model, layout), () => __foldkitBrandViewResult((!isHolding(model)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~41")), {
|
|
479
453
|
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~13")),
|
|
480
454
|
onSome: (place) => {
|
|
481
455
|
const { column, columnIndex, row, pane } = place;
|
|
482
456
|
const rows = column.panes.length;
|
|
483
457
|
const paneId = pane.id;
|
|
484
458
|
const ask = (maybeRequest, subject = Subject.Pane({ paneId })) => __foldkitBrandViewResult((requestStep(model, layout, place, subject, maybeRequest)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#ask");
|
|
485
|
-
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~
|
|
459
|
+
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~42")), {
|
|
486
460
|
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~14")),
|
|
487
461
|
onSome: (next) => __foldkitBrandViewResult((next.pane.id === paneId ? { model } : focusStep(model, layout, next)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~13"),
|
|
488
462
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#focusAt");
|
|
@@ -492,10 +466,10 @@ export const perform = (model, action, context) => {
|
|
|
492
466
|
toColumnId: found.id,
|
|
493
467
|
toIndex: Math.min(row, found.panes.length),
|
|
494
468
|
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~14"),
|
|
495
|
-
onNone: () => __foldkitBrandViewResult((Option.liftPredicate(OutMessage.PulledOutPane({ paneId, maybeBeforeColumnId: edge }), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
469
|
+
onNone: () => __foldkitBrandViewResult((Option.liftPredicate(OutMessage.PulledOutPane({ paneId, maybeBeforeColumnId: edge }), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~43"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~15"),
|
|
496
470
|
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#sideways");
|
|
497
|
-
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~
|
|
498
|
-
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~
|
|
471
|
+
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~44")), Subject.Column({ columnId: column.id }))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#moveColumn");
|
|
472
|
+
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~45")), Match.when("FocusRight", () => __foldkitBrandViewResult((focusAt(columnIndex + 1, row)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~46")), Match.when("FocusUp", () => (__foldkitBrandViewResult((row > 0 ? focusAt(columnIndex, row - 1) : { model }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~47"))), Match.when("FocusDown", () => __foldkitBrandViewResult((focusAt(columnIndex, row + 1)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~48")), 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~49")), 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~50")), Match.when("MovePaneLeft", () => __foldkitBrandViewResult((sideways(columnIndex - 1, columnIdAt(layout, 0))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~51")), Match.when("MovePaneRight", () => __foldkitBrandViewResult((sideways(columnIndex + 1, Option.none())), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~52")), 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~54")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~53")), 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~56")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~55")), Match.when("CycleWidth", () => {
|
|
499
473
|
const width = nextPreset(column.width);
|
|
500
474
|
return __foldkitBrandViewResult(({
|
|
501
475
|
model,
|
|
@@ -504,11 +478,11 @@ export const perform = (model, action, context) => {
|
|
|
504
478
|
announce(fill(COPY.widened, { column: columnIndex + 1, width: widthWords(width) })),
|
|
505
479
|
],
|
|
506
480
|
outMessage: OutMessage.ResizedColumn({ columnId: column.id, width }),
|
|
507
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
481
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~57");
|
|
508
482
|
}), Match.when("PullOut", () => __foldkitBrandViewResult((ask(Option.liftPredicate(OutMessage.PulledOutPane({
|
|
509
483
|
paneId,
|
|
510
484
|
maybeBeforeColumnId: columnIdAt(layout, columnIndex + 1),
|
|
511
|
-
}), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
485
|
+
}), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~59")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~58")), Match.exhaustive)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~12");
|
|
512
486
|
},
|
|
513
487
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#perform");
|
|
514
488
|
};
|
|
@@ -520,43 +494,43 @@ const EDGE_SCROLL_PIXELS_PER_MILLI = 0.8;
|
|
|
520
494
|
const LONGEST_FRAME_MILLIS = 50;
|
|
521
495
|
/** A column as the pointer reads it from the page: its edges, and the middles of its slots
|
|
522
496
|
* but the held pane's. */
|
|
523
|
-
const columnBoxOf = (element,
|
|
497
|
+
const columnBoxOf = (element, heldId) => {
|
|
524
498
|
const rect = element.getBoundingClientRect();
|
|
525
|
-
const heldId = Subject.match(subject, {
|
|
526
|
-
Pane: ({ paneId }) => __foldkitBrandViewResult((Option.some(paneId)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Pane~2"),
|
|
527
|
-
Column: () => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Column~2"),
|
|
528
|
-
});
|
|
529
499
|
return __foldkitBrandViewResult(({
|
|
530
500
|
id: element.getAttribute("data-reel-column") ?? "",
|
|
531
501
|
left: rect.left,
|
|
532
502
|
right: rect.right,
|
|
533
|
-
slotMiddles: Array.map(Array.filter(Array.fromIterable(element.querySelectorAll("[data-reel-slot]")), (slot) => __foldkitBrandViewResult((
|
|
503
|
+
slotMiddles: 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~60")), (slot) => {
|
|
534
504
|
const slotRect = slot.getBoundingClientRect();
|
|
535
|
-
return __foldkitBrandViewResult((slotRect.top + slotRect.height / 2), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
505
|
+
return __foldkitBrandViewResult((slotRect.top + slotRect.height / 2), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~61");
|
|
536
506
|
}),
|
|
537
507
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#columnBoxOf");
|
|
538
508
|
};
|
|
539
|
-
/** Where a pointer at (`clientX`, `clientY`) would drop `
|
|
540
|
-
* names, read from where its columns and their slots sit: none outside the reel. */
|
|
541
|
-
const pointerTarget = (reelHook,
|
|
509
|
+
/** Where a pointer at (`clientX`, `clientY`) would drop the pane `paneId` in the reel
|
|
510
|
+
* `reelHook` names, read from where its columns and their slots sit: none outside the reel. */
|
|
511
|
+
const pointerTarget = (reelHook, paneId, clientX, clientY) => __foldkitBrandViewResult((Option.map(Option.filter(scrollerOf(reelHook), (view) => {
|
|
542
512
|
const rect = view.getBoundingClientRect();
|
|
543
513
|
return (__foldkitBrandViewResult((clientX >= rect.left &&
|
|
544
514
|
clientX <= rect.right &&
|
|
545
515
|
clientY >= rect.top &&
|
|
546
|
-
clientY <= rect.bottom), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
547
|
-
}), (view) => __foldkitBrandViewResult((targetAtPoint(
|
|
516
|
+
clientY <= rect.bottom), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~62"));
|
|
517
|
+
}), (view) => __foldkitBrandViewResult((targetAtPoint(Array.map(Array.fromIterable(view.querySelectorAll("[data-reel-column]")), (element) => __foldkitBrandViewResult((columnBoxOf(element, paneId)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~64")), clientX, clientY)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~63"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#pointerTarget");
|
|
548
518
|
const PointerHold = Schema.Struct({
|
|
549
519
|
reelHook: Schema.String,
|
|
550
|
-
|
|
520
|
+
paneId: Schema.String,
|
|
551
521
|
pointerId: Schema.Number,
|
|
552
522
|
});
|
|
553
523
|
const pointerAt = (hold, event) => (__foldkitBrandViewResult(({
|
|
554
524
|
clientX: event.clientX,
|
|
555
525
|
clientY: event.clientY,
|
|
556
|
-
maybeTarget: pointerTarget(hold.reelHook, hold.
|
|
526
|
+
maybeTarget: pointerTarget(hold.reelHook, hold.paneId, event.clientX, event.clientY),
|
|
557
527
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#pointerAt"));
|
|
558
528
|
/** The pressing pointer's moves, release and cancel; another pointer's are not the reel's. */
|
|
559
|
-
const pointerMessages = (hold) => __foldkitBrandViewResult((
|
|
529
|
+
const pointerMessages = (hold) => __foldkitBrandViewResult((dragMessages(hold.pointerId, {
|
|
530
|
+
moved: (event) => __foldkitBrandViewResult((Message.MovedPointer(pointerAt(hold, event))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#moved"),
|
|
531
|
+
released: (event) => __foldkitBrandViewResult((Message.ReleasedPointer(pointerAt(hold, event))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#released"),
|
|
532
|
+
cancelled: () => __foldkitBrandViewResult((Message.CancelledPointer()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#cancelled"),
|
|
533
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#pointerMessages");
|
|
560
534
|
/** Which way a pointer at `at` scrolls a box from `low` to `high`: towards the edge it is near. */
|
|
561
535
|
const towards = (at, low, high) => {
|
|
562
536
|
if (at < low + EDGE_SCROLL) {
|
|
@@ -569,7 +543,7 @@ const towards = (at, low, high) => {
|
|
|
569
543
|
return __foldkitBrandViewResult((0), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#towards");
|
|
570
544
|
}
|
|
571
545
|
};
|
|
572
|
-
/** While a pointer carries a pane
|
|
546
|
+
/** While a pointer carries a pane near the reel's edges, the reel scrolls that way,
|
|
573
547
|
* by the time each frame took, so a drop can reach a column or a place out of view. */
|
|
574
548
|
const edgeScroll = (hold) => __foldkitBrandViewResult((Stream.callback(() => __foldkitBrandViewResult((Effect.acquireRelease(Effect.sync(() => {
|
|
575
549
|
const state = {
|
|
@@ -594,11 +568,11 @@ const edgeScroll = (hold) => __foldkitBrandViewResult((Stream.callback(() => __f
|
|
|
594
568
|
};
|
|
595
569
|
document.addEventListener("pointermove", onMove);
|
|
596
570
|
state.frame = requestAnimationFrame(step);
|
|
597
|
-
return __foldkitBrandViewResult(({ state, onMove }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
571
|
+
return __foldkitBrandViewResult(({ state, onMove }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~66");
|
|
598
572
|
}), ({ state, onMove }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
599
573
|
cancelAnimationFrame(state.frame);
|
|
600
574
|
document.removeEventListener("pointermove", onMove);
|
|
601
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
575
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~68")).pipe(Effect.flatMap(() => __foldkitBrandViewResult((Effect.never), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~70")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~65"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#edgeScroll");
|
|
602
576
|
const SplitterHold = Schema.Struct({
|
|
603
577
|
reelHook: Schema.String,
|
|
604
578
|
splitter: Splitter,
|
|
@@ -612,12 +586,12 @@ const heightOf = (element) => __foldkitBrandViewResult((element.getBoundingClien
|
|
|
612
586
|
* column's panes' height for a pane splitter. */
|
|
613
587
|
const scaleOf = (hold) => __foldkitBrandViewResult((Option.getOrElse(Option.map(scrollerOf(hold.reelHook), (view) => __foldkitBrandViewResult((Splitter.match(hold.splitter, {
|
|
614
588
|
Width: () => __foldkitBrandViewResult((view.clientWidth -
|
|
615
|
-
Option.getOrElse(Option.map(Option.fromNullishOr(view.querySelector(".reel-gap")), (gap) => __foldkitBrandViewResult((gap.getBoundingClientRect().width), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
589
|
+
Option.getOrElse(Option.map(Option.fromNullishOr(view.querySelector(".reel-gap")), (gap) => __foldkitBrandViewResult((gap.getBoundingClientRect().width), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~72")), () => __foldkitBrandViewResult((0), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~73"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Width"),
|
|
616
590
|
Split: ({ abovePaneId }) => __foldkitBrandViewResult((Number.sumAll(Array.map(Array.fromIterable(view
|
|
617
591
|
.querySelector(`[data-reel-slot="${CSS.escape(abovePaneId)}"]`)
|
|
618
592
|
?.closest(".reel-column")
|
|
619
593
|
?.querySelectorAll("[data-reel-slot]") ?? []), heightOf))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Split"),
|
|
620
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
594
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~71")), () => __foldkitBrandViewResult((0), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~74"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#scaleOf");
|
|
621
595
|
/** The dragging pointer's moves, release and cancel, as shares of the splitter's scale. */
|
|
622
596
|
const splitterMessages = (hold) => __foldkitBrandViewResult((Stream.suspend(() => {
|
|
623
597
|
const scale = scaleOf(hold);
|
|
@@ -625,14 +599,18 @@ const splitterMessages = (hold) => __foldkitBrandViewResult((Stream.suspend(() =
|
|
|
625
599
|
const moved = hold.splitter._tag === "Width" ? event.clientX - hold.pressX : event.clientY - hold.pressY;
|
|
626
600
|
return __foldkitBrandViewResult((scale > 0 ? moved / scale : 0), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#shareOf");
|
|
627
601
|
};
|
|
628
|
-
return __foldkitBrandViewResult((
|
|
602
|
+
return __foldkitBrandViewResult((dragMessages(hold.pointerId, {
|
|
603
|
+
moved: (event) => __foldkitBrandViewResult((Message.MovedSplitter({ share: shareOf(event) })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#moved~2"),
|
|
604
|
+
released: (event) => __foldkitBrandViewResult((Message.ReleasedSplitter({ share: shareOf(event) })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#released~2"),
|
|
605
|
+
cancelled: () => __foldkitBrandViewResult((Message.CancelledSplitter()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#cancelled~2"),
|
|
606
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~75");
|
|
629
607
|
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#splitterMessages");
|
|
630
|
-
const pointerHoldOf = (model, isCarryingOnly) => __foldkitBrandViewResult((Option.flatMap(model.maybeHeld, ({
|
|
608
|
+
const pointerHoldOf = (model, isCarryingOnly) => __foldkitBrandViewResult((Option.flatMap(model.maybeHeld, ({ paneId, by }) => __foldkitBrandViewResult((By.match(by, {
|
|
631
609
|
Keyboard: () => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Keyboard~3"),
|
|
632
610
|
Pointer: ({ pointerId, isCarrying }) => __foldkitBrandViewResult((isCarryingOnly && !isCarrying
|
|
633
611
|
? Option.none()
|
|
634
|
-
: Option.some({ reelHook: model.id,
|
|
635
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
612
|
+
: Option.some({ reelHook: model.id, paneId, pointerId })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Pointer~3"),
|
|
613
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~76"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#pointerHoldOf");
|
|
636
614
|
const reelSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResult(({
|
|
637
615
|
pointer: entry({ maybeHold: Schema.Option(PointerHold) }, {
|
|
638
616
|
modelToDependencies: (model) => (__foldkitBrandViewResult(({ maybeHold: pointerHoldOf(model, false) }), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#modelToDependencies")),
|
|
@@ -653,7 +631,7 @@ const reelSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResu
|
|
|
653
631
|
pointerId,
|
|
654
632
|
pressX,
|
|
655
633
|
pressY,
|
|
656
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
634
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~78"))),
|
|
657
635
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#modelToDependencies~3")),
|
|
658
636
|
dependenciesToStream: ({ maybeHold }) => __foldkitBrandViewResult((Option.match(maybeHold, {
|
|
659
637
|
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~18"),
|
|
@@ -666,8 +644,8 @@ const reelSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResu
|
|
|
666
644
|
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#modelToDependencies~4")),
|
|
667
645
|
dependenciesToStream: ({ isHolding: isHoldingNow }) => __foldkitBrandViewResult((isHoldingNow ? escapeKeys(Message.PressedEscape()) : Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#dependenciesToStream~4"),
|
|
668
646
|
}),
|
|
669
|
-
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
670
|
-
/** A held pane
|
|
647
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~77")));
|
|
648
|
+
/** A held pane follows the pointer (the reel scrolling near its edges), a dragged
|
|
671
649
|
* splitter resizes, and Escape puts either back, before a dialog or the page sees it, from
|
|
672
650
|
* listeners that run only while something is held. Lift them into the application's
|
|
673
651
|
* Subscriptions, once per reel, behind a key prefix of the parent's: `subscriptions("tiles")`
|
|
@@ -681,8 +659,8 @@ export const SizeLiftedPane = Mount.define("SizeLiftedPane", {
|
|
|
681
659
|
messages: [Message.CompletedSizeLiftedPane],
|
|
682
660
|
execute: ({ element, sourceSelector, pressX, pressY }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
683
661
|
measureLift(element, sourceSelector, pressX, pressY);
|
|
684
|
-
return __foldkitBrandViewResult((Message.CompletedSizeLiftedPane()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
685
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~
|
|
662
|
+
return __foldkitBrandViewResult((Message.CompletedSizeLiftedPane()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~79");
|
|
663
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#execute~5"),
|
|
686
664
|
});
|
|
687
665
|
const helpId = (model) => __foldkitBrandViewResult((`${model.id}-grip-help`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#helpId");
|
|
688
666
|
/** The share of the reel or the column a splitter's arrow key moves. */
|
|
@@ -693,52 +671,42 @@ const HELD_STEPS = {
|
|
|
693
671
|
ArrowLeft: "Left",
|
|
694
672
|
ArrowRight: "Right",
|
|
695
673
|
};
|
|
696
|
-
const isPlain = (modifiers) => __foldkitBrandViewResult((!modifiers.shiftKey && !modifiers.ctrlKey && !modifiers.altKey && !modifiers.metaKey), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#isPlain");
|
|
697
674
|
const isDropKey = (key) => __foldkitBrandViewResult((key === " " || key === "Enter"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#isDropKey");
|
|
698
675
|
/** The anchor that pins a pane to its slot. Pane ids are the application's, so the name is
|
|
699
676
|
* the pane's place in the id order, which the slot and the pane read from one list. */
|
|
700
677
|
const anchorName = (index) => __foldkitBrandViewResult((`--reel-${index}`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anchorName");
|
|
701
678
|
/** The panes in their layer's order: by id, which no move changes. */
|
|
702
|
-
const byId = Order.mapInput(Order.String, (pane) => __foldkitBrandViewResult((pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
679
|
+
const byId = Order.mapInput(Order.String, (pane) => __foldkitBrandViewResult((pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~80"));
|
|
703
680
|
/** Where a carried drop would land, marked: none where it would change nothing. */
|
|
704
|
-
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.
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
onSome: ({ subject }) => __foldkitBrandViewResult((Subject.match(subject, {
|
|
708
|
-
Pane: ({ paneId }) => __foldkitBrandViewResult(([paneId]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Pane~3"),
|
|
709
|
-
Column: ({ columnId }) => __foldkitBrandViewResult((Option.match(columnOf(layout, columnId), {
|
|
710
|
-
onNone: () => __foldkitBrandViewResult(([]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~20"),
|
|
711
|
-
onSome: (column) => __foldkitBrandViewResult((Array.map(column.panes, (pane) => __foldkitBrandViewResult((pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~93"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~18"),
|
|
712
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Column~3"),
|
|
713
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~17"),
|
|
714
|
-
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#heldPanesOf");
|
|
715
|
-
const gripView = (model, subject, label, h) => {
|
|
681
|
+
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~82"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~81"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#markOf");
|
|
682
|
+
const carriedIdOf = (model) => __foldkitBrandViewResult((Option.map(Option.filter(model.maybeHeld, isCarried), ({ paneId }) => __foldkitBrandViewResult((paneId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~83"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#carriedIdOf");
|
|
683
|
+
const gripView = (model, pane, h) => {
|
|
716
684
|
const isIdleNow = !isHolding(model) && Option.isNone(model.maybeResizing);
|
|
717
|
-
const maybeHeldHere = Option.filter(model.maybeHeld, (held) => __foldkitBrandViewResult((
|
|
685
|
+
const maybeHeldHere = Option.filter(model.maybeHeld, (held) => __foldkitBrandViewResult((held.paneId === pane.id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~84"));
|
|
718
686
|
const isHeld = Option.exists(maybeHeldHere, isCarried);
|
|
719
|
-
const isKeyboardHeld = Option.exists(maybeHeldHere, (held) => __foldkitBrandViewResult((held.by._tag === "Keyboard"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
687
|
+
const isKeyboardHeld = Option.exists(maybeHeldHere, (held) => __foldkitBrandViewResult((held.by._tag === "Keyboard"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~85"));
|
|
720
688
|
// the keyboard holds an item on its grip: the keys are the grip's own, and focus leaving the
|
|
721
689
|
// grip puts the item back, so a field reached by Tab types as it should
|
|
722
690
|
const onGripKey = h.OnKeyDownPreventDefault((key, modifiers) => {
|
|
723
691
|
if (!isPlain(modifiers)) {
|
|
724
|
-
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
692
|
+
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~86");
|
|
725
693
|
}
|
|
726
694
|
else if (isKeyboardHeld) {
|
|
727
695
|
return __foldkitBrandViewResult((isDropKey(key)
|
|
728
696
|
? Option.some(Message.DroppedHeld())
|
|
729
|
-
: Option.map(Option.fromNullishOr(HELD_STEPS[key]), (step) => __foldkitBrandViewResult((Message.SteppedHeld({ step })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
697
|
+
: Option.map(Option.fromNullishOr(HELD_STEPS[key]), (step) => __foldkitBrandViewResult((Message.SteppedHeld({ step })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~87"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~86");
|
|
730
698
|
}
|
|
731
699
|
else {
|
|
732
|
-
return __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGripKey({
|
|
700
|
+
return __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGripKey({ paneId: pane.id }), () => __foldkitBrandViewResult((isIdleNow && isDropKey(key)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~88"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~86");
|
|
733
701
|
}
|
|
734
702
|
});
|
|
735
|
-
const onGripPress = h.OnPointerDown((_pointerType, button, _screenX, _screenY, _time, clientX, clientY, pointerId) => __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGrip({
|
|
703
|
+
const onGripPress = h.OnPointerDown((_pointerType, button, _screenX, _screenY, _time, clientX, clientY, pointerId) => __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGrip({ paneId: pane.id, pointerId, clientX, clientY }), () => __foldkitBrandViewResult((isIdleNow && button === LEFT_BUTTON), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~90"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~89"));
|
|
736
704
|
return __foldkitBrandViewResult((IconButton.view({
|
|
737
705
|
glyph: "grip",
|
|
738
|
-
label,
|
|
706
|
+
label: fill(COPY.paneGrip, { pane: pane.label }),
|
|
739
707
|
isQuiet: true,
|
|
740
708
|
attributes: [
|
|
741
|
-
h.DataAttribute("reel-grip",
|
|
709
|
+
h.DataAttribute("reel-grip", paneHook(model, pane.id)),
|
|
742
710
|
h.AriaRoleDescription("draggable"),
|
|
743
711
|
h.AriaDescribedBy(helpId(model)),
|
|
744
712
|
Button.pressedAttribute(isHeld, h),
|
|
@@ -748,26 +716,21 @@ const gripView = (model, subject, label, h) => {
|
|
|
748
716
|
],
|
|
749
717
|
}, h)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#gripView");
|
|
750
718
|
};
|
|
751
|
-
/** A splitter's handlers: a pointer drags it, and its arrows
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
splitter,
|
|
759
|
-
share: key === more ? SPLITTER_STEP : -SPLITTER_STEP,
|
|
760
|
-
}), () => __foldkitBrandViewResult((isPlain(modifiers) && (key === less || key === more)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~104"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~103")),
|
|
761
|
-
]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#splitterAttributes");
|
|
762
|
-
};
|
|
719
|
+
/** A splitter's handlers: a pointer drags it, and its arrows step it by `SPLITTER_STEP`. */
|
|
720
|
+
const reelSplitterAttributes = (model, splitter, h) => __foldkitBrandViewResult((splitterAttributes({
|
|
721
|
+
orientation: splitter._tag === "Width" ? "vertical" : "horizontal",
|
|
722
|
+
isIdle: !isHolding(model) && Option.isNone(model.maybeResizing),
|
|
723
|
+
onPress: (pointerId, clientX, clientY) => __foldkitBrandViewResult((Message.PressedSplitter({ splitter, pointerId, clientX, clientY })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onPress"),
|
|
724
|
+
onStep: (direction) => __foldkitBrandViewResult((Message.PressedSplitterKey({ splitter, share: direction * SPLITTER_STEP })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onStep"),
|
|
725
|
+
}, h)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#reelSplitterAttributes");
|
|
763
726
|
const dropClass = (info, column, paneId) => __foldkitBrandViewResult((Option.match(Option.flatMap(info.maybeMark, (mark) => {
|
|
764
727
|
if (mark._tag !== "Into" || mark.columnId !== column.id) {
|
|
765
|
-
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
728
|
+
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~91");
|
|
766
729
|
}
|
|
767
|
-
const others = Array.filter(column.panes, (pane) => __foldkitBrandViewResult((!info.
|
|
768
|
-
return __foldkitBrandViewResult((Option.orElse(Option.map(Option.filter(Array.get(others, mark.index), (pane) => __foldkitBrandViewResult((pane.id === paneId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
769
|
-
}), { onNone: () => __foldkitBrandViewResult((""), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~
|
|
770
|
-
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~
|
|
730
|
+
const others = Array.filter(column.panes, (pane) => __foldkitBrandViewResult((!Option.contains(info.maybeCarriedId, pane.id)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~92"));
|
|
731
|
+
return __foldkitBrandViewResult((Option.orElse(Option.map(Option.filter(Array.get(others, mark.index), (pane) => __foldkitBrandViewResult((pane.id === paneId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~93")), () => __foldkitBrandViewResult((" drop-before"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~94")), () => __foldkitBrandViewResult((Option.map(Option.filter(Array.last(others), (pane) => __foldkitBrandViewResult((mark.index >= others.length && pane.id === paneId), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~96")), () => __foldkitBrandViewResult((" drop-after"), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~97"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~95"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~91");
|
|
732
|
+
}), { onNone: () => __foldkitBrandViewResult((""), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~19"), onSome: (mark) => __foldkitBrandViewResult((mark), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~17") })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#dropClass");
|
|
733
|
+
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~98"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#isGapMarked");
|
|
771
734
|
const slotView = (info, anchors, column, pane, h) => __foldkitBrandViewResult((h.keyed("div")(pane.id, [
|
|
772
735
|
h.Class(`reel-slot${dropClass(info, column, pane.id)}`),
|
|
773
736
|
h.DataAttribute("reel-slot", pane.id),
|
|
@@ -776,40 +739,32 @@ const slotView = (info, anchors, column, pane, h) => __foldkitBrandViewResult((h
|
|
|
776
739
|
const splitView = (model, above, share, h) => __foldkitBrandViewResult((h.keyed("div")(`split:${above.id}`, [
|
|
777
740
|
h.Class("reel-split"),
|
|
778
741
|
h.Role("separator"),
|
|
779
|
-
h.AriaOrientation("horizontal"),
|
|
780
742
|
h.AriaLabel(fill(COPY.heightLabel, { pane: above.label })),
|
|
781
743
|
h.AriaValuemin(0),
|
|
782
744
|
h.AriaValuemax(100),
|
|
783
745
|
h.AriaValuenow(Math.round(share * 100)),
|
|
784
746
|
h.Tabindex(0),
|
|
785
747
|
h.DataAttribute("reel-split", above.id),
|
|
786
|
-
...
|
|
748
|
+
...reelSplitterAttributes(model, Splitter.Split({ abovePaneId: above.id }), h),
|
|
787
749
|
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#splitView");
|
|
788
750
|
const columnView = (info, anchors, column, index, h) => {
|
|
789
751
|
const { model, layout } = info;
|
|
790
|
-
const total = Number.sumAll(Array.map(column.panes, (pane) => __foldkitBrandViewResult((pane.weight), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
752
|
+
const total = Number.sumAll(Array.map(column.panes, (pane) => __foldkitBrandViewResult((pane.weight), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~99")));
|
|
791
753
|
const stack = Array.flatMap(column.panes, (pane, row) => __foldkitBrandViewResult(([
|
|
792
|
-
...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~
|
|
754
|
+
...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~101"))),
|
|
793
755
|
slotView(info, anchors, column, pane, h),
|
|
794
|
-
]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
795
|
-
const maybeNextId = Option.map(Array.get(layout, index + 1), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
756
|
+
]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~100"));
|
|
757
|
+
const maybeNextId = Option.map(Array.get(layout, index + 1), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~102"));
|
|
796
758
|
return __foldkitBrandViewResult(([
|
|
797
759
|
h.keyed("div")(`column:${column.id}`, [
|
|
798
760
|
h.Class("reel-column"),
|
|
799
761
|
h.DataAttribute("reel-column", column.id),
|
|
800
762
|
h.DataAttribute("reel-hook", columnHook(model, column.id)),
|
|
801
763
|
h.Style({ "--reel-width": `${column.width}` }),
|
|
802
|
-
],
|
|
803
|
-
h.div([h.Class("reel-column-head")], [
|
|
804
|
-
gripView(model, Subject.Column({ columnId: column.id }), fill(COPY.columnGrip, { column: index + 1 }), h),
|
|
805
|
-
h.span([h.Class("reel-width"), h.AriaHidden(true)], [widthMark(column.width)]),
|
|
806
|
-
]),
|
|
807
|
-
...stack,
|
|
808
|
-
]),
|
|
764
|
+
], stack),
|
|
809
765
|
h.keyed("div")(`resize:${column.id}`, [
|
|
810
766
|
h.Class(`reel-gap reel-resize${isGapMarked(info, maybeNextId) ? " drop-here" : ""}`),
|
|
811
767
|
h.Role("separator"),
|
|
812
|
-
h.AriaOrientation("vertical"),
|
|
813
768
|
h.AriaLabel(fill(COPY.widthLabel, { column: index + 1 })),
|
|
814
769
|
h.AriaValuemin(0),
|
|
815
770
|
h.AriaValuemax(100),
|
|
@@ -817,7 +772,7 @@ const columnView = (info, anchors, column, index, h) => {
|
|
|
817
772
|
h.AriaValuetext(widthWords(column.width)),
|
|
818
773
|
h.Tabindex(0),
|
|
819
774
|
h.DataAttribute("reel-resize", column.id),
|
|
820
|
-
...
|
|
775
|
+
...reelSplitterAttributes(model, Splitter.Width({ columnId: column.id }), h),
|
|
821
776
|
]),
|
|
822
777
|
]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#columnView");
|
|
823
778
|
};
|
|
@@ -828,7 +783,7 @@ const paneLayerView = (info, panes, anchors, h) => {
|
|
|
828
783
|
// drop focus, a terminal's scroll and whatever a Mount holds inside it.
|
|
829
784
|
return __foldkitBrandViewResult((h.div([h.Class("reel-panes")], Array.map(panes, (pane) => {
|
|
830
785
|
const isFocused = Option.contains(info.maybeFocusedId, pane.id);
|
|
831
|
-
const isHeld = info.
|
|
786
|
+
const isHeld = Option.contains(info.maybeCarriedId, pane.id);
|
|
832
787
|
return __foldkitBrandViewResult((h.keyed("div")(pane.id, [
|
|
833
788
|
h.Class(`reel-pane${isFocused ? " focused" : ""}${isHeld ? " drag-dim" : ""}`),
|
|
834
789
|
h.DataAttribute("reel-pane", paneHook(model, pane.id)),
|
|
@@ -837,14 +792,14 @@ const paneLayerView = (info, panes, anchors, h) => {
|
|
|
837
792
|
h.OnFocusEnter(Message.FocusedPane({ paneId: pane.id })),
|
|
838
793
|
], [
|
|
839
794
|
info.toPaneView(pane, {
|
|
840
|
-
grip: gripView(model,
|
|
795
|
+
grip: gripView(model, pane, h),
|
|
841
796
|
id: `${model.id}-${pane.id}`,
|
|
842
797
|
}),
|
|
843
|
-
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
798
|
+
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~103");
|
|
844
799
|
}))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#paneLayerView");
|
|
845
800
|
};
|
|
846
|
-
/** The copy a pointer carries: the held
|
|
847
|
-
*
|
|
801
|
+
/** The copy a pointer carries: the held pane's title bar, drawn by the reel from its label,
|
|
802
|
+
* so whatever a pane holds (a terminal, a canvas) is never built twice. */
|
|
848
803
|
const liftedCopyView = (info, h) => {
|
|
849
804
|
const { model, layout } = info;
|
|
850
805
|
return __foldkitBrandViewResult((Array.fromOption(Option.flatMap(model.maybeHeld, (held) => __foldkitBrandViewResult((By.match(held.by, {
|
|
@@ -855,68 +810,62 @@ const liftedCopyView = (info, h) => {
|
|
|
855
810
|
h.AriaHidden(true),
|
|
856
811
|
h.Inert(true),
|
|
857
812
|
h.OnMount(SizeLiftedPane({
|
|
858
|
-
sourceSelector:
|
|
859
|
-
Pane: () => __foldkitBrandViewResult((`[data-reel-pane="${CSS.escape(subjectHook(model, held.subject))}"]`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Pane~4"),
|
|
860
|
-
Column: () => __foldkitBrandViewResult((`[data-reel-hook="${CSS.escape(subjectHook(model, held.subject))}"]`), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Column~4"),
|
|
861
|
-
}),
|
|
813
|
+
sourceSelector: `[data-reel-pane="${CSS.escape(paneHook(model, held.paneId))}"]`,
|
|
862
814
|
pressX,
|
|
863
815
|
pressY,
|
|
864
816
|
})),
|
|
865
817
|
], [
|
|
866
|
-
h.div([h.Class("
|
|
818
|
+
h.div([h.Class("panel window")], [
|
|
867
819
|
h.div([h.Class("panel-tb")], [
|
|
868
|
-
h.span([h.Class("panel-lead")], [
|
|
869
|
-
|
|
870
|
-
]),
|
|
871
|
-
h.h2([], [pane.label]),
|
|
820
|
+
h.span([h.Class("panel-lead")], [h.span([h.Class("iconbtn quiet")], [Glyph.view({ name: "grip" }, h)])]),
|
|
821
|
+
h.h2([], [heldWords(layout, held)]),
|
|
872
822
|
]),
|
|
873
|
-
])
|
|
874
|
-
]), () => __foldkitBrandViewResult((isCarrying), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
875
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
823
|
+
]),
|
|
824
|
+
]), () => __foldkitBrandViewResult((isCarrying), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~105"))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#Pointer~4"),
|
|
825
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~104")))), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#liftedCopyView");
|
|
876
826
|
};
|
|
877
827
|
/** The layout as it prints, with a dragged splitter's resize shown before it is asked for. */
|
|
878
|
-
const previewed = (model, layout) => __foldkitBrandViewResult((Option.match(Option.flatMap(model.maybeResizing, ({ maybeResize }) => __foldkitBrandViewResult((maybeResize), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
828
|
+
const previewed = (model, layout) => __foldkitBrandViewResult((Option.match(Option.flatMap(model.maybeResizing, ({ maybeResize }) => __foldkitBrandViewResult((maybeResize), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~106")), { onNone: () => __foldkitBrandViewResult((layout), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onNone~20"), onSome: (resize) => __foldkitBrandViewResult((apply(layout, resize)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#onSome~18") })), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#previewed");
|
|
879
829
|
/**
|
|
880
830
|
* A row of columns wider than the view when it must be, each a stack of panes, scrolled
|
|
881
831
|
* sideways, and down where a column is taller than the view: `div.reel` holding the scroller
|
|
882
|
-
* `div.reel-view`, whose `div.reel-track` lays out the columns (`div.reel-column`,
|
|
883
|
-
*
|
|
884
|
-
*
|
|
885
|
-
*
|
|
886
|
-
* each pane renders through `toPaneView`.
|
|
832
|
+
* `div.reel-view`, whose `div.reel-track` lays out the columns (`div.reel-column`, a slot per
|
|
833
|
+
* pane with a splitter between) with a splitter after each, and the panes themselves in
|
|
834
|
+
* `div.reel-panes`, each pinned to its slot by anchor positioning. The reel takes its height
|
|
835
|
+
* from whatever holds it. The layout is the parent's; each pane renders through `toPaneView`.
|
|
887
836
|
*
|
|
888
|
-
* A pane's grip
|
|
889
|
-
*
|
|
890
|
-
*
|
|
837
|
+
* A pane's grip lifts it under a pointer or the keyboard: Space or Enter picks it up, the
|
|
838
|
+
* arrows move it (left and right through the gaps and columns, up and down among a column's
|
|
839
|
+
* panes), Space drops it, and Escape or Tab puts it back. A drop reports what it asks
|
|
891
840
|
* of the layout as the OutMessage. Lift `subscriptions(keyPrefix)` into the application's, or
|
|
892
841
|
* nothing follows the pointer, and call `reconcile` whenever the layout changes.
|
|
893
842
|
*/
|
|
894
843
|
export const view = defineView((model, viewInputs, h) => {
|
|
895
844
|
const { label, toPaneView } = viewInputs;
|
|
896
845
|
const layout = previewed(model, viewInputs.layout);
|
|
897
|
-
const panes = Array.sort(Array.flatMap(layout, (column) => __foldkitBrandViewResult((column.panes), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
898
|
-
const anchors = new Map(Array.map(panes, (pane, index) => __foldkitBrandViewResult(([pane.id, anchorName(index)]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
846
|
+
const panes = Array.sort(Array.flatMap(layout, (column) => __foldkitBrandViewResult((column.panes), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~108")), byId);
|
|
847
|
+
const anchors = new Map(Array.map(panes, (pane, index) => __foldkitBrandViewResult(([pane.id, anchorName(index)]), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~109")));
|
|
899
848
|
const info = {
|
|
900
849
|
model,
|
|
901
850
|
layout,
|
|
902
851
|
toPaneView,
|
|
903
852
|
maybeFocusedId: focusedPaneId(model, layout),
|
|
904
853
|
maybeMark: markOf(model, layout),
|
|
905
|
-
|
|
854
|
+
maybeCarriedId: carriedIdOf(model),
|
|
906
855
|
};
|
|
907
856
|
return __foldkitBrandViewResult((h.div([h.Class("reel"), h.Role("group"), h.AriaLabel(label), h.DataAttribute("reel", model.id)], [
|
|
908
857
|
h.div([h.Class("reel-view")], [
|
|
909
858
|
h.div([h.Class("reel-track")], [
|
|
910
859
|
h.keyed("div")("gap:start", [
|
|
911
|
-
h.Class(`reel-gap${isGapMarked(info, Option.map(Array.head(layout), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
860
|
+
h.Class(`reel-gap${isGapMarked(info, Option.map(Array.head(layout), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~110")))
|
|
912
861
|
? " drop-here"
|
|
913
862
|
: ""}`),
|
|
914
863
|
]),
|
|
915
|
-
...Array.flatMap(layout, (column, index) => __foldkitBrandViewResult((columnView(info, anchors, column, index, h)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
864
|
+
...Array.flatMap(layout, (column, index) => __foldkitBrandViewResult((columnView(info, anchors, column, index, h)), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~111")),
|
|
916
865
|
paneLayerView(info, panes, anchors, h),
|
|
917
866
|
]),
|
|
918
867
|
]),
|
|
919
868
|
h.p([h.Id(helpId(model)), h.Class("sr-only")], [COPY.gripHelp]),
|
|
920
869
|
...liftedCopyView(info, h),
|
|
921
|
-
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~
|
|
870
|
+
])), "@gjermundgaraba-designs/pixel-paper/src/reel/reel.js#anonymous~107");
|
|
922
871
|
});
|