@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,355 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { view as view$1 } from "../button/button.js";
|
|
3
|
+
import { escapeKeys, markDragging, pointerMessages, splitterAttributes } from "../drag/drag.js";
|
|
4
|
+
import { view as view$2 } from "../icon-button/icon-button.js";
|
|
5
|
+
import { prefixKeys } from "../subscription/prefix-keys.js";
|
|
6
|
+
import { htmlElement } from "../dom/html-element.js";
|
|
7
|
+
import { Array, Effect, Number, Option, Schema, Stream } from "effect";
|
|
8
|
+
import * as Command from "foldkit/command";
|
|
9
|
+
import { defineMessageUnion } from "foldkit/message";
|
|
10
|
+
import * as Render from "foldkit/render";
|
|
11
|
+
import * as Mount from "foldkit/mount";
|
|
12
|
+
import { modifyFields } from "foldkit/struct";
|
|
13
|
+
import { defineView } from "foldkit/submodel";
|
|
14
|
+
import * as Subscription from "foldkit/subscription";
|
|
15
|
+
import * as Dom from "foldkit/dom";
|
|
16
|
+
// src/rail/rail.ts
|
|
17
|
+
const Resizing = Schema.Struct({
|
|
18
|
+
pointerId: Schema.Finite,
|
|
19
|
+
pressX: Schema.Finite,
|
|
20
|
+
fromWidth: Schema.Finite,
|
|
21
|
+
width: Schema.Finite
|
|
22
|
+
});
|
|
23
|
+
/** Schema for a rail: whether it is open as a drawer (at 900px and under; wider, it is always
|
|
24
|
+
* in the page and this stays false), and its splitter while a pointer drags it. Its width,
|
|
25
|
+
* and whether the reader hid it, are the parent's. */
|
|
26
|
+
const Model = Schema.Struct({
|
|
27
|
+
id: Schema.String,
|
|
28
|
+
isOpen: Schema.Boolean,
|
|
29
|
+
maybeResizing: Schema.Option(Resizing)
|
|
30
|
+
});
|
|
31
|
+
/** Union of all Messages a rail can produce. `ClosedDrawer` is the browser closing it on
|
|
32
|
+
* Escape or a press on the veil; `BlurredDrawer` is focus leaving it; `WidenedPastDrawer` is
|
|
33
|
+
* the window growing past 900px while it is open, where the rail is back in the page. */
|
|
34
|
+
const Message = defineMessageUnion({
|
|
35
|
+
ClickedOpen: {},
|
|
36
|
+
ClickedToggle: {},
|
|
37
|
+
PressedSplitter: {
|
|
38
|
+
pointerId: Schema.Finite,
|
|
39
|
+
clientX: Schema.Finite,
|
|
40
|
+
width: Schema.Finite
|
|
41
|
+
},
|
|
42
|
+
MovedSplitter: { clientX: Schema.Finite },
|
|
43
|
+
ReleasedSplitter: { clientX: Schema.Finite },
|
|
44
|
+
CancelledSplitter: {},
|
|
45
|
+
PressedEscape: {},
|
|
46
|
+
PressedSplitterKey: { width: Schema.Finite },
|
|
47
|
+
ClickedClose: {},
|
|
48
|
+
ClosedDrawer: {},
|
|
49
|
+
BlurredDrawer: {},
|
|
50
|
+
WidenedPastDrawer: {},
|
|
51
|
+
CompletedShowRailDrawer: {},
|
|
52
|
+
CompletedHideRailDrawer: {},
|
|
53
|
+
CompletedFocusRailToggle: {}
|
|
54
|
+
});
|
|
55
|
+
/** What a rail asks of its parent. `ResizedRail`: its splitter was let go, or stepped by a
|
|
56
|
+
* key, at `width` pixels, within the rail's bounds; the parent keeps it (per client) and
|
|
57
|
+
* passes it back as the view's `maybeWidth`. `ToggledRail`: its toggle was pressed; the
|
|
58
|
+
* parent flips whether it keeps the rail hidden (per client) and passes it back as the view's
|
|
59
|
+
* `isHidden`. */
|
|
60
|
+
const OutMessage = defineMessageUnion({
|
|
61
|
+
ResizedRail: { width: Schema.Finite },
|
|
62
|
+
ToggledRail: {}
|
|
63
|
+
});
|
|
64
|
+
/** Creates a rail, closed, its splitter at rest. */
|
|
65
|
+
const init = (config) => (__foldkitBrandViewResult(({
|
|
66
|
+
id: config.id,
|
|
67
|
+
isOpen: false,
|
|
68
|
+
maybeResizing: Option.none()
|
|
69
|
+
}), "@gjermundgaraba/pixel-paper/rail/rail.js#init"));
|
|
70
|
+
const WIDEST_DRAWER_WINDOW = 900;
|
|
71
|
+
const WIDTH = {
|
|
72
|
+
start: 272,
|
|
73
|
+
leastFittingPanels: 220,
|
|
74
|
+
mostLeavingLeastDeck: 480,
|
|
75
|
+
arrowStep: 16
|
|
76
|
+
};
|
|
77
|
+
const bounded = (width) => __foldkitBrandViewResult((Math.round(Number.clamp(width, {
|
|
78
|
+
minimum: WIDTH.leastFittingPanels,
|
|
79
|
+
maximum: WIDTH.mostLeavingLeastDeck
|
|
80
|
+
}))), "@gjermundgaraba/pixel-paper/rail/rail.js#bounded");
|
|
81
|
+
/** The rail's id, unique in the document. */
|
|
82
|
+
const id = (model) => __foldkitBrandViewResult((model.id), "@gjermundgaraba/pixel-paper/rail/rail.js#id");
|
|
83
|
+
/** Whether the rail is open as a drawer: a parent pauses its own page keys while it is. */
|
|
84
|
+
const isOpen = (model) => __foldkitBrandViewResult((model.isOpen), "@gjermundgaraba/pixel-paper/rail/rail.js#isOpen");
|
|
85
|
+
const openButtonId = (model) => __foldkitBrandViewResult((`${model.id}-open`), "@gjermundgaraba/pixel-paper/rail/rail.js#openButtonId");
|
|
86
|
+
const toggleId = (model) => __foldkitBrandViewResult((`${model.id}-toggle`), "@gjermundgaraba/pixel-paper/rail/rail.js#toggleId");
|
|
87
|
+
const FOCUSABLE = "a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]";
|
|
88
|
+
const findRail = (railId) => __foldkitBrandViewResult((Effect.suspend(() => __foldkitBrandViewResult((Effect.fromOption(htmlElement(`#${CSS.escape(railId)}`))), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous"))), "@gjermundgaraba/pixel-paper/rail/rail.js#findRail");
|
|
89
|
+
const firstTabStop = (rail) => __foldkitBrandViewResult((Array.findFirst(Array.fromIterable(rail.querySelectorAll(`.rail-head ~ * :is(${FOCUSABLE})`)), (control) => __foldkitBrandViewResult((control.tabIndex >= 0 && control.closest("[inert], [hidden], .rail-toggle") === null), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~2"))), "@gjermundgaraba/pixel-paper/rail/rail.js#firstTabStop");
|
|
90
|
+
/** Opens the rail as a drawer over the page and puts focus on its first control past its
|
|
91
|
+
* head. */
|
|
92
|
+
const ShowRailDrawer = Command.define("ShowRailDrawer", {
|
|
93
|
+
args: { railId: Schema.String },
|
|
94
|
+
messages: [Message.CompletedShowRailDrawer],
|
|
95
|
+
execute: ({ railId }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
96
|
+
yield* Render.afterCommit;
|
|
97
|
+
const rail = yield* findRail(railId);
|
|
98
|
+
if (!rail.matches(":popover-open")) yield* Effect.try(() => {
|
|
99
|
+
rail.showPopover();
|
|
100
|
+
});
|
|
101
|
+
(yield* Effect.fromOption(firstTabStop(rail))).focus();
|
|
102
|
+
}).pipe(Effect.ignore, Effect.as(Message.CompletedShowRailDrawer()))), "@gjermundgaraba/pixel-paper/rail/rail.js#execute")
|
|
103
|
+
});
|
|
104
|
+
/** Closes the drawer, and puts focus back on the button that opened it when asked. */
|
|
105
|
+
const HideRailDrawer = Command.define("HideRailDrawer", {
|
|
106
|
+
args: {
|
|
107
|
+
railId: Schema.String,
|
|
108
|
+
buttonId: Schema.String,
|
|
109
|
+
isReturningFocus: Schema.Boolean
|
|
110
|
+
},
|
|
111
|
+
messages: [Message.CompletedHideRailDrawer],
|
|
112
|
+
execute: ({ railId, buttonId, isReturningFocus }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
113
|
+
yield* Render.afterCommit;
|
|
114
|
+
const rail = yield* findRail(railId);
|
|
115
|
+
if (rail.matches(":popover-open")) yield* Effect.try(() => {
|
|
116
|
+
rail.hidePopover();
|
|
117
|
+
});
|
|
118
|
+
}).pipe(Effect.ignore, Effect.andThen(isReturningFocus ? Dom.focus(`#${CSS.escape(buttonId)}`).pipe(Effect.ignore) : Effect.void), Effect.as(Message.CompletedHideRailDrawer()))), "@gjermundgaraba/pixel-paper/rail/rail.js#execute~2")
|
|
119
|
+
});
|
|
120
|
+
/** Puts focus on the rail's toggle once the rail has folded or unfolded, if focus was in the
|
|
121
|
+
* rail or on its splitter: folding takes away every control in it but the toggle, which
|
|
122
|
+
* brings it back, and the splitter with them. Focus anywhere else stays where it is. */
|
|
123
|
+
const FocusRailToggle = Command.define("FocusRailToggle", {
|
|
124
|
+
args: {
|
|
125
|
+
railId: Schema.String,
|
|
126
|
+
toggleId: Schema.String
|
|
127
|
+
},
|
|
128
|
+
messages: [Message.CompletedFocusRailToggle],
|
|
129
|
+
execute: ({ railId, toggleId: buttonId }) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
130
|
+
const rail = yield* findRail(railId);
|
|
131
|
+
const active = document.activeElement;
|
|
132
|
+
const isOnSplitter = active?.matches(`.rail-resize[aria-controls="${CSS.escape(railId)}"]`) ?? false;
|
|
133
|
+
if (rail.contains(active) || isOnSplitter) yield* Dom.focus(`#${CSS.escape(buttonId)}`);
|
|
134
|
+
}).pipe(Effect.ignore, Effect.as(Message.CompletedFocusRailToggle()))), "@gjermundgaraba/pixel-paper/rail/rail.js#execute~3")
|
|
135
|
+
});
|
|
136
|
+
const closeDrawer = (model, isReturningFocus) => __foldkitBrandViewResult((model.isOpen ? {
|
|
137
|
+
model: modifyFields(model, { isOpen: () => __foldkitBrandViewResult((false), "@gjermundgaraba/pixel-paper/rail/rail.js#isOpen~2") }),
|
|
138
|
+
commands: [HideRailDrawer({
|
|
139
|
+
railId: model.id,
|
|
140
|
+
buttonId: openButtonId(model),
|
|
141
|
+
isReturningFocus
|
|
142
|
+
})]
|
|
143
|
+
} : { model }), "@gjermundgaraba/pixel-paper/rail/rail.js#closeDrawer");
|
|
144
|
+
const open = (model) => (__foldkitBrandViewResult(({
|
|
145
|
+
model: modifyFields(model, { isOpen: () => __foldkitBrandViewResult((true), "@gjermundgaraba/pixel-paper/rail/rail.js#isOpen~3") }),
|
|
146
|
+
commands: [ShowRailDrawer({ railId: model.id })]
|
|
147
|
+
}), "@gjermundgaraba/pixel-paper/rail/rail.js#open"));
|
|
148
|
+
/** Closes the rail's drawer, focus back on its button. */
|
|
149
|
+
const close = (model) => __foldkitBrandViewResult((closeDrawer(model, true)), "@gjermundgaraba/pixel-paper/rail/rail.js#close");
|
|
150
|
+
/** Folds or unfolds the rail from a key of the parent's: the parent flips whether it keeps the
|
|
151
|
+
* rail hidden, as it does for `ToggledRail`, and folds this in, which moves focus in the rail
|
|
152
|
+
* onto the toggle. */
|
|
153
|
+
const toggle = (model) => (__foldkitBrandViewResult(({
|
|
154
|
+
model,
|
|
155
|
+
commands: [FocusRailToggle({
|
|
156
|
+
railId: model.id,
|
|
157
|
+
toggleId: toggleId(model)
|
|
158
|
+
})]
|
|
159
|
+
}), "@gjermundgaraba/pixel-paper/rail/rail.js#toggle"));
|
|
160
|
+
const withResizing = (model, maybeResizing) => __foldkitBrandViewResult((modifyFields(model, { maybeResizing: () => __foldkitBrandViewResult((maybeResizing), "@gjermundgaraba/pixel-paper/rail/rail.js#maybeResizing") })), "@gjermundgaraba/pixel-paper/rail/rail.js#withResizing");
|
|
161
|
+
const dragTo = (model, clientX) => __foldkitBrandViewResult((withResizing(model, Option.map(model.maybeResizing, (resizing) => (__foldkitBrandViewResult(({
|
|
162
|
+
...resizing,
|
|
163
|
+
width: bounded(resizing.fromWidth + clientX - resizing.pressX)
|
|
164
|
+
}), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~8"))))), "@gjermundgaraba/pixel-paper/rail/rail.js#dragTo");
|
|
165
|
+
/** Processes a rail Message and returns the next Model, Commands and OutMessage: a splitter let
|
|
166
|
+
* go where it changes the width, or stepped by a key, asks for the width, and the toggle asks
|
|
167
|
+
* to fold or unfold the rail. */
|
|
168
|
+
const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
169
|
+
ClickedOpen: () => __foldkitBrandViewResult((open(model)), "@gjermundgaraba/pixel-paper/rail/rail.js#ClickedOpen"),
|
|
170
|
+
ClickedToggle: () => (__foldkitBrandViewResult(({
|
|
171
|
+
...toggle(model),
|
|
172
|
+
outMessage: OutMessage.ToggledRail()
|
|
173
|
+
}), "@gjermundgaraba/pixel-paper/rail/rail.js#ClickedToggle")),
|
|
174
|
+
PressedSplitter: ({ pointerId, clientX, width }) => __foldkitBrandViewResult((Option.isSome(model.maybeResizing) ? { model } : { model: withResizing(model, Option.some({
|
|
175
|
+
pointerId,
|
|
176
|
+
pressX: clientX,
|
|
177
|
+
fromWidth: width,
|
|
178
|
+
width
|
|
179
|
+
})) }), "@gjermundgaraba/pixel-paper/rail/rail.js#PressedSplitter"),
|
|
180
|
+
MovedSplitter: ({ clientX }) => (__foldkitBrandViewResult(({ model: dragTo(model, clientX) }), "@gjermundgaraba/pixel-paper/rail/rail.js#MovedSplitter")),
|
|
181
|
+
ReleasedSplitter: ({ clientX }) => __foldkitBrandViewResult((Option.match(dragTo(model, clientX).maybeResizing, {
|
|
182
|
+
onNone: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/rail/rail.js#onNone")),
|
|
183
|
+
onSome: ({ fromWidth, width }) => (__foldkitBrandViewResult(({
|
|
184
|
+
model: withResizing(model, Option.none()),
|
|
185
|
+
...width === fromWidth ? {} : { outMessage: OutMessage.ResizedRail({ width }) }
|
|
186
|
+
}), "@gjermundgaraba/pixel-paper/rail/rail.js#onSome"))
|
|
187
|
+
})), "@gjermundgaraba/pixel-paper/rail/rail.js#ReleasedSplitter"),
|
|
188
|
+
CancelledSplitter: () => (__foldkitBrandViewResult(({ model: withResizing(model, Option.none()) }), "@gjermundgaraba/pixel-paper/rail/rail.js#CancelledSplitter")),
|
|
189
|
+
PressedEscape: () => (__foldkitBrandViewResult(({ model: withResizing(model, Option.none()) }), "@gjermundgaraba/pixel-paper/rail/rail.js#PressedEscape")),
|
|
190
|
+
PressedSplitterKey: ({ width }) => (__foldkitBrandViewResult(({
|
|
191
|
+
model,
|
|
192
|
+
outMessage: OutMessage.ResizedRail({ width: bounded(width) })
|
|
193
|
+
}), "@gjermundgaraba/pixel-paper/rail/rail.js#PressedSplitterKey")),
|
|
194
|
+
ClickedClose: () => __foldkitBrandViewResult((close(model)), "@gjermundgaraba/pixel-paper/rail/rail.js#ClickedClose"),
|
|
195
|
+
ClosedDrawer: () => __foldkitBrandViewResult((close(model)), "@gjermundgaraba/pixel-paper/rail/rail.js#ClosedDrawer"),
|
|
196
|
+
BlurredDrawer: () => __foldkitBrandViewResult((closeDrawer(model, false)), "@gjermundgaraba/pixel-paper/rail/rail.js#BlurredDrawer"),
|
|
197
|
+
WidenedPastDrawer: () => __foldkitBrandViewResult((closeDrawer(model, false)), "@gjermundgaraba/pixel-paper/rail/rail.js#WidenedPastDrawer"),
|
|
198
|
+
CompletedShowRailDrawer: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/rail/rail.js#CompletedShowRailDrawer")),
|
|
199
|
+
CompletedHideRailDrawer: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/rail/rail.js#CompletedHideRailDrawer")),
|
|
200
|
+
CompletedFocusRailToggle: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/rail/rail.js#CompletedFocusRailToggle"))
|
|
201
|
+
})), "@gjermundgaraba/pixel-paper/rail/rail.js#update");
|
|
202
|
+
const DRAWER_QUERY = `(max-width: ${WIDEST_DRAWER_WINDOW}px)`;
|
|
203
|
+
const widthChangeMessage = (isDrawerWidth, isDrawerOpen) => __foldkitBrandViewResult((!isDrawerWidth && isDrawerOpen ? Option.some(Message.WidenedPastDrawer()) : Option.none()), "@gjermundgaraba/pixel-paper/rail/rail.js#widthChangeMessage");
|
|
204
|
+
const drawerToggleMessage = (event) => __foldkitBrandViewResult((Option.liftPredicate(Message.ClosedDrawer(), () => __foldkitBrandViewResult((event.newState === "closed"), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~9"))), "@gjermundgaraba/pixel-paper/rail/rail.js#drawerToggleMessage");
|
|
205
|
+
const drawerFocusOutMessage = (rail, event, isDrawerOpen) => __foldkitBrandViewResult((Option.liftPredicate(Message.BlurredDrawer(), () => __foldkitBrandViewResult((isDrawerOpen && event.relatedTarget instanceof Node && !rail.contains(event.relatedTarget)), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~10"))), "@gjermundgaraba/pixel-paper/rail/rail.js#drawerFocusOutMessage");
|
|
206
|
+
/** Follows the drawer the browser shows: the browser closing it (Escape, a press on the
|
|
207
|
+
* veil), focus leaving it while it is open, and the window growing past its width while it
|
|
208
|
+
* is open, each of which closes the rail. */
|
|
209
|
+
const FollowRailDrawer = Mount.defineStream("FollowRailDrawer", {
|
|
210
|
+
messages: [
|
|
211
|
+
Message.ClosedDrawer,
|
|
212
|
+
Message.BlurredDrawer,
|
|
213
|
+
Message.WidenedPastDrawer
|
|
214
|
+
],
|
|
215
|
+
execute: ({ element }) => {
|
|
216
|
+
const isDrawerOpen = () => __foldkitBrandViewResult((element.matches(":popover-open")), "@gjermundgaraba/pixel-paper/rail/rail.js#isDrawerOpen");
|
|
217
|
+
const fromToggle = Dom.streamFromEventFilterMap({
|
|
218
|
+
target: element,
|
|
219
|
+
type: "toggle",
|
|
220
|
+
filterMapEvent: drawerToggleMessage
|
|
221
|
+
});
|
|
222
|
+
const fromFocusOut = Dom.streamFromEventFilterMap({
|
|
223
|
+
target: element,
|
|
224
|
+
type: "focusout",
|
|
225
|
+
filterMapEvent: (event) => __foldkitBrandViewResult((drawerFocusOutMessage(element, event, isDrawerOpen())), "@gjermundgaraba/pixel-paper/rail/rail.js#filterMapEvent")
|
|
226
|
+
});
|
|
227
|
+
const fromWidth = Dom.streamFromMediaQuery({
|
|
228
|
+
query: DRAWER_QUERY,
|
|
229
|
+
mapMatches: (isDrawerWidth) => __foldkitBrandViewResult((widthChangeMessage(isDrawerWidth, isDrawerOpen())), "@gjermundgaraba/pixel-paper/rail/rail.js#mapMatches")
|
|
230
|
+
}).pipe(Stream.filter(Option.isSome), Stream.map(({ value }) => __foldkitBrandViewResult((value), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~11")));
|
|
231
|
+
return __foldkitBrandViewResult((Stream.mergeAll([
|
|
232
|
+
fromToggle,
|
|
233
|
+
fromFocusOut,
|
|
234
|
+
fromWidth
|
|
235
|
+
], { concurrency: "unbounded" })), "@gjermundgaraba/pixel-paper/rail/rail.js#execute~4");
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
const railSubscriptions = Subscription.make()((entry) => (__foldkitBrandViewResult(({
|
|
239
|
+
resize: entry({ maybePointerId: Schema.Option(Schema.Finite) }, {
|
|
240
|
+
modelToDependencies: (model) => (__foldkitBrandViewResult(({ maybePointerId: Option.map(model.maybeResizing, ({ pointerId }) => __foldkitBrandViewResult((pointerId), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~13")) }), "@gjermundgaraba/pixel-paper/rail/rail.js#modelToDependencies")),
|
|
241
|
+
dependenciesToStream: ({ maybePointerId }) => __foldkitBrandViewResult((Option.match(maybePointerId, {
|
|
242
|
+
onNone: () => __foldkitBrandViewResult((Stream.empty), "@gjermundgaraba/pixel-paper/rail/rail.js#onNone~2"),
|
|
243
|
+
onSome: (pointerId) => __foldkitBrandViewResult((Stream.merge(pointerMessages(pointerId, {
|
|
244
|
+
moved: ({ clientX }) => __foldkitBrandViewResult((Message.MovedSplitter({ clientX })), "@gjermundgaraba/pixel-paper/rail/rail.js#moved"),
|
|
245
|
+
released: ({ clientX }) => __foldkitBrandViewResult((Message.ReleasedSplitter({ clientX })), "@gjermundgaraba/pixel-paper/rail/rail.js#released"),
|
|
246
|
+
cancelled: () => __foldkitBrandViewResult((Message.CancelledSplitter()), "@gjermundgaraba/pixel-paper/rail/rail.js#cancelled")
|
|
247
|
+
}), markDragging)), "@gjermundgaraba/pixel-paper/rail/rail.js#onSome~2")
|
|
248
|
+
})), "@gjermundgaraba/pixel-paper/rail/rail.js#dependenciesToStream")
|
|
249
|
+
}),
|
|
250
|
+
escape: entry({ isResizing: Schema.Boolean }, {
|
|
251
|
+
modelToDependencies: (model) => (__foldkitBrandViewResult(({ isResizing: Option.isSome(model.maybeResizing) }), "@gjermundgaraba/pixel-paper/rail/rail.js#modelToDependencies~2")),
|
|
252
|
+
dependenciesToStream: ({ isResizing }) => __foldkitBrandViewResult((isResizing ? escapeKeys(Message.PressedEscape()) : Stream.empty), "@gjermundgaraba/pixel-paper/rail/rail.js#dependenciesToStream~2")
|
|
253
|
+
})
|
|
254
|
+
}), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~12")));
|
|
255
|
+
/** A dragged splitter follows the pointer, and Escape puts it back before a dialog or the
|
|
256
|
+
* page sees it, from listeners that run only while it is dragged. Lift them into the
|
|
257
|
+
* application's Subscriptions behind a key prefix of the parent's: `subscriptions("rail")` is
|
|
258
|
+
* keyed `railResize` and `railEscape`. */
|
|
259
|
+
const subscriptions = (keyPrefix) => __foldkitBrandViewResult((prefixKeys(keyPrefix, railSubscriptions)), "@gjermundgaraba/pixel-paper/rail/rail.js#subscriptions");
|
|
260
|
+
/**
|
|
261
|
+
* A column of panels beside the deck, fixed under the top bar: `div.railed >` the deck, then
|
|
262
|
+
* `aside.rail[popover="auto"][aria-label]`, then its splitter, `div.rail-resize[role="separator"]`,
|
|
263
|
+
* on its right edge. What comes before its last panel keeps its height, and the last panel
|
|
264
|
+
* shrinks to the room left, its bar and foot staying while its body scrolls. One element
|
|
265
|
+
* serves both layouts, so nothing in it renders twice or loses its state. At 900px and under it leaves the page, and
|
|
266
|
+
* `span.rail-open > button.btn.small` at the top of the deck opens the same element as a drawer
|
|
267
|
+
* over a veil, its head (the name and a close glyph) showing. Opening focuses its first
|
|
268
|
+
* control; Escape, a press on the veil, the close glyph, focus leaving or the window growing
|
|
269
|
+
* past 900px closes it, and the first three put focus back on the button.
|
|
270
|
+
*
|
|
271
|
+
* Its splitter sizes it, by a pointer (previewed as it moves) or the side arrows, within its
|
|
272
|
+
* bounds, and reports the width as `ResizedRail` for the parent to keep and pass back as
|
|
273
|
+
* `maybeWidth`, which the view sets as `--railed-width` on `div.railed`, so the page's padding
|
|
274
|
+
* and the rail's width follow it (without one, `--rail`). The drawer keeps its own width. Lift
|
|
275
|
+
* `subscriptions(keyPrefix)` into the application's, or a dragged splitter follows nothing.
|
|
276
|
+
*
|
|
277
|
+
* Its toggle, `span.rail-toggle > button.iconbtn.quiet[aria-expanded]` ("Hide <label>"), comes
|
|
278
|
+
* to `toAsideView` to print as the first panel's `lead`. Pressed, it reports `ToggledRail` for
|
|
279
|
+
* the parent to keep and pass back as `isHidden`: `div.railed.folded` then stands the first
|
|
280
|
+
* panel's title bar on end on the ground (the toggle at its top, "Show <label>"), the rest of
|
|
281
|
+
* the rail and its splitter gone, and the deck takes the width. Focus in the rail lands on the
|
|
282
|
+
* toggle. The drawer, at 900px and under, prints neither the toggle nor the fold.
|
|
283
|
+
*
|
|
284
|
+
* Its state is its own, not `@foldkit/ui`'s Popover: that panel is placed by Floating UI and
|
|
285
|
+
* rendered only while open, and this one is always in the page, placed by the stylesheet, and
|
|
286
|
+
* opened as a native popover so the browser keeps it in the top layer.
|
|
287
|
+
*/
|
|
288
|
+
const view = defineView((model, viewInputs, h) => {
|
|
289
|
+
const { label, isHidden, maybeToggleKeyHint, toAsideView, toDeckView } = viewInputs;
|
|
290
|
+
const maybeWidth = Option.orElse(Option.map(model.maybeResizing, ({ width }) => __foldkitBrandViewResult((width), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~15")), () => __foldkitBrandViewResult((Option.map(viewInputs.maybeWidth, bounded)), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~16"));
|
|
291
|
+
const width = Option.getOrElse(maybeWidth, () => __foldkitBrandViewResult((WIDTH.start), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~17"));
|
|
292
|
+
const openButton = h.span([h.Class("rail-open")], [view$1({
|
|
293
|
+
label,
|
|
294
|
+
glyph: "sidebar",
|
|
295
|
+
isSmall: true,
|
|
296
|
+
onClick: Message.ClickedOpen(),
|
|
297
|
+
attributes: [
|
|
298
|
+
h.Id(openButtonId(model)),
|
|
299
|
+
h.AriaExpanded(model.isOpen),
|
|
300
|
+
h.AriaControls(model.id)
|
|
301
|
+
]
|
|
302
|
+
}, h)]);
|
|
303
|
+
const toggleButton = h.span([h.Class("rail-toggle")], [view$2({
|
|
304
|
+
glyph: "sidebar",
|
|
305
|
+
label: `${isHidden ? "Show" : "Hide"} ${label}`,
|
|
306
|
+
isQuiet: true,
|
|
307
|
+
onClick: Message.ClickedToggle(),
|
|
308
|
+
...Option.match(maybeToggleKeyHint, {
|
|
309
|
+
onNone: () => (__foldkitBrandViewResult(({}), "@gjermundgaraba/pixel-paper/rail/rail.js#onNone~3")),
|
|
310
|
+
onSome: (keyHint) => (__foldkitBrandViewResult(({ keyHint }), "@gjermundgaraba/pixel-paper/rail/rail.js#onSome~3"))
|
|
311
|
+
}),
|
|
312
|
+
attributes: [
|
|
313
|
+
h.Id(toggleId(model)),
|
|
314
|
+
h.AriaExpanded(!isHidden),
|
|
315
|
+
h.AriaControls(model.id)
|
|
316
|
+
]
|
|
317
|
+
}, h)]);
|
|
318
|
+
const splitter = h.div([
|
|
319
|
+
h.Class("rail-resize"),
|
|
320
|
+
h.Role("separator"),
|
|
321
|
+
h.AriaLabel(`Width of ${label}`),
|
|
322
|
+
h.AriaControls(model.id),
|
|
323
|
+
h.AriaValuemin(WIDTH.leastFittingPanels),
|
|
324
|
+
h.AriaValuemax(WIDTH.mostLeavingLeastDeck),
|
|
325
|
+
h.AriaValuenow(width),
|
|
326
|
+
h.AriaValuetext(`${width} pixels`),
|
|
327
|
+
h.Tabindex(0),
|
|
328
|
+
...splitterAttributes({
|
|
329
|
+
orientation: "vertical",
|
|
330
|
+
isIdle: Option.isNone(model.maybeResizing),
|
|
331
|
+
onPress: (pointerId, clientX) => __foldkitBrandViewResult((Message.PressedSplitter({
|
|
332
|
+
pointerId,
|
|
333
|
+
clientX,
|
|
334
|
+
width
|
|
335
|
+
})), "@gjermundgaraba/pixel-paper/rail/rail.js#onPress"),
|
|
336
|
+
onStep: (direction) => __foldkitBrandViewResult((Message.PressedSplitterKey({ width: width + direction * WIDTH.arrowStep })), "@gjermundgaraba/pixel-paper/rail/rail.js#onStep")
|
|
337
|
+
}, h)
|
|
338
|
+
]);
|
|
339
|
+
return __foldkitBrandViewResult((h.div([h.Class(isHidden ? "railed folded" : "railed"), ...isHidden ? [] : Array.fromOption(Option.map(maybeWidth, (shown) => __foldkitBrandViewResult((h.Style({ "--railed-width": `${shown}px` })), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~18")))], [
|
|
340
|
+
toDeckView(openButton),
|
|
341
|
+
h.aside([
|
|
342
|
+
h.Id(model.id),
|
|
343
|
+
h.Popover("auto"),
|
|
344
|
+
h.AriaLabel(label),
|
|
345
|
+
h.Class("rail"),
|
|
346
|
+
h.OnMount(FollowRailDrawer())
|
|
347
|
+
], [h.div([h.Class("rail-head")], [h.span([h.Class("label")], [label]), view$2({
|
|
348
|
+
glyph: "cross",
|
|
349
|
+
label: "Close",
|
|
350
|
+
onClick: Message.ClickedClose()
|
|
351
|
+
}, h)]), ...toAsideView(toggleButton)]),
|
|
352
|
+
...isHidden ? [] : [splitter]
|
|
353
|
+
])), "@gjermundgaraba/pixel-paper/rail/rail.js#anonymous~14");
|
|
354
|
+
});
|
|
355
|
+
export { DRAWER_QUERY, FocusRailToggle, FollowRailDrawer, HideRailDrawer, Message, Model, OutMessage, ShowRailDrawer, WIDTH, close, drawerFocusOutMessage, drawerToggleMessage, firstTabStop, id, init, isOpen, subscriptions, toggle, update, view, widthChangeMessage };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Layout, OutMessage, Pane, apply } from "./layout.js";
|
|
2
|
+
import { Action, AnnounceReel, Arrangement, FocusPane, InitConfig, Message, Model, PaneRender, ScrollIntoView, UpdateContext, ViewInputs, focusedPaneId, init, perform, reconcile, subscriptions, update, view } from "./reel.js";
|
|
3
|
+
declare namespace index_d_exports {
|
|
4
|
+
export { Action, AnnounceReel, Arrangement, FocusPane, InitConfig, Layout, Message, Model, OutMessage, Pane, PaneRender, ScrollIntoView, UpdateContext, ViewInputs, apply, focusedPaneId, init, perform, reconcile, subscriptions, update, view };
|
|
5
|
+
}
|
|
6
|
+
export { Action, AnnounceReel, Arrangement, FocusPane, type InitConfig, Layout, Message, Model, OutMessage, Pane, type PaneRender, ScrollIntoView, type UpdateContext, type ViewInputs, apply, focusedPaneId, index_d_exports, init, perform, reconcile, subscriptions, update, view };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { Layout, OutMessage, Pane, apply } from "./layout.js";
|
|
4
|
+
import { Action, AnnounceReel, Arrangement, FocusPane, Message, Model, ScrollIntoView, focusedPaneId, init, perform, reconcile, subscriptions, update, view } from "./reel.js";
|
|
5
|
+
// src/reel/index.ts
|
|
6
|
+
var reel_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
Action: () => __foldkitBrandViewResult((Action), "@gjermundgaraba/pixel-paper/reel/index.js#Action"),
|
|
8
|
+
AnnounceReel: () => __foldkitBrandViewResult((AnnounceReel), "@gjermundgaraba/pixel-paper/reel/index.js#AnnounceReel"),
|
|
9
|
+
Arrangement: () => __foldkitBrandViewResult((Arrangement), "@gjermundgaraba/pixel-paper/reel/index.js#Arrangement"),
|
|
10
|
+
FocusPane: () => __foldkitBrandViewResult((FocusPane), "@gjermundgaraba/pixel-paper/reel/index.js#FocusPane"),
|
|
11
|
+
Layout: () => __foldkitBrandViewResult((Layout), "@gjermundgaraba/pixel-paper/reel/index.js#Layout"),
|
|
12
|
+
Message: () => __foldkitBrandViewResult((Message), "@gjermundgaraba/pixel-paper/reel/index.js#Message"),
|
|
13
|
+
Model: () => __foldkitBrandViewResult((Model), "@gjermundgaraba/pixel-paper/reel/index.js#Model"),
|
|
14
|
+
OutMessage: () => __foldkitBrandViewResult((OutMessage), "@gjermundgaraba/pixel-paper/reel/index.js#OutMessage"),
|
|
15
|
+
Pane: () => __foldkitBrandViewResult((Pane), "@gjermundgaraba/pixel-paper/reel/index.js#Pane"),
|
|
16
|
+
ScrollIntoView: () => __foldkitBrandViewResult((ScrollIntoView), "@gjermundgaraba/pixel-paper/reel/index.js#ScrollIntoView"),
|
|
17
|
+
apply: () => __foldkitBrandViewResult((apply), "@gjermundgaraba/pixel-paper/reel/index.js#apply"),
|
|
18
|
+
focusedPaneId: () => __foldkitBrandViewResult((focusedPaneId), "@gjermundgaraba/pixel-paper/reel/index.js#focusedPaneId"),
|
|
19
|
+
init: () => __foldkitBrandViewResult((init), "@gjermundgaraba/pixel-paper/reel/index.js#init"),
|
|
20
|
+
perform: () => __foldkitBrandViewResult((perform), "@gjermundgaraba/pixel-paper/reel/index.js#perform"),
|
|
21
|
+
reconcile: () => __foldkitBrandViewResult((reconcile), "@gjermundgaraba/pixel-paper/reel/index.js#reconcile"),
|
|
22
|
+
subscriptions: () => __foldkitBrandViewResult((subscriptions), "@gjermundgaraba/pixel-paper/reel/index.js#subscriptions"),
|
|
23
|
+
update: () => __foldkitBrandViewResult((update), "@gjermundgaraba/pixel-paper/reel/index.js#update"),
|
|
24
|
+
view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/reel/index.js#view")
|
|
25
|
+
});
|
|
26
|
+
export { Action, AnnounceReel, Arrangement, FocusPane, Layout, Message, Model, OutMessage, Pane, ScrollIntoView, apply, focusedPaneId, init, perform, reconcile, reel_exports, subscriptions, update, view };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
|
+
/** Schema for one pane as the reel knows it: its id, unique in the reel and the application's
|
|
3
|
+
* to keep, its name in words (its grip, its splitter and what screen readers hear), and its
|
|
4
|
+
* share of its column's height, a weight against its neighbours'. */
|
|
5
|
+
export declare const Pane: Schema.Struct<{
|
|
6
|
+
readonly id: Schema.String;
|
|
7
|
+
readonly label: Schema.String;
|
|
8
|
+
readonly weight: Schema.Finite;
|
|
9
|
+
}>;
|
|
10
|
+
export type Pane = typeof Pane.Type;
|
|
11
|
+
/** Schema for a reel's layout: its columns, left to right. The application's to keep. */
|
|
12
|
+
export declare const Layout: Schema.$Array<Schema.Struct<{
|
|
13
|
+
readonly id: Schema.String;
|
|
14
|
+
readonly width: Schema.Finite;
|
|
15
|
+
readonly panes: Schema.NonEmptyArray<Schema.Struct<{
|
|
16
|
+
readonly id: Schema.String;
|
|
17
|
+
readonly label: Schema.String;
|
|
18
|
+
readonly weight: Schema.Finite;
|
|
19
|
+
}>>;
|
|
20
|
+
}>>;
|
|
21
|
+
export type Layout = typeof Layout.Type;
|
|
22
|
+
/** Union of what a reel asks the application to do to its layout, which the application
|
|
23
|
+
* applies (`apply` does it) or not, by id, so a request still means what it meant after the
|
|
24
|
+
* layout changed under it. `MovedPane`: a pane into a column, at `toIndex` among that
|
|
25
|
+
* column's other panes. `PulledOutPane`: a pane into a column of its own, before a column
|
|
26
|
+
* (none: after the last). `MovedColumn`: a column to before another (none: last).
|
|
27
|
+
* `ResizedColumn`: a column's width. `ResizedPanes`: a column's panes' weights, by pane id. */
|
|
28
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
29
|
+
readonly MovedPane: {
|
|
30
|
+
paneId: Schema.String;
|
|
31
|
+
toColumnId: Schema.String;
|
|
32
|
+
toIndex: Schema.Finite;
|
|
33
|
+
};
|
|
34
|
+
readonly PulledOutPane: {
|
|
35
|
+
paneId: Schema.String;
|
|
36
|
+
maybeBeforeColumnId: Schema.Option<Schema.String>;
|
|
37
|
+
};
|
|
38
|
+
readonly MovedColumn: {
|
|
39
|
+
columnId: Schema.String;
|
|
40
|
+
maybeBeforeColumnId: Schema.Option<Schema.String>;
|
|
41
|
+
};
|
|
42
|
+
readonly ResizedColumn: {
|
|
43
|
+
columnId: Schema.String;
|
|
44
|
+
width: Schema.Finite;
|
|
45
|
+
};
|
|
46
|
+
readonly ResizedPanes: {
|
|
47
|
+
columnId: Schema.String;
|
|
48
|
+
weights: Schema.$Record<Schema.String, Schema.Finite>;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
export type OutMessage = typeof OutMessage.Type;
|
|
52
|
+
/**
|
|
53
|
+
* The layout once `request` is applied: what the reel asked, done the way every client does
|
|
54
|
+
* it. A pane that leaves its column takes the mean weight of the column it joins; a column
|
|
55
|
+
* left without panes goes; a pane pulled out keeps its old column's width, in a column named
|
|
56
|
+
* for it. A request naming a pane or column the layout no longer has changes nothing.
|
|
57
|
+
*/
|
|
58
|
+
export declare const apply: (layout: Layout, request: OutMessage) => Layout;
|