foldkit-mixins-ui 0.11.0 → 0.12.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/README.md +13 -8
- package/dist/index.d.mts +68 -14
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +332 -101
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -405,7 +405,7 @@ adapter.
|
|
|
405
405
|
| Switch | `button`, `label`, `description`, `hiddenInput` |
|
|
406
406
|
| Fieldset | `fieldset`, `legend`, `description` |
|
|
407
407
|
| Disclosure | `button`, `panel` |
|
|
408
|
-
| Dialog | `dialog`, `backdrop`, `panel`, `title`, `description`, `initialFocus`, `closeButton`, and this package's `handle` (the Sheet's grabber, `aria-hidden`), `body`, `scroll`, `scrollBar`, `scrollThumb` and `footer`: draw `scroll` and its bar inside `body` and the answers in `footer`, and a body taller than the screen scrolls under the title while the footer stays (`Dialog.overlayBars` beside the style draws the overlay bar). An alert dialog is this one with `role: 'alertdialog'` in its context (`Dialog.toView(mixins, { h, role: 'alertdialog' }, draw)`), which puts `role="alertdialog"` on the `dialog` bundle; draw no close button, and drop the Messages `Dialog.isDismissal` names (Escape, the backdrop, the close button) in `update`, so only its own buttons, closing with `@foldkit/ui`'s `close`, answer it. `covered: true` in the context marks the panel `data-covered`, for a dialog another was opened from (draw the second inside the first's `dialog`, beside its panel), and the recipe steps it back; `attributes` adds to a bundle before the mixins resolve. Recipe `size`: `sm`, `md` (default), `lg`, `xl`, `full` |
|
|
408
|
+
| Dialog | `dialog`, `backdrop`, `panel`, `title`, `description`, `initialFocus`, `closeButton`, and this package's `handle` (the Sheet's grabber, `aria-hidden`), `body`, `scroll`, `scrollBar`, `scrollThumb` and `footer`: draw `scroll` and its bar inside `body` and the answers in `footer`, and a body taller than the screen scrolls under the title while the footer stays (`Dialog.overlayBars` beside the style draws the overlay bar). `Dialog.keyboard` among the mixins of a dialog or sheet that holds a field measures the on-screen keyboard on the panel, and the recipes keep the panel above it (a Dialog shrinks, a bottom Sheet stands on it): iOS Safari and Chrome on Android otherwise leave it under the keys. An alert dialog is this one with `role: 'alertdialog'` in its context (`Dialog.toView(mixins, { h, role: 'alertdialog' }, draw)`), which puts `role="alertdialog"` on the `dialog` bundle; draw no close button, and drop the Messages `Dialog.isDismissal` names (Escape, the backdrop, the close button) in `update`, so only its own buttons, closing with `@foldkit/ui`'s `close`, answer it. `covered: true` in the context marks the panel `data-covered`, for a dialog another was opened from (draw the second inside the first's `dialog`, beside its panel), and the recipe steps it back; `attributes` adds to a bundle before the mixins resolve. Recipe `size`: `sm`, `md` (default), `lg`, `xl`, `full` |
|
|
409
409
|
| Popover | `button`, `panel`, `backdrop`, `arrow`, and this package's `layer`, drawn around the panel to show it in the top layer (see [The top layer](#the-top-layer)); `Popover.anchor(config?)` is the placement. Recipe `arrow`: `shown` (default), `none` |
|
|
410
410
|
| Tooltip | `trigger`, `panel`, `arrow`, and this package's `layer`. `Tooltip.toView(mixins, { h, id }, draw)` takes the Tooltip's id (`model.id`), whose trigger the arrow points at; `Tooltip.anchor(config?)` is the placement, above by default. Recipe `arrow`: `shown` (default), `none` |
|
|
411
411
|
| HoverIntent | `trigger`, `panel`, `arrow` (open and close delays with intent, for a hover card or a menu). `anchored: { id, anchor? }` in the context anchors the panel to the trigger in the top layer (`HoverIntent.anchor()` unless given), the trigger taking `HoverIntent.triggerId(id)` |
|
|
@@ -474,13 +474,13 @@ A `label` makes the icon `role="img"`. Without one the glyph is `aria-hidden`.
|
|
|
474
474
|
| `FloatingPanel` | After Zag's: a non-modal window. `FloatingPanel.init({ id, rect, open? })` holds its rect, stage and a drag, folded with `FloatingPanel.update(limits)` (`min`, `max`, `grid`, `overflow`); `FloatingPanel.open(model, { opener })` focuses it and `close` gives focus back. `FloatingPanel.view({ model, onMessage, title, content, order?, draggable?, resizable?, closeOnEscape?, step?, direction?, labels?, style? }, h)`: the drag trigger moves it and eight edges resize it, kept within the viewport; the arrows move it from the drag trigger and resize it from the bottom-end corner; minimize, maximize, restore and close. A press or focus inside returns the `Raised` OutMessage, which the application folds into the `order` its panels stack by with `FloatingPanel.raise(order, id)`. | `header`. Slots `root`, `boundary`, `panel`, `header`, `dragTrigger`, `title`, `controls`, `minimize`, `maximize`, `restore`, `close`, `body`, `handle`. |
|
|
475
475
|
| `HoverCard` (recipe) | Styles `@foldkit/ui`'s HoverIntent (`HoverIntentSlots`): a trigger read as a link, a raised panel fading in on the fast tier as it is drawn. Place the panel with `HoverIntent.toView`'s `anchored`, which shows it in the top layer with an `arrow`; the open and close delays are HoverIntent's (200ms and 300ms by default). | No axis. Slots `trigger`, `panel`, `arrow`. |
|
|
476
476
|
| `Icon` | `{ content, label? }`. A `label` is `role="img"`; without one the glyph is `aria-hidden`. | `size`: `sm`, `md`, `lg` on the type scale; none (the default) stands on the size ladder, 16px or 14px compact. Slot `glyph`. |
|
|
477
|
-
| `ImageCropper` | After Zag's: the image fitted in a viewport, a selection that a drag moves (`Move`) and eight handles resize, zoom by a Slider, the wheel and `+`/`-` with the selection kept where it is on screen, a pan of the zoomed image, quarter turns, an aspect lock and a round crop. `ImageCropper.init({ id, aspect?, shape?, crop?, min?, maxZoom? })` holds the crop, in the turned image's pixels, folded with `ImageCropper.update`; keys (arrows, Shift ×10, Alt to resize) step by screen pixels. Drawn with `ImageCropper.view({ model, onMessage, label, src, crossOrigin?, controls?, labels?, disabled?, style?, slider? }, h)`. `ImageCropper.crop(model)` is the crop in whole pixels (an `Option`); `RequestedExport({ type, quality })` returns the `Export` Command, answered by `Exported({ url, width, height })` or `FailedExport`. | `guides`, `handles` (`all`, `corners`), `viewport` (`landscape`, `wide`, `square`). Its zoom takes `Recipes.Slider({ label: 'hidden' })`. Slots `root`, `label`, `viewport`, `stage`, `pan`, `image`, `selection`, `guides`, `handle`, `controls`, `zoom`, `rotate`, `reset`. |
|
|
477
|
+
| `ImageCropper` | After Zag's: the image fitted in a viewport, a selection that a drag moves (`Move`) and eight handles resize, zoom by a Slider, the wheel, two fingers spread or pinched, and `+`/`-` with the selection kept where it is on screen, a pan of the zoomed image, quarter turns, an aspect lock and a round crop. `ImageCropper.init({ id, aspect?, shape?, crop?, min?, maxZoom? })` holds the crop, in the turned image's pixels, folded with `ImageCropper.update`; keys (arrows, Shift ×10, Alt to resize) step by screen pixels. Drawn with `ImageCropper.view({ model, onMessage, label, src, crossOrigin?, controls?, labels?, disabled?, style?, slider? }, h)`. `ImageCropper.crop(model)` is the crop in whole pixels (an `Option`); `RequestedExport({ type, quality })` returns the `Export` Command, answered by `Exported({ url, width, height })` or `FailedExport`. | `guides`, `handles` (`all`, `corners`), `viewport` (`landscape`, `wide`, `square`). Its zoom takes `Recipes.Slider({ label: 'hidden' })`. Slots `root`, `label`, `viewport`, `stage`, `pan`, `image`, `selection`, `guides`, `handle`, `controls`, `zoom`, `rotate`, `reset`. |
|
|
478
478
|
| `InputCopy` | A read-only value with a copy button, Zag's clipboard: `InputCopy.view({ id, label, value, copied, onCopy, copyLabel?, copiedLabel?, style? }, h)`. The view is stateless: answer `onCopy` with the `InputCopy.Copy({ text })` Command, which yields `foldkit-primitives/dom`'s `ClipboardMessage` (`Copied` or `CopyFailed`, never a throw); `copied` is the application's, and `InputCopy.Model` keeps it: `InputCopy.init({ resetAfter? })` (default 2000ms), folded with `InputCopy.update`, where `Copied` on `ClipboardMessage.Copied` shows it copied and starts the `Reset` Command that sets it back unless a later copy came first; pass `model.copied`. The button is named `Copy <label>`; copied, it reads `Copied` and a polite status region says so. | No axis. Slots `root`, `label`, `group`, `input`, `button`, `status`. |
|
|
479
479
|
| `Item` | The row primitive: `{ content?, media?, title?, description?, actions?, press?, label?, selected?, disabled? }`; `content` follows the title and description. `press` is `{ onClick }` or `{ href }`, one control stretched over the row (`overlay`, as a Card's) and named by `label` or the title, `actions` staying pressable above it; `selected` is `aria-pressed` or `aria-current`. `Item.group({ items: (ItemView & { key })[], label?, style?, itemStyle? })` is a list of them. Field is for form controls. | `variant`: `plain` (default), `outline`, `muted`; `density`: `comfortable` (default), `compact`; `media`: `plain` (default), `icon`, `image`. Slots `root`, `media`, `content`, `title`, `description`, `actions`, `overlay`. `Recipes.ItemGroup({ layout: 'divided' \| 'separated' })` over `ItemGroupSlots` (`root`, `row`). |
|
|
480
480
|
| `Kbd` | `{ key }`. Names the key. `Kbd.combo({ keys, joiner? }, h)` draws several in one `kbd`, with an optional joiner between them. | No axis. Slots `key`, `combo`, `joiner`. |
|
|
481
481
|
| `Label` | `{ for, text }`. `for` is the control's id. | No axis. Slot `label`. |
|
|
482
482
|
| `Marquee` | After Zag's: content that scrolls on without a seam. `Marquee.init({ id })` holds what it measured and whether it is paused, folded with `Marquee.update`; `Marquee.view({ model, onMessage, label, items, side?, speed?, autoFill?, repeat?, delay?, loopCount?, style? }, h)` measures its content (`Resize`) and draws copies to fill the viewport, `inert` after the first. A pointer, focus or its pause press (WCAG 2.2.2) holds it; `Marquee.Message.Paused()` holds it from outside. Its motion is CSS, and under reduced motion the viewport scrolls instead. | `spacing`, `edges` (`fade`, `none`). Slots `root`, `viewport`, `content`, `item`, `pause`. |
|
|
483
|
-
| `Menu` | One menu, opened three ways: `Menu.init(id, rows, { isAnimated?, isModal? })` (a row with `items` hosts a submenu, one level deep; `isAnimated` gives the menu's and its submenus' panels upstream's transition marks, for the recipe's fade, and `isModal` makes the rest of the page inert while the menu is open), folded with `Menu.update`, drawn with `Menu.view({ model, rows, buttonContent, onMessage, opensAt?, direction?, isRowDisabled?, mixins, submenuMixins? }, h)`, the style being one of the `mixins` (`[MenuStyle.mixin]`). By a button (`opensAt` unset); at a point (`opensAt: 'point'`, with `Menu.target(onMessage, h)` on the area: a right press records its point and the `contextmenu` after it opens the menu there). A row is an `ItemRow` (`{ label }`), a `CheckRow` (`check: 'checkbox' \| 'radio'`, `checked`: `menuitemcheckbox` or `menuitemradio` with `aria-checked`; choosing it sends `Selected` and leaves the menu open, the application keeping `checked`, a radio row's group being the rows of its `group`), or a `SubmenuRow` (`items`). Any row may name a `group` (rows next to each other with one group stand under its heading, a separator between groups), a `shortcut` (keys drawn at the row's end as Kbd with the view's `kbd`, named in `aria-keyshortcuts`; the menu binds nothing) and `tone: 'destructive'` (`data-tone`). A submenu's row is a `menuitem` with `aria-haspopup="menu"` and `aria-expanded`; ArrowRight, Enter or Space opens it on its first row, ArrowLeft or Escape closes it back to the row (under `direction: 'rtl'`, drawn as the root's `dir`, the submenu opens on the left, its chevron points there, and the arrows swap), a pointer resting 150ms opens it, and choosing a leaf closes everything. `Selected` names the value and the submenu it came from. Pass `Menu.fluid` beside the style (in `submenuMixins`, not `mixins`, where rows open submenus). Its panels, submenus included, draw in the top layer. A `@foldkit/ui` Menu the application folds itself, for typed items or groups, is drawn through the panel adapter instead, and opens at a point with `Menu.drawAtPoint` and `Menu.pointTarget` (see [Why some components needed a fork](#why-some-components-needed-a-fork)). | No axis. Slots `MenuSlots`. |
|
|
483
|
+
| `Menu` | One menu, opened three ways: `Menu.init(id, rows, { isAnimated?, isModal? })` (a row with `items` hosts a submenu, one level deep; `isAnimated` gives the menu's and its submenus' panels upstream's transition marks, for the recipe's fade, and `isModal` makes the rest of the page inert while the menu is open), folded with `Menu.update`, drawn with `Menu.view({ model, rows, buttonContent, onMessage, opensAt?, direction?, isRowDisabled?, mixins, submenuMixins? }, h)`, the style being one of the `mixins` (`[MenuStyle.mixin]`). By a button (`opensAt` unset); at a point (`opensAt: 'point'`, with `Menu.target(onMessage, h)` on the area: a right press records its point and the `contextmenu` after it opens the menu there; a finger or a pen held there `Menu.HOLD_MS`, 500ms, opens it too, as iOS fires no `contextmenu`, while one that moves 10px is a scroll; give the area `-webkit-touch-callout: none` and `user-select: none`, or iOS shows its own callout over it). A row is an `ItemRow` (`{ label }`), a `CheckRow` (`check: 'checkbox' \| 'radio'`, `checked`: `menuitemcheckbox` or `menuitemradio` with `aria-checked`; choosing it sends `Selected` and leaves the menu open, the application keeping `checked`, a radio row's group being the rows of its `group`), or a `SubmenuRow` (`items`). Any row may name a `group` (rows next to each other with one group stand under its heading, a separator between groups), a `shortcut` (keys drawn at the row's end as Kbd with the view's `kbd`, named in `aria-keyshortcuts`; the menu binds nothing) and `tone: 'destructive'` (`data-tone`). A submenu's row is a `menuitem` with `aria-haspopup="menu"` and `aria-expanded`; ArrowRight, Enter or Space opens it on its first row, ArrowLeft or Escape closes it back to the row (under `direction: 'rtl'`, drawn as the root's `dir`, the submenu opens on the left, its chevron points there, and the arrows swap), a pointer resting 150ms opens it, and choosing a leaf closes everything. `Selected` names the value and the submenu it came from. Pass `Menu.fluid` beside the style (in `submenuMixins`, not `mixins`, where rows open submenus). Its panels, submenus included, draw in the top layer. A `@foldkit/ui` Menu the application folds itself, for typed items or groups, is drawn through the panel adapter instead, and opens at a point with `Menu.drawAtPoint` and `Menu.pointTarget` (see [Why some components needed a fork](#why-some-components-needed-a-fork)). | No axis. Slots `MenuSlots`. |
|
|
484
484
|
| `Menubar` | A row of `@foldkit/ui` Menus, shadcn's and the APG's menubar: `Menubar.view({ label, model, menus, onMessage, direction?, style?, menuMixins }, h)`, each menu's `{ label, rows, isRowDisabled? }` taking a Menu's rows (none opening a submenu), its Model (`Menubar.init(ids, { isAnimated?, isModal? })`) folded with `Menubar.update`, whose `Selected` OutMessage names the menu and the row. One trigger is the tab stop; ArrowLeft/ArrowRight (Home/End while all are shut) move it, swapped under `direction: 'rtl'` (drawn as the bar's `dir`), and with a menu open they open the next on its first row. While one is open, pointing at another opens it, and opening any shuts the rest. `Recipes.MenubarMenu` is the Menu recipe with a bar's flat triggers. | No axis. Slots `bar`, `menu`; each menu's are `MenuSlots`. |
|
|
485
485
|
| `MessageScroller` | A conversation's log that follows the newest message while the reader is at the end and stops when they scroll up. `MessageScroller.init({ id })` holds only whether it follows and how many arrived unseen; the scroll position is the browser's, read by its `FollowEnd` Mount. Fold `MessageScroller.update`, and send `Message.Appended({ count })` when your update appends messages (not when it loads older ones, which it holds in place). `MessageScroller.view({ model, label, content, onMessage, jumpLabel?, unseenLabel?, style?, areaStyle?, areaMixins? }, h)` draws a named `role="log"` in a ScrollArea, with a jump button counting what arrived while away; give its parent a height. | No axis. Slots `root`, `log`, `jump`, `count`. |
|
|
486
486
|
| `Meter` | `@foldkit/ui`'s Meter: `Meter.view({ id, label, value, min?, max?, low?, high?, optimum?, valueText?, style? }, h)` draws a `meter` named by its label. The root says how good the value is as `data-level` (`good`, `fair`, `poor`), as the HTML meter judges it; `Meter.levelOf` is that judgment. A measurement, where `Progress` is work. | No axis; the fill takes success, warning or error by level. Slots `root`, `label`, `track`, `fill`. |
|
|
@@ -503,7 +503,7 @@ A `label` makes the icon `role="img"`. Without one the glyph is `aria-hidden`.
|
|
|
503
503
|
| `Slider` | `Slider.view({ id, label, value, onChange, min?, max?, step?, format?, marks?, showValue?, name?, disabled?, style? }, h)`, where `value` is a number or a `{ low, high }` range and `onChange` is handed the same kind. Native `input type="range"` thumbs, so drag, keys, right to left and the form value are the browser's. One number is one thumb across the track, named by the label; a press anywhere on the track moves it. A range is a `group` named by its label holding two thumbs named by `thumbLabels` (default `Minimum` and `Maximum`), each bounded by the other (the low one's `max` is the high value), so the browser stops a drag or a key at the other thumb; `Slider.moved(range, 'low' \| 'high', value, bounds)` snaps, bounds and orders a range, and returns the same range when nothing changed. `marks` are values dotted on the track (`data-filled` where the fill covers them) and `showValue` draws each value, both hidden from assistive technology, which hears `aria-valuetext`. `@foldkit/ui`'s Slider is not adapted: draw its Submodel with Slots of your own. `orientation: 'vertical'` stands it upright; `ticks` dots every step; a mark may be `{ value, label }` (`SliderMark`), its words under the track. | `tone`: `accent` (default) or `neutral`; `size`: `sm`, `md` (default), `lg`, the thumb's edge; `track`: `thick` (default; the fill reaches each thumb's far edge, Fluid's look), `thin` or `paint` (a track a holder paints, as the color picker's); `value`: `above` (default), `inside` (widens the thumb into a pill; best at `md` or `lg`) or `end` (at the end of the label's row); `label`: `shown` (default) or `hidden`. Slots `root`, `label`, `control`, `track`, `fill`, `mark`, `value`, `thumb`. |
|
|
504
504
|
| `Spinner` | `{ label?, showLabel? }`. `role="status"`; `showLabel` draws the label beside the wheel. A turn is about 720ms times `travel`. | `kind`: `ring` (default), `dots`, `bars`, `pulse`, `orbit`; `size`: `sm`, `md` (default), `lg`; `tone`: `accent` (default), `neutral`, `current`. Slots `wheel`, `part`, `root`, `text`. |
|
|
505
505
|
| `Steps` | `Steps.view({ label, steps: { title, description?, icon?, content? }[], current, onSelect?, style? }, h)`: a stepper, an ordered list named by `label`. The step at `current` is `aria-current="step"`, those before it `data-state="complete"` (a check replaces the number), those after `upcoming`. An `icon` stands in the marker for its number; `content` follows the step, beside the line in a vertical stepper. With `onSelect(index)`, completed steps are buttons for going back; steps ahead never are. The application owns `current`. `progress` (0 to 1) fills the connector after the current step when the recipe's connector is a progress bar. | `orientation`: `horizontal` (default) or `vertical`; `size`: `xs`, `sm`, `md`, `lg` (the Avatar's sizes; unset, 1.75rem); `marker`: `number` or `dot`; `connector`: `line` or `progress`. Slots `root`, `item`, `step`, `trigger`, `marker`, `text`, `title`, `description`, `content`, `connector`. |
|
|
506
|
-
| `Table` | The presentational table: `{ columns: { header, value, numeric?, sortKey? }[], rows, rowKey?, caption?, fluid?, sort?, selection?, expansion?, empty? }`. A column with a `sortKey` heads with a button that sends `sort.onSort(column)`, and the sorted column carries `aria-sort`; `Table.nextSort(sort, column)` cycles ascending, descending and none. `selection` puts a checkbox on every row and one in the heading, mixed while only some are chosen; `expansion` opens a row's detail in a row below it (`aria-expanded`, `aria-controls`); `empty` stands across the table while there are no rows (an `Empty.view`). The sort, the chosen and the open rows are the application's. With `fluid`, one highlight behind the body rows follows the pointer, skipping detail and empty rows. Filtering, column reorder and resize, and virtualized rows stay with `foldkit-data-grid`. | `rows`: `lined`, `striped`, `plain`; `density`: `compact`, `regular`, `comfortable` (none set follows the region); `header`: `static`, `sticky`. Slots `frame`, `highlight` (with `fluid`), `root`, `caption`, `head`, `headerRow`, `headerCell`, `sortButton`, `sortIcon`, `body`, `row`, `cell`, `controlCell`, `checkboxLabel`, `expandButton`, `expandIcon`, `detailRow`, `detailCell`, `emptyRow`, `emptyCell`. |
|
|
506
|
+
| `Table` | The presentational table: `{ columns: { header, value, numeric?, sortKey? }[], rows, rowKey?, caption?, fluid?, sort?, selection?, expansion?, empty? }`. A column with a `sortKey` heads with a button that sends `sort.onSort(column)`, and the sorted column carries `aria-sort`; `Table.nextSort(sort, column)` cycles ascending, descending and none. `selection` puts a checkbox on every row and one in the heading, mixed while only some are chosen; `expansion` opens a row's detail in a row below it (`aria-expanded`, `aria-controls`); `empty` stands across the table while there are no rows (an `Empty.view`). The sort, the chosen and the open rows are the application's. It stands in a `frame`, which scrolls sideways when the table is wider than the screen (under a `static` header; a `sticky` one sticks to the application's scroller, which scrolls it). With `fluid`, one highlight behind the body rows follows the pointer, skipping detail and empty rows. Filtering, column reorder and resize, and virtualized rows stay with `foldkit-data-grid`. | `rows`: `lined`, `striped`, `plain`; `density`: `compact`, `regular`, `comfortable` (none set follows the region); `header`: `static`, `sticky`. Slots `frame`, `highlight` (with `fluid`), `root`, `caption`, `head`, `headerRow`, `headerCell`, `sortButton`, `sortIcon`, `body`, `row`, `cell`, `controlCell`, `checkboxLabel`, `expandButton`, `expandIcon`, `detailRow`, `detailCell`, `emptyRow`, `emptyCell`. |
|
|
507
507
|
| `TagsInput` | Zag's tags input, a small Model of its own: `TagsInput.init({ id, tags?, delimiter?, max? })`, folded with `TagsInput.update` (which returns a focus Command), drawn with `TagsInput.view({ model, onMessage, label, placeholder?, disabled? }, h)`. The tags are a list of chips named by the label, each with a `Remove <tag>` button, then a text input. Enter or the delimiter (default `,`) adds the draft split at the delimiter and trimmed, refusing empty and repeated parts, and parts past `max`: a refusal (`TagsInput.Refusal`: `Repeat`, `Empty`, `Full`) is said in a polite `message` (worded by `refusalText`) and shakes the field once, the shake travel-aware; Backspace on an empty draft removes the last tag; a removal returns focus to the input. Keys reach `update`, which decides from its own draft. | No axis; `data-disabled` on `control`. Slots `root`, `label`, `control`, `list`, `tag`, `remove`, `input`, `message`. |
|
|
508
508
|
| `ThinkingIndicator` | An assistant at work: `ThinkingIndicator.view({ label?, detail?, active?, icon?, style? }, h)` draws dots, a pulse or the view's icon beside words a band of light sweeps, and a detail line, in a polite status. Keep it drawn with `active: false` before work starts, so what it says when it starts is announced. Every movement holds under reduced motion. | `mark` (`dots`, `pulse`, `none`), `label` (`shimmer`, `plain`, `hidden`), `tone` (`muted`, `accent`). Slots `root`, `mark`, `dot`, `icon`, `label`, `detail`. |
|
|
509
509
|
| `ThinkingSteps` | The trace of what an assistant did: `ThinkingSteps.view({ id, steps, open, onToggle, duration?, summary?, openSteps?, onToggleStep?, stateWords?, style? }, h)`. Each step is `{ id, title, state, duration?, detail?, icon?, steps? }`, `state` being `pending`, `running`, `done` or `failed`, said in words too. The button says the running step's title, or "Thought for 4s". Its openness is yours, an `Option<boolean>`: none opens it while a step runs and shuts it once all are done, and the press sends the state the reader asked for. `openSteps` and `onToggleStep` make each step's detail collapsible (`Accordion.toggled`). | `variant` (`plain`, `card`), `connector` (`line`, `none`). Slots `root`, `trigger`, `summary`, `chevron`, `panel`, `list`, `step`, `head`, `marker`, `title`, `state`, `duration`, `body`, `detail`. |
|
|
@@ -892,9 +892,12 @@ direction explicitly:
|
|
|
892
892
|
## Mechanisms
|
|
893
893
|
|
|
894
894
|
`Touch` and `Icons` are style mechanisms, not components: no slots, no views.
|
|
895
|
-
Compose them into your own slots.
|
|
896
|
-
where the pointer is coarse
|
|
897
|
-
|
|
895
|
+
Compose them into your own slots. The recipes' own controls already stand
|
|
896
|
+
44px tall where the pointer is coarse: `Defaults.reset` sets
|
|
897
|
+
`--fk-touch-floor` there, and a control's height on the size ladder is at
|
|
898
|
+
least that (a region that must stay dense sets it to `0px`). For your own
|
|
899
|
+
slots, `Touch.target` floors one control at 44px where the pointer is coarse;
|
|
900
|
+
`Touch.targets` floors every boxed control a region draws. `Icons.glyph(size)` draws the icon in `--icon` before the
|
|
898
901
|
element's words, and `Icons.byAttribute(attribute, icons)` sets `--icon` from
|
|
899
902
|
an attribute's value, where `icons` maps each value to its resolved `url(…)`:
|
|
900
903
|
|
|
@@ -976,7 +979,9 @@ h)` as `toView`'s `draw` (its button becomes a mark of no size at `point`, an
|
|
|
976
979
|
sends `onPress` with its point, which the application keeps, and the
|
|
977
980
|
`contextmenu` after it (or Shift+F10, or the ContextMenu key) sends `onOpen`,
|
|
978
981
|
which the application answers with the Menu's own `Opened` Message, the
|
|
979
|
-
browser's menu kept shut.
|
|
982
|
+
browser's menu kept shut. A finger's press sends `onPress` too, so Android's
|
|
983
|
+
`contextmenu` for a held finger opens under it; iOS fires none, which the
|
|
984
|
+
component's `Menu.target` answers by opening on the hold itself. The component (`Menu.init/update/view`, in the table above) is
|
|
980
985
|
this package's own, drawn through the adapter, as the Slider is; its
|
|
981
986
|
`Menu.target` is `pointTarget` wired to its own Messages.
|
|
982
987
|
|
package/dist/index.d.mts
CHANGED
|
@@ -422,7 +422,7 @@ type MenuBundle<Item extends string = string> = Readonly<{
|
|
|
422
422
|
/** The forked `view` with upstream's `update` and helpers. */
|
|
423
423
|
declare const create$2: <Item extends string = string>() => MenuBundle<Item>;
|
|
424
424
|
declare namespace menu_d_exports {
|
|
425
|
-
export { CheckRow, InitOptions$1 as InitOptions, ItemRow, LeafRow, MenuSlots, MenuViewOptions, Message$28 as Message, Model$27 as Model, OutMessage$4 as OutMessage, Point$1 as Point, PointTargetOptions, ResolvedMenu, ResolvedMenuGroup, ResolvedMenuHeading, ResolvedMenuItem, Row, RowsOptions, SubmenuRow, checkChosen, drawAtPoint, fluid$6 as fluid, grouping, init$22 as init, keyShortcuts, overlayBars$6 as overlayBars, pointTarget, resolve$21 as resolve, target$1 as target, toView$21 as toView, update$24 as update, view$61 as view, withRows };
|
|
425
|
+
export { CheckRow, HOLD_MS, InitOptions$1 as InitOptions, ItemRow, LeafRow, MenuSlots, MenuViewOptions, Message$28 as Message, Model$27 as Model, OutMessage$4 as OutMessage, Point$1 as Point, PointTargetOptions, ResolvedMenu, ResolvedMenuGroup, ResolvedMenuHeading, ResolvedMenuItem, Row, RowsOptions, SubmenuRow, checkChosen, drawAtPoint, fluid$6 as fluid, grouping, init$22 as init, keyShortcuts, overlayBars$6 as overlayBars, pointTarget, resolve$21 as resolve, target$1 as target, toView$21 as toView, update$24 as update, view$61 as view, withRows };
|
|
426
426
|
}
|
|
427
427
|
/**
|
|
428
428
|
* Menu is a nested Submodel: one `button`/`backdrop`/`items` group plus an
|
|
@@ -630,6 +630,8 @@ interface PointTargetOptions<Message> {
|
|
|
630
630
|
* browser's own menu kept shut. `target` is this for the component.
|
|
631
631
|
*/
|
|
632
632
|
declare const pointTarget: <Message>(options: PointTargetOptions<Message>, h: HtmlBuilder<Message>) => ReadonlyArray<Attribute<Message>>;
|
|
633
|
+
/** How long a finger is held on the `target` area before the menu opens there. */
|
|
634
|
+
declare const HOLD_MS = 500;
|
|
633
635
|
declare const Model$27: Schema.Struct<{
|
|
634
636
|
readonly menu: Schema.Struct<{
|
|
635
637
|
readonly id: Schema.String;
|
|
@@ -700,6 +702,13 @@ declare const Model$27: Schema.Struct<{
|
|
|
700
702
|
readonly x: Schema.Number;
|
|
701
703
|
readonly y: Schema.Number;
|
|
702
704
|
}>>;
|
|
705
|
+
/** A finger held on the `target` area, from where on the screen it went down. */
|
|
706
|
+
readonly holding: Schema.Option<Schema.Struct<{
|
|
707
|
+
readonly x: Schema.Number;
|
|
708
|
+
readonly y: Schema.Number;
|
|
709
|
+
}>>;
|
|
710
|
+
/** Counts the holds, so a `HOLD_MS` that ran out for an earlier one does nothing. */
|
|
711
|
+
readonly hold: Schema.Number;
|
|
703
712
|
}>;
|
|
704
713
|
type Model$27 = typeof Model$27.Type;
|
|
705
714
|
declare const Message$28: import("foldkit/message").MessageUnion<{
|
|
@@ -863,6 +872,30 @@ declare const Message$28: import("foldkit/message").MessageUnion<{
|
|
|
863
872
|
readonly y: Schema.Number;
|
|
864
873
|
}>;
|
|
865
874
|
};
|
|
875
|
+
/** A finger or a pen down on the `target` area: its point, and where on the screen it is. */
|
|
876
|
+
readonly TouchedTarget: {
|
|
877
|
+
point: Schema.Struct<{
|
|
878
|
+
readonly x: Schema.Number;
|
|
879
|
+
readonly y: Schema.Number;
|
|
880
|
+
}>;
|
|
881
|
+
screen: Schema.Struct<{
|
|
882
|
+
readonly x: Schema.Number;
|
|
883
|
+
readonly y: Schema.Number;
|
|
884
|
+
}>;
|
|
885
|
+
};
|
|
886
|
+
/** The finger moved, to where on the screen it is. */
|
|
887
|
+
readonly MovedOnTarget: {
|
|
888
|
+
screen: Schema.Struct<{
|
|
889
|
+
readonly x: Schema.Number;
|
|
890
|
+
readonly y: Schema.Number;
|
|
891
|
+
}>;
|
|
892
|
+
};
|
|
893
|
+
/** The finger lifted, or the browser took it for a scroll. */
|
|
894
|
+
readonly LiftedFromTarget: {};
|
|
895
|
+
/** `HOLD_MS` ran out for the hold it counts. */
|
|
896
|
+
readonly HeldTarget: {
|
|
897
|
+
hold: Schema.Number;
|
|
898
|
+
};
|
|
866
899
|
/** A checkbox or radio row chosen, which leaves the menu open: its words. */
|
|
867
900
|
readonly ChoseCheck: {
|
|
868
901
|
value: Schema.String;
|
|
@@ -900,8 +933,10 @@ type Return$11 = ReturnWithOutMessage<Model$27, Message$28, OutMessage$4>;
|
|
|
900
933
|
/** The menu after `message`; the same Model when nothing changes. */
|
|
901
934
|
declare const update$24: (model: Model$27, message: Message$28) => Return$11;
|
|
902
935
|
/**
|
|
903
|
-
* The attributes of the area a menu with `opensAt: 'point'` opens in: a
|
|
904
|
-
*
|
|
936
|
+
* The attributes of the area a menu with `opensAt: 'point'` opens in: a right press records
|
|
937
|
+
* its point, and its `contextmenu` opens the menu; a finger or a pen held there `HOLD_MS`
|
|
938
|
+
* opens it too, as iOS fires no `contextmenu` for one. Give the area
|
|
939
|
+
* `-webkit-touch-callout: none` and `user-select: none`, or iOS shows its own callout over it.
|
|
905
940
|
*/
|
|
906
941
|
declare const target$1: <ParentMessage>(onMessage: (message: Message$28) => ParentMessage, h: HtmlBuilder<ParentMessage>) => ReadonlyArray<Attribute<ParentMessage>>;
|
|
907
942
|
interface MenuViewOptions<ParentMessage> {
|
|
@@ -4937,7 +4972,7 @@ declare const toView$14: (mixins: MixinList<Message$3>, draw?: (resolved: Resolv
|
|
|
4937
4972
|
*/
|
|
4938
4973
|
declare const update$14: (selection: Selection) => (model: Model$3, message: Message$3) => Update.ReturnWithOutMessage<Model$3, Message$3, OutMessage>;
|
|
4939
4974
|
declare namespace dialog_d_exports {
|
|
4940
|
-
export { DialogContext, DialogSlots, ResolvedDialog, isDismissal, overlayBars$1 as overlayBars, resolve$13 as resolve, toView$13 as toView };
|
|
4975
|
+
export { DialogContext, DialogSlots, ResolvedDialog, isDismissal, keyboard, overlayBars$1 as overlayBars, resolve$13 as resolve, toView$13 as toView };
|
|
4941
4976
|
}
|
|
4942
4977
|
/**
|
|
4943
4978
|
* Dialog is a Submodel: each published bundle is a `ChildAttribute` group that
|
|
@@ -4984,6 +5019,13 @@ export declare const DialogSlots: Slots.Contract<{
|
|
|
4984
5019
|
* `scroll` in `body`. Where the pointer is coarse the browser's bar stays.
|
|
4985
5020
|
*/
|
|
4986
5021
|
declare const overlayBars$1: readonly [import("foldkit-mixins").MixinValue<never>];
|
|
5022
|
+
/**
|
|
5023
|
+
* The on-screen keyboard's height on the `panel` (`--fk-keyboard-inset`), which the Dialog
|
|
5024
|
+
* and Sheet recipes keep the panel above: iOS Safari, and Chrome on Android unless the page
|
|
5025
|
+
* asks otherwise, leave a fixed panel under the keys when a field in it takes focus. Pass it
|
|
5026
|
+
* among the mixins of a dialog or sheet that holds a field. Opt in, as it sends no Message.
|
|
5027
|
+
*/
|
|
5028
|
+
declare const keyboard: readonly [import("foldkit-mixins").MixinValue<never>];
|
|
4987
5029
|
/** The dialog's bundles with the attached Mixins applied. */
|
|
4988
5030
|
type ResolvedDialog<Message> = Resolved<RenderInfo$1, typeof DialogSlots, Message>;
|
|
4989
5031
|
interface DialogContext<Input, Message> extends ResolveContext<Input, Message> {
|
|
@@ -8183,7 +8225,9 @@ declare const Table: import("foldkit-mixins").SlotRecipe<import("foldkit-mixins"
|
|
|
8183
8225
|
};
|
|
8184
8226
|
};
|
|
8185
8227
|
header: {
|
|
8186
|
-
static: {
|
|
8228
|
+
static: {
|
|
8229
|
+
frame: import("foldkit-mixins").StyleValue;
|
|
8230
|
+
};
|
|
8187
8231
|
sticky: {
|
|
8188
8232
|
headerCell: import("foldkit-mixins").StyleValue;
|
|
8189
8233
|
};
|
|
@@ -9391,9 +9435,10 @@ declare namespace table_d_exports {
|
|
|
9391
9435
|
* filtering, reordering and resizing columns, editing cells, moving between
|
|
9392
9436
|
* them with the keys, and virtualized rows belong there, not here.
|
|
9393
9437
|
*
|
|
9394
|
-
*
|
|
9395
|
-
*
|
|
9396
|
-
* a child of a `tbody`, so it
|
|
9438
|
+
* It stands in a `frame`, which the recipe scrolls sideways when the table is wider than
|
|
9439
|
+
* the screen. Drawn with `fluid`, the frame holds one `highlight` behind the rows, which
|
|
9440
|
+
* follows the pointer to the nearest one: a highlight cannot be a child of a `tbody`, so it
|
|
9441
|
+
* is the frame's. An open row's detail and the
|
|
9397
9442
|
* empty state are rows of their own, which the highlight passes over.
|
|
9398
9443
|
*/
|
|
9399
9444
|
export declare const TableSlots: Slots.Contract<{
|
|
@@ -11137,8 +11182,13 @@ declare const Model$16: Schema.Struct<{
|
|
|
11137
11182
|
readonly swiped: Schema.Boolean;
|
|
11138
11183
|
}>>;
|
|
11139
11184
|
readonly next: Schema.Number;
|
|
11140
|
-
/**
|
|
11185
|
+
/**
|
|
11186
|
+
* What holds the stack: the mouse on it, a finger or a pen on it, focus in it, the page
|
|
11187
|
+
* hidden. A finger holds the countdown and does not spread the stack: one spread as a tap
|
|
11188
|
+
* landed moved what it was tapping on.
|
|
11189
|
+
*/
|
|
11141
11190
|
readonly pointer: Schema.Boolean;
|
|
11191
|
+
readonly touch: Schema.Boolean;
|
|
11142
11192
|
readonly focus: Schema.Boolean;
|
|
11143
11193
|
readonly hidden: Schema.Boolean;
|
|
11144
11194
|
}>;
|
|
@@ -11153,7 +11203,7 @@ declare const Message$17: import("foldkit/message").MessageUnion<{
|
|
|
11153
11203
|
};
|
|
11154
11204
|
/** The pointer, focus or the page's being hidden, holding the stack or letting it go. */
|
|
11155
11205
|
readonly Held: {
|
|
11156
|
-
by: Schema.Literals<readonly ["pointer", "focus", "hidden"]>;
|
|
11206
|
+
by: Schema.Literals<readonly ["pointer", "touch", "focus", "hidden"]>;
|
|
11157
11207
|
on: Schema.Boolean;
|
|
11158
11208
|
};
|
|
11159
11209
|
readonly StartedClock: {
|
|
@@ -11250,13 +11300,13 @@ declare const dismiss: (model: Model$16, id: string) => Return$6;
|
|
|
11250
11300
|
/** The stack after `message`; the same Model when nothing changes. */
|
|
11251
11301
|
declare const update$12: (model: Model$16, message: Message$17) => Return$6;
|
|
11252
11302
|
/**
|
|
11253
|
-
* What holds the stack, as a Mount on its container: the
|
|
11254
|
-
* and leaving it, focus coming into it and going out of it, and the
|
|
11255
|
-
* hidden and shown. Opened on a hidden page, it says so at once.
|
|
11303
|
+
* What holds the stack, as a Mount on its container: the mouse, or a finger or a pen,
|
|
11304
|
+
* entering and leaving it, focus coming into it (not a tap's) and going out of it, and the
|
|
11305
|
+
* page hidden and shown. Opened on a hidden page, it says so at once.
|
|
11256
11306
|
*/
|
|
11257
11307
|
declare const Hold: Mount.MountDefinitionNoArgs<"ToastHold", {
|
|
11258
11308
|
readonly _tag: "HeldFact";
|
|
11259
|
-
readonly by: "focus" | "hidden" | "pointer";
|
|
11309
|
+
readonly by: "focus" | "hidden" | "pointer" | "touch";
|
|
11260
11310
|
readonly on: boolean;
|
|
11261
11311
|
}>;
|
|
11262
11312
|
/**
|
|
@@ -12591,6 +12641,10 @@ declare const Message$11: import("foldkit/message").MessageUnion<{
|
|
|
12591
12641
|
readonly Wheeled: {
|
|
12592
12642
|
deltaY: Schema.Number;
|
|
12593
12643
|
};
|
|
12644
|
+
/** Two fingers spread or brought together: their distance now over the last one's. */
|
|
12645
|
+
readonly Pinched: {
|
|
12646
|
+
ratio: Schema.Number;
|
|
12647
|
+
};
|
|
12594
12648
|
/** A key on the selection; `update` decides what it does, from the crop it holds. */
|
|
12595
12649
|
readonly PressedKey: {
|
|
12596
12650
|
key: Schema.String;
|