@gjermundgaraba-designs/pixel-paper 0.22.2 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +13 -13
- package/dist/src/adapters/mermaid.d.ts.map +1 -1
- package/dist/src/adapters/mermaid.js +0 -24
- package/dist/src/announcer/announcer.d.ts.map +1 -1
- package/dist/src/announcer/announcer.js +12 -12
- package/dist/src/board/board.d.ts +0 -10
- package/dist/src/board/board.d.ts.map +1 -1
- package/dist/src/board/board.js +36 -64
- package/dist/src/board/index.d.ts +2 -1
- package/dist/src/board/index.d.ts.map +1 -1
- package/dist/src/board/index.js +2 -1
- package/dist/src/button/button.d.ts +1 -1
- package/dist/src/button/button.d.ts.map +1 -1
- package/dist/src/commandPalette/commandPalette.d.ts.map +1 -1
- package/dist/src/commandPalette/commandPalette.js +78 -83
- package/dist/src/commandPalette/keys.d.ts +2 -2
- package/dist/src/commandPalette/keys.d.ts.map +1 -1
- package/dist/src/commandPalette/keys.js +2 -4
- package/dist/src/commandPalette/match.d.ts.map +1 -1
- package/dist/src/commandPalette/match.js +2 -2
- package/dist/src/confirmDialog/confirmDialog.d.ts.map +1 -1
- package/dist/src/confirmDialog/confirmDialog.js +1 -2
- package/dist/src/copyButton/copyButton.d.ts +0 -5
- package/dist/src/copyButton/copyButton.d.ts.map +1 -1
- package/dist/src/copyButton/copyButton.js +2 -2
- package/dist/src/crumbs/crumbs.d.ts +0 -2
- package/dist/src/crumbs/crumbs.d.ts.map +1 -1
- package/dist/src/crumbs/crumbs.js +2 -2
- package/dist/src/dialog/dialog.d.ts +2 -0
- package/dist/src/dialog/dialog.d.ts.map +1 -1
- package/dist/src/dialog/dialog.js +3 -2
- package/dist/src/drag/drag.d.ts +28 -0
- package/dist/src/drag/drag.d.ts.map +1 -1
- package/dist/src/drag/drag.js +39 -17
- package/dist/src/editableTitle/editableTitle.d.ts +4 -4
- package/dist/src/field/field.d.ts +7 -1
- package/dist/src/field/field.d.ts.map +1 -1
- package/dist/src/field/field.js +14 -6
- package/dist/src/fieldset/fieldset.d.ts.map +1 -1
- package/dist/src/fieldset/fieldset.js +2 -4
- package/dist/src/fileTree/fileTree.d.ts.map +1 -1
- package/dist/src/fileTree/fileTree.js +16 -16
- package/dist/src/inlineInput/inlineInput.d.ts +4 -0
- package/dist/src/inlineInput/inlineInput.d.ts.map +1 -1
- package/dist/src/inlineInput/inlineInput.js +9 -6
- package/dist/src/keyHelp/index.d.ts +1 -1
- package/dist/src/keyHelp/index.d.ts.map +1 -1
- package/dist/src/keyHelp/index.js +1 -1
- package/dist/src/keyHelp/keyHelp.d.ts +1 -3
- package/dist/src/keyHelp/keyHelp.d.ts.map +1 -1
- package/dist/src/keyHelp/keyHelp.js +3 -6
- package/dist/src/keyHint/keyLabel.d.ts +2 -0
- package/dist/src/keyHint/keyLabel.d.ts.map +1 -1
- package/dist/src/keyHint/keyLabel.js +3 -2
- package/dist/src/lineDiff/diff.d.ts +6 -3
- package/dist/src/lineDiff/diff.d.ts.map +1 -1
- package/dist/src/lineDiff/diff.js +40 -28
- package/dist/src/lineDiff/patch.d.ts.map +1 -1
- package/dist/src/lineDiff/patch.js +18 -13
- package/dist/src/linkState/linkState.d.ts.map +1 -1
- package/dist/src/linkState/linkState.js +1 -7
- package/dist/src/menu/slip.js +2 -2
- package/dist/src/meter/meter.d.ts.map +1 -1
- package/dist/src/meter/meter.js +22 -17
- package/dist/src/notice/notice.d.ts +2 -0
- package/dist/src/notice/notice.d.ts.map +1 -1
- package/dist/src/notice/notice.js +2 -1
- package/dist/src/passwordField/passwordField.d.ts.map +1 -1
- package/dist/src/passwordField/passwordField.js +3 -7
- package/dist/src/rail/rail.d.ts +17 -3
- package/dist/src/rail/rail.d.ts.map +1 -1
- package/dist/src/rail/rail.js +6 -6
- package/dist/src/reel/layout.d.ts +9 -5
- package/dist/src/reel/layout.d.ts.map +1 -1
- package/dist/src/reel/layout.js +11 -5
- package/dist/src/reel/reel.d.ts.map +1 -1
- package/dist/src/reel/reel.js +122 -68
- package/dist/src/scheme/scheme.d.ts +1 -1
- package/dist/src/scheme/scheme.d.ts.map +1 -1
- package/dist/src/segmented/segmented.d.ts +0 -3
- package/dist/src/segmented/segmented.d.ts.map +1 -1
- package/dist/src/segmented/segmented.js +1 -6
- package/dist/src/selectField/selectField.d.ts.map +1 -1
- package/dist/src/selectField/selectField.js +3 -10
- package/dist/src/sortable/index.d.ts +1 -1
- package/dist/src/sortable/index.d.ts.map +1 -1
- package/dist/src/sortable/index.js +1 -1
- package/dist/src/sortable/sortable.d.ts +39 -40
- package/dist/src/sortable/sortable.d.ts.map +1 -1
- package/dist/src/sortable/sortable.js +14 -31
- package/dist/src/stack/stack.d.ts +1 -1
- package/dist/src/stack/stack.d.ts.map +1 -1
- package/dist/src/stack/stack.js +1 -1
- package/dist/src/tabs/tabs.d.ts +1 -1
- package/dist/src/tabs/tabs.d.ts.map +1 -1
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/textareaField/textareaField.d.ts.map +1 -1
- package/dist/src/textareaField/textareaField.js +3 -7
- package/dist/src/time/time.d.ts.map +1 -1
- package/dist/src/time/time.js +4 -2
- package/dist/src/tips/index.d.ts +1 -1
- package/dist/src/tips/index.d.ts.map +1 -1
- package/dist/src/toast/index.d.ts +1 -1
- package/dist/src/toast/index.d.ts.map +1 -1
- package/dist/src/toast/toast.d.ts +5 -5
- package/dist/src/toast/toast.d.ts.map +1 -1
- package/dist/src/toast/toast.js +1 -6
- package/dist/src/toolbar/toolbar.d.ts +0 -3
- package/dist/src/toolbar/toolbar.d.ts.map +1 -1
- package/dist/src/toolbar/toolbar.js +1 -2
- package/package.json +1 -1
- package/src/adapters/mermaid.ts +0 -24
- package/src/announcer/announcer.ts +13 -17
- package/src/board/board.ts +32 -80
- package/src/board/index.ts +1 -1
- package/src/button/button.ts +1 -1
- package/src/commandPalette/commandPalette.ts +21 -38
- package/src/commandPalette/keys.ts +2 -4
- package/src/commandPalette/match.ts +3 -3
- package/src/confirmDialog/confirmDialog.ts +5 -3
- package/src/copyButton/copyButton.ts +2 -5
- package/src/crumbs/crumbs.ts +2 -4
- package/src/dialog/dialog.ts +3 -2
- package/src/drag/drag.ts +54 -5
- package/src/field/field.ts +29 -7
- package/src/fieldset/fieldset.ts +2 -4
- package/src/fileTree/fileTree.ts +10 -12
- package/src/inlineInput/inlineInput.ts +11 -2
- package/src/keyHelp/index.ts +0 -1
- package/src/keyHelp/keyHelp.ts +3 -9
- package/src/keyHint/keyLabel.ts +5 -2
- package/src/lineDiff/diff.ts +70 -54
- package/src/lineDiff/patch.ts +27 -14
- package/src/linkState/linkState.ts +1 -8
- package/src/menu/slip.ts +2 -2
- package/src/meter/meter.ts +25 -15
- package/src/notice/notice.ts +2 -1
- package/src/passwordField/passwordField.ts +3 -7
- package/src/pixel-paper.css +82 -131
- package/src/rail/rail.ts +8 -6
- package/src/reel/layout.ts +14 -7
- package/src/reel/reel.ts +132 -63
- package/src/scheme/scheme.ts +1 -1
- package/src/segmented/segmented.ts +1 -9
- package/src/selectField/selectField.ts +3 -10
- package/src/sortable/index.ts +0 -1
- package/src/sortable/sortable.ts +35 -54
- package/src/stack/stack.ts +1 -1
- package/src/tabs/tabs.ts +1 -1
- package/src/textareaField/textareaField.ts +3 -7
- package/src/time/time.ts +6 -7
- package/src/tips/index.ts +1 -1
- package/src/toast/index.ts +1 -1
- package/src/toast/toast.ts +2 -8
- package/src/tokens.css +6 -0
- package/src/toolbar/toolbar.ts +0 -5
- package/dist/src/inlineInput/inline.d.ts +0 -6
- package/dist/src/inlineInput/inline.d.ts.map +0 -1
- package/dist/src/inlineInput/inline.js +0 -7
- package/src/inlineInput/inline.ts +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyButton.d.ts","sourceRoot":"","sources":["../../../src/copyButton/copyButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAY,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CAAC;AAEH,6DAA6D;AAC7D,eAAO,MAAM,YAAY;;;;iBAIvB,CAAC;AAIH;gFACgF;AAChF,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;;;;;;;;;;;;;EAqBjD,CAAC;AAIL;oCACoC;AACpC,eAAO,MAAM,OAAO,8CAAsC,CAAC;AAC3D,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb;2BACuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;IAff,kCAAkC;UAC5B,MAAM;IACZ;2BACuB;WAChB,MAAM;cACH,OAAO;GAsCjB,CAAC"}
|
|
@@ -103,9 +103,9 @@ export const Variant = Schema.Literals(["Icon", "Button"]);
|
|
|
103
103
|
* resources.
|
|
104
104
|
*/
|
|
105
105
|
export const view = defineView((model, viewInputs, h) => {
|
|
106
|
-
const { text, label, variant = "Icon"
|
|
106
|
+
const { text, label, variant = "Icon" } = viewInputs;
|
|
107
107
|
const isDone = isCopied(model);
|
|
108
|
-
const buttonAttributes = [
|
|
108
|
+
const buttonAttributes = [h.Id(id(model))];
|
|
109
109
|
const onClick = Message.ClickedCopy({ text });
|
|
110
110
|
return __foldkitBrandViewResult((variant === "Icon"
|
|
111
111
|
? IconButton.view({
|
|
@@ -9,8 +9,6 @@ export type Crumb = Readonly<{
|
|
|
9
9
|
/** Configuration for rendering crumbs with `view`. */
|
|
10
10
|
export type ViewConfig = Readonly<{
|
|
11
11
|
crumbs: ReadonlyArray<Crumb>;
|
|
12
|
-
/** Names the navigation for screen readers. */
|
|
13
|
-
label?: string;
|
|
14
12
|
}>;
|
|
15
13
|
/** The path to where you are, in the pixel face, split by muted slashes: a navigation
|
|
16
14
|
* landmark named "Breadcrumb", its steps an ordered list, the last `aria-current="page"`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crumbs.d.ts","sourceRoot":"","sources":["../../../src/crumbs/crumbs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAItD,2DAA2D;AAC3D,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd;wCACoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"crumbs.d.ts","sourceRoot":"","sources":["../../../src/crumbs/crumbs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAItD,2DAA2D;AAC3D,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd;wCACoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC9B,CAAC,CAAC;AAeH;8FAC8F;AAC9F,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAO3E,CAAC"}
|
|
@@ -8,6 +8,6 @@ const crumbView = (lastIndex, h) => __foldkitBrandViewResult((({ label, href },
|
|
|
8
8
|
/** The path to where you are, in the pixel face, split by muted slashes: a navigation
|
|
9
9
|
* landmark named "Breadcrumb", its steps an ordered list, the last `aria-current="page"`. */
|
|
10
10
|
export const view = (config, h) => {
|
|
11
|
-
const { crumbs
|
|
12
|
-
return __foldkitBrandViewResult((h.nav([h.AriaLabel(
|
|
11
|
+
const { crumbs } = config;
|
|
12
|
+
return __foldkitBrandViewResult((h.nav([h.AriaLabel("Breadcrumb"), h.Class("crumbs")], [h.ol([], Array.map(crumbs, crumbView(crumbs.length - 1, h)))])), "@gjermundgaraba-designs/pixel-paper/src/crumbs/crumbs.js#view");
|
|
13
13
|
};
|
|
@@ -82,6 +82,8 @@ export type UpdateContext = Readonly<{
|
|
|
82
82
|
* soon after the start a key comes. */
|
|
83
83
|
isCloseHeld: boolean;
|
|
84
84
|
}>;
|
|
85
|
+
/** The context of a dialog whose close is not held, the default. */
|
|
86
|
+
export declare const FREE: UpdateContext;
|
|
85
87
|
/** Processes a dialog Message and returns the next Model, Commands and OutMessage. */
|
|
86
88
|
export declare const update: (model: Model, message: Message, context?: UpdateContext) => Readonly<{
|
|
87
89
|
model: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/dialog/dialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,MAAM,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAC;AAE/E,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAGvC,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAO9C,gFAAgF;AAChF,eAAO,MAAM,KAAK;;;;;;;;;;;;;EAEhB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAEtC,8EAA8E;AAC9E,QAAA,MAAM,eAAe,gDAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;AAEnD,iFAAiF;AACjF,eAAO,MA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;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAzBf,2FAA2F;YACnF,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;IACpC;0FACsF;YAC9E,MAAM;IACd,sEAAsE;cAC5D,OAAO;gBACL,SAAS;qBACJ,OAAO;IACxB;;;;2FAIuF;uBACpE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;GA2D3C,CAAC"}
|
|
@@ -51,7 +51,8 @@ const dialogFold = foldDialog(UiDialog, {
|
|
|
51
51
|
toParentMessage: (message) => __foldkitBrandViewResult((Message.GotDialogMessage({ message })), "@gjermundgaraba-designs/pixel-paper/src/dialog/dialog.js#toParentMessage"),
|
|
52
52
|
toParentOutMessage: toOutMessage,
|
|
53
53
|
});
|
|
54
|
-
|
|
54
|
+
/** The context of a dialog whose close is not held, the default. */
|
|
55
|
+
export const FREE = { isCloseHeld: false };
|
|
55
56
|
// NOTE: @foldkit/ui gap: Dialog has no way to hold a close. Escape, a press on the veil and a
|
|
56
57
|
// control given the `closeButton` group all send `RequestedClose`, so a held dialog reads it
|
|
57
58
|
// by its tag and leaves it out.
|
|
@@ -125,7 +126,7 @@ export const sceneMounts = [
|
|
|
125
126
|
export const view = defineView((model, viewInputs, h) => {
|
|
126
127
|
const { toView, label, isAlert = false, placement = "Center", hasDescription = false, toLiveRegionView, } = viewInputs;
|
|
127
128
|
const actionBar = childAttributes([
|
|
128
|
-
h.
|
|
129
|
+
h.Attribute(ACTION_BAR_ATTRIBUTE, ""),
|
|
129
130
|
h.OnMount(BindActionKeys()),
|
|
130
131
|
]);
|
|
131
132
|
const veilView = (render) => __foldkitBrandViewResult((h.dialog([...render.dialog, ...(isAlert ? [h.Role("alertdialog")] : []), h.Class("veil")], render.isVisible
|
package/dist/src/drag/drag.d.ts
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
import { DragAndDrop as UiDragAndDrop } from "@foldkit/ui";
|
|
2
2
|
import { Option, Stream } from "effect";
|
|
3
|
+
import type * as Command from "foldkit/command";
|
|
3
4
|
import type { Attribute, HtmlBuilder } from "foldkit/html";
|
|
5
|
+
import * as Subscription from "foldkit/subscription";
|
|
6
|
+
import * as Update from "foldkit/update";
|
|
4
7
|
/** Where a drag is: nothing pressed, pressed but not yet moved, carried by a pointer, or
|
|
5
8
|
* carried by the keyboard. */
|
|
6
9
|
type Phase = "Idle" | "Pressed" | "PointerDragging" | "KeyboardDragging";
|
|
7
10
|
export declare const phaseOf: (dragAndDrop: UiDragAndDrop.Model) => Phase;
|
|
8
11
|
/** Whether an item is carried, by a pointer or the keyboard. */
|
|
9
12
|
export declare const isCarrying: (phase: Phase) => boolean;
|
|
13
|
+
/** What a Board's and a Sortable's Model share: the DragAndDrop, whether items may move, and
|
|
14
|
+
* what the list keeps while an item is pressed or held. */
|
|
15
|
+
type Holder = Readonly<{
|
|
16
|
+
dragAndDrop: UiDragAndDrop.Model;
|
|
17
|
+
isMovable: boolean;
|
|
18
|
+
maybeHeld: Option.Option<unknown>;
|
|
19
|
+
}>;
|
|
20
|
+
/** Whether an item is pressed or held. While it is, the arrow keys, Space and Escape belong to
|
|
21
|
+
* the list: pause the page's own bindings for them. The list takes Escape before anything
|
|
22
|
+
* else sees it. */
|
|
23
|
+
export declare const isHolding: (model: Holder) => boolean;
|
|
24
|
+
/** Whether a press may lift an item now: items may move and none is pressed or held. */
|
|
25
|
+
export declare const canLift: (model: Holder) => boolean;
|
|
26
|
+
/** Settles a DragAndDrop step: forgets the held item once it is down, and runs what the step
|
|
27
|
+
* says (`maybeAnnouncement`) after the step's own Commands. */
|
|
28
|
+
export declare const settle: <Model extends Holder, Message, OutMessage>(step: Update.ReturnWithOutMessage<Model, Message, OutMessage>, maybeAnnouncement: Option.Option<Command.Command<Message>>) => Update.ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
10
29
|
export declare const pressedDraggable: (fields: Parameters<typeof UiDragAndDrop.Message.PressedDraggable>[0]) => UiDragAndDrop.Message;
|
|
11
30
|
export declare const activatedKeyboardDrag: (fields: Parameters<typeof UiDragAndDrop.Message.ActivatedKeyboardDrag>[0]) => UiDragAndDrop.Message;
|
|
12
31
|
export declare const movedPointer: (fields: Parameters<typeof UiDragAndDrop.Message.MovedPointer>[0]) => UiDragAndDrop.Message;
|
|
@@ -22,6 +41,15 @@ export declare const innerControls: (liftingButtons: string) => string;
|
|
|
22
41
|
export declare const takeEscape: <Message>(event: KeyboardEvent, message: Message) => Option.Option<Message>;
|
|
23
42
|
/** Escape on the window, in the capture phase, as `message`. */
|
|
24
43
|
export declare const escapeKeys: <Message>(message: Message) => Stream.Stream<Message>;
|
|
44
|
+
/** A list's `escape` Subscription: `escapeKeys` as `message` while an item is pressed or
|
|
45
|
+
* held. */
|
|
46
|
+
export declare const escapeSubscriptions: <Model extends Holder, Message>(message: Message) => {
|
|
47
|
+
readonly escape: Subscription.EntryWithoutKeepAlive<Model, Message, {
|
|
48
|
+
readonly isHolding: boolean;
|
|
49
|
+
}, never> & {
|
|
50
|
+
readonly __subscription: never;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
25
53
|
/** What the pressing pointer `pointerId` does, as Messages: each move, the release and the
|
|
26
54
|
* browser's cancel. */
|
|
27
55
|
export declare const pointerMessages: <Message>(pointerId: number, toMessage: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag.d.ts","sourceRoot":"","sources":["../../../src/drag/drag.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAiB,MAAM,
|
|
1
|
+
{"version":3,"file":"drag.d.ts","sourceRoot":"","sources":["../../../src/drag/drag.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAiB,MAAM,EAAiB,MAAM,EAAQ,MAAM,QAAQ,CAA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WAAW,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1E,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC;CACxC,CAAC,KACC,WAAW,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAmBlC,CAAC;AAIF;6CAC6C;AAC7C,eAAO,MAAM,WAAW,YACb,OAAO,kBACA,MAAM,UACd,MAAM,UACN,MAAM,KACb,IAQF,CAAC;AAoBF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,cACd,OAAO,UACV,MAAM,WACL,MAAM,WACN,MAAM,KACd,MA+BF,CAAC;AAMF;;8DAE8D;AAC9D,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAK7C,CAAC"}
|
package/dist/src/drag/drag.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
2
|
// Shared by Board and Sortable, the two users of @foldkit/ui's DragAndDrop, and Reel, which
|
|
3
|
-
// holds its own: the phase a drag is in,
|
|
4
|
-
// lifts, Escape taken before anything else, the
|
|
5
|
-
// measure, and the closest-centre drop target a
|
|
6
|
-
// handlers are the Reel's and the Rail's.
|
|
3
|
+
// holds its own: the phase a drag is in, what a hold keeps and how a step settles it, the
|
|
4
|
+
// DragAndDrop Messages both build, what a press lifts, Escape taken before anything else, the
|
|
5
|
+
// pressing pointer's events, the lifted copy's measure, and the closest-centre drop target a
|
|
6
|
+
// sortable resolves for a pointer. A splitter's handlers are the Reel's and the Rail's.
|
|
7
7
|
import { DragAndDrop as UiDragAndDrop } from "@foldkit/ui";
|
|
8
|
-
import { Array, Effect, Option, Order, Stream, pipe } from "effect";
|
|
8
|
+
import { Array, Effect, Option, Order, Schema, Stream, pipe } from "effect";
|
|
9
9
|
import * as Dom from "foldkit/dom";
|
|
10
|
+
import * as Subscription from "foldkit/subscription";
|
|
11
|
+
import * as Update from "foldkit/update";
|
|
10
12
|
import { isPlain } from "../keys/keys.js";
|
|
11
13
|
// NOTE: @foldkit/ui gap: DragAndDrop has no accessor for which input holds an item.
|
|
12
14
|
// `ghostStyle` is Some only while a pointer drags, so it tells a pointer drag from a keyboard
|
|
@@ -27,6 +29,18 @@ export const phaseOf = (dragAndDrop) => {
|
|
|
27
29
|
};
|
|
28
30
|
/** Whether an item is carried, by a pointer or the keyboard. */
|
|
29
31
|
export const isCarrying = (phase) => __foldkitBrandViewResult((phase === "PointerDragging" || phase === "KeyboardDragging"), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#isCarrying");
|
|
32
|
+
/** Whether an item is pressed or held. While it is, the arrow keys, Space and Escape belong to
|
|
33
|
+
* the list: pause the page's own bindings for them. The list takes Escape before anything
|
|
34
|
+
* else sees it. */
|
|
35
|
+
export const isHolding = (model) => __foldkitBrandViewResult((phaseOf(model.dragAndDrop) !== "Idle"), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#isHolding");
|
|
36
|
+
/** Whether a press may lift an item now: items may move and none is pressed or held. */
|
|
37
|
+
export const canLift = (model) => __foldkitBrandViewResult((model.isMovable && !isHolding(model)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#canLift");
|
|
38
|
+
/** Settles a DragAndDrop step: forgets the held item once it is down, and runs what the step
|
|
39
|
+
* says (`maybeAnnouncement`) after the step's own Commands. */
|
|
40
|
+
export const settle = (step, maybeAnnouncement) => __foldkitBrandViewResult((Update.withOutMessage({
|
|
41
|
+
model: isHolding(step.model) ? step.model : { ...step.model, maybeHeld: Option.none() },
|
|
42
|
+
commands: [...(step.commands ?? []), ...Array.fromOption(maybeAnnouncement)],
|
|
43
|
+
}, step.outMessage)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#settle");
|
|
30
44
|
// CHILD MESSAGES
|
|
31
45
|
// NOTE: @foldkit/ui gap: DragAndDrop exposes no update capability for a press, a keyboard
|
|
32
46
|
// pick-up, a pointer's move and release, or a cancel, and its `draggable` bundle
|
|
@@ -81,21 +95,29 @@ export const escapeKeys = (message) => __foldkitBrandViewResult((Dom.streamFromE
|
|
|
81
95
|
filterMapEvent: (event) => __foldkitBrandViewResult((takeEscape(event, message)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#filterMapEvent"),
|
|
82
96
|
options: { capture: true },
|
|
83
97
|
})), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#escapeKeys");
|
|
98
|
+
/** A list's `escape` Subscription: `escapeKeys` as `message` while an item is pressed or
|
|
99
|
+
* held. */
|
|
100
|
+
export const escapeSubscriptions = (message) => __foldkitBrandViewResult((Subscription.make()((entry) => (__foldkitBrandViewResult(({
|
|
101
|
+
escape: entry({ isHolding: Schema.Boolean }, {
|
|
102
|
+
modelToDependencies: (model) => (__foldkitBrandViewResult(({ isHolding: isHolding(model) }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#modelToDependencies")),
|
|
103
|
+
dependenciesToStream: ({ isHolding: isHoldingNow }) => __foldkitBrandViewResult((isHoldingNow ? escapeKeys(message) : Stream.empty), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#dependenciesToStream"),
|
|
104
|
+
}),
|
|
105
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous")))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#escapeSubscriptions");
|
|
84
106
|
// POINTER
|
|
85
107
|
/** The moves, release and cancel of the pointer `pointerId`, on the document; another
|
|
86
108
|
* pointer's are not the drag's. */
|
|
87
|
-
const pressingPointer = (pointerId) => __foldkitBrandViewResult((Stream.filter(Stream.mergeAll(Array.map(["pointermove", "pointerup", "pointercancel"], (type) => __foldkitBrandViewResult((Stream.fromEventListener(document, type)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous")), { concurrency: "unbounded" }), (event) => __foldkitBrandViewResult((event.pointerId === pointerId), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
109
|
+
const pressingPointer = (pointerId) => __foldkitBrandViewResult((Stream.filter(Stream.mergeAll(Array.map(["pointermove", "pointerup", "pointercancel"], (type) => __foldkitBrandViewResult((Stream.fromEventListener(document, type)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~2")), { concurrency: "unbounded" }), (event) => __foldkitBrandViewResult((event.pointerId === pointerId), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~3"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#pressingPointer");
|
|
88
110
|
/** What the pressing pointer `pointerId` does, as Messages: each move, the release and the
|
|
89
111
|
* browser's cancel. */
|
|
90
112
|
export const pointerMessages = (pointerId, toMessage) => __foldkitBrandViewResult((Stream.map(pressingPointer(pointerId), (event) => {
|
|
91
113
|
if (event.type === "pointermove") {
|
|
92
|
-
return __foldkitBrandViewResult((toMessage.moved(event)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
114
|
+
return __foldkitBrandViewResult((toMessage.moved(event)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~4");
|
|
93
115
|
}
|
|
94
116
|
else if (event.type === "pointerup") {
|
|
95
|
-
return __foldkitBrandViewResult((toMessage.released(event)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
117
|
+
return __foldkitBrandViewResult((toMessage.released(event)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~4");
|
|
96
118
|
}
|
|
97
119
|
else {
|
|
98
|
-
return __foldkitBrandViewResult((toMessage.cancelled()), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
120
|
+
return __foldkitBrandViewResult((toMessage.cancelled()), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~4");
|
|
99
121
|
}
|
|
100
122
|
})), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#pointerMessages");
|
|
101
123
|
// SPLITTER
|
|
@@ -107,8 +129,8 @@ export const splitterAttributes = (config, h) => {
|
|
|
107
129
|
const [less, more] = config.orientation === "vertical" ? ["ArrowLeft", "ArrowRight"] : ["ArrowUp", "ArrowDown"];
|
|
108
130
|
return __foldkitBrandViewResult(([
|
|
109
131
|
h.AriaOrientation(config.orientation),
|
|
110
|
-
h.OnPointerDown((_pointerType, button, _screenX, _screenY, _time, clientX, clientY, pointerId) => __foldkitBrandViewResult((Option.liftPredicate(config.onPress(pointerId, clientX, clientY), () => __foldkitBrandViewResult((button === LEFT_BUTTON && config.isIdle), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
111
|
-
h.OnKeyDownPreventDefault((key, modifiers) => __foldkitBrandViewResult((Option.liftPredicate(config.onStep(key === more ? 1 : -1), () => __foldkitBrandViewResult((isPlain(modifiers) && (key === less || key === more)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
132
|
+
h.OnPointerDown((_pointerType, button, _screenX, _screenY, _time, clientX, clientY, pointerId) => __foldkitBrandViewResult((Option.liftPredicate(config.onPress(pointerId, clientX, clientY), () => __foldkitBrandViewResult((button === LEFT_BUTTON && config.isIdle), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~6"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~5")),
|
|
133
|
+
h.OnKeyDownPreventDefault((key, modifiers) => __foldkitBrandViewResult((Option.liftPredicate(config.onStep(key === more ? 1 : -1), () => __foldkitBrandViewResult((isPlain(modifiers) && (key === less || key === more)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~8"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~7")),
|
|
112
134
|
]), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#splitterAttributes");
|
|
113
135
|
};
|
|
114
136
|
// LIFTED COPY
|
|
@@ -142,14 +164,14 @@ const isOnSameRow = (box, other) => __foldkitBrandViewResult((Math.abs(other.top
|
|
|
142
164
|
* in a column of rows it is read down, so one reading serves a list and a grid.
|
|
143
165
|
*/
|
|
144
166
|
export const insertionIndex = (container, heldId, clientX, clientY) => {
|
|
145
|
-
const items = Array.map(Array.fromIterable(container.querySelectorAll("[data-sortable-id]")), (item) => (__foldkitBrandViewResult(({ id: item.dataset["sortableId"], box: boxOf(item) }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
167
|
+
const items = Array.map(Array.fromIterable(container.querySelectorAll("[data-sortable-id]")), (item) => (__foldkitBrandViewResult(({ id: item.dataset["sortableId"], box: boxOf(item) }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~9")));
|
|
146
168
|
// read with the held item in its place: two tiles side by side are a row even while one of
|
|
147
169
|
// them is held
|
|
148
|
-
const isTiled = Array.some(items, ({ box }, index) => __foldkitBrandViewResult((Option.exists(Array.get(items, index + 1), (next) => __foldkitBrandViewResult((isOnSameRow(box, next.box)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
149
|
-
const boxes = pipe(Array.filter(items, (item) => __foldkitBrandViewResult((item.id !== heldId), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
170
|
+
const isTiled = Array.some(items, ({ box }, index) => __foldkitBrandViewResult((Option.exists(Array.get(items, index + 1), (next) => __foldkitBrandViewResult((isOnSameRow(box, next.box)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~11"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~10"));
|
|
171
|
+
const boxes = pipe(Array.filter(items, (item) => __foldkitBrandViewResult((item.id !== heldId), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~12")), Array.map(({ box }) => __foldkitBrandViewResult((box), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~13")));
|
|
150
172
|
const distance = (box) => __foldkitBrandViewResult((Math.hypot(box.centreX - clientX, box.centreY - clientY)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#distance");
|
|
151
|
-
const byDistance = Order.mapInput(Order.Number, ({ box }) => __foldkitBrandViewResult((distance(box)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
152
|
-
return __foldkitBrandViewResult((Array.match(Array.map(boxes, (box, index) => (__foldkitBrandViewResult(({ box, index }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
173
|
+
const byDistance = Order.mapInput(Order.Number, ({ box }) => __foldkitBrandViewResult((distance(box)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~14"));
|
|
174
|
+
return __foldkitBrandViewResult((Array.match(Array.map(boxes, (box, index) => (__foldkitBrandViewResult(({ box, index }), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~15"))), {
|
|
153
175
|
onEmpty: () => __foldkitBrandViewResult((0), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#onEmpty"),
|
|
154
176
|
onNonEmpty: (candidates) => {
|
|
155
177
|
const { box, index } = Array.min(candidates, byDistance);
|
|
@@ -163,4 +185,4 @@ const DRAGGING_ATTRIBUTE = "data-pixel-paper-dragging";
|
|
|
163
185
|
/** While a pointer presses or carries an item, the page is marked
|
|
164
186
|
* (`data-pixel-paper-dragging` on the root), so the stylesheet prints the grabbing cursor and
|
|
165
187
|
* holds text selection, with no style element of its own. */
|
|
166
|
-
export const markDragging = Stream.callback(() => __foldkitBrandViewResult((Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((document.documentElement.setAttribute(DRAGGING_ATTRIBUTE, "")), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~
|
|
188
|
+
export const markDragging = Stream.callback(() => __foldkitBrandViewResult((Effect.acquireRelease(Effect.sync(() => __foldkitBrandViewResult((document.documentElement.setAttribute(DRAGGING_ATTRIBUTE, "")), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~17")), () => __foldkitBrandViewResult((Effect.sync(() => __foldkitBrandViewResult((document.documentElement.removeAttribute(DRAGGING_ATTRIBUTE)), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~19"))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~18")).pipe(Effect.flatMap(() => __foldkitBrandViewResult((Effect.never), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~20")))), "@gjermundgaraba-designs/pixel-paper/src/drag/drag.js#anonymous~16"));
|
|
@@ -86,13 +86,13 @@ export declare const update: (model: Model, message: Message) => Readonly<{
|
|
|
86
86
|
} | {
|
|
87
87
|
readonly _tag: "GotEditMessage";
|
|
88
88
|
readonly message: {
|
|
89
|
-
readonly _tag: "PressedEscape";
|
|
90
|
-
} | {
|
|
91
89
|
readonly _tag: "BlurredField";
|
|
92
90
|
} | {
|
|
93
91
|
readonly _tag: "CompletedFocusField";
|
|
94
92
|
} | {
|
|
95
93
|
readonly _tag: "PressedEnter";
|
|
94
|
+
} | {
|
|
95
|
+
readonly _tag: "PressedEscape";
|
|
96
96
|
} | {
|
|
97
97
|
readonly _tag: "UpdatedDraft";
|
|
98
98
|
readonly value: string;
|
|
@@ -142,13 +142,13 @@ export declare const view: import("foldkit/submodel").View<{
|
|
|
142
142
|
} | {
|
|
143
143
|
readonly _tag: "GotEditMessage";
|
|
144
144
|
readonly message: {
|
|
145
|
-
readonly _tag: "PressedEscape";
|
|
146
|
-
} | {
|
|
147
145
|
readonly _tag: "BlurredField";
|
|
148
146
|
} | {
|
|
149
147
|
readonly _tag: "CompletedFocusField";
|
|
150
148
|
} | {
|
|
151
149
|
readonly _tag: "PressedEnter";
|
|
150
|
+
} | {
|
|
151
|
+
readonly _tag: "PressedEscape";
|
|
152
152
|
} | {
|
|
153
153
|
readonly _tag: "UpdatedDraft";
|
|
154
154
|
readonly value: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Html, HtmlBuilder, TextareaAttribute } from "foldkit/html";
|
|
1
|
+
import type { Attribute, Html, HtmlBuilder, TextareaAttribute } from "foldkit/html";
|
|
2
2
|
import type { Attributes } from "../attributes/attributes.ts";
|
|
3
3
|
/** The red sentence under a field's control that says why it failed, given an error. */
|
|
4
4
|
export declare const errorView: <Message>(id: string, error: string | undefined, h: HtmlBuilder<Message>) => ReadonlyArray<Html>;
|
|
@@ -6,6 +6,12 @@ export declare const errorView: <Message>(id: string, error: string | undefined,
|
|
|
6
6
|
* `@foldkit/ui` attributes, whose `aria-describedby` names the help line alone; every
|
|
7
7
|
* `@foldkit/ui` control names that line `<id>-description`, as Input does. */
|
|
8
8
|
export declare const describedByError: <Message>(id: string, error: string | undefined, hasHelp: boolean, h: HtmlBuilder<Message>) => ReadonlyArray<TextareaAttribute<Message>>;
|
|
9
|
+
/** A field's control, after the `@foldkit/ui` attributes: described by its error before its
|
|
10
|
+
* help line, and `aria-required` when the form is not sent without it. */
|
|
11
|
+
export declare const controlAttributes: <Message>(id: string, error: string | undefined, help: string | undefined, isRequired: boolean, h: HtmlBuilder<Message>) => ReadonlyArray<TextareaAttribute<Message>>;
|
|
12
|
+
/** The sans sentence under a field's controls, given one, with the `@foldkit/ui`
|
|
13
|
+
* `description` group that makes it describe them. */
|
|
14
|
+
export declare const helpView: <Message>(help: string | undefined, description: ReadonlyArray<Attribute<Message>>, h: HtmlBuilder<Message>) => ReadonlyArray<Html>;
|
|
9
15
|
/** Configuration for rendering a text field with `view`. */
|
|
10
16
|
export type ViewConfig<Message> = Readonly<{
|
|
11
17
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/field/field.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|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AM,CAAC;IACd;;uCAEmC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,yFAAyF;IACzF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;qEACiE;IACjE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;iBACa;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;iBACa;IACb,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC,CAAC;AAEH;;;6EAG6E;AAC7E,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAyCpF,CAAC"}
|
package/dist/src/field/field.js
CHANGED
|
@@ -10,6 +10,18 @@ export const errorView = (id, error, h) => __foldkitBrandViewResult((error === u
|
|
|
10
10
|
export const describedByError = (id, error, hasHelp, h) => __foldkitBrandViewResult((error === undefined
|
|
11
11
|
? []
|
|
12
12
|
: [h.AriaDescribedBy(hasHelp ? `${errorId(id)} ${UiInput.descriptionId(id)}` : errorId(id))]), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#describedByError");
|
|
13
|
+
/** A field's control, after the `@foldkit/ui` attributes: described by its error before its
|
|
14
|
+
* help line, and `aria-required` when the form is not sent without it. */
|
|
15
|
+
// NOTE: @foldkit/ui gap: Input, Select and Textarea have no required option, so the wrapper
|
|
16
|
+
// says it.
|
|
17
|
+
export const controlAttributes = (id, error, help, isRequired, h) => __foldkitBrandViewResult(([
|
|
18
|
+
...describedByError(id, error, help !== undefined, h),
|
|
19
|
+
...(isRequired ? [h.AriaRequired(true)] : []),
|
|
20
|
+
]), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#controlAttributes");
|
|
21
|
+
// HELP
|
|
22
|
+
/** The sans sentence under a field's controls, given one, with the `@foldkit/ui`
|
|
23
|
+
* `description` group that makes it describe them. */
|
|
24
|
+
export const helpView = (help, description, h) => __foldkitBrandViewResult((help === undefined ? [] : [h.p([...description, h.Class("field-help")], [help])]), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#helpView");
|
|
13
25
|
/** A labelled text input with its help line, built on `@foldkit/ui`'s `Input`: the label
|
|
14
26
|
* names the input, the help line describes it (`aria-describedby`), an `error` sets
|
|
15
27
|
* `aria-invalid` and describes it before the help, and `isRequired` sets `aria-required`.
|
|
@@ -25,17 +37,13 @@ export const view = (config, h) => {
|
|
|
25
37
|
hasDescription: help !== undefined,
|
|
26
38
|
toView: (groups) => __foldkitBrandViewResult((h.div([h.Class(`field${isBoxed || type === "date" ? " boxed" : ""}${isMono ? " mono" : ""}`)], [
|
|
27
39
|
h.label([...groups.label, ...(isLabelHidden ? [h.Class("sr-only")] : [])], [label]),
|
|
28
|
-
// NOTE: @foldkit/ui gap: Input has no required option, so the wrapper says it.
|
|
29
40
|
h.input([
|
|
30
41
|
...inputAttributes,
|
|
31
42
|
...groups.input,
|
|
32
|
-
...
|
|
33
|
-
...(isRequired ? [h.AriaRequired(true)] : []),
|
|
43
|
+
...controlAttributes(id, error, help, isRequired, h),
|
|
34
44
|
]),
|
|
35
45
|
...errorView(id, error, h),
|
|
36
|
-
...(help
|
|
37
|
-
? []
|
|
38
|
-
: [h.p([...groups.description, h.Class("field-help")], [help])]),
|
|
46
|
+
...helpView(help, groups.description, h),
|
|
39
47
|
])), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#toView"),
|
|
40
48
|
}, h)), "@gjermundgaraba-designs/pixel-paper/src/field/field.js#view");
|
|
41
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldset.d.ts","sourceRoot":"","sources":["../../../src/fieldset/fieldset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMtD,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,qFAAqF;IACrF,EAAE,EAAE,MAAM,CAAC;IACX,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;gBAGY;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,0CAA0C;IAC1C,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH;;mFAEmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,
|
|
1
|
+
{"version":3,"file":"fieldset.d.ts","sourceRoot":"","sources":["../../../src/fieldset/fieldset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMtD,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,qFAAqF;IACrF,EAAE,EAAE,MAAM,CAAC;IACX,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;gBAGY;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,0CAA0C;IAC1C,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH;;mFAEmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAwB3E,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
2
|
import { Fieldset as UiFieldset } from "@foldkit/ui";
|
|
3
|
-
import { describedByError, errorView } from "../field/field.js";
|
|
3
|
+
import { describedByError, errorView, helpView } from "../field/field.js";
|
|
4
4
|
/** A group of controls under one name, built on `@foldkit/ui`'s Fieldset: a `<fieldset>`
|
|
5
5
|
* named by its `<legend>` and described by its error and its help line
|
|
6
6
|
* (`aria-describedby`). The legend turns red while a control in it is invalid. */
|
|
@@ -17,9 +17,7 @@ export const view = (config, h) => {
|
|
|
17
17
|
h.legend([...groups.legend, h.Class("field-label")], [label]),
|
|
18
18
|
...body,
|
|
19
19
|
...errorView(id, error, h),
|
|
20
|
-
...(help
|
|
21
|
-
? []
|
|
22
|
-
: [h.p([...groups.description, h.Class("field-help")], [help])]),
|
|
20
|
+
...helpView(help, groups.description, h),
|
|
23
21
|
])), "@gjermundgaraba-designs/pixel-paper/src/fieldset/fieldset.js#toView"),
|
|
24
22
|
}, h)), "@gjermundgaraba-designs/pixel-paper/src/fieldset/fieldset.js#view");
|
|
25
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileTree.d.ts","sourceRoot":"","sources":["../../../src/fileTree/fileTree.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,MAAM,EAAS,MAAM,EAAgB,MAAM,QAAQ,CAAC;AAGzF,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAGvC,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAKpD;4CAC4C;AAC5C,eAAO,MAAM,KAAK;;;;EAIhB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAItC,qDAAqD;AACrD,eAAO,MAAM,OAAO;;QACD,IAAI;;;QACN,IAAI;;;QACA,IAAI;;;QACC,IAAI;;;QACH,IAAI;;EAC7B,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAI1C;2DAC2D;AAC3D,eAAO,MAAM,UAAU;;QACP,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randViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#moveInTree");
|
|
85
85
|
}
|
|
86
86
|
const items = ownItems(tree);
|
|
87
|
-
return __foldkitBrandViewResult((pipe(Array.
|
|
87
|
+
return __foldkitBrandViewResult((pipe(Array.findFirstWithIndex(items, (item) => __foldkitBrandViewResult((item === event.target), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~21")), Option.flatMap(([item, index]) => {
|
|
88
88
|
if (isTypeahead(event)) {
|
|
89
|
-
return __foldkitBrandViewResult((moveTo(itemStartingWith(items, index, event.key))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
89
|
+
return __foldkitBrandViewResult((moveTo(itemStartingWith(items, index, event.key))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~22");
|
|
90
90
|
}
|
|
91
91
|
else if (isPlain(event)) {
|
|
92
|
-
return __foldkitBrandViewResult((actOnKey(items, index, item, event.key)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
92
|
+
return __foldkitBrandViewResult((actOnKey(items, index, item, event.key)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~22");
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
95
|
+
return __foldkitBrandViewResult((Option.none()), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~22");
|
|
96
96
|
}
|
|
97
|
-
}))
|
|
97
|
+
}))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#moveInTree");
|
|
98
98
|
};
|
|
99
99
|
// the tree item focus landed on, if focus landed on one: it becomes the tree's Tab stop
|
|
100
|
-
const focusInMessage = (event) => __foldkitBrandViewResult((Option.map(Option.flatMap(Option.liftPredicate(event.target, (target) => __foldkitBrandViewResult((target instanceof Element), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
100
|
+
const focusInMessage = (event) => __foldkitBrandViewResult((Option.map(Option.flatMap(Option.liftPredicate(event.target, (target) => __foldkitBrandViewResult((target instanceof Element), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~23")), (target) => __foldkitBrandViewResult((Option.flatMap(Option.fromNullishOr(target.closest(ITEM_SELECTOR)), pathOf)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~24")), (path) => __foldkitBrandViewResult((Message.FocusedTreeItem({ path })), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~25"))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#focusInMessage");
|
|
101
101
|
/** The tree's keys (see `moveInTree`), and the item focus lands on (see `focusInMessage`),
|
|
102
102
|
* which becomes the tree's stop for Tab. A key that moves focus reports nothing itself: the
|
|
103
103
|
* item's `focusin` does, once. Attached to the tree by `view`. */
|
|
@@ -106,7 +106,7 @@ export const BindTreeKeys = Mount.defineStream("BindTreeKeys", {
|
|
|
106
106
|
execute: ({ element }) => __foldkitBrandViewResult((Stream.callback((queue) => __foldkitBrandViewResult((Effect.gen(function* () {
|
|
107
107
|
yield* Effect.acquireRelease(Effect.sync(() => {
|
|
108
108
|
const onKeyDown = (event) => {
|
|
109
|
-
const maybeAction = Option.flatMap(Option.liftPredicate(event, (keyEvent) => __foldkitBrandViewResult((keyEvent instanceof KeyboardEvent), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
109
|
+
const maybeAction = Option.flatMap(Option.liftPredicate(event, (keyEvent) => __foldkitBrandViewResult((keyEvent instanceof KeyboardEvent), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~29")), (keyEvent) => __foldkitBrandViewResult((moveInTree(element, keyEvent)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~30"));
|
|
110
110
|
if (Option.isSome(maybeAction)) {
|
|
111
111
|
event.preventDefault();
|
|
112
112
|
TreeKeyAction.$match(maybeAction.value, {
|
|
@@ -125,23 +125,23 @@ export const BindTreeKeys = Mount.defineStream("BindTreeKeys", {
|
|
|
125
125
|
};
|
|
126
126
|
element.addEventListener("keydown", onKeyDown);
|
|
127
127
|
element.addEventListener("focusin", onFocusIn);
|
|
128
|
-
return __foldkitBrandViewResult(({ onKeyDown, onFocusIn }), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
128
|
+
return __foldkitBrandViewResult(({ onKeyDown, onFocusIn }), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~28");
|
|
129
129
|
}), ({ onKeyDown, onFocusIn }) => __foldkitBrandViewResult((Effect.sync(() => {
|
|
130
130
|
element.removeEventListener("keydown", onKeyDown);
|
|
131
131
|
element.removeEventListener("focusin", onFocusIn);
|
|
132
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
133
|
-
return __foldkitBrandViewResult((yield* Effect.never), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
134
|
-
})), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
132
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~31"));
|
|
133
|
+
return __foldkitBrandViewResult((yield* Effect.never), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~27");
|
|
134
|
+
})), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~26"))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#execute"),
|
|
135
135
|
});
|
|
136
136
|
const visiblePaths = (model, nodes) => __foldkitBrandViewResult((Array.flatMap(nodes, (node) => __foldkitBrandViewResult((node.children !== undefined && isFolderOpen(model, node.path)
|
|
137
137
|
? [node.path, ...visiblePaths(model, node.children)]
|
|
138
|
-
: [node.path]), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
138
|
+
: [node.path]), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~33"))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#visiblePaths");
|
|
139
139
|
/** The one item Tab stops on: where the keyboard last was, else the open file, else the
|
|
140
140
|
* first item, whichever is visible. */
|
|
141
141
|
const tabStop = (model, nodes, maybeCurrentPath) => {
|
|
142
142
|
const visible = visiblePaths(model, nodes);
|
|
143
143
|
const isVisible = (path) => __foldkitBrandViewResult((Array.contains(visible, path)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#isVisible");
|
|
144
|
-
return __foldkitBrandViewResult((pipe(Option.filter(model.maybeFocusedPath, isVisible), Option.orElse(() => __foldkitBrandViewResult((Option.filter(maybeCurrentPath, isVisible)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
144
|
+
return __foldkitBrandViewResult((pipe(Option.filter(model.maybeFocusedPath, isVisible), Option.orElse(() => __foldkitBrandViewResult((Option.filter(maybeCurrentPath, isVisible)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~34")), Option.orElse(() => __foldkitBrandViewResult((Array.head(visible)), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~35")))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#tabStop");
|
|
145
145
|
};
|
|
146
146
|
const groupId = (model, path) => __foldkitBrandViewResult((`${model.id}-group-${path}`), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#groupId");
|
|
147
147
|
const itemAttributes = (context, level, node, index) => {
|
|
@@ -152,7 +152,7 @@ const itemAttributes = (context, level, node, index) => {
|
|
|
152
152
|
h.AriaSetsize(level.nodes.length),
|
|
153
153
|
h.AriaPosinset(index + 1),
|
|
154
154
|
h.DataAttribute("path", node.path),
|
|
155
|
-
h.Tabindex(Option.exists(maybeTabStop, (path) => __foldkitBrandViewResult((path === node.path), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
155
|
+
h.Tabindex(Option.exists(maybeTabStop, (path) => __foldkitBrandViewResult((path === node.path), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~36")) ? 0 : -1),
|
|
156
156
|
h.Class("file"),
|
|
157
157
|
]), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#itemAttributes");
|
|
158
158
|
};
|
|
@@ -202,7 +202,7 @@ const branchView = (context, level, listAttributes) => {
|
|
|
202
202
|
const { h } = context;
|
|
203
203
|
return __foldkitBrandViewResult((h.ul(listAttributes, Array.map(level.nodes, (node, index) => __foldkitBrandViewResult((h.keyed("li")(node.path, [h.Role("none")], node.children === undefined
|
|
204
204
|
? [fileView(context, level, node, index)]
|
|
205
|
-
: folderView(context, level, node, index, node.children))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
205
|
+
: folderView(context, level, node, index, node.children))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~37")))), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#branchView");
|
|
206
206
|
};
|
|
207
207
|
/**
|
|
208
208
|
* Files and folders in the system monospace, nested on a 1px rule guide, as an ARIA tree:
|
|
@@ -226,5 +226,5 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
226
226
|
h.AriaLabel(label),
|
|
227
227
|
h.OnMount(BindTreeKeys()),
|
|
228
228
|
]),
|
|
229
|
-
])), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~
|
|
229
|
+
])), "@gjermundgaraba-designs/pixel-paper/src/fileTree/fileTree.js#anonymous~38");
|
|
230
230
|
});
|
|
@@ -75,6 +75,10 @@ export declare const isSaving: (model: Model) => boolean;
|
|
|
75
75
|
* fails, and again once the draft changes or the next save goes out. */
|
|
76
76
|
export declare const maybeError: (model: Model) => Option.Option<string>;
|
|
77
77
|
type UpdateReturn = Update.ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
78
|
+
/** What Enter or leaving an inline field writes: the draft trimmed, or none (an untouched
|
|
79
|
+
* draft, so an edit made elsewhere to `value` is never overwritten; an empty one; or the
|
|
80
|
+
* text it replaces). */
|
|
81
|
+
export declare const toWrite: (maybeDraft: Option.Option<string>, value: string) => Option.Option<string>;
|
|
78
82
|
/** Processes an inline field Message and returns the next Model, Commands and OutMessage. */
|
|
79
83
|
export declare const update: (model: Model, message: Message) => Readonly<{
|
|
80
84
|
model: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineInput.d.ts","sourceRoot":"","sources":["../../../src/inlineInput/inlineInput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"inlineInput.d.ts","sourceRoot":"","sources":["../../../src/inlineInput/inlineInput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,EAAgB,MAAM,QAAQ,CAAC;AACrE,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAIvC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AA0BzC;;;;oEAIoE;AACpE,eAAO,MAAM,KAAK;;;;;YAVN,OAAO;YAAe,OAAO;;;;;;;;;EAkBvC,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAItC;6CAC6C;AAC7C,eAAO,MAAM,OAAO;;QACF,KAAK;QAAiB,QAAQ;;;;;;EAK9C,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IA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