@gjermundgaraba/pixel-paper 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/announcer/announcer.d.ts +35 -0
- package/dist/announcer/announcer.js +121 -0
- package/dist/announcer/index.d.ts +5 -0
- package/dist/announcer/index.js +11 -0
- package/dist/attributes/attributes.d.ts +4 -0
- package/dist/banner/banner.d.ts +20 -0
- package/dist/banner/banner.js +18 -0
- package/dist/banner/index.d.ts +5 -0
- package/dist/banner/index.js +6 -0
- package/dist/bench/bench.d.ts +16 -0
- package/dist/bench/bench.js +12 -0
- package/dist/bench/index.d.ts +5 -0
- package/dist/bench/index.js +6 -0
- package/dist/board/board.d.ts +1151 -0
- package/dist/board/board.js +449 -0
- package/dist/board/index.d.ts +6 -0
- package/dist/board/index.js +21 -0
- package/dist/button/button.d.ts +54 -0
- package/dist/button/button.js +50 -0
- package/dist/button/index.d.ts +5 -0
- package/dist/button/index.js +9 -0
- package/dist/card/card.d.ts +66 -0
- package/dist/card/card.js +70 -0
- package/dist/card/index.d.ts +5 -0
- package/dist/card/index.js +10 -0
- package/dist/chip/chip.d.ts +27 -0
- package/dist/chip/chip.js +34 -0
- package/dist/chip/index.d.ts +5 -0
- package/dist/chip/index.js +9 -0
- package/dist/choice/choice.d.ts +16 -0
- package/dist/choice/choice.js +17 -0
- package/dist/choice/index.d.ts +5 -0
- package/dist/choice/index.js +6 -0
- package/dist/code-editor/code-editor.d.ts +15 -0
- package/dist/code-editor/code-editor.js +22 -0
- package/dist/code-editor/index.d.ts +5 -0
- package/dist/code-editor/index.js +6 -0
- package/dist/code-surface/code-surface.d.ts +12 -0
- package/dist/code-surface/code-surface.js +12 -0
- package/dist/code-surface/index.d.ts +5 -0
- package/dist/code-surface/index.js +6 -0
- package/dist/command-palette/command-palette.d.ts +579 -0
- package/dist/command-palette/command-palette.js +600 -0
- package/dist/command-palette/index.d.ts +9 -0
- package/dist/command-palette/index.js +32 -0
- package/dist/command-palette/keys.d.ts +13 -0
- package/dist/command-palette/keys.js +71 -0
- package/dist/command-palette/match.d.ts +43 -0
- package/dist/command-palette/match.js +45 -0
- package/dist/command-palette/message.d.ts +94 -0
- package/dist/command-palette/message.js +46 -0
- package/dist/confirm-dialog/confirm-dialog.d.ts +287 -0
- package/dist/confirm-dialog/confirm-dialog.js +115 -0
- package/dist/confirm-dialog/index.d.ts +5 -0
- package/dist/confirm-dialog/index.js +17 -0
- package/dist/copy-button/copy-button.d.ts +99 -0
- package/dist/copy-button/copy-button.js +96 -0
- package/dist/copy-button/index.d.ts +5 -0
- package/dist/copy-button/index.js +13 -0
- package/dist/crumbs/crumbs.d.ts +15 -0
- package/dist/crumbs/crumbs.js +11 -0
- package/dist/crumbs/index.d.ts +5 -0
- package/dist/crumbs/index.js +6 -0
- package/dist/deck/deck.d.ts +9 -0
- package/dist/deck/deck.js +9 -0
- package/dist/deck/index.d.ts +5 -0
- package/dist/deck/index.js +6 -0
- package/dist/dialog/dialog.d.ts +278 -0
- package/dist/dialog/dialog.js +145 -0
- package/dist/dialog/fold.d.ts +58 -0
- package/dist/dialog/fold.js +63 -0
- package/dist/dialog/index.d.ts +6 -0
- package/dist/dialog/index.js +21 -0
- package/dist/disclosure/disclosure.d.ts +24 -0
- package/dist/disclosure/disclosure.js +25 -0
- package/dist/disclosure/index.d.ts +5 -0
- package/dist/disclosure/index.js +6 -0
- package/dist/dom/html-element.js +8 -0
- package/dist/drag/drag.d.ts +15 -0
- package/dist/drag/drag.js +123 -0
- package/dist/drop-zone/drop-zone.d.ts +119 -0
- package/dist/drop-zone/drop-zone.js +64 -0
- package/dist/drop-zone/index.d.ts +5 -0
- package/dist/drop-zone/index.js +14 -0
- package/dist/empty-state/empty-state.d.ts +18 -0
- package/dist/empty-state/empty-state.js +16 -0
- package/dist/empty-state/index.d.ts +5 -0
- package/dist/empty-state/index.js +6 -0
- package/dist/error-summary/error-summary.d.ts +34 -0
- package/dist/error-summary/error-summary.js +33 -0
- package/dist/error-summary/index.d.ts +5 -0
- package/dist/error-summary/index.js +6 -0
- package/dist/field/field.d.ts +35 -0
- package/dist/field/field.js +34 -0
- package/dist/field/index.d.ts +5 -0
- package/dist/field/index.js +6 -0
- package/dist/field-grid/field-grid.d.ts +8 -0
- package/dist/field-grid/field-grid.js +8 -0
- package/dist/field-grid/index.d.ts +5 -0
- package/dist/field-grid/index.js +6 -0
- package/dist/fields/fields.js +9 -0
- package/dist/fieldset/fieldset.d.ts +13 -0
- package/dist/fieldset/fieldset.js +13 -0
- package/dist/fieldset/index.d.ts +5 -0
- package/dist/fieldset/index.js +6 -0
- package/dist/filter-chip/filter-chip.d.ts +21 -0
- package/dist/filter-chip/filter-chip.js +28 -0
- package/dist/filter-chip/index.d.ts +5 -0
- package/dist/filter-chip/index.js +6 -0
- package/dist/filter-strip/filter-strip.d.ts +12 -0
- package/dist/filter-strip/filter-strip.js +13 -0
- package/dist/filter-strip/index.d.ts +5 -0
- package/dist/filter-strip/index.js +6 -0
- package/dist/flash-word/flash-word.d.ts +31 -0
- package/dist/flash-word/flash-word.js +31 -0
- package/dist/flash-word/index.d.ts +5 -0
- package/dist/flash-word/index.js +9 -0
- package/dist/focus/focus.d.ts +15 -0
- package/dist/focus/focus.js +17 -0
- package/dist/focus/index.d.ts +5 -0
- package/dist/focus/index.js +9 -0
- package/dist/format/format.js +52 -0
- package/dist/format/index.d.ts +5 -0
- package/dist/format/index.js +6 -0
- package/dist/glyph/glyph.d.ts +9 -0
- package/dist/glyph/glyph.js +25 -0
- package/dist/glyph/glyphs.d.ts +381 -0
- package/dist/glyph/glyphs.js +2603 -0
- package/dist/glyph/index.d.ts +5 -0
- package/dist/glyph/index.js +6 -0
- package/dist/group/group.d.ts +8 -0
- package/dist/group/group.js +9 -0
- package/dist/group/index.d.ts +5 -0
- package/dist/group/index.js +6 -0
- package/dist/history/history.d.ts +34 -0
- package/dist/history/history.js +15 -0
- package/dist/history/index.d.ts +5 -0
- package/dist/history/index.js +6 -0
- package/dist/icon-button/icon-button.d.ts +23 -0
- package/dist/icon-button/icon-button.js +23 -0
- package/dist/icon-button/index.d.ts +5 -0
- package/dist/icon-button/index.js +6 -0
- package/dist/identity/identity.d.ts +15 -0
- package/dist/identity/identity.js +15 -0
- package/dist/identity/index.d.ts +5 -0
- package/dist/identity/index.js +6 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +85 -0
- package/dist/inline-input/index.d.ts +5 -0
- package/dist/inline-input/index.js +20 -0
- package/dist/inline-input/inline-input.d.ts +196 -0
- package/dist/inline-input/inline-input.js +212 -0
- package/dist/key-help/index.d.ts +5 -0
- package/dist/key-help/index.js +18 -0
- package/dist/key-help/key-help.d.ts +255 -0
- package/dist/key-help/key-help.js +137 -0
- package/dist/key-hint/index.d.ts +6 -0
- package/dist/key-hint/index.js +12 -0
- package/dist/key-hint/key-hint.d.ts +13 -0
- package/dist/key-hint/key-hint.js +7 -0
- package/dist/key-hint/key-label.d.ts +18 -0
- package/dist/key-hint/key-label.js +77 -0
- package/dist/keymap/keymap.d.ts +11 -0
- package/dist/keymap/keymap.js +9 -0
- package/dist/keys/keys.js +4 -0
- package/dist/line-diff/diff.d.ts +2 -0
- package/dist/line-diff/diff.js +73 -0
- package/dist/line-diff/index.d.ts +6 -0
- package/dist/line-diff/index.js +10 -0
- package/dist/line-diff/line-diff.d.ts +21 -0
- package/dist/line-diff/line-diff.js +75 -0
- package/dist/line-diff/patch.d.ts +15 -0
- package/dist/line-diff/patch.js +120 -0
- package/dist/link-button/index.d.ts +5 -0
- package/dist/link-button/index.js +6 -0
- package/dist/link-button/link-button.d.ts +11 -0
- package/dist/link-button/link-button.js +10 -0
- package/dist/link-state/index.d.ts +5 -0
- package/dist/link-state/index.js +6 -0
- package/dist/link-state/link-state.d.ts +15 -0
- package/dist/link-state/link-state.js +17 -0
- package/dist/live-region/index.d.ts +5 -0
- package/dist/live-region/index.js +9 -0
- package/dist/live-region/live-region.d.ts +39 -0
- package/dist/live-region/live-region.js +33 -0
- package/dist/loading/index.d.ts +5 -0
- package/dist/loading/index.js +6 -0
- package/dist/loading/loading.d.ts +19 -0
- package/dist/loading/loading.js +16 -0
- package/dist/locale/locale.d.ts +3 -0
- package/dist/locale/locale.js +5 -0
- package/dist/mark/index.d.ts +5 -0
- package/dist/mark/index.js +6 -0
- package/dist/mark/mark.d.ts +15 -0
- package/dist/mark/mark.js +30 -0
- package/dist/menu/index.d.ts +7 -0
- package/dist/menu/index.js +25 -0
- package/dist/menu/item.d.ts +236 -0
- package/dist/menu/item.js +19 -0
- package/dist/menu/menu.d.ts +206 -0
- package/dist/menu/menu.js +208 -0
- package/dist/menu/slip.js +163 -0
- package/dist/meter/index.d.ts +5 -0
- package/dist/meter/index.js +6 -0
- package/dist/meter/meter.d.ts +38 -0
- package/dist/meter/meter.js +69 -0
- package/dist/monogram/monogram.js +33 -0
- package/dist/nav-strip/index.d.ts +5 -0
- package/dist/nav-strip/index.js +6 -0
- package/dist/nav-strip/nav-strip.d.ts +19 -0
- package/dist/nav-strip/nav-strip.js +21 -0
- package/dist/notice/index.d.ts +5 -0
- package/dist/notice/index.js +6 -0
- package/dist/notice/notice.d.ts +23 -0
- package/dist/notice/notice.js +35 -0
- package/dist/outcome/index.d.ts +5 -0
- package/dist/outcome/index.js +6 -0
- package/dist/outcome/outcome.d.ts +19 -0
- package/dist/outcome/outcome.js +14 -0
- package/dist/page-head/index.d.ts +5 -0
- package/dist/page-head/index.js +6 -0
- package/dist/page-head/page-head.d.ts +13 -0
- package/dist/page-head/page-head.js +10 -0
- package/dist/panel/index.d.ts +5 -0
- package/dist/panel/index.js +6 -0
- package/dist/panel/panel.d.ts +35 -0
- package/dist/panel/panel.js +25 -0
- package/dist/password-field/index.d.ts +5 -0
- package/dist/password-field/index.js +6 -0
- package/dist/password-field/password-field.d.ts +33 -0
- package/dist/password-field/password-field.js +39 -0
- package/dist/places/index.d.ts +5 -0
- package/dist/places/index.js +6 -0
- package/dist/places/places.d.ts +32 -0
- package/dist/places/places.js +22 -0
- package/dist/props-list/index.d.ts +5 -0
- package/dist/props-list/index.js +6 -0
- package/dist/props-list/props-list.d.ts +18 -0
- package/dist/props-list/props-list.js +12 -0
- package/dist/prose/index.d.ts +5 -0
- package/dist/prose/index.js +6 -0
- package/dist/prose/prose.d.ts +14 -0
- package/dist/prose/prose.js +6 -0
- package/dist/query-chip/index.d.ts +5 -0
- package/dist/query-chip/index.js +6 -0
- package/dist/query-chip/query-chip.d.ts +18 -0
- package/dist/query-chip/query-chip.js +17 -0
- package/dist/radio-choices/index.d.ts +5 -0
- package/dist/radio-choices/index.js +12 -0
- package/dist/radio-choices/radio-choices.d.ts +105 -0
- package/dist/radio-choices/radio-choices.js +56 -0
- package/dist/rail/index.d.ts +5 -0
- package/dist/rail/index.js +22 -0
- package/dist/rail/rail.d.ts +403 -0
- package/dist/rail/rail.js +355 -0
- package/dist/reel/index.d.ts +6 -0
- package/dist/reel/index.js +26 -0
- package/dist/reel/layout.d.ts +58 -0
- package/dist/reel/layout.js +378 -0
- package/dist/reel/reel.d.ts +1070 -0
- package/dist/reel/reel.js +1019 -0
- package/dist/remote/index.d.ts +5 -0
- package/dist/remote/index.js +6 -0
- package/dist/remote/remote.d.ts +28 -0
- package/dist/remote/remote.js +41 -0
- package/dist/rows/index.d.ts +5 -0
- package/dist/rows/index.js +12 -0
- package/dist/rows/rows.d.ts +116 -0
- package/dist/rows/rows.js +67 -0
- package/dist/scheme/index.d.ts +6 -0
- package/dist/scheme/index.js +10 -0
- package/dist/scheme/scheme-switch.d.ts +98 -0
- package/dist/scheme/scheme-switch.js +118 -0
- package/dist/scheme/scheme.d.ts +5 -0
- package/dist/scheme/scheme.js +16 -0
- package/dist/scheme/script.d.ts +8 -0
- package/dist/scheme/script.js +10 -0
- package/dist/secret/index.d.ts +5 -0
- package/dist/secret/index.js +6 -0
- package/dist/secret/secret.d.ts +13 -0
- package/dist/secret/secret.js +9 -0
- package/dist/segmented/index.d.ts +5 -0
- package/dist/segmented/index.js +6 -0
- package/dist/segmented/segmented.d.ts +17 -0
- package/dist/segmented/segmented.js +17 -0
- package/dist/select-field/index.d.ts +5 -0
- package/dist/select-field/index.js +6 -0
- package/dist/select-field/select-field.d.ts +38 -0
- package/dist/select-field/select-field.js +29 -0
- package/dist/sheet/index.d.ts +5 -0
- package/dist/sheet/index.js +6 -0
- package/dist/sheet/sheet.d.ts +16 -0
- package/dist/sheet/sheet.js +15 -0
- package/dist/skip-link/index.d.ts +5 -0
- package/dist/skip-link/index.js +9 -0
- package/dist/skip-link/skip-link.d.ts +23 -0
- package/dist/skip-link/skip-link.js +36 -0
- package/dist/slot/slot.js +8 -0
- package/dist/sortable/index.d.ts +5 -0
- package/dist/sortable/index.js +16 -0
- package/dist/sortable/sortable.d.ts +1125 -0
- package/dist/sortable/sortable.js +431 -0
- package/dist/stack/index.d.ts +5 -0
- package/dist/stack/index.js +6 -0
- package/dist/stack/stack.d.ts +15 -0
- package/dist/stack/stack.js +12 -0
- package/dist/stage/index.d.ts +5 -0
- package/dist/stage/index.js +6 -0
- package/dist/stage/stage.d.ts +14 -0
- package/dist/stage/stage.js +11 -0
- package/dist/stat/index.d.ts +5 -0
- package/dist/stat/index.js +6 -0
- package/dist/stat/stat.d.ts +18 -0
- package/dist/stat/stat.js +13 -0
- package/dist/status-bar/index.d.ts +6 -0
- package/dist/status-bar/index.js +11 -0
- package/dist/status-bar/status-bar.d.ts +28 -0
- package/dist/status-bar/status-bar.js +19 -0
- package/dist/subscription/prefix-keys.js +12 -0
- package/dist/table/index.d.ts +5 -0
- package/dist/table/index.js +6 -0
- package/dist/table/table.d.ts +26 -0
- package/dist/table/table.js +18 -0
- package/dist/tabs/index.d.ts +5 -0
- package/dist/tabs/index.js +14 -0
- package/dist/tabs/tabs.d.ts +125 -0
- package/dist/tabs/tabs.js +57 -0
- package/dist/tag/index.d.ts +5 -0
- package/dist/tag/index.js +6 -0
- package/dist/tag/tag.d.ts +16 -0
- package/dist/tag/tag.js +25 -0
- package/dist/text-button/index.d.ts +5 -0
- package/dist/text-button/index.js +6 -0
- package/dist/text-button/text-button.d.ts +8 -0
- package/dist/text-button/text-button.js +12 -0
- package/dist/textarea-field/index.d.ts +5 -0
- package/dist/textarea-field/index.js +6 -0
- package/dist/textarea-field/textarea-field.d.ts +28 -0
- package/dist/textarea-field/textarea-field.js +30 -0
- package/dist/time/index.d.ts +5 -0
- package/dist/time/index.js +9 -0
- package/dist/time/time.d.ts +38 -0
- package/dist/time/time.js +63 -0
- package/dist/tips/index.d.ts +5 -0
- package/dist/tips/index.js +14 -0
- package/dist/tips/tips.d.ts +339 -0
- package/dist/tips/tips.js +308 -0
- package/dist/toast/index.d.ts +5 -0
- package/dist/toast/index.js +17 -0
- package/dist/toast/stack.d.ts +7 -0
- package/dist/toast/stack.js +23 -0
- package/dist/toast/toast.d.ts +559 -0
- package/dist/toast/toast.js +269 -0
- package/dist/toc/index.d.ts +5 -0
- package/dist/toc/index.js +9 -0
- package/dist/toc/toc.d.ts +42 -0
- package/dist/toc/toc.js +35 -0
- package/dist/top-bar/bar-height.d.ts +26 -0
- package/dist/top-bar/bar-height.js +43 -0
- package/dist/top-bar/index.d.ts +6 -0
- package/dist/top-bar/index.js +12 -0
- package/dist/top-bar/top-bar.d.ts +19 -0
- package/dist/top-bar/top-bar.js +18 -0
- package/dist/wall/index.d.ts +5 -0
- package/dist/wall/index.js +9 -0
- package/dist/wall/wall.d.ts +16 -0
- package/dist/wall/wall.js +15 -0
- package/dist/window/index.d.ts +5 -0
- package/dist/window/index.js +6 -0
- package/dist/window/window.d.ts +28 -0
- package/dist/window/window.js +29 -0
- package/dist/wordmark/index.d.ts +5 -0
- package/dist/wordmark/index.js +6 -0
- package/dist/wordmark/wordmark.d.ts +10 -0
- package/dist/wordmark/wordmark.js +10 -0
- package/dist/wrap/index.d.ts +5 -0
- package/dist/wrap/index.js +6 -0
- package/dist/wrap/wrap.d.ts +12 -0
- package/dist/wrap/wrap.js +9 -0
- package/fonts/DepartureMono-Regular.woff2 +0 -0
- package/fonts/LICENSE.txt +2 -0
- package/package.json +57 -3
- package/src/pixel-paper.css +4611 -0
- package/src/tokens.css +151 -0
|
@@ -0,0 +1,1019 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { announce as announce$1 } from "../announcer/announcer.js";
|
|
3
|
+
import { view as view$1 } from "../glyph/glyph.js";
|
|
4
|
+
import { pressedAttribute } from "../button/button.js";
|
|
5
|
+
import { isPlain } from "../keys/keys.js";
|
|
6
|
+
import { escapeKeys, markDragging, measureLift, pointerMessages as pointerMessages$1, splitterAttributes } from "../drag/drag.js";
|
|
7
|
+
import { view as view$2 } from "../icon-button/icon-button.js";
|
|
8
|
+
import { prefixKeys } from "../subscription/prefix-keys.js";
|
|
9
|
+
import { htmlElement } from "../dom/html-element.js";
|
|
10
|
+
import { OutMessage, Resize, Splitter, Step, Subject, Target, WHERE_IT_WAS, apply, columnOfTarget, fill, firstPlace, isChange, isSplitterPresent, isTargetPresent, landingWords, nextPreset, originOf, placeAt, placeOf, placeWords, requestOf, resizeOf, steppedTarget, subjectWords, targetAtPoint, whereWords, widthWords } from "./layout.js";
|
|
11
|
+
import { Array, Effect, Equal, Match, Number, Option, Order, Queue, Record, Schema, Stream, String } from "effect";
|
|
12
|
+
import * as Command from "foldkit/command";
|
|
13
|
+
import { defineMessageUnion } from "foldkit/message";
|
|
14
|
+
import * as Render from "foldkit/render";
|
|
15
|
+
import * as Mount from "foldkit/mount";
|
|
16
|
+
import { modifyFields } from "foldkit/struct";
|
|
17
|
+
import { defineView } from "foldkit/submodel";
|
|
18
|
+
import * as Subscription from "foldkit/subscription";
|
|
19
|
+
import { defineTaggedUnion } from "foldkit/schema";
|
|
20
|
+
// src/reel/reel.ts
|
|
21
|
+
const KEYBOARD_MOVES = "Arrow keys move it, space drops it, escape or tab puts it back.";
|
|
22
|
+
const COPY = {
|
|
23
|
+
paneGrip: "Move {pane}",
|
|
24
|
+
gripHelp: `Press space to pick it up. ${KEYBOARD_MOVES}`,
|
|
25
|
+
widthLabel: "Width of column {column}",
|
|
26
|
+
heightLabel: "Height of {pane}",
|
|
27
|
+
focused: "{pane}, {where}.",
|
|
28
|
+
focusedTab: "{pane}, tab {tab} of {tabs}.",
|
|
29
|
+
moved: "{subject} moved to {where}.",
|
|
30
|
+
widened: "Column {column} takes {width}.",
|
|
31
|
+
pickedUp: "Picked up {subject}.",
|
|
32
|
+
pickedUpByKeyboard: `Picked up {subject}. ${KEYBOARD_MOVES}`,
|
|
33
|
+
over: "{subject}, {where}.",
|
|
34
|
+
dropped: "{subject} dropped at {where}.",
|
|
35
|
+
putBack: "{subject} put back where it was.",
|
|
36
|
+
cancelled: "Move cancelled. {subject} put back where it was.",
|
|
37
|
+
gone: "Move cancelled."
|
|
38
|
+
};
|
|
39
|
+
const Focus = Schema.Struct({
|
|
40
|
+
paneId: Schema.String,
|
|
41
|
+
column: Schema.Finite,
|
|
42
|
+
row: Schema.Finite
|
|
43
|
+
});
|
|
44
|
+
const By = defineTaggedUnion({
|
|
45
|
+
Pointer: {
|
|
46
|
+
pointerId: Schema.Finite,
|
|
47
|
+
pressX: Schema.Finite,
|
|
48
|
+
pressY: Schema.Finite,
|
|
49
|
+
x: Schema.Finite,
|
|
50
|
+
y: Schema.Finite,
|
|
51
|
+
isCarrying: Schema.Boolean
|
|
52
|
+
},
|
|
53
|
+
Keyboard: {}
|
|
54
|
+
});
|
|
55
|
+
const Held = Schema.Struct({
|
|
56
|
+
paneId: Schema.String,
|
|
57
|
+
by: By,
|
|
58
|
+
maybeTarget: Schema.Option(Target)
|
|
59
|
+
});
|
|
60
|
+
const Resizing = Schema.Struct({
|
|
61
|
+
splitter: Splitter,
|
|
62
|
+
pointerId: Schema.Finite,
|
|
63
|
+
pressX: Schema.Finite,
|
|
64
|
+
pressY: Schema.Finite,
|
|
65
|
+
maybeResize: Schema.Option(Resize)
|
|
66
|
+
});
|
|
67
|
+
/** Schema for a reel: its id, the focused pane, what is held and a splitter being dragged. All
|
|
68
|
+
* of it is this client's; the layout is the application's. */
|
|
69
|
+
const Model = Schema.Struct({
|
|
70
|
+
id: Schema.String,
|
|
71
|
+
maybeFocus: Schema.Option(Focus),
|
|
72
|
+
maybeHeld: Schema.Option(Held),
|
|
73
|
+
maybeResizing: Schema.Option(Resizing)
|
|
74
|
+
});
|
|
75
|
+
/** How a reel shows its panes: side by side in their columns (`Strip`), or one at a time at
|
|
76
|
+
* the reel's full size under a tab per pane (`Tabs`). The application holds it and passes it
|
|
77
|
+
* in; the layout is the same in both. */
|
|
78
|
+
const Arrangement = Schema.Literals(["Strip", "Tabs"]);
|
|
79
|
+
const PointerAt = Schema.Struct({
|
|
80
|
+
clientX: Schema.Finite,
|
|
81
|
+
clientY: Schema.Finite,
|
|
82
|
+
maybeTarget: Schema.Option(Target)
|
|
83
|
+
});
|
|
84
|
+
/** Union of all Messages a reel can produce. */
|
|
85
|
+
const Message = defineMessageUnion({
|
|
86
|
+
PressedGrip: {
|
|
87
|
+
paneId: Schema.String,
|
|
88
|
+
pointerId: Schema.Finite,
|
|
89
|
+
clientX: Schema.Finite,
|
|
90
|
+
clientY: Schema.Finite
|
|
91
|
+
},
|
|
92
|
+
PressedGripKey: { paneId: Schema.String },
|
|
93
|
+
MovedPointer: PointerAt.fields,
|
|
94
|
+
ReleasedPointer: PointerAt.fields,
|
|
95
|
+
CancelledPointer: {},
|
|
96
|
+
SteppedHeld: { step: Step },
|
|
97
|
+
DroppedHeld: {},
|
|
98
|
+
LeftGrip: {},
|
|
99
|
+
PressedEscape: {},
|
|
100
|
+
FocusedPane: { paneId: Schema.String },
|
|
101
|
+
PressedTab: { paneId: Schema.String },
|
|
102
|
+
SteppedTab: { paneId: Schema.String },
|
|
103
|
+
PressedSplitter: {
|
|
104
|
+
splitter: Splitter,
|
|
105
|
+
pointerId: Schema.Finite,
|
|
106
|
+
clientX: Schema.Finite,
|
|
107
|
+
clientY: Schema.Finite
|
|
108
|
+
},
|
|
109
|
+
MovedSplitter: { share: Schema.Finite },
|
|
110
|
+
ReleasedSplitter: { share: Schema.Finite },
|
|
111
|
+
CancelledSplitter: {},
|
|
112
|
+
PressedSplitterKey: {
|
|
113
|
+
splitter: Splitter,
|
|
114
|
+
share: Schema.Finite
|
|
115
|
+
},
|
|
116
|
+
CompletedAnnounceReel: {},
|
|
117
|
+
CompletedFocusPane: {},
|
|
118
|
+
CompletedFocusTab: {},
|
|
119
|
+
CompletedRestoreFocus: {},
|
|
120
|
+
CompletedScrollIntoView: {},
|
|
121
|
+
CompletedSizeLiftedPane: {}
|
|
122
|
+
});
|
|
123
|
+
/** Creates a reel focused on its first pane, holding nothing, at rest. */
|
|
124
|
+
const init = (config) => (__foldkitBrandViewResult(({
|
|
125
|
+
id: config.id,
|
|
126
|
+
maybeFocus: Option.none(),
|
|
127
|
+
maybeHeld: Option.none(),
|
|
128
|
+
maybeResizing: Option.none()
|
|
129
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#init"));
|
|
130
|
+
const focusedPlace = (model, layout) => __foldkitBrandViewResult((Option.orElse(Option.flatMap(model.maybeFocus, (focus) => __foldkitBrandViewResult((Option.orElse(placeOf(layout, focus.paneId), () => {
|
|
131
|
+
const column = Number.clamp(focus.column, {
|
|
132
|
+
minimum: 0,
|
|
133
|
+
maximum: layout.length - 1
|
|
134
|
+
});
|
|
135
|
+
const rows = Option.match(Array.get(layout, column), {
|
|
136
|
+
onNone: () => __foldkitBrandViewResult((0), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone"),
|
|
137
|
+
onSome: (found) => __foldkitBrandViewResult((found.panes.length), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome")
|
|
138
|
+
});
|
|
139
|
+
return __foldkitBrandViewResult((placeAt(layout, column, Number.clamp(focus.row, {
|
|
140
|
+
minimum: 0,
|
|
141
|
+
maximum: rows - 1
|
|
142
|
+
}))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~2");
|
|
143
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous")), () => __foldkitBrandViewResult((firstPlace(layout)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~3"))), "@gjermundgaraba/pixel-paper/reel/reel.js#focusedPlace");
|
|
144
|
+
/** The pane focus is on: the one last focused, or, when it has gone from `layout`, the pane
|
|
145
|
+
* now nearest its place; the first pane before any is focused. None for an empty layout. */
|
|
146
|
+
const focusedPaneId = (model, layout) => __foldkitBrandViewResult((Option.map(focusedPlace(model, layout), ({ pane }) => __foldkitBrandViewResult((pane.id), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~4"))), "@gjermundgaraba/pixel-paper/reel/reel.js#focusedPaneId");
|
|
147
|
+
const isHolding = (model) => __foldkitBrandViewResult((Option.isSome(model.maybeHeld)), "@gjermundgaraba/pixel-paper/reel/reel.js#isHolding");
|
|
148
|
+
const isIdle = (model) => __foldkitBrandViewResult((!isHolding(model) && Option.isNone(model.maybeResizing)), "@gjermundgaraba/pixel-paper/reel/reel.js#isIdle");
|
|
149
|
+
const isCarried = (held) => __foldkitBrandViewResult((By.match(held.by, {
|
|
150
|
+
Pointer: ({ isCarrying }) => __foldkitBrandViewResult((isCarrying), "@gjermundgaraba/pixel-paper/reel/reel.js#Pointer"),
|
|
151
|
+
Keyboard: () => __foldkitBrandViewResult((true), "@gjermundgaraba/pixel-paper/reel/reel.js#Keyboard")
|
|
152
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#isCarried");
|
|
153
|
+
const paneHook = (model, paneId) => __foldkitBrandViewResult((`${model.id}/pane/${paneId}`), "@gjermundgaraba/pixel-paper/reel/reel.js#paneHook");
|
|
154
|
+
const columnHook = (model, columnId) => __foldkitBrandViewResult((`${model.id}/column/${columnId}`), "@gjermundgaraba/pixel-paper/reel/reel.js#columnHook");
|
|
155
|
+
const tabHook = (model, paneId) => __foldkitBrandViewResult((`${model.id}/tab/${paneId}`), "@gjermundgaraba/pixel-paper/reel/reel.js#tabHook");
|
|
156
|
+
const scrollerOf = (reelHook) => __foldkitBrandViewResult((htmlElement(`[data-reel="${CSS.escape(reelHook)}"] > .reel-view`)), "@gjermundgaraba/pixel-paper/reel/reel.js#scrollerOf");
|
|
157
|
+
const paneElement = (hook) => __foldkitBrandViewResult((htmlElement(`[data-reel-pane="${CSS.escape(hook)}"]`)), "@gjermundgaraba/pixel-paper/reel/reel.js#paneElement");
|
|
158
|
+
const focusInto = (pane) => {
|
|
159
|
+
Option.getOrElse(htmlElement("[data-reel-focus]", pane), () => __foldkitBrandViewResult((pane), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~5")).focus({ preventScroll: true });
|
|
160
|
+
};
|
|
161
|
+
/** Says a focus move, a move or a step of a drag through the page's live region (as
|
|
162
|
+
* `Announcer.Announce` does). */
|
|
163
|
+
const AnnounceReel = Command.define("AnnounceReel", {
|
|
164
|
+
args: { text: Schema.String },
|
|
165
|
+
messages: [Message.CompletedAnnounceReel],
|
|
166
|
+
execute: ({ text }) => __foldkitBrandViewResult((announce$1(text).pipe(Effect.as(Message.CompletedAnnounceReel()))), "@gjermundgaraba/pixel-paper/reel/reel.js#execute")
|
|
167
|
+
});
|
|
168
|
+
/** Focuses the pane `paneHook` names, unless focus is already inside it: the control in it
|
|
169
|
+
* marked `data-reel-focus` (a terminal's input), or the pane itself. It does not scroll;
|
|
170
|
+
* ScrollIntoView does. */
|
|
171
|
+
const FocusPane = Command.define("FocusPane", {
|
|
172
|
+
args: { paneHook: Schema.String },
|
|
173
|
+
messages: [Message.CompletedFocusPane],
|
|
174
|
+
execute: ({ paneHook: hook }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
175
|
+
yield* Render.afterCommit;
|
|
176
|
+
yield* Effect.sync(() => {
|
|
177
|
+
Option.map(Option.filter(paneElement(hook), (pane) => __foldkitBrandViewResult((!pane.contains(document.activeElement)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~8")), focusInto);
|
|
178
|
+
});
|
|
179
|
+
return __foldkitBrandViewResult((Message.CompletedFocusPane()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~6");
|
|
180
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#execute~2")
|
|
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
|
+
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
|
+
Option.map(htmlElement(`[data-reel-tab="${CSS.escape(hook)}"]`), (tab) => {
|
|
191
|
+
tab.focus();
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
return __foldkitBrandViewResult((Message.CompletedFocusTab()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~9");
|
|
195
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#execute~3")
|
|
196
|
+
});
|
|
197
|
+
/** Focuses the pane `paneHook` names only where focus was lost (it left with the pane that
|
|
198
|
+
* held it), so focus the reader put somewhere else stays there. */
|
|
199
|
+
const RestoreFocus = Command.define("RestoreFocus", {
|
|
200
|
+
args: { paneHook: Schema.String },
|
|
201
|
+
messages: [Message.CompletedRestoreFocus],
|
|
202
|
+
execute: ({ paneHook: hook }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
203
|
+
yield* Render.afterCommit;
|
|
204
|
+
yield* Effect.sync(() => {
|
|
205
|
+
const active = document.activeElement;
|
|
206
|
+
if (active === null || active === document.body) Option.map(paneElement(hook), focusInto);
|
|
207
|
+
});
|
|
208
|
+
return __foldkitBrandViewResult((Message.CompletedRestoreFocus()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~12");
|
|
209
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#execute~4")
|
|
210
|
+
});
|
|
211
|
+
/** Scrolls the pane or column `hook` names into view, by the least distance either way, its
|
|
212
|
+
* gutter kept by the stylesheet's `scroll-margin`, once the render that placed it is in the
|
|
213
|
+
* page. It jumps: motion is stepped or instant, and a follow is instant. */
|
|
214
|
+
const ScrollIntoView = Command.define("ScrollIntoView", {
|
|
215
|
+
args: { hook: Schema.String },
|
|
216
|
+
messages: [Message.CompletedScrollIntoView],
|
|
217
|
+
execute: ({ hook }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
218
|
+
yield* Render.afterCommit;
|
|
219
|
+
yield* Effect.sync(() => {
|
|
220
|
+
document.querySelector(`[data-reel-pane="${CSS.escape(hook)}"], [data-reel-hook="${CSS.escape(hook)}"]`)?.scrollIntoView({
|
|
221
|
+
block: "nearest",
|
|
222
|
+
inline: "nearest"
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
return __foldkitBrandViewResult((Message.CompletedScrollIntoView()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~14");
|
|
226
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#execute~5")
|
|
227
|
+
});
|
|
228
|
+
const CARRY_THRESHOLD = 5;
|
|
229
|
+
const withHeld = (model, maybeHeld) => __foldkitBrandViewResult((modifyFields(model, { maybeHeld: () => __foldkitBrandViewResult((maybeHeld), "@gjermundgaraba/pixel-paper/reel/reel.js#maybeHeld") })), "@gjermundgaraba/pixel-paper/reel/reel.js#withHeld");
|
|
230
|
+
const withResizing = (model, maybeResizing) => __foldkitBrandViewResult((modifyFields(model, { maybeResizing: () => __foldkitBrandViewResult((maybeResizing), "@gjermundgaraba/pixel-paper/reel/reel.js#maybeResizing") })), "@gjermundgaraba/pixel-paper/reel/reel.js#withResizing");
|
|
231
|
+
const focusOn = (model, place) => __foldkitBrandViewResult((modifyFields(model, { maybeFocus: () => __foldkitBrandViewResult((Option.some({
|
|
232
|
+
paneId: place.pane.id,
|
|
233
|
+
column: place.columnIndex,
|
|
234
|
+
row: place.row
|
|
235
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#maybeFocus") })), "@gjermundgaraba/pixel-paper/reel/reel.js#focusOn");
|
|
236
|
+
const announce = (text) => __foldkitBrandViewResult((AnnounceReel({ text })), "@gjermundgaraba/pixel-paper/reel/reel.js#announce");
|
|
237
|
+
const heldLabel = (layout, held) => __foldkitBrandViewResult((Option.getOrElse(subjectWords(layout, Subject.Pane({ paneId: held.paneId })), () => __foldkitBrandViewResult((""), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~16"))), "@gjermundgaraba/pixel-paper/reel/reel.js#heldLabel");
|
|
238
|
+
const heldWords = (layout, held) => __foldkitBrandViewResult((String.capitalize(heldLabel(layout, held))), "@gjermundgaraba/pixel-paper/reel/reel.js#heldWords");
|
|
239
|
+
const scrollToTarget = (model, layout, target) => __foldkitBrandViewResult((Array.fromOption(Option.map(columnOfTarget(layout, target), (columnId) => __foldkitBrandViewResult((ScrollIntoView({ hook: columnHook(model, columnId) })), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~17")))), "@gjermundgaraba/pixel-paper/reel/reel.js#scrollToTarget");
|
|
240
|
+
const letGo = (model, layout, held, putBack) => {
|
|
241
|
+
const released = withHeld(model, Option.none());
|
|
242
|
+
if (!isCarried(held)) return __foldkitBrandViewResult(({ model: released }), "@gjermundgaraba/pixel-paper/reel/reel.js#letGo");
|
|
243
|
+
const subject = heldWords(layout, held);
|
|
244
|
+
const maybeRequest = Option.flatMap(held.maybeTarget, (target) => __foldkitBrandViewResult((requestOf(layout, held.paneId, target)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~18"));
|
|
245
|
+
return __foldkitBrandViewResult((Option.match(maybeRequest, {
|
|
246
|
+
onNone: () => (__foldkitBrandViewResult(({
|
|
247
|
+
model: released,
|
|
248
|
+
commands: [announce(fill(putBack, { subject }))]
|
|
249
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~2")),
|
|
250
|
+
onSome: (request) => (__foldkitBrandViewResult(({
|
|
251
|
+
model: released,
|
|
252
|
+
commands: [announce(fill(COPY.dropped, {
|
|
253
|
+
subject,
|
|
254
|
+
where: Option.getOrElse(whereWords(apply(layout, request), Subject.Pane({ paneId: held.paneId })), () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~19"))
|
|
255
|
+
}))],
|
|
256
|
+
outMessage: request
|
|
257
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~2"))
|
|
258
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#letGo");
|
|
259
|
+
};
|
|
260
|
+
const cancel = (model, layout, held) => __foldkitBrandViewResult((letGo(model, layout, {
|
|
261
|
+
...held,
|
|
262
|
+
maybeTarget: Option.none()
|
|
263
|
+
}, COPY.cancelled)), "@gjermundgaraba/pixel-paper/reel/reel.js#cancel");
|
|
264
|
+
const lift = (model, layout, paneId, by) => __foldkitBrandViewResult((Option.match(Option.filter(originOf(layout, paneId), () => __foldkitBrandViewResult((isIdle(model)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~20")), {
|
|
265
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~3")),
|
|
266
|
+
onSome: (origin) => {
|
|
267
|
+
const held = {
|
|
268
|
+
paneId,
|
|
269
|
+
by,
|
|
270
|
+
maybeTarget: Option.some(origin)
|
|
271
|
+
};
|
|
272
|
+
return __foldkitBrandViewResult(({
|
|
273
|
+
model: withHeld(model, Option.some(held)),
|
|
274
|
+
commands: by._tag === "Keyboard" ? [announce(fill(COPY.pickedUpByKeyboard, { subject: heldWords(layout, held) }))] : []
|
|
275
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~3");
|
|
276
|
+
}
|
|
277
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#lift");
|
|
278
|
+
const movePointer = (model, layout, held, pointer) => __foldkitBrandViewResult((By.match(held.by, {
|
|
279
|
+
Keyboard: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#Keyboard~2")),
|
|
280
|
+
Pointer: (by) => {
|
|
281
|
+
const isCarrying = by.isCarrying || Math.hypot(pointer.clientX - by.pressX, pointer.clientY - by.pressY) > CARRY_THRESHOLD;
|
|
282
|
+
const next = {
|
|
283
|
+
...held,
|
|
284
|
+
by: By.Pointer({
|
|
285
|
+
...by,
|
|
286
|
+
x: pointer.clientX,
|
|
287
|
+
y: pointer.clientY,
|
|
288
|
+
isCarrying
|
|
289
|
+
}),
|
|
290
|
+
maybeTarget: isCarrying ? pointer.maybeTarget : held.maybeTarget
|
|
291
|
+
};
|
|
292
|
+
return __foldkitBrandViewResult(({
|
|
293
|
+
model: withHeld(model, Option.some(next)),
|
|
294
|
+
commands: isCarrying && !by.isCarrying ? [announce(fill(COPY.pickedUp, { subject: heldWords(layout, held) }))] : []
|
|
295
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#Pointer~2");
|
|
296
|
+
}
|
|
297
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#movePointer");
|
|
298
|
+
const stepHeld = (model, layout, held, step) => __foldkitBrandViewResult((Option.match(Option.filter(held.maybeTarget, () => __foldkitBrandViewResult((held.by._tag === "Keyboard"), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~21")), {
|
|
299
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~4")),
|
|
300
|
+
onSome: (target) => {
|
|
301
|
+
const next = steppedTarget(layout, held.paneId, target, step);
|
|
302
|
+
if (Equal.equals(next, target)) return __foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~4");
|
|
303
|
+
return __foldkitBrandViewResult(({
|
|
304
|
+
model: withHeld(model, Option.some({
|
|
305
|
+
...held,
|
|
306
|
+
maybeTarget: Option.some(next)
|
|
307
|
+
})),
|
|
308
|
+
commands: [announce(fill(COPY.over, {
|
|
309
|
+
subject: heldWords(layout, held),
|
|
310
|
+
where: landingWords(layout, held.paneId, next)
|
|
311
|
+
})), ...scrollToTarget(model, layout, next)]
|
|
312
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~4");
|
|
313
|
+
}
|
|
314
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#stepHeld");
|
|
315
|
+
const whileHeld = (model, f) => __foldkitBrandViewResult((Option.match(model.maybeHeld, {
|
|
316
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~5")),
|
|
317
|
+
onSome: f
|
|
318
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#whileHeld");
|
|
319
|
+
const whileHeldBy = (model, by, f) => __foldkitBrandViewResult((whileHeld(model, (held) => __foldkitBrandViewResult((held.by._tag === by ? f(held) : { model }), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~22"))), "@gjermundgaraba/pixel-paper/reel/reel.js#whileHeldBy");
|
|
320
|
+
const resizeSplitter = (model, layout, share, isLetGo) => __foldkitBrandViewResult((Option.match(model.maybeResizing, {
|
|
321
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~6")),
|
|
322
|
+
onSome: (resizing) => {
|
|
323
|
+
const maybeResize = resizeOf(layout, resizing.splitter, share);
|
|
324
|
+
if (!isLetGo) return __foldkitBrandViewResult(({ model: withResizing(model, Option.some({
|
|
325
|
+
...resizing,
|
|
326
|
+
maybeResize
|
|
327
|
+
})) }), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~5");
|
|
328
|
+
return __foldkitBrandViewResult((Option.match(maybeResize, {
|
|
329
|
+
onNone: () => (__foldkitBrandViewResult(({ model: withResizing(model, Option.none()) }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~7")),
|
|
330
|
+
onSome: (resize) => (__foldkitBrandViewResult(({
|
|
331
|
+
model: withResizing(model, Option.none()),
|
|
332
|
+
outMessage: resize
|
|
333
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~6"))
|
|
334
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~5");
|
|
335
|
+
}
|
|
336
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#resizeSplitter");
|
|
337
|
+
const selectTab = (model, layout, paneId, focus) => __foldkitBrandViewResult((Option.match(placeOf(layout, paneId), {
|
|
338
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~8")),
|
|
339
|
+
onSome: (place) => (__foldkitBrandViewResult(({
|
|
340
|
+
model: focusOn(model, place),
|
|
341
|
+
commands: [focus]
|
|
342
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~7"))
|
|
343
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#selectTab");
|
|
344
|
+
/** Processes a reel Message against the layout as the application holds it now, and returns
|
|
345
|
+
* the next Model, Commands and OutMessage. */
|
|
346
|
+
const update = (model, message, context) => {
|
|
347
|
+
const { layout } = context;
|
|
348
|
+
return __foldkitBrandViewResult((Message.match(message, {
|
|
349
|
+
PressedGrip: ({ paneId, pointerId, clientX, clientY }) => __foldkitBrandViewResult((lift(model, layout, paneId, By.Pointer({
|
|
350
|
+
pointerId,
|
|
351
|
+
pressX: clientX,
|
|
352
|
+
pressY: clientY,
|
|
353
|
+
x: clientX,
|
|
354
|
+
y: clientY,
|
|
355
|
+
isCarrying: false
|
|
356
|
+
}))), "@gjermundgaraba/pixel-paper/reel/reel.js#PressedGrip"),
|
|
357
|
+
PressedGripKey: ({ paneId }) => __foldkitBrandViewResult((lift(model, layout, paneId, By.Keyboard())), "@gjermundgaraba/pixel-paper/reel/reel.js#PressedGripKey"),
|
|
358
|
+
MovedPointer: (pointer) => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((movePointer(model, layout, held, pointer)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~23"))), "@gjermundgaraba/pixel-paper/reel/reel.js#MovedPointer"),
|
|
359
|
+
ReleasedPointer: (pointer) => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((letGo(model, layout, isCarried(held) ? {
|
|
360
|
+
...held,
|
|
361
|
+
maybeTarget: pointer.maybeTarget
|
|
362
|
+
} : held, COPY.putBack)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~24"))), "@gjermundgaraba/pixel-paper/reel/reel.js#ReleasedPointer"),
|
|
363
|
+
CancelledPointer: () => __foldkitBrandViewResult((whileHeldBy(model, "Pointer", (held) => __foldkitBrandViewResult((letGo(model, layout, {
|
|
364
|
+
...held,
|
|
365
|
+
maybeTarget: Option.none()
|
|
366
|
+
}, COPY.putBack)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~25"))), "@gjermundgaraba/pixel-paper/reel/reel.js#CancelledPointer"),
|
|
367
|
+
SteppedHeld: ({ step }) => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((stepHeld(model, layout, held, step)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~26"))), "@gjermundgaraba/pixel-paper/reel/reel.js#SteppedHeld"),
|
|
368
|
+
DroppedHeld: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((letGo(model, layout, held, COPY.putBack)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~27"))), "@gjermundgaraba/pixel-paper/reel/reel.js#DroppedHeld"),
|
|
369
|
+
LeftGrip: () => __foldkitBrandViewResult((whileHeldBy(model, "Keyboard", (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~28"))), "@gjermundgaraba/pixel-paper/reel/reel.js#LeftGrip"),
|
|
370
|
+
PressedEscape: () => __foldkitBrandViewResult((Option.isSome(model.maybeResizing) ? { model: withResizing(model, Option.none()) } : whileHeld(model, (held) => __foldkitBrandViewResult((cancel(model, layout, held)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~29"))), "@gjermundgaraba/pixel-paper/reel/reel.js#PressedEscape"),
|
|
371
|
+
PressedTab: ({ paneId }) => __foldkitBrandViewResult((selectTab(model, layout, paneId, FocusPane({ paneHook: paneHook(model, paneId) }))), "@gjermundgaraba/pixel-paper/reel/reel.js#PressedTab"),
|
|
372
|
+
SteppedTab: ({ paneId }) => __foldkitBrandViewResult((selectTab(model, layout, paneId, FocusTab({ tabHook: tabHook(model, paneId) }))), "@gjermundgaraba/pixel-paper/reel/reel.js#SteppedTab"),
|
|
373
|
+
FocusedPane: ({ paneId }) => __foldkitBrandViewResult((Option.match(Option.filter(placeOf(layout, paneId), () => __foldkitBrandViewResult((!Option.exists(model.maybeFocus, (focus) => __foldkitBrandViewResult((focus.paneId === paneId), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~31"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~30")), {
|
|
374
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~9")),
|
|
375
|
+
onSome: (place) => (__foldkitBrandViewResult(({ model: focusOn(model, place) }), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~8"))
|
|
376
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#FocusedPane"),
|
|
377
|
+
PressedSplitter: ({ splitter, pointerId, clientX, clientY }) => __foldkitBrandViewResult((!isIdle(model) || !isSplitterPresent(layout, splitter) ? { model } : { model: withResizing(model, Option.some({
|
|
378
|
+
splitter,
|
|
379
|
+
pointerId,
|
|
380
|
+
pressX: clientX,
|
|
381
|
+
pressY: clientY,
|
|
382
|
+
maybeResize: Option.none()
|
|
383
|
+
})) }), "@gjermundgaraba/pixel-paper/reel/reel.js#PressedSplitter"),
|
|
384
|
+
MovedSplitter: ({ share }) => __foldkitBrandViewResult((resizeSplitter(model, layout, share, false)), "@gjermundgaraba/pixel-paper/reel/reel.js#MovedSplitter"),
|
|
385
|
+
ReleasedSplitter: ({ share }) => __foldkitBrandViewResult((resizeSplitter(model, layout, share, true)), "@gjermundgaraba/pixel-paper/reel/reel.js#ReleasedSplitter"),
|
|
386
|
+
CancelledSplitter: () => (__foldkitBrandViewResult(({ model: withResizing(model, Option.none()) }), "@gjermundgaraba/pixel-paper/reel/reel.js#CancelledSplitter")),
|
|
387
|
+
PressedSplitterKey: ({ splitter, share }) => __foldkitBrandViewResult((Option.match(resizeOf(layout, splitter, share), {
|
|
388
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~10")),
|
|
389
|
+
onSome: (resize) => (__foldkitBrandViewResult(({
|
|
390
|
+
model,
|
|
391
|
+
outMessage: resize
|
|
392
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~9"))
|
|
393
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#PressedSplitterKey"),
|
|
394
|
+
CompletedAnnounceReel: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#CompletedAnnounceReel")),
|
|
395
|
+
CompletedFocusPane: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#CompletedFocusPane")),
|
|
396
|
+
CompletedFocusTab: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#CompletedFocusTab")),
|
|
397
|
+
CompletedRestoreFocus: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#CompletedRestoreFocus")),
|
|
398
|
+
CompletedScrollIntoView: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#CompletedScrollIntoView")),
|
|
399
|
+
CompletedSizeLiftedPane: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#CompletedSizeLiftedPane"))
|
|
400
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#update");
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Brings the reel in line with a layout that changed: call it whenever the application changes
|
|
404
|
+
* the layout, by a request it applied, another client's or one of its own (a pane closed). The
|
|
405
|
+
* focused pane's place is read again; when it has gone, focus moves to the pane now nearest
|
|
406
|
+
* where it was, and the keyboard follows where it went with the pane. A drag whose pane has
|
|
407
|
+
* gone is cancelled, and one whose target's column has gone aims where it started;
|
|
408
|
+
* a splitter whose column or pane has gone lets go.
|
|
409
|
+
*/
|
|
410
|
+
const reconcile = (model, context) => {
|
|
411
|
+
const { layout } = context;
|
|
412
|
+
const isFocusGone = Option.exists(model.maybeFocus, (focus) => __foldkitBrandViewResult((Option.isNone(placeOf(layout, focus.paneId))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~32"));
|
|
413
|
+
const maybePlace = Option.filter(focusedPlace(model, layout), () => __foldkitBrandViewResult((Option.isSome(model.maybeFocus)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~33"));
|
|
414
|
+
const focused = Option.match(maybePlace, {
|
|
415
|
+
onNone: () => __foldkitBrandViewResult((model), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~11"),
|
|
416
|
+
onSome: (place) => __foldkitBrandViewResult((focusOn(model, place)), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~10")
|
|
417
|
+
});
|
|
418
|
+
const restore = Array.fromOption(Option.map(Option.filter(maybePlace, () => __foldkitBrandViewResult((isFocusGone), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~34")), (place) => __foldkitBrandViewResult((RestoreFocus({ paneHook: paneHook(model, place.pane.id) })), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~35")));
|
|
419
|
+
const settled = Option.exists(model.maybeResizing, ({ splitter }) => __foldkitBrandViewResult((isSplitterPresent(layout, splitter)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~36")) ? focused : withResizing(focused, Option.none());
|
|
420
|
+
return __foldkitBrandViewResult((Option.match(settled.maybeHeld, {
|
|
421
|
+
onNone: () => (__foldkitBrandViewResult(({
|
|
422
|
+
model: settled,
|
|
423
|
+
commands: restore
|
|
424
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~12")),
|
|
425
|
+
onSome: (held) => {
|
|
426
|
+
if (Option.isNone(placeOf(layout, held.paneId))) return __foldkitBrandViewResult(({
|
|
427
|
+
model: withHeld(settled, Option.none()),
|
|
428
|
+
commands: [...restore, announce(COPY.gone)]
|
|
429
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~11");
|
|
430
|
+
const maybeTarget = Option.orElse(Option.filter(held.maybeTarget, (target) => __foldkitBrandViewResult((isTargetPresent(layout, target)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~37")), () => __foldkitBrandViewResult((held.by._tag === "Keyboard" ? originOf(layout, held.paneId) : Option.none()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~38"));
|
|
431
|
+
return __foldkitBrandViewResult(({
|
|
432
|
+
model: withHeld(settled, Option.some({
|
|
433
|
+
...held,
|
|
434
|
+
maybeTarget
|
|
435
|
+
})),
|
|
436
|
+
commands: restore
|
|
437
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~11");
|
|
438
|
+
}
|
|
439
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#reconcile");
|
|
440
|
+
};
|
|
441
|
+
/** What the application's keys ask of the reel. `Focus*`: focus the pane beside the focused
|
|
442
|
+
* one. `MovePane*`: move the focused pane up or down its column, or into the column beside it
|
|
443
|
+
* (past the first or last column, into a column of its own). `MoveColumn*`: move its column.
|
|
444
|
+
* `CycleWidth`: its column's width to the next preset. `PullOut`: the pane into a column of
|
|
445
|
+
* its own, right of its column. */
|
|
446
|
+
const Action = Schema.Literals([
|
|
447
|
+
"FocusLeft",
|
|
448
|
+
"FocusRight",
|
|
449
|
+
"FocusUp",
|
|
450
|
+
"FocusDown",
|
|
451
|
+
"MovePaneLeft",
|
|
452
|
+
"MovePaneRight",
|
|
453
|
+
"MovePaneUp",
|
|
454
|
+
"MovePaneDown",
|
|
455
|
+
"MoveColumnLeft",
|
|
456
|
+
"MoveColumnRight",
|
|
457
|
+
"CycleWidth",
|
|
458
|
+
"PullOut"
|
|
459
|
+
]);
|
|
460
|
+
const focusStep = (model, layout, place) => (__foldkitBrandViewResult(({
|
|
461
|
+
model: focusOn(model, place),
|
|
462
|
+
commands: [
|
|
463
|
+
FocusPane({ paneHook: paneHook(model, place.pane.id) }),
|
|
464
|
+
ScrollIntoView({ hook: paneHook(model, place.pane.id) }),
|
|
465
|
+
announce(fill(COPY.focused, {
|
|
466
|
+
pane: place.pane.label,
|
|
467
|
+
where: placeWords(layout, place)
|
|
468
|
+
}))
|
|
469
|
+
]
|
|
470
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#focusStep"));
|
|
471
|
+
const requestStep = (model, layout, place, subject, maybeRequest) => __foldkitBrandViewResult((Option.match(Option.filter(maybeRequest, (request) => __foldkitBrandViewResult((isChange(layout, request)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~39")), {
|
|
472
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~13")),
|
|
473
|
+
onSome: (request) => {
|
|
474
|
+
const next = apply(layout, request);
|
|
475
|
+
const landing = Option.getOrElse(placeOf(next, place.pane.id), () => __foldkitBrandViewResult((place), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~40"));
|
|
476
|
+
const words = Option.getOrElse(subjectWords(layout, subject), () => __foldkitBrandViewResult((place.pane.label), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~41"));
|
|
477
|
+
const where = Option.getOrElse(whereWords(next, subject), () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~42"));
|
|
478
|
+
return __foldkitBrandViewResult(({
|
|
479
|
+
model: focusOn(model, landing),
|
|
480
|
+
commands: [ScrollIntoView({ hook: paneHook(model, place.pane.id) }), announce(fill(COPY.moved, {
|
|
481
|
+
subject: String.capitalize(words),
|
|
482
|
+
where
|
|
483
|
+
}))],
|
|
484
|
+
outMessage: request
|
|
485
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~12");
|
|
486
|
+
}
|
|
487
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#requestStep");
|
|
488
|
+
const readingOrder = (layout) => __foldkitBrandViewResult((Array.flatMap(layout, (column) => __foldkitBrandViewResult((column.panes), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~43"))), "@gjermundgaraba/pixel-paper/reel/reel.js#readingOrder");
|
|
489
|
+
const TAB_STEPS = {
|
|
490
|
+
FocusLeft: -1,
|
|
491
|
+
FocusUp: -1,
|
|
492
|
+
FocusRight: 1,
|
|
493
|
+
FocusDown: 1
|
|
494
|
+
};
|
|
495
|
+
const performTabbed = (model, action, layout) => {
|
|
496
|
+
const panes = readingOrder(layout);
|
|
497
|
+
const maybeNext = Option.flatMap(Option.all({
|
|
498
|
+
step: Option.fromUndefinedOr(TAB_STEPS[action]),
|
|
499
|
+
index: Option.flatMap(focusedPaneId(model, layout), (paneId) => __foldkitBrandViewResult((Array.findFirstIndex(panes, (pane) => __foldkitBrandViewResult((pane.id === paneId), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~45"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~44"))
|
|
500
|
+
}), ({ step, index }) => __foldkitBrandViewResult((Option.flatMap(Array.get(panes, index + step), (pane) => __foldkitBrandViewResult((Option.map(placeOf(layout, pane.id), (place) => (__foldkitBrandViewResult(({
|
|
501
|
+
place,
|
|
502
|
+
tab: index + step + 1
|
|
503
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~48")))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~47"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~46"));
|
|
504
|
+
return __foldkitBrandViewResult((Option.match(Option.filter(maybeNext, () => __foldkitBrandViewResult((!isHolding(model)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~49")), {
|
|
505
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~14")),
|
|
506
|
+
onSome: ({ place, tab }) => (__foldkitBrandViewResult(({
|
|
507
|
+
model: focusOn(model, place),
|
|
508
|
+
commands: [FocusPane({ paneHook: paneHook(model, place.pane.id) }), announce(fill(COPY.focusedTab, {
|
|
509
|
+
pane: place.pane.label,
|
|
510
|
+
tab,
|
|
511
|
+
tabs: panes.length
|
|
512
|
+
}))]
|
|
513
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~13"))
|
|
514
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#performTabbed");
|
|
515
|
+
};
|
|
516
|
+
const columnIdAt = (layout, index) => __foldkitBrandViewResult((Option.map(Array.get(layout, index), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~50"))), "@gjermundgaraba/pixel-paper/reel/reel.js#columnIdAt");
|
|
517
|
+
/**
|
|
518
|
+
* Does what the application's key for `action` asks, from the focused pane, against the
|
|
519
|
+
* layout as the application holds it: focus moves focus the pane and scroll the reel to it;
|
|
520
|
+
* moves report their request as the OutMessage, which the application applies, with focus
|
|
521
|
+
* kept on the pane. Each is said through the live region. Nothing happens while something is
|
|
522
|
+
* held, or where there is nowhere to go. Under tabs, only the focus keys act, stepping from tab
|
|
523
|
+
* to tab.
|
|
524
|
+
*/
|
|
525
|
+
const perform = (model, action, context) => {
|
|
526
|
+
const { layout, arrangement = "Strip" } = context;
|
|
527
|
+
if (arrangement === "Tabs") return __foldkitBrandViewResult((performTabbed(model, action, layout)), "@gjermundgaraba/pixel-paper/reel/reel.js#perform");
|
|
528
|
+
return __foldkitBrandViewResult((Option.match(Option.filter(focusedPlace(model, layout), () => __foldkitBrandViewResult((!isHolding(model)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~51")), {
|
|
529
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~15")),
|
|
530
|
+
onSome: (place) => {
|
|
531
|
+
const { column, columnIndex, row, pane } = place;
|
|
532
|
+
const rows = column.panes.length;
|
|
533
|
+
const paneId = pane.id;
|
|
534
|
+
const ask = (maybeRequest, subject = Subject.Pane({ paneId })) => __foldkitBrandViewResult((requestStep(model, layout, place, subject, maybeRequest)), "@gjermundgaraba/pixel-paper/reel/reel.js#ask");
|
|
535
|
+
const focusAt = (toColumn, toRow) => __foldkitBrandViewResult((Option.match(Option.flatMap(Array.get(layout, toColumn), (found) => __foldkitBrandViewResult((placeAt(layout, toColumn, Number.clamp(toRow, {
|
|
536
|
+
minimum: 0,
|
|
537
|
+
maximum: found.panes.length - 1
|
|
538
|
+
}))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~52")), {
|
|
539
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~16")),
|
|
540
|
+
onSome: (next) => __foldkitBrandViewResult((next.pane.id === paneId ? { model } : focusStep(model, layout, next)), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~15")
|
|
541
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#focusAt");
|
|
542
|
+
const sideways = (toColumn, edge) => __foldkitBrandViewResult((ask(Option.match(Array.get(layout, toColumn), {
|
|
543
|
+
onSome: (found) => __foldkitBrandViewResult((Option.some(OutMessage.MovedPane({
|
|
544
|
+
paneId,
|
|
545
|
+
toColumnId: found.id,
|
|
546
|
+
toIndex: Math.min(row, found.panes.length)
|
|
547
|
+
}))), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~16"),
|
|
548
|
+
onNone: () => __foldkitBrandViewResult((Option.liftPredicate(OutMessage.PulledOutPane({
|
|
549
|
+
paneId,
|
|
550
|
+
maybeBeforeColumnId: edge
|
|
551
|
+
}), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~53"))), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~17")
|
|
552
|
+
}))), "@gjermundgaraba/pixel-paper/reel/reel.js#sideways");
|
|
553
|
+
const moveColumn = (maybeBefore) => __foldkitBrandViewResult((ask(Option.map(maybeBefore, (maybeBeforeColumnId) => __foldkitBrandViewResult((OutMessage.MovedColumn({
|
|
554
|
+
columnId: column.id,
|
|
555
|
+
maybeBeforeColumnId
|
|
556
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~54")), Subject.Column({ columnId: column.id }))), "@gjermundgaraba/pixel-paper/reel/reel.js#moveColumn");
|
|
557
|
+
return __foldkitBrandViewResult((Match.value(action).pipe(Match.withReturnType(), Match.when("FocusLeft", () => __foldkitBrandViewResult((focusAt(columnIndex - 1, row)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~55")), Match.when("FocusRight", () => __foldkitBrandViewResult((focusAt(columnIndex + 1, row)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~56")), Match.when("FocusUp", () => __foldkitBrandViewResult((row > 0 ? focusAt(columnIndex, row - 1) : { model }), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~57")), Match.when("FocusDown", () => __foldkitBrandViewResult((focusAt(columnIndex, row + 1)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~58")), Match.when("MovePaneUp", () => __foldkitBrandViewResult((ask(Option.some(OutMessage.MovedPane({
|
|
558
|
+
paneId,
|
|
559
|
+
toColumnId: column.id,
|
|
560
|
+
toIndex: row - 1
|
|
561
|
+
})))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~59")), Match.when("MovePaneDown", () => __foldkitBrandViewResult((ask(Option.some(OutMessage.MovedPane({
|
|
562
|
+
paneId,
|
|
563
|
+
toColumnId: column.id,
|
|
564
|
+
toIndex: row + 1
|
|
565
|
+
})))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~60")), Match.when("MovePaneLeft", () => __foldkitBrandViewResult((sideways(columnIndex - 1, columnIdAt(layout, 0))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~61")), Match.when("MovePaneRight", () => __foldkitBrandViewResult((sideways(columnIndex + 1, Option.none())), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~62")), Match.when("MoveColumnLeft", () => __foldkitBrandViewResult((moveColumn(Option.map(columnIdAt(layout, columnIndex - 1), (before) => __foldkitBrandViewResult((Option.some(before)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~64")))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~63")), Match.when("MoveColumnRight", () => __foldkitBrandViewResult((moveColumn(Option.map(columnIdAt(layout, columnIndex + 1), () => __foldkitBrandViewResult((columnIdAt(layout, columnIndex + 2)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~66")))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~65")), Match.when("CycleWidth", () => {
|
|
566
|
+
const width = nextPreset(column.width);
|
|
567
|
+
return __foldkitBrandViewResult(({
|
|
568
|
+
model,
|
|
569
|
+
commands: [ScrollIntoView({ hook: paneHook(model, paneId) }), announce(fill(COPY.widened, {
|
|
570
|
+
column: columnIndex + 1,
|
|
571
|
+
width: widthWords(width)
|
|
572
|
+
}))],
|
|
573
|
+
outMessage: OutMessage.ResizedColumn({
|
|
574
|
+
columnId: column.id,
|
|
575
|
+
width
|
|
576
|
+
})
|
|
577
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~67");
|
|
578
|
+
}), Match.when("PullOut", () => __foldkitBrandViewResult((ask(Option.liftPredicate(OutMessage.PulledOutPane({
|
|
579
|
+
paneId,
|
|
580
|
+
maybeBeforeColumnId: columnIdAt(layout, columnIndex + 1)
|
|
581
|
+
}), () => __foldkitBrandViewResult((rows > 1), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~69")))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~68")), Match.exhaustive)), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~14");
|
|
582
|
+
}
|
|
583
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#perform");
|
|
584
|
+
};
|
|
585
|
+
const EDGE_SCROLL = 40;
|
|
586
|
+
const EDGE_SCROLL_PIXELS_PER_MILLI = .8;
|
|
587
|
+
const LONGEST_FRAME_MILLIS = 50;
|
|
588
|
+
const columnBoxOf = (element) => {
|
|
589
|
+
const rect = element.getBoundingClientRect();
|
|
590
|
+
return __foldkitBrandViewResult(({
|
|
591
|
+
id: element.dataset["reelColumn"] ?? "",
|
|
592
|
+
left: rect.left,
|
|
593
|
+
right: rect.right
|
|
594
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#columnBoxOf");
|
|
595
|
+
};
|
|
596
|
+
const slotMiddlesOf = (element, heldId) => __foldkitBrandViewResult((Array.map(Array.filter(Array.fromIterable(element.querySelectorAll("[data-reel-slot]")), (slot) => __foldkitBrandViewResult((slot.dataset["reelSlot"] !== heldId), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~70")), (slot) => {
|
|
597
|
+
const slotRect = slot.getBoundingClientRect();
|
|
598
|
+
return __foldkitBrandViewResult((slotRect.top + slotRect.height / 2), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~71");
|
|
599
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#slotMiddlesOf");
|
|
600
|
+
const pointerTarget = (reelHook, paneId, clientX, clientY) => __foldkitBrandViewResult((Option.map(Option.filter(scrollerOf(reelHook), (view) => {
|
|
601
|
+
const rect = view.getBoundingClientRect();
|
|
602
|
+
return __foldkitBrandViewResult((clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~72");
|
|
603
|
+
}), (view) => {
|
|
604
|
+
const columns = Array.fromIterable(view.querySelectorAll("[data-reel-column]"));
|
|
605
|
+
return __foldkitBrandViewResult((targetAtPoint(Array.map(columns, columnBoxOf), clientX, clientY, (index) => __foldkitBrandViewResult((Option.match(Array.get(columns, index), {
|
|
606
|
+
onNone: () => __foldkitBrandViewResult(([]), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~18"),
|
|
607
|
+
onSome: (column) => __foldkitBrandViewResult((slotMiddlesOf(column, paneId)), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~17")
|
|
608
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~74"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~73");
|
|
609
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#pointerTarget");
|
|
610
|
+
const PointerHold = Schema.Struct({
|
|
611
|
+
reelHook: Schema.String,
|
|
612
|
+
paneId: Schema.String,
|
|
613
|
+
pointerId: Schema.Finite
|
|
614
|
+
});
|
|
615
|
+
const pointerAt = (hold, event) => (__foldkitBrandViewResult(({
|
|
616
|
+
clientX: event.clientX,
|
|
617
|
+
clientY: event.clientY,
|
|
618
|
+
maybeTarget: pointerTarget(hold.reelHook, hold.paneId, event.clientX, event.clientY)
|
|
619
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#pointerAt"));
|
|
620
|
+
const pointerMessages = (hold) => __foldkitBrandViewResult((Stream.callback((queue) => __foldkitBrandViewResult((Effect.acquireRelease(Effect.sync(() => {
|
|
621
|
+
const state = {
|
|
622
|
+
maybeMove: Option.none(),
|
|
623
|
+
frame: 0
|
|
624
|
+
};
|
|
625
|
+
const readMove = () => {
|
|
626
|
+
cancelAnimationFrame(state.frame);
|
|
627
|
+
Option.map(state.maybeMove, (event) => {
|
|
628
|
+
Queue.offerUnsafe(queue, Message.MovedPointer(pointerAt(hold, event)));
|
|
629
|
+
});
|
|
630
|
+
state.maybeMove = Option.none();
|
|
631
|
+
};
|
|
632
|
+
const onMove = (event) => {
|
|
633
|
+
if (event.pointerId === hold.pointerId) {
|
|
634
|
+
if (Option.isNone(state.maybeMove)) state.frame = requestAnimationFrame(readMove);
|
|
635
|
+
state.maybeMove = Option.some(event);
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
const onUp = (event) => {
|
|
639
|
+
if (event.pointerId === hold.pointerId) {
|
|
640
|
+
readMove();
|
|
641
|
+
Queue.offerUnsafe(queue, Message.ReleasedPointer(pointerAt(hold, event)));
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
const onCancel = (event) => {
|
|
645
|
+
if (event.pointerId === hold.pointerId) {
|
|
646
|
+
cancelAnimationFrame(state.frame);
|
|
647
|
+
state.maybeMove = Option.none();
|
|
648
|
+
Queue.offerUnsafe(queue, Message.CancelledPointer());
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
document.addEventListener("pointermove", onMove);
|
|
652
|
+
document.addEventListener("pointerup", onUp);
|
|
653
|
+
document.addEventListener("pointercancel", onCancel);
|
|
654
|
+
return __foldkitBrandViewResult(({
|
|
655
|
+
state,
|
|
656
|
+
onMove,
|
|
657
|
+
onUp,
|
|
658
|
+
onCancel
|
|
659
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~76");
|
|
660
|
+
}), ({ state, onMove, onUp, onCancel }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
661
|
+
cancelAnimationFrame(state.frame);
|
|
662
|
+
document.removeEventListener("pointermove", onMove);
|
|
663
|
+
document.removeEventListener("pointerup", onUp);
|
|
664
|
+
document.removeEventListener("pointercancel", onCancel);
|
|
665
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~78"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~75"))), "@gjermundgaraba/pixel-paper/reel/reel.js#pointerMessages");
|
|
666
|
+
const towards = (at, low, high) => {
|
|
667
|
+
if (at < low + EDGE_SCROLL) return __foldkitBrandViewResult((-1), "@gjermundgaraba/pixel-paper/reel/reel.js#towards");
|
|
668
|
+
else if (at > high - EDGE_SCROLL) return __foldkitBrandViewResult((1), "@gjermundgaraba/pixel-paper/reel/reel.js#towards");
|
|
669
|
+
return __foldkitBrandViewResult((0), "@gjermundgaraba/pixel-paper/reel/reel.js#towards");
|
|
670
|
+
};
|
|
671
|
+
const edgeScroll = (hold) => __foldkitBrandViewResult((Stream.callback(() => __foldkitBrandViewResult((Effect.acquireRelease(Effect.sync(() => {
|
|
672
|
+
const state = {
|
|
673
|
+
maybeAt: Option.none(),
|
|
674
|
+
frame: 0,
|
|
675
|
+
last: performance.now()
|
|
676
|
+
};
|
|
677
|
+
const onMove = (event) => {
|
|
678
|
+
if (event.pointerId === hold.pointerId) state.maybeAt = Option.some({
|
|
679
|
+
x: event.clientX,
|
|
680
|
+
y: event.clientY
|
|
681
|
+
});
|
|
682
|
+
};
|
|
683
|
+
const step = (now) => {
|
|
684
|
+
const distance = Math.min(now - state.last, LONGEST_FRAME_MILLIS) * EDGE_SCROLL_PIXELS_PER_MILLI;
|
|
685
|
+
state.last = now;
|
|
686
|
+
Option.map(Option.all({
|
|
687
|
+
view: scrollerOf(hold.reelHook),
|
|
688
|
+
at: state.maybeAt
|
|
689
|
+
}), ({ view, at }) => {
|
|
690
|
+
const rect = view.getBoundingClientRect();
|
|
691
|
+
view.scrollLeft += towards(at.x, rect.left, rect.right) * distance;
|
|
692
|
+
view.scrollTop += towards(at.y, rect.top, rect.bottom) * distance;
|
|
693
|
+
});
|
|
694
|
+
state.frame = requestAnimationFrame(step);
|
|
695
|
+
};
|
|
696
|
+
document.addEventListener("pointermove", onMove);
|
|
697
|
+
state.frame = requestAnimationFrame(step);
|
|
698
|
+
return __foldkitBrandViewResult(({
|
|
699
|
+
state,
|
|
700
|
+
onMove
|
|
701
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~81");
|
|
702
|
+
}), ({ state, onMove }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
703
|
+
cancelAnimationFrame(state.frame);
|
|
704
|
+
document.removeEventListener("pointermove", onMove);
|
|
705
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~83")).pipe(Effect.flatMap(() => __foldkitBrandViewResult((Effect.never), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~85")))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~80"))), "@gjermundgaraba/pixel-paper/reel/reel.js#edgeScroll");
|
|
706
|
+
const SplitterHold = Schema.Struct({
|
|
707
|
+
reelHook: Schema.String,
|
|
708
|
+
splitter: Splitter,
|
|
709
|
+
pointerId: Schema.Finite,
|
|
710
|
+
pressX: Schema.Finite,
|
|
711
|
+
pressY: Schema.Finite
|
|
712
|
+
});
|
|
713
|
+
const heightOf = (element) => __foldkitBrandViewResult((element.getBoundingClientRect().height), "@gjermundgaraba/pixel-paper/reel/reel.js#heightOf");
|
|
714
|
+
const scaleOf = (hold) => __foldkitBrandViewResult((Option.getOrElse(Option.map(scrollerOf(hold.reelHook), (view) => __foldkitBrandViewResult((Splitter.match(hold.splitter, {
|
|
715
|
+
Width: () => __foldkitBrandViewResult((view.clientWidth - Option.getOrElse(Option.map(Option.fromNullishOr(view.querySelector(".reel-gap")), (gap) => __foldkitBrandViewResult((gap.getBoundingClientRect().width), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~87")), () => __foldkitBrandViewResult((0), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~88"))), "@gjermundgaraba/pixel-paper/reel/reel.js#Width"),
|
|
716
|
+
Split: ({ abovePaneId }) => __foldkitBrandViewResult((Number.sumAll(Array.map(Array.fromIterable(view.querySelector(`[data-reel-slot="${CSS.escape(abovePaneId)}"]`)?.closest(".reel-column")?.querySelectorAll("[data-reel-slot]") ?? []), heightOf))), "@gjermundgaraba/pixel-paper/reel/reel.js#Split")
|
|
717
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~86")), () => __foldkitBrandViewResult((0), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~89"))), "@gjermundgaraba/pixel-paper/reel/reel.js#scaleOf");
|
|
718
|
+
const splitterMessages = (hold) => __foldkitBrandViewResult((Stream.suspend(() => {
|
|
719
|
+
const scale = scaleOf(hold);
|
|
720
|
+
const shareOf = (event) => {
|
|
721
|
+
const moved = hold.splitter._tag === "Width" ? event.clientX - hold.pressX : event.clientY - hold.pressY;
|
|
722
|
+
return __foldkitBrandViewResult((scale > 0 ? moved / scale : 0), "@gjermundgaraba/pixel-paper/reel/reel.js#shareOf");
|
|
723
|
+
};
|
|
724
|
+
return __foldkitBrandViewResult((pointerMessages$1(hold.pointerId, {
|
|
725
|
+
moved: (event) => __foldkitBrandViewResult((Message.MovedSplitter({ share: shareOf(event) })), "@gjermundgaraba/pixel-paper/reel/reel.js#moved"),
|
|
726
|
+
released: (event) => __foldkitBrandViewResult((Message.ReleasedSplitter({ share: shareOf(event) })), "@gjermundgaraba/pixel-paper/reel/reel.js#released"),
|
|
727
|
+
cancelled: () => __foldkitBrandViewResult((Message.CancelledSplitter()), "@gjermundgaraba/pixel-paper/reel/reel.js#cancelled")
|
|
728
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~90");
|
|
729
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#splitterMessages");
|
|
730
|
+
const pointerHoldOf = (model, isCarryingOnly) => __foldkitBrandViewResult((Option.flatMap(model.maybeHeld, ({ paneId, by }) => __foldkitBrandViewResult((By.match(by, {
|
|
731
|
+
Keyboard: () => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/reel/reel.js#Keyboard~3"),
|
|
732
|
+
Pointer: ({ pointerId, isCarrying }) => __foldkitBrandViewResult((isCarryingOnly && !isCarrying ? Option.none() : Option.some({
|
|
733
|
+
reelHook: model.id,
|
|
734
|
+
paneId,
|
|
735
|
+
pointerId
|
|
736
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#Pointer~3")
|
|
737
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~91"))), "@gjermundgaraba/pixel-paper/reel/reel.js#pointerHoldOf");
|
|
738
|
+
const reelSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResult(({
|
|
739
|
+
pointer: entry({ maybeHold: Schema.Option(PointerHold) }, {
|
|
740
|
+
modelToDependencies: (model) => (__foldkitBrandViewResult(({ maybeHold: pointerHoldOf(model, false) }), "@gjermundgaraba/pixel-paper/reel/reel.js#modelToDependencies")),
|
|
741
|
+
dependenciesToStream: ({ maybeHold }) => __foldkitBrandViewResult((Option.match(maybeHold, {
|
|
742
|
+
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~19"),
|
|
743
|
+
onSome: (hold) => __foldkitBrandViewResult((Stream.merge(pointerMessages(hold), markDragging)), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~18")
|
|
744
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#dependenciesToStream")
|
|
745
|
+
}),
|
|
746
|
+
edge: entry({ maybeHold: Schema.Option(PointerHold) }, {
|
|
747
|
+
modelToDependencies: (model) => (__foldkitBrandViewResult(({ maybeHold: pointerHoldOf(model, true) }), "@gjermundgaraba/pixel-paper/reel/reel.js#modelToDependencies~2")),
|
|
748
|
+
dependenciesToStream: ({ maybeHold }) => __foldkitBrandViewResult((Option.match(maybeHold, {
|
|
749
|
+
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~20"),
|
|
750
|
+
onSome: edgeScroll
|
|
751
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#dependenciesToStream~2")
|
|
752
|
+
}),
|
|
753
|
+
resize: entry({ maybeHold: Schema.Option(SplitterHold) }, {
|
|
754
|
+
modelToDependencies: (model) => (__foldkitBrandViewResult(({ maybeHold: Option.map(model.maybeResizing, ({ splitter, pointerId, pressX, pressY }) => (__foldkitBrandViewResult(({
|
|
755
|
+
reelHook: model.id,
|
|
756
|
+
splitter,
|
|
757
|
+
pointerId,
|
|
758
|
+
pressX,
|
|
759
|
+
pressY
|
|
760
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~93"))) }), "@gjermundgaraba/pixel-paper/reel/reel.js#modelToDependencies~3")),
|
|
761
|
+
dependenciesToStream: ({ maybeHold }) => __foldkitBrandViewResult((Option.match(maybeHold, {
|
|
762
|
+
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~21"),
|
|
763
|
+
onSome: (hold) => __foldkitBrandViewResult((Stream.merge(splitterMessages(hold), markDragging)), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~19")
|
|
764
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#dependenciesToStream~3")
|
|
765
|
+
}),
|
|
766
|
+
escape: entry({ isHolding: Schema.Boolean }, {
|
|
767
|
+
modelToDependencies: (model) => (__foldkitBrandViewResult(({ isHolding: !isIdle(model) }), "@gjermundgaraba/pixel-paper/reel/reel.js#modelToDependencies~4")),
|
|
768
|
+
dependenciesToStream: ({ isHolding: isHoldingNow }) => __foldkitBrandViewResult((isHoldingNow ? escapeKeys(Message.PressedEscape()) : Stream.empty), "@gjermundgaraba/pixel-paper/reel/reel.js#dependenciesToStream~4")
|
|
769
|
+
})
|
|
770
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~92")));
|
|
771
|
+
/** A held pane follows the pointer (the reel scrolling near its edges), a dragged
|
|
772
|
+
* splitter resizes, and Escape puts either back, before a dialog or the page sees it, from
|
|
773
|
+
* listeners that run only while something is held. Lift them into the application's
|
|
774
|
+
* Subscriptions, once per reel, behind a key prefix of the parent's: `subscriptions("tiles")`
|
|
775
|
+
* is keyed `tilesPointer`, `tilesEdge`, `tilesResize` and `tilesEscape`. */
|
|
776
|
+
const subscriptions = (keyPrefix) => __foldkitBrandViewResult((prefixKeys(keyPrefix, reelSubscriptions)), "@gjermundgaraba/pixel-paper/reel/reel.js#subscriptions");
|
|
777
|
+
/** Sizes the copy that follows the pointer to what it lifts, and keeps the pointer where it
|
|
778
|
+
* pressed. Measures the source once, when the copy appears. */
|
|
779
|
+
const SizeLiftedPane = Mount.define("SizeLiftedPane", {
|
|
780
|
+
args: {
|
|
781
|
+
sourceSelector: Schema.String,
|
|
782
|
+
pressX: Schema.Finite,
|
|
783
|
+
pressY: Schema.Finite
|
|
784
|
+
},
|
|
785
|
+
messages: [Message.CompletedSizeLiftedPane],
|
|
786
|
+
execute: ({ element, sourceSelector, pressX, pressY }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
787
|
+
measureLift(element, sourceSelector, pressX, pressY);
|
|
788
|
+
return __foldkitBrandViewResult((Message.CompletedSizeLiftedPane()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~94");
|
|
789
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#execute~6")
|
|
790
|
+
});
|
|
791
|
+
const helpId = (model) => __foldkitBrandViewResult((`${model.id}-grip-help`), "@gjermundgaraba/pixel-paper/reel/reel.js#helpId");
|
|
792
|
+
const SPLITTER_STEP = .05;
|
|
793
|
+
const HELD_STEPS = {
|
|
794
|
+
ArrowUp: "Up",
|
|
795
|
+
ArrowDown: "Down",
|
|
796
|
+
ArrowLeft: "Left",
|
|
797
|
+
ArrowRight: "Right"
|
|
798
|
+
};
|
|
799
|
+
const isDropKey = (key) => __foldkitBrandViewResult((key === " " || key === "Enter"), "@gjermundgaraba/pixel-paper/reel/reel.js#isDropKey");
|
|
800
|
+
const STAGE_ANCHOR = "--reel-stage";
|
|
801
|
+
const anchorName = (index) => __foldkitBrandViewResult((`--reel-${index}`), "@gjermundgaraba/pixel-paper/reel/reel.js#anchorName");
|
|
802
|
+
const byId = Order.mapInput(Order.String, (pane) => __foldkitBrandViewResult((pane.id), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~95"));
|
|
803
|
+
const stableDomOrder = (layout) => __foldkitBrandViewResult((Array.sort(Array.flatMap(layout, (column) => __foldkitBrandViewResult((column.panes), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~96")), byId)), "@gjermundgaraba/pixel-paper/reel/reel.js#stableDomOrder");
|
|
804
|
+
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/pixel-paper/reel/reel.js#anonymous~98"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~97"))), "@gjermundgaraba/pixel-paper/reel/reel.js#markOf");
|
|
805
|
+
const carriedIdOf = (model) => __foldkitBrandViewResult((Option.map(Option.filter(model.maybeHeld, isCarried), ({ paneId }) => __foldkitBrandViewResult((paneId), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~99"))), "@gjermundgaraba/pixel-paper/reel/reel.js#carriedIdOf");
|
|
806
|
+
const gripView = (model, pane, h) => {
|
|
807
|
+
const maybeHeldHere = Option.filter(model.maybeHeld, (held) => __foldkitBrandViewResult((held.paneId === pane.id), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~100"));
|
|
808
|
+
const isHeld = Option.exists(maybeHeldHere, isCarried);
|
|
809
|
+
const isKeyboardHeld = Option.exists(maybeHeldHere, (held) => __foldkitBrandViewResult((held.by._tag === "Keyboard"), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~101"));
|
|
810
|
+
const onGripKey = h.OnKeyDownPreventDefault((key, modifiers) => {
|
|
811
|
+
if (!isPlain(modifiers)) return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~102");
|
|
812
|
+
else if (isKeyboardHeld) return __foldkitBrandViewResult((isDropKey(key) ? Option.some(Message.DroppedHeld()) : Option.map(Record.get(HELD_STEPS, key), (step) => __foldkitBrandViewResult((Message.SteppedHeld({ step })), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~103"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~102");
|
|
813
|
+
return __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGripKey({ paneId: pane.id }), () => __foldkitBrandViewResult((isIdle(model) && isDropKey(key)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~104"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~102");
|
|
814
|
+
});
|
|
815
|
+
const onGripPress = h.OnPointerDown((_pointerType, button, _screenX, _screenY, _time, clientX, clientY, pointerId) => __foldkitBrandViewResult((Option.liftPredicate(Message.PressedGrip({
|
|
816
|
+
paneId: pane.id,
|
|
817
|
+
pointerId,
|
|
818
|
+
clientX,
|
|
819
|
+
clientY
|
|
820
|
+
}), () => __foldkitBrandViewResult((isIdle(model) && button === 0), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~106"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~105"));
|
|
821
|
+
return __foldkitBrandViewResult((view$2({
|
|
822
|
+
glyph: "grip",
|
|
823
|
+
label: fill(COPY.paneGrip, { pane: pane.label }),
|
|
824
|
+
isQuiet: true,
|
|
825
|
+
attributes: [
|
|
826
|
+
h.DataAttribute("reel-grip", paneHook(model, pane.id)),
|
|
827
|
+
h.AriaRoleDescription("draggable"),
|
|
828
|
+
h.AriaDescribedBy(helpId(model)),
|
|
829
|
+
pressedAttribute(isHeld, h),
|
|
830
|
+
onGripKey,
|
|
831
|
+
onGripPress,
|
|
832
|
+
...isKeyboardHeld ? [h.OnBlur(Message.LeftGrip())] : []
|
|
833
|
+
]
|
|
834
|
+
}, h)), "@gjermundgaraba/pixel-paper/reel/reel.js#gripView");
|
|
835
|
+
};
|
|
836
|
+
const reelSplitterAttributes = (model, splitter, h) => __foldkitBrandViewResult((splitterAttributes({
|
|
837
|
+
orientation: splitter._tag === "Width" ? "vertical" : "horizontal",
|
|
838
|
+
isIdle: isIdle(model),
|
|
839
|
+
onPress: (pointerId, clientX, clientY) => __foldkitBrandViewResult((Message.PressedSplitter({
|
|
840
|
+
splitter,
|
|
841
|
+
pointerId,
|
|
842
|
+
clientX,
|
|
843
|
+
clientY
|
|
844
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#onPress"),
|
|
845
|
+
onStep: (direction) => __foldkitBrandViewResult((Message.PressedSplitterKey({
|
|
846
|
+
splitter,
|
|
847
|
+
share: direction * SPLITTER_STEP
|
|
848
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#onStep")
|
|
849
|
+
}, h)), "@gjermundgaraba/pixel-paper/reel/reel.js#reelSplitterAttributes");
|
|
850
|
+
const dropMarkOf = (info, column) => __foldkitBrandViewResult((Option.flatMap(info.maybeMark, (mark) => {
|
|
851
|
+
if (mark._tag !== "Into" || mark.columnId !== column.id) return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~107");
|
|
852
|
+
const others = Array.filter(column.panes, (pane) => __foldkitBrandViewResult((!Option.contains(info.maybeCarriedId, pane.id)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~108"));
|
|
853
|
+
return __foldkitBrandViewResult((Option.orElse(Option.map(Array.get(others, mark.index), ({ id }) => (__foldkitBrandViewResult(({
|
|
854
|
+
paneId: id,
|
|
855
|
+
markClass: " drop-before"
|
|
856
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~109"))), () => __foldkitBrandViewResult((Option.map(Option.filter(Array.last(others), () => __foldkitBrandViewResult((mark.index >= others.length), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~111")), ({ id }) => (__foldkitBrandViewResult(({
|
|
857
|
+
paneId: id,
|
|
858
|
+
markClass: " drop-after"
|
|
859
|
+
}), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~112")))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~110"))), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~107");
|
|
860
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#dropMarkOf");
|
|
861
|
+
const isGapMarked = (info, maybeBeforeColumnId) => __foldkitBrandViewResult((Option.exists(info.maybeMark, (mark) => __foldkitBrandViewResult((mark._tag === "Gap" && Equal.equals(mark.maybeBeforeColumnId, maybeBeforeColumnId)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~113"))), "@gjermundgaraba/pixel-paper/reel/reel.js#isGapMarked");
|
|
862
|
+
const slotView = (anchors, maybeDropMark, pane, h) => __foldkitBrandViewResult((h.keyed("div")(pane.id, [
|
|
863
|
+
h.Class(`reel-slot${Option.match(Option.filter(maybeDropMark, ({ paneId }) => __foldkitBrandViewResult((paneId === pane.id), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~114")), {
|
|
864
|
+
onNone: () => __foldkitBrandViewResult((""), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~22"),
|
|
865
|
+
onSome: ({ markClass }) => __foldkitBrandViewResult((markClass), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~20")
|
|
866
|
+
})}`),
|
|
867
|
+
h.DataAttribute("reel-slot", pane.id),
|
|
868
|
+
h.Style({
|
|
869
|
+
"--reel-weight": `${pane.weight}`,
|
|
870
|
+
"--reel-anchor": anchors.get(pane.id) ?? "none"
|
|
871
|
+
})
|
|
872
|
+
])), "@gjermundgaraba/pixel-paper/reel/reel.js#slotView");
|
|
873
|
+
const splitView = (model, above, share, h) => __foldkitBrandViewResult((h.keyed("div")(`split:${above.id}`, [
|
|
874
|
+
h.Class("reel-split"),
|
|
875
|
+
h.Role("separator"),
|
|
876
|
+
h.AriaLabel(fill(COPY.heightLabel, { pane: above.label })),
|
|
877
|
+
h.AriaValuemin(0),
|
|
878
|
+
h.AriaValuemax(100),
|
|
879
|
+
h.AriaValuenow(Math.round(share * 100)),
|
|
880
|
+
h.Tabindex(0),
|
|
881
|
+
h.DataAttribute("reel-split", above.id),
|
|
882
|
+
...reelSplitterAttributes(model, Splitter.Split({ abovePaneId: above.id }), h)
|
|
883
|
+
])), "@gjermundgaraba/pixel-paper/reel/reel.js#splitView");
|
|
884
|
+
const columnView = (info, anchors, column, index, h) => {
|
|
885
|
+
const { model, layout } = info;
|
|
886
|
+
const total = Number.sumAll(Array.map(column.panes, (pane) => __foldkitBrandViewResult((pane.weight), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~115")));
|
|
887
|
+
const maybeDropMark = dropMarkOf(info, column);
|
|
888
|
+
const stack = Array.flatMap(column.panes, (pane, row) => __foldkitBrandViewResult(([...Array.fromOption(Option.map(Array.get(column.panes, row - 1), (above) => __foldkitBrandViewResult((splitView(model, above, total > 0 ? above.weight / total : 0, h)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~117"))), slotView(anchors, maybeDropMark, pane, h)]), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~116"));
|
|
889
|
+
const maybeNextId = Option.map(Array.get(layout, index + 1), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~118"));
|
|
890
|
+
return __foldkitBrandViewResult(([h.keyed("div")(`column:${column.id}`, [
|
|
891
|
+
h.Class("reel-column"),
|
|
892
|
+
h.DataAttribute("reel-column", column.id),
|
|
893
|
+
h.DataAttribute("reel-hook", columnHook(model, column.id)),
|
|
894
|
+
h.Style({ "--reel-width": `${column.width}` })
|
|
895
|
+
], stack), h.keyed("div")(`resize:${column.id}`, [
|
|
896
|
+
h.Class(`reel-gap reel-resize${isGapMarked(info, maybeNextId) ? " drop-here" : ""}`),
|
|
897
|
+
h.Role("separator"),
|
|
898
|
+
h.AriaLabel(fill(COPY.widthLabel, { column: index + 1 })),
|
|
899
|
+
h.AriaValuemin(0),
|
|
900
|
+
h.AriaValuemax(100),
|
|
901
|
+
h.AriaValuenow(Math.round(column.width * 100)),
|
|
902
|
+
h.AriaValuetext(widthWords(column.width)),
|
|
903
|
+
h.Tabindex(0),
|
|
904
|
+
h.DataAttribute("reel-resize", column.id),
|
|
905
|
+
...reelSplitterAttributes(model, Splitter.Width({ columnId: column.id }), h)
|
|
906
|
+
])]), "@gjermundgaraba/pixel-paper/reel/reel.js#columnView");
|
|
907
|
+
};
|
|
908
|
+
const paneLayerView = (info, panesInDomOrder, anchors, h) => {
|
|
909
|
+
const { model } = info;
|
|
910
|
+
return __foldkitBrandViewResult((h.div([h.Class("reel-panes")], Array.map(panesInDomOrder, (pane) => {
|
|
911
|
+
const isFocused = Option.contains(info.maybeFocusedId, pane.id);
|
|
912
|
+
const isHeld = Option.contains(info.maybeCarriedId, pane.id);
|
|
913
|
+
const isBehind = info.isTabbed && !isFocused;
|
|
914
|
+
return __foldkitBrandViewResult((h.keyed("div")(pane.id, [
|
|
915
|
+
h.Class(`reel-pane${isFocused ? " focused" : ""}${isHeld ? " drag-dim" : ""}${isBehind ? " behind" : ""}`),
|
|
916
|
+
h.DataAttribute("reel-pane", paneHook(model, pane.id)),
|
|
917
|
+
h.Style({ "--reel-anchor": anchors.get(pane.id) ?? "none" }),
|
|
918
|
+
h.Tabindex(-1),
|
|
919
|
+
...isBehind ? [h.Inert(true)] : [],
|
|
920
|
+
h.OnFocusEnter(Message.FocusedPane({ paneId: pane.id }))
|
|
921
|
+
], [info.toPaneView(pane, {
|
|
922
|
+
lead: info.isTabbed ? [] : [gripView(model, pane, h)],
|
|
923
|
+
id: `${model.id}-${pane.id}`
|
|
924
|
+
})])), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~119");
|
|
925
|
+
}))), "@gjermundgaraba/pixel-paper/reel/reel.js#paneLayerView");
|
|
926
|
+
};
|
|
927
|
+
const liftedCopyView = (info, h) => {
|
|
928
|
+
const { model, layout } = info;
|
|
929
|
+
return __foldkitBrandViewResult((Array.fromOption(Option.flatMap(model.maybeHeld, (held) => __foldkitBrandViewResult((By.match(held.by, {
|
|
930
|
+
Keyboard: () => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/reel/reel.js#Keyboard~4"),
|
|
931
|
+
Pointer: ({ isCarrying, pressX, pressY, x, y }) => __foldkitBrandViewResult((Option.liftPredicate(h.div([
|
|
932
|
+
h.Class("reel-lift"),
|
|
933
|
+
h.Style({ transform: `translate3d(${x}px, ${y}px, 0)` }),
|
|
934
|
+
h.AriaHidden(true),
|
|
935
|
+
h.Inert(true),
|
|
936
|
+
h.OnMount(SizeLiftedPane({
|
|
937
|
+
sourceSelector: `[data-reel-pane="${CSS.escape(paneHook(model, held.paneId))}"]`,
|
|
938
|
+
pressX,
|
|
939
|
+
pressY
|
|
940
|
+
}))
|
|
941
|
+
], [h.div([h.Class("panel window")], [h.div([h.Class("panel-tb")], [h.span([h.Class("panel-lead")], [h.span([h.Class("iconbtn quiet")], [view$1({ name: "grip" }, h)])]), h.h2([], [heldLabel(layout, held)])])])]), () => __foldkitBrandViewResult((isCarrying), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~121"))), "@gjermundgaraba/pixel-paper/reel/reel.js#Pointer~4")
|
|
942
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~120")))), "@gjermundgaraba/pixel-paper/reel/reel.js#liftedCopyView");
|
|
943
|
+
};
|
|
944
|
+
const tabListView = (info, label, toTabLeadView, h) => {
|
|
945
|
+
const { model, layout } = info;
|
|
946
|
+
const panes = readingOrder(layout);
|
|
947
|
+
const stepTo = (index) => __foldkitBrandViewResult((Option.map(Array.get(panes, (index + panes.length) % panes.length), ({ id }) => __foldkitBrandViewResult((Message.SteppedTab({ paneId: id })), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~122"))), "@gjermundgaraba/pixel-paper/reel/reel.js#stepTo");
|
|
948
|
+
const keyOf = (index, key) => __foldkitBrandViewResult((Match.value(key).pipe(Match.when("ArrowLeft", () => __foldkitBrandViewResult((stepTo(index - 1)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~123")), Match.when("ArrowRight", () => __foldkitBrandViewResult((stepTo(index + 1)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~124")), Match.when("Home", () => __foldkitBrandViewResult((stepTo(0)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~125")), Match.when("End", () => __foldkitBrandViewResult((stepTo(panes.length - 1)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~126")), Match.orElse(() => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~127")))), "@gjermundgaraba/pixel-paper/reel/reel.js#keyOf");
|
|
949
|
+
return __foldkitBrandViewResult((h.div([
|
|
950
|
+
h.Class("nav tabs reel-tabs"),
|
|
951
|
+
h.Role("tablist"),
|
|
952
|
+
h.AriaLabel(label)
|
|
953
|
+
], Array.map(panes, (pane, index) => {
|
|
954
|
+
const isSelected = Option.contains(info.maybeFocusedId, pane.id);
|
|
955
|
+
return __foldkitBrandViewResult((h.keyed("button")(pane.id, [
|
|
956
|
+
h.Type("button"),
|
|
957
|
+
h.Role("tab"),
|
|
958
|
+
h.AriaSelected(isSelected),
|
|
959
|
+
h.AriaControls(`${model.id}-${pane.id}`),
|
|
960
|
+
h.Tabindex(isSelected ? 0 : -1),
|
|
961
|
+
h.DataAttribute("reel-tab", tabHook(model, pane.id)),
|
|
962
|
+
h.OnClick(Message.PressedTab({ paneId: pane.id })),
|
|
963
|
+
h.OnKeyDownPreventDefault((key, modifiers) => __foldkitBrandViewResult((isPlain(modifiers) ? keyOf(index, key) : Option.none()), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~129"))
|
|
964
|
+
], [...toTabLeadView(pane), h.span([h.Class("reel-tab-words")], [pane.label])])), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~128");
|
|
965
|
+
}))), "@gjermundgaraba/pixel-paper/reel/reel.js#tabListView");
|
|
966
|
+
};
|
|
967
|
+
const NO_TAB_LEAD = () => __foldkitBrandViewResult(([]), "@gjermundgaraba/pixel-paper/reel/reel.js#NO_TAB_LEAD");
|
|
968
|
+
const previewed = (model, layout) => __foldkitBrandViewResult((Option.match(Option.flatMap(model.maybeResizing, ({ maybeResize }) => __foldkitBrandViewResult((maybeResize), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~130")), {
|
|
969
|
+
onNone: () => __foldkitBrandViewResult((layout), "@gjermundgaraba/pixel-paper/reel/reel.js#onNone~23"),
|
|
970
|
+
onSome: (resize) => __foldkitBrandViewResult((apply(layout, resize)), "@gjermundgaraba/pixel-paper/reel/reel.js#onSome~21")
|
|
971
|
+
})), "@gjermundgaraba/pixel-paper/reel/reel.js#previewed");
|
|
972
|
+
/**
|
|
973
|
+
* A row of columns wider than the view when it must be, each a stack of panes, scrolled
|
|
974
|
+
* sideways, and down where a column is taller than the view: `div.reel` holding the scroller
|
|
975
|
+
* `div.reel-view`, whose `div.reel-track` lays out the columns (`div.reel-column`, a slot per
|
|
976
|
+
* pane with a splitter between) with a splitter after each, and the panes themselves in
|
|
977
|
+
* `div.reel-panes`, each pinned to its slot by anchor positioning. The reel takes its height
|
|
978
|
+
* from whatever holds it. The layout is the parent's; each pane renders through `toPaneView`.
|
|
979
|
+
*
|
|
980
|
+
* A pane's grip lifts it under a pointer or the keyboard: Space or Enter picks it up, the
|
|
981
|
+
* arrows move it (left and right through the gaps and columns, up and down among a column's
|
|
982
|
+
* panes), Space drops it, and Escape or Tab puts it back. A drop reports what it asks
|
|
983
|
+
* of the layout as the OutMessage. Lift `subscriptions(keyPrefix)` into the application's, or
|
|
984
|
+
* nothing follows the pointer, and call `reconcile` whenever the layout changes.
|
|
985
|
+
*
|
|
986
|
+
* Under tabs (`arrangement: "Tabs"`) the reel is `div.reel.tabbed`: a `div.nav.tabs.reel-tabs`
|
|
987
|
+
* tab list over the scroller, whose track holds one `div.reel-slot.reel-stage` at the reel's
|
|
988
|
+
* full size where the columns were. Every pane is pinned to it, the focused one shown and the
|
|
989
|
+
* others `.behind`, hidden and inert; there are no grips and no splitters.
|
|
990
|
+
*/
|
|
991
|
+
const view = defineView((model, viewInputs, h) => {
|
|
992
|
+
const { label, toPaneView, arrangement = "Strip", toTabLeadView = NO_TAB_LEAD } = viewInputs;
|
|
993
|
+
const isTabbed = arrangement === "Tabs";
|
|
994
|
+
const layout = previewed(model, viewInputs.layout);
|
|
995
|
+
const panesInDomOrder = stableDomOrder(layout);
|
|
996
|
+
const anchors = new Map(Array.map(panesInDomOrder, (pane, index) => __foldkitBrandViewResult(([pane.id, isTabbed ? STAGE_ANCHOR : anchorName(index)]), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~132")));
|
|
997
|
+
const info = {
|
|
998
|
+
model,
|
|
999
|
+
layout,
|
|
1000
|
+
isTabbed,
|
|
1001
|
+
toPaneView,
|
|
1002
|
+
maybeFocusedId: focusedPaneId(model, layout),
|
|
1003
|
+
maybeMark: markOf(model, layout),
|
|
1004
|
+
maybeCarriedId: carriedIdOf(model)
|
|
1005
|
+
};
|
|
1006
|
+
const strip = () => __foldkitBrandViewResult(([h.keyed("div")("gap:start", [h.Class(`reel-gap${isGapMarked(info, Option.map(Array.head(layout), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~133"))) ? " drop-here" : ""}`)]), ...Array.flatMap(layout, (column, index) => __foldkitBrandViewResult((columnView(info, anchors, column, index, h)), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~134"))]), "@gjermundgaraba/pixel-paper/reel/reel.js#strip");
|
|
1007
|
+
return __foldkitBrandViewResult((h.div([
|
|
1008
|
+
h.Class(isTabbed ? "reel tabbed" : "reel"),
|
|
1009
|
+
h.Role("group"),
|
|
1010
|
+
h.AriaLabel(label),
|
|
1011
|
+
h.DataAttribute("reel", model.id)
|
|
1012
|
+
], [
|
|
1013
|
+
...isTabbed ? [tabListView(info, label, toTabLeadView, h)] : [],
|
|
1014
|
+
h.div([h.Class("reel-view")], [h.div([h.Class("reel-track")], [...isTabbed ? [h.div([h.Class("reel-slot reel-stage"), h.Style({ "--reel-anchor": STAGE_ANCHOR })])] : strip(), paneLayerView(info, panesInDomOrder, anchors, h)])]),
|
|
1015
|
+
h.p([h.Id(helpId(model)), h.Class("sr-only")], [COPY.gripHelp]),
|
|
1016
|
+
...liftedCopyView(info, h)
|
|
1017
|
+
])), "@gjermundgaraba/pixel-paper/reel/reel.js#anonymous~131");
|
|
1018
|
+
});
|
|
1019
|
+
export { Action, AnnounceReel, Arrangement, FocusPane, FocusTab, Message, Model, RestoreFocus, ScrollIntoView, SizeLiftedPane, focusedPaneId, init, perform, reconcile, subscriptions, update, view };
|