@gjermundgaraba/pixel-paper 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/announcer/announcer.d.ts +35 -0
- package/dist/announcer/announcer.js +121 -0
- package/dist/announcer/index.d.ts +5 -0
- package/dist/announcer/index.js +11 -0
- package/dist/attributes/attributes.d.ts +4 -0
- package/dist/banner/banner.d.ts +20 -0
- package/dist/banner/banner.js +18 -0
- package/dist/banner/index.d.ts +5 -0
- package/dist/banner/index.js +6 -0
- package/dist/bench/bench.d.ts +16 -0
- package/dist/bench/bench.js +12 -0
- package/dist/bench/index.d.ts +5 -0
- package/dist/bench/index.js +6 -0
- package/dist/board/board.d.ts +1151 -0
- package/dist/board/board.js +449 -0
- package/dist/board/index.d.ts +6 -0
- package/dist/board/index.js +21 -0
- package/dist/button/button.d.ts +54 -0
- package/dist/button/button.js +50 -0
- package/dist/button/index.d.ts +5 -0
- package/dist/button/index.js +9 -0
- package/dist/card/card.d.ts +66 -0
- package/dist/card/card.js +70 -0
- package/dist/card/index.d.ts +5 -0
- package/dist/card/index.js +10 -0
- package/dist/chip/chip.d.ts +27 -0
- package/dist/chip/chip.js +34 -0
- package/dist/chip/index.d.ts +5 -0
- package/dist/chip/index.js +9 -0
- package/dist/choice/choice.d.ts +16 -0
- package/dist/choice/choice.js +17 -0
- package/dist/choice/index.d.ts +5 -0
- package/dist/choice/index.js +6 -0
- package/dist/code-editor/code-editor.d.ts +15 -0
- package/dist/code-editor/code-editor.js +22 -0
- package/dist/code-editor/index.d.ts +5 -0
- package/dist/code-editor/index.js +6 -0
- package/dist/code-surface/code-surface.d.ts +12 -0
- package/dist/code-surface/code-surface.js +12 -0
- package/dist/code-surface/index.d.ts +5 -0
- package/dist/code-surface/index.js +6 -0
- package/dist/command-palette/command-palette.d.ts +579 -0
- package/dist/command-palette/command-palette.js +600 -0
- package/dist/command-palette/index.d.ts +9 -0
- package/dist/command-palette/index.js +32 -0
- package/dist/command-palette/keys.d.ts +13 -0
- package/dist/command-palette/keys.js +71 -0
- package/dist/command-palette/match.d.ts +43 -0
- package/dist/command-palette/match.js +45 -0
- package/dist/command-palette/message.d.ts +94 -0
- package/dist/command-palette/message.js +46 -0
- package/dist/confirm-dialog/confirm-dialog.d.ts +287 -0
- package/dist/confirm-dialog/confirm-dialog.js +115 -0
- package/dist/confirm-dialog/index.d.ts +5 -0
- package/dist/confirm-dialog/index.js +17 -0
- package/dist/copy-button/copy-button.d.ts +99 -0
- package/dist/copy-button/copy-button.js +96 -0
- package/dist/copy-button/index.d.ts +5 -0
- package/dist/copy-button/index.js +13 -0
- package/dist/crumbs/crumbs.d.ts +15 -0
- package/dist/crumbs/crumbs.js +11 -0
- package/dist/crumbs/index.d.ts +5 -0
- package/dist/crumbs/index.js +6 -0
- package/dist/deck/deck.d.ts +9 -0
- package/dist/deck/deck.js +9 -0
- package/dist/deck/index.d.ts +5 -0
- package/dist/deck/index.js +6 -0
- package/dist/dialog/dialog.d.ts +278 -0
- package/dist/dialog/dialog.js +145 -0
- package/dist/dialog/fold.d.ts +58 -0
- package/dist/dialog/fold.js +63 -0
- package/dist/dialog/index.d.ts +6 -0
- package/dist/dialog/index.js +21 -0
- package/dist/disclosure/disclosure.d.ts +24 -0
- package/dist/disclosure/disclosure.js +25 -0
- package/dist/disclosure/index.d.ts +5 -0
- package/dist/disclosure/index.js +6 -0
- package/dist/dom/html-element.js +8 -0
- package/dist/drag/drag.d.ts +15 -0
- package/dist/drag/drag.js +123 -0
- package/dist/drop-zone/drop-zone.d.ts +119 -0
- package/dist/drop-zone/drop-zone.js +64 -0
- package/dist/drop-zone/index.d.ts +5 -0
- package/dist/drop-zone/index.js +14 -0
- package/dist/empty-state/empty-state.d.ts +18 -0
- package/dist/empty-state/empty-state.js +16 -0
- package/dist/empty-state/index.d.ts +5 -0
- package/dist/empty-state/index.js +6 -0
- package/dist/error-summary/error-summary.d.ts +34 -0
- package/dist/error-summary/error-summary.js +33 -0
- package/dist/error-summary/index.d.ts +5 -0
- package/dist/error-summary/index.js +6 -0
- package/dist/field/field.d.ts +35 -0
- package/dist/field/field.js +34 -0
- package/dist/field/index.d.ts +5 -0
- package/dist/field/index.js +6 -0
- package/dist/field-grid/field-grid.d.ts +8 -0
- package/dist/field-grid/field-grid.js +8 -0
- package/dist/field-grid/index.d.ts +5 -0
- package/dist/field-grid/index.js +6 -0
- package/dist/fields/fields.js +9 -0
- package/dist/fieldset/fieldset.d.ts +13 -0
- package/dist/fieldset/fieldset.js +13 -0
- package/dist/fieldset/index.d.ts +5 -0
- package/dist/fieldset/index.js +6 -0
- package/dist/filter-chip/filter-chip.d.ts +21 -0
- package/dist/filter-chip/filter-chip.js +28 -0
- package/dist/filter-chip/index.d.ts +5 -0
- package/dist/filter-chip/index.js +6 -0
- package/dist/filter-strip/filter-strip.d.ts +12 -0
- package/dist/filter-strip/filter-strip.js +13 -0
- package/dist/filter-strip/index.d.ts +5 -0
- package/dist/filter-strip/index.js +6 -0
- package/dist/flash-word/flash-word.d.ts +31 -0
- package/dist/flash-word/flash-word.js +31 -0
- package/dist/flash-word/index.d.ts +5 -0
- package/dist/flash-word/index.js +9 -0
- package/dist/focus/focus.d.ts +15 -0
- package/dist/focus/focus.js +17 -0
- package/dist/focus/index.d.ts +5 -0
- package/dist/focus/index.js +9 -0
- package/dist/format/format.js +52 -0
- package/dist/format/index.d.ts +5 -0
- package/dist/format/index.js +6 -0
- package/dist/glyph/glyph.d.ts +9 -0
- package/dist/glyph/glyph.js +25 -0
- package/dist/glyph/glyphs.d.ts +381 -0
- package/dist/glyph/glyphs.js +2603 -0
- package/dist/glyph/index.d.ts +5 -0
- package/dist/glyph/index.js +6 -0
- package/dist/group/group.d.ts +8 -0
- package/dist/group/group.js +9 -0
- package/dist/group/index.d.ts +5 -0
- package/dist/group/index.js +6 -0
- package/dist/history/history.d.ts +34 -0
- package/dist/history/history.js +15 -0
- package/dist/history/index.d.ts +5 -0
- package/dist/history/index.js +6 -0
- package/dist/icon-button/icon-button.d.ts +23 -0
- package/dist/icon-button/icon-button.js +23 -0
- package/dist/icon-button/index.d.ts +5 -0
- package/dist/icon-button/index.js +6 -0
- package/dist/identity/identity.d.ts +15 -0
- package/dist/identity/identity.js +15 -0
- package/dist/identity/index.d.ts +5 -0
- package/dist/identity/index.js +6 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +85 -0
- package/dist/inline-input/index.d.ts +5 -0
- package/dist/inline-input/index.js +20 -0
- package/dist/inline-input/inline-input.d.ts +196 -0
- package/dist/inline-input/inline-input.js +212 -0
- package/dist/key-help/index.d.ts +5 -0
- package/dist/key-help/index.js +18 -0
- package/dist/key-help/key-help.d.ts +255 -0
- package/dist/key-help/key-help.js +137 -0
- package/dist/key-hint/index.d.ts +6 -0
- package/dist/key-hint/index.js +12 -0
- package/dist/key-hint/key-hint.d.ts +13 -0
- package/dist/key-hint/key-hint.js +7 -0
- package/dist/key-hint/key-label.d.ts +18 -0
- package/dist/key-hint/key-label.js +77 -0
- package/dist/keymap/keymap.d.ts +11 -0
- package/dist/keymap/keymap.js +9 -0
- package/dist/keys/keys.js +4 -0
- package/dist/line-diff/diff.d.ts +2 -0
- package/dist/line-diff/diff.js +73 -0
- package/dist/line-diff/index.d.ts +6 -0
- package/dist/line-diff/index.js +10 -0
- package/dist/line-diff/line-diff.d.ts +21 -0
- package/dist/line-diff/line-diff.js +75 -0
- package/dist/line-diff/patch.d.ts +15 -0
- package/dist/line-diff/patch.js +120 -0
- package/dist/link-button/index.d.ts +5 -0
- package/dist/link-button/index.js +6 -0
- package/dist/link-button/link-button.d.ts +11 -0
- package/dist/link-button/link-button.js +10 -0
- package/dist/link-state/index.d.ts +5 -0
- package/dist/link-state/index.js +6 -0
- package/dist/link-state/link-state.d.ts +15 -0
- package/dist/link-state/link-state.js +17 -0
- package/dist/live-region/index.d.ts +5 -0
- package/dist/live-region/index.js +9 -0
- package/dist/live-region/live-region.d.ts +39 -0
- package/dist/live-region/live-region.js +33 -0
- package/dist/loading/index.d.ts +5 -0
- package/dist/loading/index.js +6 -0
- package/dist/loading/loading.d.ts +19 -0
- package/dist/loading/loading.js +16 -0
- package/dist/locale/locale.d.ts +3 -0
- package/dist/locale/locale.js +5 -0
- package/dist/mark/index.d.ts +5 -0
- package/dist/mark/index.js +6 -0
- package/dist/mark/mark.d.ts +15 -0
- package/dist/mark/mark.js +30 -0
- package/dist/menu/index.d.ts +7 -0
- package/dist/menu/index.js +25 -0
- package/dist/menu/item.d.ts +236 -0
- package/dist/menu/item.js +19 -0
- package/dist/menu/menu.d.ts +206 -0
- package/dist/menu/menu.js +208 -0
- package/dist/menu/slip.js +163 -0
- package/dist/meter/index.d.ts +5 -0
- package/dist/meter/index.js +6 -0
- package/dist/meter/meter.d.ts +38 -0
- package/dist/meter/meter.js +69 -0
- package/dist/monogram/monogram.js +33 -0
- package/dist/nav-strip/index.d.ts +5 -0
- package/dist/nav-strip/index.js +6 -0
- package/dist/nav-strip/nav-strip.d.ts +19 -0
- package/dist/nav-strip/nav-strip.js +21 -0
- package/dist/notice/index.d.ts +5 -0
- package/dist/notice/index.js +6 -0
- package/dist/notice/notice.d.ts +23 -0
- package/dist/notice/notice.js +35 -0
- package/dist/outcome/index.d.ts +5 -0
- package/dist/outcome/index.js +6 -0
- package/dist/outcome/outcome.d.ts +19 -0
- package/dist/outcome/outcome.js +14 -0
- package/dist/page-head/index.d.ts +5 -0
- package/dist/page-head/index.js +6 -0
- package/dist/page-head/page-head.d.ts +13 -0
- package/dist/page-head/page-head.js +10 -0
- package/dist/panel/index.d.ts +5 -0
- package/dist/panel/index.js +6 -0
- package/dist/panel/panel.d.ts +35 -0
- package/dist/panel/panel.js +25 -0
- package/dist/password-field/index.d.ts +5 -0
- package/dist/password-field/index.js +6 -0
- package/dist/password-field/password-field.d.ts +33 -0
- package/dist/password-field/password-field.js +39 -0
- package/dist/places/index.d.ts +5 -0
- package/dist/places/index.js +6 -0
- package/dist/places/places.d.ts +32 -0
- package/dist/places/places.js +22 -0
- package/dist/props-list/index.d.ts +5 -0
- package/dist/props-list/index.js +6 -0
- package/dist/props-list/props-list.d.ts +18 -0
- package/dist/props-list/props-list.js +12 -0
- package/dist/prose/index.d.ts +5 -0
- package/dist/prose/index.js +6 -0
- package/dist/prose/prose.d.ts +14 -0
- package/dist/prose/prose.js +6 -0
- package/dist/query-chip/index.d.ts +5 -0
- package/dist/query-chip/index.js +6 -0
- package/dist/query-chip/query-chip.d.ts +18 -0
- package/dist/query-chip/query-chip.js +17 -0
- package/dist/radio-choices/index.d.ts +5 -0
- package/dist/radio-choices/index.js +12 -0
- package/dist/radio-choices/radio-choices.d.ts +105 -0
- package/dist/radio-choices/radio-choices.js +56 -0
- package/dist/rail/index.d.ts +5 -0
- package/dist/rail/index.js +22 -0
- package/dist/rail/rail.d.ts +403 -0
- package/dist/rail/rail.js +355 -0
- package/dist/reel/index.d.ts +6 -0
- package/dist/reel/index.js +26 -0
- package/dist/reel/layout.d.ts +58 -0
- package/dist/reel/layout.js +378 -0
- package/dist/reel/reel.d.ts +1070 -0
- package/dist/reel/reel.js +1019 -0
- package/dist/remote/index.d.ts +5 -0
- package/dist/remote/index.js +6 -0
- package/dist/remote/remote.d.ts +28 -0
- package/dist/remote/remote.js +41 -0
- package/dist/rows/index.d.ts +5 -0
- package/dist/rows/index.js +12 -0
- package/dist/rows/rows.d.ts +116 -0
- package/dist/rows/rows.js +67 -0
- package/dist/scheme/index.d.ts +6 -0
- package/dist/scheme/index.js +10 -0
- package/dist/scheme/scheme-switch.d.ts +98 -0
- package/dist/scheme/scheme-switch.js +118 -0
- package/dist/scheme/scheme.d.ts +5 -0
- package/dist/scheme/scheme.js +16 -0
- package/dist/scheme/script.d.ts +8 -0
- package/dist/scheme/script.js +10 -0
- package/dist/secret/index.d.ts +5 -0
- package/dist/secret/index.js +6 -0
- package/dist/secret/secret.d.ts +13 -0
- package/dist/secret/secret.js +9 -0
- package/dist/segmented/index.d.ts +5 -0
- package/dist/segmented/index.js +6 -0
- package/dist/segmented/segmented.d.ts +17 -0
- package/dist/segmented/segmented.js +17 -0
- package/dist/select-field/index.d.ts +5 -0
- package/dist/select-field/index.js +6 -0
- package/dist/select-field/select-field.d.ts +38 -0
- package/dist/select-field/select-field.js +29 -0
- package/dist/sheet/index.d.ts +5 -0
- package/dist/sheet/index.js +6 -0
- package/dist/sheet/sheet.d.ts +16 -0
- package/dist/sheet/sheet.js +15 -0
- package/dist/skip-link/index.d.ts +5 -0
- package/dist/skip-link/index.js +9 -0
- package/dist/skip-link/skip-link.d.ts +23 -0
- package/dist/skip-link/skip-link.js +36 -0
- package/dist/slot/slot.js +8 -0
- package/dist/sortable/index.d.ts +5 -0
- package/dist/sortable/index.js +16 -0
- package/dist/sortable/sortable.d.ts +1125 -0
- package/dist/sortable/sortable.js +431 -0
- package/dist/stack/index.d.ts +5 -0
- package/dist/stack/index.js +6 -0
- package/dist/stack/stack.d.ts +15 -0
- package/dist/stack/stack.js +12 -0
- package/dist/stage/index.d.ts +5 -0
- package/dist/stage/index.js +6 -0
- package/dist/stage/stage.d.ts +14 -0
- package/dist/stage/stage.js +11 -0
- package/dist/stat/index.d.ts +5 -0
- package/dist/stat/index.js +6 -0
- package/dist/stat/stat.d.ts +18 -0
- package/dist/stat/stat.js +13 -0
- package/dist/status-bar/index.d.ts +6 -0
- package/dist/status-bar/index.js +11 -0
- package/dist/status-bar/status-bar.d.ts +28 -0
- package/dist/status-bar/status-bar.js +19 -0
- package/dist/subscription/prefix-keys.js +12 -0
- package/dist/table/index.d.ts +5 -0
- package/dist/table/index.js +6 -0
- package/dist/table/table.d.ts +26 -0
- package/dist/table/table.js +18 -0
- package/dist/tabs/index.d.ts +5 -0
- package/dist/tabs/index.js +14 -0
- package/dist/tabs/tabs.d.ts +125 -0
- package/dist/tabs/tabs.js +57 -0
- package/dist/tag/index.d.ts +5 -0
- package/dist/tag/index.js +6 -0
- package/dist/tag/tag.d.ts +16 -0
- package/dist/tag/tag.js +25 -0
- package/dist/text-button/index.d.ts +5 -0
- package/dist/text-button/index.js +6 -0
- package/dist/text-button/text-button.d.ts +8 -0
- package/dist/text-button/text-button.js +12 -0
- package/dist/textarea-field/index.d.ts +5 -0
- package/dist/textarea-field/index.js +6 -0
- package/dist/textarea-field/textarea-field.d.ts +28 -0
- package/dist/textarea-field/textarea-field.js +30 -0
- package/dist/time/index.d.ts +5 -0
- package/dist/time/index.js +9 -0
- package/dist/time/time.d.ts +38 -0
- package/dist/time/time.js +63 -0
- package/dist/tips/index.d.ts +5 -0
- package/dist/tips/index.js +14 -0
- package/dist/tips/tips.d.ts +339 -0
- package/dist/tips/tips.js +308 -0
- package/dist/toast/index.d.ts +5 -0
- package/dist/toast/index.js +17 -0
- package/dist/toast/stack.d.ts +7 -0
- package/dist/toast/stack.js +23 -0
- package/dist/toast/toast.d.ts +559 -0
- package/dist/toast/toast.js +269 -0
- package/dist/toc/index.d.ts +5 -0
- package/dist/toc/index.js +9 -0
- package/dist/toc/toc.d.ts +42 -0
- package/dist/toc/toc.js +35 -0
- package/dist/top-bar/bar-height.d.ts +26 -0
- package/dist/top-bar/bar-height.js +43 -0
- package/dist/top-bar/index.d.ts +6 -0
- package/dist/top-bar/index.js +12 -0
- package/dist/top-bar/top-bar.d.ts +19 -0
- package/dist/top-bar/top-bar.js +18 -0
- package/dist/wall/index.d.ts +5 -0
- package/dist/wall/index.js +9 -0
- package/dist/wall/wall.d.ts +16 -0
- package/dist/wall/wall.js +15 -0
- package/dist/window/index.d.ts +5 -0
- package/dist/window/index.js +6 -0
- package/dist/window/window.d.ts +28 -0
- package/dist/window/window.js +29 -0
- package/dist/wordmark/index.d.ts +5 -0
- package/dist/wordmark/index.js +6 -0
- package/dist/wordmark/wordmark.d.ts +10 -0
- package/dist/wordmark/wordmark.js +10 -0
- package/dist/wrap/index.d.ts +5 -0
- package/dist/wrap/index.js +6 -0
- package/dist/wrap/wrap.d.ts +12 -0
- package/dist/wrap/wrap.js +9 -0
- package/fonts/DepartureMono-Regular.woff2 +0 -0
- package/fonts/LICENSE.txt +2 -0
- package/package.json +57 -3
- package/src/pixel-paper.css +4611 -0
- package/src/tokens.css +151 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { view } from "./remote.js";
|
|
4
|
+
// src/remote/index.ts
|
|
5
|
+
var remote_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/remote/index.js#view") });
|
|
6
|
+
export { remote_exports, view };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Html, HtmlBuilder } from "foldkit/html";
|
|
2
|
+
import { AsyncData } from "foldkit";
|
|
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) => readonly 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>) => readonly Html[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { view as view$1 } from "../notice/notice.js";
|
|
3
|
+
import { view as view$2 } from "../button/button.js";
|
|
4
|
+
import { view as view$3 } from "../loading/loading.js";
|
|
5
|
+
import { AsyncData } from "foldkit";
|
|
6
|
+
// src/remote/remote.ts
|
|
7
|
+
const capitalised = (label) => __foldkitBrandViewResult((`${label.charAt(0).toUpperCase()}${label.slice(1)}`), "@gjermundgaraba/pixel-paper/remote/remote.js#capitalised");
|
|
8
|
+
/**
|
|
9
|
+
* Data that loads, in each of Foldkit's `AsyncData` states, with the retry built in: a Loading
|
|
10
|
+
* line while it first loads (in place in every state, so its status is heard), an error
|
|
11
|
+
* Notice with retry when it failed with nothing to show, a warn Notice with retry above the
|
|
12
|
+
* last data when a refresh failed (stale), and the data itself once loaded or while it
|
|
13
|
+
* refreshes, quietly, so a page that polls is not heard each time. Spread it where the
|
|
14
|
+
* content goes.
|
|
15
|
+
*/
|
|
16
|
+
const view = (config, h) => {
|
|
17
|
+
const { id, data, label, toErrorText, onRetry, toDataView } = config;
|
|
18
|
+
const noticeView = (tone, title, error) => __foldkitBrandViewResult((view$1({
|
|
19
|
+
tone,
|
|
20
|
+
title,
|
|
21
|
+
body: [toErrorText(error)],
|
|
22
|
+
actions: [view$2({
|
|
23
|
+
label: "retry",
|
|
24
|
+
isSmall: true,
|
|
25
|
+
onClick: onRetry
|
|
26
|
+
}, h)]
|
|
27
|
+
}, h)), "@gjermundgaraba/pixel-paper/remote/remote.js#noticeView");
|
|
28
|
+
return __foldkitBrandViewResult(([view$3({
|
|
29
|
+
isLoading: AsyncData.isLoading(data),
|
|
30
|
+
label: `loading ${label}`,
|
|
31
|
+
attributes: [h.Id(id), h.Tabindex(-1)]
|
|
32
|
+
}, h), ...AsyncData.match(data, {
|
|
33
|
+
onIdle: () => __foldkitBrandViewResult(([]), "@gjermundgaraba/pixel-paper/remote/remote.js#onIdle"),
|
|
34
|
+
onLoading: () => __foldkitBrandViewResult(([]), "@gjermundgaraba/pixel-paper/remote/remote.js#onLoading"),
|
|
35
|
+
onFailure: (error) => __foldkitBrandViewResult(([noticeView("Error", `${capitalised(label)} not loaded`, error)]), "@gjermundgaraba/pixel-paper/remote/remote.js#onFailure"),
|
|
36
|
+
onStale: ({ error, data: lastData }) => __foldkitBrandViewResult(([noticeView("Warn", `${capitalised(label)} not refreshed`, error), ...toDataView(lastData)]), "@gjermundgaraba/pixel-paper/remote/remote.js#onStale"),
|
|
37
|
+
onRefreshing: toDataView,
|
|
38
|
+
onSuccess: toDataView
|
|
39
|
+
})]), "@gjermundgaraba/pixel-paper/remote/remote.js#view");
|
|
40
|
+
};
|
|
41
|
+
export { view };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GlyphConfig, RowConfig, TitleConfig, ToggleConfig, ViewConfig, glyphView, rowView, titleView, toggleView, view } from "./rows.js";
|
|
2
|
+
declare namespace index_d_exports {
|
|
3
|
+
export { GlyphConfig, RowConfig, TitleConfig, ToggleConfig, ViewConfig, glyphView, rowView, titleView, toggleView, view };
|
|
4
|
+
}
|
|
5
|
+
export { type GlyphConfig, type RowConfig, type TitleConfig, type ToggleConfig, type ViewConfig, glyphView, index_d_exports, rowView, titleView, toggleView, view };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { glyphView, rowView, titleView, toggleView, view } from "./rows.js";
|
|
4
|
+
// src/rows/index.ts
|
|
5
|
+
var rows_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
glyphView: () => __foldkitBrandViewResult((glyphView), "@gjermundgaraba/pixel-paper/rows/index.js#glyphView"),
|
|
7
|
+
rowView: () => __foldkitBrandViewResult((rowView), "@gjermundgaraba/pixel-paper/rows/index.js#rowView"),
|
|
8
|
+
titleView: () => __foldkitBrandViewResult((titleView), "@gjermundgaraba/pixel-paper/rows/index.js#titleView"),
|
|
9
|
+
toggleView: () => __foldkitBrandViewResult((toggleView), "@gjermundgaraba/pixel-paper/rows/index.js#toggleView"),
|
|
10
|
+
view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/rows/index.js#view")
|
|
11
|
+
});
|
|
12
|
+
export { glyphView, rowView, rows_exports, titleView, toggleView, view };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Attributes } from "../attributes/attributes.js";
|
|
2
|
+
import { GlyphName } from "../glyph/glyphs.js";
|
|
3
|
+
import { Html, HtmlBuilder } from "foldkit/html";
|
|
4
|
+
/** Configuration for rendering a list of rows with `view`. */
|
|
5
|
+
export type ViewConfig = Readonly<{
|
|
6
|
+
/** Each made with `rowView`. */
|
|
7
|
+
rows: readonly Html[];
|
|
8
|
+
/** An outline: nested rows indent 26px and hang on a 1px rule guide. */
|
|
9
|
+
isOutline?: boolean;
|
|
10
|
+
/** Names the list for screen readers; a treegrid needs it. */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** A keyboard-driven list, whose cursor the application moves (see Keys in DESIGN.md): a
|
|
13
|
+
* `role="treegrid"`, so a screen reader hands it the arrow and letter keys. Give every row
|
|
14
|
+
* its `treegrid` place. */
|
|
15
|
+
isTreegrid?: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
/** A list of 34px rows. */
|
|
18
|
+
export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
|
|
19
|
+
/** A selectable row's checkbox, held in the caller's Model. Its cell inverts while checked; the
|
|
20
|
+
* row's text is its label, so a click anywhere on the text toggles it. */
|
|
21
|
+
export type RowSelect<Message> = Readonly<{
|
|
22
|
+
/** Unique in the document: the id of the box's name is made from it. The box itself has no
|
|
23
|
+
* id. */
|
|
24
|
+
id: string;
|
|
25
|
+
isChecked: boolean;
|
|
26
|
+
/** The box's next state. */
|
|
27
|
+
onToggle: (isChecked: boolean) => Message;
|
|
28
|
+
}>;
|
|
29
|
+
/** A row's place in a treegrid (`view`'s `isTreegrid`): its line is a `role="row"` and each
|
|
30
|
+
* of its parts a `role="gridcell"`, while the list items around them step aside
|
|
31
|
+
* (`role="none"`). */
|
|
32
|
+
export type TreegridPlace = Readonly<{
|
|
33
|
+
/** Its depth, from 1 at the list's roots: `aria-level`. */
|
|
34
|
+
level: number;
|
|
35
|
+
/** Its place among its siblings, from 1: `aria-posinset`. */
|
|
36
|
+
position: number;
|
|
37
|
+
/** How many siblings it has, itself included: `aria-setsize`. */
|
|
38
|
+
setSize: number;
|
|
39
|
+
/** Whether the rows under it show, for a row that folds: `aria-expanded`. */
|
|
40
|
+
isExpanded?: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
/** Configuration for rendering a row with `rowView`. */
|
|
43
|
+
export type RowConfig<Message> = Readonly<{
|
|
44
|
+
/** The row's stable id among its siblings. */
|
|
45
|
+
key: string;
|
|
46
|
+
/** The 18px glyph slot at the left: a `glyphView`, a `toggleView`, or a status as a
|
|
47
|
+
* `Chip.dotView`. */
|
|
48
|
+
glyph?: Html;
|
|
49
|
+
/** The row's text; it takes the free width and ellipsises. */
|
|
50
|
+
body: ReadonlyArray<Html | string>;
|
|
51
|
+
/** Right-aligned chips, marks, counts, due days. */
|
|
52
|
+
slot?: ReadonlyArray<Html | string>;
|
|
53
|
+
/** Further attributes for the slot's `span.slot`, such as an id the row's line is described
|
|
54
|
+
* by (`aria-describedby`); there is no span, and so nothing to point at, while `slot` is
|
|
55
|
+
* empty. Never a class. */
|
|
56
|
+
slotAttributes?: Attributes<Message>;
|
|
57
|
+
/** Controls that belong to the row's job, before the tools (an approve and reject pair). */
|
|
58
|
+
actions?: ReadonlyArray<Html | string>;
|
|
59
|
+
/** Icon buttons at the row's right end, dimmed until the row is hovered or focused (full
|
|
60
|
+
* on the cursor row) and hidden on a phone: `span.tools`. */
|
|
61
|
+
tools?: ReadonlyArray<Html | string>;
|
|
62
|
+
/** Rows under this one, in an outline, each made with `rowView`. */
|
|
63
|
+
nested?: readonly Html[];
|
|
64
|
+
/** Outside a filter, printed only to keep a match on its chain: muted, and "(context)"
|
|
65
|
+
* after its text for screen readers, which the muting does not reach. In a selectable
|
|
66
|
+
* row the text names the box, so the box's name says it too. */
|
|
67
|
+
isContext?: boolean;
|
|
68
|
+
/** The row's text holds one link (a task, a page), and the row's whole box is its target: a
|
|
69
|
+
* press anywhere on the row follows it, while the row's own controls (the box, a toggle,
|
|
70
|
+
* the actions and tools) and whatever has a tip stay their own targets. The row takes no
|
|
71
|
+
* Tab stop of its own, and the link's ring is drawn round the row. A link that is
|
|
72
|
+
* `aria-current` inverts the row. For a list no keyboard drives: a treegrid's row (with
|
|
73
|
+
* `treegrid`) is already its own stop, and ignores it. */
|
|
74
|
+
isLink?: boolean;
|
|
75
|
+
/** Makes the row selectable: a box at its left edge. */
|
|
76
|
+
select?: RowSelect<Message>;
|
|
77
|
+
/** The row's place in a treegrid; every row of a treegrid has one. */
|
|
78
|
+
treegrid?: TreegridPlace;
|
|
79
|
+
/** Further attributes for the row's line, the `div.row`, not its `li`: a keyboard list's
|
|
80
|
+
* cursor (`aria-current="true"`, which the stylesheet outlines, and a roving `tabindex`),
|
|
81
|
+
* its name (with `role="group"` outside a treegrid, whose row is already a named `row`), data
|
|
82
|
+
* attributes, key and focus handlers. Never a class. */
|
|
83
|
+
attributes?: Attributes<Message>;
|
|
84
|
+
}>;
|
|
85
|
+
/** One 34px row: box, glyph, text, slot, actions, tools, and the rows nested under it. Hover
|
|
86
|
+
* and focus tint it head. The box of a selectable row is built on `@foldkit/ui`'s Checkbox:
|
|
87
|
+
* a `role="checkbox"` button (`aria-checked`) whose whole cell is its target. In a treegrid
|
|
88
|
+
* the line is the `role="row"` and each part a `role="gridcell"`. */
|
|
89
|
+
export declare const rowView: <Message>(config: RowConfig<Message>, h: HtmlBuilder<Message>) => Html;
|
|
90
|
+
/** Configuration for rendering a glyph slot with `glyphView`. */
|
|
91
|
+
export type GlyphConfig = Readonly<{
|
|
92
|
+
name: GlyphName;
|
|
93
|
+
}>;
|
|
94
|
+
/** A glyph in the row's 18px slot. */
|
|
95
|
+
export declare const glyphView: <Message>(config: GlyphConfig, h: HtmlBuilder<Message>) => Html;
|
|
96
|
+
/** Configuration for rendering a fold toggle with `toggleView`. */
|
|
97
|
+
export type ToggleConfig<Message> = Readonly<{
|
|
98
|
+
isExpanded: boolean;
|
|
99
|
+
/** What the nested rows hang under: the toggle is named `"Rows under Notes"` whether open
|
|
100
|
+
* or not, and `aria-expanded` says which. */
|
|
101
|
+
label: string;
|
|
102
|
+
onToggle: Message;
|
|
103
|
+
}>;
|
|
104
|
+
/** The glyph slot as a fold toggle, built on `@foldkit/ui`'s Button: a ring, open or closed,
|
|
105
|
+
* `aria-expanded`, named for the rows it shows. */
|
|
106
|
+
export declare const toggleView: <Message>(config: ToggleConfig<Message>, h: HtmlBuilder<Message>) => Html;
|
|
107
|
+
/** Configuration for rendering a row's title with `titleView`. */
|
|
108
|
+
export type TitleConfig<Message> = Readonly<{
|
|
109
|
+
label: string;
|
|
110
|
+
onOpen: Message;
|
|
111
|
+
/** Closed items print muted and struck through. */
|
|
112
|
+
isDone?: boolean;
|
|
113
|
+
}>;
|
|
114
|
+
/** The row's title as the button that opens it, built on `@foldkit/ui`'s Button; it
|
|
115
|
+
* underlines on hover. */
|
|
116
|
+
export declare const titleView: <Message>(config: TitleConfig<Message>, h: HtmlBuilder<Message>) => Html;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { view as view$1 } from "../glyph/glyph.js";
|
|
3
|
+
import { slotView } from "../slot/slot.js";
|
|
4
|
+
import { Button, Checkbox } from "@foldkit/ui";
|
|
5
|
+
// src/rows/rows.ts
|
|
6
|
+
/** A list of 34px rows. */
|
|
7
|
+
const view = (config, h) => __foldkitBrandViewResult((h.ul([
|
|
8
|
+
...config.isTreegrid === true ? [h.Role("treegrid")] : [],
|
|
9
|
+
...config.label === void 0 ? [] : [h.AriaLabel(config.label)],
|
|
10
|
+
h.Class(config.isOutline === true ? "rows tree" : "rows")
|
|
11
|
+
], config.rows)), "@gjermundgaraba/pixel-paper/rows/rows.js#view");
|
|
12
|
+
const cellRole = (config, h) => __foldkitBrandViewResult((config.treegrid === void 0 ? [] : [h.Role("gridcell")]), "@gjermundgaraba/pixel-paper/rows/rows.js#cellRole");
|
|
13
|
+
const rowRole = (place, h) => __foldkitBrandViewResult((place === void 0 ? [] : [
|
|
14
|
+
h.Role("row"),
|
|
15
|
+
h.AriaLevel(place.level),
|
|
16
|
+
h.AriaPosinset(place.position),
|
|
17
|
+
h.AriaSetsize(place.setSize),
|
|
18
|
+
...place.isExpanded === void 0 ? [] : [h.AriaExpanded(place.isExpanded)]
|
|
19
|
+
]), "@gjermundgaraba/pixel-paper/rows/rows.js#rowRole");
|
|
20
|
+
const cellView = (config, className, content, h) => __foldkitBrandViewResult((config.treegrid === void 0 ? content : slotView("span", className, content, h, cellRole(config, h))), "@gjermundgaraba/pixel-paper/rows/rows.js#cellView");
|
|
21
|
+
const textOf = (config, h) => __foldkitBrandViewResult((config.isContext === true ? [...config.body, h.span([h.Class("sr-only")], [" (context)"])] : config.body), "@gjermundgaraba/pixel-paper/rows/rows.js#textOf");
|
|
22
|
+
const lineView = (config, box, text, h) => __foldkitBrandViewResult((h.div([
|
|
23
|
+
...config.attributes ?? [],
|
|
24
|
+
...rowRole(config.treegrid, h),
|
|
25
|
+
h.Class(`row${config.isContext === true ? " context" : ""}${config.isLink === true && config.treegrid === void 0 ? " linked" : ""}`)
|
|
26
|
+
], [
|
|
27
|
+
...box,
|
|
28
|
+
...cellView(config, "cell", config.glyph === void 0 ? [] : [config.glyph], h),
|
|
29
|
+
text,
|
|
30
|
+
...slotView("span", "slot", config.slot ?? [], h, [...config.slotAttributes ?? [], ...cellRole(config, h)]),
|
|
31
|
+
...cellView(config, "cell actions", config.actions ?? [], h),
|
|
32
|
+
...slotView("span", "tools", config.tools ?? [], h, cellRole(config, h))
|
|
33
|
+
])), "@gjermundgaraba/pixel-paper/rows/rows.js#lineView");
|
|
34
|
+
const selectableLineView = (config, select, h) => __foldkitBrandViewResult((Checkbox.view({
|
|
35
|
+
id: select.id,
|
|
36
|
+
isChecked: select.isChecked,
|
|
37
|
+
onToggle: select.onToggle,
|
|
38
|
+
toView: (groups) => __foldkitBrandViewResult((lineView(config, [h.span([...cellRole(config, h), h.Class("row-check")], [h.button(groups.checkbox)])], config.treegrid === void 0 ? h.label([...groups.label, h.Class("grow")], textOf(config, h)) : h.span([...cellRole(config, h), h.Class("cell grow-cell")], [h.label([...groups.label, h.Class("grow")], textOf(config, h))]), h)), "@gjermundgaraba/pixel-paper/rows/rows.js#toView")
|
|
39
|
+
}, h)), "@gjermundgaraba/pixel-paper/rows/rows.js#selectableLineView");
|
|
40
|
+
/** One 34px row: box, glyph, text, slot, actions, tools, and the rows nested under it. Hover
|
|
41
|
+
* and focus tint it head. The box of a selectable row is built on `@foldkit/ui`'s Checkbox:
|
|
42
|
+
* a `role="checkbox"` button (`aria-checked`) whose whole cell is its target. In a treegrid
|
|
43
|
+
* the line is the `role="row"` and each part a `role="gridcell"`. */
|
|
44
|
+
const rowView = (config, h) => {
|
|
45
|
+
const listRole = config.treegrid === void 0 ? [] : [h.Role("none")];
|
|
46
|
+
return __foldkitBrandViewResult((h.keyed("li")(config.key, listRole, [config.select === void 0 ? lineView(config, [], h.div([...cellRole(config, h), h.Class("grow")], textOf(config, h)), h) : selectableLineView(config, config.select, h), ...slotView("ul", "rows", config.nested ?? [], h, listRole)])), "@gjermundgaraba/pixel-paper/rows/rows.js#rowView");
|
|
47
|
+
};
|
|
48
|
+
/** A glyph in the row's 18px slot. */
|
|
49
|
+
const glyphView = (config, h) => __foldkitBrandViewResult((h.span([h.Class("glyph")], [view$1({ name: config.name }, h)])), "@gjermundgaraba/pixel-paper/rows/rows.js#glyphView");
|
|
50
|
+
/** The glyph slot as a fold toggle, built on `@foldkit/ui`'s Button: a ring, open or closed,
|
|
51
|
+
* `aria-expanded`, named for the rows it shows. */
|
|
52
|
+
const toggleView = (config, h) => __foldkitBrandViewResult((Button.view({
|
|
53
|
+
onClick: config.onToggle,
|
|
54
|
+
toView: (groups) => __foldkitBrandViewResult((h.button([
|
|
55
|
+
...groups.button,
|
|
56
|
+
h.AriaExpanded(config.isExpanded),
|
|
57
|
+
h.AriaLabel(`Rows under ${config.label}`),
|
|
58
|
+
h.Class("glyph")
|
|
59
|
+
], [view$1({ name: config.isExpanded ? "ring" : "ring-closed" }, h)])), "@gjermundgaraba/pixel-paper/rows/rows.js#toView~2")
|
|
60
|
+
}, h)), "@gjermundgaraba/pixel-paper/rows/rows.js#toggleView");
|
|
61
|
+
/** The row's title as the button that opens it, built on `@foldkit/ui`'s Button; it
|
|
62
|
+
* underlines on hover. */
|
|
63
|
+
const titleView = (config, h) => __foldkitBrandViewResult((Button.view({
|
|
64
|
+
onClick: config.onOpen,
|
|
65
|
+
toView: (groups) => __foldkitBrandViewResult((h.button([...groups.button, h.Class(config.isDone === true ? "title done-title" : "title")], [config.label])), "@gjermundgaraba/pixel-paper/rows/rows.js#toView~3")
|
|
66
|
+
}, h)), "@gjermundgaraba/pixel-paper/rows/rows.js#titleView");
|
|
67
|
+
export { glyphView, rowView, titleView, toggleView, view };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Scheme } from "./scheme.js";
|
|
2
|
+
import { scheme_switch_d_exports } from "./scheme-switch.js";
|
|
3
|
+
declare namespace index_d_exports {
|
|
4
|
+
export { Scheme, scheme_switch_d_exports as SchemeSwitch };
|
|
5
|
+
}
|
|
6
|
+
export { Scheme, scheme_switch_d_exports as SchemeSwitch, index_d_exports };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { Scheme } from "./scheme.js";
|
|
4
|
+
import { scheme_switch_exports } from "./scheme-switch.js";
|
|
5
|
+
// src/scheme/index.ts
|
|
6
|
+
var scheme_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
Scheme: () => __foldkitBrandViewResult((Scheme), "@gjermundgaraba/pixel-paper/scheme/index.js#Scheme"),
|
|
8
|
+
SchemeSwitch: () => __foldkitBrandViewResult((scheme_switch_exports), "@gjermundgaraba/pixel-paper/scheme/index.js#SchemeSwitch")
|
|
9
|
+
});
|
|
10
|
+
export { Scheme, scheme_switch_exports as SchemeSwitch, scheme_exports };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Scheme } from "./scheme.js";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
import * as Command from "foldkit/command";
|
|
4
|
+
import * as Subscription from "foldkit/subscription";
|
|
5
|
+
import * as Update from "foldkit/update";
|
|
6
|
+
declare namespace scheme_switch_d_exports {
|
|
7
|
+
export { Message, Model, PinScheme, init, scheme, select, subscriptions, update, view };
|
|
8
|
+
}
|
|
9
|
+
/** Schema for the scheme switch: the scheme in force as far as the page has seen, and the
|
|
10
|
+
* palette the reader's system prefers, which `System` prints in. */
|
|
11
|
+
export declare const Model: Schema.Struct<{
|
|
12
|
+
readonly scheme: Schema.Literals<readonly ["System", "Paper", "Plum"]>;
|
|
13
|
+
readonly systemPalette: Schema.Literals<readonly ["Paper", "Plum"]>;
|
|
14
|
+
}>;
|
|
15
|
+
export type Model = typeof Model.Type;
|
|
16
|
+
/** Union of all Messages the scheme switch can produce. */
|
|
17
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
18
|
+
readonly SelectedScheme: {
|
|
19
|
+
scheme: Schema.Literals<readonly ["System", "Paper", "Plum"]>;
|
|
20
|
+
};
|
|
21
|
+
readonly CompletedPinScheme: {};
|
|
22
|
+
readonly CompletedReadScheme: {
|
|
23
|
+
scheme: Schema.Literals<readonly ["System", "Paper", "Plum"]>;
|
|
24
|
+
};
|
|
25
|
+
readonly UpdatedSystemPalette: {
|
|
26
|
+
palette: Schema.Literals<readonly ["Paper", "Plum"]>;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
export type Message = typeof Message.Type;
|
|
30
|
+
/** Pins a scheme on `<html data-scheme>` and remembers it on this device in `localStorage`
|
|
31
|
+
* under the key `schemeScript` reads; `System` removes both. The attribute is written first,
|
|
32
|
+
* so storage that refuses (blocked or full) still switches the page; the choice is just not
|
|
33
|
+
* remembered. */
|
|
34
|
+
export declare const PinScheme: Command.CommandDefinitionWithArgs<"PinScheme", {
|
|
35
|
+
scheme: Schema.Literals<readonly ["System", "Paper", "Plum"]>;
|
|
36
|
+
}, Effect.Effect<{
|
|
37
|
+
readonly _tag: "CompletedPinScheme";
|
|
38
|
+
}, never, never>>;
|
|
39
|
+
/** Creates the switch on `System` in the paper palette, as the server renders it, with a
|
|
40
|
+
* Command that reads `<html data-scheme>` once the client runs it after hydration: the scheme
|
|
41
|
+
* `schemeScript` pinned before first paint (the server ignores it), or `System` without one. The `subscriptions` bring in the
|
|
42
|
+
* system's palette. A change made in another tab is seen on the next load, not live. */
|
|
43
|
+
export declare const init: () => Update.Return<Model, Message>;
|
|
44
|
+
/** The scheme in force: the reader's choice, or `System`. */
|
|
45
|
+
export declare const scheme: (model: Model) => Scheme;
|
|
46
|
+
type UpdateReturn = Update.Return<Model, Message>;
|
|
47
|
+
/** Processes a scheme switch Message and returns the next Model and Commands. */
|
|
48
|
+
export declare const update: (model: Model, message: Message) => Readonly<{
|
|
49
|
+
model: {
|
|
50
|
+
readonly scheme: "Paper" | "Plum" | "System";
|
|
51
|
+
readonly systemPalette: "Paper" | "Plum";
|
|
52
|
+
};
|
|
53
|
+
commands?: Update.Commands<{
|
|
54
|
+
readonly _tag: "CompletedPinScheme";
|
|
55
|
+
} | {
|
|
56
|
+
readonly _tag: "CompletedReadScheme";
|
|
57
|
+
readonly scheme: "Paper" | "Plum" | "System";
|
|
58
|
+
} | {
|
|
59
|
+
readonly _tag: "SelectedScheme";
|
|
60
|
+
readonly scheme: "Paper" | "Plum" | "System";
|
|
61
|
+
} | {
|
|
62
|
+
readonly _tag: "UpdatedSystemPalette";
|
|
63
|
+
readonly palette: "Paper" | "Plum";
|
|
64
|
+
}, never>;
|
|
65
|
+
outMessage?: never;
|
|
66
|
+
}>;
|
|
67
|
+
/** Pins a scheme from outside the switch, such as a command palette entry. */
|
|
68
|
+
export declare const select: (model: Model, chosen: Scheme) => UpdateReturn;
|
|
69
|
+
/** Keeps the switch in step with the palette the reader's system prefers, which `System`
|
|
70
|
+
* prints in. Lift it into the application's Subscriptions. One switch per page: its key is
|
|
71
|
+
* fixed, `schemeSwitchSystemPalette`. */
|
|
72
|
+
export declare const subscriptions: {
|
|
73
|
+
readonly schemeSwitchSystemPalette: Subscription.EntryWithoutKeepAlive<unknown, {
|
|
74
|
+
readonly _tag: "UpdatedSystemPalette";
|
|
75
|
+
readonly palette: "Paper" | "Plum";
|
|
76
|
+
}, Record<string, never>, never> & {
|
|
77
|
+
readonly __subscription: never;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/** System, paper, plum: two palettes of one system, or whatever the reader's system prefers.
|
|
81
|
+
* Put `schemeScript` in the page's `<head>` so a remembered choice applies before first
|
|
82
|
+
* paint. */
|
|
83
|
+
export declare const view: import("foldkit/submodel").View<{
|
|
84
|
+
readonly scheme: "Paper" | "Plum" | "System";
|
|
85
|
+
readonly systemPalette: "Paper" | "Plum";
|
|
86
|
+
}, {
|
|
87
|
+
readonly _tag: "CompletedPinScheme";
|
|
88
|
+
} | {
|
|
89
|
+
readonly _tag: "CompletedReadScheme";
|
|
90
|
+
readonly scheme: "Paper" | "Plum" | "System";
|
|
91
|
+
} | {
|
|
92
|
+
readonly _tag: "SelectedScheme";
|
|
93
|
+
readonly scheme: "Paper" | "Plum" | "System";
|
|
94
|
+
} | {
|
|
95
|
+
readonly _tag: "UpdatedSystemPalette";
|
|
96
|
+
readonly palette: "Paper" | "Plum";
|
|
97
|
+
}, void>;
|
|
98
|
+
export { scheme_switch_d_exports };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { Palette, Scheme, fromPinnedValue, toPinnedValue } from "./scheme.js";
|
|
4
|
+
import { view as view$1 } from "../segmented/segmented.js";
|
|
5
|
+
import { SCHEME_ATTRIBUTE, SCHEME_STORAGE_KEY } from "./script.js";
|
|
6
|
+
import { Effect, Option, Schema } from "effect";
|
|
7
|
+
import * as Command from "foldkit/command";
|
|
8
|
+
import { defineMessageUnion } from "foldkit/message";
|
|
9
|
+
import { modifyFields } from "foldkit/struct";
|
|
10
|
+
import { defineView } from "foldkit/submodel";
|
|
11
|
+
import * as Subscription from "foldkit/subscription";
|
|
12
|
+
import * as Dom from "foldkit/dom";
|
|
13
|
+
// src/scheme/scheme-switch.ts
|
|
14
|
+
var scheme_switch_exports = /* @__PURE__ */ __exportAll({
|
|
15
|
+
Message: () => __foldkitBrandViewResult((Message), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#Message"),
|
|
16
|
+
Model: () => __foldkitBrandViewResult((Model), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#Model"),
|
|
17
|
+
PinScheme: () => __foldkitBrandViewResult((PinScheme), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#PinScheme"),
|
|
18
|
+
init: () => __foldkitBrandViewResult((init), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#init"),
|
|
19
|
+
scheme: () => __foldkitBrandViewResult((scheme), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#scheme"),
|
|
20
|
+
select: () => __foldkitBrandViewResult((select), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#select"),
|
|
21
|
+
subscriptions: () => __foldkitBrandViewResult((subscriptions), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#subscriptions"),
|
|
22
|
+
update: () => __foldkitBrandViewResult((update), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#update"),
|
|
23
|
+
view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#view")
|
|
24
|
+
});
|
|
25
|
+
/** Schema for the scheme switch: the scheme in force as far as the page has seen, and the
|
|
26
|
+
* palette the reader's system prefers, which `System` prints in. */
|
|
27
|
+
const Model = Schema.Struct({
|
|
28
|
+
scheme: Scheme,
|
|
29
|
+
systemPalette: Palette
|
|
30
|
+
});
|
|
31
|
+
/** Union of all Messages the scheme switch can produce. */
|
|
32
|
+
const Message = defineMessageUnion({
|
|
33
|
+
SelectedScheme: { scheme: Scheme },
|
|
34
|
+
CompletedPinScheme: {},
|
|
35
|
+
CompletedReadScheme: { scheme: Scheme },
|
|
36
|
+
UpdatedSystemPalette: { palette: Palette }
|
|
37
|
+
});
|
|
38
|
+
/** Pins a scheme on `<html data-scheme>` and remembers it on this device in `localStorage`
|
|
39
|
+
* under the key `schemeScript` reads; `System` removes both. The attribute is written first,
|
|
40
|
+
* so storage that refuses (blocked or full) still switches the page; the choice is just not
|
|
41
|
+
* remembered. */
|
|
42
|
+
const PinScheme = Command.define("PinScheme", {
|
|
43
|
+
args: { scheme: Scheme },
|
|
44
|
+
messages: [Message.CompletedPinScheme],
|
|
45
|
+
execute: ({ scheme }) => __foldkitBrandViewResult((Effect.try(() => {
|
|
46
|
+
Option.match(toPinnedValue(scheme), {
|
|
47
|
+
onNone: () => {
|
|
48
|
+
document.documentElement.removeAttribute(SCHEME_ATTRIBUTE);
|
|
49
|
+
localStorage.removeItem(SCHEME_STORAGE_KEY);
|
|
50
|
+
},
|
|
51
|
+
onSome: (value) => {
|
|
52
|
+
document.documentElement.setAttribute(SCHEME_ATTRIBUTE, value);
|
|
53
|
+
localStorage.setItem(SCHEME_STORAGE_KEY, value);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}).pipe(Effect.ignore, Effect.as(Message.CompletedPinScheme()))), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#execute")
|
|
57
|
+
});
|
|
58
|
+
const ReadScheme = Command.define("ReadScheme", {
|
|
59
|
+
messages: [Message.CompletedReadScheme],
|
|
60
|
+
execute: Effect.sync(() => __foldkitBrandViewResult((Message.CompletedReadScheme({ scheme: fromPinnedValue(document.documentElement.getAttribute(SCHEME_ATTRIBUTE)) })), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#anonymous~2"))
|
|
61
|
+
});
|
|
62
|
+
/** Creates the switch on `System` in the paper palette, as the server renders it, with a
|
|
63
|
+
* Command that reads `<html data-scheme>` once the client runs it after hydration: the scheme
|
|
64
|
+
* `schemeScript` pinned before first paint (the server ignores it), or `System` without one. The `subscriptions` bring in the
|
|
65
|
+
* system's palette. A change made in another tab is seen on the next load, not live. */
|
|
66
|
+
const init = () => (__foldkitBrandViewResult(({
|
|
67
|
+
model: {
|
|
68
|
+
scheme: "System",
|
|
69
|
+
systemPalette: "Paper"
|
|
70
|
+
},
|
|
71
|
+
commands: [ReadScheme()]
|
|
72
|
+
}), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#init~2"));
|
|
73
|
+
/** The scheme in force: the reader's choice, or `System`. */
|
|
74
|
+
const scheme = (model) => __foldkitBrandViewResult((model.scheme), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#scheme~2");
|
|
75
|
+
/** Processes a scheme switch Message and returns the next Model and Commands. */
|
|
76
|
+
const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
77
|
+
SelectedScheme: ({ scheme: chosen }) => (__foldkitBrandViewResult(({
|
|
78
|
+
model: modifyFields(model, { scheme: () => __foldkitBrandViewResult((chosen), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#scheme~3") }),
|
|
79
|
+
commands: [PinScheme({ scheme: chosen })]
|
|
80
|
+
}), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#SelectedScheme")),
|
|
81
|
+
CompletedPinScheme: () => (__foldkitBrandViewResult(({ model }), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#CompletedPinScheme")),
|
|
82
|
+
CompletedReadScheme: ({ scheme: read }) => (__foldkitBrandViewResult(({ model: modifyFields(model, { scheme: () => __foldkitBrandViewResult((read), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#scheme~4") }) }), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#CompletedReadScheme")),
|
|
83
|
+
UpdatedSystemPalette: ({ palette: systemPalette }) => (__foldkitBrandViewResult(({ model: modifyFields(model, { systemPalette: () => __foldkitBrandViewResult((systemPalette), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#systemPalette") }) }), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#UpdatedSystemPalette"))
|
|
84
|
+
})), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#update~2");
|
|
85
|
+
/** Pins a scheme from outside the switch, such as a command palette entry. */
|
|
86
|
+
const select = (model, chosen) => __foldkitBrandViewResult((update(model, Message.SelectedScheme({ scheme: chosen }))), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#select~2");
|
|
87
|
+
const systemPaletteChanges = Dom.streamFromMediaQuery({
|
|
88
|
+
query: "(prefers-color-scheme: dark)",
|
|
89
|
+
mapMatches: (isDark) => __foldkitBrandViewResult((Message.UpdatedSystemPalette({ palette: isDark ? "Plum" : "Paper" })), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#mapMatches")
|
|
90
|
+
});
|
|
91
|
+
/** Keeps the switch in step with the palette the reader's system prefers, which `System`
|
|
92
|
+
* prints in. Lift it into the application's Subscriptions. One switch per page: its key is
|
|
93
|
+
* fixed, `schemeSwitchSystemPalette`. */
|
|
94
|
+
const subscriptions = Subscription.make()(() => (__foldkitBrandViewResult(({ schemeSwitchSystemPalette: Subscription.persistentEntry(systemPaletteChanges) }), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#anonymous~3")));
|
|
95
|
+
const SEGMENTS = [
|
|
96
|
+
{
|
|
97
|
+
value: "System",
|
|
98
|
+
label: "system"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
value: "Paper",
|
|
102
|
+
label: "paper"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
value: "Plum",
|
|
106
|
+
label: "plum"
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
/** System, paper, plum: two palettes of one system, or whatever the reader's system prefers.
|
|
110
|
+
* Put `schemeScript` in the page's `<head>` so a remembered choice applies before first
|
|
111
|
+
* paint. */
|
|
112
|
+
const view = defineView((model, h) => __foldkitBrandViewResult((view$1({
|
|
113
|
+
label: "Palette",
|
|
114
|
+
options: SEGMENTS,
|
|
115
|
+
value: model.scheme,
|
|
116
|
+
onSelect: (chosen) => __foldkitBrandViewResult((Message.SelectedScheme({ scheme: chosen })), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#onSelect")
|
|
117
|
+
}, h)), "@gjermundgaraba/pixel-paper/scheme/scheme-switch.js#anonymous~4"));
|
|
118
|
+
export { Message, Model, PinScheme, init, scheme, scheme_switch_exports, select, subscriptions, update, view };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
|
+
/** The colour scheme: `Paper` (light) or `Plum` (dark) pinned on `<html data-scheme>`, as
|
|
3
|
+
* `"light"` or `"dark"`, or `System`, which follows the reader's system in CSS alone. */
|
|
4
|
+
export declare const Scheme: Schema.Literals<readonly ["System", "Paper", "Plum"]>;
|
|
5
|
+
export type Scheme = typeof Scheme.Type;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { Match, Option, Schema } from "effect";
|
|
3
|
+
// src/scheme/scheme.ts
|
|
4
|
+
/** The colour scheme: `Paper` (light) or `Plum` (dark) pinned on `<html data-scheme>`, as
|
|
5
|
+
* `"light"` or `"dark"`, or `System`, which follows the reader's system in CSS alone. */
|
|
6
|
+
const Scheme = Schema.Literals([
|
|
7
|
+
"System",
|
|
8
|
+
"Paper",
|
|
9
|
+
"Plum"
|
|
10
|
+
]);
|
|
11
|
+
/** The palette a page prints in: `Paper` (light) or `Plum` (dark). Under `System` it is the
|
|
12
|
+
* one the reader's system prefers. */
|
|
13
|
+
const Palette = Schema.Literals(["Paper", "Plum"]);
|
|
14
|
+
const toPinnedValue = (scheme) => __foldkitBrandViewResult((Match.value(scheme).pipe(Match.withReturnType(), Match.when("System", () => __foldkitBrandViewResult((Option.none()), "@gjermundgaraba/pixel-paper/scheme/scheme.js#anonymous")), Match.when("Paper", () => __foldkitBrandViewResult((Option.some("light")), "@gjermundgaraba/pixel-paper/scheme/scheme.js#anonymous~2")), Match.when("Plum", () => __foldkitBrandViewResult((Option.some("dark")), "@gjermundgaraba/pixel-paper/scheme/scheme.js#anonymous~3")), Match.exhaustive)), "@gjermundgaraba/pixel-paper/scheme/scheme.js#toPinnedValue");
|
|
15
|
+
const fromPinnedValue = (value) => __foldkitBrandViewResult((Match.value(value).pipe(Match.withReturnType(), Match.when("light", () => __foldkitBrandViewResult(("Paper"), "@gjermundgaraba/pixel-paper/scheme/scheme.js#anonymous~4")), Match.when("dark", () => __foldkitBrandViewResult(("Plum"), "@gjermundgaraba/pixel-paper/scheme/scheme.js#anonymous~5")), Match.orElse(() => __foldkitBrandViewResult(("System"), "@gjermundgaraba/pixel-paper/scheme/scheme.js#anonymous~6")))), "@gjermundgaraba/pixel-paper/scheme/scheme.js#fromPinnedValue");
|
|
16
|
+
export { Palette, Scheme, fromPinnedValue, toPinnedValue };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Where a pinned scheme is remembered on this device, in `localStorage`. */
|
|
2
|
+
export declare const SCHEME_STORAGE_KEY = "pixel-paper-scheme";
|
|
3
|
+
/** The attribute on `<html>` a pinned scheme is written to: `data-scheme="light"` or
|
|
4
|
+
`"dark"`. Without it the stylesheet follows the reader's system. */
|
|
5
|
+
export declare const SCHEME_ATTRIBUTE = "data-scheme";
|
|
6
|
+
/** Inline this in `<head>`, before the stylesheet paints, so a remembered scheme never
|
|
7
|
+
flashes the other one first. Blocked storage leaves the page on the system's scheme. */
|
|
8
|
+
export declare const schemeScript = "try{var s=localStorage.getItem(\"pixel-paper-scheme\");if(s===\"light\"||s===\"dark\")document.documentElement.setAttribute(\"data-scheme\",s);}catch(e){}";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/scheme/script.ts
|
|
2
|
+
/** Where a pinned scheme is remembered on this device, in `localStorage`. */
|
|
3
|
+
const SCHEME_STORAGE_KEY = "pixel-paper-scheme";
|
|
4
|
+
/** The attribute on `<html>` a pinned scheme is written to: `data-scheme="light"` or
|
|
5
|
+
`"dark"`. Without it the stylesheet follows the reader's system. */
|
|
6
|
+
const SCHEME_ATTRIBUTE = "data-scheme";
|
|
7
|
+
/** Inline this in `<head>`, before the stylesheet paints, so a remembered scheme never
|
|
8
|
+
flashes the other one first. Blocked storage leaves the page on the system's scheme. */
|
|
9
|
+
const schemeScript = `try{var s=localStorage.getItem("${SCHEME_STORAGE_KEY}");if(s==="light"||s==="dark")document.documentElement.setAttribute("${SCHEME_ATTRIBUTE}",s);}catch(e){}`;
|
|
10
|
+
export { SCHEME_ATTRIBUTE, SCHEME_STORAGE_KEY, schemeScript };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { view } from "./secret.js";
|
|
4
|
+
// src/secret/index.ts
|
|
5
|
+
var secret_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/secret/index.js#view") });
|
|
6
|
+
export { secret_exports, view };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Html, HtmlBuilder } from "foldkit/html";
|
|
2
|
+
/** Configuration for rendering a secret with `view`. */
|
|
3
|
+
export type ViewConfig = Readonly<{
|
|
4
|
+
value: string;
|
|
5
|
+
/** What the value is ("API key"): the code's accessible name. A `<code>` may not be named,
|
|
6
|
+
* so it is a `role="group"`, which may. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** After the code: a CopyButton labelled "Copy" and the label. */
|
|
9
|
+
actions: ReadonlyArray<Html | string>;
|
|
10
|
+
}>;
|
|
11
|
+
/** A value shown once (a key, a token): code in a head-tinted box, named by its label, with
|
|
12
|
+
* the button that copies it. */
|
|
13
|
+
export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
// src/secret/secret.ts
|
|
3
|
+
/** A value shown once (a key, a token): code in a head-tinted box, named by its label, with
|
|
4
|
+
* the button that copies it. */
|
|
5
|
+
const view = (config, h) => {
|
|
6
|
+
const { value, label, actions } = config;
|
|
7
|
+
return __foldkitBrandViewResult((h.div([h.Class("secret")], [h.code([h.Role("group"), h.AriaLabel(label)], [value]), ...actions])), "@gjermundgaraba/pixel-paper/secret/secret.js#view");
|
|
8
|
+
};
|
|
9
|
+
export { view };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { view } from "./segmented.js";
|
|
4
|
+
// src/segmented/index.ts
|
|
5
|
+
var segmented_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/segmented/index.js#view") });
|
|
6
|
+
export { segmented_exports, view };
|