@gjermundgaraba/pixel-paper 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,378 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { LOCALE } from "../locale/locale.js";
|
|
3
|
+
import { Array, Equal, Match, Number, Option, Predicate, Record, Schema, pipe } from "effect";
|
|
4
|
+
import { defineMessageUnion } from "foldkit/message";
|
|
5
|
+
import { defineTaggedUnion } from "foldkit/schema";
|
|
6
|
+
// src/reel/layout.ts
|
|
7
|
+
/** Schema for one pane as the reel knows it: its id, unique in the reel and the application's
|
|
8
|
+
* to keep, its name in words (its grip, its splitter and what screen readers hear), and its
|
|
9
|
+
* share of its column's height, a weight against its neighbours'. */
|
|
10
|
+
const Pane = Schema.Struct({
|
|
11
|
+
id: Schema.String,
|
|
12
|
+
label: Schema.String,
|
|
13
|
+
weight: Schema.Finite
|
|
14
|
+
});
|
|
15
|
+
const Column = Schema.Struct({
|
|
16
|
+
id: Schema.String,
|
|
17
|
+
width: Schema.Finite,
|
|
18
|
+
panes: Schema.NonEmptyArray(Pane)
|
|
19
|
+
});
|
|
20
|
+
/** Schema for a reel's layout: its columns, left to right. The application's to keep. */
|
|
21
|
+
const Layout = Schema.Array(Column);
|
|
22
|
+
const Subject = defineTaggedUnion({
|
|
23
|
+
Pane: { paneId: Schema.String },
|
|
24
|
+
Column: { columnId: Schema.String }
|
|
25
|
+
});
|
|
26
|
+
const Target = defineTaggedUnion({
|
|
27
|
+
Into: {
|
|
28
|
+
columnId: Schema.String,
|
|
29
|
+
index: Schema.Finite
|
|
30
|
+
},
|
|
31
|
+
Gap: { maybeBeforeColumnId: Schema.Option(Schema.String) }
|
|
32
|
+
});
|
|
33
|
+
/** Union of what a reel asks the application to do to its layout, which the application
|
|
34
|
+
* applies (`apply` does it) or not, by id, so a request still means what it meant after the
|
|
35
|
+
* layout changed under it. `MovedPane`: a pane into a column, at `toIndex` among that
|
|
36
|
+
* column's other panes. `PulledOutPane`: a pane into a column of its own, before a column
|
|
37
|
+
* (none: after the last). `MovedColumn`: a column to before another (none: last).
|
|
38
|
+
* `ResizedColumn`: a column's width. `ResizedPanes`: a column's panes' weights, by pane id. */
|
|
39
|
+
const OutMessage = defineMessageUnion({
|
|
40
|
+
MovedPane: {
|
|
41
|
+
paneId: Schema.String,
|
|
42
|
+
toColumnId: Schema.String,
|
|
43
|
+
toIndex: Schema.Finite
|
|
44
|
+
},
|
|
45
|
+
PulledOutPane: {
|
|
46
|
+
paneId: Schema.String,
|
|
47
|
+
maybeBeforeColumnId: Schema.Option(Schema.String)
|
|
48
|
+
},
|
|
49
|
+
MovedColumn: {
|
|
50
|
+
columnId: Schema.String,
|
|
51
|
+
maybeBeforeColumnId: Schema.Option(Schema.String)
|
|
52
|
+
},
|
|
53
|
+
ResizedColumn: {
|
|
54
|
+
columnId: Schema.String,
|
|
55
|
+
width: Schema.Finite
|
|
56
|
+
},
|
|
57
|
+
ResizedPanes: {
|
|
58
|
+
columnId: Schema.String,
|
|
59
|
+
weights: Schema.Record(Schema.String, Schema.Finite)
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const Splitter = defineTaggedUnion({
|
|
63
|
+
Width: { columnId: Schema.String },
|
|
64
|
+
Split: { abovePaneId: Schema.String }
|
|
65
|
+
});
|
|
66
|
+
const Resize = Schema.Union([OutMessage.ResizedColumn, OutMessage.ResizedPanes]);
|
|
67
|
+
const placesOf = (layout) => __foldkitBrandViewResult((Array.flatMap(layout, (column, columnIndex) => __foldkitBrandViewResult((Array.map(column.panes, (pane, row) => (__foldkitBrandViewResult(({
|
|
68
|
+
column,
|
|
69
|
+
columnIndex,
|
|
70
|
+
row,
|
|
71
|
+
pane
|
|
72
|
+
}), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~2")))), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous"))), "@gjermundgaraba/pixel-paper/reel/layout.js#placesOf");
|
|
73
|
+
const placeOf = (layout, paneId) => __foldkitBrandViewResult((Array.findFirst(placesOf(layout), (place) => __foldkitBrandViewResult((place.pane.id === paneId), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~3"))), "@gjermundgaraba/pixel-paper/reel/layout.js#placeOf");
|
|
74
|
+
const placeAt = (layout, columnIndex, row) => __foldkitBrandViewResult((Option.flatMap(Array.get(layout, columnIndex), (column) => __foldkitBrandViewResult((Option.map(Array.get(column.panes, row), (pane) => (__foldkitBrandViewResult(({
|
|
75
|
+
column,
|
|
76
|
+
columnIndex,
|
|
77
|
+
row,
|
|
78
|
+
pane
|
|
79
|
+
}), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~5")))), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~4"))), "@gjermundgaraba/pixel-paper/reel/layout.js#placeAt");
|
|
80
|
+
const firstPlace = (layout) => __foldkitBrandViewResult((placeAt(layout, 0, 0)), "@gjermundgaraba/pixel-paper/reel/layout.js#firstPlace");
|
|
81
|
+
const columnIndexOf = (layout, columnId) => __foldkitBrandViewResult((Array.findFirstIndex(layout, (column) => __foldkitBrandViewResult((column.id === columnId), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~6"))), "@gjermundgaraba/pixel-paper/reel/layout.js#columnIndexOf");
|
|
82
|
+
const columnOf = (layout, columnId) => __foldkitBrandViewResult((Array.findFirst(layout, (column) => __foldkitBrandViewResult((column.id === columnId), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~7"))), "@gjermundgaraba/pixel-paper/reel/layout.js#columnOf");
|
|
83
|
+
const nextColumnId = (layout, columnIndex) => __foldkitBrandViewResult((Option.map(Array.get(layout, columnIndex + 1), (column) => __foldkitBrandViewResult((column.id), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~8"))), "@gjermundgaraba/pixel-paper/reel/layout.js#nextColumnId");
|
|
84
|
+
const meanWeight = (panes) => __foldkitBrandViewResult((Array.match(panes, {
|
|
85
|
+
onEmpty: () => __foldkitBrandViewResult((1), "@gjermundgaraba/pixel-paper/reel/layout.js#onEmpty"),
|
|
86
|
+
onNonEmpty: (some) => __foldkitBrandViewResult((Array.reduce(some, 0, (mean, pane, index) => __foldkitBrandViewResult((mean + (pane.weight - mean) / (index + 1)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~9"))), "@gjermundgaraba/pixel-paper/reel/layout.js#onNonEmpty")
|
|
87
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#meanWeight");
|
|
88
|
+
const othersIn = (column, paneId) => __foldkitBrandViewResult((Array.filter(column.panes, (pane) => __foldkitBrandViewResult((pane.id !== paneId), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~10"))), "@gjermundgaraba/pixel-paper/reel/layout.js#othersIn");
|
|
89
|
+
const insertAt = (items, index, item) => {
|
|
90
|
+
const [before, after] = Array.splitAt(items, Number.clamp(index, {
|
|
91
|
+
minimum: 0,
|
|
92
|
+
maximum: items.length
|
|
93
|
+
}));
|
|
94
|
+
return __foldkitBrandViewResult((Array.appendAll(Array.append(before, item), after)), "@gjermundgaraba/pixel-paper/reel/layout.js#insertAt");
|
|
95
|
+
};
|
|
96
|
+
const without = (layout, paneId) => __foldkitBrandViewResult((Array.flatMap(layout, (column) => {
|
|
97
|
+
const others = othersIn(column, paneId);
|
|
98
|
+
return __foldkitBrandViewResult((Array.isReadonlyArrayNonEmpty(others) ? [{
|
|
99
|
+
...column,
|
|
100
|
+
panes: others
|
|
101
|
+
}] : []), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~11");
|
|
102
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#without");
|
|
103
|
+
const gapIndex = (layout, maybeBeforeColumnId) => __foldkitBrandViewResult((Option.match(maybeBeforeColumnId, {
|
|
104
|
+
onNone: () => __foldkitBrandViewResult((Option.some(layout.length)), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone"),
|
|
105
|
+
onSome: (columnId) => __foldkitBrandViewResult((columnIndexOf(layout, columnId)), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome")
|
|
106
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#gapIndex");
|
|
107
|
+
const freshColumnId = (layout, paneId, suffix = 1) => {
|
|
108
|
+
const candidate = suffix === 1 ? paneId : `${paneId}/${suffix}`;
|
|
109
|
+
return __foldkitBrandViewResult((Array.some(layout, (column) => __foldkitBrandViewResult((column.id === candidate), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~12")) ? freshColumnId(layout, paneId, suffix + 1) : candidate), "@gjermundgaraba/pixel-paper/reel/layout.js#freshColumnId");
|
|
110
|
+
};
|
|
111
|
+
const movePane = (layout, paneId, toColumnId, toIndex) => __foldkitBrandViewResult((Option.match(Option.all({
|
|
112
|
+
from: placeOf(layout, paneId),
|
|
113
|
+
to: columnOf(layout, toColumnId)
|
|
114
|
+
}), {
|
|
115
|
+
onNone: () => __foldkitBrandViewResult((layout), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~2"),
|
|
116
|
+
onSome: ({ from, to }) => {
|
|
117
|
+
const others = othersIn(to, paneId);
|
|
118
|
+
const weight = to.id === from.column.id ? from.pane.weight : meanWeight(others);
|
|
119
|
+
const panes = insertAt(others, toIndex, {
|
|
120
|
+
...from.pane,
|
|
121
|
+
weight
|
|
122
|
+
});
|
|
123
|
+
return __foldkitBrandViewResult((Array.flatMap(layout, (column) => __foldkitBrandViewResult((column.id === toColumnId ? [{
|
|
124
|
+
...column,
|
|
125
|
+
panes
|
|
126
|
+
}] : without([column], paneId)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~13"))), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~2");
|
|
127
|
+
}
|
|
128
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#movePane");
|
|
129
|
+
const pullOutPane = (layout, paneId, maybeBeforeColumnId) => __foldkitBrandViewResult((Option.match(placeOf(layout, paneId), {
|
|
130
|
+
onNone: () => __foldkitBrandViewResult((layout), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~3"),
|
|
131
|
+
onSome: (from) => {
|
|
132
|
+
const isAlone = from.column.panes.length === 1;
|
|
133
|
+
const isWhereItIs = Equal.equals(maybeBeforeColumnId, Option.some(from.column.id)) || Equal.equals(maybeBeforeColumnId, nextColumnId(layout, from.columnIndex));
|
|
134
|
+
const rest = without(layout, paneId);
|
|
135
|
+
if (isAlone && isWhereItIs) return __foldkitBrandViewResult((layout), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~3");
|
|
136
|
+
return __foldkitBrandViewResult((Option.match(gapIndex(rest, maybeBeforeColumnId), {
|
|
137
|
+
onNone: () => __foldkitBrandViewResult((layout), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~4"),
|
|
138
|
+
onSome: (gap) => __foldkitBrandViewResult((insertAt(rest, gap, {
|
|
139
|
+
id: freshColumnId(rest, paneId),
|
|
140
|
+
width: from.column.width,
|
|
141
|
+
panes: [{
|
|
142
|
+
...from.pane,
|
|
143
|
+
weight: 1
|
|
144
|
+
}]
|
|
145
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~4")
|
|
146
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~3");
|
|
147
|
+
}
|
|
148
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#pullOutPane");
|
|
149
|
+
const moveColumn = (layout, columnId, maybeBeforeColumnId) => {
|
|
150
|
+
const rest = Array.filter(layout, (column) => __foldkitBrandViewResult((column.id !== columnId), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~14"));
|
|
151
|
+
return __foldkitBrandViewResult((Option.match(Option.all({
|
|
152
|
+
column: columnOf(layout, columnId),
|
|
153
|
+
gap: gapIndex(rest, maybeBeforeColumnId)
|
|
154
|
+
}), {
|
|
155
|
+
onNone: () => __foldkitBrandViewResult((layout), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~5"),
|
|
156
|
+
onSome: ({ column, gap }) => __foldkitBrandViewResult((insertAt(rest, gap, column)), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~5")
|
|
157
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#moveColumn");
|
|
158
|
+
};
|
|
159
|
+
const modifyColumn = (layout, columnId, f) => __foldkitBrandViewResult((Array.map(layout, (column) => __foldkitBrandViewResult((column.id === columnId ? f(column) : column), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~15"))), "@gjermundgaraba/pixel-paper/reel/layout.js#modifyColumn");
|
|
160
|
+
/**
|
|
161
|
+
* The layout once `request` is applied: what the reel asked, done the way every client does
|
|
162
|
+
* it. A pane that leaves its column takes the mean weight of the column it joins; a column
|
|
163
|
+
* left without panes goes; a pane pulled out keeps its old column's width, in a column named
|
|
164
|
+
* for it. A request naming a pane or column the layout no longer has changes nothing.
|
|
165
|
+
*/
|
|
166
|
+
const apply = (layout, request) => __foldkitBrandViewResult((OutMessage.match(request, {
|
|
167
|
+
MovedPane: ({ paneId, toColumnId, toIndex }) => __foldkitBrandViewResult((movePane(layout, paneId, toColumnId, toIndex)), "@gjermundgaraba/pixel-paper/reel/layout.js#MovedPane"),
|
|
168
|
+
PulledOutPane: ({ paneId, maybeBeforeColumnId }) => __foldkitBrandViewResult((pullOutPane(layout, paneId, maybeBeforeColumnId)), "@gjermundgaraba/pixel-paper/reel/layout.js#PulledOutPane"),
|
|
169
|
+
MovedColumn: ({ columnId, maybeBeforeColumnId }) => __foldkitBrandViewResult((moveColumn(layout, columnId, maybeBeforeColumnId)), "@gjermundgaraba/pixel-paper/reel/layout.js#MovedColumn"),
|
|
170
|
+
ResizedColumn: ({ columnId, width }) => __foldkitBrandViewResult((modifyColumn(layout, columnId, (column) => (__foldkitBrandViewResult(({
|
|
171
|
+
...column,
|
|
172
|
+
width
|
|
173
|
+
}), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~16")))), "@gjermundgaraba/pixel-paper/reel/layout.js#ResizedColumn"),
|
|
174
|
+
ResizedPanes: ({ columnId, weights }) => __foldkitBrandViewResult((modifyColumn(layout, columnId, (column) => (__foldkitBrandViewResult(({
|
|
175
|
+
...column,
|
|
176
|
+
panes: Array.map(column.panes, (pane) => (__foldkitBrandViewResult(({
|
|
177
|
+
...pane,
|
|
178
|
+
weight: Option.getOrElse(Record.get(weights, pane.id), () => __foldkitBrandViewResult((pane.weight), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~19"))
|
|
179
|
+
}), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~18")))
|
|
180
|
+
}), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~17")))), "@gjermundgaraba/pixel-paper/reel/layout.js#ResizedPanes")
|
|
181
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#apply");
|
|
182
|
+
const isChange = (layout, request) => __foldkitBrandViewResult((!Equal.equals(apply(layout, request), layout)), "@gjermundgaraba/pixel-paper/reel/layout.js#isChange");
|
|
183
|
+
const PRESET_TOLERANCE = .01;
|
|
184
|
+
const PRESETS = [
|
|
185
|
+
{
|
|
186
|
+
width: 1 / 3,
|
|
187
|
+
words: "a third of the width"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
width: 1 / 2,
|
|
191
|
+
words: "half the width"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
width: 2 / 3,
|
|
195
|
+
words: "two thirds of the width"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
width: 1,
|
|
199
|
+
words: "the full width"
|
|
200
|
+
}
|
|
201
|
+
];
|
|
202
|
+
const presetOf = (width) => __foldkitBrandViewResult((Array.findFirst(PRESETS, (preset) => __foldkitBrandViewResult((Math.abs(preset.width - width) < PRESET_TOLERANCE), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~20"))), "@gjermundgaraba/pixel-paper/reel/layout.js#presetOf");
|
|
203
|
+
const percent = (width) => __foldkitBrandViewResult((Math.round(width * 100).toLocaleString(LOCALE)), "@gjermundgaraba/pixel-paper/reel/layout.js#percent");
|
|
204
|
+
const widthWords = (width) => __foldkitBrandViewResult((Option.match(presetOf(width), {
|
|
205
|
+
onNone: () => __foldkitBrandViewResult((`${percent(width)}% of the width`), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~6"),
|
|
206
|
+
onSome: ({ words }) => __foldkitBrandViewResult((words), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~6")
|
|
207
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#widthWords");
|
|
208
|
+
const nextPreset = (width) => __foldkitBrandViewResult((Option.getOrElse(Array.findFirst(PRESETS, (preset) => __foldkitBrandViewResult((preset.width > width + PRESET_TOLERANCE), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~21")), () => __foldkitBrandViewResult((Array.headNonEmpty(PRESETS)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~22")).width), "@gjermundgaraba/pixel-paper/reel/layout.js#nextPreset");
|
|
209
|
+
const WORDS = {
|
|
210
|
+
columnSubject: "column with {pane}",
|
|
211
|
+
place: "column {column} of {columns}",
|
|
212
|
+
stackedPlace: "{row} of {rows} in column {column} of {columns}"
|
|
213
|
+
};
|
|
214
|
+
const WHERE_IT_WAS = "where it was";
|
|
215
|
+
const fill = (template, fields) => __foldkitBrandViewResult((Array.reduce(Object.entries(fields), template, (text, [key, value]) => __foldkitBrandViewResult((text.replaceAll(`{${key}}`, Predicate.isNumber(value) ? value.toLocaleString(LOCALE) : value)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~23"))), "@gjermundgaraba/pixel-paper/reel/layout.js#fill");
|
|
216
|
+
const subjectWords = (layout, subject) => __foldkitBrandViewResult((Subject.match(subject, {
|
|
217
|
+
Pane: ({ paneId }) => __foldkitBrandViewResult((Option.map(placeOf(layout, paneId), ({ pane }) => __foldkitBrandViewResult((pane.label), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~24"))), "@gjermundgaraba/pixel-paper/reel/layout.js#Pane"),
|
|
218
|
+
Column: ({ columnId }) => __foldkitBrandViewResult((Option.map(columnOf(layout, columnId), (column) => __foldkitBrandViewResult((fill(WORDS.columnSubject, { pane: Array.headNonEmpty(column.panes).label })), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~25"))), "@gjermundgaraba/pixel-paper/reel/layout.js#Column")
|
|
219
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#subjectWords");
|
|
220
|
+
const placeWords = (layout, place) => {
|
|
221
|
+
const rows = place.column.panes.length;
|
|
222
|
+
const fields = {
|
|
223
|
+
column: place.columnIndex + 1,
|
|
224
|
+
columns: layout.length,
|
|
225
|
+
row: place.row + 1,
|
|
226
|
+
rows
|
|
227
|
+
};
|
|
228
|
+
return __foldkitBrandViewResult((rows > 1 ? fill(WORDS.stackedPlace, fields) : fill(WORDS.place, fields)), "@gjermundgaraba/pixel-paper/reel/layout.js#placeWords");
|
|
229
|
+
};
|
|
230
|
+
const whereWords = (layout, subject) => __foldkitBrandViewResult((Subject.match(subject, {
|
|
231
|
+
Pane: ({ paneId }) => __foldkitBrandViewResult((Option.map(placeOf(layout, paneId), (place) => __foldkitBrandViewResult((placeWords(layout, place)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~26"))), "@gjermundgaraba/pixel-paper/reel/layout.js#Pane~2"),
|
|
232
|
+
Column: ({ columnId }) => __foldkitBrandViewResult((Option.map(columnIndexOf(layout, columnId), (column) => __foldkitBrandViewResult((fill(WORDS.place, {
|
|
233
|
+
column: column + 1,
|
|
234
|
+
columns: layout.length
|
|
235
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~27"))), "@gjermundgaraba/pixel-paper/reel/layout.js#Column~2")
|
|
236
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#whereWords");
|
|
237
|
+
const originOf = (layout, paneId) => __foldkitBrandViewResult((Option.map(placeOf(layout, paneId), ({ column, row }) => __foldkitBrandViewResult((Target.Into({
|
|
238
|
+
columnId: column.id,
|
|
239
|
+
index: row
|
|
240
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~28"))), "@gjermundgaraba/pixel-paper/reel/layout.js#originOf");
|
|
241
|
+
const requestOf = (layout, paneId, target) => __foldkitBrandViewResult((Option.liftPredicate(Target.match(target, {
|
|
242
|
+
Into: ({ columnId, index }) => __foldkitBrandViewResult((OutMessage.MovedPane({
|
|
243
|
+
paneId,
|
|
244
|
+
toColumnId: columnId,
|
|
245
|
+
toIndex: index
|
|
246
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#Into"),
|
|
247
|
+
Gap: ({ maybeBeforeColumnId }) => __foldkitBrandViewResult((OutMessage.PulledOutPane({
|
|
248
|
+
paneId,
|
|
249
|
+
maybeBeforeColumnId
|
|
250
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#Gap")
|
|
251
|
+
}), (request) => __foldkitBrandViewResult((isChange(layout, request)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~29"))), "@gjermundgaraba/pixel-paper/reel/layout.js#requestOf");
|
|
252
|
+
const landingWords = (layout, paneId, target) => __foldkitBrandViewResult((Option.match(requestOf(layout, paneId, target), {
|
|
253
|
+
onNone: () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~7"),
|
|
254
|
+
onSome: (request) => __foldkitBrandViewResult((Option.getOrElse(whereWords(apply(layout, request), Subject.Pane({ paneId })), () => __foldkitBrandViewResult((WHERE_IT_WAS), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~30"))), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~7")
|
|
255
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#landingWords");
|
|
256
|
+
const columnOfTarget = (layout, target) => __foldkitBrandViewResult((Target.match(target, {
|
|
257
|
+
Into: ({ columnId }) => __foldkitBrandViewResult((Option.some(columnId)), "@gjermundgaraba/pixel-paper/reel/layout.js#Into~2"),
|
|
258
|
+
Gap: ({ maybeBeforeColumnId }) => __foldkitBrandViewResult((Option.orElse(maybeBeforeColumnId, () => __foldkitBrandViewResult((Option.map(Array.last(layout), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~32"))), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~31"))), "@gjermundgaraba/pixel-paper/reel/layout.js#Gap~2")
|
|
259
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#columnOfTarget");
|
|
260
|
+
const Step = Schema.Literals([
|
|
261
|
+
"Up",
|
|
262
|
+
"Down",
|
|
263
|
+
"Left",
|
|
264
|
+
"Right"
|
|
265
|
+
]);
|
|
266
|
+
const stopOf = (layout, target) => __foldkitBrandViewResult((Target.match(target, {
|
|
267
|
+
Into: ({ columnId }) => __foldkitBrandViewResult((Option.map(columnIndexOf(layout, columnId), (column) => __foldkitBrandViewResult((column * 2 + 1), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~33"))), "@gjermundgaraba/pixel-paper/reel/layout.js#Into~3"),
|
|
268
|
+
Gap: ({ maybeBeforeColumnId }) => __foldkitBrandViewResult((Option.map(gapIndex(layout, maybeBeforeColumnId), (gap) => __foldkitBrandViewResult((gap * 2), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~34"))), "@gjermundgaraba/pixel-paper/reel/layout.js#Gap~3")
|
|
269
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#stopOf");
|
|
270
|
+
const isTargetPresent = (layout, target) => __foldkitBrandViewResult((Option.isSome(stopOf(layout, target))), "@gjermundgaraba/pixel-paper/reel/layout.js#isTargetPresent");
|
|
271
|
+
const roomIn = (column, paneId) => __foldkitBrandViewResult((othersIn(column, paneId).length), "@gjermundgaraba/pixel-paper/reel/layout.js#roomIn");
|
|
272
|
+
const targetAtStop = (layout, paneId, stop, row) => __foldkitBrandViewResult((stop % 2 === 0 ? Target.Gap({ maybeBeforeColumnId: Option.map(Array.get(layout, stop / 2), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~35")) }) : Option.match(Array.get(layout, (stop - 1) / 2), {
|
|
273
|
+
onNone: () => __foldkitBrandViewResult((Target.Gap({ maybeBeforeColumnId: Option.none() })), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~8"),
|
|
274
|
+
onSome: (column) => __foldkitBrandViewResult((Target.Into({
|
|
275
|
+
columnId: column.id,
|
|
276
|
+
index: Math.min(row, roomIn(column, paneId))
|
|
277
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~8")
|
|
278
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#targetAtStop");
|
|
279
|
+
const stepOnce = (layout, paneId, target, step) => {
|
|
280
|
+
const row = Target.match(target, {
|
|
281
|
+
Into: ({ index }) => __foldkitBrandViewResult((index), "@gjermundgaraba/pixel-paper/reel/layout.js#Into~4"),
|
|
282
|
+
Gap: () => __foldkitBrandViewResult((0), "@gjermundgaraba/pixel-paper/reel/layout.js#Gap~4")
|
|
283
|
+
});
|
|
284
|
+
return __foldkitBrandViewResult((Option.match(stopOf(layout, target), {
|
|
285
|
+
onNone: () => __foldkitBrandViewResult((target), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~9"),
|
|
286
|
+
onSome: (stop) => __foldkitBrandViewResult((Match.value(step).pipe(Match.withReturnType(), Match.when("Left", () => __foldkitBrandViewResult((targetAtStop(layout, paneId, Math.max(stop - 1, 0), row)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~36")), Match.when("Right", () => __foldkitBrandViewResult((targetAtStop(layout, paneId, Math.min(stop + 1, layout.length * 2), row)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~37")), Match.whenOr("Up", "Down", () => __foldkitBrandViewResult((Target.match(target, {
|
|
287
|
+
Gap: () => __foldkitBrandViewResult((target), "@gjermundgaraba/pixel-paper/reel/layout.js#Gap~5"),
|
|
288
|
+
Into: ({ columnId }) => __foldkitBrandViewResult((Option.match(columnOf(layout, columnId), {
|
|
289
|
+
onNone: () => __foldkitBrandViewResult((target), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~10"),
|
|
290
|
+
onSome: (column) => __foldkitBrandViewResult((Target.Into({
|
|
291
|
+
columnId,
|
|
292
|
+
index: Number.clamp(step === "Up" ? row - 1 : row + 1, {
|
|
293
|
+
minimum: 0,
|
|
294
|
+
maximum: roomIn(column, paneId)
|
|
295
|
+
})
|
|
296
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~10")
|
|
297
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#Into~5")
|
|
298
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~38")), Match.exhaustive)), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~9")
|
|
299
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#stepOnce");
|
|
300
|
+
};
|
|
301
|
+
const presentOrOrigin = (layout, target, origin) => __foldkitBrandViewResult((isTargetPresent(layout, target) ? target : Option.getOrElse(origin, () => __foldkitBrandViewResult((target), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~39"))), "@gjermundgaraba/pixel-paper/reel/layout.js#presentOrOrigin");
|
|
302
|
+
const isChangingDropOrOrigin = (layout, paneId, origin, candidate) => __foldkitBrandViewResult((Option.isSome(requestOf(layout, paneId, candidate)) || Option.exists(origin, (place) => __foldkitBrandViewResult((Equal.equals(place, candidate)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~40"))), "@gjermundgaraba/pixel-paper/reel/layout.js#isChangingDropOrOrigin");
|
|
303
|
+
const stopAndRowCount = (layout) => __foldkitBrandViewResult((layout.length * 2 + Array.length(placesOf(layout))), "@gjermundgaraba/pixel-paper/reel/layout.js#stopAndRowCount");
|
|
304
|
+
const steppedTarget = (layout, paneId, target, step) => {
|
|
305
|
+
const origin = originOf(layout, paneId);
|
|
306
|
+
const start = presentOrOrigin(layout, target, origin);
|
|
307
|
+
const walkPastUnchangingStops = (from, left) => {
|
|
308
|
+
const next = stepOnce(layout, paneId, from, step);
|
|
309
|
+
if (Equal.equals(next, from) || left === 0) return __foldkitBrandViewResult((start), "@gjermundgaraba/pixel-paper/reel/layout.js#walkPastUnchangingStops");
|
|
310
|
+
return __foldkitBrandViewResult((isChangingDropOrOrigin(layout, paneId, origin, next) ? next : walkPastUnchangingStops(next, left - 1)), "@gjermundgaraba/pixel-paper/reel/layout.js#walkPastUnchangingStops");
|
|
311
|
+
};
|
|
312
|
+
return __foldkitBrandViewResult((walkPastUnchangingStops(start, stopAndRowCount(layout))), "@gjermundgaraba/pixel-paper/reel/layout.js#steppedTarget");
|
|
313
|
+
};
|
|
314
|
+
const GAP_BAND_SHARE = .2;
|
|
315
|
+
const GAP_BAND_MAX = 48;
|
|
316
|
+
const gapBefore = (columns, gap) => __foldkitBrandViewResult((Target.Gap({ maybeBeforeColumnId: Option.map(Array.get(columns, gap), ({ id }) => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~41")) })), "@gjermundgaraba/pixel-paper/reel/layout.js#gapBefore");
|
|
317
|
+
const gapBandOf = ({ left, right }) => __foldkitBrandViewResult((Math.min((right - left) * GAP_BAND_SHARE, GAP_BAND_MAX)), "@gjermundgaraba/pixel-paper/reel/layout.js#gapBandOf");
|
|
318
|
+
const columnUnderOrRightOf = (columns, clientX) => __foldkitBrandViewResult((pipe(Array.findFirstIndex(columns, ({ right }) => __foldkitBrandViewResult((clientX <= right), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~42")), Option.flatMap((index) => __foldkitBrandViewResult((Option.map(Array.get(columns, index), (box) => (__foldkitBrandViewResult(({
|
|
319
|
+
index,
|
|
320
|
+
box
|
|
321
|
+
}), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~44")))), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~43")))), "@gjermundgaraba/pixel-paper/reel/layout.js#columnUnderOrRightOf");
|
|
322
|
+
const slotsAbove = (slotMiddles, clientY) => __foldkitBrandViewResult((Array.filter(slotMiddles, (middle) => __foldkitBrandViewResult((middle < clientY), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~45")).length), "@gjermundgaraba/pixel-paper/reel/layout.js#slotsAbove");
|
|
323
|
+
const targetAtPoint = (columns, clientX, clientY, slotMiddlesOf) => __foldkitBrandViewResult((Option.match(columnUnderOrRightOf(columns, clientX), {
|
|
324
|
+
onNone: () => __foldkitBrandViewResult((gapBefore(columns, columns.length)), "@gjermundgaraba/pixel-paper/reel/layout.js#onNone~11"),
|
|
325
|
+
onSome: ({ index, box }) => {
|
|
326
|
+
const band = gapBandOf(box);
|
|
327
|
+
if (clientX < box.left + band) return __foldkitBrandViewResult((gapBefore(columns, index)), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~11");
|
|
328
|
+
else if (clientX > box.right - band) return __foldkitBrandViewResult((gapBefore(columns, index + 1)), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~11");
|
|
329
|
+
return __foldkitBrandViewResult((Target.Into({
|
|
330
|
+
columnId: box.id,
|
|
331
|
+
index: slotsAbove(slotMiddlesOf(index), clientY)
|
|
332
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#onSome~11");
|
|
333
|
+
}
|
|
334
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#targetAtPoint");
|
|
335
|
+
const COLUMN_WIDTH_FLOOR = .1;
|
|
336
|
+
const PANE_SHARE_FLOOR = .05;
|
|
337
|
+
const PRECISION = 1e4;
|
|
338
|
+
const rounded = (value) => __foldkitBrandViewResult((Math.round(value * PRECISION) / PRECISION), "@gjermundgaraba/pixel-paper/reel/layout.js#rounded");
|
|
339
|
+
const precisionFinerThan = (floor) => __foldkitBrandViewResult((Math.max(PRECISION, 10 ** Math.ceil(-Math.log10(floor)))), "@gjermundgaraba/pixel-paper/reel/layout.js#precisionFinerThan");
|
|
340
|
+
const roundedOver = (weight, floor) => {
|
|
341
|
+
const precision = precisionFinerThan(floor);
|
|
342
|
+
const scaled = weight * precision;
|
|
343
|
+
return __foldkitBrandViewResult((globalThis.Number.isFinite(scaled) ? Math.round(scaled) / precision : weight), "@gjermundgaraba/pixel-paper/reel/layout.js#roundedOver");
|
|
344
|
+
};
|
|
345
|
+
const resizedColumn = (layout, columnId, share) => __foldkitBrandViewResult((Option.map(columnOf(layout, columnId), (column) => __foldkitBrandViewResult((OutMessage.ResizedColumn({
|
|
346
|
+
columnId,
|
|
347
|
+
width: rounded(Number.clamp(column.width + share, {
|
|
348
|
+
minimum: COLUMN_WIDTH_FLOOR,
|
|
349
|
+
maximum: 1
|
|
350
|
+
}))
|
|
351
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~46"))), "@gjermundgaraba/pixel-paper/reel/layout.js#resizedColumn");
|
|
352
|
+
const paneWeightFloor = (total, pair) => __foldkitBrandViewResult((Math.max(Math.min(total * PANE_SHARE_FLOOR, pair / 2), globalThis.Number.MIN_VALUE)), "@gjermundgaraba/pixel-paper/reel/layout.js#paneWeightFloor");
|
|
353
|
+
const sharedPair = (column, above, below, share) => {
|
|
354
|
+
const total = Number.sumAll(Array.map(column.panes, ({ weight }) => __foldkitBrandViewResult((weight), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~47")));
|
|
355
|
+
const pair = above.weight + below.weight;
|
|
356
|
+
const floor = paneWeightFloor(total, pair);
|
|
357
|
+
const nextAbove = Number.clamp(above.weight + share * total, {
|
|
358
|
+
minimum: floor,
|
|
359
|
+
maximum: pair - floor
|
|
360
|
+
});
|
|
361
|
+
const isShareMovable = globalThis.Number.isFinite(total);
|
|
362
|
+
return __foldkitBrandViewResult((OutMessage.ResizedPanes({
|
|
363
|
+
columnId: column.id,
|
|
364
|
+
weights: isShareMovable ? {
|
|
365
|
+
[above.id]: roundedOver(nextAbove, floor),
|
|
366
|
+
[below.id]: roundedOver(pair - nextAbove, floor)
|
|
367
|
+
} : {
|
|
368
|
+
[above.id]: above.weight,
|
|
369
|
+
[below.id]: below.weight
|
|
370
|
+
}
|
|
371
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#sharedPair");
|
|
372
|
+
};
|
|
373
|
+
const resizeOf = (layout, splitter, share) => __foldkitBrandViewResult((Splitter.match(splitter, {
|
|
374
|
+
Width: ({ columnId }) => __foldkitBrandViewResult((resizedColumn(layout, columnId, share)), "@gjermundgaraba/pixel-paper/reel/layout.js#Width"),
|
|
375
|
+
Split: ({ abovePaneId }) => __foldkitBrandViewResult((Option.flatMap(placeOf(layout, abovePaneId), ({ column, row, pane: above }) => __foldkitBrandViewResult((Option.map(Array.get(column.panes, row + 1), (below) => __foldkitBrandViewResult((sharedPair(column, above, below, share)), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~49"))), "@gjermundgaraba/pixel-paper/reel/layout.js#anonymous~48"))), "@gjermundgaraba/pixel-paper/reel/layout.js#Split")
|
|
376
|
+
})), "@gjermundgaraba/pixel-paper/reel/layout.js#resizeOf");
|
|
377
|
+
const isSplitterPresent = (layout, splitter) => __foldkitBrandViewResult((Option.isSome(resizeOf(layout, splitter, 0))), "@gjermundgaraba/pixel-paper/reel/layout.js#isSplitterPresent");
|
|
378
|
+
export { Column, Layout, OutMessage, Pane, 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 };
|