@gjermundgaraba/pixel-paper 0.0.0-stage → 0.1.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/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,25 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { slotView } from "../slot/slot.js";
|
|
3
|
+
// src/panel/panel.ts
|
|
4
|
+
const titleId = (id) => __foldkitBrandViewResult((`${id}-title`), "@gjermundgaraba/pixel-paper/panel/panel.js#titleId");
|
|
5
|
+
/** The unit of the system: paper in a 2px ink box on a 5px print shadow, under a title bar. A
|
|
6
|
+
* region landmark (`<section>`) named by its `h2` title, or by `name`, keyed by its `id`. */
|
|
7
|
+
const view = (config, h) => {
|
|
8
|
+
const { id, title, name, lead = [], meta, actions = [], shelf = [], body, foot = [], isFlush = false } = config;
|
|
9
|
+
return __foldkitBrandViewResult((h.keyed("section")(id, [
|
|
10
|
+
h.Id(id),
|
|
11
|
+
name === void 0 ? h.AriaLabelledBy(titleId(id)) : h.AriaLabel(name),
|
|
12
|
+
h.Class("panel")
|
|
13
|
+
], [
|
|
14
|
+
h.header([h.Class("panel-tb")], [
|
|
15
|
+
...slotView("span", "panel-lead", lead, h),
|
|
16
|
+
h.h2([h.Id(titleId(id))], [title]),
|
|
17
|
+
...meta === void 0 ? [] : [h.span([h.Class("meta")], [meta])],
|
|
18
|
+
...slotView("span", "panel-acts", actions, h)
|
|
19
|
+
]),
|
|
20
|
+
...slotView("div", "panel-shelf", shelf, h),
|
|
21
|
+
...isFlush ? body : [h.div([h.Class("panel-body")], body)],
|
|
22
|
+
...slotView("div", "panel-foot", foot, h)
|
|
23
|
+
])), "@gjermundgaraba/pixel-paper/panel/panel.js#view");
|
|
24
|
+
};
|
|
25
|
+
export { titleId, 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 "./password-field.js";
|
|
4
|
+
// src/password-field/index.ts
|
|
5
|
+
var password_field_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/password-field/index.js#view") });
|
|
6
|
+
export { password_field_exports, view };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Html, HtmlBuilder } from "foldkit/html";
|
|
2
|
+
/** Configuration for rendering a password field with `view`. */
|
|
3
|
+
export type ViewConfig<Message> = Readonly<{
|
|
4
|
+
/** Unique in the document: the input's id. */
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
onInput: (value: string) => Message;
|
|
9
|
+
/** Whether the password prints in the clear. The caller keeps it, as it keeps `value`, and
|
|
10
|
+
* hides it again when the form is sent. */
|
|
11
|
+
isShown: boolean;
|
|
12
|
+
/** The show toggle's Message: flip `isShown`. */
|
|
13
|
+
onToggleShown: Message;
|
|
14
|
+
/** A sans sentence under the box. */
|
|
15
|
+
help?: string;
|
|
16
|
+
/** Why the value was refused: a red sentence under the control, which the control is
|
|
17
|
+
* described by, with red on its box and its label (`aria-invalid`). Say it again in an
|
|
18
|
+
* ErrorSummary above the form. */
|
|
19
|
+
error?: string | undefined;
|
|
20
|
+
/** The form is not sent without it: screen readers hear "required" (`aria-required`). */
|
|
21
|
+
isRequired?: boolean;
|
|
22
|
+
/** `current-password` to sign in, `new-password` to set one. */
|
|
23
|
+
autocomplete?: "current-password" | "new-password";
|
|
24
|
+
/** The show toggle's name, "Show password" when not given: give each of two fields in a
|
|
25
|
+
* form its own, such as "Show password again". */
|
|
26
|
+
toggleLabel?: string;
|
|
27
|
+
}>;
|
|
28
|
+
/** A boxed password field with a show toggle inside its box, built on `@foldkit/ui`'s Input:
|
|
29
|
+
* named by its label, described by its help line, `aria-invalid` and described by its
|
|
30
|
+
* `error` when it failed, and `aria-required` when the form is not sent without it. The
|
|
31
|
+
* toggle is a button named `toggleLabel` ("Show password"), `aria-pressed` while the
|
|
32
|
+
* password shows. */
|
|
33
|
+
export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { pressedAttribute } from "../button/button.js";
|
|
3
|
+
import { view as view$1 } from "../icon-button/icon-button.js";
|
|
4
|
+
import { controlAttributes, errorView, helpView } from "../field/field.js";
|
|
5
|
+
import { Input } from "@foldkit/ui";
|
|
6
|
+
// src/password-field/password-field.ts
|
|
7
|
+
/** A boxed password field with a show toggle inside its box, built on `@foldkit/ui`'s Input:
|
|
8
|
+
* named by its label, described by its help line, `aria-invalid` and described by its
|
|
9
|
+
* `error` when it failed, and `aria-required` when the form is not sent without it. The
|
|
10
|
+
* toggle is a button named `toggleLabel` ("Show password"), `aria-pressed` while the
|
|
11
|
+
* password shows. */
|
|
12
|
+
const view = (config, h) => {
|
|
13
|
+
const { id, label, value, onInput, isShown, onToggleShown, help, error, isRequired = false, autocomplete = "current-password", toggleLabel = "Show password" } = config;
|
|
14
|
+
return __foldkitBrandViewResult((Input.view({
|
|
15
|
+
id,
|
|
16
|
+
value,
|
|
17
|
+
onInput,
|
|
18
|
+
isInvalid: error !== void 0,
|
|
19
|
+
type: isShown ? "text" : "password",
|
|
20
|
+
hasDescription: help !== void 0,
|
|
21
|
+
toView: (groups) => __foldkitBrandViewResult((h.div([h.Class("field boxed")], [
|
|
22
|
+
h.label(groups.label, [label]),
|
|
23
|
+
h.span([h.Class("password")], [h.input([
|
|
24
|
+
...groups.input,
|
|
25
|
+
h.Autocomplete(autocomplete),
|
|
26
|
+
...controlAttributes(id, error, help, isRequired, h)
|
|
27
|
+
]), view$1({
|
|
28
|
+
glyph: isShown ? "eye-off" : "eye",
|
|
29
|
+
label: toggleLabel,
|
|
30
|
+
isQuiet: true,
|
|
31
|
+
onClick: onToggleShown,
|
|
32
|
+
attributes: [pressedAttribute(isShown, h)]
|
|
33
|
+
}, h)]),
|
|
34
|
+
...errorView(id, error, h),
|
|
35
|
+
...helpView(help, groups.description, h)
|
|
36
|
+
])), "@gjermundgaraba/pixel-paper/password-field/password-field.js#toView")
|
|
37
|
+
}, h)), "@gjermundgaraba/pixel-paper/password-field/password-field.js#view");
|
|
38
|
+
};
|
|
39
|
+
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 "./places.js";
|
|
4
|
+
// src/places/index.ts
|
|
5
|
+
var places_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/places/index.js#view") });
|
|
6
|
+
export { places_exports, view };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Html, HtmlBuilder } from "foldkit/html";
|
|
2
|
+
/** One place in Places: a link to its address (`href`), or a button that shows it in the page
|
|
3
|
+
* (`onSelect`). */
|
|
4
|
+
export type Place<Message> = PlaceContent & PlaceTarget<Message>;
|
|
5
|
+
export type PlaceContent = Readonly<{
|
|
6
|
+
/** Stable and unique among the places: the row's key, so two places that share a name stay
|
|
7
|
+
* apart. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** The place's name, in sans: it is authored. It wraps rather than clipping. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** The place you are in: `aria-current="page"`, printed inverted. */
|
|
12
|
+
isCurrent?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
export type PlaceTarget<Message> = Readonly<{
|
|
15
|
+
/** The place's address: the line is a link, so it opens in a new tab and reads as one. */
|
|
16
|
+
href: string;
|
|
17
|
+
onSelect?: never;
|
|
18
|
+
}> | Readonly<{
|
|
19
|
+
/** Shows the place without leaving the page: the line is a button. */
|
|
20
|
+
onSelect: Message;
|
|
21
|
+
href?: never;
|
|
22
|
+
}>;
|
|
23
|
+
/** Configuration for rendering places with `view`. */
|
|
24
|
+
export type ViewConfig<Message> = Readonly<{
|
|
25
|
+
/** Names the navigation for screen readers ("Areas"). */
|
|
26
|
+
label: string;
|
|
27
|
+
places: ReadonlyArray<Place<Message>>;
|
|
28
|
+
}>;
|
|
29
|
+
/** A column of places to go (areas, collections, saved filters), flush in a rail panel: a
|
|
30
|
+
* navigation landmark named by its label, one line each a link to the place or a button built
|
|
31
|
+
* on `@foldkit/ui`'s Button, the one you are in `aria-current="page"` and printed inverted. */
|
|
32
|
+
export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { Array } from "effect";
|
|
3
|
+
import { Button } from "@foldkit/ui";
|
|
4
|
+
// src/places/places.ts
|
|
5
|
+
const lineView = (place, h) => {
|
|
6
|
+
const { label, isCurrent = false } = place;
|
|
7
|
+
const current = isCurrent ? [h.AriaCurrent("page")] : [];
|
|
8
|
+
const content = [h.span([h.Class("place-name")], [label])];
|
|
9
|
+
return __foldkitBrandViewResult((place.href === void 0 ? Button.view({
|
|
10
|
+
onClick: place.onSelect,
|
|
11
|
+
toView: (groups) => __foldkitBrandViewResult((h.button([...groups.button, ...current], content)), "@gjermundgaraba/pixel-paper/places/places.js#toView")
|
|
12
|
+
}, h) : h.a([h.Href(place.href), ...current], content)), "@gjermundgaraba/pixel-paper/places/places.js#lineView");
|
|
13
|
+
};
|
|
14
|
+
const placeView = (h) => __foldkitBrandViewResult(((place) => __foldkitBrandViewResult((h.keyed("li")(place.id, [], [lineView(place, h)])), "@gjermundgaraba/pixel-paper/places/places.js#anonymous")), "@gjermundgaraba/pixel-paper/places/places.js#placeView");
|
|
15
|
+
/** A column of places to go (areas, collections, saved filters), flush in a rail panel: a
|
|
16
|
+
* navigation landmark named by its label, one line each a link to the place or a button built
|
|
17
|
+
* on `@foldkit/ui`'s Button, the one you are in `aria-current="page"` and printed inverted. */
|
|
18
|
+
const view = (config, h) => {
|
|
19
|
+
const { label, places } = config;
|
|
20
|
+
return __foldkitBrandViewResult((h.nav([h.AriaLabel(label), h.Class("places")], [h.ul([], Array.map(places, placeView(h)))])), "@gjermundgaraba/pixel-paper/places/places.js#view");
|
|
21
|
+
};
|
|
22
|
+
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 "./props-list.js";
|
|
4
|
+
// src/props-list/index.ts
|
|
5
|
+
var props_list_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/props-list/index.js#view") });
|
|
6
|
+
export { props_list_exports, view };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Html, HtmlBuilder } from "foldkit/html";
|
|
2
|
+
/** One property: its label, its value and its controls. */
|
|
3
|
+
export type Prop = Readonly<{
|
|
4
|
+
/** Pixel caps; unique in the list. */
|
|
5
|
+
label: string;
|
|
6
|
+
value: ReadonlyArray<Html | string>;
|
|
7
|
+
/** Prints the value as code: a key, an id, a path. */
|
|
8
|
+
isCode?: boolean;
|
|
9
|
+
/** Controls for the row, at the right: a copy button, an edit. */
|
|
10
|
+
actions?: ReadonlyArray<Html | string>;
|
|
11
|
+
}>;
|
|
12
|
+
/** Configuration for rendering a props list with `view`. */
|
|
13
|
+
export type ViewConfig = Readonly<{
|
|
14
|
+
items: readonly Prop[];
|
|
15
|
+
}>;
|
|
16
|
+
/** A description list: a pixel-caps label, the value, and an action column, one 34px row
|
|
17
|
+
* each. */
|
|
18
|
+
export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { Array } from "effect";
|
|
3
|
+
// src/props-list/props-list.ts
|
|
4
|
+
const propView = (h) => __foldkitBrandViewResult((({ label, value, isCode = false, actions = [] }) => __foldkitBrandViewResult((h.keyed("div")(label, [], [
|
|
5
|
+
h.dt([], [label]),
|
|
6
|
+
h.dd([], isCode ? [h.code([], value)] : value),
|
|
7
|
+
h.dd([h.Class("acts")], actions)
|
|
8
|
+
])), "@gjermundgaraba/pixel-paper/props-list/props-list.js#anonymous")), "@gjermundgaraba/pixel-paper/props-list/props-list.js#propView");
|
|
9
|
+
/** A description list: a pixel-caps label, the value, and an action column, one 34px row
|
|
10
|
+
* each. */
|
|
11
|
+
const view = (config, h) => __foldkitBrandViewResult((h.dl([h.Class("props")], Array.map(config.items, propView(h)))), "@gjermundgaraba/pixel-paper/props-list/props-list.js#view");
|
|
12
|
+
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 "./prose.js";
|
|
4
|
+
// src/prose/index.ts
|
|
5
|
+
var prose_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/prose/index.js#view") });
|
|
6
|
+
export { prose_exports, view };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Html, HtmlBuilder } from "foldkit/html";
|
|
2
|
+
/** Configuration for rendering prose with `view`. */
|
|
3
|
+
export type ViewConfig = Readonly<{
|
|
4
|
+
/** Authored elements: `p`, headings, lists, `blockquote`, `code`, tables, a Notice, or the
|
|
5
|
+
* view a Markdown renderer makes of a document. Headings are styled at every level: `h1`
|
|
6
|
+
* as `h2` (a section under the page's own title), `h3` at the body's size, `h4` in pixel caps,
|
|
7
|
+
* `h5` in bold 13px type and `h6` as a muted pixel label, so no two neighbouring levels
|
|
8
|
+
* look alike. Inside a titled container (a Sheet's `h1`, a Dialog's `h2`), shift a
|
|
9
|
+
* document's headings so its top level sits under the container's title. */
|
|
10
|
+
body: ReadonlyArray<Html | string>;
|
|
11
|
+
}>;
|
|
12
|
+
/** Authored text at 15/1.65 sans within a 68ch measure; code and tables may run wider. It
|
|
13
|
+
* styles the plain elements it holds, so rendered Markdown needs no classes. */
|
|
14
|
+
export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
// src/prose/prose.ts
|
|
3
|
+
/** Authored text at 15/1.65 sans within a 68ch measure; code and tables may run wider. It
|
|
4
|
+
* styles the plain elements it holds, so rendered Markdown needs no classes. */
|
|
5
|
+
const view = (config, h) => __foldkitBrandViewResult((h.div([h.Class("prose")], config.body)), "@gjermundgaraba/pixel-paper/prose/prose.js#view");
|
|
6
|
+
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 "./query-chip.js";
|
|
4
|
+
// src/query-chip/index.ts
|
|
5
|
+
var query_chip_exports = /* @__PURE__ */ __exportAll({ view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/query-chip/index.js#view") });
|
|
6
|
+
export { query_chip_exports, view };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Attributes } from "../attributes/attributes.js";
|
|
2
|
+
import { Html, HtmlBuilder } from "foldkit/html";
|
|
3
|
+
/** Configuration for rendering a query chip with `view`. */
|
|
4
|
+
export type ViewConfig<Message> = Readonly<{
|
|
5
|
+
/** Unique in the document: the search field's id. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** The chip's name, which names the field: "find". */
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
onInput: (value: string) => Message;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
/** Further attributes for the search field, the `<input>`, not the chip: its key handlers
|
|
13
|
+
* (a Mount that hears Escape), a description. Never a class. */
|
|
14
|
+
inputAttributes?: Attributes<Message>;
|
|
15
|
+
}>;
|
|
16
|
+
/** A search field shaped as a chip, built on `@foldkit/ui`'s Input: a `type="search"` field
|
|
17
|
+
* named by the chip's name, tinted while it holds a query. */
|
|
18
|
+
export declare const view: <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Message>) => Html;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { Input } from "@foldkit/ui";
|
|
3
|
+
// src/query-chip/query-chip.ts
|
|
4
|
+
/** A search field shaped as a chip, built on `@foldkit/ui`'s Input: a `type="search"` field
|
|
5
|
+
* named by the chip's name, tinted while it holds a query. */
|
|
6
|
+
const view = (config, h) => {
|
|
7
|
+
const { id, label, value, onInput, placeholder, inputAttributes = [] } = config;
|
|
8
|
+
return __foldkitBrandViewResult((Input.view({
|
|
9
|
+
id,
|
|
10
|
+
value,
|
|
11
|
+
onInput,
|
|
12
|
+
type: "search",
|
|
13
|
+
...placeholder !== void 0 && { placeholder },
|
|
14
|
+
toView: (groups) => __foldkitBrandViewResult((h.label([...groups.label, h.Class(value === "" ? "fchip query" : "fchip query live")], [h.span([h.Class("fchip-name")], [label]), h.input([...inputAttributes, ...groups.input])])), "@gjermundgaraba/pixel-paper/query-chip/query-chip.js#toView")
|
|
15
|
+
}, h)), "@gjermundgaraba/pixel-paper/query-chip/query-chip.js#view");
|
|
16
|
+
};
|
|
17
|
+
export { view };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InitConfig, Message, Model, ViewInputs, init, update, view } from "./radio-choices.js";
|
|
2
|
+
declare namespace index_d_exports {
|
|
3
|
+
export { InitConfig, Message, Model, ViewInputs, init, update, view };
|
|
4
|
+
}
|
|
5
|
+
export { type InitConfig, Message, Model, type ViewInputs, index_d_exports, init, update, view };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { Message, Model, init, update, view } from "./radio-choices.js";
|
|
4
|
+
// src/radio-choices/index.ts
|
|
5
|
+
var radio_choices_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
Message: () => __foldkitBrandViewResult((Message), "@gjermundgaraba/pixel-paper/radio-choices/index.js#Message"),
|
|
7
|
+
Model: () => __foldkitBrandViewResult((Model), "@gjermundgaraba/pixel-paper/radio-choices/index.js#Model"),
|
|
8
|
+
init: () => __foldkitBrandViewResult((init), "@gjermundgaraba/pixel-paper/radio-choices/index.js#init"),
|
|
9
|
+
update: () => __foldkitBrandViewResult((update), "@gjermundgaraba/pixel-paper/radio-choices/index.js#update"),
|
|
10
|
+
view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/radio-choices/index.js#view")
|
|
11
|
+
});
|
|
12
|
+
export { Message, Model, init, radio_choices_exports, update, view };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
|
+
import * as Update from "foldkit/update";
|
|
3
|
+
/** Schema for a radio choice: the `@foldkit/ui` RadioGroup it is built on, which keeps where
|
|
4
|
+
* keyboard focus is. The selected value is the parent's, passed in as `selectedValue`. */
|
|
5
|
+
export declare const Model: Schema.Struct<{
|
|
6
|
+
readonly radioGroup: Schema.Struct<{
|
|
7
|
+
readonly id: Schema.String;
|
|
8
|
+
readonly maybeFocusedIndex: Schema.Option<Schema.Number>;
|
|
9
|
+
}>;
|
|
10
|
+
}>;
|
|
11
|
+
export type Model = typeof Model.Type;
|
|
12
|
+
/** Union of all Messages a radio choice can produce. */
|
|
13
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
14
|
+
readonly GotRadioGroupMessage: {
|
|
15
|
+
message: import("foldkit/message").MessageUnion<{
|
|
16
|
+
readonly SelectedOption: {
|
|
17
|
+
index: Schema.Number;
|
|
18
|
+
value: Schema.String;
|
|
19
|
+
};
|
|
20
|
+
readonly FocusedOption: {
|
|
21
|
+
index: Schema.Number;
|
|
22
|
+
};
|
|
23
|
+
readonly CompletedFocusOption: {};
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
export type Message = typeof Message.Type;
|
|
28
|
+
/** Configuration for creating a radio choice with `init`. The `id` must be unique in the
|
|
29
|
+
* document. */
|
|
30
|
+
export type InitConfig = Readonly<{
|
|
31
|
+
id: string;
|
|
32
|
+
}>;
|
|
33
|
+
/** Creates a radio choice whose keyboard focus follows its selection. */
|
|
34
|
+
export declare const init: (config: InitConfig) => Model;
|
|
35
|
+
/** Processes a radio choice Message and returns the next Model, Commands and OutMessage. */
|
|
36
|
+
export declare const update: (model: Model, message: Message) => Readonly<{
|
|
37
|
+
model: {
|
|
38
|
+
readonly radioGroup: {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly maybeFocusedIndex: Option.Option<number>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
commands?: Update.Commands<{
|
|
44
|
+
readonly _tag: "GotRadioGroupMessage";
|
|
45
|
+
readonly message: {
|
|
46
|
+
readonly _tag: "CompletedFocusOption";
|
|
47
|
+
} | {
|
|
48
|
+
readonly _tag: "FocusedOption";
|
|
49
|
+
readonly index: number;
|
|
50
|
+
} | {
|
|
51
|
+
readonly _tag: "SelectedOption";
|
|
52
|
+
readonly index: number;
|
|
53
|
+
readonly value: string;
|
|
54
|
+
};
|
|
55
|
+
}, never>;
|
|
56
|
+
outMessage?: {
|
|
57
|
+
readonly _tag: "Selected";
|
|
58
|
+
readonly value: string;
|
|
59
|
+
};
|
|
60
|
+
}>;
|
|
61
|
+
/** One option: its value, its name in pixel caps, and an optional sans note under it. */
|
|
62
|
+
export type RadioOption = Readonly<{
|
|
63
|
+
value: string;
|
|
64
|
+
label: string;
|
|
65
|
+
note?: string;
|
|
66
|
+
}>;
|
|
67
|
+
/** Per-render inputs passed to `view` through `h.submodel`'s `viewInputs`. */
|
|
68
|
+
export type ViewInputs = Readonly<{
|
|
69
|
+
/** Names the group for screen readers; a Fieldset around it says it on the page. */
|
|
70
|
+
label: string;
|
|
71
|
+
options: readonly RadioOption[];
|
|
72
|
+
/** The parent's selection. */
|
|
73
|
+
selectedValue: Option.Option<string>;
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* A choice of one, built on `@foldkit/ui`'s RadioGroup: a `role="radiogroup"` of
|
|
77
|
+
* `role="radio"` options (`aria-checked`), each a button holding its mark, its name and its
|
|
78
|
+
* note, named by the name and described by the note, so a click anywhere on it chooses it.
|
|
79
|
+
* One stop for Tab, and the arrows move the selection. Its mark is a diamond, so a single
|
|
80
|
+
* choice reads apart from a checkbox.
|
|
81
|
+
*/
|
|
82
|
+
export declare const view: import("foldkit/submodel").View<{
|
|
83
|
+
readonly radioGroup: {
|
|
84
|
+
readonly id: string;
|
|
85
|
+
readonly maybeFocusedIndex: Option.Option<number>;
|
|
86
|
+
};
|
|
87
|
+
}, {
|
|
88
|
+
readonly _tag: "GotRadioGroupMessage";
|
|
89
|
+
readonly message: {
|
|
90
|
+
readonly _tag: "CompletedFocusOption";
|
|
91
|
+
} | {
|
|
92
|
+
readonly _tag: "FocusedOption";
|
|
93
|
+
readonly index: number;
|
|
94
|
+
} | {
|
|
95
|
+
readonly _tag: "SelectedOption";
|
|
96
|
+
readonly index: number;
|
|
97
|
+
readonly value: string;
|
|
98
|
+
};
|
|
99
|
+
}, Readonly<{
|
|
100
|
+
/** Names the group for screen readers; a Fieldset around it says it on the page. */
|
|
101
|
+
label: string;
|
|
102
|
+
options: readonly RadioOption[];
|
|
103
|
+
/** The parent's selection. */
|
|
104
|
+
selectedValue: Option.Option<string>;
|
|
105
|
+
}>>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { Array, Option, Schema } from "effect";
|
|
3
|
+
import { defineMessageUnion } from "foldkit/message";
|
|
4
|
+
import { RadioGroup } from "@foldkit/ui";
|
|
5
|
+
import { modifyFields } from "foldkit/struct";
|
|
6
|
+
import { defineView } from "foldkit/submodel";
|
|
7
|
+
import * as Update from "foldkit/update";
|
|
8
|
+
// src/radio-choices/radio-choices.ts
|
|
9
|
+
/** Schema for a radio choice: the `@foldkit/ui` RadioGroup it is built on, which keeps where
|
|
10
|
+
* keyboard focus is. The selected value is the parent's, passed in as `selectedValue`. */
|
|
11
|
+
const Model = Schema.Struct({ radioGroup: RadioGroup.Model });
|
|
12
|
+
/** Union of all Messages a radio choice can produce. */
|
|
13
|
+
const Message = defineMessageUnion({ GotRadioGroupMessage: { message: RadioGroup.Message } });
|
|
14
|
+
/** Union of OutMessages a radio choice reports to its parent: an option was chosen, by a
|
|
15
|
+
* click anywhere on it, Space, or an arrow key. The parent stores `value`. */
|
|
16
|
+
const OutMessage = defineMessageUnion({ Selected: { value: Schema.String } });
|
|
17
|
+
/** Creates a radio choice whose keyboard focus follows its selection. */
|
|
18
|
+
const init = (config) => (__foldkitBrandViewResult(({ radioGroup: RadioGroup.init({ id: config.id }) }), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#init"));
|
|
19
|
+
/** The radio choice's id, unique in the document. */
|
|
20
|
+
const id = (model) => __foldkitBrandViewResult((model.radioGroup.id), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#id");
|
|
21
|
+
const RadioGroup$1 = RadioGroup.create();
|
|
22
|
+
const foldRadioGroup = Update.foldChild({
|
|
23
|
+
update: RadioGroup$1.update,
|
|
24
|
+
read: (model) => __foldkitBrandViewResult((Option.some(model.radioGroup)), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#read"),
|
|
25
|
+
write: (model, nextRadioGroup) => __foldkitBrandViewResult((modifyFields(model, { radioGroup: () => __foldkitBrandViewResult((nextRadioGroup), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#radioGroup") })), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#write"),
|
|
26
|
+
toParentMessage: (message) => __foldkitBrandViewResult((Message.GotRadioGroupMessage({ message })), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#toParentMessage"),
|
|
27
|
+
toParentOutMessage: RadioGroup.OutMessage.match({ Selected: ({ value }) => __foldkitBrandViewResult((OutMessage.Selected({ value })), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#Selected") })
|
|
28
|
+
});
|
|
29
|
+
/** Processes a radio choice Message and returns the next Model, Commands and OutMessage. */
|
|
30
|
+
const update = (model, message) => __foldkitBrandViewResult((Message.match(message, { GotRadioGroupMessage: ({ message: radioGroupMessage }) => __foldkitBrandViewResult((foldRadioGroup(model, radioGroupMessage)), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#GotRadioGroupMessage") })), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#update");
|
|
31
|
+
/**
|
|
32
|
+
* A choice of one, built on `@foldkit/ui`'s RadioGroup: a `role="radiogroup"` of
|
|
33
|
+
* `role="radio"` options (`aria-checked`), each a button holding its mark, its name and its
|
|
34
|
+
* note, named by the name and described by the note, so a click anywhere on it chooses it.
|
|
35
|
+
* One stop for Tab, and the arrows move the selection. Its mark is a diamond, so a single
|
|
36
|
+
* choice reads apart from a checkbox.
|
|
37
|
+
*/
|
|
38
|
+
const view = defineView((model, viewInputs, h) => {
|
|
39
|
+
const { label, options, selectedValue } = viewInputs;
|
|
40
|
+
const optionView = (option, info) => __foldkitBrandViewResult((h.keyed("button")(info.value, [...info.option, h.Class("choice")], [h.span([h.Class("choice-box")]), h.span([], [h.span([...info.label, h.Class("choice-name")], [option.label]), ...option.note === void 0 ? [] : [h.span([...info.description, h.Class("choice-note")], [option.note])]])])), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#optionView");
|
|
41
|
+
return __foldkitBrandViewResult((h.submodel({
|
|
42
|
+
slotId: id(model),
|
|
43
|
+
model: model.radioGroup,
|
|
44
|
+
view: RadioGroup$1.view,
|
|
45
|
+
viewInputs: {
|
|
46
|
+
options: Array.map(options, ({ value }) => __foldkitBrandViewResult((value), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#anonymous~2")),
|
|
47
|
+
selectedValue,
|
|
48
|
+
ariaLabel: label,
|
|
49
|
+
orientation: "Vertical",
|
|
50
|
+
hasOptionDescription: (value) => __foldkitBrandViewResult((Array.some(options, (option) => __foldkitBrandViewResult((option.value === value && option.note !== void 0), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#anonymous~3"))), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#hasOptionDescription"),
|
|
51
|
+
toView: (render) => __foldkitBrandViewResult((h.div([...render.group, h.Class("choices")], Array.zipWith(options, render.options, optionView))), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#toView")
|
|
52
|
+
},
|
|
53
|
+
toParentMessage: (message) => __foldkitBrandViewResult((Message.GotRadioGroupMessage({ message })), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#toParentMessage~2")
|
|
54
|
+
})), "@gjermundgaraba/pixel-paper/radio-choices/radio-choices.js#anonymous");
|
|
55
|
+
});
|
|
56
|
+
export { Message, Model, OutMessage, id, init, update, view };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FocusRailToggle, FollowRailDrawer, HideRailDrawer, InitConfig, Message, Model, OutMessage, ShowRailDrawer, ViewInputs, close, id, init, isOpen, subscriptions, toggle, update, view } from "./rail.js";
|
|
2
|
+
declare namespace index_d_exports {
|
|
3
|
+
export { FocusRailToggle, FollowRailDrawer, HideRailDrawer, InitConfig, Message, Model, OutMessage, ShowRailDrawer, ViewInputs, close, id, init, isOpen, subscriptions, toggle, update, view };
|
|
4
|
+
}
|
|
5
|
+
export { FocusRailToggle, FollowRailDrawer, HideRailDrawer, type InitConfig, Message, Model, OutMessage, ShowRailDrawer, type ViewInputs, close, id, index_d_exports, init, isOpen, subscriptions, toggle, update, view };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { FocusRailToggle, FollowRailDrawer, HideRailDrawer, Message, Model, OutMessage, ShowRailDrawer, close, id, init, isOpen, subscriptions, toggle, update, view } from "./rail.js";
|
|
4
|
+
// src/rail/index.ts
|
|
5
|
+
var rail_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
FocusRailToggle: () => __foldkitBrandViewResult((FocusRailToggle), "@gjermundgaraba/pixel-paper/rail/index.js#FocusRailToggle"),
|
|
7
|
+
FollowRailDrawer: () => __foldkitBrandViewResult((FollowRailDrawer), "@gjermundgaraba/pixel-paper/rail/index.js#FollowRailDrawer"),
|
|
8
|
+
HideRailDrawer: () => __foldkitBrandViewResult((HideRailDrawer), "@gjermundgaraba/pixel-paper/rail/index.js#HideRailDrawer"),
|
|
9
|
+
Message: () => __foldkitBrandViewResult((Message), "@gjermundgaraba/pixel-paper/rail/index.js#Message"),
|
|
10
|
+
Model: () => __foldkitBrandViewResult((Model), "@gjermundgaraba/pixel-paper/rail/index.js#Model"),
|
|
11
|
+
OutMessage: () => __foldkitBrandViewResult((OutMessage), "@gjermundgaraba/pixel-paper/rail/index.js#OutMessage"),
|
|
12
|
+
ShowRailDrawer: () => __foldkitBrandViewResult((ShowRailDrawer), "@gjermundgaraba/pixel-paper/rail/index.js#ShowRailDrawer"),
|
|
13
|
+
close: () => __foldkitBrandViewResult((close), "@gjermundgaraba/pixel-paper/rail/index.js#close"),
|
|
14
|
+
id: () => __foldkitBrandViewResult((id), "@gjermundgaraba/pixel-paper/rail/index.js#id"),
|
|
15
|
+
init: () => __foldkitBrandViewResult((init), "@gjermundgaraba/pixel-paper/rail/index.js#init"),
|
|
16
|
+
isOpen: () => __foldkitBrandViewResult((isOpen), "@gjermundgaraba/pixel-paper/rail/index.js#isOpen"),
|
|
17
|
+
subscriptions: () => __foldkitBrandViewResult((subscriptions), "@gjermundgaraba/pixel-paper/rail/index.js#subscriptions"),
|
|
18
|
+
toggle: () => __foldkitBrandViewResult((toggle), "@gjermundgaraba/pixel-paper/rail/index.js#toggle"),
|
|
19
|
+
update: () => __foldkitBrandViewResult((update), "@gjermundgaraba/pixel-paper/rail/index.js#update"),
|
|
20
|
+
view: () => __foldkitBrandViewResult((view), "@gjermundgaraba/pixel-paper/rail/index.js#view")
|
|
21
|
+
});
|
|
22
|
+
export { FocusRailToggle, FollowRailDrawer, HideRailDrawer, Message, Model, OutMessage, ShowRailDrawer, close, id, init, isOpen, rail_exports, subscriptions, toggle, update, view };
|