@gjermundgaraba-designs/pixel-paper 0.13.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +29 -22
- package/dist/src/announcer/announcer.d.ts +34 -26
- package/dist/src/announcer/announcer.d.ts.map +1 -1
- package/dist/src/announcer/announcer.js +42 -32
- package/dist/src/announcer/index.d.ts +1 -1
- package/dist/src/announcer/index.d.ts.map +1 -1
- package/dist/src/announcer/index.js +1 -1
- package/dist/src/banner/banner.d.ts +1 -1
- package/dist/src/banner/banner.js +1 -1
- package/dist/src/barChart/barChart.js +1 -1
- package/dist/src/board/board.d.ts +1 -4
- package/dist/src/board/board.d.ts.map +1 -1
- package/dist/src/board/board.js +8 -71
- package/dist/src/button/button.d.ts +1 -1
- package/dist/src/button/button.js +1 -1
- package/dist/src/card/card.d.ts +36 -9
- package/dist/src/card/card.d.ts.map +1 -1
- package/dist/src/card/card.js +46 -8
- package/dist/src/card/index.d.ts +2 -2
- package/dist/src/card/index.d.ts.map +1 -1
- package/dist/src/card/index.js +1 -1
- package/dist/src/commandPalette/commandPalette.d.ts +4 -0
- package/dist/src/commandPalette/commandPalette.d.ts.map +1 -1
- package/dist/src/confirmDialog/confirmDialog.d.ts +20 -27
- package/dist/src/confirmDialog/confirmDialog.d.ts.map +1 -1
- package/dist/src/confirmDialog/confirmDialog.js +23 -20
- package/dist/src/confirmDialog/index.d.ts +1 -1
- package/dist/src/confirmDialog/index.d.ts.map +1 -1
- package/dist/src/confirmDialog/index.js +1 -1
- package/dist/src/contextMenu/contextMenu.d.ts +6 -6
- package/dist/src/dialog/dialog.d.ts +40 -9
- package/dist/src/dialog/dialog.d.ts.map +1 -1
- package/dist/src/dialog/dialog.js +37 -15
- package/dist/src/dialog/index.d.ts +1 -1
- package/dist/src/dialog/index.d.ts.map +1 -1
- package/dist/src/dialog/index.js +1 -1
- package/dist/src/drag/drag.d.ts +40 -0
- package/dist/src/drag/drag.d.ts.map +1 -0
- package/dist/src/drag/drag.js +134 -0
- package/dist/src/emptyState/emptyState.d.ts +6 -4
- package/dist/src/emptyState/emptyState.d.ts.map +1 -1
- package/dist/src/emptyState/emptyState.js +1 -1
- package/dist/src/errorSummary/errorSummary.d.ts +1 -1
- package/dist/src/errorSummary/errorSummary.js +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/keyHelp/keyHelp.d.ts +4 -0
- package/dist/src/keyHelp/keyHelp.d.ts.map +1 -1
- package/dist/src/lineChart/lineChart.js +1 -1
- package/dist/src/liveRegion/index.d.ts +3 -0
- package/dist/src/liveRegion/index.d.ts.map +1 -0
- package/dist/src/liveRegion/index.js +1 -0
- package/dist/src/liveRegion/liveRegion.d.ts +42 -0
- package/dist/src/liveRegion/liveRegion.d.ts.map +1 -0
- package/dist/src/liveRegion/liveRegion.js +35 -0
- package/dist/src/loading/loading.d.ts +8 -3
- package/dist/src/loading/loading.d.ts.map +1 -1
- package/dist/src/loading/loading.js +4 -3
- package/dist/src/menu/menu.d.ts +6 -6
- package/dist/src/meter/meter.d.ts +3 -0
- package/dist/src/meter/meter.d.ts.map +1 -1
- package/dist/src/meter/meter.js +6 -3
- package/dist/src/remote/index.d.ts +3 -0
- package/dist/src/remote/index.d.ts.map +1 -0
- package/dist/src/remote/index.js +1 -0
- package/dist/src/remote/remote.d.ts +29 -0
- package/dist/src/remote/remote.d.ts.map +1 -0
- package/dist/src/remote/remote.js +41 -0
- package/dist/src/skipLink/index.d.ts +1 -1
- package/dist/src/skipLink/index.d.ts.map +1 -1
- package/dist/src/skipLink/index.js +1 -1
- package/dist/src/skipLink/skipLink.d.ts +24 -8
- package/dist/src/skipLink/skipLink.d.ts.map +1 -1
- package/dist/src/skipLink/skipLink.js +27 -8
- package/dist/src/sortable/index.d.ts +3 -0
- package/dist/src/sortable/index.d.ts.map +1 -0
- package/dist/src/sortable/index.js +1 -0
- package/dist/src/sortable/sortable.d.ts +1144 -0
- package/dist/src/sortable/sortable.d.ts.map +1 -0
- package/dist/src/sortable/sortable.js +504 -0
- package/dist/src/toast/index.d.ts +1 -1
- package/dist/src/toast/index.d.ts.map +1 -1
- package/dist/src/toast/index.js +1 -1
- package/dist/src/toast/toast.d.ts +32 -20
- package/dist/src/toast/toast.d.ts.map +1 -1
- package/dist/src/toast/toast.js +8 -3
- package/dist/src/topBar/barHeight.d.ts +6 -0
- package/dist/src/topBar/barHeight.d.ts.map +1 -1
- package/dist/src/topBar/barHeight.js +4 -0
- package/dist/src/topBar/index.d.ts +1 -1
- package/dist/src/topBar/index.d.ts.map +1 -1
- package/dist/src/topBar/index.js +1 -1
- package/dist/src/topBar/topBar.d.ts +1 -2
- package/dist/src/topBar/topBar.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/announcer/announcer.ts +48 -32
- package/src/announcer/index.ts +1 -1
- package/src/banner/banner.ts +1 -1
- package/src/barChart/barChart.ts +1 -1
- package/src/board/board.ts +18 -87
- package/src/button/button.ts +1 -1
- package/src/card/card.ts +121 -21
- package/src/card/index.ts +2 -2
- package/src/confirmDialog/confirmDialog.ts +27 -33
- package/src/confirmDialog/index.ts +2 -0
- package/src/dialog/dialog.ts +47 -18
- package/src/dialog/index.ts +3 -1
- package/src/drag/drag.ts +207 -0
- package/src/emptyState/emptyState.ts +7 -5
- package/src/errorSummary/errorSummary.ts +1 -1
- package/src/index.ts +3 -0
- package/src/lineChart/lineChart.ts +1 -1
- package/src/liveRegion/index.ts +2 -0
- package/src/liveRegion/liveRegion.ts +75 -0
- package/src/loading/loading.ts +11 -5
- package/src/meter/meter.ts +17 -3
- package/src/pixel-paper.css +182 -27
- package/src/remote/index.ts +2 -0
- package/src/remote/remote.ts +76 -0
- package/src/skipLink/index.ts +1 -1
- package/src/skipLink/skipLink.ts +38 -9
- package/src/sortable/index.ts +14 -0
- package/src/sortable/sortable.ts +857 -0
- package/src/toast/index.ts +1 -0
- package/src/toast/toast.ts +9 -3
- package/src/tokens.css +13 -11
- package/src/topBar/barHeight.ts +6 -0
- package/src/topBar/index.ts +1 -1
- package/src/topBar/topBar.ts +1 -2
|
@@ -20,6 +20,7 @@ export declare const Model: Schema.Struct<{
|
|
|
20
20
|
}>;
|
|
21
21
|
readonly maybeFocusSelector: Schema.Option<Schema.String>;
|
|
22
22
|
}>;
|
|
23
|
+
readonly isCloseHeld: Schema.Boolean;
|
|
23
24
|
}>;
|
|
24
25
|
readonly query: Schema.String;
|
|
25
26
|
}>;
|
|
@@ -105,6 +106,7 @@ export declare const update: (model: Model, message: Message) => Readonly<{
|
|
|
105
106
|
};
|
|
106
107
|
readonly maybeFocusSelector: import("effect/Option").Option<string>;
|
|
107
108
|
};
|
|
109
|
+
readonly isCloseHeld: boolean;
|
|
108
110
|
};
|
|
109
111
|
readonly query: string;
|
|
110
112
|
};
|
|
@@ -182,6 +184,7 @@ export declare const subscriptions: {
|
|
|
182
184
|
};
|
|
183
185
|
readonly maybeFocusSelector: import("effect/Option").Option<string>;
|
|
184
186
|
};
|
|
187
|
+
readonly isCloseHeld: boolean;
|
|
185
188
|
};
|
|
186
189
|
readonly query: string;
|
|
187
190
|
}, {
|
|
@@ -268,6 +271,7 @@ export declare const view: import("foldkit/submodel").View<{
|
|
|
268
271
|
};
|
|
269
272
|
readonly maybeFocusSelector: import("effect/Option").Option<string>;
|
|
270
273
|
};
|
|
274
|
+
readonly isCloseHeld: boolean;
|
|
271
275
|
};
|
|
272
276
|
readonly query: string;
|
|
273
277
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyHelp.d.ts","sourceRoot":"","sources":["../../../src/keyHelp/keyHelp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAgB,MAAM,QAAQ,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,cAAc,CAAC;AAItD,OAAO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AAa,CAAC,OAAO,CAAC,CAAC;IACjC,QAAQ,EAAE,WAAW,CAAC;IACtB;;+DAE2D;IAC3D,WAAW,CAAC,EAAE,MAAM,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACjD;0CACsC;IACtC,gBAAgB,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC7C,CAAC,CAAC;AAsDH;;qBAEqB;AACrB,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAnEf,8DAA8D;cACpD,aAAa,CAAC,OAAO,CAAC;cACtB,WAAW;IACrB;;+DAE2D;kBAC7C,MAAM,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC;IAChD;0CACsC;uBACnB,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;GAqE5C,CAAC"}
|
|
@@ -91,6 +91,6 @@ const chartView = (config, labels, h) => {
|
|
|
91
91
|
* Renders on the server: a fixed viewBox, stretched to its container's width.
|
|
92
92
|
*/
|
|
93
93
|
export const view = (config, h) => __foldkitBrandViewResult((Array.match(config.labels, {
|
|
94
|
-
onEmpty: () => __foldkitBrandViewResult((EmptyState.view({ title: "nothing to chart" }, h)), "@gjermundgaraba-designs/pixel-paper/src/lineChart/lineChart.js#onEmpty"),
|
|
94
|
+
onEmpty: () => __foldkitBrandViewResult((EmptyState.view({ title: "nothing to chart", headingLevel: "Strong" }, h)), "@gjermundgaraba-designs/pixel-paper/src/lineChart/lineChart.js#onEmpty"),
|
|
95
95
|
onNonEmpty: (labels) => __foldkitBrandViewResult((chartView(config, labels, h)), "@gjermundgaraba-designs/pixel-paper/src/lineChart/lineChart.js#onNonEmpty"),
|
|
96
96
|
})), "@gjermundgaraba-designs/pixel-paper/src/lineChart/lineChart.js#view");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/liveRegion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { place, view } from "./liveRegion.js";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Html, HtmlBuilder } from "foldkit/html";
|
|
2
|
+
/** A dialog that can host the page's live parts: its name in the application, and whether it
|
|
3
|
+
* is open now. */
|
|
4
|
+
export type DialogEntry<Host extends string> = readonly [host: Host, isOpen: boolean];
|
|
5
|
+
/** Where the page's live parts go on this render. */
|
|
6
|
+
export type Placement<Host extends string> = Readonly<{
|
|
7
|
+
/** The `toLiveRegionView` to give the dialog `host`: the parts while it is the topmost open
|
|
8
|
+
* dialog, `undefined` while it is not. */
|
|
9
|
+
toDialogView: (host: Host) => (() => Html) | undefined;
|
|
10
|
+
/** The parts for the end of the body while no dialog is open, nothing while one is. */
|
|
11
|
+
toPageView: () => ReadonlyArray<Html>;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Places the page's live parts by the hosting rule: an open Dialog makes the page outside it
|
|
15
|
+
* inert and hidden from screen readers, so they render inside the topmost open dialog, and at
|
|
16
|
+
* the end of the body while none is open, exactly once either way. Neither renders them
|
|
17
|
+
* until called, so a Submodel among the parts (the toast stack) is built once. `dialogs` lists every dialog
|
|
18
|
+
* that can host them from the bottom of the stack to the top: one that opens from another
|
|
19
|
+
* (a confirm from a form) comes after it, so of the open ones the last is the topmost. Call it
|
|
20
|
+
* on every render, from the application's Model, so the parts move as dialogs open and close.
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* const placement = LiveRegion.place([
|
|
24
|
+
* ["Rename", Dialog.isOpen(model.rename)],
|
|
25
|
+
* ["Delete", ConfirmDialog.isOpen(model.deleteConfirm)],
|
|
26
|
+
* ], () => LiveRegion.view({ toasts: toastsView(model, h) }, h));
|
|
27
|
+
* // the rename dialog's view inputs: toLiveRegionView: placement.toDialogView("Rename")
|
|
28
|
+
* // the body: [...content, ...placement.toPageView()]
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const place: <Host extends string>(dialogs: ReadonlyArray<DialogEntry<Host>>, toView: () => Html) => Placement<Host>;
|
|
32
|
+
/** Configuration for rendering the page's live parts with `view`. */
|
|
33
|
+
export type ViewConfig = Readonly<{
|
|
34
|
+
/** The page's Toast stack (its `h.submodel`), when it has one. */
|
|
35
|
+
toasts?: Html;
|
|
36
|
+
/** The Banner in force, when one is: it stays in reach while a dialog is open. */
|
|
37
|
+
banner?: Html;
|
|
38
|
+
}>;
|
|
39
|
+
/** The page's live parts together, for `place`: the Announcer's region, then the toast stack
|
|
40
|
+
* and the banner the application gives. */
|
|
41
|
+
export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
|
|
42
|
+
//# sourceMappingURL=liveRegion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveRegion.d.ts","sourceRoot":"","sources":["../../../src/liveRegion/liveRegion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMtD;mBACmB;AACnB,MAAM,MAAM,WAAW,CAAC,IAAI,SAAS,MAAM,IAAI,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtF,qDAAqD;AACrD,MAAM,MAAM,SAAS,CAAC,IAAI,SAAS,MAAM,IAAI,QAAQ,CAAC;IACpD;+CAC2C;IAC3C,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACvD,uFAAuF;IACvF,UAAU,EAAE,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;CACvC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,SAAS,MAAM,WAC9B,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UACjC,MAAM,IAAI,KACjB,SAAS,CAAC,IAAI,CAWhB,CAAC;AAIF,qEAAqE;AACrE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,kEAAkE;IAClE,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,kFAAkF;IAClF,MAAM,CAAC,EAAE,IAAI,CAAC;CACf,CAAC,CAAC;AAEH;4CAC4C;AAC5C,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAQzE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { Array, Option, pipe } from "effect";
|
|
3
|
+
import * as Announcer from "../announcer/announcer.js";
|
|
4
|
+
/**
|
|
5
|
+
* Places the page's live parts by the hosting rule: an open Dialog makes the page outside it
|
|
6
|
+
* inert and hidden from screen readers, so they render inside the topmost open dialog, and at
|
|
7
|
+
* the end of the body while none is open, exactly once either way. Neither renders them
|
|
8
|
+
* until called, so a Submodel among the parts (the toast stack) is built once. `dialogs` lists every dialog
|
|
9
|
+
* that can host them from the bottom of the stack to the top: one that opens from another
|
|
10
|
+
* (a confirm from a form) comes after it, so of the open ones the last is the topmost. Call it
|
|
11
|
+
* on every render, from the application's Model, so the parts move as dialogs open and close.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* const placement = LiveRegion.place([
|
|
15
|
+
* ["Rename", Dialog.isOpen(model.rename)],
|
|
16
|
+
* ["Delete", ConfirmDialog.isOpen(model.deleteConfirm)],
|
|
17
|
+
* ], () => LiveRegion.view({ toasts: toastsView(model, h) }, h));
|
|
18
|
+
* // the rename dialog's view inputs: toLiveRegionView: placement.toDialogView("Rename")
|
|
19
|
+
* // the body: [...content, ...placement.toPageView()]
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export const place = (dialogs, toView) => {
|
|
23
|
+
const maybeTopmost = pipe(Array.findLast(dialogs, ([, isOpen]) => __foldkitBrandViewResult((isOpen), "@gjermundgaraba-designs/pixel-paper/src/liveRegion/liveRegion.js#anonymous")), Option.map(([host]) => __foldkitBrandViewResult((host), "@gjermundgaraba-designs/pixel-paper/src/liveRegion/liveRegion.js#anonymous~2")));
|
|
24
|
+
return __foldkitBrandViewResult(({
|
|
25
|
+
toDialogView: (host) => __foldkitBrandViewResult((Option.exists(maybeTopmost, (topmost) => __foldkitBrandViewResult((topmost === host), "@gjermundgaraba-designs/pixel-paper/src/liveRegion/liveRegion.js#anonymous~3")) ? toView : undefined), "@gjermundgaraba-designs/pixel-paper/src/liveRegion/liveRegion.js#toDialogView"),
|
|
26
|
+
toPageView: () => (__foldkitBrandViewResult((Option.isNone(maybeTopmost) ? [toView()] : []), "@gjermundgaraba-designs/pixel-paper/src/liveRegion/liveRegion.js#toPageView")),
|
|
27
|
+
}), "@gjermundgaraba-designs/pixel-paper/src/liveRegion/liveRegion.js#place");
|
|
28
|
+
};
|
|
29
|
+
/** The page's live parts together, for `place`: the Announcer's region, then the toast stack
|
|
30
|
+
* and the banner the application gives. */
|
|
31
|
+
export const view = (config, h) => __foldkitBrandViewResult((h.div([], [
|
|
32
|
+
Announcer.view(h),
|
|
33
|
+
...(config.toasts === undefined ? [] : [config.toasts]),
|
|
34
|
+
...(config.banner === undefined ? [] : [config.banner]),
|
|
35
|
+
])), "@gjermundgaraba-designs/pixel-paper/src/liveRegion/liveRegion.js#view");
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { Html, HtmlBuilder } from "foldkit/html";
|
|
2
|
+
import type { Attributes } from "../attributes/attributes.ts";
|
|
2
3
|
/** Configuration for rendering a loading line with `view`. */
|
|
3
|
-
export type ViewConfig = Readonly<{
|
|
4
|
+
export type ViewConfig<Message> = Readonly<{
|
|
4
5
|
/** Whether the content is on its way. Done, the line empties and leaves the flow, so it
|
|
5
6
|
* takes no room and no gap, but stays in place, so the next wait is heard. */
|
|
6
7
|
isLoading: boolean;
|
|
7
8
|
/** What is on its way, in pixel caps (`"loading the items"`). `"loading"` by default. */
|
|
8
9
|
label?: string;
|
|
10
|
+
/** Attributes for the line, such as the id and `tabindex="-1"` that make it a place to
|
|
11
|
+
* send focus. */
|
|
12
|
+
attributes?: Attributes<Message>;
|
|
9
13
|
}>;
|
|
10
14
|
/** What a panel says while its content is on the way, centred where the content will be, with
|
|
11
15
|
* the working cursor. A polite status that stays in place with its words swapped, as a live
|
|
12
16
|
* region must be for a screen reader to hear it: render it before the content, from before
|
|
13
|
-
* the wait starts, and set `isLoading`.
|
|
14
|
-
|
|
17
|
+
* the wait starts, and set `isLoading`. It is not the page's live region (the Announcer's,
|
|
18
|
+
* marked `data-pixel-paper-announcer`), so a test that counts live regions counts that. */
|
|
19
|
+
export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
|
|
15
20
|
//# sourceMappingURL=loading.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../../../src/loading/loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../../../src/loading/loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAI9D,8DAA8D;AAC9D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC;mFAC+E;IAC/E,SAAS,EAAE,OAAO,CAAC;IACnB,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;sBACkB;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAClC,CAAC,CAAC;AAEH;;;;4FAI4F;AAC5F,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAOpF,CAAC"}
|
|
@@ -2,8 +2,9 @@ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
|
2
2
|
/** What a panel says while its content is on the way, centred where the content will be, with
|
|
3
3
|
* the working cursor. A polite status that stays in place with its words swapped, as a live
|
|
4
4
|
* region must be for a screen reader to hear it: render it before the content, from before
|
|
5
|
-
* the wait starts, and set `isLoading`.
|
|
5
|
+
* the wait starts, and set `isLoading`. It is not the page's live region (the Announcer's,
|
|
6
|
+
* marked `data-pixel-paper-announcer`), so a test that counts live regions counts that. */
|
|
6
7
|
export const view = (config, h) => {
|
|
7
|
-
const { isLoading, label = "loading" } = config;
|
|
8
|
-
return __foldkitBrandViewResult((h.div([h.Role("status"), h.Class(isLoading ? "loading" : "loading-idle")], isLoading ? [label, h.span([h.Class("cursor"), h.AriaHidden(true)])] : [])), "@gjermundgaraba-designs/pixel-paper/src/loading/loading.js#view");
|
|
8
|
+
const { isLoading, label = "loading", attributes = [] } = config;
|
|
9
|
+
return __foldkitBrandViewResult((h.div([...attributes, h.Role("status"), h.Class(isLoading ? "loading" : "loading-idle")], isLoading ? [label, h.span([h.Class("cursor"), h.AriaHidden(true)])] : [])), "@gjermundgaraba-designs/pixel-paper/src/loading/loading.js#view");
|
|
9
10
|
};
|
package/dist/src/menu/menu.d.ts
CHANGED
|
@@ -75,8 +75,6 @@ export declare const update: (model: Model, message: Message) => Readonly<{
|
|
|
75
75
|
readonly edge: "First" | "Last";
|
|
76
76
|
};
|
|
77
77
|
commands?: Update.Commands<{
|
|
78
|
-
readonly _tag: "PressedEscape";
|
|
79
|
-
} | {
|
|
80
78
|
readonly _tag: "CompletedFocus";
|
|
81
79
|
} | {
|
|
82
80
|
readonly _tag: "ClickedToggle";
|
|
@@ -86,6 +84,8 @@ export declare const update: (model: Model, message: Message) => Readonly<{
|
|
|
86
84
|
readonly _tag: "CompletedPlaceSlip";
|
|
87
85
|
} | {
|
|
88
86
|
readonly _tag: "LeftSlip";
|
|
87
|
+
} | {
|
|
88
|
+
readonly _tag: "PressedEscape";
|
|
89
89
|
} | {
|
|
90
90
|
readonly _tag: "PressedTab";
|
|
91
91
|
} | {
|
|
@@ -125,11 +125,11 @@ export declare const BindSlip: Mount.MountDefinitionWithArgs<"BindSlip", {
|
|
|
125
125
|
isEnd: Schema.Boolean;
|
|
126
126
|
edge: Schema.Literals<readonly ["First", "Last"]>;
|
|
127
127
|
}, {
|
|
128
|
-
readonly _tag: "PressedEscape";
|
|
129
|
-
} | {
|
|
130
128
|
readonly _tag: "CompletedPlaceSlip";
|
|
131
129
|
} | {
|
|
132
130
|
readonly _tag: "LeftSlip";
|
|
131
|
+
} | {
|
|
132
|
+
readonly _tag: "PressedEscape";
|
|
133
133
|
} | {
|
|
134
134
|
readonly _tag: "PressedTab";
|
|
135
135
|
}>;
|
|
@@ -174,8 +174,6 @@ export declare const view: import("foldkit/submodel").View<{
|
|
|
174
174
|
readonly isOpen: boolean;
|
|
175
175
|
readonly edge: "First" | "Last";
|
|
176
176
|
}, {
|
|
177
|
-
readonly _tag: "PressedEscape";
|
|
178
|
-
} | {
|
|
179
177
|
readonly _tag: "CompletedFocus";
|
|
180
178
|
} | {
|
|
181
179
|
readonly _tag: "ClickedToggle";
|
|
@@ -185,6 +183,8 @@ export declare const view: import("foldkit/submodel").View<{
|
|
|
185
183
|
readonly _tag: "CompletedPlaceSlip";
|
|
186
184
|
} | {
|
|
187
185
|
readonly _tag: "LeftSlip";
|
|
186
|
+
} | {
|
|
187
|
+
readonly _tag: "PressedEscape";
|
|
188
188
|
} | {
|
|
189
189
|
readonly _tag: "PressedTab";
|
|
190
190
|
} | {
|
|
@@ -32,6 +32,9 @@ export type MeterConfig = Readonly<{
|
|
|
32
32
|
/** Replaces the printed numbers and what screen readers hear:
|
|
33
33
|
* `"41,200 of 50,000 requests"`. */
|
|
34
34
|
valueText?: string;
|
|
35
|
+
/** Prints the numbers line (the default). Leave it out where it would repeat the
|
|
36
|
+
* percentage (`valueText: "62% used"`); screen readers still hear `valueText`. */
|
|
37
|
+
hasNumbers?: boolean;
|
|
35
38
|
/** In a red chip once the value reaches `max`. The percentage by default. */
|
|
36
39
|
full?: string;
|
|
37
40
|
/** The last reading failed: the cells print muted, the numbers are the last known, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meter.d.ts","sourceRoot":"","sources":["../../../src/meter/meter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAatD,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,uDAAuD;IACvD,EAAE,EAAE,MAAM,CAAC;IACX,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AASH;0EAC0E;AAC1E,eAAO,MAAM,SAAS,GAAI,OAAO,UAAU,WAAW,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAmBjF,CAAC;AAIF,iCAAiC;AACjC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,uDAAuD;IACvD,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,MAAM,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC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AG,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;yCACqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;uFACmF;IACnF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;kBAEc;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,IAAI,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACrC,CAAC,CAAC;AAwFH,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,UAAU,cAAc,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAMjF,CAAC"}
|
package/dist/src/meter/meter.js
CHANGED
|
@@ -48,7 +48,7 @@ const percentView = (config, percent, isFull, h) => {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
const meterView = (config, h) => {
|
|
51
|
-
const { id, label, value, max, detail = [], foot = [], isStale = false } = config;
|
|
51
|
+
const { id, label, value, max, detail = [], foot = [], isStale = false, hasNumbers = true, } = config;
|
|
52
52
|
const share = max > 0 ? Math.min(1, Math.max(0, value / max)) : 0;
|
|
53
53
|
const isFull = value >= max;
|
|
54
54
|
const numbers = config.valueText ?? numbersText(value, max, config.unit);
|
|
@@ -66,7 +66,7 @@ const meterView = (config, h) => {
|
|
|
66
66
|
h.div([h.Class("meter-line")], [
|
|
67
67
|
h.span([...groups.meter, h.Class("cells")], cellRowView(METER_CELLS, scaled(share, METER_CELLS, isFull), h)),
|
|
68
68
|
percentView(config, scaled(share, PERCENT, isFull), isFull, h),
|
|
69
|
-
h.span([h.Class("meter-num tnum")], [numbers]),
|
|
69
|
+
...(hasNumbers ? [h.span([h.Class("meter-num tnum")], [numbers])] : []),
|
|
70
70
|
]),
|
|
71
71
|
...slotView("div", "meter-foot", foot, h),
|
|
72
72
|
])), "@gjermundgaraba-designs/pixel-paper/src/meter/meter.js#toView~2"),
|
|
@@ -79,4 +79,7 @@ const meterView = (config, h) => {
|
|
|
79
79
|
* the numbers in English, a foot line. The cells are the `meter`, named by the printed label,
|
|
80
80
|
* with the value, the maximum and the numbers in words for screen readers.
|
|
81
81
|
*/
|
|
82
|
-
export const listView = (config, h) => __foldkitBrandViewResult((h.ul(
|
|
82
|
+
export const listView = (config, h) => __foldkitBrandViewResult((h.ul(
|
|
83
|
+
// NOTE: Safari takes list semantics from a list printed without markers, so the list
|
|
84
|
+
// says it is one
|
|
85
|
+
[h.Role("list"), h.Class("meters")], Array.map(config.meters, (meter) => __foldkitBrandViewResult((meterView(meter, h)), "@gjermundgaraba-designs/pixel-paper/src/meter/meter.js#anonymous~2")))), "@gjermundgaraba-designs/pixel-paper/src/meter/meter.js#listView");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/remote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { view } from "./remote.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AsyncData } from "foldkit";
|
|
2
|
+
import type { Html, HtmlBuilder } from "foldkit/html";
|
|
3
|
+
/** Configuration for rendering data that loads with `view`. */
|
|
4
|
+
export type ViewConfig<Data, Error, Message> = Readonly<{
|
|
5
|
+
/** The loading line's id, unique in the document. Retry takes its button away with the
|
|
6
|
+
* notice, so return `Focus.Focus({ id })` with the retry: focus lands on the line, which
|
|
7
|
+
* says a first load and stays quiet over a refresh. */
|
|
8
|
+
id: string;
|
|
9
|
+
data: AsyncData.AsyncData<Data, Error>;
|
|
10
|
+
/** What loads, as a noun in the words around it: `"usage"` reads "loading usage", "Usage
|
|
11
|
+
* not loaded" and "Usage not refreshed". */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Why a load failed, in a sentence, under the notice's title. */
|
|
14
|
+
toErrorText: (error: Error) => string;
|
|
15
|
+
/** Loads it again: the notice's retry button, on a failure and on stale data alike. */
|
|
16
|
+
onRetry: Message;
|
|
17
|
+
/** The data, loaded or the last loaded (an EmptyState for none is the caller's). */
|
|
18
|
+
toDataView: (data: Data) => ReadonlyArray<Html>;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Data that loads, in each of Foldkit's `AsyncData` states, with the retry built in: a Loading
|
|
22
|
+
* line while it first loads (in place in every state, so its status is heard), an error
|
|
23
|
+
* Notice with retry when it failed with nothing to show, a warn Notice with retry above the
|
|
24
|
+
* last data when a refresh failed (stale), and the data itself once loaded or while it
|
|
25
|
+
* refreshes, quietly, so a page that polls is not heard each time. Spread it where the
|
|
26
|
+
* content goes.
|
|
27
|
+
*/
|
|
28
|
+
export declare const view: <Data, Error, Message>(config: ViewConfig<Data, Error, Message>, h: HtmlBuilder<Message>) => ReadonlyArray<Html>;
|
|
29
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../src/remote/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQtD,+DAA+D;AAC/D,MAAM,MAAM,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,IAAI,QAAQ,CAAC;IACtD;;4DAEwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvC;iDAC6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;IACtC,uFAAuF;IACvF,OAAO,EAAE,OAAO,CAAC;IACjB,oFAAoF;IACpF,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC;CACjD,CAAC,CAAC;AAIH;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAI,IAAI,EAAE,KAAK,EAAE,OAAO,UAC/B,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KACrC,WAAW,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,IAAI,CAmCpB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { AsyncData } from "foldkit";
|
|
3
|
+
import * as Button from "../button/button.js";
|
|
4
|
+
import * as Loading from "../loading/loading.js";
|
|
5
|
+
import * as Notice from "../notice/notice.js";
|
|
6
|
+
const capitalised = (label) => __foldkitBrandViewResult((`${label.charAt(0).toUpperCase()}${label.slice(1)}`), "@gjermundgaraba-designs/pixel-paper/src/remote/remote.js#capitalised");
|
|
7
|
+
/**
|
|
8
|
+
* Data that loads, in each of Foldkit's `AsyncData` states, with the retry built in: a Loading
|
|
9
|
+
* line while it first loads (in place in every state, so its status is heard), an error
|
|
10
|
+
* Notice with retry when it failed with nothing to show, a warn Notice with retry above the
|
|
11
|
+
* last data when a refresh failed (stale), and the data itself once loaded or while it
|
|
12
|
+
* refreshes, quietly, so a page that polls is not heard each time. Spread it where the
|
|
13
|
+
* content goes.
|
|
14
|
+
*/
|
|
15
|
+
export const view = (config, h) => {
|
|
16
|
+
const { id, data, label, toErrorText, onRetry, toDataView } = config;
|
|
17
|
+
const noticeView = (tone, title, error) => __foldkitBrandViewResult((Notice.view({
|
|
18
|
+
tone,
|
|
19
|
+
title,
|
|
20
|
+
body: [toErrorText(error)],
|
|
21
|
+
actions: [Button.view({ label: "retry", isSmall: true, onClick: onRetry }, h)],
|
|
22
|
+
}, h)), "@gjermundgaraba-designs/pixel-paper/src/remote/remote.js#noticeView");
|
|
23
|
+
return __foldkitBrandViewResult(([
|
|
24
|
+
Loading.view({
|
|
25
|
+
isLoading: AsyncData.isLoading(data),
|
|
26
|
+
label: `loading ${label}`,
|
|
27
|
+
attributes: [h.Id(id), h.Tabindex(-1)],
|
|
28
|
+
}, h),
|
|
29
|
+
...AsyncData.match(data, {
|
|
30
|
+
onIdle: () => __foldkitBrandViewResult(([]), "@gjermundgaraba-designs/pixel-paper/src/remote/remote.js#onIdle"),
|
|
31
|
+
onLoading: () => __foldkitBrandViewResult(([]), "@gjermundgaraba-designs/pixel-paper/src/remote/remote.js#onLoading"),
|
|
32
|
+
onFailure: (error) => __foldkitBrandViewResult(([noticeView("Error", `${capitalised(label)} not loaded`, error)]), "@gjermundgaraba-designs/pixel-paper/src/remote/remote.js#onFailure"),
|
|
33
|
+
onStale: ({ error, data: lastData }) => __foldkitBrandViewResult(([
|
|
34
|
+
noticeView("Warn", `${capitalised(label)} not refreshed`, error),
|
|
35
|
+
...toDataView(lastData),
|
|
36
|
+
]), "@gjermundgaraba-designs/pixel-paper/src/remote/remote.js#onStale"),
|
|
37
|
+
onRefreshing: toDataView,
|
|
38
|
+
onSuccess: toDataView,
|
|
39
|
+
}),
|
|
40
|
+
]), "@gjermundgaraba-designs/pixel-paper/src/remote/remote.js#view");
|
|
41
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ScrollToFragment, view } from "./skipLink.ts";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/skipLink/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/skipLink/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ScrollToFragment, view } from "./skipLink.js";
|
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import * as Command from "foldkit/command";
|
|
2
3
|
import type { Html, HtmlBuilder } from "foldkit/html";
|
|
4
|
+
/** What `ScrollToFragment` reports. An application that runs it puts
|
|
5
|
+
* `CompletedScrollToFragment: {}` in its own Message union, which this tag matches. */
|
|
6
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
7
|
+
readonly CompletedScrollToFragment: {};
|
|
8
|
+
}>;
|
|
9
|
+
export type Message = typeof Message.Type;
|
|
3
10
|
/**
|
|
4
11
|
* The first thing in the page: a link to the main landmark (`#main`, as Deck, Stage and Wall render it), hidden until it holds the
|
|
5
12
|
* keyboard. A Foldkit application routes every link click through its own update, so its
|
|
6
|
-
* fragment handler must move focus to the target as the browser would:
|
|
7
|
-
*
|
|
13
|
+
* fragment handler must move focus to the target as the browser would: return
|
|
14
|
+
* `ScrollToFragment` for a changed URL.
|
|
8
15
|
*/
|
|
9
16
|
export declare const view: <Message>(h: HtmlBuilder<Message>) => Html;
|
|
17
|
+
/** Moves focus to the element a fragment names, making it focusable when it is not;
|
|
18
|
+
* `ScrollToFragment` runs it. */
|
|
19
|
+
export declare const focusFragment: (fragment: string) => Effect.Effect<void>;
|
|
10
20
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
21
|
+
* What a followed link does without an application in the way, for the application's URL
|
|
22
|
+
* handler to return when the URL changes: with a fragment, scrolls to the element it names and
|
|
23
|
+
* moves focus to it, making it focusable (`tabindex="-1"`) when it is not, so the next Tab
|
|
24
|
+
* continues from there (nothing when no element has that id); without one, scrolls to the
|
|
25
|
+
* top, since Foldkit reports a link followed and a step through history as the same change, so
|
|
26
|
+
* a new page opens at its top either way. Reports `CompletedScrollToFragment`.
|
|
15
27
|
*/
|
|
16
|
-
export declare const
|
|
28
|
+
export declare const ScrollToFragment: Command.CommandDefinitionWithArgs<"ScrollToFragment", {
|
|
29
|
+
maybeFragment: Schema.Option<Schema.String>;
|
|
30
|
+
}, Effect.Effect<{
|
|
31
|
+
readonly _tag: "CompletedScrollToFragment";
|
|
32
|
+
}, never, never>>;
|
|
17
33
|
//# sourceMappingURL=skipLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skipLink.d.ts","sourceRoot":"","sources":["../../../src/skipLink/skipLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"skipLink.d.ts","sourceRoot":"","sources":["../../../src/skipLink/skipLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKtD;wFACwF;AACxF,eAAO,MAAM,OAAO;;EAAwD,CAAC;AAC7E,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAI1C;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,OAAO,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IACM,CAAC;AAI/D;kCACkC;AAClC,eAAO,MAAM,aAAa,aAAc,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAGhE,CAAC;AAIJ;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;;;;iBAY3B,CAAC"}
|
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Effect } from "effect";
|
|
2
|
+
import { Effect, Option, Schema } from "effect";
|
|
3
|
+
import * as Command from "foldkit/command";
|
|
3
4
|
import * as Dom from "foldkit/dom";
|
|
5
|
+
import { defineMessageUnion } from "foldkit/message";
|
|
6
|
+
// MESSAGE
|
|
7
|
+
/** What `ScrollToFragment` reports. An application that runs it puts
|
|
8
|
+
* `CompletedScrollToFragment: {}` in its own Message union, which this tag matches. */
|
|
9
|
+
export const Message = defineMessageUnion({ CompletedScrollToFragment: {} });
|
|
4
10
|
// VIEW
|
|
5
11
|
/**
|
|
6
12
|
* The first thing in the page: a link to the main landmark (`#main`, as Deck, Stage and Wall render it), hidden until it holds the
|
|
7
13
|
* keyboard. A Foldkit application routes every link click through its own update, so its
|
|
8
|
-
* fragment handler must move focus to the target as the browser would:
|
|
9
|
-
*
|
|
14
|
+
* fragment handler must move focus to the target as the browser would: return
|
|
15
|
+
* `ScrollToFragment` for a changed URL.
|
|
10
16
|
*/
|
|
11
17
|
export const view = (h) => __foldkitBrandViewResult((h.a([h.Href("#main"), h.Class("skip")], ["Skip to content"])), "@gjermundgaraba-designs/pixel-paper/src/skipLink/skipLink.js#view");
|
|
12
18
|
// FOCUS
|
|
19
|
+
/** Moves focus to the element a fragment names, making it focusable when it is not;
|
|
20
|
+
* `ScrollToFragment` runs it. */
|
|
21
|
+
export const focusFragment = (fragment) => __foldkitBrandViewResult((Effect.suspend(() => __foldkitBrandViewResult((Dom.focus(`#${CSS.escape(fragment)}`, { makeFocusable: true })), "@gjermundgaraba-designs/pixel-paper/src/skipLink/skipLink.js#anonymous")).pipe(Effect.ignore)), "@gjermundgaraba-designs/pixel-paper/src/skipLink/skipLink.js#focusFragment");
|
|
22
|
+
// COMMAND
|
|
13
23
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
24
|
+
* What a followed link does without an application in the way, for the application's URL
|
|
25
|
+
* handler to return when the URL changes: with a fragment, scrolls to the element it names and
|
|
26
|
+
* moves focus to it, making it focusable (`tabindex="-1"`) when it is not, so the next Tab
|
|
27
|
+
* continues from there (nothing when no element has that id); without one, scrolls to the
|
|
28
|
+
* top, since Foldkit reports a link followed and a step through history as the same change, so
|
|
29
|
+
* a new page opens at its top either way. Reports `CompletedScrollToFragment`.
|
|
18
30
|
*/
|
|
19
|
-
export const
|
|
31
|
+
export const ScrollToFragment = Command.define("ScrollToFragment", {
|
|
32
|
+
args: { maybeFragment: Schema.Option(Schema.String) },
|
|
33
|
+
messages: [Message.CompletedScrollToFragment],
|
|
34
|
+
execute: ({ maybeFragment }) => __foldkitBrandViewResult((Option.match(maybeFragment, {
|
|
35
|
+
onNone: () => __foldkitBrandViewResult((Effect.sync(() => __foldkitBrandViewResult((window.scrollTo(0, 0)), "@gjermundgaraba-designs/pixel-paper/src/skipLink/skipLink.js#anonymous~2"))), "@gjermundgaraba-designs/pixel-paper/src/skipLink/skipLink.js#onNone"),
|
|
36
|
+
onSome: (fragment) => __foldkitBrandViewResult((Dom.scrollIntoView(`#${CSS.escape(fragment)}`).pipe(Effect.ignore, Effect.andThen(focusFragment(fragment)))), "@gjermundgaraba-designs/pixel-paper/src/skipLink/skipLink.js#onSome"),
|
|
37
|
+
}).pipe(Effect.as(Message.CompletedScrollToFragment()))), "@gjermundgaraba-designs/pixel-paper/src/skipLink/skipLink.js#execute"),
|
|
38
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sortable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,IAAI,EACJ,OAAO,EACP,KAAK,EACL,UAAU,EACV,cAAc,EACd,IAAI,EACJ,UAAU,EACV,aAAa,EACb,MAAM,EACN,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AnnounceReorder, Item, Message, Model, OutMessage, SizeLiftedItem, init, setMovable, subscriptions, update, view, } from "./sortable.js";
|